query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
11da0b2c8eaf84818f454d5c25516130
Interleave the bits of x and y. In the result, x and y occupy even and odd bitlevels, respectively.
[ { "docid": "f3b226fe641e14ef3001fff8c970d689", "score": "0.7235081", "text": "func Interleave(x, y uint32) uint64 {\n\treturn Spread(x) | (Spread(y) << 1)\n}", "title": "" } ]
[ { "docid": "3150c0eb5e14fdc5e1e258d7cdf1dc23", "score": "0.7504523", "text": "func interleave64(xlo uint32, ylo uint32) uint64 {\n\tvar x, y uint64 = uint64(xlo), uint64(ylo)\n\tx = (x | x<<s[5]) & b[4]\n\ty = (y | y<<s[5]) & b[4]\n\n\tx = (x | x<<s[4]) & b[3]\n\ty = (y | y<<s[4]) & b[3]\n\n\tx = (x | x<<s[3]) & b[2]\n\ty = (y | y<<s[3]) & b[2]\n\n\tx = (x | x<<s[2]) & b[1]\n\ty = (y | y<<s[2]) & b[1]\n\n\tx = (x | x<<s[1]) & b[0]\n\ty = (y | y<<s[1]) & b[0]\n\n\treturn x | (y << 1)\n}", "title": "" }, { "docid": "899aaa55d64baefaa284151e6e97e501", "score": "0.63242686", "text": "func InterleaveAsm(x, y uint32) uint64", "title": "" }, { "docid": "2c55bad1fc4ef662dbcab714d04d2ddd", "score": "0.61375177", "text": "func concatonate(x, y uint64) uint64 { return x | y }", "title": "" }, { "docid": "d4f863644fe23a3b423b6a551d686d5c", "score": "0.5617108", "text": "func deinterleave(X uint64) (uint32, uint32) {\n\treturn squash(X), squash(X >> 1)\n}", "title": "" }, { "docid": "399ba505dedf2939d4228a8e84480206", "score": "0.5159986", "text": "func pair(x, y *big.Int) [2]*big.Int { return [2]*big.Int{x, y} }", "title": "" }, { "docid": "7ea5c023496f252638c68097cfb47c35", "score": "0.50581956", "text": "func BitToCartesian(p int) (int, int) {\n\tx := p % FILES\n\ty := p / FILES\n\treturn x, y\n}", "title": "" }, { "docid": "c01febfa81a6b04c2d13dda62dc77fa7", "score": "0.5042504", "text": "func XorBytesBitwise(a,b []byte) []int{\n\tresult := make([]int,len(a)*8)\n\n\tfor i := range(a){\n\t\tbyte1_as_string_bits := strconv.FormatInt(int64(a[i]), 2)\n\t\tbyte1_as_string_bits = AddLeadingZerosToBitString(byte1_as_string_bits)\n\n\t\tbyte2_as_string_bits := strconv.FormatInt(int64(b[i]), 2)\n\t\tbyte2_as_string_bits = AddLeadingZerosToBitString(byte2_as_string_bits)\n\n\t\tfor j := range(byte1_as_string_bits){\n\t\t\tresult[i*8+j] = int(byte1_as_string_bits[j] ^ byte2_as_string_bits[j])\n\t\t}\n\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "35505b2c928e01ae0b1de4618224e78d", "score": "0.50095755", "text": "func swap(x, y int) (int, int) {\n\treturn y, x\n}", "title": "" }, { "docid": "a10897cff946fd1b05bb67d0e1a35435", "score": "0.5005839", "text": "func XOr(b1, b2 []byte) []byte {\n\tif len(b1) != len(b2) {\n\t\tpanic(\"buffers are not the same length\")\n\t}\n\n\tout := make([]byte, len(b1))\n\tfor i := 0; i < len(b1); i++ {\n\t\tout[i] = b1[i] ^ b2[i]\n\t}\n\treturn out\n}", "title": "" }, { "docid": "4045f5aff278494a90f122ca0ac5d9b5", "score": "0.5005327", "text": "func (b *Bits64) Intersection(s Bits64) {\n\t*b &= s\n}", "title": "" }, { "docid": "6ea5e489f66db130fabd451b483b5626", "score": "0.4965674", "text": "func invertRightShiftXor(y2 uint64, shift uint, mask uint64) uint64 {\n\tif shift <= 8 {\n\t\t// this algorithm only works if lower bytes don't influence higher bytes\n\t\tpanic(\"shift must be greater than 8\")\n\t}\n\n\tvar y uint64\n\n\tfor i := 0; i < 8; i++ {\n\t\t// shift to get the desired byte\n\t\tpos := uint((7 - i) * 8)\n\n\tguessbyte:\n\t\tfor j := 0; j <= 256; j++ {\n\t\t\tif j == 256 {\n\t\t\t\tpanic(\"cannot find result\")\n\t\t\t}\n\n\t\t\t// clear nth byte\n\t\t\ty &= ^(uint64(0xff) << pos)\n\n\t\t\t// set nth byte\n\t\t\ty |= uint64(j) << pos\n\n\t\t\t// DEBUG\n\t\t\t// fmt.Printf(\"set j=0x%01x 0x%016x\\n\", j, uint64(j)<<pos)\n\t\t\t// fmt.Printf(\"y = 0x%016x\\n\", y)\n\n\t\t\ty2test := y ^ ((y >> shift) & mask)\n\n\t\t\ttest := byte(y2>>pos) == byte(y2test>>pos)\n\n\t\t\tif test {\n\t\t\t\tbreak guessbyte\n\t\t\t}\n\t\t}\n\t}\n\n\treturn y\n}", "title": "" }, { "docid": "fcf1267a6a9ef06d786f2b6c0293a9d8", "score": "0.49631423", "text": "func invertLeftShiftXor(y2 uint64, shift uint, mask uint64) uint64 {\n\tif shift <= 8 {\n\t\t// this algorithm only works if lower bytes don't influence higher bytes\n\t\tpanic(\"shift must be greater than 8\")\n\t}\n\n\tvar y uint64\n\n\tfor i := 7; i >= 0; i-- {\n\t\t// shift to get the desired byte\n\t\tpos := uint((7 - i) * 8)\n\n\tguessbyte:\n\t\tfor j := 0; j <= 256; j++ {\n\t\t\tif j == 256 {\n\t\t\t\tpanic(\"cannot find result\")\n\t\t\t}\n\n\t\t\t// clear nth byte\n\t\t\ty &= ^(uint64(0xff) << pos)\n\n\t\t\t// set nth byte\n\t\t\ty |= uint64(j) << pos\n\n\t\t\t// DEBUG\n\t\t\t// fmt.Printf(\"set j=0x%01x 0x%016x\\n\", j, uint64(j)<<pos)\n\t\t\t// fmt.Printf(\"y = 0x%016x\\n\", y)\n\n\t\t\ty2test := y ^ ((y << shift) & mask)\n\n\t\t\ttest := byte(y2>>pos) == byte(y2test>>pos)\n\n\t\t\tif test {\n\t\t\t\tbreak guessbyte\n\t\t\t}\n\t\t}\n\t}\n\n\treturn y\n}", "title": "" }, { "docid": "3a85b47001a41700b27bcc9d107c7303", "score": "0.49586123", "text": "func Swapbits(val uint64, i, j uint8) uint64 {\n\tmaski := uint64(1)\n\tmaskj := uint64(1)\n\tmaski = 1 << i\n\tmaskj = 1 << j\n\tres1 := val & maski\n\tres2 := val & maskj\n\tif exor(res1, res2) {\n\t\tval = val ^ maski\n\t\tval = val ^ maskj\n\t}\n\treturn val\n}", "title": "" }, { "docid": "fad3c817e9285067966cbf8370f5585f", "score": "0.4958386", "text": "func deinterleave64(interleaved uint64) (uint32, uint32) {\n\tx, y := interleaved, interleaved>>1\n\n\tx = (x | (x >> s[0])) & b[0]\n\ty = (y | (y >> s[0])) & b[0]\n\n\tx = (x | (x >> s[1])) & b[1]\n\ty = (y | (y >> s[1])) & b[1]\n\n\tx = (x | (x >> s[2])) & b[2]\n\ty = (y | (y >> s[2])) & b[2]\n\n\tx = (x | (x >> s[3])) & b[3]\n\ty = (y | (y >> s[3])) & b[3]\n\n\tx = (x | (x >> s[4])) & b[4]\n\ty = (y | (y >> s[4])) & b[4]\n\n\tx = (x | (x >> s[5])) & b[5]\n\ty = (y | (y >> s[5])) & b[5]\n\n\tx = x | (y << 32)\n\n\treturn uint32(x), uint32(x >> 32)\n}", "title": "" }, { "docid": "f630a59a3230adc9e2d9ef4fd0eed95d", "score": "0.49573898", "text": "func twoCoords(tls *libc.TLS, p1 int32, p2 int32, mx uint32, pX0 uintptr, pX1 uintptr) { /* speedtest1.c:1385:13: */\n\tvar d uint32\n\tvar x0 uint32\n\tvar x1 uint32\n\tvar span uint32\n\n\tspan = ((mx / uint32(100)) + uint32(1))\n\tif (speedtest1_random(tls) % uint32(3)) == uint32(0) {\n\t\tspan = span * (uint32(p1))\n\t}\n\tif (speedtest1_random(tls) % uint32(p2)) == uint32(0) {\n\t\tspan = (mx / uint32(2))\n\t}\n\td = ((speedtest1_random(tls) % span) + uint32(1))\n\tx0 = ((speedtest1_random(tls) % (mx - d)) + uint32(1))\n\tx1 = (x0 + d)\n\t*(*uint32)(unsafe.Pointer(pX0)) = x0\n\t*(*uint32)(unsafe.Pointer(pX1)) = x1\n}", "title": "" }, { "docid": "c19e740a3bfca898c0742e6da3bfb972", "score": "0.48948312", "text": "func bitXor(x, y int) int {\n\t//return x^y\n\treturn (x & (^y)) | ((^x )& y)\n\t//return (^x& ^y) & ^(x& y)\n\t//return (x | y) & (^x | ^y)\n\t//return (X || Y) && !(X && Y)\n}", "title": "" }, { "docid": "40036a93874fa4bad9343d23a0a17be4", "score": "0.48596844", "text": "func MergePixels(pixels ...rune) rune {\n\tpixel := '2'\n\n\tfor _, p := range pixels {\n\t\tswitch p {\n\t\tcase '0', '1':\n\t\t\treturn p\n\t\t}\n\t}\n\n\treturn pixel\n}", "title": "" }, { "docid": "c6a057dc227a57b913335993c6854057", "score": "0.48363093", "text": "func (z nat) halfAdd(x, y nat) nat {\n\tm := len(x)\n\tn := len(y)\n\n\tswitch {\n\tcase m < n:\n\t\treturn z.add(y, x)\n\tcase m == 0:\n\t\t// n == 0 because m >= n; result is 0\n\t\treturn z.make(0)\n\tcase n == 0:\n\t\t// result is x\n\t\treturn z.set(x)\n\t}\n\t// m >= n > 0\n\n\tconst W2 = W / 2 // half-digit size in bits\n\tconst M2 = (1 << W2) - 1 // lower half-digit mask\n\n\tz = z.make(m + 1)\n\tvar c big.Word\n\tfor i := 0; i < n; i++ {\n\t\t// lower half-digit\n\t\tc += x[i]&M2 + y[i]&M2\n\t\td := c & M2\n\t\tc >>= W2\n\t\t// upper half-digit\n\t\tc += x[i]>>W2 + y[i]>>W2\n\t\tz[i] = c<<W2 | d\n\t\tc >>= W2\n\t}\n\tfor i := n; i < m; i++ {\n\t\t// lower half-digit\n\t\tc += x[i] & M2\n\t\td := c & M2\n\t\tc >>= W2\n\t\t// upper half-digit\n\t\tc += x[i] >> W2\n\t\tz[i] = c<<W2 | d\n\t\tc >>= W2\n\t}\n\tif c != 0 {\n\t\tz[m] = c\n\t\tm++\n\t}\n\treturn z[:m]\n}", "title": "" }, { "docid": "dd1dbc93389ce04d6d163fc210151b1c", "score": "0.4821849", "text": "func MergeNibbles(N1 byte, N2 byte) byte {\n\tN1 = N1 << 4\n\tN3 := N1 | N2\n\treturn N3\n}", "title": "" }, { "docid": "f8540876bff5f4c483da3b5956037146", "score": "0.48124093", "text": "func easyXorend(a, b []byte) []byte {\n\tdst := make([]byte, len(a))\n\txorend(dst, a, b)\n\treturn dst\n}", "title": "" }, { "docid": "63f2eae38438cc8d6ed8187468248045", "score": "0.4803172", "text": "func Spread(x uint32) uint64 {\n\tX := uint64(x)\n\tX = (X | (X << 16)) & 0x0000ffff0000ffff\n\tX = (X | (X << 8)) & 0x00ff00ff00ff00ff\n\tX = (X | (X << 4)) & 0x0f0f0f0f0f0f0f0f\n\tX = (X | (X << 2)) & 0x3333333333333333\n\tX = (X | (X << 1)) & 0x5555555555555555\n\treturn X\n}", "title": "" }, { "docid": "7298cd7e2b60c70caee9c40b683c7b9d", "score": "0.4796662", "text": "func Xor(a, b *big.Int) *big.Int {\n\twa := a.Bits()\n\twb := b.Bits()\n\tvar w []big.Word\n\tn := len(wa)\n\tif len(wa) > len(wb) {\n\t\tw = append(w, wa...)\n\t\tn = len(wb)\n\t} else {\n\t\tw = append(w, wb...)\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tw[i] = wa[i] ^ wb[i]\n\t}\n\ti := &big.Int{}\n\ti.SetBits(w)\n\treturn i\n}", "title": "" }, { "docid": "0e5ce494fc9dd10a7a6fe83546fba779", "score": "0.47928983", "text": "func joinBytes02(m, a, b []byte) {\n\tfor i := 0; i < len(m); i++ {\n\t\tc := a[i] ^ b[i]\n\t\tm[i] = ((c & 0xf0) >> 4) ^ c\n\t}\n}", "title": "" }, { "docid": "b1cb885107427870dabe8c4665088ceb", "score": "0.47788528", "text": "func Xor(a []byte, b []byte) []byte {\n\tc := make([]byte, len(a))\n\tfor i := 0; i < len(a); i++ {\n\t\tc[i] = a[i] ^ b[i]\n\t}\n\treturn c\n}", "title": "" }, { "docid": "f9f3d6ecf9e68e3fddcceecc9db32d88", "score": "0.47719893", "text": "func interleave(bytes []byte, size int) error {\n\tif size <= 0 {\n\t\treturn errors.New(\"size must be greater than 0\")\n\t}\n\tif len(bytes)%size != 0 {\n\t\treturn fmt.Errorf(\"size (%d) must be a divisor of array length (%d)\", size, len(bytes))\n\t}\n\n\treturn transpose(bytes, len(bytes)/size)\n}", "title": "" }, { "docid": "5a85e57693074c202d3ded5083ffddd4", "score": "0.47608495", "text": "func (z *Int) Xor(x, y *Int) *Int", "title": "" }, { "docid": "1b9237f95df88128b364da55315e16fa", "score": "0.47600642", "text": "func symMerge(data lessSwap, a, m, b int) {\n\tif m-a == 1 {\n\t\ti := m\n\t\tj := b\n\t\tfor i < j {\n\t\t\th := int(uint(i+j) >> 1)\n\t\t\tif data.Less(h, a) {\n\t\t\t\ti = h + 1\n\t\t\t} else {\n\t\t\t\tj = h\n\t\t\t}\n\t\t}\n\t\tfor k := a; k < i-1; k++ {\n\t\t\tdata.Swap(k, k+1)\n\t\t}\n\t\treturn\n\t}\n\tif b-m == 1 {\n\t\ti := a\n\t\tj := m\n\t\tfor i < j {\n\t\t\th := int(uint(i+j) >> 1)\n\t\t\tif !data.Less(m, h) {\n\t\t\t\ti = h + 1\n\t\t\t} else {\n\t\t\t\tj = h\n\t\t\t}\n\t\t}\n\t\tfor k := m; k > i; k-- {\n\t\t\tdata.Swap(k, k-1)\n\t\t}\n\t\treturn\n\t}\n\tmid := int(uint(a+b) >> 1)\n\tn := mid + m\n\tvar start, r int\n\tif m > mid {\n\t\tstart = n - b\n\t\tr = mid\n\t} else {\n\t\tstart = a\n\t\tr = m\n\t}\n\tp := n - 1\n\tfor start < r {\n\t\tc := int(uint(start+r) >> 1)\n\t\tif !data.Less(p-c, c) {\n\t\t\tstart = c + 1\n\t\t} else {\n\t\t\tr = c\n\t\t}\n\t}\n\tend := n - start\n\tif start < m && m < end {\n\t\trotate(data, start, m, end)\n\t}\n\tif a < start && start < mid {\n\t\tsymMerge(data, a, start, mid)\n\t}\n\tif mid < end && end < b {\n\t\tsymMerge(data, mid, end, b)\n\t}\n}", "title": "" }, { "docid": "db2f1a5a6e12d22062ce100c508ee805", "score": "0.47467148", "text": "func Multiply(x_, y_ string) string {\n\tx, err := strconv.ParseInt(x_, 2, 64)\n\tif err != nil {\n\t\tlog.Fatalln(\"Can't parse string to int:\", err)\n\t}\n\ty, err := strconv.ParseInt(y_, 2, 64)\n\tif err != nil {\n\t\tlog.Fatalln(\"Can't parse string to int:\", err)\n\t}\n\n\tfmt.Printf(\"%s * %s\\n\", x_, y_)\n\n\tsum := int64(0)\n\tt := int64(0)\n\n\txl, yl := uint(len(x_)), uint(len(y_))\n\tsumL := xl\n\n\trx := int64(uint64(-x) % (1 << xl))\n\tfmt.Printf(\"%0*b [-x]\\n\\n\", xl, rx)\n\n\tfor i := uint(0); i < yl; i++ {\n\t\tfmt.Printf(\"%0*b|%0*b|%b\\n\", sumL, sum, yl-i, y, t)\n\n\t\tswitch t - (y & 1) {\n\t\tcase 1:\n\t\t\tfmt.Printf(\"%0*b +[+x]\\n\", xl, x)\n\t\t\tsum += x << i\n\t\tcase -1:\n\t\t\tfmt.Printf(\"%0*b +[-x]\\n\", xl, rx)\n\t\t\tsum += rx << i\n\t\t}\n\n\t\tprintLine(xl + yl + 3)\n\n\t\tsum %= 1 << sumL\n\t\tfmt.Printf(\"%0*b|%0*b|%b\\n\", sumL, sum, yl-i, y, t)\n\n\t\tif i < yl-1 {\n\t\t\tsum = rightShift(sum, &sumL)\n\t\t}\n\n\t\tt = y & 1\n\t\ty >>= 1\n\t}\n\n\treturn fmt.Sprintf(\"%0*b\", sumL, sum)\n}", "title": "" }, { "docid": "271ce398ab1181b184e2f44d211c34b6", "score": "0.47176993", "text": "func PABSBm128int8(X1 []int8, X2 []int8)", "title": "" }, { "docid": "8a6f4de560323ee595dc0d43d3e930a1", "score": "0.4690692", "text": "func toByte(x, y int) (z []byte) {\n\tz = make([]byte, y)\n\tux := uint64(x)\n\tvar xByte byte\n\tfor i := y - 1; i >= 0; i-- {\n\t\txByte = byte(ux)\n\t\tz[i] = xByte & 0xff\n\t\tux = ux >> 8\n\t}\n\treturn\n}", "title": "" }, { "docid": "793ea4a49716eec3d753888faff45ceb", "score": "0.46864748", "text": "func merge(a *uint32, b uint32, r uint32) {\n\tswitch r % 4 {\n\tcase 0:\n\t\t*a = (*a * 33) + b\n\tcase 1:\n\t\t*a = (*a ^ b) * 33\n\tcase 2:\n\t\t*a = rotl32(*a, ((r>>16)%31)+1) ^ b\n\tdefault:\n\t\t*a = rotr32(*a, ((r>>16)%31)+1) ^ b\n\t}\n}", "title": "" }, { "docid": "4b8415fbb1f99edfb9f741de4bd110f2", "score": "0.4626252", "text": "func norm(x, y []byte) (a, b []byte) {\n\t// compute max length of x, y\n\txLen := len(x)\n\tyLen := len(y)\n\tlength := xLen\n\tif length < yLen {\n\t\tlength = yLen\n\t\ta := append(bytes.Repeat([]byte{byte(0)}, yLen-xLen), x...)\n\t\tb := y\n\t\treturn a, b\n\t} else if length > yLen {\n\t\tb := append(bytes.Repeat([]byte{byte(0)}, xLen-yLen), y...)\n\t\ta := x\n\t\treturn a, b\n\t}\n\treturn x, y\n\n}", "title": "" }, { "docid": "fb70a4a82ace842618ffa0f725f74e0a", "score": "0.46119827", "text": "func XorBytes(one, two []byte, len int) []byte {\n\tresult := make([]byte, len)\n\tfor i := 0; i < len; i++ {\n\t\tresult[i] = one[i] ^ two[i]\n\t}\n\treturn result\n}", "title": "" }, { "docid": "98c60e0964070315c37c136a4e1007ce", "score": "0.4609553", "text": "func PABSWm128int16(X1 []int16, X2 []int16)", "title": "" }, { "docid": "f7af6e4f266c463f5e3e1720dd39fe1b", "score": "0.4607782", "text": "func InlineXor(dst []byte, src []byte) {\n\tfor i := 0; i < len(dst); i++ {\n\t\tdst[i] ^= src[i]\n\t}\n}", "title": "" }, { "docid": "3ba432f076cf58ea3467d7ef8c706cc6", "score": "0.4606396", "text": "func Xor(b1, b2 []byte) ([]byte, error) {\n\tb1Len := len(b1)\n\tb2Len := len(b2)\n\n\tif b1Len < 1 {\n\t\treturn nil, errors.New(\"empty slice\")\n\t}\n\tif b2Len < 1 {\n\t\treturn nil, errors.New(\"empty slice\")\n\t}\n\tif b1Len != b2Len {\n\t\treturn nil, errors.New(\"length mismatch\")\n\t}\n\n\txored := make([]byte, len(b1))\n\tfor i := range xored {\n\t\txored[i] = b1[i] ^ b2[i]\n\t}\n\treturn xored, nil\n}", "title": "" }, { "docid": "a728f26349148844053a0a5c52e8ff4f", "score": "0.45876247", "text": "func PABSDm128int32(X1 []int32, X2 []int32)", "title": "" }, { "docid": "d12c0eaa3ef73db9b0cf3133feb2270a", "score": "0.45828024", "text": "func MapXtoY(t, x, y Field) bool {\n\ty2, c := t.New(), t.New()\n\tx.Set(t)\n\t// There is no bound, make up arbitrary one\n\tfor i := 0; i < 1000; i++ {\n\t\t// y2 = y^2 = x^3 + 4\n\t\ty2.Square(x)\n\t\ty2.Mul(y2, x)\n\t\ty2.Add(y2, c.GetB()) // 4u\n\n\t\tif y.Sqrt(y2) {\n\t\t\treturn true\n\t\t}\n\t\tx.Add(x, c.Cast(&One))\n\t}\n\treturn false\n}", "title": "" }, { "docid": "beb59bfa527ace9780f2687c748a8a37", "score": "0.45676908", "text": "func XorID(a, b internal.ID) internal.ID {\n\tresult := make([]byte, len(a.Id))\n\n\tfor i := 0; i < len(a.Id) && i < len(b.Id); i++ {\n\t\tresult[i] = a.Id[i] ^ b.Id[i]\n\t}\n\treturn internal.ID{Address: a.Address, Id: result}\n}", "title": "" }, { "docid": "e1cd67686ad1d1b53a8e7a94fa31f43c", "score": "0.45644355", "text": "func bitwiseOperations() {\n\tvar x uint8 = 1<<1 | 1<<5\n\tvar y uint8 = 1<<1 | 1<<2\n\n\t// Print a number’s binary digits; 08 modifies %b (an adverb!)\n\t// to pad the result with zeros to exactly 8 digits.\n\tfmt.Printf(\"%08b\\n\", x) // \"00100010\", the set {1, 5}\n\tfmt.Printf(\"%08b\\n\", y) // \"00000110\", the set {1, 2}\n\tfmt.Printf(\"%08b\\n\", x&y) // \"00000010\", the intersection {1}\n\tfmt.Printf(\"%08b\\n\", x|y) // \"00100110\", the union {1, 2, 5}\n\tfmt.Printf(\"%08b\\n\", x^y) // the symmetric difference {2, 5}\n\tfmt.Printf(\"%08b\\n\", x&^y) // &^ is a bit clear operator (AND NOT). output: \"00100000\", the difference {5}\n\n\tfor i := uint8(0); i < 8; i++ {\n\t\tif x&(1<<i) != 0 { // membership test\n\t\t\tfmt.Println(i) // \"1\", \"5\"\n\t\t}\n\t}\n\tfmt.Printf(\"%08b\\n\", x<<1) // \"01000100\", the set {2, 6}\n\tfmt.Printf(\"%08b\\n\", x>>1) // \"00010001\", the set {0, 4}\n}", "title": "" }, { "docid": "ecc7a92577edf787e18fa5d517f26570", "score": "0.45578152", "text": "func mixedStyle8(a int, b, c int) (d int, e int) { return a, c }", "title": "" }, { "docid": "5ee5381a5c3fa9e76667d9b23eaba572", "score": "0.45568612", "text": "func Marshal(curve elliptic.Curve, x, y *big.Int) []byte {\n\tbyteLen := (curve.Params().BitSize + 7) >> 3\n\n\tret := make([]byte, 1+byteLen)\n\tret[0] = 2 // compressed point\n\n\txBytes := x.Bytes()\n\tcopy(ret[1+byteLen-len(xBytes):], xBytes)\n\tret[0] += byte(y.Bit(0))\n\treturn ret\n}", "title": "" }, { "docid": "5ee5381a5c3fa9e76667d9b23eaba572", "score": "0.45568612", "text": "func Marshal(curve elliptic.Curve, x, y *big.Int) []byte {\n\tbyteLen := (curve.Params().BitSize + 7) >> 3\n\n\tret := make([]byte, 1+byteLen)\n\tret[0] = 2 // compressed point\n\n\txBytes := x.Bytes()\n\tcopy(ret[1+byteLen-len(xBytes):], xBytes)\n\tret[0] += byte(y.Bit(0))\n\treturn ret\n}", "title": "" }, { "docid": "50a56298e33735d5165eeb1c90195d25", "score": "0.45380333", "text": "func MultiplyByTwo(x int) int {\n\treturn x << 1\n}", "title": "" }, { "docid": "6643ea3a2318aa965cafbcf6c274bf96", "score": "0.4533255", "text": "func rangeBitwiseAnd2(m int, n int) int {\n\tstep := 0\n\t for m != n {\n\t\t m >>=1\n\t\t n >>=1\n\t\t step++\n\t }\n\t return m << step\n}", "title": "" }, { "docid": "4868eb8e8317bd93e8ee0e10b961f73e", "score": "0.45294788", "text": "func RevertLeftShiftOp2(y uint32, shift uint8, a uint32) uint32 {\r\n\tres := uint32(0)\r\n\tnumOfChunks := 32 / shift\r\n\r\n\t//mask with ones(length = shift) in the last position 000011\r\n\tbaseMask := uint32(0xffffffff >> (32 - shift))\r\n\r\n\tfor i := uint8(0); i <= numOfChunks; i++ {\r\n\t\t//mask shifted to the next bits of interest i = 0 : 000011 ; i = 1 : 001100\r\n\t\tmaskForChunk := uint32(baseMask << (shift * i))\r\n\r\n\t\t//new portion of final result\r\n\t\tchunk := y & maskForChunk // y4 y5 for i == 0\r\n\r\n\t\t//y[i] ^ (res[i+shift] & a[i])\r\n\t\ty ^= (chunk << shift) & a // y4 y5 (= x4 x5) shifted left for i == 0\r\n\r\n\t\tres |= chunk\r\n\t}\r\n\treturn res\r\n}", "title": "" }, { "docid": "e6c423af006a84b124925b9207513b25", "score": "0.45290282", "text": "func swap64(c []int64, x, y int) {\n\t//Swaps element of an array\n\tv := c[x]\n\tc[x] = c[y]\n\tc[y] = v\n}", "title": "" }, { "docid": "f6256373a26859b8f3b18a6b45db30d5", "score": "0.45249826", "text": "func cswap(b byte, x0, x1 *big.Int) {\n\tm := ^big.Word(b) + 1 // if b=0, ^b=11111111, ^b+1=0; if b=1, ^b=11111110, ^b+1=11111111\n\tv := new(big.Int).Xor(x1, x0)\n\tbits := v.Bits() // changing Bits() will modify the big.Int directly\n\tfor i := range bits {\n\t\tbits[i] = bits[i] & m\n\t}\n\tx0.Xor(x0, v)\n\tx1.Xor(x1, v)\n}", "title": "" }, { "docid": "366ff3d83461978164807362b33133a5", "score": "0.4515646", "text": "func div(x, y uint) (res uint, carry uint) {\n\tres, carry = 0, 0\n\txL := bitLen(x)\n\tyL := bitLen(y)\n\n\t// number of next bit to process\n\t// (count from low bit to high)\n\t// where 0 is lowest bit\n\ti := xL - yL\n\t// a part to div to y each iteration\n\tcarry = x >> (xL - yL)\n\tfor {\n\t\t// allocate a place for next digit of result\n\t\tres <<= 1\n\t\t// nothing to do if carry < y\n\t\t// we need to put 0 to res, and this is already done while alocating bit in result\n\t\tif carry >= y {\n\t\t\t// 1) write 1 to res\n\t\t\tres += 1\n\t\t\t// 2) substract y from carry so carry is again smaller than y\n\t\t\tcarry -= y\n\t\t}\n\t\tif i == 0 {\n\t\t\t// stop when processed all digits\n\t\t\tbreak\n\t\t}\n\t\t// prepare data for next iteration\n\t\ti--\n\t\t// add next bit to d for next iteration\n\t\tcarry <<= 1\n\t\tcarry += bitVal(x, i)\n\t}\n\n\treturn res, carry\n}", "title": "" }, { "docid": "918e068e4710a9dd8139124821d03f8d", "score": "0.4509153", "text": "func NumberSwap(x, y *int) {\n\t*x ^= *y\n\t*y ^= *x\n}", "title": "" }, { "docid": "1e5b5d4fc1ee482a5dc2c913c390d9fb", "score": "0.45062774", "text": "func (x Int) Mod(y Int) Int {\n\txSmall, xBig := x.get()\n\tySmall, yBig := y.get()\n\tif xBig != nil || yBig != nil {\n\t\txb, yb := x.bigInt(), y.bigInt()\n\n\t\tvar quo, rem big.Int\n\t\tquo.QuoRem(xb, yb, &rem)\n\t\tif (xb.Sign() < 0) != (yb.Sign() < 0) && rem.Sign() != 0 {\n\t\t\trem.Add(&rem, yb)\n\t\t}\n\t\treturn MakeBigInt(&rem)\n\t}\n\trem := xSmall % ySmall\n\tif (xSmall < 0) != (ySmall < 0) && rem != 0 {\n\t\trem += ySmall\n\t}\n\treturn makeSmallInt(rem)\n}", "title": "" }, { "docid": "1e8254d2d858873a63e542d0c68f0372", "score": "0.4505952", "text": "func Xor(a, b []byte) []byte {\n\tif len(a) != len(b) {\n\t\tpanic(errXorLength)\n\t}\n\n\tdst := make([]byte, len(a))\n\n\t// if the size is fixed, we could unroll the loop\n\tfor i, r := range a {\n\t\tdst[i] = r ^ b[i]\n\t}\n\n\treturn dst\n}", "title": "" }, { "docid": "c2ba04036f4d26ebaa618c1d5fa52901", "score": "0.44975308", "text": "func Intersect(x, y [][]string) [][]string {\n\tif Same(x, y) {\n\t\treturn x[:len(x):len(x)] // so append won't share\n\t}\n\tif len(x) == 0 || len(y) == 0 {\n\t\treturn [][]string{}\n\t}\n\tz := make([][]string, 0, ints.Min(len(x), len(y))/2) // ???\nouter:\n\tfor _, xs := range x {\n\t\tfor _, ys := range y {\n\t\t\tif eq(xs, ys) {\n\t\t\t\tz = append(z, xs)\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t}\n\t}\n\treturn z\n}", "title": "" }, { "docid": "c8e64b5782ad52f7b0ea6881844e2b46", "score": "0.44849938", "text": "func combine(a, b string, xoffset, yoffset int) string {\n\taW, aH := size(a)\n\tbW, bH := size(b)\n\tmaxW := max(aW, bW+xoffset)\n\tmaxH := max(aH, bH+yoffset)\n\taMap := toMap(a, aW)\n\tbMap := toMap(b, bW)\n\tvar sb strings.Builder\n\tfor y := 0; y < maxH; y++ {\n\t\tfor x := 0; x < maxW; x++ {\n\t\t\tif get(bMap, x-xoffset, y-yoffset, bW, bH) == ' ' {\n\t\t\t\tsb.WriteRune(get(aMap, x, y, aW, aH))\n\t\t\t} else {\n\t\t\t\tsb.WriteRune(get(bMap, x-xoffset, y-yoffset, bW, bH))\n\t\t\t}\n\t\t}\n\t\tsb.WriteRune('\\n')\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "253d022d73c1cb6c7b386472b0c81908", "score": "0.44844306", "text": "func swap(x,y string) (string, string){\n\treturn y, x\n}", "title": "" }, { "docid": "669d7351bcb54ad71b1082ce6a5d58ca", "score": "0.4478838", "text": "func Xor(a, b []byte) ([]byte, error) {\n\tif len(a) != len(b) {\n\t\treturn nil, fmt.Errorf(\"Xor called with two buffers of different sizes %d != %d \", len(a), len(b))\n\t}\n\tres := make([]byte, len(a))\n\tfor i, v := range a {\n\t\tres[i] = v ^ b[i]\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "43cd4097831916230346bb852ac93c6f", "score": "0.44660717", "text": "func swapUint64(n uint64) uint64 {\n\treturn ((n & 0x00000000000000FF) << 56) |\n\t\t((n & 0x000000000000FF00) << 40) |\n\t\t((n & 0x0000000000FF0000) << 24) |\n\t\t((n & 0x00000000FF000000) << 8) |\n\t\t((n & 0x000000FF00000000) >> 8) |\n\t\t((n & 0x0000FF0000000000) >> 24) |\n\t\t((n & 0x00FF000000000000) >> 40) |\n\t\t((n & 0xFF00000000000000) >> 56)\n}", "title": "" }, { "docid": "cc0a4106ad722bceb0a86ecd31f0be74", "score": "0.44642374", "text": "func multByTwo(out []byte, in []byte) {\n\tif len(in) != 16 {\n\t\tpanic(\"len must be 16\")\n\t}\n\ttmp := make([]byte, 16)\n\n\ttmp[0] = 2 * in[0]\n\tif in[15] >= 128 {\n\t\ttmp[0] = tmp[0] ^ 135\n\t}\n\tfor j := 1; j < 16; j++ {\n\t\ttmp[j] = 2 * in[j]\n\t\tif in[j-1] >= 128 {\n\t\t\ttmp[j] += 1\n\t\t}\n\t}\n\tcopy(out, tmp)\n}", "title": "" }, { "docid": "040a1a42da2dbe2b83b8d276ead8181e", "score": "0.4447558", "text": "func opI64Bitand(inputs []ast.CXValue, outputs []ast.CXValue) {\n\toutV0 := inputs[0].Get_i64() & inputs[1].Get_i64()\n\toutputs[0].Set_i64(outV0)\n}", "title": "" }, { "docid": "3dfcbf5c8cb9aa5f64b0fa763e89e5b6", "score": "0.44424483", "text": "func swap(x, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "3dfcbf5c8cb9aa5f64b0fa763e89e5b6", "score": "0.44424483", "text": "func swap(x, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "3dfcbf5c8cb9aa5f64b0fa763e89e5b6", "score": "0.44424483", "text": "func swap(x, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "3dfcbf5c8cb9aa5f64b0fa763e89e5b6", "score": "0.44424483", "text": "func swap(x, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "3dfcbf5c8cb9aa5f64b0fa763e89e5b6", "score": "0.44424483", "text": "func swap(x, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "b09040ddb56a4908358ba104fa45a388", "score": "0.44400832", "text": "func Xor(a, b []byte) (outBytes []byte, err error) {\n\tif len(a) != len(b) {\n\t\terr = errors.New(\"XOR inputs are not the same length\")\n\t\ta, b = matchByteSliceLengths(a, b)\n\t}\n\n\toutBytes = make([]byte, len(a))\n\n\tfor i := range outBytes {\n\t\toutBytes[i] = a[i] ^ b[i]\n\t}\n\n\treturn outBytes, err\n}", "title": "" }, { "docid": "2e6fadca554717451812422563d7f777", "score": "0.44376355", "text": "func (receiver T) YWYX() T {\n return T{\n receiver[y],\n receiver[w],\n receiver[y],\n receiver[x],\n }\n}", "title": "" }, { "docid": "95cfce22d89ed23fb8e5dd8dc1500f25", "score": "0.44337702", "text": "func (_ *GF) Add(x, y byte) byte { return x ^ y }", "title": "" }, { "docid": "2b9290873a9783ca5643bba17059de05", "score": "0.4429656", "text": "func andDemorgans(x, y int) int {\n\t// amd64:\"OR\",-\"AND\"\n\tz := ^x & ^y\n\treturn z\n}", "title": "" }, { "docid": "742bdbc3a18898ea1e1834cac339bea2", "score": "0.4424406", "text": "func (r *Region) Flip(x, y bool) {\n\tif x {\n\t\ttmp := r.u\n\t\tr.u = r.u2\n\t\tr.u2 = tmp\n\t}\n\tif y {\n\t\ttmp := r.v\n\t\tr.v = r.v2\n\t\tr.v2 = tmp\n\t}\n}", "title": "" }, { "docid": "8ae2a2d9b343d58adb902537a1b26ed0", "score": "0.44214606", "text": "func isLessOrEqual(x, y int) int{\n\tval := bang(bang(((x+ ^y)>>63)))\n\tx >>= 63\n\ty >>= 63\n\treturn (x| bang(y))&(x& bang(y)) | (val)\n}", "title": "" }, { "docid": "881fe922da29064ee8f51dfda90305b2", "score": "0.44195256", "text": "func marshalBitwiseUint64(fields []bool) uint64 {\n\tvar res uint64\n\tfor shift, set := range fields {\n\t\tif set {\n\t\t\tres |= 1 << uint(shift)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "7104481d448a54476955af23d9820969", "score": "0.4415498", "text": "func main() {\n\tx := 42\n\tfmt.Printf(\"Decimal: %d \\n\", x)\n\tfmt.Printf(\"Binary: %b \\n\", x)\n\tfmt.Printf(\"Hex: %#x \\n\", x)\n\n\ty := x << 1 // shift left 1 position (add 0 into the end of the x in binary)\n\tfmt.Printf(\"Decimal: %d \\n\", y)\n\tfmt.Printf(\"Binary: %b \\n\", y)\n\tfmt.Printf(\"Hex: %#x \\n\", y)\n}", "title": "" }, { "docid": "eaafb5a06e21581735bff90bf792f1db", "score": "0.44116598", "text": "func two_s_complement_encoding(buf []byte, bytes_size int) []byte {\n\n\t//two's complement carry\n\tvar carry uint8 = 1\n\n\t//use one additional byte for signing\n\tfor i := len(buf) - 1; i >= len(buf)-bytes_size; i-- {\n\t\tthisdigit := uint8(buf[i])\n\t\tthisdigit = thisdigit ^ 0xff\n\n\t\tif thisdigit == 0xff {\n\t\t\tif carry == 1 {\n\t\t\t\tthisdigit = 0\n\t\t\t\tcarry = 1\n\t\t\t} else {\n\t\t\t\tcarry = 0\n\t\t\t}\n\t\t} else {\n\t\t\tthisdigit = thisdigit + carry\n\t\t\tcarry = 0\n\t\t}\n\n\t\tbuf[i] = thisdigit\n\t}\n\n\t//put all remaining leading bytes to 0\n\tfor i := len(buf) - bytes_size - 1; i >= 0; i-- {\n\t\tbuf[i] = 0xff\n\t}\n\n\treturn buf\n}", "title": "" }, { "docid": "d80a1fa37966426c4ed3b7808215ffd0", "score": "0.44116527", "text": "func IntersectXUint16(x, y []uint16, ix []uint32) int {\n\tcnt := 0\n\tfor i, j := 0, 0; i < len(x) && j < len(y); {\n\t\tif x[i] == y[j] {\n\t\t\tix[cnt] = uint32(i)\n\t\t\tcnt++\n\t\t\ti++\n\t\t\tj++\n\t\t} else if x[i] > y[j] {\n\t\t\tj++\n\t\t} else {\n\t\t\ti++\n\t\t}\n\t}\n\n\treturn cnt\n}", "title": "" }, { "docid": "fae69b6209b2c91fad1fca1de8c442e6", "score": "0.44105712", "text": "func swap(x string, y string) (string, string) {\n\treturn y, x\n}", "title": "" }, { "docid": "131523bb28190a9847fd9dfac3627d50", "score": "0.43888715", "text": "func BSwap64(a uint64) uint64 {\n\tpanic(\"BSwap64 is not supported\")\n}", "title": "" }, { "docid": "2dd2f47884888b81d71906d60bb535c9", "score": "0.43868357", "text": "func even_spaced(x [1000]float64, y [1000]float64, no_cols int, space float64) ([]float64, []float64) {\r\n\td2 := make([]float64, no_cols)\r\n\tk := make([]float64, no_cols)\r\n\tm := make([]float64, no_cols)\r\n\td2_left := 0.0\r\n\tvar p0, p1, p_start, p_end, p_last, new_point [2]float64\r\n\tfor i := 0; i < no_cols; i++ {\r\n\t\tp0[0] = x[i]\r\n\t\tp0[1] = y[i]\r\n\t\tp1[0] = x[i+1]\r\n\t\tp1[1] = y[i+1]\r\n\t\td2[i] = line_square_length(p0, p1)\r\n\t\tk[i] = line_k(p0, p1)\r\n\t\tm[i] = line_m(p0, p1)\r\n\t}\r\n\t//\r\n\tline_index := 0\r\n\tpoint_index := 0\r\n\tcs_x := make([]float64, 1000)\r\n\tcs_y := make([]float64, 1000)\r\n\t// adds the first point from cs to cs_x and cs_y\r\n\tcs_x[point_index] = x[0]\r\n\tcs_y[point_index] = y[0]\r\n\tpoint_index++\r\n\t// take the first point in cs as a starting point\r\n\tcs_x[point_index] = x[0]\r\n\tcs_y[point_index] = y[0]\r\n\tfor i := 0; i < 100; i++ {\r\n\t\t//fmt.Println(\"i:\",i)\r\n\t\t//check if new point pass the center line (x=0)\r\n\t\tif cs_x[point_index] > 0 {\r\n\t\t\tcs_x[point_index] = 0\r\n\t\t\t//cs_y[point_index] = m[line_index]\r\n\t\t\tcs_y[point_index] = cs_y[point_index-1]\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tspace2 := space * space\r\n\t\t// calculating the square distance from the previous point ...\r\n\t\t// to the end of the line that it belongs to (d2_left)\r\n\t\tp_end[0] = x[line_index+1]\r\n\t\tp_end[1] = y[line_index+1]\r\n\t\tp_last[0] = cs_x[point_index]\r\n\t\tp_last[1] = cs_y[point_index]\r\n\t\td2_left = line_square_length(p_last, p_end)\r\n\t\tif space2 < d2_left {\r\n\t\t\t//... then the next point should be in this line\r\n\t\t\t// finds the point where the distance is space2\r\n\t\t\t// from the last point to the new point\r\n\t\t\tp_start[0] = cs_x[point_index]\r\n\t\t\tp_start[1] = cs_y[point_index]\r\n\t\t\tnew_point = calc_next(p_start, space2, k[line_index], m[line_index])\r\n\t\t\tpoint_index++\r\n\t\t\tcs_x[point_index] = new_point[0]\r\n\t\t\tcs_y[point_index] = new_point[1]\r\n\t\t\t/*\r\n\t\t\t\tfmt.Println(\"p_start\", p_start)\r\n\t\t\t\tfmt.Println(\"space2\", space2)\r\n\t\t\t\tfmt.Println(\"k[line_index]\", k[line_index])\r\n\t\t\t\tfmt.Println(\"m[line_index]\", m[line_index])\r\n\t\t\t\tfmt.Println(\"point index:\", point_index)\r\n\t\t\t\tfmt.Println(\"cs_x[point_index]:\",cs_x[point_index])\r\n\t\t\t\tfmt.Println(\"cs_y[point_index]:\",cs_y[point_index])\r\n\t\t\t*/\r\n\t\t} else {\r\n\t\t\tfor {\r\n\t\t\t\t// new space2 when looking at the next line...\r\n\t\t\t\tspace2 = (math.Sqrt(space2) - math.Sqrt(d2_left)) * (math.Sqrt(space2) - math.Sqrt(d2_left))\r\n\t\t\t\t// move index to next line\r\n\t\t\t\tline_index = line_index + 1\r\n\t\t\t\t// move to next line distance. Note that d2_left is the whole\r\n\t\t\t\t// line length since previous point was on the previous line\r\n\t\t\t\td2_left = d2[line_index]\r\n\t\t\t\tif space2 < d2_left {\r\n\t\t\t\t\t// ... then the next point should be in this line\r\n\t\t\t\t\t// finds the point where the distance is space2\r\n\t\t\t\t\tp_start[0] = x[line_index]\r\n\t\t\t\t\tp_start[1] = y[line_index]\r\n\r\n\t\t\t\t\tnew_point = calc_next(p_start, space2, k[line_index], m[line_index])\r\n\t\t\t\t\tpoint_index++\r\n\t\t\t\t\tcs_x[point_index] = new_point[0]\r\n\t\t\t\t\tcs_y[point_index] = new_point[1]\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t\tfmt.Println(\"Next line\")\r\n\t\t\t\t\t\tfmt.Println(\"p_start\", p_start)\r\n\t\t\t\t\t\tfmt.Println(\"space2\", space2)\r\n\t\t\t\t\t\tfmt.Println(\"k[line_index]\", k[line_index])\r\n\t\t\t\t\t\tfmt.Println(\"m[line_index]\", m[line_index])\r\n\t\t\t\t\t\tfmt.Println(\"point index:\", point_index)\r\n\t\t\t\t\t\tfmt.Println(\"cs_x[point_index]:\",cs_x[point_index])\r\n\t\t\t\t\t\tfmt.Println(\"cs_y[point_index]:\",cs_y[point_index])\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\tcs_x_out := cs_x[:(point_index + 1)]\r\n\tcs_y_out := cs_y[:(point_index + 1)]\r\n\treturn cs_x_out, cs_y_out\r\n}", "title": "" }, { "docid": "aecdfbad91a6455f358d9c40aacbe897", "score": "0.43772826", "text": "func Blend(dst []byte, src []byte) int", "title": "" }, { "docid": "bf3fabcf843104937cd7c97644f35eab", "score": "0.43712044", "text": "func Intersect[E comparable, S ~[]E](x, y S) S {\n\tif len(x) == 0 || len(y) == 0 {\n\t\treturn S{}\n\t}\n\tif slc.Same(x, y) {\n\t\treturn slices.Clip(x) // so append won't share\n\t}\n\tz := make(S, 0) //, min(len(x), len(y))/2) // ???\nouter:\n\tfor _, xe := range x {\n\t\tfor _, ye := range y {\n\t\t\tif xe == ye {\n\t\t\t\tz = append(z, xe)\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t}\n\t}\n\treturn z\n}", "title": "" }, { "docid": "59ae172d1494cf630890db19360c5730", "score": "0.43680382", "text": "func CreateNibbleMerged(N1 byte, N2 byte) byte {\n\t//prevent values over 15 and correct them to the highest value\n\tif N1 > 15 {\n\t\tN1 = 15\n\t}\n\tif N2 > 15 {\n\t\tN2 = 15\n\t}\n\tN1 = N1 << 4\n\tN3 := N1 | N2 //mix the numbers together\n\treturn N3\n}", "title": "" }, { "docid": "fe0d32b03f5499d370fa87950864886f", "score": "0.4351743", "text": "func (z *Int) Or(x, y *Int) *Int", "title": "" }, { "docid": "81d68bfde8e14c4fe2ead12655bd7abf", "score": "0.4350891", "text": "func Interp2d(x, y, z []float64) func(x, y float64) float64 {\n\txsorted, ysorted, zsorted := make([]float64, len(x)), make([]float64, len(x)), make([]float64, len(x))\n\tcopy(xsorted, x)\n\tcopy(ysorted, y)\n\tcopy(zsorted, z)\n\tall := &xyz{x: xsorted, y: ysorted, z: zsorted}\n\tsort.Sort(all)\n\treturn func(x, y float64) float64 {\n\t\tix0 := 0\n\t\tl := len(xsorted)\n\t\tix2 := l - 1\n\t\tfor i := range xsorted {\n\t\t\tif xsorted[i] > xsorted[ix0] && xsorted[i] <= x && xsorted[i] <= xsorted[ix2] {\n\t\t\t\tix0 = i\n\t\t\t}\n\t\t\tif xsorted[l-1-i] <= xsorted[ix2] && xsorted[l-1-i] >= x && xsorted[l-1-i] > xsorted[ix0] {\n\t\t\t\tix2 = l - 1 - i\n\t\t\t}\n\t\t}\n\t\tix1 := ix0\n\t\tfor ix1 < l && xsorted[ix1] == xsorted[ix0] {\n\t\t\tix1++\n\t\t}\n\t\tix3 := ix2\n\t\tfor ix3 < l && xsorted[ix3] == xsorted[ix2] {\n\t\t\tix3++\n\t\t}\n\t\tx2 := xsorted[ix2]\n\t\tfor ix2 > 1 && xsorted[ix2-1] == x2 {\n\t\t\tix2--\n\t\t}\n\t\tzxlow := Interp1d(ysorted[ix0:ix1], zsorted[ix0:ix1])(y)\n\t\tzxhi := Interp1d(ysorted[ix2:ix3], zsorted[ix2:ix3])(y)\n\t\t//fmt.Println(\"xlow\", xsorted[ix0:ix1], \"xhi\", xsorted[ix2:ix3], \"yxlow\", ysorted[ix0:ix1], \"yxhi\", ysorted[ix2:ix3], \"zxlow\", zsorted[ix0:ix1], zxlow, \"zxhi\", zsorted[ix2:ix3], zxhi)\n\t\treturn Interp1d([]float64{xsorted[ix0], xsorted[ix2]}, []float64{zxlow, zxhi})(x)\n\t}\n}", "title": "" }, { "docid": "57a9cf6b4db07f9e20a8a2c4520814a6", "score": "0.43486273", "text": "func addcarryxU64(x uint64, y uint64, carry uint1) (uint64, uint1) {\n var sum uint64\n var carryOut uint64\n sum, carryOut = bits.Add64(x, y, uint64(carry))\n return sum, uint1(carryOut)\n}", "title": "" }, { "docid": "26ad85ecc72c262d837102d7f05fd90d", "score": "0.4347531", "text": "func (id ID) XorID(other ID) ID {\n\tresult := make([]byte, len(id.Id))\n\n\tfor i := 0; i < len(id.Id) && i < len(other.Id); i++ {\n\t\tresult[i] = id.Id[i] ^ other.Id[i]\n\t}\n\treturn ID{Address: id.Address, Id: result}\n}", "title": "" }, { "docid": "fefb6815996649cb29a940aa7d07dc88", "score": "0.43468544", "text": "func interleave(np, zero int, xyz ...interface{}) (interface{}, error) {\n\t// ensure all components have equal length\n\tn := make([]int, len(xyz))\n\tfor i, v := range xyz {\n\t\tn[i] = reflect.ValueOf(v).Len()\n\t}\n\tfor _, v := range n {\n\t\tif v != np {\n\t\t\tmsg := \"Unequal component lengths: exp: %d got: %v\"\n\t\t\treturn nil, fmt.Errorf(msg, np, n)\n\t\t}\n\t}\n\n\tswitch xyz[0].(type) {\n\tcase []int:\n\t\tif len(xyz) == 2 {\n\t\t\tz := make([]int, np)\n\t\t\txyz = splice(zero, xyz, z)\n\t\t}\n\n\t\tres := make([]int, np*len(xyz))\n\n\t\tfor dim, x := range xyz {\n\t\t\tif _, ok := x.([]int); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Cannot cast %T to int\", x)\n\t\t\t}\n\t\t\tfor i, v := range x.([]int) {\n\t\t\t\tres[i*len(xyz)+dim] = v\n\t\t\t}\n\t\t}\n\t\treturn res, nil\n\tcase []float64:\n\t\tif len(xyz) == 2 {\n\t\t\tz := make([]float64, np)\n\t\t\txyz = splice(zero, xyz, z)\n\t\t}\n\n\t\tres := make([]float64, np*len(xyz))\n\n\t\tfor dim, x := range xyz {\n\t\t\tif _, ok := x.([]float64); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Cannot cast %T to float\", x)\n\t\t\t}\n\t\t\tfor i, v := range x.([]float64) {\n\t\t\t\tres[i*len(xyz)+dim] = v\n\t\t\t}\n\t\t}\n\t\treturn res, nil\n\tdefault:\n\t\tmsg := \"interleave is not implemented for type '%T'\"\n\t\treturn nil, fmt.Errorf(msg, xyz[0])\n\t}\n}", "title": "" }, { "docid": "05619d4f3128a7bbeb9b472422592198", "score": "0.434378", "text": "func Half(a, b uint8) (c, s uint8) {\n\treturn a & b, a ^ b\n}", "title": "" }, { "docid": "037edd3947a2566a9e130d12e079baaa", "score": "0.43379602", "text": "func testPolygonOverlappingPair(t *testing.T, a, b *Polygon) {\n\t// TODO(roberts): Uncomment once complement is completed\n\t// a1 := InitToComplement(a);\n\t// b1 := InitToComplement(b);\n\n\ttestPolygonOneOverlappingPair(t, a, b)\n\t// testPolygonOneOverlappingPair(t, a1, b1);\n\t// testPolygonOneOverlappingPair(t, a1, b);\n\t// testPolygonOneOverlappingPair(t, a, b1);\n}", "title": "" }, { "docid": "8cca33c101445e1dd023e1ebd1ca7859", "score": "0.43370357", "text": "func Swap(x *int, y *int) {\n\tvar temp int\n\ttemp = *x /* save the value at address x */\n\t*x = *y /* put y into x */\n\t*y = temp /* put temp into y */\n}", "title": "" }, { "docid": "80adac64ef5430e752b1662f48d1ad15", "score": "0.4332134", "text": "func cat(x, y []byte) []byte {\n\tbuf := bytes.NewBuffer(make([]byte, 0, len(x)+len(y)))\n\tbuf.Write(x)\n\tbuf.Write(y)\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "85d682e2a75ae56b268b7ab6ca997b19", "score": "0.43260673", "text": "func (z nat) add(x, y nat) nat {\n\tm := len(x)\n\tn := len(y)\n\n\tswitch {\n\tcase m < n:\n\t\treturn z.add(y, x)\n\tcase m == 0:\n\t\t// n == 0 because m >= n; result is 0\n\t\treturn z.make(0)\n\tcase n == 0:\n\t\t// result is x\n\t\treturn z.set(x)\n\t}\n\t// m >= n > 0\n\n\tz = z.make(m + 1)\n\tvar c big.Word\n\n\tfor i, xi := range x[:n] {\n\t\tyi := y[i]\n\t\tzi := xi + yi + c\n\t\tz[i] = zi\n\t\t// see \"Hacker's Delight\", section 2-12 (overflow detection)\n\t\tc = ((xi & yi) | ((xi | yi) &^ zi)) >> (W - 1)\n\t}\n\tfor i, xi := range x[n:] {\n\t\tzi := xi + c\n\t\tz[n+i] = zi\n\t\tc = (xi &^ zi) >> (W - 1)\n\t\tif c == 0 {\n\t\t\tcopy(z[n+i+1:], x[i+1:])\n\t\t\tbreak\n\t\t}\n\t}\n\tif c != 0 {\n\t\tz[m] = c\n\t\tm++\n\t}\n\treturn z[:m]\n}", "title": "" }, { "docid": "6b108381f716e1994e545e7288d1cbd9", "score": "0.43243015", "text": "func TestTwo_bits_successive(t *testing.T) {\n\tused = 0\n\t// should be to 0b11100100000110111110010000011011\n\t// or 4#3210012332100123\n\tsrc = 0xE41BE41B\n\tres := []uint8{3,2,1,0,0,1,2,3,3,2,1,0,0,1,2,3}\n\tfor i:=0; i<16; i++ {\n\t\tif res[i] != Two_bits(){\n\t\t\tt.Error(\"Two_bits isn't properly returning src.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "467bfee7415bad6f6c95fd72fc03bcc5", "score": "0.43203443", "text": "func (op UnOpK16) encodeY() Opcode {\n\treturn Opcode(op) << 24\n}", "title": "" }, { "docid": "aa1afac7c20ea03f1d19574236106ba6", "score": "0.43194526", "text": "func Union(x, y [][]string) [][]string {\n\tif len(x) == 0 {\n\t\treturn y[:len(y):len(y)] // so append won't share\n\t}\n\tif len(y) == 0 {\n\t\treturn x[:len(x):len(x)] // so append won't share\n\t}\n\tz := make([][]string, 0, len(x)+len(y))\n\tz = append(z, x...)\nouter:\n\tfor _, ys := range y {\n\t\tfor _, xs := range x {\n\t\t\tif eq(xs, ys) {\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t}\n\t\tz = append(z, ys)\n\t}\n\treturn z\n}", "title": "" }, { "docid": "154f051531797f3d5db3b4844026b238", "score": "0.4290579", "text": "func xtob(x1, x2 byte) (byte, bool) {\n\tb1 := xvalues[x1]\n\tb2 := xvalues[x2]\n\treturn (b1 << 4) | b2, b1 != 255 && b2 != 255\n}", "title": "" }, { "docid": "d6e3b96dd57873cff0ebb3028a5be3f6", "score": "0.42902535", "text": "func Iterate(src *Tape, bgLeft *Tape, bgRight *Tape) *Tape {\n\t//left, right := src.left+1, src.right+1\n\tleft, right := src.left, src.right\n\tout := Tape{\n\t\tleft, right,\n\t\tnil, nil,\n\t}\n\tlchunks, rchunks := out.leftChunks(), out.rightChunks()\n\tchunks := lchunks + rchunks\n\n\tx := make([]uint64, chunks)\n\ty := make([]uint64, chunks)\n\tz := make([]uint64, chunks)\n\n\tfor i := 0; i < lchunks; i++ {\n\t\tif i == 0 && len(src.dataL) < lchunks {\n\t\t\tcontinue\n\t\t}\n\t\ty[i] = src.dataL[lchunks-1-i]\n\t}\n\tfor i := lchunks; i < chunks; i++ {\n\t\tif i == chunks-1 && len(src.dataR) < rchunks {\n\t\t\tcontinue\n\t\t}\n\t\ty[i] = src.dataR[i-lchunks]\n\t}\n\n\tfor i := 0; i < chunks; i++ {\n\t\tx[i] = y[i] >> 1\n\t\tz[i] = y[i] << 1\n\t\tif i > 0 {\n\t\t\tz[i-1] += (y[i] >> 63) & 1\n\t\t\tx[i] += (y[i-1] & 1) << 63\n\t\t}\n\t}\n\tif bgLeft != nil {\n\t\tif bgLeft.AtLeft(src.left) > 0 {\n\t\t\tx[0] |= 1 << (uint(src.left+63) % 64)\n\t\t} else {\n\t\t\tx[0] &= ^(1 << (uint(src.left+63) % 64))\n\t\t}\n\t}\n\tif bgRight != nil {\n\t\tif bgLeft.AtRight(src.right) > 0 {\n\t\t\tz[chunks-1] |= 1 << ((64 - (uint(src.right) % 64)) % 64)\n\t\t} else {\n\t\t\tz[chunks-1] &= ^(1 << ((64 - (uint(src.right) % 64)) % 64))\n\t\t}\n\t}\n\n\tdataL := make([]uint64, lchunks)\n\tdataR := make([]uint64, rchunks)\n\n\tfor i := 0; i < lchunks; i++ {\n\t\tdataL[lchunks-1-i] = (^x[i] | ^y[i] | ^z[i]) & (y[i] | z[i])\n\t}\n\tfor i := lchunks; i < chunks; i++ {\n\t\tdataR[i-lchunks] = (^x[i] | ^y[i] | ^z[i]) & (y[i] | z[i])\n\t}\n\n\tout.dataL = dataL\n\tout.dataR = dataR\n\n\treturn &out\n\n}", "title": "" }, { "docid": "12c3deaab81c69b473b83163eb8c20f9", "score": "0.42859113", "text": "func calcXBasedOnY(y int) int {\n\treturn y / 3 * 2\n}", "title": "" }, { "docid": "a7e4207f66e3e0b3e56997acdf648415", "score": "0.42786825", "text": "func Xor(a, b internal.ID) internal.ID {\n\tresult := make([]byte, len(a.PublicKey))\n\n\tfor i := 0; i < len(a.PublicKey) && i < len(b.PublicKey); i++ {\n\t\tresult[i] = a.PublicKey[i] ^ b.PublicKey[i]\n\t}\n\treturn internal.ID{Address: a.Address, PublicKey: result}\n}", "title": "" }, { "docid": "cba2afb951dcbdb0465c6fdd8c16dc90", "score": "0.42778066", "text": "func bang(x int) (y int) {\n\t//x |= (x>>32)\n\tx |= (x>>16)\n\tx |= (x>>8)\n\tx |= (x>>4)\n\tx |= (x>>2)\n\tx |= (x>>1)\n\treturn ^x&0x1;\n}", "title": "" }, { "docid": "411967002f09f60e2f72d989381f4018", "score": "0.42770717", "text": "func gcd(x, y int64) int64 {\n\n\tfor y != 0 {\n\t\tx, y = y, x%y\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "bc220aadd1678cc27ff4989edb3767d2", "score": "0.42761937", "text": "func (receiver T) YXZW() T {\n return T{\n receiver[y],\n receiver[x],\n receiver[z],\n receiver[w],\n }\n}", "title": "" } ]
36f4434b56334a21a1b4e2e2c037be1f
/ NavigateToHistoryEntry navigates current page to the given history entry.
[ { "docid": "e1c907c42a20c64890de06517ca83f66", "score": "0.7987751", "text": "func (protocol *PageProtocol) NavigateToHistoryEntry(\n\tparams *page.NavigateToHistoryEntryParams,\n) <-chan *page.NavigateToHistoryEntryResult {\n\tresultChan := make(chan *page.NavigateToHistoryEntryResult)\n\tcommand := NewCommand(protocol.Socket, \"Page.navigateToHistoryEntry\", params)\n\tresult := &page.NavigateToHistoryEntryResult{}\n\n\tgo func() {\n\t\tresponse := <-protocol.Socket.SendCommand(command)\n\t\tif nil != response.Error && 0 != response.Error.Code {\n\t\t\tresult.Err = response.Error\n\t\t}\n\t\tresultChan <- result\n\t\tclose(resultChan)\n\t}()\n\n\treturn resultChan\n}", "title": "" } ]
[ { "docid": "acc19a1b72f67ab984fe5c31d6b05def", "score": "0.57907826", "text": "func (a *Client) UpdateHistoryEntry(params *UpdateHistoryEntryParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateHistoryEntryParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"updateHistoryEntry\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/history/{entryId}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/octet-stream\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateHistoryEntryReader{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 err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd7eed6105f975fbdf3e21a320e66ac9", "score": "0.5778948", "text": "func (m PageNavigateToHistoryEntry) Call(c Client) error {\n\treturn call(m.ProtoReq(), m, nil, c)\n}", "title": "" }, { "docid": "ae9b64bfe5cf581c9ff134d806e2e3b8", "score": "0.57390565", "text": "func (h *memoryCommandHistory) GetHistoryEntry(index int) ([]string, bool) {\n\tif index >= len(h.history) {\n\t\treturn nil, false\n\t}\n\n\treturn h.history[index], true\n}", "title": "" }, { "docid": "3a416be0b56d0b5e9fa779b2ce4c53c3", "score": "0.53942007", "text": "func (a *Client) DeleteHistoryEntry(params *DeleteHistoryEntryParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteHistoryEntryParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteHistoryEntry\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/history/{entryId}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/octet-stream\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteHistoryEntryReader{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 err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be05412c76464efc5484a2d456694c63", "score": "0.53806883", "text": "func (in *HistoryRecordEntry) DeepCopy() *HistoryRecordEntry {\n\tif in == nil { return nil }\n\tout := new(HistoryRecordEntry)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f17438124c3cee707a61746d5d24073a", "score": "0.501823", "text": "func (s *Server) ListEntryHistory(ctx context.Context, in *tpb.ListEntryHistoryRequest) (*tpb.ListEntryHistoryResponse, error) {\n\t// Get current epoch.\n\tignore := new(ctmap.SignedMapHead)\n\tcurrentEpoch, _, err := s.appender.Latest(ctx, &ignore)\n\tif err != nil {\n\t\tlog.Printf(\"Cannot get latest epoch: %v\", err)\n\t\treturn nil, grpc.Errorf(codes.Internal, \"Cannot get latest epoch\")\n\t}\n\n\tif err := validateListEntryHistoryRequest(in, currentEpoch); err != nil {\n\t\tlog.Printf(\"Invalid ListEntryHistoryRequest: %v\", err)\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"Invalid request\")\n\t}\n\n\t// Get all GetEntryResponse for all epochs in the range [start, start +\n\t// in.PageSize].\n\tresponses := make([]*tpb.GetEntryResponse, in.PageSize)\n\tfor i := range responses {\n\t\tresp, err := s.getEntry(ctx, in.UserId, in.Start+int64(i))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"getEntry failed for epoch %v: %v\", in.Start+int64(i), err)\n\t\t\treturn nil, grpc.Errorf(codes.Internal, \"GetEntry failed\")\n\t\t}\n\t\tresponses[i] = resp\n\t}\n\n\tnextStart := in.Start + int64(in.PageSize)\n\tif nextStart > currentEpoch {\n\t\tnextStart = 0\n\t}\n\n\treturn &tpb.ListEntryHistoryResponse{\n\t\tValues: responses,\n\t\tNextStart: nextStart,\n\t}, nil\n}", "title": "" }, { "docid": "74609c7a159954cdbdbb601a58a08ad0", "score": "0.49404114", "text": "func (view *View) GoToHistoryOffset(offset int) {\n\tC.ulViewGoToHistoryOffset(view.view, C.int(offset))\n}", "title": "" }, { "docid": "3fa04d4f8d558fad39d66eb92941ad70", "score": "0.48282892", "text": "func ToHistory(t *shared.History) *types.History {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.History{\n\t\tEvents: ToHistoryEventArray(t.Events),\n\t}\n}", "title": "" }, { "docid": "aad8d7a3015db78f0b6ae39a0dc0144f", "score": "0.47619647", "text": "func (a *App) HistoryExport(ctx context.Context, input *HistoryExportInput) error {\n\tzap.S().Infow(\"exporting history\")\n\n\tfilterSpec := createFilter(input.Filter)\n\tsetFlags := flags.ParseFlagMultiValueToMap(input.Set)\n\n\thistoryList, err := a.historyStore.GetAll()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting history list: %w\", err)\n\t}\n\terr = history.FilterHistory(historyList, filterSpec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"filtering history list: %w\", err)\n\t}\n\tvar historyExportList = &v1alpha1.HistoryEntryList{}\n\n\texportCount := 0\n\tfor i := range historyList.Items {\n\t\tnewEntry := processEntry(&historyList.Items[i], setFlags)\n\t\thistoryExportList.Items = append(historyExportList.Items, *newEntry)\n\t\texportCount++\n\t}\n\tzap.S().Infof(\"exporting %d entries\", exportCount)\n\terr = writeExportFile(input.File, historyExportList)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"writing export file: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6da1dfc0e2da6ac11a707d0784c5157", "score": "0.46728736", "text": "func (c *Client) AddressHistory(address string) (history *History, err error) {\r\n\r\n\tvar resp string\r\n\r\n\t// GET https://api.mattercloud.net/api/v3/main/address/<address>/history\r\n\tif resp, err = c.Request(\"address/\"+address+\"/history\", http.MethodGet, nil); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Check for error\r\n\tif c.LastRequest.StatusCode != http.StatusOK {\r\n\t\tvar apiError APIInternalError\r\n\t\tif err = json.Unmarshal([]byte(resp), &apiError); err != nil {\r\n\t\t\treturn\r\n\t\t}\r\n\t\terr = fmt.Errorf(\"error: %s\", apiError.ErrorMessage)\r\n\t\treturn\r\n\t}\r\n\r\n\t// Process the response\r\n\terr = json.Unmarshal([]byte(resp), &history)\r\n\treturn\r\n}", "title": "" }, { "docid": "688fe8fa1240ebbffb6cfa212a3389c7", "score": "0.46209714", "text": "func (k Keeper) getLastContractHistoryEntry(ctx sdk.Context, contractAddr sdk.AccAddress) types.ContractCodeHistoryEntry {\n\tprefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractCodeHistoryElementPrefix(contractAddr))\n\titer := prefixStore.ReverseIterator(nil, nil)\n\tdefer iter.Close()\n\n\tvar r types.ContractCodeHistoryEntry\n\tif !iter.Valid() {\n\t\t// all contracts have a history\n\t\tpanic(fmt.Sprintf(\"no history for %s\", contractAddr.String()))\n\t}\n\tk.cdc.MustUnmarshal(iter.Value(), &r)\n\treturn r\n}", "title": "" }, { "docid": "44f69c6a73a8a17c200e4320ab345afe", "score": "0.46058053", "text": "func AddHistory(name, search string) {\n\t//store last 10\n\tif h, ok := history[name]; ok {\n\t\t//ensure that it not duplicate\n\t\tfor _, k := range h {\n\t\t\tif k == search {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif len(h) == 10 {\n\t\t\thistory[name] = append(h[1:], search)\n\t\t} else {\n\t\t\thistory[name] = append(h, search)\n\t\t}\n\n\t} else {\n\t\thistory[name] = []string{\n\t\t\tsearch,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58b17cac7de619ece05ee20810043726", "score": "0.45992845", "text": "func (r *Radarr) GetHistoryPage(params *starr.PageReq) (*History, error) {\n\treturn r.GetHistoryPageContext(context.Background(), params)\n}", "title": "" }, { "docid": "994142c6f3904fa819ea8ef8da9af958", "score": "0.45664588", "text": "func (a *App) HistoryImport(ctx context.Context, input *HistoryImportInput) error {\n\tzap.S().Infow(\"importing history\")\n\n\tfilterSpec := createFilter(input.Filter)\n\tsetFlags := flags.ParseFlagMultiValueToMap(input.Set)\n\n\timportList, err := readImportFile(input.File)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading history import file: %w\", err)\n\t}\n\terr = history.FilterHistory(importList, filterSpec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"filtering history list: %w\", err)\n\t}\n\n\tvar historyList = &v1alpha1.HistoryEntryList{}\n\tif !input.Clean {\n\t\thistoryList, err = a.historyStore.GetAll()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting existing history list: %w\", err)\n\t\t}\n\t} else {\n\t\tzap.S().Info(\"deleting exiting history\")\n\t}\n\n\timportCount := 0\n\tfor i := range importList.Items {\n\t\tnewEntry := processEntry(&importList.Items[i], setFlags)\n\t\tinUse, index := checkAliasInUse(historyList, newEntry)\n\t\tif inUse {\n\t\t\tif input.Overwrite {\n\t\t\t\tzap.S().Infow(\"Entry with alias already exists, overwriting\", \"alias\", newEntry.Spec.Alias)\n\t\t\t\thistoryList.Items[index] = *newEntry\n\t\t\t\timportCount++\n\t\t\t} else {\n\t\t\t\tzap.S().Infow(\"Entry with alias already exists, skipping\", \"alias\", newEntry.Spec.Alias)\n\t\t\t}\n\t\t} else {\n\t\t\thistoryList.Items = append(historyList.Items, *newEntry)\n\t\t\timportCount++\n\t\t}\n\t}\n\tzap.S().Infof(\"Importing %d entries\", importCount)\n\n\terr = a.historyStore.SetHistoryList(historyList)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"storing history entries: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a24ef5c925051955f791bc2287bb2e41", "score": "0.45664328", "text": "func FromHistory(t *types.History) *shared.History {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &shared.History{\n\t\tEvents: FromHistoryEventArray(t.Events),\n\t}\n}", "title": "" }, { "docid": "92511a7c17a3915587b591707fa5cd46", "score": "0.45425618", "text": "func (a *Client) UpdateHistoryEntries(params *UpdateHistoryEntriesParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateHistoryEntriesParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"updateHistoryEntries\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/history\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/octet-stream\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateHistoryEntriesReader{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 err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4448fb4ca774cfbf5708dd51f01bfe64", "score": "0.45143884", "text": "func ToHistoryBranch(t *shared.HistoryBranch) *types.HistoryBranch {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.HistoryBranch{\n\t\tTreeID: t.TreeID,\n\t\tBranchID: t.BranchID,\n\t\tAncestors: ToHistoryBranchRangeArray(t.Ancestors),\n\t}\n}", "title": "" }, { "docid": "a537a34b46056cc2258bc5de801ce75e", "score": "0.44847134", "text": "func LookupHistory(ctx *pulumi.Context, args *LookupHistoryArgs, opts ...pulumi.InvokeOption) (*LookupHistoryResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupHistoryResult\n\terr := ctx.Invoke(\"google-native:toolresults/v1beta3:getHistory\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "2e4d5318e3c0c3d3c83423e380655e8a", "score": "0.4448942", "text": "func (f *DataLoader) MoveToHistoryThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID, deleted bool) error {\n\treturn f.databaseConnector.MoveToHistoryThing(ctx, thing, UUID, deleted)\n}", "title": "" }, { "docid": "44f94d59382492c7e139bcfc431c4624", "score": "0.4410546", "text": "func (n *Node) SetEntry(path string, entry Navigatable) {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\tif n.children == nil {\n\t\tn.children = make(map[string]Navigatable)\n\t}\n\n\tn.children[path] = entry\n}", "title": "" }, { "docid": "f595b95b3c389bd6847dc3109c202819", "score": "0.44056615", "text": "func ToHistoryEvent(t *shared.HistoryEvent) *types.HistoryEvent {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.HistoryEvent{\n\t\tEventID: t.GetEventId(),\n\t\tTimestamp: t.Timestamp,\n\t\tEventType: ToEventType(t.EventType),\n\t\tVersion: t.GetVersion(),\n\t\tTaskID: t.GetTaskId(),\n\t\tWorkflowExecutionStartedEventAttributes: ToWorkflowExecutionStartedEventAttributes(t.WorkflowExecutionStartedEventAttributes),\n\t\tWorkflowExecutionCompletedEventAttributes: ToWorkflowExecutionCompletedEventAttributes(t.WorkflowExecutionCompletedEventAttributes),\n\t\tWorkflowExecutionFailedEventAttributes: ToWorkflowExecutionFailedEventAttributes(t.WorkflowExecutionFailedEventAttributes),\n\t\tWorkflowExecutionTimedOutEventAttributes: ToWorkflowExecutionTimedOutEventAttributes(t.WorkflowExecutionTimedOutEventAttributes),\n\t\tDecisionTaskScheduledEventAttributes: ToDecisionTaskScheduledEventAttributes(t.DecisionTaskScheduledEventAttributes),\n\t\tDecisionTaskStartedEventAttributes: ToDecisionTaskStartedEventAttributes(t.DecisionTaskStartedEventAttributes),\n\t\tDecisionTaskCompletedEventAttributes: ToDecisionTaskCompletedEventAttributes(t.DecisionTaskCompletedEventAttributes),\n\t\tDecisionTaskTimedOutEventAttributes: ToDecisionTaskTimedOutEventAttributes(t.DecisionTaskTimedOutEventAttributes),\n\t\tDecisionTaskFailedEventAttributes: ToDecisionTaskFailedEventAttributes(t.DecisionTaskFailedEventAttributes),\n\t\tActivityTaskScheduledEventAttributes: ToActivityTaskScheduledEventAttributes(t.ActivityTaskScheduledEventAttributes),\n\t\tActivityTaskStartedEventAttributes: ToActivityTaskStartedEventAttributes(t.ActivityTaskStartedEventAttributes),\n\t\tActivityTaskCompletedEventAttributes: ToActivityTaskCompletedEventAttributes(t.ActivityTaskCompletedEventAttributes),\n\t\tActivityTaskFailedEventAttributes: ToActivityTaskFailedEventAttributes(t.ActivityTaskFailedEventAttributes),\n\t\tActivityTaskTimedOutEventAttributes: ToActivityTaskTimedOutEventAttributes(t.ActivityTaskTimedOutEventAttributes),\n\t\tTimerStartedEventAttributes: ToTimerStartedEventAttributes(t.TimerStartedEventAttributes),\n\t\tTimerFiredEventAttributes: ToTimerFiredEventAttributes(t.TimerFiredEventAttributes),\n\t\tActivityTaskCancelRequestedEventAttributes: ToActivityTaskCancelRequestedEventAttributes(t.ActivityTaskCancelRequestedEventAttributes),\n\t\tRequestCancelActivityTaskFailedEventAttributes: ToRequestCancelActivityTaskFailedEventAttributes(t.RequestCancelActivityTaskFailedEventAttributes),\n\t\tActivityTaskCanceledEventAttributes: ToActivityTaskCanceledEventAttributes(t.ActivityTaskCanceledEventAttributes),\n\t\tTimerCanceledEventAttributes: ToTimerCanceledEventAttributes(t.TimerCanceledEventAttributes),\n\t\tCancelTimerFailedEventAttributes: ToCancelTimerFailedEventAttributes(t.CancelTimerFailedEventAttributes),\n\t\tMarkerRecordedEventAttributes: ToMarkerRecordedEventAttributes(t.MarkerRecordedEventAttributes),\n\t\tWorkflowExecutionSignaledEventAttributes: ToWorkflowExecutionSignaledEventAttributes(t.WorkflowExecutionSignaledEventAttributes),\n\t\tWorkflowExecutionTerminatedEventAttributes: ToWorkflowExecutionTerminatedEventAttributes(t.WorkflowExecutionTerminatedEventAttributes),\n\t\tWorkflowExecutionCancelRequestedEventAttributes: ToWorkflowExecutionCancelRequestedEventAttributes(t.WorkflowExecutionCancelRequestedEventAttributes),\n\t\tWorkflowExecutionCanceledEventAttributes: ToWorkflowExecutionCanceledEventAttributes(t.WorkflowExecutionCanceledEventAttributes),\n\t\tRequestCancelExternalWorkflowExecutionInitiatedEventAttributes: ToRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(t.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes),\n\t\tRequestCancelExternalWorkflowExecutionFailedEventAttributes: ToRequestCancelExternalWorkflowExecutionFailedEventAttributes(t.RequestCancelExternalWorkflowExecutionFailedEventAttributes),\n\t\tExternalWorkflowExecutionCancelRequestedEventAttributes: ToExternalWorkflowExecutionCancelRequestedEventAttributes(t.ExternalWorkflowExecutionCancelRequestedEventAttributes),\n\t\tWorkflowExecutionContinuedAsNewEventAttributes: ToWorkflowExecutionContinuedAsNewEventAttributes(t.WorkflowExecutionContinuedAsNewEventAttributes),\n\t\tStartChildWorkflowExecutionInitiatedEventAttributes: ToStartChildWorkflowExecutionInitiatedEventAttributes(t.StartChildWorkflowExecutionInitiatedEventAttributes),\n\t\tStartChildWorkflowExecutionFailedEventAttributes: ToStartChildWorkflowExecutionFailedEventAttributes(t.StartChildWorkflowExecutionFailedEventAttributes),\n\t\tChildWorkflowExecutionStartedEventAttributes: ToChildWorkflowExecutionStartedEventAttributes(t.ChildWorkflowExecutionStartedEventAttributes),\n\t\tChildWorkflowExecutionCompletedEventAttributes: ToChildWorkflowExecutionCompletedEventAttributes(t.ChildWorkflowExecutionCompletedEventAttributes),\n\t\tChildWorkflowExecutionFailedEventAttributes: ToChildWorkflowExecutionFailedEventAttributes(t.ChildWorkflowExecutionFailedEventAttributes),\n\t\tChildWorkflowExecutionCanceledEventAttributes: ToChildWorkflowExecutionCanceledEventAttributes(t.ChildWorkflowExecutionCanceledEventAttributes),\n\t\tChildWorkflowExecutionTimedOutEventAttributes: ToChildWorkflowExecutionTimedOutEventAttributes(t.ChildWorkflowExecutionTimedOutEventAttributes),\n\t\tChildWorkflowExecutionTerminatedEventAttributes: ToChildWorkflowExecutionTerminatedEventAttributes(t.ChildWorkflowExecutionTerminatedEventAttributes),\n\t\tSignalExternalWorkflowExecutionInitiatedEventAttributes: ToSignalExternalWorkflowExecutionInitiatedEventAttributes(t.SignalExternalWorkflowExecutionInitiatedEventAttributes),\n\t\tSignalExternalWorkflowExecutionFailedEventAttributes: ToSignalExternalWorkflowExecutionFailedEventAttributes(t.SignalExternalWorkflowExecutionFailedEventAttributes),\n\t\tExternalWorkflowExecutionSignaledEventAttributes: ToExternalWorkflowExecutionSignaledEventAttributes(t.ExternalWorkflowExecutionSignaledEventAttributes),\n\t\tUpsertWorkflowSearchAttributesEventAttributes: ToUpsertWorkflowSearchAttributesEventAttributes(t.UpsertWorkflowSearchAttributesEventAttributes),\n\t}\n}", "title": "" }, { "docid": "401e60803194723c04b3f4b1a93774b5", "score": "0.4392923", "text": "func (c *Client) CreateHistory() (*History, error) {\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"/account/%s/own-history-keys\", c.EMail), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tif resp.StatusCode == http.StatusUnauthorized {\n\t\t\treturn nil, ErrUnauthorized\n\t\t}\n\t\treturn nil, fmt.Errorf(\"http response code: %s\", resp.Status)\n\n\t}\n\tbs, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar v createHistoryResponse\n\tjson.Unmarshal(bs, &v)\n\treturn &History{\n\t\tClient: c,\n\t\tID: v.Key,\n\t}, nil\n}", "title": "" }, { "docid": "7d2bf2fe8a73eb841a8c8050debb6743", "score": "0.4387008", "text": "func (a *Client) SetHistoryEntryNote(params *SetHistoryEntryNoteParams, authInfo runtime.ClientAuthInfoWriter) (*SetHistoryEntryNoteOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSetHistoryEntryNoteParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"setHistoryEntryNote\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/history/{entryId}/note\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/octet-stream\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &SetHistoryEntryNoteReader{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.(*SetHistoryEntryNoteOK)\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 setHistoryEntryNote: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "bd6a577009c3a4ebe0da75355fad643c", "score": "0.43584767", "text": "func ToVersionHistoryItem(t *shared.VersionHistoryItem) *types.VersionHistoryItem {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.VersionHistoryItem{\n\t\tEventID: t.GetEventID(),\n\t\tVersion: t.GetVersion(),\n\t}\n}", "title": "" }, { "docid": "c9ca6add20d7ab1dcf21dab2f3046caa", "score": "0.4336679", "text": "func (s *State) AppendHistory(item string) {\n\ts.historyMutex.Lock()\n\tdefer s.historyMutex.Unlock()\n\n\tif len(s.history) > 0 {\n\t\tif item == s.history[len(s.history)-1] {\n\t\t\treturn\n\t\t}\n\t}\n\ts.history = append(s.history, item)\n\tif len(s.history) > HistoryLimit {\n\t\ts.history = s.history[1:]\n\t}\n}", "title": "" }, { "docid": "55eb799458fad3004b3f6ed9149570f6", "score": "0.43326887", "text": "func FromHistoryEvent(t *types.HistoryEvent) *shared.HistoryEvent {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &shared.HistoryEvent{\n\t\tEventId: &t.EventID,\n\t\tTimestamp: t.Timestamp,\n\t\tEventType: FromEventType(t.EventType),\n\t\tVersion: &t.Version,\n\t\tTaskId: &t.TaskID,\n\t\tWorkflowExecutionStartedEventAttributes: FromWorkflowExecutionStartedEventAttributes(t.WorkflowExecutionStartedEventAttributes),\n\t\tWorkflowExecutionCompletedEventAttributes: FromWorkflowExecutionCompletedEventAttributes(t.WorkflowExecutionCompletedEventAttributes),\n\t\tWorkflowExecutionFailedEventAttributes: FromWorkflowExecutionFailedEventAttributes(t.WorkflowExecutionFailedEventAttributes),\n\t\tWorkflowExecutionTimedOutEventAttributes: FromWorkflowExecutionTimedOutEventAttributes(t.WorkflowExecutionTimedOutEventAttributes),\n\t\tDecisionTaskScheduledEventAttributes: FromDecisionTaskScheduledEventAttributes(t.DecisionTaskScheduledEventAttributes),\n\t\tDecisionTaskStartedEventAttributes: FromDecisionTaskStartedEventAttributes(t.DecisionTaskStartedEventAttributes),\n\t\tDecisionTaskCompletedEventAttributes: FromDecisionTaskCompletedEventAttributes(t.DecisionTaskCompletedEventAttributes),\n\t\tDecisionTaskTimedOutEventAttributes: FromDecisionTaskTimedOutEventAttributes(t.DecisionTaskTimedOutEventAttributes),\n\t\tDecisionTaskFailedEventAttributes: FromDecisionTaskFailedEventAttributes(t.DecisionTaskFailedEventAttributes),\n\t\tActivityTaskScheduledEventAttributes: FromActivityTaskScheduledEventAttributes(t.ActivityTaskScheduledEventAttributes),\n\t\tActivityTaskStartedEventAttributes: FromActivityTaskStartedEventAttributes(t.ActivityTaskStartedEventAttributes),\n\t\tActivityTaskCompletedEventAttributes: FromActivityTaskCompletedEventAttributes(t.ActivityTaskCompletedEventAttributes),\n\t\tActivityTaskFailedEventAttributes: FromActivityTaskFailedEventAttributes(t.ActivityTaskFailedEventAttributes),\n\t\tActivityTaskTimedOutEventAttributes: FromActivityTaskTimedOutEventAttributes(t.ActivityTaskTimedOutEventAttributes),\n\t\tTimerStartedEventAttributes: FromTimerStartedEventAttributes(t.TimerStartedEventAttributes),\n\t\tTimerFiredEventAttributes: FromTimerFiredEventAttributes(t.TimerFiredEventAttributes),\n\t\tActivityTaskCancelRequestedEventAttributes: FromActivityTaskCancelRequestedEventAttributes(t.ActivityTaskCancelRequestedEventAttributes),\n\t\tRequestCancelActivityTaskFailedEventAttributes: FromRequestCancelActivityTaskFailedEventAttributes(t.RequestCancelActivityTaskFailedEventAttributes),\n\t\tActivityTaskCanceledEventAttributes: FromActivityTaskCanceledEventAttributes(t.ActivityTaskCanceledEventAttributes),\n\t\tTimerCanceledEventAttributes: FromTimerCanceledEventAttributes(t.TimerCanceledEventAttributes),\n\t\tCancelTimerFailedEventAttributes: FromCancelTimerFailedEventAttributes(t.CancelTimerFailedEventAttributes),\n\t\tMarkerRecordedEventAttributes: FromMarkerRecordedEventAttributes(t.MarkerRecordedEventAttributes),\n\t\tWorkflowExecutionSignaledEventAttributes: FromWorkflowExecutionSignaledEventAttributes(t.WorkflowExecutionSignaledEventAttributes),\n\t\tWorkflowExecutionTerminatedEventAttributes: FromWorkflowExecutionTerminatedEventAttributes(t.WorkflowExecutionTerminatedEventAttributes),\n\t\tWorkflowExecutionCancelRequestedEventAttributes: FromWorkflowExecutionCancelRequestedEventAttributes(t.WorkflowExecutionCancelRequestedEventAttributes),\n\t\tWorkflowExecutionCanceledEventAttributes: FromWorkflowExecutionCanceledEventAttributes(t.WorkflowExecutionCanceledEventAttributes),\n\t\tRequestCancelExternalWorkflowExecutionInitiatedEventAttributes: FromRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(t.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes),\n\t\tRequestCancelExternalWorkflowExecutionFailedEventAttributes: FromRequestCancelExternalWorkflowExecutionFailedEventAttributes(t.RequestCancelExternalWorkflowExecutionFailedEventAttributes),\n\t\tExternalWorkflowExecutionCancelRequestedEventAttributes: FromExternalWorkflowExecutionCancelRequestedEventAttributes(t.ExternalWorkflowExecutionCancelRequestedEventAttributes),\n\t\tWorkflowExecutionContinuedAsNewEventAttributes: FromWorkflowExecutionContinuedAsNewEventAttributes(t.WorkflowExecutionContinuedAsNewEventAttributes),\n\t\tStartChildWorkflowExecutionInitiatedEventAttributes: FromStartChildWorkflowExecutionInitiatedEventAttributes(t.StartChildWorkflowExecutionInitiatedEventAttributes),\n\t\tStartChildWorkflowExecutionFailedEventAttributes: FromStartChildWorkflowExecutionFailedEventAttributes(t.StartChildWorkflowExecutionFailedEventAttributes),\n\t\tChildWorkflowExecutionStartedEventAttributes: FromChildWorkflowExecutionStartedEventAttributes(t.ChildWorkflowExecutionStartedEventAttributes),\n\t\tChildWorkflowExecutionCompletedEventAttributes: FromChildWorkflowExecutionCompletedEventAttributes(t.ChildWorkflowExecutionCompletedEventAttributes),\n\t\tChildWorkflowExecutionFailedEventAttributes: FromChildWorkflowExecutionFailedEventAttributes(t.ChildWorkflowExecutionFailedEventAttributes),\n\t\tChildWorkflowExecutionCanceledEventAttributes: FromChildWorkflowExecutionCanceledEventAttributes(t.ChildWorkflowExecutionCanceledEventAttributes),\n\t\tChildWorkflowExecutionTimedOutEventAttributes: FromChildWorkflowExecutionTimedOutEventAttributes(t.ChildWorkflowExecutionTimedOutEventAttributes),\n\t\tChildWorkflowExecutionTerminatedEventAttributes: FromChildWorkflowExecutionTerminatedEventAttributes(t.ChildWorkflowExecutionTerminatedEventAttributes),\n\t\tSignalExternalWorkflowExecutionInitiatedEventAttributes: FromSignalExternalWorkflowExecutionInitiatedEventAttributes(t.SignalExternalWorkflowExecutionInitiatedEventAttributes),\n\t\tSignalExternalWorkflowExecutionFailedEventAttributes: FromSignalExternalWorkflowExecutionFailedEventAttributes(t.SignalExternalWorkflowExecutionFailedEventAttributes),\n\t\tExternalWorkflowExecutionSignaledEventAttributes: FromExternalWorkflowExecutionSignaledEventAttributes(t.ExternalWorkflowExecutionSignaledEventAttributes),\n\t\tUpsertWorkflowSearchAttributesEventAttributes: FromUpsertWorkflowSearchAttributesEventAttributes(t.UpsertWorkflowSearchAttributesEventAttributes),\n\t}\n}", "title": "" }, { "docid": "e8038b8beb58cff15a9047153889d35b", "score": "0.43289694", "text": "func (storage *Storage) CreateEntry(entry shared.Entry, id string) error {\n\t// add the entry (path->url mapping)\n\tlogger.Debugf(\"Creating entry '%s' for user '%s'\", id)\n\n\traw, err := json.Marshal(entry)\n\tif err != nil {\n\t\terrmsg := fmt.Sprintf(\"Could not marshal JSON for entry %s: %v\", id, err)\n\n\t\tlogger.Error(errmsg)\n\t\treturn errors.Wrap(err, errmsg)\n\t}\n\n\tentryKey := entryKeyPrefix + id\n\tlogger.Debugf(\"Adding key '%s': %s\", entryKey, raw)\n\n\terr = storage.createValue(entryKey, raw, entry.GetExpiration())\n\tif err != nil {\n\t\terrmsg := fmt.Sprintf(\"Failed to set key '%s': %v\", entryKey, err)\n\n\t\tlogger.Error(errmsg)\n\t\treturn errors.Wrap(err, errmsg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f6629f9594b50215f1ecb293cfe03de5", "score": "0.43210927", "text": "func (p *Proxy) History(w http.ResponseWriter, r *http.Request) error {\n\tdata, err := body(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &services.GetHistoryRequest{}\n\tvar res *services.GetHistoryResponse\n\n\tif err := json.Unmarshal(data, req); err != nil {\n\t\treturn err\n\t}\n\n\terr = p.do(func(rlc services.ReleaseServiceClient) error {\n\t\tvar err error\n\t\tres, err = rlc.GetHistory(NewContext(), req)\n\t\treturn err\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata, err = json.Marshal(res)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(data)\n\treturn err\n}", "title": "" }, { "docid": "440332628331b3251a91696ff9a8893b", "score": "0.43183455", "text": "func AddHistory(s string) {\n}", "title": "" }, { "docid": "2aaeb0627132405455ffb5566c52a0b8", "score": "0.43075353", "text": "func FromHistoryBranch(t *types.HistoryBranch) *shared.HistoryBranch {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &shared.HistoryBranch{\n\t\tTreeID: t.TreeID,\n\t\tBranchID: t.BranchID,\n\t\tAncestors: FromHistoryBranchRangeArray(t.Ancestors),\n\t}\n}", "title": "" }, { "docid": "66517d021e68b1bc58af22a53a26ae8a", "score": "0.42968035", "text": "func (o LookupHistoryResultOutput) HistoryId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupHistoryResult) string { return v.HistoryId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "af10fe783b40ad7536bebd2b74cadf59", "score": "0.42865545", "text": "func (_IPFSStorage *IPFSStorageCallerSession) GetEntry(_address common.Address) (string, error) {\n\treturn _IPFSStorage.Contract.GetEntry(&_IPFSStorage.CallOpts, _address)\n}", "title": "" }, { "docid": "cdd55abd694527933aabaafdaa14d4c5", "score": "0.42854965", "text": "func (backend *Backend) CommitEntry(command Command) (interface{}, error) {\n\tswitch command.Action {\n\tcase \"CreateGiraffe\":\n\t\treturn backend.createGiraffe(command.Data)\n\tcase \"EditGiraffe\":\n\t\treturn backend.editGiraffe(command.Data)\n\tcase \"DeleteGiraffe\":\n\t\treturn backend.deleteGiraffe(command.Data)\n\t}\n\n\treturn nil, fmt.Errorf(\"unrecognized command %v\", command.Action)\n}", "title": "" }, { "docid": "e3488f91a4ae84cbf9199ec58a82d96e", "score": "0.4280898", "text": "func (o *GetStackInWorkspaceParams) SetEntry(entry []string) {\n\to.Entry = entry\n}", "title": "" }, { "docid": "acb75f450e5c639ea20bd825c711c128", "score": "0.42639846", "text": "func BackToWallpaper(ui *uiauto.Context) uiauto.Action {\n\treturn personalization.NavigateBreadcrumb(\"Wallpaper\", ui)\n}", "title": "" }, { "docid": "c1e64653258197706ab162e6f1acffd0", "score": "0.42469063", "text": "func ToVersionHistory(t *shared.VersionHistory) *types.VersionHistory {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.VersionHistory{\n\t\tBranchToken: t.BranchToken,\n\t\tItems: ToVersionHistoryItemArray(t.Items),\n\t}\n}", "title": "" }, { "docid": "ef03069c2a48948590d52aecd3976dc7", "score": "0.4235295", "text": "func ToHistoryBranchRange(t *shared.HistoryBranchRange) *types.HistoryBranchRange {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.HistoryBranchRange{\n\t\tBranchID: t.BranchID,\n\t\tBeginNodeID: t.BeginNodeID,\n\t\tEndNodeID: t.EndNodeID,\n\t}\n}", "title": "" }, { "docid": "34c6ec9ffe65cb99ea51ac66cd5694ff", "score": "0.42255425", "text": "func GetHistory(name string) ([]byte, error) {\n\tif h, ok := history[name]; ok {\n\t\treturn json.Marshal(h)\n\n\t}\n\n\treturn []byte{}, nil\n}", "title": "" }, { "docid": "d73c3cabf9ba799f459049768c1ce53c", "score": "0.42248386", "text": "func (p *Prium) History() error {\n\n\t// get snapshot history\n\tif err := p.SnapshotHistory(); err != nil {\n\t\treturn errors.Wrap(err, \"error getting snapshot history\")\n\t}\n\tfmt.Printf(\"backup list:\\n%s\", p.hist)\n\treturn nil\n}", "title": "" }, { "docid": "3e4d01d3b02743c470390cfb6da8dcd7", "score": "0.4215155", "text": "func (m *BrowserSharedCookie) SetHistory(value []BrowserSharedCookieHistoryable)() {\n err := m.GetBackingStore().Set(\"history\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6ac77978e6a105e849ef20339dc0f560", "score": "0.41901907", "text": "func updateHistory(history OutputHistory, newValue string, maxHistorySize int) OutputHistory {\n\n\ttimeStamp := time.Now()\n\ttimeStampStr := timeStamp.Format(types.TimeFormat)\n\n\tlatest := types.OutputValue{\n\t\tTimestamp: timeStampStr,\n\t\tEpochTime: timeStamp.Unix(),\n\t\tValue: newValue,\n\t}\n\tif history == nil {\n\t\thistory = make(OutputHistory, 1)\n\t} else {\n\t\t// make room at the front of the slice\n\t\thistory = append(history, latest)\n\t\tcopy(history[1:], history[0:])\n\t}\n\thistory[0] = latest\n\n\t// remove old entries, determine the max\n\tif maxHistorySize == 0 || len(history) < maxHistorySize {\n\t\tmaxHistorySize = len(history)\n\t}\n\t// cap at 24 hours\n\tfor ; maxHistorySize > 1; maxHistorySize-- {\n\t\tentry := history[maxHistorySize-1]\n\t\tentrytime := time.Unix(entry.EpochTime, 0)\n\t\tif timeStamp.Sub(entrytime) <= time.Hour*24 {\n\t\t\tbreak\n\t\t}\n\t}\n\thistory = history[0:maxHistorySize]\n\treturn history\n}", "title": "" }, { "docid": "80d56cd9d148be883f7b3b45d5523a44", "score": "0.41865978", "text": "func (o ToolResultsHistoryPtrOutput) HistoryId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ToolResultsHistory) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.HistoryId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "df1baaa09c5372bc3e36f006f8a56421", "score": "0.41678616", "text": "func (s *elaChainCode) getHistory(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting a search key\")\n\t}\n\n\tsearchKey := args[0]\n\tfmt.Printf(\"##### start History of Record: %s\\n\", searchKey)\n\n\tresultsIterator, err := stub.GetHistoryForKey(searchKey)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\n\t// buffer is a JSON array containing historic values for the marble\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tbArrayMemberAlreadyWritten := false\n\tfor resultsIterator.HasNext() {\n\t\tresponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t// Add a comma before array members, suppress it for the first array member\n\t\tif bArrayMemberAlreadyWritten == true {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\tbuffer.WriteString(\"{\\\"TxId\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(response.TxId)\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\", \\\"Value\\\":\")\n\t\t// if it was a delete operation on given key, then we need to set the\n\t\t//corresponding value null. Else, we will write the response.Value\n\t\t//as-is (as the Value itself a JSON marble)\n\t\tif response.IsDelete {\n\t\t\tbuffer.WriteString(\"null\")\n\t\t} else {\n\t\t\tbuffer.WriteString(string(response.Value))\n\t\t}\n\n\t\tbuffer.WriteString(\", \\\"Timestamp\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(time.Unix(response.Timestamp.Seconds, int64(response.Timestamp.Nanos)).String())\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\", \\\"IsDelete\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(strconv.FormatBool(response.IsDelete))\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\"}\")\n\t\tbArrayMemberAlreadyWritten = true\n\t}\n\tbuffer.WriteString(\"]\")\n\n\tfmt.Printf(\"- getHistoryForProductID returning:\\n%s\\n\", buffer.String())\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "9af6c9f9044c3452139ea5c328910d05", "score": "0.41640872", "text": "func (in *HistoryRecord) DeepCopy() *HistoryRecord {\n\tif in == nil { return nil }\n\tout := new(HistoryRecord)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ab2cda2babc8c97f0d8043dd03b8f595", "score": "0.41629407", "text": "func (s *HomeDirectoryMapEntry) SetEntry(v string) *HomeDirectoryMapEntry {\n\ts.Entry = &v\n\treturn s\n}", "title": "" }, { "docid": "0740af800a2c36cf5fbb15ec3045492f", "score": "0.41551042", "text": "func (q Query) History(\n\tctx context.Context,\n\tcode string,\n\tdate *time.Time,\n) ([]location.HistorySegment, error) {\n\tok, err := q.auth.HasPermission(\n\t\tctx,\n\t\tstrings.TrimSpace(code), location.PermHistory,\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"locgql: checking permissions\")\n\t}\n\tif !ok {\n\t\treturn nil, authutil.ErrAccessDenied\n\t}\n\n\tif date != nil {\n\t\treturn q.svc.GetHistory(ctx, *date)\n\t}\n\treturn q.svc.RecentHistory(ctx)\n}", "title": "" }, { "docid": "5b58ce1d223b90d5fde064a4fb5b7910", "score": "0.41481864", "text": "func findHistoryHandler(res http.ResponseWriter, req *http.Request) {\n\tsession, err := provider.GetSessionFromStore(req, res)\n\tif err != nil {\n\t\tfmt.Fprintln(res, err)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(req)\n\tobject := vars[\"object\"]\n\tid := vars[\"id\"]\n\tstrList := []string{\"banktransaction\",\n\t\t\t\t\t\t\t\t\t\t\t\"banktransfer\",\n\t\t\t\t\t\t\t\t\t\t\t\"contact\",\n\t\t\t\t\t\t\t\t\t\t\t\"creditnote\",\n\t\t\t\t\t\t\t\t\t\t\t\"expenseclaim\",\n\t\t\t\t\t\t\t\t\t\t\t\"invoice\",\n\t\t\t\t\t\t\t\t\t\t\t\"item\",\n\t\t\t\t\t\t\t\t\t\t\t\"overpayment\",\n\t\t\t\t\t\t\t\t\t\t\t\"payment\",\n\t\t\t\t\t\t\t\t\t\t\t\"prepayment\",\n\t\t\t\t\t\t\t\t\t\t\t\"purchaseorder\",\n\t\t\t\t\t\t\t\t\t\t\t\"receipt\",\n\t\t\t\t\t\t\t\t\t\t\t\"repeatinginvoice\"}\n\tif !helpers.StringInSlice(object, strList) {\n\t\t\tfmt.Fprintln(res, \"History not available on this entity\")\n\t\t\treturn\n\t}\n\thistoryCollection, err := accounting.FindHistoryAndNotes(provider, session, object, id)\n\tif err != nil {\n\t\tfmt.Fprintln(res, err)\n\t\treturn\n\t}\n\tt, _ := template.New(\"foo\").Parse(historyTemplate)\n\tt.Execute(res, historyCollection.HistoryRecords)\n}", "title": "" }, { "docid": "b992451fe78a49a54994bf1a004d57b6", "score": "0.41318434", "text": "func Navigate(url string) {\n\tnavigate(url)\n}", "title": "" }, { "docid": "402ac87ae1e636f8f55eceaa2398ca31", "score": "0.41234806", "text": "func (r *ProjectsLocationsAgentsEnvironmentsService) LookupEnvironmentHistory(name string) *ProjectsLocationsAgentsEnvironmentsLookupEnvironmentHistoryCall {\n\tc := &ProjectsLocationsAgentsEnvironmentsLookupEnvironmentHistoryCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "title": "" }, { "docid": "a165a8ca79d92f7aaa0bcdebdcb4ab69", "score": "0.41232535", "text": "func HistoryID(r *http.Request) string {\n\treturn ContextMap(r)[\"HistoryID\"]\n}", "title": "" }, { "docid": "1c9ca12c14949bec6f31892c7be620c8", "score": "0.41218245", "text": "func historyURL(t *task.Task, testName, uiRoot string) string {\n\treturn fmt.Sprintf(\"%v/task_history/%v/%v#%v=fail\",\n\t\tuiRoot, t.Project, url.PathEscape(t.Id), testName)\n}", "title": "" }, { "docid": "697a1d6e4a7b083af322d743d5855953", "score": "0.41189346", "text": "func (c *RealtimeChannel) History(params *PaginateParams) (*PaginatedResult, error) {\n\treturn c.client.rest.Channels.Get(c.Name, nil).History(params)\n}", "title": "" }, { "docid": "73e2cbd8a68046a188b14c9fbbb1acb4", "score": "0.4113779", "text": "func (changeEntry *ChangeEntry) ToLogEntry() string {\n\tstr := \"commit: \" + changeEntry.commit + \"\\n\"\n\tstr += \"Author: <\" + changeEntry.email + \">\\n\"\n str += fmt.Sprintf(\"Date: %s\\n\", time.Unix(int64(changeEntry.ts), 0).Format(time.UnixDate))\n\tstr += \"Service: \" + changeEntry.name + \"\\n\"\n\treturn str\n}", "title": "" }, { "docid": "2a39a05f96f756605ea8b86f6336943f", "score": "0.41113988", "text": "func (s *BaseFaultParserListener) EnterAccessHistory(ctx *AccessHistoryContext) {}", "title": "" }, { "docid": "3fea23e8bbc2ac7201d807bfcb8544d1", "score": "0.41096428", "text": "func (s *Server) History(message *chatterpb.HistoryRequest, stream chatterpb.Chatter_HistoryServer) error {\n\tctx := stream.Context()\n\tctx = context.WithValue(ctx, goa.MethodKey, \"history\")\n\tctx = context.WithValue(ctx, goa.ServiceKey, \"chatter\")\n\tp, err := s.HistoryH.Decode(ctx, message)\n\tif err != nil {\n\t\tvar en goa.GoaErrorNamer\n\t\tif errors.As(err, &en) {\n\t\t\tswitch en.GoaErrorName() {\n\t\t\tcase \"unauthorized\":\n\t\t\t\treturn goagrpc.NewStatusError(codes.Unauthenticated, err, goagrpc.NewErrorResponse(err))\n\t\t\tcase \"invalid-scopes\":\n\t\t\t\treturn goagrpc.NewStatusError(codes.Unauthenticated, err, goagrpc.NewErrorResponse(err))\n\t\t\t}\n\t\t}\n\t\treturn goagrpc.EncodeError(err)\n\t}\n\tep := &chatter.HistoryEndpointInput{\n\t\tStream: &HistoryServerStream{stream: stream},\n\t\tPayload: p.(*chatter.HistoryPayload),\n\t}\n\terr = s.HistoryH.Handle(ctx, ep)\n\tif err != nil {\n\t\tvar en goa.GoaErrorNamer\n\t\tif errors.As(err, &en) {\n\t\t\tswitch en.GoaErrorName() {\n\t\t\tcase \"unauthorized\":\n\t\t\t\treturn goagrpc.NewStatusError(codes.Unauthenticated, err, goagrpc.NewErrorResponse(err))\n\t\t\tcase \"invalid-scopes\":\n\t\t\t\treturn goagrpc.NewStatusError(codes.Unauthenticated, err, goagrpc.NewErrorResponse(err))\n\t\t\t}\n\t\t}\n\t\treturn goagrpc.EncodeError(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce5626967048999102c65e1ed140156c", "score": "0.41075382", "text": "func (tab *ChromeTab) Navigate(url string) error {\n\t// Navigate and especially waiting for the page to be ready is a cause for a race condition.\n\t// By locking the navigate funciton we ensure that this can't happen.\n\tnavLock.Lock()\n\tdefer navLock.Unlock()\n\ttab.URL = url\n\tklog.Infof(\"[%d] Reached target navigate.\", tab.ID)\n\tdefer klog.Infof(\"[%d] Navigated to url:\\t%s\", tab.ID, tab.URL)\n\n\ttask := chromedp.ActionFunc(func(ctx context.Context) error {\n\t\temulation.SetUserAgentOverride(userAgent).Do(ctx) // Set user agent\n\t\t_, _, _, err := page.Navigate(url).Do(ctx) // Navigate\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"[%d] Navigation error. %s\", tab.ID, err)\n\t\t\treturn err\n\t\t}\n\t\twait := waitLoadedOrTimeout(ctx) // Wait\n\t\t_, _, contentSize, err := page.GetLayoutMetrics().Do(ctx) // Get the size of the website\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttab.ContentSize = contentSize\n\t\treturn wait\n\t})\n\treturn chromedp.Run(*tab.Context, task)\n}", "title": "" }, { "docid": "37d2fe9f580757872fa6107b65bc9791", "score": "0.41044784", "text": "func (c *Cmd) SearchHistory(cmd *cobra.Command, args []string) {\n\n\tconfig := c.Config\n\tlog := config.Log\n\ts := service.NewService(log)\n\n\tconfig.CLI.Prompt(\"\\n\")\n\tconfig.CLI.Prompt(\"Starting backup for Search History...\\n\\n\")\n\n\tauth, err := s.Login(config.URL, config.Username, config.Password, config.CookiePort, config.Log)\n\tif err != nil {\n\t\tlog.Fatalf(\"fatal: Splunk Cloud Authentication: %+v\", err)\n\t}\n\tlog.Infof(\"Successful login to instance:\\n %s\", auth.URL)\n\tconfig.CLI.Prompt(fmt.Sprintf(\"√ Successful login with '%s' to instance:\\n %s\", auth.Username, auth.URL) + \"\\n\")\n\n\tchanr := make(chan interface{})\n\tgo func() {\n\t\tlog.Infof(\"Retrieving Search History for ALL searches ... \")\n\t\terr := s.ListSearchHistory(auth, chanr)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"fatal: couldn't retrieve search history lists: %s\", err)\n\t\t}\n\t\tconfig.CLI.Prompt(\"\\n√ Fetched search history listing for ALL search history ... \")\n\t}()\n\n\tfolder := filepath.Join(c.Config.OutputFolder, \"search\")\n\tabs, _ := filepath.Abs(folder)\n\tlog.Infof(\"Creating backup search history folder named '%s%c'\", abs, os.PathSeparator)\n\tos.MkdirAll(abs, 0777)\n\n\trawfolder := filepath.Join(c.Config.OutputFolder, \"search\", \"raw\")\n\trawabs, _ := filepath.Abs(rawfolder)\n\tlog.Infof(\"Creating backup search history folder named '%s%c'\", rawabs, os.PathSeparator)\n\tos.MkdirAll(rawabs, 0777)\n\n\tconfig.CLI.Prompt(fmt.Sprintf(\"\\n√ Beginning to write files folder '%s%c' .\", abs, os.PathSeparator))\n\n\tvar totalbytes = 0\n\tvar count = 0\n\tfor r := range chanr {\n\t\t//Type asseertation, because we use Generic interface{} for our channel.\n\t\trec := r.(service.SearchHistoryResult)\n\n\t\tconfig.CLI.Prompt(\".\")\n\n\t\tfilenamexml := filepath.Join(folder, fmt.Sprintf(\"%s.splunk.txt\", rec.SearchID))\n\t\tc.writeContent(rec.Search, filenamexml)\n\t\tc.touchFile(filenamexml, rec.Time)\n\n\t\tfilenamejson := filepath.Join(folder, \"raw\", fmt.Sprintf(\"%s.json\", rec.SearchID))\n\t\tc.writeContent(rec.RawEntry, filenamejson)\n\t\tc.touchFile(filenamejson, rec.Time)\n\n\t\ttotalbytes = totalbytes + len(rec.RawEntry)/1024\n\t\tlog.Debugf(\"%s, %dkb, %s, %s\", filenamexml, len(rec.RawEntry)/1024, auth.Username, rec.SearchID)\n\t\tcount = count + 1\n\t}\n\n\tlog.Info(fmt.Sprintf(\"Wrote '%d' search histories folder '%s%c'\", count, abs, os.PathSeparator))\n\tconfig.CLI.Prompt(fmt.Sprintf(\"\\n√ Wrote '%d' search histories \\n√ Writing files to folder '%s%c'\\n\", count, abs, os.PathSeparator))\n\n\tlog.Infof(\"Done. Wrote '%dkb' total of content. :-)\", totalbytes)\n\tconfig.CLI.Prompt(fmt.Sprintf(\" done! :-) \\n\\n√ Success! Wrote '%dkb' across '%d' search histories backup files.\\n\\n√ Congratulations you now have a local backup! :-)\\n\\n\", totalbytes, count))\n\n\treturn\n}", "title": "" }, { "docid": "164290439883b8afc5c6fb4c0eec2b90", "score": "0.41032335", "text": "func (_KyberStorage *KyberStorageCaller) KyberNetworkHistory(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _KyberStorage.contract.Call(opts, out, \"kyberNetworkHistory\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fc2cbd127f05465963a6684f9fd7df9b", "score": "0.40945342", "text": "func (a *Client) DeleteHistoryEntries(params *DeleteHistoryEntriesParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteHistoryEntriesParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteHistoryEntries\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/history\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/octet-stream\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteHistoryEntriesReader{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 err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7aafd075587685490a0fb2f0e9a8dc71", "score": "0.40899646", "text": "func retrieveGitHistory(repository *git.Repository, ref *plumbing.Reference) []*object.Commit {\n\tcIter, err := repository.Log(&git.LogOptions{From: ref.Hash()})\n\tCheckIfError(err)\n\n\tvar history []*object.Commit\n\terr = cIter.ForEach(func(commit *object.Commit) error {\n\t\thistory = append(history, commit)\n\t\treturn nil\n\t})\n\n\tCheckIfError(err)\n\n\treturn history\n}", "title": "" }, { "docid": "ba9d0ad81dee51a42dc29a309078fb5e", "score": "0.40850866", "text": "func NewHistoryHandler(endpoint goa.Endpoint, h goagrpc.StreamHandler) goagrpc.StreamHandler {\n\tif h == nil {\n\t\th = goagrpc.NewStreamHandler(endpoint, DecodeHistoryRequest)\n\t}\n\treturn h\n}", "title": "" }, { "docid": "5d2247bb2d41a16f09e8af9a783efa6a", "score": "0.4079706", "text": "func (_IPFSStorage *IPFSStorageSession) GetEntry(_address common.Address) (string, error) {\n\treturn _IPFSStorage.Contract.GetEntry(&_IPFSStorage.CallOpts, _address)\n}", "title": "" }, { "docid": "6b1c59bcfdf2cc22f1106c49b3f0206b", "score": "0.40782192", "text": "func (s *SimpleFSHandler) SimpleFSFolderEditHistory(\n\tctx context.Context, path keybase1.Path) (\n\tres keybase1.FSFolderEditHistory, err error) {\n\tcli, err := s.client(ctx)\n\tif err != nil {\n\t\treturn keybase1.FSFolderEditHistory{}, err\n\t}\n\tctx, cancel := s.wrapContextWithTimeout(ctx)\n\tdefer cancel()\n\treturn cli.SimpleFSFolderEditHistory(ctx, path)\n}", "title": "" }, { "docid": "59572b7d2332849dbbca139ecf557716", "score": "0.4075107", "text": "func (o ToolResultsHistoryResponsePtrOutput) HistoryId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ToolResultsHistoryResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.HistoryId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c5ec7718ffeba2aaa120952d774cd49f", "score": "0.4065866", "text": "func HistoryFile() (string, error) {\n\thome, e := homedir.Dir()\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\thistoryFileName := home + \"/.bk_history\"\n\treturn historyFileName, e\n}", "title": "" }, { "docid": "c03583015a3052dddbb18ed07bab5abd", "score": "0.4065597", "text": "func (m PageResetNavigationHistory) Call(c Client) error {\n\treturn call(m.ProtoReq(), m, nil, c)\n}", "title": "" }, { "docid": "9a3c5ac8e66291ad71bb64ce90740274", "score": "0.40620232", "text": "func (app *adapter) ToEntry(js []byte) (Entry, error) {\n\tins := new(entry)\n\terr := json.Unmarshal(js, ins)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ins, nil\n}", "title": "" }, { "docid": "3fbea681cdcf5eea4eee7d377241609a", "score": "0.40617374", "text": "func (t *Tab) MoveIn() {\n\tfocusedElement := t.Elements[t.FocusedElementIdx]\n\n\tif focusedElement.ToParent {\n\t\tt.MoveOut()\n\t} else if focusedElement.IsDirectory {\n\t\tcurrentpath, _ := t.pathTracker.Peek()\n\t\tt.Navigate(currentpath + \"\\\\\" + focusedElement.Name)\n\n\t} else {\n\n\t}\n}", "title": "" }, { "docid": "d50935315e1efe6054a7cb9d80a023aa", "score": "0.40606934", "text": "func (_ExchangeContract *ExchangeContractFilterer) WatchHistory(opts *bind.WatchOpts, sink chan<- *ExchangeContractHistory, sender []common.Address) (event.Subscription, error) {\n\n\tvar senderRule []interface{}\n\tfor _, senderItem := range sender {\n\t\tsenderRule = append(senderRule, senderItem)\n\t}\n\n\tlogs, sub, err := _ExchangeContract.contract.WatchLogs(opts, \"History\", senderRule)\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(ExchangeContractHistory)\n\t\t\t\tif err := _ExchangeContract.contract.UnpackLog(event, \"History\", 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": "b1996bd2245f3b8da5b0942e12c7a095", "score": "0.40477788", "text": "func (r *Radarr) GetHistoryPageContext(ctx context.Context, params *starr.PageReq) (*History, error) {\n\tvar output History\n\n\treq := starr.Request{URI: bpHistory, Query: params.Params()}\n\tif err := r.GetInto(ctx, req, &output); err != nil {\n\t\treturn nil, fmt.Errorf(\"api.Get(%s): %w\", &req, err)\n\t}\n\n\treturn &output, nil\n}", "title": "" }, { "docid": "d97a8611660a7deb467f9b6e3245cfbf", "score": "0.4040399", "text": "func (_IPFSStorage *IPFSStorageTransactor) SetEntry(opts *bind.TransactOpts, _hash string) (*types.Transaction, error) {\n\treturn _IPFSStorage.contract.Transact(opts, \"setEntry\", _hash)\n}", "title": "" }, { "docid": "983a143e76be4a6988275bafc1b4d2af", "score": "0.40392408", "text": "func FromHistoryBranchRange(t *types.HistoryBranchRange) *shared.HistoryBranchRange {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &shared.HistoryBranchRange{\n\t\tBranchID: t.BranchID,\n\t\tBeginNodeID: t.BeginNodeID,\n\t\tEndNodeID: t.EndNodeID,\n\t}\n}", "title": "" }, { "docid": "0733b2d73115ea9676bf972f840ebde3", "score": "0.4037749", "text": "func (o ToolResultsHistoryOutput) HistoryId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ToolResultsHistory) string { return v.HistoryId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "476af797bd1385240438ff4ac3e9f914", "score": "0.40369138", "text": "func (o *Command) SetHistory(v []CommandHistory) {\n\to.History = &v\n}", "title": "" }, { "docid": "dadf0ec1ef85a2f68ac668dcabb72c4a", "score": "0.4035429", "text": "func FromVersionHistory(t *types.VersionHistory) *shared.VersionHistory {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &shared.VersionHistory{\n\t\tBranchToken: t.BranchToken,\n\t\tItems: FromVersionHistoryItemArray(t.Items),\n\t}\n}", "title": "" }, { "docid": "12d70685a6b4a6a9187772a3977a2f6b", "score": "0.40323278", "text": "func (r *Radarr) GetHistory(records, perPage int) (*History, error) {\n\treturn r.GetHistoryContext(context.Background(), records, perPage)\n}", "title": "" }, { "docid": "28c1daf7c3f3b168f6d8afacd65990ea", "score": "0.40304482", "text": "func (n *Node) History(ch string, opts ...HistoryOption) (HistoryResult, error) {\n\tincActionCount(\"history\")\n\thistoryOpts := &HistoryOptions{}\n\tfor _, opt := range opts {\n\t\topt(historyOpts)\n\t}\n\tif n.config.UseSingleFlight {\n\t\tvar builder strings.Builder\n\t\tbuilder.WriteString(\"channel:\")\n\t\tbuilder.WriteString(ch)\n\t\tif historyOpts.Filter.Since != nil {\n\t\t\tbuilder.WriteString(\",offset:\")\n\t\t\tbuilder.WriteString(strconv.FormatUint(historyOpts.Filter.Since.Offset, 10))\n\t\t\tbuilder.WriteString(\",epoch:\")\n\t\t\tbuilder.WriteString(historyOpts.Filter.Since.Epoch)\n\t\t}\n\t\tbuilder.WriteString(\",limit:\")\n\t\tbuilder.WriteString(strconv.Itoa(historyOpts.Filter.Limit))\n\t\tbuilder.WriteString(\",reverse:\")\n\t\tbuilder.WriteString(strconv.FormatBool(historyOpts.Filter.Reverse))\n\t\tbuilder.WriteString(\",meta_ttl:\")\n\t\tbuilder.WriteString(historyOpts.MetaTTL.String())\n\t\tkey := builder.String()\n\n\t\tresult, err, _ := historyGroup.Do(key, func() (any, error) {\n\t\t\treturn n.history(ch, historyOpts)\n\t\t})\n\t\treturn result.(HistoryResult), err\n\t}\n\treturn n.history(ch, historyOpts)\n}", "title": "" }, { "docid": "b1b0eece5991edbf9cd4892b6747d880", "score": "0.40300646", "text": "func (s *tmesssrvc) History(ctx context.Context, p *tmess.HistoryPayload, stream tmess.HistoryServerStream) (err error) {\n\tstream.SetView(\"default\")\n\ts.logger.Print(\"tmess.history\")\n\treturn\n}", "title": "" }, { "docid": "2d3a2faa6f9d508e2011d6cf8fba2062", "score": "0.40272668", "text": "func (c *Client) FileContractHistory(id types.FileContractID) (history []wallet.FileContract, err error) {\n\terr = c.get(\"/filecontracts/\"+id.String(), &history)\n\treturn\n}", "title": "" }, { "docid": "bb9a22e078efd04fd9203e59c0ce9628", "score": "0.4020195", "text": "func (cl *Client) OrderHistory(\n\tpairName string,\n\tcount, from int64,\n) (openOrders []OrderHistory, err error) {\n\tif pairName == \"\" {\n\t\treturn nil, ErrInvalidPairName\n\t}\n\n\tparams := url.Values{}\n\tparams.Set(\"pair\", pairName)\n\n\tif count > 0 {\n\t\tparams.Set(\"count\", strconv.FormatInt(count, 10))\n\t}\n\tif from > 0 {\n\t\tparams.Set(\"from\", strconv.FormatInt(from, 10))\n\t}\n\n\trespBody, err := cl.curlPrivate(apiViewOrderHistory, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprintDebug(string(respBody))\n\n\trespOrderHistory := &respOrderHistory{}\n\n\terr = json.Unmarshal(respBody, respOrderHistory)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"OrderHistory: \" + err.Error())\n\t\treturn nil, err\n\t}\n\tif respOrderHistory.Success != 1 {\n\t\treturn nil, fmt.Errorf(\"OrderHistory: \" + respOrderHistory.Message)\n\t}\n\n\tprintDebug(respOrderHistory)\n\n\treturn respOrderHistory.Return.Orders, nil\n}", "title": "" }, { "docid": "e6aaabfb5df685c33d9a80e45b382ccd", "score": "0.40088648", "text": "func NewHistory() *History {\n\tthis := History{}\n\treturn &this\n}", "title": "" }, { "docid": "0f5e369e0486dc301d69bb41901a75f2", "score": "0.39998057", "text": "func (p *terminalPrompter) AppendHistory(command string) {\n\tp.State.AppendHistory(command)\n}", "title": "" }, { "docid": "0002799c775365c2d8425e3a74bf67da", "score": "0.39991122", "text": "func commandHistory(fuser histutil.Store, ch chan<- interface{}) error {\n\tif fuser == nil {\n\t\treturn errStoreOffline\n\t}\n\tcmds, err := fuser.AllCmds()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, cmd := range cmds {\n\t\tch <- vals.MakeMap(\"id\", strconv.Itoa(cmd.Seq), \"cmd\", cmd.Text)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cedfb9a668c5e4af3453f2eadc23fbed", "score": "0.39983425", "text": "func NewHistory(capacity int) *History {\n\treturn &History{ring.New(capacity)}\n}", "title": "" }, { "docid": "22117ee80e2f2764a7e4e2f74678fe6d", "score": "0.39967903", "text": "func History(history dispatch.History, log *logger.UPPLogger) func(w http.ResponseWriter, r *http.Request) {\n\terrMsg := \"Serving /__history request\"\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-type\", \"application/json; charset=UTF-8\")\n\n\t\tvar notifications []dispatch.NotificationResponse\n\t\tfor _, n := range history.Notifications() {\n\t\t\tnotifications = append(notifications, dispatch.CreateNotificationResponse(n, nil))\n\t\t}\n\n\t\thistoryJSON, err := dispatch.MarshalNotificationResponsesJSON(notifications)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warn(errMsg)\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = w.Write(historyJSON)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warn(errMsg)\n\t\t\thttp.Error(w, \"\", http.StatusInternalServerError)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "370be513ec228172c972d1b59174793e", "score": "0.39945915", "text": "func (u *urlTester) saveHistory(m *tb.Message) {\n\tu.db.Save(&history{\n\t\tWhen: time.Now(),\n\t\tUserID: m.Sender.ID,\n\t\tMessage: m.Text,\n\t})\n}", "title": "" }, { "docid": "4b26203de1b8b0c7f58bc5dcc287aea4", "score": "0.39937347", "text": "func (o *GetHistoryParams) WithEndAt(endAt *strfmt.Date) *GetHistoryParams {\n\to.SetEndAt(endAt)\n\treturn o\n}", "title": "" }, { "docid": "901fb444e102c5b4dc7171c40a6f400c", "score": "0.39895678", "text": "func (d *KeyValue) SetEntry(key string, entry Encodable) {\n\tif d.entryMap == nil {\n\t\td.entryMap = make(map[string]Encodable)\n\t}\n\n\td.entryMap[key] = entry\n}", "title": "" }, { "docid": "cbfb380e07f080031cad5d45ee029d76", "score": "0.3988127", "text": "func (s *State) WriteHistory(w io.Writer) (num int, err error) {\n\ts.historyMutex.RLock()\n\tdefer s.historyMutex.RUnlock()\n\n\tfor _, item := range s.history {\n\t\t_, err := fmt.Fprintln(w, item)\n\t\tif err != nil {\n\t\t\treturn num, err\n\t\t}\n\t\tnum++\n\t}\n\treturn num, nil\n}", "title": "" }, { "docid": "a98aac790158513134aca557cc0e9e3a", "score": "0.3985759", "text": "func WalkCommitHistory(c *Commit, cb func(*Commit) error) error {\n\tw := &commitWalker{\n\t\tseen: make(map[plumbing.Hash]bool),\n\t\tstack: make([]*CommitIter, 0),\n\t\tstart: c,\n\t\tcb: cb,\n\t}\n\n\treturn w.walk()\n}", "title": "" }, { "docid": "a3ad39b4c6c3c7246ead065935f4de64", "score": "0.39847964", "text": "func NewForwardEntry(ctx *pulumi.Context,\n\tname string, args *ForwardEntryArgs, opts ...pulumi.ResourceOption) (*ForwardEntry, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ExternalIp == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ExternalIp'\")\n\t}\n\tif args.ExternalPort == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ExternalPort'\")\n\t}\n\tif args.ForwardTableId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ForwardTableId'\")\n\t}\n\tif args.InternalIp == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InternalIp'\")\n\t}\n\tif args.InternalPort == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InternalPort'\")\n\t}\n\tif args.IpProtocol == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'IpProtocol'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ForwardEntry\n\terr := ctx.RegisterResource(\"alicloud:vpc/forwardEntry:ForwardEntry\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "2ebe3d2dc5911306bd9074470b0a35f2", "score": "0.3977053", "text": "func (o *Historyentry) 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": "88ddeaab68d0fd38592dcc9a8438c0e1", "score": "0.39768043", "text": "func EntryToValue(e *goukv.Entry) Value {\n\tval := Value{\n\t\tValue: e.Value,\n\t\tExpires: nil,\n\t}\n\n\tif e.TTL > 0 {\n\t\texpires := time.Now().Add(e.TTL)\n\t\tval.Expires = &expires\n\t}\n\n\treturn val\n}", "title": "" }, { "docid": "9bb5ed3fb64297eef69bacd636b6db0d", "score": "0.39689463", "text": "func TestHistory(t *testing.T) {\n\ttt := []struct {\n\t\tinput string\n\t\texpected History\n\t}{\n\t\t{\"\", History{}},\n\t\t{\"A\", History{'A': 1}},\n\t\t{\"AA\", History{'A': 2}},\n\t\t{\"ACGT\", History{'A': 1, 'C': 1, 'G': 1, 'T': 1}},\n\t\t{\"AB\", History{'A': 1}}, // B should be ignored because it is not A,C,G, or T\n\t}\n\n\tfor _, tc := range tt {\n\t\tt.Run(tc.input, func(t *testing.T) {\n\t\t\tstream := strings.NewReader(tc.input)\n\t\t\trecorder := NewRecorder(stream)\n\n\t\t\t// read all data through the recorder\n\t\t\tbytes, err := ioutil.ReadAll(recorder)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Equal(t, tc.input, string(bytes))\n\n\t\t\trecordedHistory := recorder.History()\n\t\t\tassert.Equal(t, tc.expected, recordedHistory)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "fb39c8c2e9cfb8bff92a625848bc60e1", "score": "0.39681962", "text": "func (sc *BuyerContract) History(ctx contractapi.TransactionContextInterface, key string) ([]BuyerHistory, error) {\n\n\titer, err := ctx.GetStub().GetHistoryForKey(key)\n\tif err != nil {\n return nil, err\n\t}\n\tdefer func() { _ = iter.Close() }()\n\n\tvar results []BuyerHistory\n\tfor iter.HasNext() {\n\t\tstate, err := iter.Next()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tentryObj := new(BuyerObj)\n\t\tif errNew := json.Unmarshal(state.Value, entryObj); errNew != nil {\n\t\t\treturn nil, errNew\n\t\t}\n\n\t\tentry := BuyerHistory{\n\t\t\tTxID:\t\tstate.GetTxId(),\n\t\t\tTimestamp:\ttime.Unix(state.GetTimestamp().GetSeconds(), 0),\n\t\t\tBuyer:\tentryObj,\n\t\t}\n\n\t\tresults = append(results, entry)\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "faf4e8c8463da31ff53aa900d8c10f61", "score": "0.39648914", "text": "func InsertEntry(e Entry, db *Database) {\n\tlog.Println(\"Key-Value-Store: Inserting Entry into slice\")\n\tdb.entrydb[e.Key] = &e // Pass in mutable reference to the entry\n}", "title": "" }, { "docid": "780e7d297adef2a01715ba63474905c7", "score": "0.39633322", "text": "func (r *checkImpl) History(p schema.CheckHistoryFieldResolverParams) (interface{}, error) {\n\tcheck := p.Source.(*types.Check)\n\thistory := check.History\n\n\tlength := clampInt(p.Args.First, 0, len(history))\n\treturn history[0:length], nil\n}", "title": "" }, { "docid": "1b8815067d2088ebcadbc85cc9851935", "score": "0.39617673", "text": "func orderHistory(c *bm.Context) {\n\tvar (\n\t\terr error\n\t\tt int64\n\t\thistory *model.ArgOrderHistory\n\t\tdata []*model.PendantOrderInfo\n\t\tcount map[string]int64\n\t\treq = c.Request\n\t\tparams = req.Form\n\t\tmidStr = params.Get(\"mid\")\n\t\tpidStr = params.Get(\"pid\")\n\t\torderID = params.Get(\"orderID\")\n\t\tpayID = params.Get(\"payID\")\n\t\tpayType = params.Get(\"payType\")\n\t\tstatus = params.Get(\"status\")\n\t\tstartTime = params.Get(\"start_time\")\n\t\tendTime = params.Get(\"end_time\")\n\t\tpage = params.Get(\"page\")\n\t)\n\tif midStr == \"\" {\n\t\tc.JSON(nil, ecode.RequestErr)\n\t\treturn\n\t}\n\thistory = new(model.ArgOrderHistory)\n\tif history.Mid, err = strconv.ParseInt(midStr, 10, 64); err != nil || history.Mid <= 0 {\n\t\tc.JSON(nil, ecode.RequestErr)\n\t\treturn\n\t}\n\tif pidStr != \"\" {\n\t\tif t, err = strconv.ParseInt(pidStr, 10, 64); err != nil {\n\t\t\tc.JSON(nil, ecode.RequestErr)\n\t\t\treturn\n\t\t}\n\t\thistory.Pid = t\n\t}\n\tif orderID != \"\" {\n\t\thistory.OrderID = orderID\n\t}\n\tif payID != \"\" {\n\t\thistory.PayID = payID\n\t}\n\tif payType != \"\" {\n\t\tif t, err = strconv.ParseInt(payType, 10, 64); err != nil {\n\t\t\tc.JSON(nil, ecode.RequestErr)\n\t\t\treturn\n\t\t}\n\t\thistory.PayType = int32(t)\n\t}\n\tif status != \"\" {\n\t\tif t, err = strconv.ParseInt(status, 10, 64); err != nil {\n\t\t\tc.JSON(nil, ecode.RequestErr)\n\t\t\treturn\n\t\t}\n\t\thistory.Status = int32(t)\n\t}\n\tif startTime != \"\" {\n\t\tif t, err = strconv.ParseInt(startTime, 10, 64); err != nil {\n\t\t\tc.JSON(nil, ecode.RequestErr)\n\t\t\treturn\n\t\t}\n\t\thistory.StartTime = t\n\t}\n\tif endTime != \"\" {\n\t\tif t, err = strconv.ParseInt(endTime, 10, 64); err != nil {\n\t\t\tc.JSON(nil, ecode.RequestErr)\n\t\t\treturn\n\t\t}\n\t\thistory.EndTime = t\n\t}\n\tif page != \"\" {\n\t\tif t, err = strconv.ParseInt(page, 10, 64); err != nil {\n\t\t\thistory.Page = 1\n\t\t}\n\t\thistory.Page = t\n\t} else {\n\t\thistory.Page = 1\n\t}\n\n\tif data, count, err = usersuitSvc.OrderHistory(c, history); err != nil {\n\t\tlog.Error(\"usersuitSvc.History error(%v)\", err)\n\t\tc.JSON(nil, err)\n\t\treturn\n\t}\n\tc.JSONMap(map[string]interface{}{\n\t\t\"data\": data,\n\t\t\"count\": count,\n\t}, nil)\n}", "title": "" }, { "docid": "477d2801b831c32146e8992a492c6c82", "score": "0.39587042", "text": "func (f *File) GetHistory(path string) ([]Entry, error) {\n\tvar err error\n\tres := []Entry{}\n\n\t// Query the database\n\trows, err := f.ctx.Db.Query(\"select * from entries \"+\n\t\t\"where PathName=? order by VersionNum desc\", path)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tdefer func() {\n\t\tcloseErr := rows.Close()\n\t\tif closeErr != nil {\n\t\t\terr = utils.ComboErr(\"Couldn't close db rows.\", closeErr, err)\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\t// Process results\n\tmd := Metadata{}\n\tfor rows.Next() {\n\t\terr = rows.Scan(&md.Path, &md.Version,\n\t\t\t&md.ModTime, &md.ArchiveKey)\n\t\tif err != nil {\n\t\t\treturn res, err\n\t\t}\n\t\tentry := Entry{\n\t\t\tPath: md.Path,\n\t\t\tVersion: md.Version,\n\t\t\tModTime: md.ModTime.String,\n\t\t}\n\t\tres = append(res, entry)\n\t}\n\treturn res, err\n}", "title": "" }, { "docid": "25688067cda3f54e097a394d55a8d218", "score": "0.39574796", "text": "func (cc *ConduitCache) InsertEntry(pair string) {\n\n\tentry := &models.CacheEntry{Pair: pair, ObUrl: getOrderBookUrlString(pair)}\n\tcc.entries = append(cc.entries, entry)\n}", "title": "" } ]
ff5c3bb1033ec84a42a63949a3c4447a
SetTotalSuccessTimes sets field value
[ { "docid": "c2c2768d851e62bb64ac1aca0a290a0f", "score": "0.68477863", "text": "func (o *PeriodOrderResult) SetTotalSuccessTimes(v int) {\n\to.TotalSuccessTimes = v\n}", "title": "" } ]
[ { "docid": "ba3308f5775ca71ad94ad8407b6bbdbd", "score": "0.65663487", "text": "func (m *DeviceComplianceDeviceOverview) SetSuccessCount(value *int32)() {\n m.successCount = value\n}", "title": "" }, { "docid": "a7233d1258d2308f7395fc1ef3f8cab4", "score": "0.64250064", "text": "func (g *Gauge) SetSuccess(ts *time.Time) {\n\tif ts != nil {\n\t\tg.lastSuccess.Set(float64(ts.Unix()))\n\t} else {\n\t\tg.lastSuccess.Set(float64(time.Now().Unix()))\n\t}\n\tg.countSuccess.Inc()\n}", "title": "" }, { "docid": "0c0f1c7ffd8800b223c12302e492274b", "score": "0.6356447", "text": "func (o *PeriodOrderResult) GetTotalSuccessTimes() int {\n\tif o == nil {\n\t\tvar ret int\n\t\treturn ret\n\t}\n\n\treturn o.TotalSuccessTimes\n}", "title": "" }, { "docid": "629bb8a75fc955a635dd278264790a08", "score": "0.6119223", "text": "func (m *UserSimulationDetails) SetCompletedTrainingsCount(value *int32)() {\n m.completedTrainingsCount = value\n}", "title": "" }, { "docid": "4b251a0e40c5e88960d827cbaef75e0f", "score": "0.59448385", "text": "func (m *ApplicationSignInSummary) SetSuccessfulSignInCount(value *int64)() {\n err := m.GetBackingStore().Set(\"successfulSignInCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6461d0f5c5e3d76dc5ca1985cbbe749f", "score": "0.58986366", "text": "func (m *AssignedTrainingInfo) SetCompletedUserCount(value *int32)() {\n m.completedUserCount = value\n}", "title": "" }, { "docid": "8142f05381e66e03930e13f34af9131b", "score": "0.58452123", "text": "func (m *ApplicationSignInSummary) SetSuccessPercentage(value *float64)() {\n err := m.GetBackingStore().Set(\"successPercentage\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f28133cfe16e7f8e2121bf239d0a26d7", "score": "0.5753202", "text": "func (m *UserSimulationDetails) SetInProgressTrainingsCount(value *int32)() {\n m.inProgressTrainingsCount = value\n}", "title": "" }, { "docid": "95e6e04188333f1b39a9d7ca9e8bcd85", "score": "0.56596035", "text": "func (o *PeriodOrderResult) GetTotalSuccessTimesOk() (*int, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.TotalSuccessTimes, true\n}", "title": "" }, { "docid": "a996e2487efef2a2d1a6dbb303375a88", "score": "0.55670214", "text": "func (p *Prometheus) setRunSuccess(module, namespace string, success bool) {\n\tas := float64(0)\n\tif success {\n\t\tas = 1\n\t}\n\tp.moduleRunSuccess.With(prometheus.Labels{\n\t\t\"module\": module,\n\t\t\"namespace\": namespace,\n\t}).Set(as)\n}", "title": "" }, { "docid": "874c96a2eae68a7eede86ecb6b6f8820", "score": "0.5537341", "text": "func (m *IndustryDataRunEntityCountMetric) SetTotal(value *int32)() {\n err := m.GetBackingStore().Set(\"total\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8ffe325303f1ebc9adbb455a96446953", "score": "0.55178916", "text": "func (m *RoleSuccessStatistics) SetTemporarySuccess(value *int64)() {\n err := m.GetBackingStore().Set(\"temporarySuccess\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3cd0d1689e34770682ba5c55d3b9159b", "score": "0.54394865", "text": "func (trPtr *TestResults) RecordSuccess() {\n\ttrPtr.LastSucceeded = time.Now()\n\ttrPtr.LastError = \"\"\n}", "title": "" }, { "docid": "cb62e56eb27d8ea85cae926de6baa76c", "score": "0.53701705", "text": "func IncrementSuccess(method, path string, primaryAverage, candidateAverage time.Duration) int {\n\treturn stats.IncSuccess(method, path, primaryAverage, candidateAverage)\n}", "title": "" }, { "docid": "126aee7495ef90ce795fc80fa0e3d894", "score": "0.53699595", "text": "func (m *DeviceComplianceDeviceOverview) SetFailedCount(value *int32)() {\n m.failedCount = value\n}", "title": "" }, { "docid": "1c7b21a0cc1cacd50f273864cab3ca2b", "score": "0.5351038", "text": "func (db *database) SetSuccessTime(domain, host string, successTime time.Time) error {\n\treturn fmt.Errorf(\"not implemented\") // no plan to migrate back to sqlite\n}", "title": "" }, { "docid": "a666f341598214f5d1f2d19c74bf0490", "score": "0.5339722", "text": "func (m *RoleSuccessStatistics) SetPermanentSuccess(value *int64)() {\n err := m.GetBackingStore().Set(\"permanentSuccess\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a7f3e83c46da4cb70653e13e98a65a5a", "score": "0.53123236", "text": "func (c *CallData) IncSuccess() {\n\tc.Success++\n}", "title": "" }, { "docid": "2d32714e78edd04067f1620f8b383157", "score": "0.5277756", "text": "func (m *UserSimulationDetails) SetAssignedTrainingsCount(value *int32)() {\n m.assignedTrainingsCount = value\n}", "title": "" }, { "docid": "4396a8f27919559eecbb9396a7864e9c", "score": "0.5265458", "text": "func (r *UpdateShouldDelBackupsRequest) SetTotalCount(totalCount int) {\n r.TotalCount = &totalCount\n}", "title": "" }, { "docid": "4d68252d4b00a76522b92ec08e5111f5", "score": "0.52360755", "text": "func (p *Pipeline) Total(value int) {\n\tp.unitTotal = value\n}", "title": "" }, { "docid": "ade7dcb174d493418db99a4ab77dfcf8", "score": "0.52191", "text": "func (m *RoleSuccessStatistics) SetRemoveSuccess(value *int64)() {\n err := m.GetBackingStore().Set(\"removeSuccess\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d91c15e072f3805f93e5c59dd364115f", "score": "0.5218015", "text": "func (m *MobileAppInstallSummary) SetFailedUserCount(value *int32)() {\n err := m.GetBackingStore().Set(\"failedUserCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7f0bb7d26739747fc25223a7b15cc967", "score": "0.5179397", "text": "func (r *TestResults) calcTotals() {\n\ttotalTime, _ := strconv.ParseFloat(r.Time, 64)\n\tfor _, suite := range r.Suites {\n\t\tr.NumPassed += suite.NumPassed()\n\t\tr.NumFailed += suite.NumFailed()\n\t\tr.NumSkipped += suite.NumSkipped()\n\n\t\tsuiteTime, _ := strconv.ParseFloat(suite.Time, 64)\n\t\ttotalTime += suiteTime\n\t\tr.Time = fmt.Sprintf(\"%.3f\", totalTime)\n\t}\n\tr.Len = r.NumPassed + r.NumSkipped + r.NumFailed\n}", "title": "" }, { "docid": "6e9f9a484b07f1c1daa19ce5d3cc5b01", "score": "0.51786256", "text": "func (m *MockMetrics) IncSuccessUpdateAppointmentCounter() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"IncSuccessUpdateAppointmentCounter\")\n}", "title": "" }, { "docid": "198a862c91bd5de9bfb72ecb9fdf9690", "score": "0.5142773", "text": "func (wcpc *WeChatPayCreate) SetSuccessTime(t time.Time) *WeChatPayCreate {\n\twcpc.mutation.SetSuccessTime(t)\n\treturn wcpc\n}", "title": "" }, { "docid": "5f4e78cd2aeb3bbd8907d0ea4df8cf18", "score": "0.5079835", "text": "func (m *AssignedTrainingInfo) SetAssignedUserCount(value *int32)() {\n m.assignedUserCount = value\n}", "title": "" }, { "docid": "b301c0c8845e4410bcdd1ea8c72baa6c", "score": "0.5052221", "text": "func (c *Check) Total(n int64) {\n\tc.Counts[Corpus] = n\n}", "title": "" }, { "docid": "4fab52027f8bb705686d1b6573cf8927", "score": "0.5049715", "text": "func (m *URLCounterMap) IncSuccess(method, path string, primaryAverage, candidateAverage time.Duration) int {\n\tm.Lock()\n\tdefer m.Unlock()\n\tcall := URLCall{method, path}\n\n\tcounter, ok := m.internal[call]\n\tnewCounter := counter\n\tif ok {\n\t\tcounter.IncSuccess()\n\t\tcounter.IncAveragePrimaryTime(primaryAverage)\n\t\tcounter.IncAverageCandidateTime(candidateAverage)\n\t\tnewCounter = counter\n\t\tm.internal[call] = newCounter\n\t} else {\n\t\tnewCounter = CallData{PrimaryDurationAllCalls: primaryAverage, CandidateDurationAllCalls: candidateAverage, Success: 1}\n\t\tm.internal[call] = newCounter\n\t}\n\n\treturn newCounter.Success\n}", "title": "" }, { "docid": "f599ec53d1c7e6bdd3e4c8285c85a167", "score": "0.5046624", "text": "func (s *Step) SetPassed() {\n\ts.isSuccessful = true\n}", "title": "" }, { "docid": "3dd2ad6bc35888de67bbdb338b38bdc6", "score": "0.50010246", "text": "func (m *AttackSimulationSimulationUserCoverage) SetClickCount(value *int32)() {\n m.clickCount = value\n}", "title": "" }, { "docid": "d419812e43ea1f2216a6591821c3e06d", "score": "0.49980685", "text": "func (c *runMetricsCollector) Success(now time.Time, duration time.Duration) {\n\tsuccessDuration.WithLabelValues(runCmd, c.name).Observe(duration.Seconds())\n}", "title": "" }, { "docid": "55c312fded1c1d3665d34d2d81c3def5", "score": "0.49953952", "text": "func (m *CrossTenantSummary) SetUserCount(value *int32)() {\n err := m.GetBackingStore().Set(\"userCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f5bc56ecde7ab37affc755fdf8747a5f", "score": "0.4979319", "text": "func (m *ApplicationSignInSummary) SetFailedSignInCount(value *int64)() {\n err := m.GetBackingStore().Set(\"failedSignInCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "92659c386906efb2402a6ba3dd7ed3d8", "score": "0.49475846", "text": "func (m *ItemActionStat) SetActionCount(value *int32)() {\n m.actionCount = value\n}", "title": "" }, { "docid": "3cfc93d7c084755bb7fa79a98529ae2b", "score": "0.4934263", "text": "func (ic *importMetrics) IncSuccessful() {\n\tic.importCounterVec.With(prometheus.Labels{\"result\": \"successful\"}).Inc()\n}", "title": "" }, { "docid": "f40c4daefeeda1533d308cb09f2ac5ee", "score": "0.49150196", "text": "func (m *MockMetrics) IncSuccessMultiCreateAppointmentCounter() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"IncSuccessMultiCreateAppointmentCounter\")\n}", "title": "" }, { "docid": "22acab1fb8c92ec322519ba73de6928e", "score": "0.4909055", "text": "func (s *BatchImportFindingsOutput) SetSuccessCount(v int64) *BatchImportFindingsOutput {\n\ts.SuccessCount = &v\n\treturn s\n}", "title": "" }, { "docid": "f025230f3c6337dba2a998f0cf383392", "score": "0.4899576", "text": "func (m *IosVppApp) SetTotalLicenseCount(value *int32)() {\n m.totalLicenseCount = value\n}", "title": "" }, { "docid": "7ea57ab6894c904b604581e0b9bbfea6", "score": "0.48988077", "text": "func (r *Result) Total(t time.Time) time.Duration {\n\treturn t.Sub(r.dnsStart)\n}", "title": "" }, { "docid": "eb31124dba8ae44d2bf3da5341634721", "score": "0.48855263", "text": "func (o *ProcessGroupDTO) SetUpToDateCount(v int32) {\n\to.UpToDateCount = &v\n}", "title": "" }, { "docid": "eac6848e857d9f6153b8db09bd17f821", "score": "0.4859223", "text": "func (task *Task) Succeeded() {\n\ttask.EndDate = time.Now()\n\ttask.Status = SUCCESS\n}", "title": "" }, { "docid": "722d9c08daa2d407d745657c692e6853", "score": "0.48572078", "text": "func (m *MockMetrics) IncSuccessCreateAppointmentCounter() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"IncSuccessCreateAppointmentCounter\")\n}", "title": "" }, { "docid": "9eec86a2b2511cb7546d5388bd8c35c9", "score": "0.485275", "text": "func (m *MobileAppInstallSummary) SetPendingInstallUserCount(value *int32)() {\n err := m.GetBackingStore().Set(\"pendingInstallUserCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "52821173650a8d13c772a3d118342dcc", "score": "0.48470825", "text": "func SetSuccessStatus(success bool) {\n\tcollector.SetSuccessStatus(success)\n}", "title": "" }, { "docid": "b277383ab79363fe91c2b07f88aa7439", "score": "0.4836992", "text": "func (entry *Entry) SetTimes(times int) {\n\tentry.times.Set(times)\n}", "title": "" }, { "docid": "2206705f6fd3379c7c124b29e0d433ec", "score": "0.48285216", "text": "func (m *wasiSnapshotPreview1) wasiPathFilestatSetTimes(p0 int32, p1 int32, p2 int32, p3 int32, p4 int64, p5 int64, p6 int32) int32 {\n\terr := m.impl.pathFilestatSetTimes(wasiFd(p0), wasiLookupflags(p1), list{pointer: pointer(p2), length: int32(p3)}, uint64(p4), uint64(p5), wasiFstflags(p6))\n\tres := int32(wasiErrnoSuccess)\n\tif err != wasiErrnoSuccess {\n\t\tres = int32(err)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "462ba82c5c812dded90a100d7f8f7216", "score": "0.48075056", "text": "func (m *RoleSuccessStatistics) SetTemporaryFail(value *int64)() {\n err := m.GetBackingStore().Set(\"temporaryFail\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c8d0df0967beeace2f655dd02cb63239", "score": "0.47873032", "text": "func Times(expected int) verifyOpt {\n\treturn func(opts *verifier) {\n\t\topts.verifyTimes = func(acceptedCount, unmatchedCount int) error {\n\t\t\ttotalCount := acceptedCount + unmatchedCount\n\t\t\tif totalCount != expected {\n\t\t\t\treturn verifyError(fmt.Sprintf(\"request was called unexpected number of times. expected: %d, actual: %d\", expected, totalCount))\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e83f475af24c46733331cd455132c196", "score": "0.47836214", "text": "func (s *Counters) SetPassed(v int64) *Counters {\n\ts.Passed = &v\n\treturn s\n}", "title": "" }, { "docid": "7a4efd4502d64352d5d0e8b965a4e527", "score": "0.4774626", "text": "func (m *CrossTenantSummary) SetNewTenantCount(value *int32)() {\n err := m.GetBackingStore().Set(\"newTenantCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "eedb0239fb4870979af34c3c99a61aed", "score": "0.47679362", "text": "func (m *ItemActionStat) SetActorCount(value *int32)() {\n m.actorCount = value\n}", "title": "" }, { "docid": "ef0ae1733643baee7740effa0d77fbbf", "score": "0.47576794", "text": "func (m *DeviceComplianceDeviceOverview) SetPendingCount(value *int32)() {\n m.pendingCount = value\n}", "title": "" }, { "docid": "14fb5d7d1afff207a86266fe64f13550", "score": "0.47483948", "text": "func (m *MockMetrics) IncSuccessRemoveAppointmentCounter() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"IncSuccessRemoveAppointmentCounter\")\n}", "title": "" }, { "docid": "a9418ef3855c33c8b956e5bdb51fde33", "score": "0.47442403", "text": "func (b *Breaker) SuccessCount() int {\n\treturn b.successCount\n}", "title": "" }, { "docid": "aaf7d6cde36611b26b691c09df7c6831", "score": "0.47429836", "text": "func CollectSuccessUnit(name string, unitCount int, arg interface{}) {\n\tcollector.CollectSuccessUnit(name, unitCount, arg)\n}", "title": "" }, { "docid": "343e97974477d2a8229467e340f35dec", "score": "0.47410235", "text": "func (s *SheddingStat) IncrementTotal() {\n\tatomic.AddInt64(&s.total, 1)\n}", "title": "" }, { "docid": "f590f79dcc326f114ee674e53adfd939", "score": "0.47108153", "text": "func (m *AttackSimulationSimulationUserCoverage) SetSimulationCount(value *int32)() {\n m.simulationCount = value\n}", "title": "" }, { "docid": "fbf29ae89fc519afa8c0b23709acf105", "score": "0.46741927", "text": "func (p *Player) TotalRecords() int {\n\treturn int(atomic.LoadInt64(&p.totalRecords))\n}", "title": "" }, { "docid": "e4b773ba254d8a758bfd832e13be2c5e", "score": "0.46640748", "text": "func percentSuccess(sliceProcess []int) float64 {\n\ttotalUnsuccessfull := 0\n\ttotalReqs := len(sliceProcess)\n\tfor _, code := range sliceProcess {\n\t\tif code == 200 {\n\t\t\ttotalUnsuccessfull++\n\t\t}\n\t}\n\n\treturn float64(totalUnsuccessfull/totalReqs) * 100\n\n}", "title": "" }, { "docid": "9d412f54d73e244178d47dd2460ce643", "score": "0.46632373", "text": "func WithTotalPending(value uint) zap.Field {\n\treturn zap.Uint(FieldTotalPending, value)\n}", "title": "" }, { "docid": "d746ba9df8b7ca7a8fa0107db4ce6228", "score": "0.46523666", "text": "func TestSetTotalPagesWithZero(t *testing.T) {\n\n\tcurrentPage := 1\n\ttotalItems := 0\n\tperPage := 5\n\trangePage := 5\n\n\tpagination := new(Pagination)\n\tpagination.CurrentPage = currentPage\n\tpagination.TotalItems = totalItems\n\tpagination.PerPage = perPage\n\tpagination.RangePage = rangePage\n\n\tpagination.setTotalPages()\n\n\tif pagination.TotalPages != 0 {\n\t\tt.Errorf(\"SetTotalPages(): expected pagination.TotalPages equals 0 but obtained %v\", pagination.TotalPages)\n\t}\n\n}", "title": "" }, { "docid": "c108955f37f6f999cc71231a74b7ab58", "score": "0.46498507", "text": "func (m *MethodMetrics) ReportSuccess(d time.Duration) {\n\tm.Success.Inc(1)\n\tm.SuccessLatency.Record(d)\n}", "title": "" }, { "docid": "ed6d8bed930e483c9efc66b184650277", "score": "0.46489203", "text": "func (s *Stats) IncrementFilesTotal() {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.FilesTotal++\n}", "title": "" }, { "docid": "ca62cd0a9487ff87c2f44fb7d0283616", "score": "0.46418998", "text": "func (m *MobileAppInstallSummary) SetFailedDeviceCount(value *int32)() {\n err := m.GetBackingStore().Set(\"failedDeviceCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0f1589403f84ec998e352b8d3f92a861", "score": "0.46221903", "text": "func (c *BallClock) MinutesPassed() int {\n\treturn c.totalMinutes\n}", "title": "" }, { "docid": "e092bae805908962e9f88b10f9b7084e", "score": "0.46167624", "text": "func TestSetTotalPages(t *testing.T) {\n\n\tcurrentPage := 1\n\ttotalItems := 50\n\tperPage := 5\n\trangePage := 5\n\n\tpagination := new(Pagination)\n\n\tpagination.CurrentPage = currentPage\n\tpagination.TotalItems = totalItems\n\tpagination.PerPage = perPage\n\tpagination.RangePage = rangePage\n\n\tpagination.setTotalPages()\n\n\tif pagination.TotalPages != 10 {\n\t\tt.Errorf(\"SetTotalPages(): expected pagination.TotalPages equals 10 but obtained %v\", pagination.TotalPages)\n\t}\n\n}", "title": "" }, { "docid": "3404723f9b1fd5a6b396f4b04bfebb99", "score": "0.46145335", "text": "func (m *ItemAnalytics) SetAllTime(value ItemActivityStatable)() {\n err := m.GetBackingStore().Set(\"allTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cc6ca686996ea39a7bf271926dd9fc53", "score": "0.46129635", "text": "func (gen *Gen) countTotal(start time.Time, tableName string) {\n\tlog.Printf(\"Insertion is successfully completed and took %v.\\n\", time.Since(start))\n\n\tvar count int\n\trow := gen.db.QueryRow(\"SELECT COUNT(*) FROM \" + tableName)\n\terr := row.Scan(&count)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Total count: %v\\n\\n\", count)\n}", "title": "" }, { "docid": "93497279df0c708f1b5be86c2dadd1c8", "score": "0.46124756", "text": "func (p *Player) UpdateTotal() {\n\tp.Points += p.RoundPoints\n\treturn\n}", "title": "" }, { "docid": "ea3236790a98ffb8b355b92468e22836", "score": "0.4605989", "text": "func (s *Storage) TotalTests() int {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.totalTests\n}", "title": "" }, { "docid": "68b0cbc39e4735d27f7a7cdbf17c28b8", "score": "0.46030062", "text": "func (st *worker) SetExternalTaskSuccesses(external goconcurrentcounter.Int) {\n\tst.externalTaskSuccesses = external\n}", "title": "" }, { "docid": "18c6cd773f3287ccef6afa6b4835cb2a", "score": "0.4599427", "text": "func (model *Model) Times(retry uint) *Model {\n\tmodel.retry = retry\n\treturn model\n}", "title": "" }, { "docid": "cf8d56feffcedd01d7deb6dbd571dd0f", "score": "0.4592008", "text": "func (o *IndicatorLatency) SetSuccess(v Query) {\n\to.Success = v\n}", "title": "" }, { "docid": "bbf6b5a8d1ee44ef7f2c3a68f9351fa6", "score": "0.45800978", "text": "func (a *Analysis) GetRecentlyRequestSuccessedCount(server string, secs int) int {\r\n\tpoints, ok := a.recentlyPoints[server]\r\n\r\n\tif !ok {\r\n\t\treturn 0\r\n\t}\r\n\r\n\tpoint, ok := points[secs]\r\n\r\n\tif !ok {\r\n\t\treturn 0\r\n\t}\r\n\r\n\treturn int(point.successed)\r\n}", "title": "" }, { "docid": "b0d0001036e3ae804df3e66d564091f8", "score": "0.4575036", "text": "func (wcpc *WeChatPayCreate) SetNillableSuccessTime(t *time.Time) *WeChatPayCreate {\n\tif t != nil {\n\t\twcpc.SetSuccessTime(*t)\n\t}\n\treturn wcpc\n}", "title": "" }, { "docid": "a8d5f8245b5ca498137e38406600eb51", "score": "0.45450974", "text": "func (k Keeper) SetVestingProgress(ctx sdk.Context, addr sdk.AccAddress, period int, success bool) {\n\tvv := k.GetAccountFromAuthKeeper(ctx, addr)\n\tvv.VestingPeriodProgress[period] = types.VestingProgress{PeriodComplete: true, VestingSuccessful: success}\n\tk.ak.SetAccount(ctx, vv)\n}", "title": "" }, { "docid": "bc976a7e21a0ace6e0f66bc0733c62de", "score": "0.45447403", "text": "func (s *Stats) IncrementFindingsTotal() {\n\ts.Lock()\n\tdefer s.Unlock()\n\ts.FindingsTotal++\n\ts.Findings++\n}", "title": "" }, { "docid": "381d0a1700cb15bf1e6569c9f998dd07", "score": "0.4523006", "text": "func (m *MockMetrics) UpdateMetricValidationSucceeded(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"UpdateMetricValidationSucceeded\", arg0)\n}", "title": "" }, { "docid": "0e570cbda6cb493da5abd91ee1ea519f", "score": "0.45161724", "text": "func (o *SyntheticsTiming) SetTotal(v float64) {\n\to.Total = &v\n}", "title": "" }, { "docid": "1e0007680b439cfec128a2b1561a1d43", "score": "0.45117217", "text": "func totalCompleted(user *arn.User, animes []*arn.Anime) int {\n\tif user == nil {\n\t\treturn 0\n\t}\n\n\tcount := 0\n\n\tcompletedList := user.AnimeList().FilterStatus(arn.AnimeListStatusCompleted)\n\n\tfor _, anime := range animes {\n\t\tif completedList.Contains(anime.ID) {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "8a86741e7eb0c5748e20b7b09a2b9126", "score": "0.44960168", "text": "func (m *MockMetrics) UpdateMetricClusterVerificationSucceeded(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"UpdateMetricClusterVerificationSucceeded\", arg0)\n}", "title": "" }, { "docid": "f52cdeac8e61b8707e436f1fe633ffb1", "score": "0.448815", "text": "func recordPutSuccess() {\n\tput200Ok.Inc()\n}", "title": "" }, { "docid": "aa79a9c6295b07ccfb741a77a676c444", "score": "0.4487177", "text": "func (m *CrossTenantSummary) SetAuthTransactionCount(value *int32)() {\n err := m.GetBackingStore().Set(\"authTransactionCount\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "242ae715f4ffe90ffa44a634d3bd0af0", "score": "0.4484611", "text": "func (t *Timer) Count() int64 { return t.count }", "title": "" }, { "docid": "c218c25287353d05d54efd2139ee5085", "score": "0.44772446", "text": "func UpdateTotalCalls(shortURL string) (int64, error) {\n\tcalls, _ := getURLTotalCalls(shortURL)\n\tresult, err := db.Exec(\"update url set total_calls = ? where short_url = ?\", calls+1, shortURL)\n\n\tif err != nil {\n\t\tlog.Println(\"dbService: Failed to update total calls for URL: \", shortURL, err)\n\t\treturn 0, errors.New(\"failure:update-total-calls\")\n\t}\n\t\n\tres, _ := result.RowsAffected()\n\n\treturn res, nil\n}", "title": "" }, { "docid": "dbc43c0dce6f00b4ffee076b069038e8", "score": "0.44748604", "text": "func (m *DepOnboardingSetting) SetLastSuccessfulSyncDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n err := m.GetBackingStore().Set(\"lastSuccessfulSyncDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4a46a1d9c47123d38242f8688ba8fb78", "score": "0.44692683", "text": "func (m *UserTrainingStatusInfo) SetCompletionDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.completionDateTime = value\n}", "title": "" }, { "docid": "2c1503f0161d84db5f9d83d58c6f8b32", "score": "0.44677493", "text": "func (l *Logger) SetCommonPartialSuccess(partialSuccess bool) {\n\tl.commonPartialSuccess = partialSuccess\n}", "title": "" }, { "docid": "190d8c83d4a029eaeeb52fd66de1f10f", "score": "0.4467657", "text": "func (b *Breaker) success() {\n\tb.successCount++\n}", "title": "" }, { "docid": "6daa95e3c4b3f583839c4de345e7e330", "score": "0.44661754", "text": "func (mr *MockMetricsMockRecorder) IncSuccessUpdateAppointmentCounter() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IncSuccessUpdateAppointmentCounter\", reflect.TypeOf((*MockMetrics)(nil).IncSuccessUpdateAppointmentCounter))\n}", "title": "" }, { "docid": "9d5ed2b2922d4892d774d50150511fd9", "score": "0.44640967", "text": "func SetTotalSoldTickets(sold uint64, stats *LDBMap) error {\n\treturn stats.Put(\"totalsold\", strconv.FormatUint(sold, 10))\n}", "title": "" }, { "docid": "f40ef654e4fbb0eeeb8dd52f21dcb1a3", "score": "0.4462659", "text": "func (m *AttackSimulationSimulationUserCoverage) SetCompromisedCount(value *int32)() {\n m.compromisedCount = value\n}", "title": "" }, { "docid": "c2efb9dffe8897a6774745a148718830", "score": "0.4458635", "text": "func (m *Photo) SetTakenDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.takenDateTime = value\n}", "title": "" }, { "docid": "83a84dbe299fb5c9cc1cc7e711de8fef", "score": "0.44540486", "text": "func (o *IndicatorLatency) SetTotal(v Query) {\n\to.Total = v\n}", "title": "" }, { "docid": "351dcd19f977c380ee2c8fb83aa4f279", "score": "0.44506732", "text": "func (o *InlineResponse200Metrics) SetSuccessfulRuns(v int64) {\n\to.SuccessfulRuns = v\n}", "title": "" }, { "docid": "7bbf67c38701efe3d6079e4a25fa49f0", "score": "0.44500434", "text": "func (gs *getStrategy) setCount(v uint64) {\n\tif gs.count == 0 || gs.count > v {\n\t\tgs.count = v\n\t}\n}", "title": "" }, { "docid": "b49e87bd7c062b9eba5b3cf5e4bbd2b4", "score": "0.44475403", "text": "func TestSuccessRate(t *testing.T) {\n\tas17, _ := addr.IAFromString(\"1-7\")\n\tconfig := Default()\n\tinfo := NewInfo(*as17, config)\n\n\t// oldest episode first to add\n\tinfo.AddDetectionResult(true)\n\tinfo.AddDetectionResult(false)\n\tinfo.AddDetectionResult(true)\n\t// newest episode last to add\n\tinfo.AddDetectionResult(true)\n\n\texpectedValue := 1.75\n\trate := info.SuccessRate()\n\tif rate != expectedValue {\n\t\tt.Errorf(\"Info success rate should be %v, but it was %v\", expectedValue, rate)\n\t}\n}", "title": "" }, { "docid": "19b8a490ec1f1e884697877d27cc1654", "score": "0.44472224", "text": "func SetTestTime() {\n\tSetTime(GetTestTime())\n}", "title": "" }, { "docid": "21fd1479f7eac3eaa27f03e3ac78a4a1", "score": "0.4436737", "text": "func TotalCount() int {\n\treturn reporter.TotalCount()\n}", "title": "" } ]
44a4f479d8702f1b250b2910bf6b17cc
Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.
[ { "docid": "bfb3de2674ce60f97ad020f3a6453637", "score": "0.0", "text": "func (_PriorityQueue *PriorityQueueRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _PriorityQueue.Contract.PriorityQueueTransactor.contract.Transfer(opts)\n}", "title": "" } ]
[ { "docid": "a5ca6c63ab282a4fbfe2677d29417eb1", "score": "0.736107", "text": "func (_SimpleContract *SimpleContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ff2a5392a014b4c1e8596a6ed3702eb9", "score": "0.730056", "text": "func (_SimpleContract *SimpleContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleContract.Contract.SimpleContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "f014eb215d89a0ca0cbad42263cbb315", "score": "0.71062386", "text": "func (_RollupCreator *RollupCreatorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupCreator.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "cdb8c401772800df0395a3527cbd1427", "score": "0.7103233", "text": "func (_SfcV1Contract *SfcV1ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "db94dbffe46ed8de3637665a164f1dbf", "score": "0.71001846", "text": "func (_Escrow *EscrowTransactor) Transfer(opts *bind.TransactOpts, identifier [32]byte, token common.Address, value *big.Int, expirySeconds *big.Int, paymentId common.Address, minAttestations *big.Int) (*types.Transaction, error) {\n\treturn _Escrow.contract.Transact(opts, \"transfer\", identifier, token, value, expirySeconds, paymentId, minAttestations)\n}", "title": "" }, { "docid": "28a493188b298d9c749c35d7d2b06199", "score": "0.70908904", "text": "func (_SimpleAirdrop *SimpleAirdropTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleAirdrop.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1bb27b979fe5ce76b6904d4ba5e6ff01", "score": "0.7081643", "text": "func (_BaseFeeVault *BaseFeeVaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseFeeVault.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "21e7aa2eab00345104a0755fcc0984e6", "score": "0.70809174", "text": "func (_Tester *TesterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Tester.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c7e8f73437211f88d1dd30ce6d1c4f0d", "score": "0.7080401", "text": "func (_BalanceContract *BalanceContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BalanceContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "1e2a85b3194dc849f0014d5e3d3ae122", "score": "0.7071973", "text": "func (_SfcV1Contract *SfcV1ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SfcV1Contract.Contract.SfcV1ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c80a29c27f09b529b652cc4a9036df9e", "score": "0.70699644", "text": "func (_RollupUtils *RollupUtilsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupUtils.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "8524b5b749f71cb4880c7a2dfdf8a471", "score": "0.7064915", "text": "func (_IChallengeFactory *IChallengeFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IChallengeFactory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ca29299fe836fe24fb7e2ca97ea07cac", "score": "0.7051112", "text": "func (_NeutralVault *NeutralVaultTransactor) Transfer(opts *bind.TransactOpts, _from common.Address, _to common.Address, _token common.Address, _quantity *big.Int) (*types.Transaction, error) {\n\treturn _NeutralVault.contract.Transact(opts, \"transfer\", _from, _to, _token, _quantity)\n}", "title": "" }, { "docid": "55fc6651e156a1a4f2f3903f40da7712", "score": "0.7045317", "text": "func (_Deposit *DepositTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Deposit.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "fa0374e4b5e909c3890a8598e05700bc", "score": "0.7036992", "text": "func (_HasNoContracts *HasNoContractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _HasNoContracts.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a1465011e06240c67ee80fbcaa0ed804", "score": "0.7032366", "text": "func (_Accounts *AccountsTransactor) Transfer(opts *bind.TransactOpts, destination common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Accounts.contract.Transact(opts, \"transfer\", destination, amount)\n}", "title": "" }, { "docid": "f326273cbc64c95c05fc5a039953b5ea", "score": "0.70277697", "text": "func (_WizardConstants *WizardConstantsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _WizardConstants.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a544f085165c28a7ddaafe3e5812685d", "score": "0.7020435", "text": "func (_Destructible *DestructibleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Destructible.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "00bc5f25091e91cc1fca39486f67b236", "score": "0.70172507", "text": "func (_TransferHelper *TransferHelperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _TransferHelper.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d10302cf1cbff98ba156dbdab33ce6b4", "score": "0.70116377", "text": "func (_BalanceContract *BalanceContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BalanceContract.Contract.BalanceContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "6ef96c5a1dbddff6fd9603b970fba664", "score": "0.7008974", "text": "func (_DFedBank *DFedBankTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DFedBank.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c160fb0f64318e11aa7d57aabc3cf157", "score": "0.700659", "text": "func (_PaymentGateway *PaymentGatewayTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _PaymentGateway.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "bf4cbd642722c6fdb2cebaa7f222ea63", "score": "0.70042944", "text": "func (_Dosstaking *DosstakingTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Dosstaking.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "78b4a16f525760396407e3a8a5b67c49", "score": "0.7004166", "text": "func (_ConstructorCallback *ConstructorCallbackTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ConstructorCallback.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "7b82a1418ff5a8a8885755c21f5e82c7", "score": "0.6998057", "text": "func (_CryptoFiat *CryptoFiatTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CryptoFiat.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3a097c69cd4d99372543485e2a6ce42b", "score": "0.6989753", "text": "func (_IdFedFactory *IdFedFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IdFedFactory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e7be469a4c02bc2edc2c1bacc45392f5", "score": "0.69863766", "text": "func (_Contracts *ContractsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contracts.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "8196536ed5e744a4da1bb230864267f6", "score": "0.6981993", "text": "func (_Activatable *ActivatableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Activatable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e0b21a8665c53c8d506ab802a50e7121", "score": "0.6978085", "text": "func (_ERC20Basic *ERC20BasicTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC20Basic.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "bc665ad0fc2576a0f2e22bcaaaca28e8", "score": "0.69746125", "text": "func (_BaseFeeVault *BaseFeeVaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseFeeVault.Contract.BaseFeeVaultTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "b8939e505c4e94e98c91621fff36d2ed", "score": "0.6972126", "text": "func (_ERC20Basic *ERC20BasicTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {\n\treturn _ERC20Basic.contract.Transact(opts, \"transfer\", to, value)\n}", "title": "" }, { "docid": "d2f598df65c346b132de77e843129580", "score": "0.6970173", "text": "func (_Contract *ContractTransactor) Transfer(opts *bind.TransactOpts , to common.Address , value *big.Int ) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"transfer\" , to, value)\n}", "title": "" }, { "docid": "5f27f67779dbfae0fd4b2e05a6b1f888", "score": "0.696861", "text": "func (_Suicide *SuicideTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Suicide.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a6e72407a7c8f527f750e231820beb88", "score": "0.6966303", "text": "func (_CompoundStrategy *CompoundStrategyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CompoundStrategy.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "704c0ab494459eec91a4bbdc240f2c0c", "score": "0.6964988", "text": "func (_Utils *UtilsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Utils.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "704c0ab494459eec91a4bbdc240f2c0c", "score": "0.6964988", "text": "func (_Utils *UtilsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Utils.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "dce694d71b0e22b97227bbf677e60d23", "score": "0.6951434", "text": "func (_Main *MainTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Main.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "34ab54ea49274f5fb649feda3ec2c13a", "score": "0.69425106", "text": "func (_Bindings *BindingsTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Bindings.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "f3ed7b014ab8d9d71be416a68dbe8f0f", "score": "0.6939728", "text": "func (_DataLedgerContract *DataLedgerContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DataLedgerContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "605e320a54fe5dfc319acb36d2dca1b7", "score": "0.69383705", "text": "func (_Foundation *FoundationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\r\n\treturn _Foundation.Contract.contract.Transfer(opts)\r\n}", "title": "" }, { "docid": "69a2ca316ce8113882b7cc24574f96f8", "score": "0.69376236", "text": "func (_Erc20factory *Erc20factoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Erc20factory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "023bf4d0110fc3cf81bedac6f276321f", "score": "0.6934794", "text": "func (_Ownable *OwnableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Ownable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d165054ebef3be65032f3da20860868d", "score": "0.69334906", "text": "func (_Utilities *UtilitiesTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Utilities.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "83f6c4c4ff1571ec2b61d34be384e757", "score": "0.6932347", "text": "func (_DFedLibrary *DFedLibraryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _DFedLibrary.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "424227198b177888b9b8f92af9d4ed39", "score": "0.6930244", "text": "func (_Contracts *ContractsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contracts.Contract.ContractsTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "db17b87145bf1d0e4e7e3ee11642b7bc", "score": "0.69292974", "text": "func (_Calypso *CalypsoTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Calypso.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "0fecd285dceadfb86f005db3dd9e3e8c", "score": "0.6924934", "text": "func (_ExchangeContract *ExchangeContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ExchangeContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d68cf4c0edd821a47ea905ab384bf4a0", "score": "0.6918339", "text": "func (_MessageHelper *MessageHelperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _MessageHelper.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "18cc33214a51c0832d88598b6bfef3a7", "score": "0.6916147", "text": "func (_IServiceDelegator *IServiceDelegatorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, *types.Receipt, error) {\n\treturn _IServiceDelegator.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "67c35a1ad146801dfa9c2bf7801e4ba9", "score": "0.69149756", "text": "func (_RollupMock *RollupMockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _RollupMock.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4420b8d55ef77f10262a370d789f6707", "score": "0.6913723", "text": "func (_Deposit *DepositRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Deposit.Contract.DepositTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4e5c59bd90191c148db33d19f8f039d6", "score": "0.6911222", "text": "func (_Pausable *PausableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pausable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "31c8c1d92b76fb3fe99dbb7620f28b44", "score": "0.6911053", "text": "func (_Delegation *DelegationTransactor) Transfer(opts *bind.TransactOpts, nonce *big.Int, destination common.Address, amount *big.Int, fee *big.Int, signature []byte, delegate common.Address) (*types.Transaction, error) {\n\treturn _Delegation.contract.Transact(opts, \"transfer\", nonce, destination, amount, fee, signature, delegate)\n}", "title": "" }, { "docid": "1abc7b81bd8dc41cddd7a13d7c8ca8d8", "score": "0.6910438", "text": "func (_AnyContract *AnyContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AnyContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "f9ed15f6d3a2908ef07fc77b9e79693e", "score": "0.6909256", "text": "func (_SuyuanContract *SuyuanContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SuyuanContract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "03f79d4b9de1732973953a6f0837b586", "score": "0.6909073", "text": "func (_Accounts *AccountsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Accounts.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "222e44ad87bbc4d11ca66356946f75b3", "score": "0.690501", "text": "func (_Approving *ApprovingTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Approving.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "902a43ba6295f99afa93c91544c93b1c", "score": "0.6904982", "text": "func (_Migratable *MigratableTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Migratable.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "cd7cb07046f0806ebcdd6d40deae2002", "score": "0.6904825", "text": "func (_Tellor *TellorTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Tellor.contract.Transact(opts, \"transfer\", _to, _amount)\n}", "title": "" }, { "docid": "909fb62376bd66e3ff8f52a2f7b7f51c", "score": "0.6898769", "text": "func (_ERC1155 *ERC1155TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ERC1155.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "04101cf9e3a2de0459880dc0032b25c2", "score": "0.6895886", "text": "func (_BEP20 *BEP20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _BEP20.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "125c0b315f180a11e460a5220b5be489", "score": "0.68958676", "text": "func (_Comtroller *ComtrollerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Comtroller.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a13335244958ee00c425904a2ad5d6f5", "score": "0.68950313", "text": "func (_NeutralVault *NeutralVaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _NeutralVault.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "f2be26f607b2c7d2b5004f13ce67914b", "score": "0.6891435", "text": "func (_SimpleAirdrop *SimpleAirdropRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SimpleAirdrop.Contract.SimpleAirdropTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c25bc20adeb0deeefca37ee148ed3075", "score": "0.6890424", "text": "func (_AccessControllerInterface *AccessControllerInterfaceTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _AccessControllerInterface.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d60a530f588ffc574ddffa5165010803", "score": "0.68856555", "text": "func (_Bindings *BindingsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Bindings.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d60a530f588ffc574ddffa5165010803", "score": "0.68856555", "text": "func (_Bindings *BindingsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Bindings.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "63d2ac4eed3f3c6dd64344a40035ea39", "score": "0.6883618", "text": "func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _ERC20.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "aee289f345caaaf30e286b7fd4d7c205", "score": "0.6883359", "text": "func (_ExchangeContract *ExchangeContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ExchangeContract.Contract.ExchangeContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "4bd2d86ef37eaeb378b119ce2cab7adf", "score": "0.68782717", "text": "func (_ArbRollup *ArbRollupTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ArbRollup.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "7e90b44d647eb5678338559fdcd36218", "score": "0.6876381", "text": "func (_ContractWrapper *ContractWrapperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _ContractWrapper.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3f78146921cf45f6b70562e189306760", "score": "0.68746185", "text": "func (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "3ddda7c62fe6be862bee4e48869c8d6a", "score": "0.68745023", "text": "func (_Adder *AdderTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Adder.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "579ff838924c1a5a7c707f3da80d23bc", "score": "0.6874208", "text": "func (_Migrations *MigrationsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Migrations.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "5533975a2d98f42a9a5004589b29bf8f", "score": "0.6874117", "text": "func (_CryptoFiat *CryptoFiatRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CryptoFiat.Contract.CryptoFiatTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "e9d315483d370295f9b9bb529504aa60", "score": "0.6873981", "text": "func (_Generated *GeneratedTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Generated.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "c79ccf53fbc9ea2289e06e4bedaf5ba0", "score": "0.6872443", "text": "func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pancake.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "9e67bb7be9db44cf24afa3e6804bb7ce", "score": "0.6870352", "text": "func (_CloneFactory *CloneFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _CloneFactory.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "ec0d6093c42b6c0b72ad6aa2855d2a58", "score": "0.6866472", "text": "func (_BtEth *BtEthTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BtEth.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d9d5182f740a49b580a143aa7963572a", "score": "0.6862502", "text": "func (_Esd *EsdTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {\n\treturn _Esd.contract.Transact(opts, \"transfer\", recipient, amount)\n}", "title": "" }, { "docid": "41b0612ba3db22ec11f2dee3a465f359", "score": "0.6862244", "text": "func (_Staking *StakingTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Staking.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "38ff545a873fe609edc78338f4a04785", "score": "0.68622154", "text": "func (_SanityRates *SanityRatesTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SanityRates.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "79e7cda0f5e7a97e89c1de3930d2a76c", "score": "0.6861533", "text": "func (_SuyuanContract *SuyuanContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _SuyuanContract.Contract.SuyuanContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "715e8d0c9234fbc588c187293c12f4c7", "score": "0.68590003", "text": "func (_Slashmanager *SlashmanagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Slashmanager.Contract.contract.Transfer(opts)\n}", "title": "" }, { "docid": "d0df0fe5e4223a83fa630e708f0e4abe", "score": "0.6858595", "text": "func (_A *ARaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _A.Contract.ATransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.6853701", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.6853701", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.6853701", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.6853701", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.6853701", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "a7d383ce130dc3ca29b4ecd6b694c307", "score": "0.68518203", "text": "func (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Contract.Contract.ContractTransactor.contract.Transfer(opts)\n}", "title": "" } ]
3c2197f4ccaa6dda37aa2aa5a137173b
ItemExists returns whether an item exists the library or not.
[ { "docid": "46e94ef5c5ec5570eaf9c86dc345c18f", "score": "0.84529686", "text": "func (library *Library) ItemExists(id string, itemType int) bool {\n\texists := false\n\n\tswitch itemType {\n\tcase LibraryItemSourceGroup, LibraryItemMetricGroup:\n\t\tif _, ok := library.Groups[id]; ok && library.Groups[id].Type == itemType {\n\t\t\texists = true\n\t\t}\n\n\tcase LibraryItemGraph:\n\t\t_, exists = library.Graphs[id]\n\n\tcase LibraryItemGraphTemplate:\n\t\t_, exists = library.TemplateGraphs[id]\n\n\tcase LibraryItemCollection:\n\t\t_, exists = library.Collections[id]\n\t}\n\n\treturn exists\n}", "title": "" } ]
[ { "docid": "ad56c6cc32b8ab2b48cfb3ede7c9e428", "score": "0.7435038", "text": "func (ei *EquippedItem) Exists() bool {\n\treturn ei._exists\n}", "title": "" }, { "docid": "e217cace71f613f1396e7d4f0c5cf4e7", "score": "0.7414754", "text": "func (ini *Ini) ItemExists(section string, item string) bool {\n\t_, exists := ini.data[section]\n\tif exists {\n\t\t_, exists := ini.data[section].items[item]\n\t\treturn exists\n\t}\n\treturn false\n}", "title": "" }, { "docid": "adaf418600a47f6330c065a05ad0849e", "score": "0.7206243", "text": "func (gi *GiftItem) Exists() bool {\n\treturn gi._exists\n}", "title": "" }, { "docid": "bb669ad325f407fd764b61b1a933c994", "score": "0.710586", "text": "func (si *Item) Exists() bool {\n\treturn (len(si.Word) > 0) || (len(si.S) > 0)\n}", "title": "" }, { "docid": "510bc5ce4d201eb6783c19be5be499b7", "score": "0.70164794", "text": "func (ini *Ini) Exists(section string, item string) bool {\n\treturn ini.ItemExists(section, item)\n}", "title": "" }, { "docid": "43bfb3142c5aa2cdcf777073b0a14f80", "score": "0.6875281", "text": "func ItemExists(arrayType interface{}, item interface{}) bool {\n\tarr := reflect.ValueOf(arrayType)\n\n\tfor i := 0; i < arr.Len(); i++ {\n\t\tif arr.Index(i).Interface() == item {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d22bb818df185bcd468511a06769564f", "score": "0.6749168", "text": "func (item *BackupItem) Exists() bool {\n\treturn fileutils.Exists(item.FilePath())\n}", "title": "" }, { "docid": "754409ac634429416e26cb5aba4f436c", "score": "0.6735413", "text": "func itemExists(array []string, product string) bool {\n\tfor _, item := range array {\n\t\tif item == product {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7e968fcc8da3371e5a4918952a32daf3", "score": "0.6683886", "text": "func itemExists(array []string, item string) bool {\n\n\tfor i := 0; i < len(array); i++ {\n\t\tif array[i] == item {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "80528a83fca0aadbddd6ec890355995b", "score": "0.66422373", "text": "func (self *Directory) Has(item string) bool {\n\t_, ok := self.items[item]\n\treturn ok\n}", "title": "" }, { "docid": "c438e065440e046cc056ec73e5e910dd", "score": "0.6560764", "text": "func CartItemExists(ctx context.Context, exec boil.ContextExecutor, iD int64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"cart_items\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, iD)\n\t}\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"orm: unable to check if cart_items exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "9182cde1afaaa60aa066d6c3cfea2a11", "score": "0.65436393", "text": "func (l *List) Exists(item interface{}) bool {\n\ti := l.Index(item)\n\tif i < 0 {\n\t\t// Index didn't find anything, or the list is invalid.\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a07cd9da0fb8003b3c4696e5b86e2204", "score": "0.6498215", "text": "func (o *ViewLockdown) HasItem() bool {\n\tif o != nil && o.Item != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e8d2cc2d319b8f3236c434eb1bbd4f23", "score": "0.6492146", "text": "func (self *ArraySet) Exists(item interface{}) bool{\n return self.Object.Call(\"exists\", item).Bool()\n}", "title": "" }, { "docid": "76cb1480301ec06fb413c2fcb64ecdb4", "score": "0.6483081", "text": "func (m *ObjectManager) Exists(guid interfaces.GUID) bool {\n\tif _, ok := m.ActiveIDs[guid]; ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a9dda3a655f237397fa1c4af64d23bd2", "score": "0.64734805", "text": "func (q cartItemQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (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.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"orm: failed to check if cart_items exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "5c9f21a4aee08e582c93eeb9c7c29a13", "score": "0.6461427", "text": "func (repo *tweetItemRepository) Exists(ctx context.Context, id string) bool {\n\t_, err := repo.Find(ctx, id)\n\treturn err == nil\n}", "title": "" }, { "docid": "234e06a0118c6dabdd5f2e34152aa857", "score": "0.6452603", "text": "func (f *BloomFilter) Exists(ctx context.Context, key, item string) (bool, error) {\n\tcmd := redis.NewBoolCmd(ctx, \"BF.EXISTS\", key, item)\n\tf.client.Process(ctx, cmd)\n\treturn cmd.Result()\n}", "title": "" }, { "docid": "078cce24a193d58f75d924ecc573ffe2", "score": "0.6442935", "text": "func (w *Worker) hasItem(newItem Item) bool {\n\tfor _, item := range w.items {\n\t\tif item == newItem {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "31df1e1acc41ceaf4a8181239c9449fb", "score": "0.64227074", "text": "func (ddb *Dynalock) Exists(ctx context.Context, key string, options ...ReadOption) (bool, error) {\n\n\treadOptions := NewReadOptions(options...)\n\n\treq := ddb.dynamoSvc.GetItemRequest(&dynamodb.GetItemInput{\n\t\tTableName: aws.String(ddb.tableName),\n\t\tKey: buildKeys(ddb.partition, key),\n\t\tConsistentRead: aws.Bool(readOptions.consistent),\n\t})\n\tres, err := req.Send(ctx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif res.Item == nil {\n\t\treturn false, nil\n\t}\n\n\t// is the item expired?\n\tif isItemExpired(res.Item) {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "2c42236f56b54226a33fd3fe6ce74f83", "score": "0.6253303", "text": "func Exists(id int) bool {\n\texists, err := ExistsProduct(id)\n\tif err != nil {\n\t\tfmt.Printf(\"Error when try chek if product exists. %s\\n\", err)\n\t\treturn true\n\t}\n\n\treturn exists\n}", "title": "" }, { "docid": "40692eaea2516dd42b8a1ea4890a8daf", "score": "0.62492937", "text": "func (o *ActivityActivity) HasItem() bool {\n\tif o != nil && o.Item != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9febed4f5f7d99e399eddfd5bf7013e3", "score": "0.6223137", "text": "func (br *BuyRequest) Exists() bool {\n\treturn br._exists\n}", "title": "" }, { "docid": "711d7b712b60a759db0f84e39c4846bd", "score": "0.62220544", "text": "func (s *set) Exist(item uint64) bool {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\t_, ok := s.data[item]\n\treturn ok\n}", "title": "" }, { "docid": "539ad26f83b9792a9f6c8d11d7fb01de", "score": "0.6219124", "text": "func (sb *ScBanner) Exists() bool {\n\treturn sb._exists\n}", "title": "" }, { "docid": "a177ac447120cf1f2a186b04ef003581", "score": "0.61565745", "text": "func (ap *AgPay) Exists() bool {\n\treturn ap._exists\n}", "title": "" }, { "docid": "a2dce242ab9cb8d589261b7b6fe0d005", "score": "0.6154652", "text": "func (meta *ShardingMeta) checkItemExists(item *DDLItem) (int, bool) {\n\tsource, ok := meta.sources[item.Source]\n\tif !ok {\n\t\treturn 0, false\n\t}\n\tfor idx, ddlItem := range source.Items {\n\t\tif binlog.CompareLocation(item.FirstLocation, ddlItem.FirstLocation, meta.enableGTID) == 0 {\n\t\t\treturn idx, true\n\t\t}\n\t}\n\treturn len(source.Items), false\n}", "title": "" }, { "docid": "59ed2a337d4c4629c6afab46e0006299", "score": "0.61136204", "text": "func (q appPlaybookQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if app_playbook exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "80287a2a4c79ca43340e9b5557ec45b1", "score": "0.6095312", "text": "func (s *Store) Exists() bool {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.Result.Search.Value != nil\n}", "title": "" }, { "docid": "60523a160a69728727f2eef45c93839a", "score": "0.6077064", "text": "func (m *Module) Exists(id string) bool {\n\t_, err := Find(id)\n\treturn err == nil\n}", "title": "" }, { "docid": "c263b18bc4d4a465f8ef1f920b180cb1", "score": "0.6069643", "text": "func (l *Library) Has(name borges.RepositoryID) (bool, borges.LibraryID, borges.LocationID, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), l.options.Timeout)\n\tdefer cancel()\n\n\tlocs, err := l.locations(ctx)\n\tif err != nil {\n\t\treturn false, \"\", \"\", err\n\t}\n\n\tit := util.NewLocationIterator(locs)\n\tdefer it.Close()\n\n\tfor {\n\t\tlocation, err := it.Next()\n\t\tif err == io.EOF {\n\t\t\treturn false, \"\", \"\", nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn false, \"\", \"\", err\n\t\t}\n\n\t\tloc, _ := location.(*Location)\n\n\t\thas, err := loc.has(ctx, name)\n\t\tif err != nil {\n\t\t\treturn false, \"\", \"\", err\n\t\t}\n\n\t\tif has {\n\t\t\treturn true, l.id, loc.ID(), nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0db268c8fddd586d05d99a918921ad0a", "score": "0.6068194", "text": "func (o *DriveItem) HasListItem() bool {\n\tif o != nil && o.ListItem != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2a958191c71d6e6cdb4c6f8990195df0", "score": "0.60658187", "text": "func (s *Storage) Exists(ctx context.Context, module, version string) (bool, error) {\n\tconst op errors.Op = \"s3.Exists\"\n\tctx, span := observ.StartSpan(ctx, op.String())\n\tdefer span.End()\n\n\tpkgName := config.PackageVersionedName(module, version, \"mod\")\n\thoParams := &s3.HeadObjectInput{\n\t\tBucket: aws.String(s.bucket),\n\t\tKey: aws.String(pkgName),\n\t}\n\n\tif _, err := s.s3API.HeadObjectWithContext(ctx, hoParams); err != nil {\n\t\tif err.(awserr.Error).Code() == s3ErrorCodeNotFound {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, errors.E(op, err, errors.M(module))\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "b83fa7c3466043166d85a425943d3573", "score": "0.6062548", "text": "func (b VersioningBucket) Exists(db weave.KVStore, idRef VersionedIDRef) (bool, error) {\n\t_, err := b.GetVersion(db, idRef)\n\tswitch {\n\tcase err == nil:\n\t\treturn true, nil\n\tcase errors.ErrNotFound.Is(err):\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, errors.Wrap(err, \"failed to load object\")\n\t}\n}", "title": "" }, { "docid": "70b2c4aca4779a34c41977b4d02a6454", "score": "0.60593224", "text": "func (o *Odai) Exists() bool {\n\treturn o._exists\n}", "title": "" }, { "docid": "8bf22137dbafbe0a47a8cc46cc517839", "score": "0.6053983", "text": "func (obj *RawCardList) HasItem() bool {\n\tproxyResult := /*pr4*/ C.vssc_raw_card_list_has_item(obj.cCtx)\n\n\truntime.KeepAlive(obj)\n\n\treturn bool(proxyResult) /* r9 */\n}", "title": "" }, { "docid": "d1a8c68c7f9abc9b4f3657753477496d", "score": "0.6018994", "text": "func (hs *HashSearch) Has(item string) bool {\n\treturn hs.hashes.Has(HashString(item))\n}", "title": "" }, { "docid": "9da258b85b6d24c10a1feecf9a62fc82", "score": "0.6013094", "text": "func (g *Group) Exists(vars Code, formula1 Code, formula2 Code) *Statement {\n\ts := Exists(vars, formula1, formula2)\n\tg.items = append(g.items, s)\n\treturn s\n}", "title": "" }, { "docid": "3a2f77db7d5f386ad10bfdbe2eef1a09", "score": "0.59933", "text": "func (wm *WsubModule) Exists() bool {\n\treturn wm._exists\n}", "title": "" }, { "docid": "17bcb6e112cbe25f7a01f94f4b03b3d5", "score": "0.59816647", "text": "func Exists(client *occlient.Client, componentType string) (bool, error) {\n\n\ts := log.Spinner(\"Checking component\")\n\tdefer s.End(false)\n\tcatalogList, err := List(client)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"unable to list catalog\")\n\t}\n\n\tfor _, supported := range catalogList {\n\t\tif componentType == supported.Name || componentType == fmt.Sprintf(\"%s/%s\", supported.Namespace, supported.Name) {\n\t\t\ts.End(true)\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "7ba7e8c064de11c6ef6ea88cc671fc5d", "score": "0.5964949", "text": "func (t *LLRB) Has(key Item) bool {\n\treturn t.Get(key) != nil\n}", "title": "" }, { "docid": "409210269e711ceb80c5b4cba5b21192", "score": "0.5962558", "text": "func (wm *WsubMenu) Exists() bool {\n\treturn wm._exists\n}", "title": "" }, { "docid": "2bebc665236ee6e5a3f38d9a50fb5e43", "score": "0.5944179", "text": "func (xpgpi *XProdGrpProdIntertable) Exists() bool {\n\treturn xpgpi._exists\n}", "title": "" }, { "docid": "40bc593a3e8634900f6f74f23d3b2edc", "score": "0.5930258", "text": "func (cli *BusinessWrapper) IsExists() (bool, error) {\n\treturn cli.business.IsExists()\n}", "title": "" }, { "docid": "ec8661d40f0b77a2c7cd033192447a35", "score": "0.5929039", "text": "func (vaultStorage *VaultStorage) Exists(key string) bool {\n\tres := utils.QueryStore(vaultStorage.API + loadURL + key)\n\treturn len(res.Data.Data) > 0 && !res.Data.Metadata.Destroyed\n}", "title": "" }, { "docid": "9b2d73c8670555b6c986a41a5a5adaea", "score": "0.5918843", "text": "func (o *Outbox) Exists() bool {\n\treturn o._exists\n}", "title": "" }, { "docid": "50065c6036fd3107bc02aff1bdd24c87", "score": "0.5914583", "text": "func (_Gods *GodsCaller) Exists(opts *bind.CallOpts, _tokenId *big.Int) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Gods.contract.Call(opts, out, \"exists\", _tokenId)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e87f6285209282a447894bf6076b9bb5", "score": "0.59143347", "text": "func (s *SystemService) Exists() bool {\n\tplist := newPlist(s)\n\n\treturn fileExists(plist.Path())\n}", "title": "" }, { "docid": "033c43c07a9f84a22fd438025a8deda6", "score": "0.5907982", "text": "func (xp *XPostn) Exists() bool {\n\treturn xp._exists\n}", "title": "" }, { "docid": "366f0682045447f7d562a79896f5d5df", "score": "0.590577", "text": "func (l *Legality) Exists() bool {\n\treturn l._exists\n}", "title": "" }, { "docid": "fdb82a9a44678d492dee0347321a1134", "score": "0.5905568", "text": "func (m CMap) Exists(key string) bool {\n\t// Get shard\n\tshard := m.GetShard(key)\n\tshard.RLock()\n\t// Get item from shard.\n\t_, ok := shard.items[key]\n\tshard.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "f0fb63687ff1fdaef95cebec60e8c7a1", "score": "0.589529", "text": "func (sl *SkipList) Has(item Item) bool { return sl.Get(item) != nil }", "title": "" }, { "docid": "f1afbf43b270e94d16fca82e21e06c3c", "score": "0.5894276", "text": "func (r *BzrReader) Exists(l Location) (string, Resulter, error) {\n\treturn BzrExists(r, l)\n}", "title": "" }, { "docid": "d45a6dce3798a75fd650c0066ad3fef0", "score": "0.589125", "text": "func (biq *BinaryItemQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := biq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn biq.sqlExist(ctx)\n}", "title": "" }, { "docid": "e945b79aede25784742035588417b17c", "score": "0.5876423", "text": "func (c *Category) Exists() bool {\n\treturn c._exists\n}", "title": "" }, { "docid": "e331b477befd09c7c019ac80f2011939", "score": "0.5850187", "text": "func (u *BzrUpdater) Exists(l Location) (string, Resulter, error) {\n\treturn BzrExists(u, l)\n}", "title": "" }, { "docid": "1ec250cfbb126bf942c3ced2daaef2cf", "score": "0.58402526", "text": "func (o *MicrosoftGraphSharedDriveItem) HasListItem() bool {\n\tif o != nil && o.ListItem != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "af15a29d6095d43c27c6ec8a1139ff8c", "score": "0.58399695", "text": "func (o *InstallStatusStatus) HasItemCount() bool {\n\tif o != nil && o.ItemCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1bc89a9ad56c81779b3e153f04743053", "score": "0.583581", "text": "func (g *Garbager) Exists(ctx context.Context, c cid.Cid) bool {\n\t// check chain get / blockstore get\n\t_, err := g.node.ChainReadObj(ctx, c)\n\tif ipld.IsNotFound(err) {\n\t\treturn false\n\t} else if err != nil {\n\t\tg.t.Fatalf(\"ChainReadObj failure on existence check: %s\", err)\n\t\treturn false // unreachable\n\t} else {\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "939337f76823a1a4b3ceef16e89df9cb", "score": "0.5829062", "text": "func (bkt *Bucket) Exists(key int) (ok bool) {\n\tbkt.mtx.Lock()\n\tdefer bkt.mtx.Unlock()\n\t_, ok = bkt.data[key]\n\treturn\n}", "title": "" }, { "docid": "0055d75db04e512eb91eb93c1e0dab2e", "score": "0.5823372", "text": "func AppPlaybookExists(exec boil.Executor, id int64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from `app_playbook` where `id`=? 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 app_playbook exists\")\n\t}\n\n\treturn exists, nil\n}", "title": "" }, { "docid": "cd80815df99b229fca1d539c986a3e2f", "score": "0.58141977", "text": "func HasItem(m Matcher) Matcher {\n\treturn &mHasItem{m}\n}", "title": "" }, { "docid": "0f44add3dd04f5f124c37d51cd62678e", "score": "0.5809387", "text": "func (e *existenceList) Exists(osdID int) bool {\n\t_, ok := e.m[osdID]\n\treturn ok\n}", "title": "" }, { "docid": "e6c12e87452cf8bdf720529293a9f4f0", "score": "0.58010715", "text": "func (c *DefaultCache) Exists(key string) (bool, error) {\n\tc.m.RLock()\n\ti, ok := c.items[key]\n\tc.m.RUnlock()\n\n\tif !ok {\n\t\treturn false, nil\n\t}\n\n\tif c.hasExpired(i) {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "08de0aa0476f7a30d2132254edb93c48", "score": "0.5797587", "text": "func (c *Component) Exists(di ds.Interface) (bool, error) {\n\ter, err := di.Exists(di.KeyForObj(c.entity()))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn er.All(), nil\n}", "title": "" }, { "docid": "44f0444c74a65bd933b3fcd58202af21", "score": "0.5797389", "text": "func (o *KeystoreInfo) HasExists() bool {\n\tif o != nil && o.Exists != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b98a32f867fb9d185ef8292396ba9c82", "score": "0.5795207", "text": "func (s *Supplier) Exists() bool {\n\treturn s._exists\n}", "title": "" }, { "docid": "43f9a52c59081aff27441e81eb2d15fc", "score": "0.57770073", "text": "func (r *EventRepository) IsExists(ID int64) (bool, error) {\n\treturn false, errors.New(\"method IsExists is not supported in RPC context\")\n}", "title": "" }, { "docid": "70ed8eab4463ebcaa4ecce7c4403e76c", "score": "0.57642", "text": "func (q apiAppQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (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.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if api_apps exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "956ad5de390d14fc45d73f928ac85ef3", "score": "0.57622", "text": "func (q manufacturerQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (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.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"db: failed to check if manufacturer exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "f5adc1bd6aeaac38a182c79fa6a5b97a", "score": "0.57616025", "text": "func (s *Silo) Exists(key string) (bool, error) {\n\treturn s.store.Exists(key)\n}", "title": "" }, { "docid": "aefd0054b9461d4ee4cb818a01969c56", "score": "0.57571095", "text": "func main() {\n\tvar strSlice = []string{\"banana\", \"apple\", \"peach\", \"managa\", \"dates\"}\n\tfmt.Println(itemExists(strSlice, \"apple\"))\n\tfmt.Println(itemExists(strSlice, \"orange\"))\n}", "title": "" }, { "docid": "e082c0f62eeac632ed6380a0fca85738", "score": "0.57459986", "text": "func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error) {\n\tassetJSON, err := ctx.GetStub().GetState(id)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to read from world state: %v\", err)\n\t}\n\n\treturn assetJSON != nil, nil\n}", "title": "" }, { "docid": "ab7e09466eea18677222109bc634650d", "score": "0.5744179", "text": "func (s *ContentStore) Exists(pointer Pointer) (bool, error) {\n\t_, err := s.ObjectStorage.Stat(pointer.RelativePath())\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "938232c84c6ebc2c1cb0661c8f03cc9b", "score": "0.57431644", "text": "func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, assetType, id string) (bool, error) {\n\tassetJSON, err := ctx.GetStub().GetState(getBondAssetKey(assetType, id))\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to read asset record from world state: %v\", err)\n\t}\n\n\treturn assetJSON != nil, nil\n}", "title": "" }, { "docid": "12d3a4466b9cb805d4c08c922c8eaaf5", "score": "0.57429326", "text": "func (q stockPubQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"chado: failed to check if stock_pub exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "cde7a26c416c0e789157bd21aa25cb52", "score": "0.5730036", "text": "func (t *Tag) Exists() bool {\n\treturn t._exists\n}", "title": "" }, { "docid": "3f4c6f3e5e2b051e27bd75e5428e0acc", "score": "0.57277274", "text": "func (ma *MidAd) Exists() bool { //mid_ad\n\treturn ma._exists\n}", "title": "" }, { "docid": "3852919af5c31146671a1d925e7b8060", "score": "0.57265556", "text": "func (f *Factory) IsExists(names []string) bool {\n\treturn f.registry.IsExists(names)\n}", "title": "" }, { "docid": "634b4f4e2840342822b9cd3b9c755d5c", "score": "0.5719918", "text": "func (q appPlaybookQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "ee633f98cec8fdf3c9b218555cc5eb47", "score": "0.57089406", "text": "func (s *Discovery) Exists(key string) (bool, error) {\n\treturn s.store.Exists(key)\n}", "title": "" }, { "docid": "f70d50d88c5df0ea2e9956729c398ebd", "score": "0.57069004", "text": "func (manager *IPManager) Exists(ip string) (bool, error) {\n\tok, err := manager.client.Exists(ip)\n\tif err == store.ErrKeyNotFound {\n\t\treturn false, nil\n\t}\n\n\treturn ok, err\n}", "title": "" }, { "docid": "a0cbe5f3a1835e9bcbd5cb2ce10414f3", "score": "0.5703084", "text": "func (xoa *XOptionAttr) Exists() bool {\n\treturn xoa._exists\n}", "title": "" }, { "docid": "6b903b826201730e7e41b5c72c9ff3f9", "score": "0.569687", "text": "func (me TxsdSystemitemClass) IsLibrary() bool { return me == \"library\" }", "title": "" }, { "docid": "dff3bd5cff012c9a8ee6c4920207b5e4", "score": "0.56947106", "text": "func (s *StorageClient) Exists(ctx context.Context, key string) (bool, error) {\n\tresp, err := s.client.StorageExists(ctx, &proto.StorageExistsRequest{\n\t\tKey: key,\n\t\tSession: s.session.ToProto(),\n\t})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn resp.Exists, nil\n}", "title": "" }, { "docid": "2c8e82f309047fb10747ecd83f907ee8", "score": "0.5692893", "text": "func (sdiq *SysDictItemQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := sdiq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn sdiq.sqlExist(ctx)\n}", "title": "" }, { "docid": "df692338c8dc4333f9711bf833abfc78", "score": "0.56918293", "text": "func Exists(id uuid.UUID) (bool, error) {\n\tif _, err := Find(id); err != nil {\n\t\tif errors.Cause(err) == store.ErrNotFound {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, errors.Wrap(err, \"error checking if blocklist exists\")\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "a55af48606875f5c4ed32e3aec71892f", "score": "0.56897634", "text": "func (a Items) Contains(i Item) bool {\n\tif i.IsValid() {\n\t\tfor x := range a {\n\t\t\tif a[x] == i {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "da09ae25a464e5c01f9ec35a4e32b0da", "score": "0.56887895", "text": "func (kps *KeepPartStock) Exists() bool { //keep_part_stock\n\treturn kps._exists\n}", "title": "" }, { "docid": "030e9936d165caf36f8f536acd940a78", "score": "0.5683788", "text": "func (s Set) Has(item interface{}) bool {\n\t_, exists := s[item]\n\treturn exists\n}", "title": "" }, { "docid": "aec5ff3869df73fecab57f0855a6f033", "score": "0.56822914", "text": "func (q auditPackageQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (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.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if audit_package exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "ff031351fa304d38f4c6e7faf4061c48", "score": "0.56703687", "text": "func (j*Jobs) Exists(title string) bool{\n\t_, ok := j.jobs[title]\n\tif ok {\n\t\treturn true\n\t}\n\n\t_, ok2 := j.groupjobs[title]\n\tif ok2 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f019725d1121b8518fd593f93d0e8bf7", "score": "0.56685877", "text": "func (s *Store) Exists(ctx context.Context, name string) bool {\n\t_, err := s.Get(ctx, name)\n\treturn err == nil\n}", "title": "" }, { "docid": "5e1d142cf048ee9233e7e55a2d848bf8", "score": "0.5667682", "text": "func Exists(ctx context.Context, name string, options *ExistsOptions) (bool, error) {\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tresponse, err := conn.DoRequest(nil, http.MethodGet, \"/manifests/%s/exists\", nil, nil, name)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer response.Body.Close()\n\n\treturn response.IsSuccess(), nil\n}", "title": "" }, { "docid": "72c34e7c69cd6f5a64cad7e872f2fd51", "score": "0.5666852", "text": "func Exists(inputKey string) bool {\n\t_, ok := Get(inputKey)\n\treturn ok\n}", "title": "" }, { "docid": "157b3f5fb8b1e8a5bad8a27f7cddec4c", "score": "0.56651103", "text": "func (app *RepositoryServiceForTests) Exists(filePath string) bool {\n\tdata, err := app.Retrieve(filePath)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn len(data) > 0\n}", "title": "" }, { "docid": "4dd59094e30aa30308ab130013e362a8", "score": "0.5660017", "text": "func (o *ViewLockdown) HasItemID() bool {\n\tif o != nil && o.ItemID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "88b8dd007274194e922346c6c2c02364", "score": "0.5653822", "text": "func (self *Rope) Exists() bool{\n return self.Object.Get(\"exists\").Bool()\n}", "title": "" }, { "docid": "b54f3dbda111260278171fe4810ca89b", "score": "0.564932", "text": "func (o *CreditSessionBankEmploymentResult) HasItemId() bool {\n\tif o != nil && o.ItemId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "855c0e12d3c021fbc4d7b6cf0e86c7b0", "score": "0.5646408", "text": "func (storage *AppRepository) AppExists(id string) (bool, error) {\n\tstmt, err := storage.dbHolder.db.Prepare(appExistsSQL)\n\n\tif err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"AppExists: preparing statement failed: %v\\n\", err)\n\t\treturn false, err\n\t}\n\n\trow := stmt.QueryRow(id)\n\n\tdefer stmt.Close()\n\n\tvar exists bool\n\n\terr = row.Scan(&exists)\n\n\tif err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"AppExists: query scan failed: %v\\n\", err)\n\t\treturn false, err\n\t}\n\n\treturn exists, nil\n}", "title": "" } ]
14f49586690fa445e99806e2031b33c8
HasAFT reports whether and IE has AFT bit.
[ { "docid": "0b0cac03a83829329d5b1cfdfab04149", "score": "0.84737134", "text": "func (i *IE) HasAFT() bool {\n\tv, err := i.UsageInformation()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has2ndBit(v)\n}", "title": "" } ]
[ { "docid": "4ba91a2fcfdb121b9c909be33e12de88", "score": "0.59737825", "text": "func (i *IE) HasUAE() bool {\n\tv, err := i.UsageInformation()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has3rdBit(v)\n}", "title": "" }, { "docid": "6498b4a80810bf361d02cea264298603", "score": "0.57345927", "text": "func (ab *backend) HasFua(ctx context.Context) bool {\n\treturn true\n}", "title": "" }, { "docid": "c639c5aafdb29d9dc0a492efbcd7f336", "score": "0.5561756", "text": "func (i *IE) HasBEF() bool {\n\tv, err := i.UsageInformation()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has1stBit(v)\n}", "title": "" }, { "docid": "83b41e1b7e962d15af825408bf807582", "score": "0.5544225", "text": "func (player *Player) HasAwp() bool {\n\tfor _, eq := range player.Inventory {\n\t\tif eq == demoinfo.EqAWP {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a4b523dc7e3e9e0b12fb46e2e1d18e11", "score": "0.5530196", "text": "func (o *AdapterUnitAllOf) HasHostFcIfs() bool {\n\tif o != nil && o.HostFcIfs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7c41d8489c5f998a5399708dcced44a5", "score": "0.538046", "text": "func (vfs *OrefaFS) HasFeature(feature avfs.Feature) bool {\n\treturn vfs.feature&feature == feature\n}", "title": "" }, { "docid": "270d71b0c2e3cfb9aa1cbec036dfcc14", "score": "0.5362598", "text": "func (o *AdapterUnitAllOf) HasHostEthIfs() bool {\n\tif o != nil && o.HostEthIfs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a493cb8ed8568b2146de1fa2f25913e2", "score": "0.5319121", "text": "func (i *IE) HasQAURR() bool {\n\tif i.Type != PFCPSMReqFlags {\n\t\treturn false\n\t}\n\tif len(i.Payload) < 1 {\n\t\treturn false\n\t}\n\n\treturn has3rdBit(i.Payload[0])\n}", "title": "" }, { "docid": "a851e8a99b405703e62c902d42a8166c", "score": "0.5312823", "text": "func (o *Share) HasExportToAfp() bool {\n\tif o != nil && o.ExportToAfp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "065450fd5a5e295921561182ff793b31", "score": "0.530326", "text": "func (vfs *OsFS) HasFeature(feature avfs.Feature) bool {\n\treturn vfs.feature&feature == feature\n}", "title": "" }, { "docid": "e97938cdfcdfdaaaf21f1c33494e8a39", "score": "0.52995557", "text": "func (o *AdapterUnitAllOf) HasExtEthIfs() bool {\n\tif o != nil && o.ExtEthIfs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5b70f34ac6b0df57df9903562437d7b7", "score": "0.5282415", "text": "func (m NoOrders) HasRule80A() bool {\n\treturn m.Has(tag.Rule80A)\n}", "title": "" }, { "docid": "cd077e8eff8c7370b4f6bc2d1ece5dec", "score": "0.52322286", "text": "func (mh *MOBIHeader) hasEXTH() bool {\n\treturn (mh.EXTHFlags & 0x40) != 0\n}", "title": "" }, { "docid": "d21fea3e2dcba27ba8e14baaf08f53f0", "score": "0.5228366", "text": "func HasFeature(f string) bool {\n\treturn strings.Contains(os.Getenv(\"DD_APM_FEATURES\"), f)\n}", "title": "" }, { "docid": "dabf395c99c0237622c1b0e026ffdc4f", "score": "0.52185994", "text": "func HasThermalAndPowerFeature(feature uint32) bool {\n\treturn (thermalAndPowerFeatureFlags & feature) != 0\n}", "title": "" }, { "docid": "f635af350d006a089805a5dbf6c56c2e", "score": "0.5181096", "text": "func (i *IE) HasQAURR() bool {\n\tif len(i.Payload) < 1 {\n\t\treturn false\n\t}\n\n\tswitch i.Type {\n\tcase PFCPSMReqFlags:\n\t\tv, err := i.PFCPSMReqFlags()\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\treturn has3rdBit(v)\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "688e49e38d7a4e582c7d2bc6f9f2096d", "score": "0.51800233", "text": "func (i *IE) HasEVENT() bool {\n\tv, err := i.MeasurementMethod()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has3rdBit(v)\n}", "title": "" }, { "docid": "b9aef7be36ecc7f815ee2f2374a0e635", "score": "0.5178382", "text": "func HasExtendedFeature(feature uint64) bool {\n\treturn (extendedFeatureFlags & feature) != 0\n}", "title": "" }, { "docid": "8aa6ed812d7385b548a4a1aef70ddb02", "score": "0.5028897", "text": "func (i *IE) HasUBE() bool {\n\tv, err := i.UsageInformation()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has4thBit(v)\n}", "title": "" }, { "docid": "20fc3107f8a59653f8aaf84bc2c0989b", "score": "0.50279665", "text": "func (m Advertisement) HasFactor() bool {\n\treturn m.Has(tag.Factor)\n}", "title": "" }, { "docid": "59e7144928cd4ebe139aeb70b10fba27", "score": "0.502373", "text": "func (o *RESTLogin) HasMfaEnabled() bool {\n\tif o != nil && o.MfaEnabled != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "178d5555d899e50f0d48e4c288608b64", "score": "0.5023491", "text": "func (o *HyperflexHxHostMountStatusDtAllOf) HasAccessibility() bool {\n\tif o != nil && o.Accessibility != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd4e537c5662f2207145caf2a16f3359", "score": "0.49992645", "text": "func (o *HyperflexHxHostMountStatusDt) HasAccessibility() bool {\n\tif o != nil && o.Accessibility != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9bb46860a563d9d08a3936a2e868e640", "score": "0.49805033", "text": "func (o *EquipmentSwitchCard) HasFcSwitchingMode() bool {\n\tif o != nil && o.FcSwitchingMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6cacb1db1afcb9fda7de2c88ff37d39c", "score": "0.49754605", "text": "func (o *ModelsAccount) HasBaasFeaturesEnabled() bool {\n\tif o != nil && o.BaasFeaturesEnabled != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b8119bc0c5bf4947ac16fd5fb29e8516", "score": "0.4973352", "text": "func (i *IE) HasINAM() bool {\n\tif i.Type != MeasurementInformation {\n\t\treturn false\n\t}\n\tif len(i.Payload) < 1 {\n\t\treturn false\n\t}\n\n\treturn has2ndBit(i.Payload[0])\n}", "title": "" }, { "docid": "8feadff06f36187ed68cf6db342b9794", "score": "0.4971991", "text": "func (t *TileDefRequest) HasApmQuery() bool {\n\tif t != nil && t.ApmQuery != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9f34c1d07380ec8330202c7fe4888f14", "score": "0.49593553", "text": "func (o *Event) HasShowAs() bool {\n\tif o != nil && o.ShowAs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "59f519354e1bb97699412aa052732f87", "score": "0.49545613", "text": "func (u *UserAgentParser) HasIsEncoded() bool {\n\tif u != nil && u.IsEncoded != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "26a14d034ec7bc704bde58bd64b83f4e", "score": "0.4947916", "text": "func (o *Windows10SecureAssessmentConfiguration) HasAllowTextSuggestion() bool {\n\tif o != nil && o.AllowTextSuggestion != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ce6a132f655b06294fb47ed18f7830f6", "score": "0.49449152", "text": "func (m Advertisement) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "0001a984f9ae802251b4def9b04e29da", "score": "0.49348283", "text": "func (e *Event) HasAlertType() bool {\n\tif e != nil && e.AlertType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "868764946c2d3cc76f3b68c180868a97", "score": "0.4920584", "text": "func (m TradeCaptureReportRequest) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "23ffa371b9643dbb2743b09ca1b5894f", "score": "0.48983485", "text": "func (fr *Frame) Has(f uint8) bool {\n\treturn (fr.flags & f) == f\n}", "title": "" }, { "docid": "9ab36abfd04c6da23ae89d939e3184d2", "score": "0.48902294", "text": "func (t *NetworkInstance) GetAfts() *NetworkInstance_Afts {\n\tif t != nil && t.Afts != nil {\n\t\treturn t.Afts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "656cae9f65482cc95b64d8d62bc13c66", "score": "0.4888674", "text": "func (o *MicrosoftGraphWindowsUpdateActiveHoursInstall) HasActiveHoursEnd() bool {\n\tif o != nil && o.ActiveHoursEnd != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "85729156b96ec93888615805c8115a99", "score": "0.48798922", "text": "func (m NewOrderSingle) HasRule80A() bool {\n\treturn m.Has(tag.Rule80A)\n}", "title": "" }, { "docid": "8ffea7def1ae4d6899641f7fb77c0c5b", "score": "0.48666042", "text": "func (t *Time) HasHour() bool { return (t.set & hourFlag) != 0 }", "title": "" }, { "docid": "a401983bfd718b6c8c5274c8f29dde16", "score": "0.48630214", "text": "func (o *AdapterUnitAllOf) HasThermal() bool {\n\tif o != nil && o.Thermal != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "34e145557cad23cdbc2126716818aa8a", "score": "0.48558387", "text": "func (o *AdapterAdapterConfigAllOf) HasFcSettings() bool {\n\tif o != nil && o.FcSettings.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e33f1ce1936b961ef8dbc8388b159ccb", "score": "0.48516324", "text": "func HasKnownEncoder(mimeType string) bool {\n\treturn KnownEncoders[mimeType][1] != \"\"\n}", "title": "" }, { "docid": "08359659f2975f1dac54b67d668e65d8", "score": "0.4848518", "text": "func (_this *DisplayCapabilities) HasExternalDisplay() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"hasExternalDisplay\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" }, { "docid": "badb4321af1aa7271996792faf4ee49f", "score": "0.48353824", "text": "func (o *BankTransferCreateRequest) HasAchClass() bool {\n\tif o != nil && o.AchClass != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7af4fc6240c46c90a77e4491924feb6d", "score": "0.48314995", "text": "func TestHTT(t *testing.T) {\n\tgot := CPU.HTT()\n\texpected := CPU.Features&HTT == HTT\n\tif got != expected {\n\t\tt.Fatalf(\"HTT: expected %v, got %v\", expected, got)\n\t}\n\tt.Log(\"HTT Support:\", got)\n}", "title": "" }, { "docid": "629ada2045f01f50e81c303dc62d15a2", "score": "0.4830856", "text": "func supportsAufs() error {\n\t// We can try to modprobe aufs first before looking at\n\t// proc/filesystems for when aufs is supported\n\texec.Command(\"modprobe\", \"aufs\").Run()\n\n\tif unshare.IsRootless() {\n\t\treturn ErrAufsNested\n\t}\n\n\tf, err := os.Open(\"/proc/filesystems\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\ts := bufio.NewScanner(f)\n\tfor s.Scan() {\n\t\tif strings.Contains(s.Text(), \"aufs\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn ErrAufsNotSupported\n}", "title": "" }, { "docid": "c5d94d2e59cddeaa724d47ade87b7351", "score": "0.4823079", "text": "func HasAmbulance() predicate.Transport {\n\treturn predicate.Transport(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(AmbulanceTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, AmbulanceTable, AmbulanceColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "4acf9a7026e215bae144cabbf76379ba", "score": "0.48196328", "text": "func (o *Share) HasExportToFtp() bool {\n\tif o != nil && o.ExportToFtp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "548014f87a3159565dab77348b3b3764", "score": "0.4815928", "text": "func (s *NetworkInstance) GetAfts() *NetworkInstance_Afts {\n\tif s != nil && s.Afts != nil {\n\t\treturn s.Afts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "548014f87a3159565dab77348b3b3764", "score": "0.4815928", "text": "func (s *NetworkInstance) GetAfts() *NetworkInstance_Afts {\n\tif s != nil && s.Afts != nil {\n\t\treturn s.Afts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "548014f87a3159565dab77348b3b3764", "score": "0.4815928", "text": "func (s *NetworkInstance) GetAfts() *NetworkInstance_Afts {\n\tif s != nil && s.Afts != nil {\n\t\treturn s.Afts\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "497e245d844f2b1cb30a77b3cfbc72ec", "score": "0.4813808", "text": "func (o *StorageHitachiPort) HasFabricMode() bool {\n\tif o != nil && o.FabricMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d3f855fcd30be40b96f07c0778d30e16", "score": "0.48070276", "text": "func (fh FrameHeader) HasFlow() bool {\n\treturn FrameFlag(fh[2])&FrameFlagFlow == FrameFlagFlow\n}", "title": "" }, { "docid": "12440379a5c544c931a1c825aecdcdb2", "score": "0.4804569", "text": "func (m NoOrders) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "12440379a5c544c931a1c825aecdcdb2", "score": "0.4804569", "text": "func (m NoOrders) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "5fc03c346029b414df9ed2c47d1e69e9", "score": "0.48019212", "text": "func (o *NiatelemetryApicPerformanceData) HasEqptStorageFirmware() bool {\n\tif o != nil && o.EqptStorageFirmware.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c58c6f5130fd715ba47a1362bcd4f463", "score": "0.48017517", "text": "func (o *Alert) HasAzureTenantId() bool {\n\tif o != nil && o.AzureTenantId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a243b907ef2bad9b240aa651f8f9ddfa", "score": "0.47977814", "text": "func (o *StorageHitachiHostAllOf) HasAuthenticationMode() bool {\n\tif o != nil && o.AuthenticationMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "15b8892c7c393e6fe48fe5480b5ab46b", "score": "0.4797405", "text": "func Installed() bool {\n\treturn bool(C.al_is_acodec_addon_initialized())\n}", "title": "" }, { "docid": "472468ed66b6515653b45b6588724dc9", "score": "0.47960314", "text": "func phySupportsFrequency(phy *iw.Phy, freq int) bool {\n\tfor _, b := range phy.Bands {\n\t\tif _, ok := b.FrequencyFlags[freq]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4feca6b3c557708f8ded977e98be6111", "score": "0.47945094", "text": "func (o *AdapterAdapterConfig) HasFcSettings() bool {\n\tif o != nil && o.FcSettings.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2f38a2f6b7c987ca65c4a4f53c11dc70", "score": "0.47921032", "text": "func HasFeature(feature uint64) bool {\n\treturn (featureFlags & feature) != 0\n}", "title": "" }, { "docid": "86120a4b30782194c228910b4c0a3e66", "score": "0.47913638", "text": "func (o *StorageHitachiPort) HasIsIpv6Enable() bool {\n\tif o != nil && o.IsIpv6Enable != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bd871eff15317a40af0e366d4c028196", "score": "0.47877073", "text": "func (o *HyperflexCapability) HasEncryptionSupported() bool {\n\tif o != nil && o.EncryptionSupported != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "af4e83f2f9494f284ee1e1c9bd2a8469", "score": "0.4776134", "text": "func (o *VnicFcAdapterPolicy) HasTxQueueSettings() bool {\n\tif o != nil && o.TxQueueSettings.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7cc170951444138ff61f50b1deb57c9f", "score": "0.4771316", "text": "func (m AllocationReportAck) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "712b8fe7e6333a3269dc80f97cf7a7a5", "score": "0.4767502", "text": "func (e *Env) HasFeature(flag int) bool {\n\tenabled, has := e.features[flag]\n\treturn has && enabled\n}", "title": "" }, { "docid": "40bbefab00a50ee496dd4f91f55d7af0", "score": "0.47614777", "text": "func (o *CustconfResponseHeader) HasEnableETag() bool {\n\tif o != nil && o.EnableETag != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f1aa0f318708ed3d72b1630b28385e96", "score": "0.47592455", "text": "func (o *WindowsUpdateForBusinessConfiguration) HasFeatureUpdatesPauseExpiryDateTime() bool {\n\tif o != nil && o.FeatureUpdatesPauseExpiryDateTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "626d8df9bed6d0e42d8e002aae44ff13", "score": "0.47472966", "text": "func (builder *QemuBuilder) supportsFwCfg() bool {\n\tswitch builder.architecture {\n\tcase \"s390x\", \"ppc64le\":\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "906a2aec9e09fcdd7d7b9f6dbbd74bbf", "score": "0.47397938", "text": "func (o *StorageHitachiHostAllOf) HasHostModeOptions() bool {\n\tif o != nil && o.HostModeOptions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0a96a3c8bcde5bf3dd40cb530c1a0c7f", "score": "0.4738758", "text": "func (m TradingSessionStatus) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "89b50731000425cf135045e1035f81ee", "score": "0.47314394", "text": "func IsInHaMode(ann map[string]string) bool {\n\tif ann != nil {\n\t\tval, ok := ann[AnnHaModeKey]\n\t\tif ok && val == AnnHaModeVal {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "db2715a3951d9667e3f6521877e1ba8a", "score": "0.4730119", "text": "func (o *PurchaseBSD) HasAgreedAt() bool {\n\tif o != nil && o.AgreedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "73c1524b3e317c37d3098c14454786ee", "score": "0.47292405", "text": "func (o *EquipmentSwitchCard) HasEthernetSwitchingMode() bool {\n\tif o != nil && o.EthernetSwitchingMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "82ebcb4a70af015e5c6a558732fca958", "score": "0.47249004", "text": "func (o *CapabilityFeatureConfig) HasSupportedFwVersions() bool {\n\tif o != nil && o.SupportedFwVersions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c07e79c47939f178236a8a991022aa71", "score": "0.47194713", "text": "func (o *CapabilityFeatureConfigAllOf) HasSupportedFwVersions() bool {\n\tif o != nil && o.SupportedFwVersions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "28d15fade4c632233c6fd420d3f73a01", "score": "0.47194445", "text": "func (i *IE) HasDURAT() bool {\n\tv, err := i.MeasurementMethod()\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn has1stBit(v)\n}", "title": "" }, { "docid": "d66d3cc94a95b193ce3f8a69cb8a97e1", "score": "0.47177035", "text": "func supportsAEAD(scan ScanResult) bool {\n\taead := false\n\tfor _, aeP := range tlsdefs.AEADProtocols {\n\t\tfor _, p := range scan.SupportedProtocols {\n\t\t\tif p == aeP {\n\t\t\t\tvar ciphers []uint16\n\t\t\t\tif scan.HasCipherPreferenceOrderByProtocol[p] {\n\t\t\t\t\tciphers = scan.CipherPreferenceOrderByProtocol[p]\n\t\t\t\t} else {\n\t\t\t\t\tciphers = scan.CipherSuiteByProtocol[p]\n\t\t\t\t}\n\t\t\t\tfor _, c := range ciphers {\n\t\t\t\t\tcc, _ := GetCipherConfig(c)\n\t\t\t\t\tif strings.Contains(cc.Encryption, \"GCM\") || strings.Contains(cc.Encryption, \"POLY1305\") || strings.Contains(cc.Encryption, \"CCM\") {\n\t\t\t\t\t\taead = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif aead {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn aead\n}", "title": "" }, { "docid": "dd78208867ef761392a6b9d5171666d7", "score": "0.47147313", "text": "func (o *OrgTierHistory) HasActivated() bool {\n\tif o != nil && o.Activated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0b4f54647a113b947f0baded4cac5e2b", "score": "0.47131473", "text": "func (m SettlementInstructions) HasEncodedText() bool {\n\treturn m.Has(tag.EncodedText)\n}", "title": "" }, { "docid": "500940d0c888e17ab873613533c78614", "score": "0.47085938", "text": "func (o *SelfServiceLoginFlow) HasRequestedAal() bool {\n\tif o != nil && o.RequestedAal != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4001f1b537e0c87be6df1660c602199b", "score": "0.47057748", "text": "func (o *AdapterUnitAllOf) HasHostIscsiIfs() bool {\n\tif o != nil && o.HostIscsiIfs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6762cb10140c15382719009a4285876f", "score": "0.47014886", "text": "func (i *IE) HasISTM() bool {\n\tif i.Type != MeasurementInformation {\n\t\treturn false\n\t}\n\tif len(i.Payload) < 1 {\n\t\treturn false\n\t}\n\n\treturn has4thBit(i.Payload[0])\n}", "title": "" }, { "docid": "ea1581add0302138fa6636c7a8eb2816", "score": "0.4700685", "text": "func (o *InlineObject635) HasAttendees() bool {\n\tif o != nil && o.Attendees != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2f6ebde28275751096d68f2678eaf632", "score": "0.4699589", "text": "func (o *Domain) HasAxfrIps() bool {\n\tif o != nil && o.AxfrIps != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8022fe5b5532452586477e4812cffc1b", "score": "0.469404", "text": "func GetAHTrace() bool {\n\treturn TraceAH\n}", "title": "" }, { "docid": "63b8c5a4e33c456b6f4bfbd30d348cac", "score": "0.4693967", "text": "func (i triggerSystem) IsAtriggerSystem() bool {\n\tfor _, v := range _triggerSystemValues {\n\t\tif i == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "554a9777cc6d8072544b49c3b9e5a7db", "score": "0.46920964", "text": "func (o *MicrosoftGraphWindowsUpdateActiveHoursInstall) HasActiveHoursStart() bool {\n\tif o != nil && o.ActiveHoursStart != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "947ae112abee6f3ea9259c94609861ca", "score": "0.46841955", "text": "func (x *fastReflection_TxEncodeAminoResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.tx.v1beta1.TxEncodeAminoResponse.amino_binary\":\n\t\treturn len(x.AminoBinary) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeAminoResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.tx.v1beta1.TxEncodeAminoResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "c062f71de4e7faa07f05d066261e54c0", "score": "0.467705", "text": "func (o *MetaPropDefinitionAllOf) HasApiAccess() bool {\n\tif o != nil && o.ApiAccess != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9ce8c43a89e5b0975083f80768efc015", "score": "0.46705657", "text": "func (v PowerTableView) HasPower(ctx context.Context, mAddr address.Address) (bool, error) {\n\tnumBytes, err := v.Miner(ctx, mAddr)\n\tif err != nil {\n\t\tif state.IsActorNotFoundError(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn numBytes.GreaterThan(types.ZeroBytes), nil\n}", "title": "" }, { "docid": "3beac85868d27cfa6af10ad4a9cc5cd6", "score": "0.46696472", "text": "func (i *integrationPD) HasAPIToken() bool {\n\tif i != nil && i.APIToken != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aa32aa6f24537d12636969bf7c2e13d7", "score": "0.46673772", "text": "func (t *TraceServiceDefinition) HasShowHits() bool {\n\tif t != nil && t.ShowHits != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1d4635182f3410718447d9551f4cf143", "score": "0.4667222", "text": "func (o *MicrosoftGraphOutlookGeoCoordinates) HasAltitudeAccuracy() bool {\n\tif o != nil && o.AltitudeAccuracy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "741dd0ae73d0fd0937d794dca5ee8cac", "score": "0.466384", "text": "func (pn PackageFunctions) HasFauxImports() bool {\n\tfor _, item := range pn.List {\n\t\tif item.Context == UseFauxContext {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bc6510c2297b2fd4acbcaab11a95921d", "score": "0.46588928", "text": "func (m TradeCaptureReportRequest) HasEncodedTextLen() bool {\n\treturn m.Has(tag.EncodedTextLen)\n}", "title": "" }, { "docid": "65fc443e96a4bf5f8b8dfe5d196feb73", "score": "0.4655136", "text": "func (o *ProcessGroupMetadata) HasSoftwareAgInstallRoot() bool {\n\tif o != nil && o.SoftwareAgInstallRoot != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "312b23ffb6107de770acffb9ef5a46cd", "score": "0.46519282", "text": "func (md *ScannerAdapterMetadata) HasCapability(mimeType string) bool {\n\tfor _, capability := range md.Capabilities {\n\t\tfor _, mt := range capability.ConsumesMimeTypes {\n\t\t\tif mt == mimeType {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "109b64a0ff47f941ed34235d87c484e7", "score": "0.46505943", "text": "func (o *NiatelemetryHealthInsightsDataAllOf) HasFltEqptFlashMinorAlarmFaultCount() bool {\n\tif o != nil && o.FltEqptFlashMinorAlarmFaultCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f358754faf508408902eab7015b0fd41", "score": "0.4649948", "text": "func (s StubMode) Has(m StubMode) bool {\n\treturn s&m != 0\n}", "title": "" } ]
a7b8e9a9485fc6e4213333dd6ba2b520
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationReceiverSpec.
[ { "docid": "679f9d043b2144d539e1ea821b8f4410", "score": "0.8985534", "text": "func (in *FederatedNotificationReceiverSpec) DeepCopy() *FederatedNotificationReceiverSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationReceiverSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "655f418777d034bb5c8797ff66a196fd", "score": "0.7393578", "text": "func (in *FederatedNotificationRouterSpec) DeepCopy() *FederatedNotificationRouterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationRouterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ce7e5e09ae8c6ad5cd1e020e5f5533a2", "score": "0.709743", "text": "func (in *GitWebHookReceiverSpec) DeepCopy() *GitWebHookReceiverSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitWebHookReceiverSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c590d618b0723dcf8cd7b489348b1633", "score": "0.69717574", "text": "func (in *FederatedNotificationConfigSpec) DeepCopy() *FederatedNotificationConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f7c19588293450bde21f06e68b06795f", "score": "0.6964838", "text": "func (in *FederatedNotificationManagerSpec) DeepCopy() *FederatedNotificationManagerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationManagerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f751d5df65ed5ac8c0d6c8f63809507d", "score": "0.6816972", "text": "func (in *FederatedNotificationReceiver) DeepCopy() *FederatedNotificationReceiver {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationReceiver)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3a744ae7819eb2927e431832fcc98b2d", "score": "0.64131266", "text": "func (in *NotificationSpec) DeepCopy() *NotificationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c1bfe3f90f5247b7e0f7c553f92ee7c2", "score": "0.62245196", "text": "func (in *AWSFederatedRoleSpec) DeepCopy() *AWSFederatedRoleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSFederatedRoleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1ef0a0390ab98fbda4857a0e5ce3a968", "score": "0.605222", "text": "func (in *FederatedNotificationReceiverList) DeepCopy() *FederatedNotificationReceiverList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationReceiverList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "74274f09fe0cf91045f0261bbe22fafb", "score": "0.5906943", "text": "func (in *FederatedNotificationSilenceSpec) DeepCopy() *FederatedNotificationSilenceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationSilenceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cad97e721b69c65b2785d08051043298", "score": "0.56873685", "text": "func (in *K8SWatcherNotifierSpec) DeepCopy() *K8SWatcherNotifierSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8SWatcherNotifierSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c2e158bde35c49613eb9da87e2b19847", "score": "0.560526", "text": "func (in *RocketMQSpec) DeepCopy() *RocketMQSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RocketMQSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a80c17059db83781a90614717a8612da", "score": "0.5592303", "text": "func (in *SubscriberSpec) DeepCopy() *SubscriberSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubscriberSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "18993d854b53dbc8c38db3cc4dabf171", "score": "0.5568694", "text": "func (in *AlertManagerNotificationQueueSpec) DeepCopy() *AlertManagerNotificationQueueSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlertManagerNotificationQueueSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b6c325adf01ba9f736f01d918841b774", "score": "0.55607635", "text": "func (in *Factory_Spec) DeepCopy() *Factory_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Factory_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e47e58bd20e7986644e550aa5f238d23", "score": "0.5548011", "text": "func (in *FlexibleServers_Configuration_Spec) DeepCopy() *FlexibleServers_Configuration_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServers_Configuration_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1d9d023c7faa9c5e757dcfcaf351571c", "score": "0.5536147", "text": "func (in *Receiver) DeepCopy() *Receiver {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Receiver)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "425442728b0f607136a050c15eedf519", "score": "0.53587383", "text": "func (in *AlertManagerDiscoverySpec) DeepCopy() *AlertManagerDiscoverySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlertManagerDiscoverySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c81f2418faabab4d470182b37d1b2116", "score": "0.5348945", "text": "func (in *Registry_Spec) DeepCopy() *Registry_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Registry_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "673a7b5b24d07b64365451991490bc3d", "score": "0.5308463", "text": "func (in *SesReceiptFilterSpec) DeepCopy() *SesReceiptFilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SesReceiptFilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "12373c128c45f0ad91b3d7ec6e03fb96", "score": "0.5270662", "text": "func (in *MessagingUserSpec) DeepCopy() *MessagingUserSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MessagingUserSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b00e0def15c09741c13b04db5d26ee83", "score": "0.5238339", "text": "func (in *PeeringSpec) DeepCopy() *PeeringSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeeringSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3af1274a4dba1e5906f627e4df336a08", "score": "0.52242523", "text": "func (in *ObservatoriumSpec) DeepCopy() *ObservatoriumSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObservatoriumSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "87573bbc9f1a3a9cb37dc22ed97dd822", "score": "0.5222035", "text": "func (in *CustomResourceDefinitionSpec) DeepCopy() *CustomResourceDefinitionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomResourceDefinitionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cbef93c0d0a945832b572df5b7502dbc", "score": "0.52074504", "text": "func (in *RemoteSecretSpec) DeepCopy() *RemoteSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RemoteSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d234fe10c50028f07caf8658b608d5ba", "score": "0.519106", "text": "func (in *ServiceBridgeSpec) DeepCopy() *ServiceBridgeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceBridgeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "694b7510f17087ec43b997f4200c4473", "score": "0.5177305", "text": "func (in *RegistrySpec) DeepCopy() *RegistrySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistrySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2e820806ace746dbbeacdd6cc016542f", "score": "0.51516", "text": "func (in *FederatedNotificationRouter) DeepCopy() *FederatedNotificationRouter {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationRouter)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f239d09907c8600a7c799bbb40c872cf", "score": "0.51496214", "text": "func (in *FlannelConfigSpec) DeepCopy() *FlannelConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlannelConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8e81825cc0fc7a366e0f899989bfa011", "score": "0.514885", "text": "func (in *SensuMutatorSpec) DeepCopy() *SensuMutatorSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuMutatorSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "419ce4a94224d13f422efde4af43cdb2", "score": "0.51484597", "text": "func (in *RealmSpec) DeepCopy() *RealmSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RealmSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "976a9493c6cdc37e6334e9e9fc2bcc66", "score": "0.5124203", "text": "func (in *EdgeDeviceSpec) DeepCopy() *EdgeDeviceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EdgeDeviceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "976a9493c6cdc37e6334e9e9fc2bcc66", "score": "0.5124203", "text": "func (in *EdgeDeviceSpec) DeepCopy() *EdgeDeviceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EdgeDeviceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3832f2ecd2332f8c53e6873f7ac7f096", "score": "0.51079446", "text": "func (in *WebhookSpec) DeepCopy() *WebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "de12406a2be4b5b6c1ec0a76662402d2", "score": "0.5103134", "text": "func (in *FCDInfoSpec) DeepCopy() *FCDInfoSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FCDInfoSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "73c274b91f0d6d0d083b04801b3874e6", "score": "0.5086446", "text": "func (in *RedisEnterprise_Spec) DeepCopy() *RedisEnterprise_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisEnterprise_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b4d15a9b1d7ba10ee8cd15680671e6dd", "score": "0.5080564", "text": "func (in *PatchingSpec) DeepCopy() *PatchingSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PatchingSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8e8c50d6f1f9aa5498565f02e7d965dc", "score": "0.5074551", "text": "func (in *FlannelConfigSpecFlannelSpec) DeepCopy() *FlannelConfigSpecFlannelSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlannelConfigSpecFlannelSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d2ac28fd959905694dc76c141b09de2e", "score": "0.50503767", "text": "func (in *FlannelConfigSpecBridgeSpec) DeepCopy() *FlannelConfigSpecBridgeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlannelConfigSpecBridgeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1448fcf199941136c07456b34acfa3d0", "score": "0.50384396", "text": "func (in *MySQLServerSpec) DeepCopy() *MySQLServerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLServerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "810118a94a533b6b995195fc3008af90", "score": "0.50357443", "text": "func (in *SRSConfigServerSpec) DeepCopy() *SRSConfigServerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SRSConfigServerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6a29b9f586af6c76825a73ab40101451", "score": "0.501423", "text": "func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SubscriptionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e48b09ec3e9bef1801b1c538fb6d18e9", "score": "0.5005792", "text": "func (in *DNSProviderSpec) DeepCopy() *DNSProviderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DNSProviderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c9237ffd54604fc8f1a2fdc5e08c06f3", "score": "0.4980982", "text": "func (r *CreateSpecType) SetReceiverToGlobalSpecType(o *GlobalSpecType) error {\n\tswitch of := r.Receiver.(type) {\n\tcase nil:\n\t\to.Receiver = nil\n\n\tcase *CreateSpecType_AwsCloudWatchReceiver:\n\t\to.Receiver = &GlobalSpecType_AwsCloudWatchReceiver{AwsCloudWatchReceiver: of.AwsCloudWatchReceiver}\n\n\tcase *CreateSpecType_AzureEventHubsReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureEventHubsReceiver{AzureEventHubsReceiver: of.AzureEventHubsReceiver}\n\n\tcase *CreateSpecType_AzureReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureReceiver{AzureReceiver: of.AzureReceiver}\n\n\tcase *CreateSpecType_DatadogReceiver:\n\t\to.Receiver = &GlobalSpecType_DatadogReceiver{DatadogReceiver: of.DatadogReceiver}\n\n\tcase *CreateSpecType_ElasticReceiver:\n\t\to.Receiver = &GlobalSpecType_ElasticReceiver{ElasticReceiver: of.ElasticReceiver}\n\n\tcase *CreateSpecType_HttpReceiver:\n\t\to.Receiver = &GlobalSpecType_HttpReceiver{HttpReceiver: of.HttpReceiver}\n\n\tcase *CreateSpecType_KafkaReceiver:\n\t\to.Receiver = &GlobalSpecType_KafkaReceiver{KafkaReceiver: of.KafkaReceiver}\n\n\tcase *CreateSpecType_NewRelicReceiver:\n\t\to.Receiver = &GlobalSpecType_NewRelicReceiver{NewRelicReceiver: of.NewRelicReceiver}\n\n\tcase *CreateSpecType_QradarReceiver:\n\t\to.Receiver = &GlobalSpecType_QradarReceiver{QradarReceiver: of.QradarReceiver}\n\n\tcase *CreateSpecType_S3Receiver:\n\t\to.Receiver = &GlobalSpecType_S3Receiver{S3Receiver: of.S3Receiver}\n\n\tcase *CreateSpecType_SplunkReceiver:\n\t\to.Receiver = &GlobalSpecType_SplunkReceiver{SplunkReceiver: of.SplunkReceiver}\n\n\tcase *CreateSpecType_SumoLogicReceiver:\n\t\to.Receiver = &GlobalSpecType_SumoLogicReceiver{SumoLogicReceiver: of.SumoLogicReceiver}\n\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown oneof field %T\", of)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55dc5d41475cc33ed4353d2aadde0f02", "score": "0.49752095", "text": "func (in *MetricWebhookSpec) DeepCopy() *MetricWebhookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricWebhookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3dff98337b22c1d4edc7d25448e01894", "score": "0.4969805", "text": "func (in *EventSourceSpec) DeepCopy() *EventSourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventSourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "deb25f5a24c8b277093e8daf0709930f", "score": "0.49403962", "text": "func (in *EFSCSIDriverSpec) DeepCopy() *EFSCSIDriverSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EFSCSIDriverSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fdbf924fa4f31d8889bf0cc73791198b", "score": "0.49334335", "text": "func (in *DestinationSpec) DeepCopy() *DestinationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DestinationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "05975fdef9e3209d66d1fe0b099b4001", "score": "0.4931316", "text": "func (in *FormationSpec) DeepCopy() *FormationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FormationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "00a3a2c7d5f5eb2ec5bb6a9f82bd9583", "score": "0.4924587", "text": "func (in *RolePolicyAttachmentSpec) DeepCopy() *RolePolicyAttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RolePolicyAttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bfaaf7779e488e737d4aac4b722ba3e6", "score": "0.49200925", "text": "func (r *ReplaceSpecType) SetReceiverToGlobalSpecType(o *GlobalSpecType) error {\n\tswitch of := r.Receiver.(type) {\n\tcase nil:\n\t\to.Receiver = nil\n\n\tcase *ReplaceSpecType_AwsCloudWatchReceiver:\n\t\to.Receiver = &GlobalSpecType_AwsCloudWatchReceiver{AwsCloudWatchReceiver: of.AwsCloudWatchReceiver}\n\n\tcase *ReplaceSpecType_AzureEventHubsReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureEventHubsReceiver{AzureEventHubsReceiver: of.AzureEventHubsReceiver}\n\n\tcase *ReplaceSpecType_AzureReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureReceiver{AzureReceiver: of.AzureReceiver}\n\n\tcase *ReplaceSpecType_DatadogReceiver:\n\t\to.Receiver = &GlobalSpecType_DatadogReceiver{DatadogReceiver: of.DatadogReceiver}\n\n\tcase *ReplaceSpecType_ElasticReceiver:\n\t\to.Receiver = &GlobalSpecType_ElasticReceiver{ElasticReceiver: of.ElasticReceiver}\n\n\tcase *ReplaceSpecType_HttpReceiver:\n\t\to.Receiver = &GlobalSpecType_HttpReceiver{HttpReceiver: of.HttpReceiver}\n\n\tcase *ReplaceSpecType_KafkaReceiver:\n\t\to.Receiver = &GlobalSpecType_KafkaReceiver{KafkaReceiver: of.KafkaReceiver}\n\n\tcase *ReplaceSpecType_NewRelicReceiver:\n\t\to.Receiver = &GlobalSpecType_NewRelicReceiver{NewRelicReceiver: of.NewRelicReceiver}\n\n\tcase *ReplaceSpecType_QradarReceiver:\n\t\to.Receiver = &GlobalSpecType_QradarReceiver{QradarReceiver: of.QradarReceiver}\n\n\tcase *ReplaceSpecType_S3Receiver:\n\t\to.Receiver = &GlobalSpecType_S3Receiver{S3Receiver: of.S3Receiver}\n\n\tcase *ReplaceSpecType_SplunkReceiver:\n\t\to.Receiver = &GlobalSpecType_SplunkReceiver{SplunkReceiver: of.SplunkReceiver}\n\n\tcase *ReplaceSpecType_SumoLogicReceiver:\n\t\to.Receiver = &GlobalSpecType_SumoLogicReceiver{SumoLogicReceiver: of.SumoLogicReceiver}\n\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown oneof field %T\", of)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1bad678db9da62cb00f73a848420f3c9", "score": "0.49189106", "text": "func (in *ObservabilitySpec) DeepCopy() *ObservabilitySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObservabilitySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5172b5659d235011fba84d249a6a0c66", "score": "0.49064532", "text": "func (in *MariaDBConsumerSpec) DeepCopy() *MariaDBConsumerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConsumerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2c0c8d8cc4701d2060db1464a4cf1aff", "score": "0.4899878", "text": "func (in *ServingRuntimeSpec) DeepCopy() *ServingRuntimeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServingRuntimeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ee881641bb97cc41b472e3e73057df31", "score": "0.4888236", "text": "func (in *SupportBundleSpec) DeepCopy() *SupportBundleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SupportBundleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e69c4db6ff21a5fb12729bb2f695d751", "score": "0.4865932", "text": "func (in *AccessContextManagerServicePerimeterSpec) DeepCopy() *AccessContextManagerServicePerimeterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AccessContextManagerServicePerimeterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3e84e71ef9df759337e4ee5338f5ce9f", "score": "0.48616275", "text": "func (in *SensuFilterSpec) DeepCopy() *SensuFilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuFilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "801e73bb9cecbb605e91fe68014e7864", "score": "0.48607016", "text": "func (in *WildFlyServerSpec) DeepCopy() *WildFlyServerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WildFlyServerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "220d7b2a9d49673d1dc47e8dd2bcc98f", "score": "0.4859997", "text": "func (in *ConsumerGroupSpec) DeepCopy() *ConsumerGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsumerGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "220d7b2a9d49673d1dc47e8dd2bcc98f", "score": "0.4859997", "text": "func (in *ConsumerGroupSpec) DeepCopy() *ConsumerGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsumerGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1e3d55204a7b5369a7e06d101c43dce7", "score": "0.48587087", "text": "func (in *RemoteWriteSpec) DeepCopy() *RemoteWriteSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RemoteWriteSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a2231681b59a0f026de800c8b2aec728", "score": "0.4849861", "text": "func (in *TelemetrySpec) DeepCopy() *TelemetrySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TelemetrySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c371a7998a1c67db51a3f163a3c169f9", "score": "0.48461142", "text": "func (in *PatchSpec) DeepCopy() *PatchSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PatchSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ec46afd05057fb11f0a0323501a247b9", "score": "0.4844632", "text": "func (in *FeatureSpec) DeepCopy() *FeatureSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FeatureSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3d48e0cadfa7cb1cbb8eb67f5c719416", "score": "0.48389626", "text": "func (in *RecordingRuleSpec) DeepCopy() *RecordingRuleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RecordingRuleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8973733ee46fe796ebe21c8fdcfd7517", "score": "0.48348", "text": "func (in *IbmqeSpec) DeepCopy() *IbmqeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IbmqeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d2c416a5be71c83829144031c526b51", "score": "0.48320103", "text": "func (in *ServiceperimeterSpec) DeepCopy() *ServiceperimeterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceperimeterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d6b16d554d8eb7a1dffe2829312acab4", "score": "0.48287606", "text": "func (in *NotificationReceiverTemplate) DeepCopy() *NotificationReceiverTemplate {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationReceiverTemplate)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "71aa77f97e6ee7581d7a047e57c8f1a7", "score": "0.48247477", "text": "func (in *AttachmentSpec) DeepCopy() *AttachmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttachmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "deef1c901151370bd47da7a062394023", "score": "0.48118457", "text": "func (in *DialogflowFulfillmentSpec) DeepCopy() *DialogflowFulfillmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DialogflowFulfillmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e803b4190e11a6e4d337389ef2182678", "score": "0.4811278", "text": "func (in *GitWebHookReceiver) DeepCopy() *GitWebHookReceiver {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitWebHookReceiver)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "49aea4a7d62589fe5e341e59cba5b168", "score": "0.480529", "text": "func (r *GetSpecType) SetReceiverToGlobalSpecType(o *GlobalSpecType) error {\n\tswitch of := r.Receiver.(type) {\n\tcase nil:\n\t\to.Receiver = nil\n\n\tcase *GetSpecType_AwsCloudWatchReceiver:\n\t\to.Receiver = &GlobalSpecType_AwsCloudWatchReceiver{AwsCloudWatchReceiver: of.AwsCloudWatchReceiver}\n\n\tcase *GetSpecType_AzureEventHubsReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureEventHubsReceiver{AzureEventHubsReceiver: of.AzureEventHubsReceiver}\n\n\tcase *GetSpecType_AzureReceiver:\n\t\to.Receiver = &GlobalSpecType_AzureReceiver{AzureReceiver: of.AzureReceiver}\n\n\tcase *GetSpecType_DatadogReceiver:\n\t\to.Receiver = &GlobalSpecType_DatadogReceiver{DatadogReceiver: of.DatadogReceiver}\n\n\tcase *GetSpecType_ElasticReceiver:\n\t\to.Receiver = &GlobalSpecType_ElasticReceiver{ElasticReceiver: of.ElasticReceiver}\n\n\tcase *GetSpecType_HttpReceiver:\n\t\to.Receiver = &GlobalSpecType_HttpReceiver{HttpReceiver: of.HttpReceiver}\n\n\tcase *GetSpecType_KafkaReceiver:\n\t\to.Receiver = &GlobalSpecType_KafkaReceiver{KafkaReceiver: of.KafkaReceiver}\n\n\tcase *GetSpecType_NewRelicReceiver:\n\t\to.Receiver = &GlobalSpecType_NewRelicReceiver{NewRelicReceiver: of.NewRelicReceiver}\n\n\tcase *GetSpecType_QradarReceiver:\n\t\to.Receiver = &GlobalSpecType_QradarReceiver{QradarReceiver: of.QradarReceiver}\n\n\tcase *GetSpecType_S3Receiver:\n\t\to.Receiver = &GlobalSpecType_S3Receiver{S3Receiver: of.S3Receiver}\n\n\tcase *GetSpecType_SplunkReceiver:\n\t\to.Receiver = &GlobalSpecType_SplunkReceiver{SplunkReceiver: of.SplunkReceiver}\n\n\tcase *GetSpecType_SumoLogicReceiver:\n\t\to.Receiver = &GlobalSpecType_SumoLogicReceiver{SumoLogicReceiver: of.SumoLogicReceiver}\n\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown oneof field %T\", of)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fcdff8a4f71cc87598d893b4904f907c", "score": "0.480417", "text": "func (in *FilterSpec) DeepCopy() *FilterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FilterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3b92f494a0e96649dcd74fbe5424f460", "score": "0.47911003", "text": "func (in *FederatedNotificationConfig) DeepCopy() *FederatedNotificationConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a4d816f017cac97473360cb98efc7e6a", "score": "0.47895896", "text": "func (in *ApplicationDefinitionSpec) DeepCopy() *ApplicationDefinitionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationDefinitionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "78e11f84def1c146f1ada6bd6e4eb18a", "score": "0.4789308", "text": "func (in *CertManagerProviderSpec) DeepCopy() *CertManagerProviderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertManagerProviderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "024d114c0a5d9bc40344a1d75393fb30", "score": "0.47800696", "text": "func (in *DrainerConfigSpec) DeepCopy() *DrainerConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DrainerConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f6a791ec77391bd05ce5cd7ecbab95a5", "score": "0.47781795", "text": "func (in *MySQLFirewallRuleSpec) DeepCopy() *MySQLFirewallRuleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLFirewallRuleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb4f683b26ebe6b49e097817adb4f603", "score": "0.477588", "text": "func (in *ServingRuntimePodSpec) DeepCopy() *ServingRuntimePodSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServingRuntimePodSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3f2ed6d4d6b7f3e6f29bf115ee0fdb6d", "score": "0.4774765", "text": "func (in *RemoteWriteClientQueueSpec) DeepCopy() *RemoteWriteClientQueueSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RemoteWriteClientQueueSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3efb72b8b95339f4d09889f8d3cd32da", "score": "0.47587466", "text": "func (in *UnsealerSpec) DeepCopy() *UnsealerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UnsealerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6b4e82e287c98efb19e78d9a8f9edd18", "score": "0.47510153", "text": "func (in *SplunkForwarderSpec) DeepCopy() *SplunkForwarderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SplunkForwarderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a1f17a7a3388566cd72ed76a4cc2427b", "score": "0.47460303", "text": "func (in *KfConfigSpec) DeepCopy() *KfConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KfConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5152aba68f1485c06f6f211bd452c326", "score": "0.4743591", "text": "func (in *SensuNamespaceSpec) DeepCopy() *SensuNamespaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuNamespaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.4741346", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "895e02cd32d13c50c3a4fe7f9c11a52f", "score": "0.47406006", "text": "func (in *StandaloneSpec) DeepCopy() *StandaloneSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StandaloneSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d9e9445bc9999069cf2238146f3c3856", "score": "0.47385713", "text": "func (in *ExtensionRequestSpec) DeepCopy() *ExtensionRequestSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExtensionRequestSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6290a4b56d90ac0166fd42d9073c082f", "score": "0.4735709", "text": "func (in *FormDefinitionSpec) DeepCopy() *FormDefinitionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FormDefinitionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a9e69f6a627437d6463d50ec1c495bf3", "score": "0.47349846", "text": "func (in *AlamedaNotificationChannelSpec) DeepCopy() *AlamedaNotificationChannelSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlamedaNotificationChannelSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5f1a6e294a813961db032f056254be76", "score": "0.47296152", "text": "func (in *PrometheusSpec) DeepCopy() *PrometheusSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrometheusSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b2e1d5e4ce0d80759d2fda7af77d964d", "score": "0.47240138", "text": "func (in *AndroidDeviceSpec) DeepCopy() *AndroidDeviceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AndroidDeviceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b8cd314ef36c7d96036320ff30e6569d", "score": "0.472033", "text": "func (in *RulerConfigSpec) DeepCopy() *RulerConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RulerConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cff342adbdcc166858b078ae9cb100bc", "score": "0.47193754", "text": "func (in *KnativeEventingSpec) DeepCopy() *KnativeEventingSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KnativeEventingSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4d3c7dda1d0ee1a2585f99d7fc02bd03", "score": "0.47184947", "text": "func (in *BrokerSpec) DeepCopy() *BrokerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BrokerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4d3c7dda1d0ee1a2585f99d7fc02bd03", "score": "0.47184947", "text": "func (in *BrokerSpec) DeepCopy() *BrokerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BrokerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fc780d96b8ff3ab331a20781014de375", "score": "0.47168767", "text": "func (in *RedisSpec) DeepCopy() *RedisSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d65f107e02a6b040c644027be6b991d4", "score": "0.4711498", "text": "func (in *LogFileMetricExporterSpec) DeepCopy() *LogFileMetricExporterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LogFileMetricExporterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "aa980ff3b51c5ba7708bc133fecf776f", "score": "0.4699536", "text": "func (in *FileSpec) DeepCopy() *FileSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FileSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "90d075e452377b692ac82aafb2205d82", "score": "0.46949425", "text": "func (in *FederatedNotificationRouterList) DeepCopy() *FederatedNotificationRouterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederatedNotificationRouterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4f51f39ff0aa0c07de8230e6e48b6b14", "score": "0.46944246", "text": "func (in *KlovercloudFacadeSpec) DeepCopy() *KlovercloudFacadeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KlovercloudFacadeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6c341045c44f38ea81eaef10e16ded7c", "score": "0.4694276", "text": "func (in *ScheduleSpec) DeepCopy() *ScheduleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ScheduleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
64d7b2aedb91e4a74d3505c7eadcd287
Sets the deletion policy of the resource based on the removal policy specified. Experimental.
[ { "docid": "0d8b79bbe992d9ec06c8166af3cd0c41", "score": "0.0", "text": "func (c *jsiiProxy_CfnLicense) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" } ]
[ { "docid": "8874258bd12f5b5213ff07c9de3d845b", "score": "0.7184643", "text": "func (rndr *Renderer) DeletePolicy(serviceInfo *common.ServiceInfo, sp *sasemodel.SaseConfig) error {\n\treturn nil\n}", "title": "" }, { "docid": "88bbb75c4de9a59c546acd0e5f2a5247", "score": "0.69998765", "text": "func (mg *Addon) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "6624ea7618c02652a84e86c43d726d82", "score": "0.6846735", "text": "func DeletePolicy(_ context.Context, _ *dcl.Config, _ *unstructured.Resource) error {\n\treturn unstructured.ErrNoSuchMethod\n}", "title": "" }, { "docid": "6c67dbe28a8a8922f4dbff36d709e717", "score": "0.68251824", "text": "func (mg *HealthCheck) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "4418f85d4b0a557bee35a0950c7cba74", "score": "0.6775006", "text": "func (mg *Record) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "4f89a386bd8f44185faafca7116b3736", "score": "0.6763039", "text": "func DeletePolicy(ctx context.Context, clientsEndpoint string, clientID string, policyID string, protectionAPIToken string) error {\n\tif policyID == \"\" {\n\t\tlog.Error(ctx, map[string]interface{}{}, \"policy-id is emtpy\")\n\t\treturn errors.NewBadParameterError(\"policyID\", policyID)\n\t}\n\treq, err := http.NewRequest(\"DELETE\", clientsEndpoint+\"/\"+clientID+\"/authz/resource-server/policy/\"+policyID, nil)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err.Error(),\n\t\t}, \"unable to create http request\")\n\t\treturn errors.NewInternalError(errs.Wrap(err, \"unable to create http request\"))\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+protectionAPIToken)\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"policy_id\": policyID,\n\t\t\t\"err\": err.Error(),\n\t\t}, \"unable to delete the Keycloak policy\")\n\t\treturn errors.NewInternalError(errs.Wrap(err, \"unable to delete the Keycloak policy\"))\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusNoContent {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"policy_id\": policyID,\n\t\t\t\"response_status\": res.Status,\n\t\t\t\"response_body\": rest.ReadBody(res.Body),\n\t\t}, \"unable to delete the Keycloak policy\")\n\t\treturn errors.NewInternalError(errs.New(\"unable to delete the Keycloak policy. Response status: \" + res.Status + \". Responce body: \" + rest.ReadBody(res.Body)))\n\t}\n\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"policy_id\": policyID,\n\t}, \"Keycloak policy deleted\")\n\n\treturn nil\n}", "title": "" }, { "docid": "e33cb7091a1ab3a573b73ef477852f0d", "score": "0.67545617", "text": "func (mg *EventHub) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "17d2badaffa3f0273b57b7987d283ef9", "score": "0.6723247", "text": "func (r *Policy) Delete(ctx context.Context, config *dcl.Config, resource *unstructured.Resource) error {\n\treturn DeletePolicy(ctx, config, resource)\n}", "title": "" }, { "docid": "4ae67a06aecea0af4ef68b18709ad44c", "score": "0.67204285", "text": "func (mg *IAMAccessKey) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "24de66e186b55929a3ee870e0cc5ce2b", "score": "0.6688269", "text": "func (mg *Rule) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "f83223f1e15a0daac27a0a13476c269b", "score": "0.6676331", "text": "func (mg *KeySigningKey) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "4599ab15aa29ed9ed28c3125a6ff4140", "score": "0.66296226", "text": "func (mg *OpenIDConnectProvider) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "7c1bd4a3f40f2bdd467d9f496b21392d", "score": "0.66242176", "text": "func (r *CustomResource) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "41ae84455a3da12adff14bc4a95f39d9", "score": "0.660516", "text": "func (mg *QueryLog) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "949c98ceb8df90868d89f4a033822a63", "score": "0.660511", "text": "func (mg *IAMGroup) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "4f686c0abdf6f50768beaea4020d0cad", "score": "0.6604148", "text": "func (mg *IAMPolicy) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "45c113c7fccdeb3c7ff041310c44c4a8", "score": "0.6587551", "text": "func (mg *ConsumerGroup) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "ccb3ae4e9284ec9ce68f34112295bf8c", "score": "0.65871537", "text": "func (mg *DelegationSet) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "26342d564692b2a492c33d9d5546efc1", "score": "0.6583508", "text": "func (mg *AuthorizationRule) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "c87ee1f017c51058b9eee1375987a41c", "score": "0.65826786", "text": "func (mg *IAMGroupUserMembership) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "c0d97b43ff60cc733fdef6ac715a4c04", "score": "0.6579057", "text": "func (mg *RuleAssociation) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "e5f99edfbb19562c251922364385f5c3", "score": "0.6577061", "text": "func (mg *Endpoint) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "c8e82b3f255647e320b238d768fa7ae5", "score": "0.656746", "text": "func (mg *IAMUserPolicyAttachment) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "b7dd02bcebe0b88976d1f2c8a8609e08", "score": "0.6564479", "text": "func (mg *HostedZoneDNSSEC) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "90aaef3228a8cf0ef43d8143c6e29940", "score": "0.65447927", "text": "func (mg *IAMUser) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "4abc30641951e1a5cfbee3ac1f6191c8", "score": "0.65394235", "text": "func (r *Route_RouteSpec) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "f3f5df8cccacf576e04b207a677a2c56", "score": "0.65350986", "text": "func (mg *FirewallRule) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "ed9d5f3a50a55633d86ca51ef5f64680", "score": "0.6514238", "text": "func (a *CasbinAdapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "2844a5314e5c7a09734268e88e74d992", "score": "0.65120506", "text": "func (mg *FirewallRuleGroup) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "b5301728b79454001b7a79b79649dfea", "score": "0.65096337", "text": "func (r *CustomResource) DeletionPolicy() policies.DeletionPolicy {\n\treturn r._deletionPolicy\n}", "title": "" }, { "docid": "37411cbc12c811f22102ed471c4c4b36", "score": "0.6502458", "text": "func (mg *FirewallDomainList) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "895daa22143f27077c65d7b56f234a1f", "score": "0.6501645", "text": "func (mg *Zone) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "6e7bdff9818e272a26b0404cead88297", "score": "0.6486791", "text": "func (mg *ZoneAssociation) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "42fee76531b9e27f08d6683824984b13", "score": "0.6471308", "text": "func (api *preheatAPI) DeletePolicy(ctx context.Context, params operation.DeletePolicyParams) middleware.Responder {\n\tif err := api.RequireProjectAccess(ctx, params.ProjectName, rbac.ActionDelete, rbac.ResourcePreatPolicy); err != nil {\n\t\treturn api.SendError(ctx, err)\n\t}\n\n\tproject, err := api.projectCtl.GetByName(ctx, params.ProjectName)\n\tif err != nil {\n\t\treturn api.SendError(ctx, err)\n\t}\n\n\tpolicy, err := api.preheatCtl.GetPolicyByName(ctx, project.ProjectID, params.PreheatPolicyName)\n\tif err != nil {\n\t\treturn api.SendError(ctx, err)\n\t}\n\n\tdetectRunningExecutions := func(executions []*task.Execution) error {\n\t\tfor _, exec := range executions {\n\t\t\tif exec.Status == job.RunningStatus.String() {\n\t\t\t\treturn fmt.Errorf(\"execution %d under the policy %s is running, stop it and retry\", exec.ID, policy.Name)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\texecutions, err := api.executionCtl.List(ctx, &q.Query{Keywords: map[string]interface{}{\n\t\t\"vendor_type\": job.P2PPreheatVendorType,\n\t\t\"vendor_id\": policy.ID,\n\t}})\n\tif err != nil {\n\t\treturn api.SendError(ctx, err)\n\t}\n\n\t// Detecting running tasks under the policy\n\tif err = detectRunningExecutions(executions); err != nil {\n\t\treturn api.SendError(ctx, errors.New(err).WithCode(errors.PreconditionCode))\n\t}\n\n\terr = api.preheatCtl.DeletePolicy(ctx, policy.ID)\n\tif err != nil {\n\t\treturn api.SendError(ctx, err)\n\t}\n\n\treturn operation.NewDeletePolicyOK()\n}", "title": "" }, { "docid": "6852feee62d144ca46f50e0651271c90", "score": "0.6468102", "text": "func (mg *QueryLogConfig) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "9a91ce57df6954a4f33c37e7229d5cd8", "score": "0.64673346", "text": "func (mg *IAMGroupPolicyAttachment) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "1aee2e18bd1720d01dd2957ced053bad", "score": "0.6457224", "text": "func (mg *FirewallRuleGroupAssociation) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "1612706d375bfdcda7274046bb9b3799", "score": "0.64501655", "text": "func (mg *EventHubNamespace) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "b19021440250e9f8f4b3ebc06350ef3c", "score": "0.64287555", "text": "func (c *Client) DeleteEscalationPolicy(id string) error {\n\t_, err := c.delete(escPath + \"/\" + id)\n\treturn err\n}", "title": "" }, { "docid": "7d2a16fbff45de2fb9a97f50d36c2b4f", "score": "0.642648", "text": "func (r *jsiiProxy_Resource) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "6206dcfbde1990477bac77af64d683ff", "score": "0.64211965", "text": "func (o AppleAppOutput) DeletionPolicy() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AppleApp) pulumi.StringPtrOutput { return v.DeletionPolicy }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e98d2de89fd61fd237fe737fe974d8e3", "score": "0.6407997", "text": "func (s *API) DeletePolicy(req *DeletePolicyRequest, opts ...scw.RequestOption) error {\n\tvar err error\n\n\tif fmt.Sprint(req.PolicyID) == \"\" {\n\t\treturn errors.New(\"field PolicyID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"DELETE\",\n\t\tPath: \"/iam/v1alpha1/policies/\" + fmt.Sprint(req.PolicyID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = s.client.Do(scwReq, nil, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5c556ee9f856509844ca1db7219ff9e", "score": "0.6403513", "text": "func (a *adapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\tline := savePolicyLine(ptype, rule)\n\n\tctx, cancel := context.WithTimeout(context.TODO(), a.timeout)\n\tdefer cancel()\n\n\tif _, err := a.collection.DeleteOne(ctx, line); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8da986c8afa078708dc4c616a064db5", "score": "0.6388015", "text": "func (mg *FirewallConfig) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "1ef889b2fb31c69d5a6e65542bbb505d", "score": "0.63863385", "text": "func (mg *DNSSECConfig) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "67ce43eb39a473ed69759ebbe5837ed5", "score": "0.6383499", "text": "func (mg *VPCAssociationAuthorization) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "28ca246060d169b403eb8bab6e63e3f2", "score": "0.63809144", "text": "func (mg *QueryLogConfigAssociation) SetDeletionPolicy(r xpv1.DeletionPolicy) {\n\tmg.Spec.DeletionPolicy = r\n}", "title": "" }, { "docid": "a11d21518802816bb9e0624df6f36938", "score": "0.6379318", "text": "func (r *AWSECSTaskDefinition_DockerVolumeConfiguration) SetDeletionPolicy(policy DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "0eb65cb7bd797d2bca5b0990fcefa051", "score": "0.63658583", "text": "func (r *AWSCodeBuildProject_Environment) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "1b84f1064984080ddc76dd7c85db1f73", "score": "0.63517946", "text": "func (r *Function_SAMPolicyTemplate) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "b5836775f9a23c27d9ca888c272ab421", "score": "0.6328783", "text": "func (client *Client) DeletePolicy(id int64, req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"DELETE\",\n\t\tPath: fmt.Sprintf(\"%s/%d\", PoliciesPath, id),\n\t\tQueryParams: req.QueryParams,\n\t\tBody: req.Body,\n\t\tResult: &DeletePolicyResult{},\n\t})\n}", "title": "" }, { "docid": "79773a951c5d260149c9400c93f5e1f5", "score": "0.6327791", "text": "func (db *Store) DeletePolicy(ctx context.Context, txn storage.Transaction, id string) error {\n\tunderlying, err := db.underlying(txn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := underlying.GetPolicy(ctx, id); err != nil {\n\t\treturn err\n\t}\n\treturn underlying.DeletePolicy(ctx, id)\n}", "title": "" }, { "docid": "2679751a03a00b4c778f81ea4c1ebc9b", "score": "0.63267446", "text": "func (pa *RepPolicyAPI) Delete() {\n\tid := pa.GetIDFromURL()\n\n\tpolicy, err := core.GlobalController.GetPolicy(id)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to get policy %d: %v\", id, err)\n\t\tpa.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))\n\t}\n\n\tif policy.ID == 0 {\n\t\tpa.HandleNotFound(fmt.Sprintf(\"policy %d not found\", id))\n\t\treturn\n\t}\n\n\tcount, err := dao.GetTotalCountOfRepJobs(&models.RepJobQuery{\n\t\tPolicyID: id,\n\t\tStatuses: []string{models.JobRunning, models.JobRetrying, models.JobPending},\n\t\t// only get the transfer and delete jobs, do not get schedule job\n\t\tOperations: []string{models.RepOpTransfer, models.RepOpDelete},\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"failed to filter jobs of policy %d: %v\", id, err)\n\t\tpa.CustomAbort(http.StatusInternalServerError, \"\")\n\t}\n\tif count > 0 {\n\t\tpa.CustomAbort(http.StatusPreconditionFailed, \"policy has running/retrying/pending jobs, can not be deleted\")\n\t}\n\n\tif err = core.GlobalController.RemovePolicy(id); err != nil {\n\t\tlog.Errorf(\"failed to delete policy %d: %v\", id, err)\n\t\tpa.CustomAbort(http.StatusInternalServerError, \"\")\n\t}\n}", "title": "" }, { "docid": "464891a44984346cd375ba5deb64bcab", "score": "0.63232803", "text": "func (s *policyCRUD) Delete(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\tpolicy := policyFromStuct(event)\n\terr := s.client.Policies.Delete(nil, policy.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn policy, nil\n}", "title": "" }, { "docid": "8ddc354f050cd540ae9a54e88c08fc88", "score": "0.63161147", "text": "func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) (err error) {\n\treturn\n\t// line := a.createPolicyRule(ptype, rule)\n\t// err = a.deletePolicyLine(&line)\n\t// if err != nil {\n\t// \treturn\n\t// }\n\t// return err\n}", "title": "" }, { "docid": "666114221229026580c9376cc6e6b427", "score": "0.6274259", "text": "func (r *jsiiProxy_ResourceBase) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "64b06ab92c076439e725bd4f33af3791", "score": "0.62556857", "text": "func (s *jsiiProxy_SpecRestApi) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\ts,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "b4ac9e4cf1a065dc6f5840df6e97fdc9", "score": "0.62400186", "text": "func (p *jsiiProxy_ProxyResource) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tp,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "5293b863db164c1a0fb563f86d213040", "score": "0.6229308", "text": "func (r *Function_SAMPolicyTemplate) DeletionPolicy() policies.DeletionPolicy {\n\treturn r._deletionPolicy\n}", "title": "" }, { "docid": "437253ce9f90f7d685263a4396ee67cf", "score": "0.6212161", "text": "func (a *NASApiService) FpolicyDelete(ctx context.Context, svmUuid string) (*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\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/protocols/fpolicy/{svm.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"svm.uuid\"+\"}\", fmt.Sprintf(\"%v\", svmUuid), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/hal+json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 0 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "debe3647b34be6beac3dea544497b224", "score": "0.61870396", "text": "func (c *jsiiProxy_CfnResource) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "cf8955dd6ceae35bcacf5a99c8ac1301", "score": "0.6173893", "text": "func (r *FirewallPolicyResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+FirewallPolicyEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d2cf4c44e7a67a501f66e9dd586fd032", "score": "0.61704487", "text": "func (c *Core) DeletePolicy(policyID uint64) error {\n\tpolicyAPI := policies.NewPolicyAPI(c.kvClient, c.projectPath)\n\tpolicyKey := strconv.FormatUint(policyID, 10)\n\t_, err := policyAPI.Find(policyKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot find policy: %v\", err)\n\t}\n\treturn policyAPI.Delete(policyKey)\n}", "title": "" }, { "docid": "f8a1d073f4555464916b1ce1ea61760b", "score": "0.61667854", "text": "func DeletePolicyManagement(\n\tctx context.Context,\n\ttx *sql.Tx,\n\trequest *models.DeletePolicyManagementRequest) error {\n\tdeleteQuery := deletePolicyManagementQuery\n\tselectQuery := \"select count(uuid) from policy_management where uuid = ?\"\n\tvar err error\n\tvar count int\n\tuuid := request.ID\n\tauth := common.GetAuthCTX(ctx)\n\tif auth.IsAdmin() {\n\t\trow := tx.QueryRowContext(ctx, selectQuery, uuid)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"not found\")\n\t\t}\n\t\trow.Scan(&count)\n\t\tif count == 0 {\n\t\t\treturn errors.New(\"Not found\")\n\t\t}\n\t\t_, err = tx.ExecContext(ctx, deleteQuery, uuid)\n\t} else {\n\t\tdeleteQuery += \" and owner = ?\"\n\t\tselectQuery += \" and owner = ?\"\n\t\trow := tx.QueryRowContext(ctx, selectQuery, uuid, auth.ProjectID())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"not found\")\n\t\t}\n\t\trow.Scan(&count)\n\t\tif count == 0 {\n\t\t\treturn errors.New(\"Not found\")\n\t\t}\n\t\t_, err = tx.ExecContext(ctx, deleteQuery, uuid, auth.ProjectID())\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"delete failed\")\n\t}\n\n\terr = common.DeleteMetaData(tx, uuid)\n\tlog.WithFields(log.Fields{\n\t\t\"uuid\": uuid,\n\t}).Debug(\"deleted\")\n\treturn err\n}", "title": "" }, { "docid": "46a4f732f15636600c1d2357072a581d", "score": "0.61257744", "text": "func (r *Route_RouteSpec) DeletionPolicy() policies.DeletionPolicy {\n\treturn r._deletionPolicy\n}", "title": "" }, { "docid": "cb8a6a443ba386ec314567453a4de589", "score": "0.61239475", "text": "func (a *adapter) RemovePolicy(sec string, ptype string, rule []string) error {\n\tline := savePolicyLine(ptype, rule)\n\n\tsession := a.session.Copy()\n\tdefer session.Close()\n\n\tif err := a.collection.With(session).Remove(line); err != nil {\n\t\tswitch err {\n\t\tcase mgo.ErrNotFound:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5e0bd81dab0ea3dea287fc2073681ab", "score": "0.61226547", "text": "func (pp *PgPolicy) Delete(ctx context.Context, db DB) error {\n\tswitch {\n\tcase !pp._exists: // doesn't exist\n\t\treturn nil\n\tcase pp._deleted: // deleted\n\t\treturn nil\n\t}\n\t// delete with single primary key\n\tconst sqlstr = `DELETE FROM pg_catalog.pg_policy ` +\n\t\t`WHERE oid = $1`\n\t// run\n\tlogf(sqlstr, pp.Oid)\n\tif _, err := db.ExecContext(ctx, sqlstr, pp.Oid); err != nil {\n\t\treturn logerror(err)\n\t}\n\t// set deleted\n\tpp._deleted = true\n\treturn nil\n}", "title": "" }, { "docid": "f8acbc01745b7ca713d50d147f289f3f", "score": "0.6115114", "text": "func (r *AWSCodeBuildProject_Environment) DeletionPolicy() policies.DeletionPolicy {\n\treturn r._deletionPolicy\n}", "title": "" }, { "docid": "9a438f64977ebfd982f70fd45b4826c3", "score": "0.6103214", "text": "func (r *jsiiProxy_RestApi) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "69d58cfc359aef40a0d4627adda30ae7", "score": "0.6078242", "text": "func (r *AWSPinpointCampaign_Message) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "b65de8d54b58413ae66d045ad0db5b59", "score": "0.6060916", "text": "func (r *jsiiProxy_RequestAuthorizer) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "c94b160d727f214bafb5a1739e3144f2", "score": "0.6050206", "text": "func (r *FirewallGlobalFQDNPolicyResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+FirewallGlobalFQDNPolicyEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86f35ca1ab32246c2a5adea790dcfddc", "score": "0.6038702", "text": "func (r *AWSRDSOptionGroup_OptionConfiguration) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "1e65adac73e75583db8d571d0cb5da7b", "score": "0.60228175", "text": "func (_e *Guard_Expecter) DeletePolicy(pol interface{}) *Guard_DeletePolicy_Call {\n\treturn &Guard_DeletePolicy_Call{Call: _e.mock.On(\"DeletePolicy\", pol)}\n}", "title": "" }, { "docid": "4069f0bb09f818062016922395b3b6f2", "score": "0.6021788", "text": "func (r *AWSRDSOptionGroup_OptionConfiguration) DeletionPolicy() policies.DeletionPolicy {\n\treturn r._deletionPolicy\n}", "title": "" }, { "docid": "48e4c1097f6109d523dbd0ec1fe17cc3", "score": "0.60205454", "text": "func (r *jsiiProxy_RestApiBase) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "a1c60f5e1be3839d960dd21de5110ac6", "score": "0.6019566", "text": "func (s *XPackIlmDeleteLifecycleService) Policy(policy string) *XPackIlmDeleteLifecycleService {\n\ts.policy = policy\n\treturn s\n}", "title": "" }, { "docid": "298570d12dae192ff0e7185fdd91e8f0", "score": "0.60005856", "text": "func (a *jsiiProxy_Authorizer) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\ta,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "a85216035a7fa079f110a5b6dd7f54ac", "score": "0.59864855", "text": "func (s *Service) handleRemovePolicy(w http.ResponseWriter, r *http.Request) {\n\tremoveType := r.URL.Query().Get(\"type\")\n\tswitch removeType {\n\tcase \"all\":\n\t\terr := s.store.ClearPolicy()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\tcase \"filtered\":\n\t\tdata, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tvar cmd command.RemoveFilteredPolicyRequest\n\t\terr = jsoniter.Unmarshal(data, &cmd)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\terr = s.store.RemoveFilteredPolicy(&cmd)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\tcase \"\":\n\t\tdata, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tvar cmd command.RemovePoliciesRequest\n\t\terr = jsoniter.Unmarshal(data, &cmd)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\terr = s.store.RemovePolicies(&cmd)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t}\n}", "title": "" }, { "docid": "d73891110f4495d28efbebfc0f332c0b", "score": "0.5984994", "text": "func (pMgr *PolicyManager) removePolicy(policy *NPMNetworkPolicy, endpointList map[string]string) error {\n\tif endpointList == nil {\n\t\tif len(policy.PodEndpoints) == 0 {\n\t\t\tklog.Infof(\"[PolicyManagerWindows] No Endpoints to remove policy %s on\", policy.PolicyKey)\n\t\t\treturn nil\n\t\t}\n\t\tendpointList = policy.PodEndpoints\n\t}\n\n\trulesToRemove, err := pMgr.getSettingsFromACL(policy)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// FIXME rulesToRemove is a list of pointers\n\tklog.Infof(\"[PolicyManagerWindows] To Remove Policy: %s \\n To Delete ACLs: %+v \\n To Remove From %+v endpoints\", policy.PolicyKey, rulesToRemove, endpointList)\n\t// If remove bug is solved we can directly remove the exact policy from the endpoint\n\t// but if the bug is not solved then get all existing policies and remove relevant policies from list\n\t// then apply remaining policies onto the endpoint\n\tvar aggregateErr error\n\tnumOfRulesToRemove := len(rulesToRemove)\n\tfor epIPAddr, epID := range endpointList {\n\t\terr := pMgr.removePolicyByEndpointID(rulesToRemove[0].Id, epID, numOfRulesToRemove, removeOnlyGivenPolicy)\n\t\tif err != nil {\n\t\t\tif aggregateErr == nil {\n\t\t\t\taggregateErr = fmt.Errorf(\"skipping removing policy on %s ID Endpoint with err: %w\", epID, err)\n\t\t\t} else {\n\t\t\t\taggregateErr = fmt.Errorf(\"skipping removing policy on %s ID Endpoint with err: %s. previous err: [%w]\", epID, err.Error(), aggregateErr)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Delete podendpoint from policy cache\n\t\tdelete(policy.PodEndpoints, epIPAddr)\n\t}\n\n\tif aggregateErr != nil {\n\t\treturn fmt.Errorf(\"[PolicyManagerWindows] while removing policy %s, %w\", policy.PolicyKey, aggregateErr)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25ea2888add61c0a430427ee06ed4be1", "score": "0.59845805", "text": "func (c BlobContainersClient) preparerForDeleteImmutabilityPolicy(ctx context.Context, id ContainerId, options DeleteImmutabilityPolicyOperationOptions) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": defaultApiVersion,\n\t}\n\n\tfor k, v := range options.toQueryString() {\n\t\tqueryParameters[k] = autorest.Encode(\"query\", v)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithHeaders(options.toHeaders()),\n\t\tautorest.WithPath(fmt.Sprintf(\"%s/immutabilityPolicies/default\", id.ID())),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "d3e6a9ad6c304bade00e428917e912e3", "score": "0.5983105", "text": "func (r *MaintenanceWindowTask_MaintenanceWindowLambdaParameters) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "9cb774aad6d671de4f289f68183cacc0", "score": "0.5979763", "text": "func (c *jsiiProxy_CfnRestApi) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "ea93e1a390851d5fa29d79d84f119332", "score": "0.5959827", "text": "func (resource IamPolicy) Delete() error {\n\tauth.MakeClient(auth.Sess)\n\tsvc := auth.Client.IamConn\n\tdeletePolicyInput := &iam.DeletePolicyInput{\n\t\tPolicyArn: &resource.PolicyArn,\n\t}\n\t_, err := svc.DeletePolicy(deletePolicyInput)\n\treturn err\n}", "title": "" }, { "docid": "8c60e7f3ffa419fab43e0cb18fe2dd83", "score": "0.59515035", "text": "func RemovePolicy(ip, policyName string) (string, error) {\n\tlog.Printf(\"Removing policy [%s] on esx [%s]\\n\", policyName, ip)\n\treturn ssh.InvokeCommand(ip, admincli.RemovePolicy+policyName)\n}", "title": "" }, { "docid": "759ddb4ed45aba017648c3990f61b2e6", "score": "0.5932365", "text": "func (r *AWSCognitoUserPool_LambdaConfig) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "44a1931cdcb258210a87b1f0410aa22e", "score": "0.5928313", "text": "func (l *jsiiProxy_LambdaRestApi) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tl,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "f74b396c6808126749d1c36a727d82d8", "score": "0.592669", "text": "func (c *jsiiProxy_CustomResource) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "9d836a70f6fd3d6bf50a4feadf6d0585", "score": "0.5909623", "text": "func (d *ResourceDetector) OnPropagationPolicyDelete(obj interface{}) {\n\tkey, err := ClusterWideKeyFunc(obj)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tklog.V(2).Infof(\"Delete PropagationPolicy(%s)\", key)\n\td.policyReconcileWorker.Add(key)\n}", "title": "" }, { "docid": "e26a90de2c30cadd79abaa8879c2acdd", "score": "0.5889056", "text": "func (r *AWSOpsWorksInstance_TimeBasedAutoScaling) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "2f7abcaec642744bc15e9728af1d012a", "score": "0.58795893", "text": "func (c *jsiiProxy_CfnDocumentationPart) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "e29388a49b0856f78f2b8c3d30a69d60", "score": "0.58760345", "text": "func (c *jsiiProxy_CfnThing) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "3832ee1a07ccfe9adbe04ae34bbf69f7", "score": "0.5843563", "text": "func (c *jsiiProxy_CfnAuthorizer) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "3832ee1a07ccfe9adbe04ae34bbf69f7", "score": "0.58427763", "text": "func (c *jsiiProxy_CfnAuthorizer) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "180d4affd8714b3c8919e33cafa6ca98", "score": "0.5801986", "text": "func (r *AWSManagedBlockchainMember_MemberFabricConfiguration) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "d41c23fe832aef682141ea393f64b6ff", "score": "0.57995707", "text": "func (c *jsiiProxy_Canary) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "b116ad353e451f9d850b2054e498ccba", "score": "0.5796668", "text": "func (r *UserPoolRiskConfigurationAttachment_AccountTakeoverActionsType) SetDeletionPolicy(policy policies.DeletionPolicy) {\n\tr._deletionPolicy = policy\n}", "title": "" }, { "docid": "77a1bead96d1a21ae4c566b5d4bbb3fb", "score": "0.5787864", "text": "func (d *jsiiProxy_Deployment) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) {\n\t_jsii_.InvokeVoid(\n\t\td,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy},\n\t)\n}", "title": "" }, { "docid": "bd7d6846cffae94e745c499736dabd58", "score": "0.5783638", "text": "func (c *jsiiProxy_CfnTemplate) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "6169cef1c87328055fa9328b0ad65f68", "score": "0.57745624", "text": "func (c *jsiiProxy_CfnSchema) ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"applyRemovalPolicy\",\n\t\t[]interface{}{policy, options},\n\t)\n}", "title": "" }, { "docid": "81ba6cf9eb4c40b1b6bb3108daafc227", "score": "0.5770718", "text": "func Test_DeleteNodePolicy1(t *testing.T) {\n\n\tdir, db, err := utsetup()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer cleanTestDir(dir)\n\n\tpropName := \"prop1\"\n\tpropList := new(externalpolicy.PropertyList)\n\tpropList.Add_Property(externalpolicy.Property_Factory(propName, \"val1\"), false)\n\n\textNodePolicy := &externalpolicy.ExternalPolicy{\n\t\tProperties: *propList,\n\t\tConstraints: []string{`prop3 == \"some value\"`},\n\t}\n\n\terr = SaveNodePolicy(db, extNodePolicy)\n\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error: %v\", err)\n\t} else if fnp, err := FindNodePolicy(db); err != nil {\n\t\tt.Errorf(\"failed to find node policy in db, error %v\", err)\n\t} else if len(fnp.Properties) != 1 {\n\t\tt.Errorf(\"incorrect node policy, there should be 1 property defined, found: %v\", *fnp)\n\t} else if fnp.Properties[0].Name != propName {\n\t\tt.Errorf(\"expected property %v, but received %v\", propName, fnp.Properties[0].Name)\n\t}\n\n\t// Now delete the object.\n\n\terr = DeleteNodePolicy(db)\n\n\tif np, err := FindNodePolicy(db); err != nil {\n\t\tt.Errorf(\"failed to find node policy in db, error %v\", err)\n\t} else if np != nil {\n\t\tt.Errorf(\"incorrect result, there should not be a node policy: %v\", *np)\n\t}\n\n}", "title": "" } ]
cea0c53a95ab6bd05b31bb81d395869c
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
[ { "docid": "b30a8721a48c5698ec80f9f256cf48ce", "score": "0.74792385", "text": "func (m *UserMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addage != nil {\n\t\tfields = append(fields, user.FieldAge)\n\t}\n\treturn fields\n}", "title": "" } ]
[ { "docid": "8c413dbae8dccd41c13abec209286d94", "score": "0.7893316", "text": "func (m *WorkOrderMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, workorder.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "c99fe7fdfaed397fa9476a591b27c39d", "score": "0.7851588", "text": "func (m *EntryMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addamount != nil {\n\t\tfields = append(fields, entry.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "cb3df06e7d1edb38db0b7f330ee660cd", "score": "0.7844098", "text": "func (m *RequisitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addamount != nil {\n\t\tfields = append(fields, requisition.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "17a1822c0caae850655d13f49ded766b", "score": "0.7839795", "text": "func (m *RoomamountMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Amount != nil {\n\t\tfields = append(fields, roomamount.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "c419cd1733592634d0f6629d880d68bc", "score": "0.7819537", "text": "func (m *KidMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Amount != nil {\n\t\tfields = append(fields, kid.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1d0a551d84bd06189f219b474266bb04", "score": "0.7814203", "text": "func (m *PhysicaltherapyrecordMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addprice != nil {\n\t\tfields = append(fields, physicaltherapyrecord.FieldPrice)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "2f3cc043f1f1672a27eeccb2306d4b57", "score": "0.7736248", "text": "func (m *WorkOrderDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, workorderdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "29ee90bffb00e8cb0fb368700253530c", "score": "0.7734139", "text": "func (m *TransferMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addamount != nil {\n\t\tfields = append(fields, transfer.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "ffcce8cb1290c6d56e73b6ed9ccc35f8", "score": "0.76954913", "text": "func (m *HistorytakingMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addhight != nil {\n\t\tfields = append(fields, historytaking.FieldHight)\n\t}\n\tif m.addweight != nil {\n\t\tfields = append(fields, historytaking.FieldWeight)\n\t}\n\tif m.addtemp != nil {\n\t\tfields = append(fields, historytaking.FieldTemp)\n\t}\n\tif m.addpulse != nil {\n\t\tfields = append(fields, historytaking.FieldPulse)\n\t}\n\tif m.addrespiration != nil {\n\t\tfields = append(fields, historytaking.FieldRespiration)\n\t}\n\tif m.addbp != nil {\n\t\tfields = append(fields, historytaking.FieldBp)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "dd54e20b36a6d4fd20e42262ff19ce93", "score": "0.7668146", "text": "func (m *PropertyMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addint_val != nil {\n\t\tfields = append(fields, property.FieldIntVal)\n\t}\n\tif m.addfloat_val != nil {\n\t\tfields = append(fields, property.FieldFloatVal)\n\t}\n\tif m.addlatitude_val != nil {\n\t\tfields = append(fields, property.FieldLatitudeVal)\n\t}\n\tif m.addlongitude_val != nil {\n\t\tfields = append(fields, property.FieldLongitudeVal)\n\t}\n\tif m.addrange_from_val != nil {\n\t\tfields = append(fields, property.FieldRangeFromVal)\n\t}\n\tif m.addrange_to_val != nil {\n\t\tfields = append(fields, property.FieldRangeToVal)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "88f6d8369b359bfe4d71178c3c27eb2f", "score": "0.7637246", "text": "func (m *AdultMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Amount != nil {\n\t\tfields = append(fields, adult.FieldAmount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "dfb9516f22c54779cc04d69fe2b3a383", "score": "0.7631447", "text": "func (m *AbiturientEntryMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addnumber != nil {\n\t\tfields = append(fields, abituriententry.FieldNumber)\n\t}\n\tif m.addsum != nil {\n\t\tfields = append(fields, abituriententry.FieldSum)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "6391e3b4e2a3bcdd5a561227dcdab4e4", "score": "0.7614468", "text": "func (m *FriendshipMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addweight != nil {\n\t\tfields = append(fields, friendship.FieldWeight)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "f3cc990ea592a9463a2efcfe2286d592", "score": "0.7606766", "text": "func (m *AppointmentMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addcharge != nil {\n\t\tfields = append(fields, appointment.FieldCharge)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "05f110e185f986836e15598fdfd4f4a3", "score": "0.7590501", "text": "func (m *EquipmentPortDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, equipmentportdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "a6db5377dea2d51951da8ab4078ebd51", "score": "0.75679314", "text": "func (m *PatientMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Age != nil {\n\t\tfields = append(fields, patient.FieldAge)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "5dda6b90849d9c8bc67713eadfaa19ed", "score": "0.7566584", "text": "func (m *AssignmentMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addduration != nil {\n\t\tfields = append(fields, assignment.FieldDuration)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "b78c6f4f2665880b240493ab36ff8fc5", "score": "0.7543302", "text": "func (m *RelationshipMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addweight != nil {\n\t\tfields = append(fields, relationship.FieldWeight)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "5bd33640e588bc79766c8c748259c700", "score": "0.7539528", "text": "func (m *RoomMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_ROOMNUMBER != nil {\n\t\tfields = append(fields, room.FieldROOMNUMBER)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1c08e1b27f0e4557dc3fdf19c326a749", "score": "0.7537635", "text": "func (m *PropertyTypeMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, propertytype.FieldIndex)\n\t}\n\tif m.addint_val != nil {\n\t\tfields = append(fields, propertytype.FieldIntVal)\n\t}\n\tif m.addfloat_val != nil {\n\t\tfields = append(fields, propertytype.FieldFloatVal)\n\t}\n\tif m.addlatitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLatitudeVal)\n\t}\n\tif m.addlongitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLongitudeVal)\n\t}\n\tif m.addrange_from_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeFromVal)\n\t}\n\tif m.addrange_to_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeToVal)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1584a89916db49970734722043c3aca4", "score": "0.7526385", "text": "func (m *PaytypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "a02df815aa3bdae7df3b377ba3f6ec22", "score": "0.7513883", "text": "func (m *DentalappointmentMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addamount != nil {\n\t\tfields = append(fields, dentalappointment.FieldAmount)\n\t}\n\tif m.addprice != nil {\n\t\tfields = append(fields, dentalappointment.FieldPrice)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "0dc6470e6b591e77d75d30d06339d77e", "score": "0.74991024", "text": "func (m *UnpaybillMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "93878fc2c81068ab9862709824e6a0b3", "score": "0.7493507", "text": "func (m *EquipmentPositionDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, equipmentpositiondefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "26eddb5bf0add3db1feb5255f54b5064", "score": "0.7486712", "text": "func (m *UserMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addfollows_count != nil {\n\t\tfields = append(fields, user.FieldFollowsCount)\n\t}\n\tif m.addfollowers_count != nil {\n\t\tfields = append(fields, user.FieldFollowersCount)\n\t}\n\tif m.addtweets_count != nil {\n\t\tfields = append(fields, user.FieldTweetsCount)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "5b6b1fbcf927c224c36050f22ebf7d37", "score": "0.74732465", "text": "func (m *ToolMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addmachine_id != nil {\n\t\tfields = append(fields, tool.FieldMachineID)\n\t}\n\tif m.addstatus != nil {\n\t\tfields = append(fields, tool.FieldStatus)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "30388c85b8d1ec3e5b59fa51a24bd6a1", "score": "0.74713796", "text": "func (m *BillMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "4862f7378df49a4c3514506d4da5a6a5", "score": "0.7470228", "text": "func (m *SurgeryappointmentMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addcost != nil {\n\t\tfields = append(fields, surgeryappointment.FieldCost)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "9c029e8db15411812504248012babc5c", "score": "0.7464217", "text": "func (m *WorkOrderTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "2bd6baa69c72f2891fe57eca96b902c4", "score": "0.74638224", "text": "func (m *PatientrecordMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Idcardnumber != nil {\n\t\tfields = append(fields, patientrecord.FieldIdcardnumber)\n\t}\n\tif m.add_Age != nil {\n\t\tfields = append(fields, patientrecord.FieldAge)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "16dd7d414deb962280934612280db069", "score": "0.74547", "text": "func (m *AbilitypatientrightsMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_Operative != nil {\n\t\tfields = append(fields, abilitypatientrights.FieldOperative)\n\t}\n\tif m.add_MedicalSupplies != nil {\n\t\tfields = append(fields, abilitypatientrights.FieldMedicalSupplies)\n\t}\n\tif m.add_Examine != nil {\n\t\tfields = append(fields, abilitypatientrights.FieldExamine)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "bfb6b2781e6880baf4b40b9c25f93fd5", "score": "0.74293983", "text": "func (m *HogeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "a37bd434e8d74ebfa0ec36e81be3bb64", "score": "0.74293816", "text": "func (m *UrgencyLevelMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "c905c5e0cdbb66ce9dec6db1e9ec9e1a", "score": "0.7425902", "text": "func (m *AccountMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addbalance != nil {\n\t\tfields = append(fields, account.FieldBalance)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "3130351a6a63c13ee237737eb19f3af3", "score": "0.7418174", "text": "func (m *TriageResultMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "fcf64c6a428253f3029beb30f4caeaba", "score": "0.7395662", "text": "func (m *EventMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "d78d5c459445a353bf64a1e5cfc539ce", "score": "0.7392319", "text": "func (m *ServiceEndpointDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, serviceendpointdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "e6183f12ab240ec7148faffe1737341e", "score": "0.7391832", "text": "func (m *GroupTagMutation) AddedFields() []string {\n\tvar fields []string\n\treturn fields\n}", "title": "" }, { "docid": "e01281bea5e10cbaa10bf2452639c9eb", "score": "0.7381543", "text": "func (m *FileMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addsize != nil {\n\t\tfields = append(fields, file.FieldSize)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "868e0d305c7a24904e4e64f679e988a5", "score": "0.7378051", "text": "func (m *PetMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addheight != nil {\n\t\tfields = append(fields, pet.FieldHeight)\n\t}\n\tif m.addweight != nil {\n\t\tfields = append(fields, pet.FieldWeight)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "34e1b2fde3e9ca60c881025defd52369", "score": "0.73762906", "text": "func (m *ReplyMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.adduser_id != nil {\n\t\tfields = append(fields, reply.FieldUserID)\n\t}\n\tif m.addstatus != nil {\n\t\tfields = append(fields, reply.FieldStatus)\n\t}\n\tif m.addfloor != nil {\n\t\tfields = append(fields, reply.FieldFloor)\n\t}\n\tif m.addcreate_at != nil {\n\t\tfields = append(fields, reply.FieldCreateAt)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "48a5e91bae8c72ad10d3e04946ae3524", "score": "0.737517", "text": "func (m *PatientMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addpersonalID != nil {\n\t\tfields = append(fields, patient.FieldPersonalID)\n\t}\n\tif m.addage != nil {\n\t\tfields = append(fields, patient.FieldAge)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "f9eb4a867da1093ee2b1d90a4abe5b0f", "score": "0.7361136", "text": "func (m *LocationTypeMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addmap_zoom_level != nil {\n\t\tfields = append(fields, locationtype.FieldMapZoomLevel)\n\t}\n\tif m.addindex != nil {\n\t\tfields = append(fields, locationtype.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "f2afdf945b018f5de0cf513cb3e093f3", "score": "0.7355902", "text": "func (m *WorkingMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "6c70cd19a9d3aac76a824dd35ffcf2fb", "score": "0.73547685", "text": "func (m *TicketMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "c9be0661b16ec96f28e8f4299a8b2300", "score": "0.7350168", "text": "func (m *BadgeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "56c99800798bd7e7728b052cb2509450", "score": "0.73490715", "text": "func (m *LastUpdatedMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "3c827e4a04ddeb1b5107128b80a6f66a", "score": "0.7347736", "text": "func (m *MedicalRecordMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "8f32b5436743ed350fb6e358718e531c", "score": "0.734616", "text": "func (m *PrefixMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "72ca2ef1861019a59e8f3e4a1e0a788d", "score": "0.734486", "text": "func (m *ReportFilterMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "8ea848bb9783432e3f7c3eb7663527da", "score": "0.7341437", "text": "func (m *TweetLikeMutation) AddedFields() []string {\n\tvar fields []string\n\treturn fields\n}", "title": "" }, { "docid": "9cc99c28b21144f7d6134be2d36b4174", "score": "0.7340509", "text": "func (m *SpecialistMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "8e4df78e3612d3c10d495104141c3c38", "score": "0.7334187", "text": "func (m *InsuranceMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "878d254caac831556cc8d20286d92dfc", "score": "0.73286945", "text": "func (m *FloorPlanReferencePointMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addx != nil {\n\t\tfields = append(fields, floorplanreferencepoint.FieldX)\n\t}\n\tif m.addy != nil {\n\t\tfields = append(fields, floorplanreferencepoint.FieldY)\n\t}\n\tif m.addlatitude != nil {\n\t\tfields = append(fields, floorplanreferencepoint.FieldLatitude)\n\t}\n\tif m.addlongitude != nil {\n\t\tfields = append(fields, floorplanreferencepoint.FieldLongitude)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "74f2c96a72583d3ed86ccc65ceb5f963", "score": "0.7328314", "text": "func (m *AntenatalinformationMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addgestationalage != nil {\n\t\tfields = append(fields, antenatalinformation.FieldGestationalage)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "9db1a8ed5df452e8fb98e4d124ae6e91", "score": "0.73282945", "text": "func (m *FloorPlanScaleMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addreference_point1_x != nil {\n\t\tfields = append(fields, floorplanscale.FieldReferencePoint1X)\n\t}\n\tif m.addreference_point1_y != nil {\n\t\tfields = append(fields, floorplanscale.FieldReferencePoint1Y)\n\t}\n\tif m.addreference_point2_x != nil {\n\t\tfields = append(fields, floorplanscale.FieldReferencePoint2X)\n\t}\n\tif m.addreference_point2_y != nil {\n\t\tfields = append(fields, floorplanscale.FieldReferencePoint2Y)\n\t}\n\tif m.addscale_in_meters != nil {\n\t\tfields = append(fields, floorplanscale.FieldScaleInMeters)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "5fac34a9b0a67ea652d3ff8130898ad6", "score": "0.73210424", "text": "func (m *MinerMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "7408c50a8970df6397abea2500c0ed2c", "score": "0.7320809", "text": "func (m *BooksMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "6e3f941578791d12e687d5a14aafbee6", "score": "0.7318724", "text": "func (m *FloorPlanMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "a244271655e841819abe339b1dfa475d", "score": "0.7317912", "text": "func (m *GroupMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "1da5c4d1e506ba34194d145a6faa3590", "score": "0.7303981", "text": "func (m *EquipmentTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "3ad03de2f1555cf0a957ca1269b032d1", "score": "0.7302154", "text": "func (m *ArticleMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "18e6ccf2e0089b68b0689ccdf6c05057", "score": "0.7295806", "text": "func (m *BookMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "9ac57eabbd2f029d2e1f1139c8b39031", "score": "0.7295623", "text": "func (m *EducationlevelMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "cc812e7a87e0eb9a132e45b3689a9f34", "score": "0.72950083", "text": "func (m *TreatmentMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "7ad2affd37e94bbf19a80442112c6b0c", "score": "0.7294154", "text": "func (m *EquipmentPortTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "29e4e8a7f0d574848a51049b6b5b76ca", "score": "0.72927123", "text": "func (m *EquipmentPortMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "189ac15be8d72b4ddb5cb986bfa4ff39", "score": "0.7291899", "text": "func (m *ActionsRuleMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "fab7a15ce7472dd78711f8deb4695ab9", "score": "0.7290004", "text": "func (m *DrugMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "8efcc50d9381764ae7817a7d3764fa46", "score": "0.72813505", "text": "func (m *CheckListItemMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, checklistitem.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "448b0c9d699440dfd2cbcdcd6a8b0204", "score": "0.7278613", "text": "func (m *UserGroupMutation) AddedFields() []string {\n\tvar fields []string\n\treturn fields\n}", "title": "" }, { "docid": "b8dc0496158cfc4002b9d32849e2a115", "score": "0.72762614", "text": "func (m *SurveyCellScanMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addsignal_strength != nil {\n\t\tfields = append(fields, surveycellscan.FieldSignalStrength)\n\t}\n\tif m.addarfcn != nil {\n\t\tfields = append(fields, surveycellscan.FieldArfcn)\n\t}\n\tif m.addtiming_advance != nil {\n\t\tfields = append(fields, surveycellscan.FieldTimingAdvance)\n\t}\n\tif m.addearfcn != nil {\n\t\tfields = append(fields, surveycellscan.FieldEarfcn)\n\t}\n\tif m.adduarfcn != nil {\n\t\tfields = append(fields, surveycellscan.FieldUarfcn)\n\t}\n\tif m.addlatitude != nil {\n\t\tfields = append(fields, surveycellscan.FieldLatitude)\n\t}\n\tif m.addlongitude != nil {\n\t\tfields = append(fields, surveycellscan.FieldLongitude)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "55a9763418ff2c8af4e42c2863ed05c6", "score": "0.7275871", "text": "func (m *UserTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "dbb2a42d529352cc219b037e20c2a305", "score": "0.7275125", "text": "func (m *FooMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "afa18e59b64c5068ba3b98710b06c4c4", "score": "0.72656024", "text": "func (m *StatusMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "f472cf67ff05cb065a175615a7689f7d", "score": "0.72654676", "text": "func (m *PatientrightsMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "723747d5dceb623697ad5abc70db76ae", "score": "0.7265227", "text": "func (m *RightToTreatmentTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "3e4dc28423d371d87c24dddd45d9c779", "score": "0.72620773", "text": "func (m *TypetreatmentMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "89341960486e94d6c2e94183f127c4fd", "score": "0.726166", "text": "func (m *SurveyTemplateQuestionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, surveytemplatequestion.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "d5feb7493bf6206f4254c10831143359", "score": "0.72558814", "text": "func (m *OfficeroomMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "9081d29181269e5b6427e020de17bf26", "score": "0.7255672", "text": "func (m *ProblemtypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "9b49eed21cba5385c226555437e0dd30", "score": "0.72547877", "text": "func (m *EquipmentMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "c8a16929b86397c2114de88df4406826", "score": "0.7253403", "text": "func (m *FinancierMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "004b6b0323428c8ea94b5ddfe156fccf", "score": "0.7253044", "text": "func (m *NoticeMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addnoticeType != nil {\n\t\tfields = append(fields, notice.FieldNoticeType)\n\t}\n\tif m.adduserId != nil {\n\t\tfields = append(fields, notice.FieldUserId)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "fba78b4dbf4f8cf0e229a9123f7ff2ed", "score": "0.72529215", "text": "func (m *VocaMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "58a9233081bddb427d92ac81a9a3bc05", "score": "0.7250215", "text": "func (m *PatientMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "5d4f28f16599e990699d8625b4f6aeaf", "score": "0.7241785", "text": "func (m *FileMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.adduid != nil {\n\t\tfields = append(fields, file.FieldUID)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1afda989e4f1779520074218135370ff", "score": "0.7236664", "text": "func (m *RightToTreatmentMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "889e59a9ca623d347e9d312ca90764ad", "score": "0.7235506", "text": "func (m *CheckListItemDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, checklistitemdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1deae1f71c9b6961d37be7caa37f3f8a", "score": "0.72317386", "text": "func (m *TweetTagMutation) AddedFields() []string {\n\tvar fields []string\n\treturn fields\n}", "title": "" }, { "docid": "f9a7ad41f8d1aeb07379c3080c360686", "score": "0.7230903", "text": "func (m *RemedyMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "f6652aa17f339c313596eea81858551a", "score": "0.72271824", "text": "func (m *PlayGroupMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "d65aaf86022361b9a218d7fae83a4c12", "score": "0.72225296", "text": "func (m *TaskMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.add_TaskTimeInvested != nil {\n\t\tfields = append(fields, task.FieldTaskTimeInvested)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "da4fdfeabb0e0591d8bdef60513ffeda", "score": "0.7221712", "text": "func (m *ToyMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "fd20d990efd4fff5dc4dfb78f0d2b3a6", "score": "0.72165847", "text": "func (m *ProcedureTypeMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "6039087b0eff7649fe3c4b542cdd61a4", "score": "0.721385", "text": "func (m *DoctorMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "6039087b0eff7649fe3c4b542cdd61a4", "score": "0.721385", "text": "func (m *DoctorMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "6039087b0eff7649fe3c4b542cdd61a4", "score": "0.721385", "text": "func (m *DoctorMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "ab53e65b85016d2f6e167b58751ebe82", "score": "0.7212162", "text": "func (m *PhysicaltherapyroomMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" }, { "docid": "55d47b02b01890a6a96e96ac2a9810c7", "score": "0.7208516", "text": "func (m *LanguageMutation) AddedFields() []string {\n\treturn nil\n}", "title": "" } ]
96c4c5ee91cc0a4e521c18f632532369
helper function to run the init process for a pipeline
[ { "docid": "b2e39d95fe6b45a3ceface26899e3bd7", "score": "0.0", "text": "func gen(c *cli.Context) error {\n\n\tpipe := defaultGoPipe(c.Bool(\"stages\"))\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to get working directory: %v\", err)\n\t}\n\n\tif len(c.String(\"path\")) != 0 {\n\n\t\tdir = c.String(\"path\")\n\n\t\terr := os.MkdirAll(dir, 0777)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to create directory path to config @ %s: %v\", dir, err)\n\t\t}\n\t}\n\n\tp := fmt.Sprintf(\"%s/.vela.yml\", dir)\n\n\tswitch c.String(\"type\") {\n\tcase \"node\":\n\t\tpipe = defaultNodePipe(c.Bool(\"stages\"))\n\tcase \"java\":\n\t\tpipe = defaultJavaPipe(c.Bool(\"stages\"))\n\t}\n\n\tdata, err := yaml.Marshal(&pipe)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to create config content: %v\", err)\n\t}\n\n\terr = ioutil.WriteFile(p, data, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to create yaml config file @ %s: %v\", \".vela.yml\", err)\n\t}\n\n\tfmt.Printf(\"\\\"%s\\\" %s pipeline generated \\n\", p, c.String(\"type\"))\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "37ee86aaecec25676c0f090d52ed047b", "score": "0.67164105", "text": "func (p *Pipeline) Init(tmoutMillis int64) error {\n\tif p.Stat != PipelineUnint {\n\t\treturn errors.Errorf(\"Invalid state: %s\", p.Stat.String())\n\t}\n\terr := p.forEach(tmoutMillis, true, func(n *pnode, ctx context.Context, errc chan<- error, wg *sync.WaitGroup) {\n\t\tn.node.Init(ctx, errc, wg)\n\t})\n\tif err == nil {\n\t\tp.Stat = PipelineInited\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c1fccb8f149229c6259259518fc86ef0", "score": "0.647796", "text": "func (p platformRunner) init(f *os.File) {\n\t//if clusterSize != 2 {\n\t//\tfmt.Fprintf(f, \"Requires 2 nodes\\n\")\n\t//\truntime.Goexit()\n\t//}\n\t// TODO(pbardea): Check that enough nodes exist in the cluster.\n\tif _, err := os.Stat(\"./init.sh\"); os.IsNotExist(err) {\n\t\tfmt.Fprintf(f, \"./init.sh not present\\n\")\n\t\truntime.Goexit()\n\t}\n\tif _, err := os.Stat(\"./scripts\"); os.IsNotExist(err) {\n\t\tfmt.Fprintf(f, \"./scripts not present\\n\")\n\t\truntime.Goexit()\n\t}\n\trunCmd(f, \"chmod\", \"-R\", \"a+x\", \"./scripts\")\n\trunCmd(f, \"zip\", \"-FSro\", \"./scripts.zip\", \"./scripts\")\n\n\tfmt.Fprintf(f, \"Putting and prepping scripts...\\n\")\n\tfor nodeID := 1; nodeID < p.clusterSize+1; nodeID++ {\n\t\tdest := p.nodeIDToHostname(nodeID)\n\t\tp.upload(f, dest, \"scripts.zip\")\n\t\tp.upload(f, dest, \"init.sh\")\n\t\tp.exec(f, dest, \"chmod a+x init.sh\")\n\t\tp.exec(f, dest, \"./init.sh\")\n\t}\n\tfmt.Fprintf(f, \"Put and prepped scripts\\n\")\n}", "title": "" }, { "docid": "00f2dfa52f907258397e191bbc3ccdf7", "score": "0.6359668", "text": "func (cs *containerSetup) launchInit() error {\n\tcs.log.Debug(\"Launching the init process\")\n\n\tconfig, err := cs.getInitContainerConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to generate init container config: %v\", err)\n\t}\n\n\tcontainer, err := cs.factory.Create(\"init\", config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create init container: %v\", err)\n\t}\n\tcs.initContainer = container\n\n\t// Open the log file\n\tflags := os.O_WRONLY | os.O_APPEND | os.O_CREATE | os.O_EXCL | os.O_TRUNC\n\tinitlog, err := os.OpenFile(\"/logs/init.log\", flags, os.FileMode(0666))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open init process log: %v\", err)\n\t}\n\tdefer initlog.Close()\n\n\tcs.initProcess = &libcontainer.Process{\n\t\tCwd: \"/\",\n\t\tUser: \"0\",\n\t\tArgs: []string{\"/init\"},\n\t\tStdout: initlog,\n\t\tStderr: initlog,\n\t}\n\tif err := cs.initContainer.Start(cs.initProcess); err != nil {\n\t\treturn fmt.Errorf(\"failed to launch init process: %v\", err)\n\t}\n\n\tpid, err := cs.initProcess.Pid()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve the pid of the init process: %v\", err)\n\t}\n\tcs.log.Tracef(\"Launched init process, pid: %d\", pid)\n\n\tgo cs.initWait()\n\n\treturn nil\n}", "title": "" }, { "docid": "60a2fd978d4a90280829f6b3d88576f2", "score": "0.6173429", "text": "func init() {\n\tprocessCmd.Flags().StringVarP(&port, \"port\", \"p\", \"18080\", \"port to run the heatlh check on\")\n\n\thealthy.AddCommand(versionCmd)\n\thealthy.AddCommand(processCmd)\n}", "title": "" }, { "docid": "7ccd4697d2b1d0b0e035dc53230f8347", "score": "0.6128604", "text": "func run(c *cli.Context) error {\n\t// set the log level for the plugin\n\tswitch c.String(\"runtime.log.level\") {\n\tcase \"t\", \"trace\", \"Trace\", \"TRACE\":\n\t\tlogrus.SetLevel(logrus.TraceLevel)\n\tcase \"d\", \"debug\", \"Debug\", \"DEBUG\":\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\tcase \"w\", \"warn\", \"Warn\", \"WARN\":\n\t\tlogrus.SetLevel(logrus.WarnLevel)\n\tcase \"e\", \"error\", \"Error\", \"ERROR\":\n\t\tlogrus.SetLevel(logrus.ErrorLevel)\n\tcase \"f\", \"fatal\", \"Fatal\", \"FATAL\":\n\t\tlogrus.SetLevel(logrus.FatalLevel)\n\tcase \"p\", \"panic\", \"Panic\", \"PANIC\":\n\t\tlogrus.SetLevel(logrus.PanicLevel)\n\tcase \"i\", \"info\", \"Info\", \"INFO\":\n\t\tfallthrough\n\tdefault:\n\t\tlogrus.SetLevel(logrus.InfoLevel)\n\t}\n\n\t// setup the compiler\n\tcompiler, err := setupCompiler(c)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\t// setup the pipeline\n\tp, err := setupPipeline(c, compiler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// setup the runtime\n\tr, err := runtime.New(&runtime.Setup{\n\t\tDriver: c.String(\"runtime.driver\"),\n\t\tConfigFile: c.String(\"runtime.config\"),\n\t\tNamespace: c.String(\"runtime.namespace\"),\n\t})\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\t// setup the context\n\tctx := context.Background()\n\n\tlogrus.Infof(\"creating network for pipeline %s\", p.ID)\n\terr = r.CreateNetwork(ctx, p)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tlogrus.Infof(\"creating volume for pipeline %s\", p.ID)\n\terr = r.CreateVolume(ctx, p)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tdefer func() {\n\t\tfor _, step := range p.Steps {\n\t\t\t// TODO: remove hardcoded reference\n\t\t\t//\n\t\t\t// nolint: goconst // ignore init as constant\n\t\t\tif step.Name == \"init\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogrus.Infof(\"removing container for step %s\", step.Name)\n\t\t\t// remove the runtime container\n\t\t\terr := r.RemoveContainer(ctx, step)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\tlogrus.Infof(\"removing volume for pipeline %s\", p.ID)\n\t\terr = r.RemoveVolume(ctx, p)\n\t\tif err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\n\t\tlogrus.Infof(\"removing network for pipeline %s\", p.ID)\n\t\terr = r.RemoveNetwork(ctx, p)\n\t\tif err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t}()\n\n\tfor _, step := range p.Steps {\n\t\t// TODO: remove hardcoded reference\n\t\tif step.Name == \"init\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tlogrus.Infof(\"setting up container for step %s\", step.Name)\n\t\terr = r.SetupContainer(ctx, step)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor _, step := range p.Steps {\n\t\t// https://golang.org/doc/faq#closures_and_goroutines\n\t\ttmp := step\n\n\t\t// TODO: remove hardcoded reference\n\t\tif tmp.Name == \"init\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tlogrus.Infof(\"creating container for step %s\", tmp.Name)\n\t\terr = r.RunContainer(ctx, tmp, p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// tail the logs of the container\n\t\tgo func() {\n\t\t\tlogrus.Infof(\"tailing container for step %s\", tmp.Name)\n\t\t\trc, err := r.TailContainer(ctx, tmp)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatal(err)\n\t\t\t}\n\t\t\tdefer rc.Close()\n\n\t\t\tlogrus.Infof(\"scanning container logs for step %s\", tmp.Name)\n\t\t\t// create new scanner from the container output\n\t\t\tscanner := bufio.NewScanner(rc)\n\t\t\tfor scanner.Scan() {\n\t\t\t\tfmt.Println(string(scanner.Bytes()))\n\t\t\t}\n\t\t}()\n\n\t\tlogrus.Infof(\"waiting for container for step %s\", tmp.Name)\n\t\terr = r.WaitContainer(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogrus.Infof(\"inspecting container for step %s\", tmp.Name)\n\t\terr = r.InspectContainer(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogrus.Infof(\"Container exited with code %d\", tmp.ExitCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fdb5226730e81fff077942976c42040e", "score": "0.61133826", "text": "func (p *Processor) init(ctx context.Context) error {\n\treturn p.initFromFind(ctx)\n\t// return p.initFromEvents(ctx) // For illustration.\n}", "title": "" }, { "docid": "cc82151a49303b91ac096a240fc8d3c0", "score": "0.6099867", "text": "func main() {\n\tcmd.Init()\n}", "title": "" }, { "docid": "e1708151364d4c9fd4e088ec03ecd3de", "score": "0.6070216", "text": "func (r *Runner) Init(ctx context.Context) {\n\tdefer lg.Scope(r.w.Log, \"initializing\")()\n\n\t// Install toolchain.\n\tr.w.Log.Info(\"install toolchain\", zap.Stringer(\"toolchain\", r.tc))\n\tgoroot := r.w.Path(\"goroot\")\n\tr.tc.Install(r.w, goroot)\n\n\tgorootbin := filepath.Join(goroot, \"bin\")\n\tr.gobin = filepath.Join(gorootbin, \"go\")\n\n\t// Configure Go environment.\n\tr.w.SetEnv(\"GOROOT\", goroot)\n\tr.w.SetEnv(\"GOPATH\", r.w.EnsureDir(\"gopath\"))\n\tr.w.SetEnv(\"GOCACHE\", r.w.EnsureDir(\"gocache\"))\n\tr.w.SetEnv(\"GO111MODULE\", \"on\")\n\tr.w.SetEnv(\"GOPROXY\", r.goproxy)\n\tr.w.DefineTool(\"AR\", \"ar\")\n\tr.w.DefineTool(\"CC\", \"gcc\")\n\tr.w.DefineTool(\"CXX\", \"g++\")\n\tr.w.DefineTool(\"PKG_CONFIG\", \"pkg-config\")\n\n\t// Environment required by standard library tests.\n\t// BenchmarkExecHostname calls \"hostname\".\n\t// https://github.com/golang/go/blob/83610c90bbe4f5f0b18ac01da3f3921c2f7090e4/src/os/exec/bench_test.go#L11\n\tr.w.ExposeTool(\"hostname\")\n\n\t// Environment checks.\n\tr.GoExec(ctx, \"version\")\n\tr.GoExec(ctx, \"env\")\n}", "title": "" }, { "docid": "68a4f7cb95069410a94898a0e9692612", "score": "0.60359544", "text": "func init() {\n\tif err := envconfig.Process(\"\", Conf); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "5b14740e1b6e97bb29ea69f031e91e87", "score": "0.59748477", "text": "func (s *RPC) Init(c context.Context, id string, state rpc.State) error {\n\t// logrus.Debugf(\"init\")\n\tprocID, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tproc, err := s.store.ProcLoad(procID)\n\tif err != nil {\n\t\tlogrus.Errorf(\"error: cannot find proc with id %d: %s\", procID, err)\n\t\treturn err\n\t}\n\tmetadata, ok := metadata.FromContext(c)\n\tif ok {\n\t\thostname, ok := metadata[\"hostname\"]\n\t\tif ok && len(hostname) != 0 {\n\t\t\tproc.Machine = hostname[0]\n\t\t}\n\t}\n\n\tbuild, err := s.store.GetBuild(proc.BuildID)\n\tif err != nil {\n\t\tlogrus.Errorf(\"error: cannot find build with id %d: %s\", proc.BuildID, err)\n\t\treturn err\n\t}\n\n\trepo, err := s.store.GetRepo(build.RepoID)\n\tif err != nil {\n\t\tlogrus.Errorf(\"error: cannot find repo with id %d: %s\", build.RepoID, err)\n\t\treturn err\n\t}\n\n\tif build.Status == model.StatusPending {\n\t\tbuild.Status = model.StatusRunning\n\t\tbuild.Started = state.Started\n\t\tif err := s.store.UpdateBuild(build); err != nil {\n\t\t\tlogrus.Errorf(\"error: init: cannot update build_id %d state: %s\", build.ID, err)\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tbuild.Procs, _ = s.store.ProcList(build)\n\n\t\tuser2, err := s.store.GetUser(repo.UserID)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"get user error:%s\", err)\n\t\t}\n\t\tproject, err := s.store.GetProject(user2.ProjectID)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"get project error:%s\", err)\n\t\t\t//return err\n\t\t}\n\n\t\tmessage := pubsub.Message{\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"test\": \"test2\",\n\t\t\t\t\"repo\": repo.FullName,\n\t\t\t\t\"project\": project.Name,\n\t\t\t\t\"private\": strconv.FormatBool(repo.IsPrivate),\n\t\t\t},\n\t\t}\n\t\tmessage.Data, _ = json.Marshal(model.Event{\n\t\t\tRepo: *repo,\n\t\t\tBuild: *build,\n\t\t})\n\t\ts.pubsub.Publish(c, \"topic/events\", message)\n\t}()\n\n\tproc.Started = state.Started\n\tproc.State = model.StatusRunning\n\treturn s.store.ProcUpdate(proc)\n}", "title": "" }, { "docid": "8d945909a8c144db4705ce3408765a0f", "score": "0.59453", "text": "func (p *Process) Init() error {\n\t// register enterprise-specific cluster services, this should be done\n\t// before initializing the open-source process\n\tp.registerClusterServices()\n\t// init the open-source process\n\tif err := p.Process.Init(p.Context()); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\t// the OSS operator can be either a local operator or a router\n\tswitch o := p.Operator().(type) {\n\tcase *ossservice.Operator:\n\t\tp.operator = service.New(o)\n\tcase *ossrouter.Router:\n\t\tp.operator = router.New(o, service.New(o.Local))\n\tdefault:\n\t\treturn trace.BadParameter(\"unexpected type: %T\", p.Operator())\n\t}\n\tclose(p.operatorReadyC)\n\tp.handlers = &Handlers{\n\t\tHandlers: p.Handlers(),\n\t\tOperator: handler.NewWebHandler(p.Handlers().Operator, p.operator),\n\t\tWebAPI: webapi.NewHandler(p.Handlers().WebAPI, p.operator),\n\t}\n\t// some actions should be taken when running inside Kubernetes\n\tif p.KubeClient() != nil {\n\t\terr := p.runMigrations(p.KubeClient())\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1c22dc1fd56349a70a7671cac04d072", "score": "0.5932186", "text": "func runInit(imageName string) error {\n\terr := os.Mkdir(imageName, 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.Mkdir(filepath.Join(imageName, \"workspace\"), 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdockerWorkspaceFileBytes, err := yaml.Marshal(DockerWorkspaceFile{imageName})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tenvironmentFiles := []environmentFile{\n\t\tenvironmentFile{\n\t\t\tName: \"Dockerfile\",\n\t\t\tContents: []byte(dockerfileContents),\n\t\t},\n\t\tenvironmentFile{\n\t\t\tName: DockerWorkspaceFileName,\n\t\t\tContents: dockerWorkspaceFileBytes,\n\t\t},\n\t}\n\n\tfor _, fileToWrite := range environmentFiles {\n\t\terr = ioutil.WriteFile(filepath.Join(imageName, fileToWrite.Name), fileToWrite.Contents, 0600)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = runCommandThroughPipes(\"docker\", \"build\", \"-t\"+imageName, imageName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn runResume(imageName)\n}", "title": "" }, { "docid": "5e7fa48b1c8a1d20145baea924f4a8f5", "score": "0.59199166", "text": "func init() {\n\tregister(&cli.Command{\n\t\tName: \"init\",\n\t\tUsage: \"Create a codelingo.yaml file in the current directory.\",\n\t\tAction: newLingoAction,\n\t}, false, false, verify.VCSRq, verify.VersionRq)\n}", "title": "" }, { "docid": "38998bd81868ca51bfe5563071451e8f", "score": "0.5912385", "text": "func init() {\n\tpiperunner.StartPool()\n}", "title": "" }, { "docid": "cc70eaff999877e383e01ed635b05ec0", "score": "0.5888172", "text": "func (g *Github) Init(source string, pipelineID string) error {\n\tg.Version = source\n\tg.remoteBranch = git.SanitizeBranchName(fmt.Sprintf(\"updatecli_%v\", pipelineID))\n\tg.setDirectory()\n\n\tif ok, err := g.Check(); !ok {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1816df1ea72332401725b093eeeba64c", "score": "0.58868885", "text": "func BuildPipelineInitCmd() *cobra.Command {\n\topts := NewInitPipelineOpts()\n\tcmd := &cobra.Command{\n\t\tUse: \"init\",\n\t\tShort: \"Creates a pipeline for applications in your workspace.\",\n\t\tLong: `Creates a pipeline for the applications in your workspace, using the environments associated with the applications.`,\n\t\tExample: `\n Create a pipeline for the applications in your workspace:\n\t/code $ dw_run.sh pipeline init \\\n\t /code --github-url https://github.com/gitHubUserName/myFrontendApp.git \\\n\t /code --github-access-token file://myGitHubToken \\\n\t /code --environments \"dev,prod\" \\\n\t /code --deploy`,\n\t\tPreRunE: runCmdE(func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := opts.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// TODO: move these logic to a method\n\t\t\tprojectEnvs, err := opts.getEnvNames()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't get environments: %w\", err)\n\t\t\t}\n\t\t\tif len(projectEnvs) == 0 {\n\t\t\t\treturn errNoEnvsInProject\n\t\t\t}\n\t\t\topts.projectEnvs = projectEnvs\n\n\t\t\tws, err := workspace.New()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"workspace cannot be created: %w\", err)\n\t\t\t}\n\t\t\topts.workspace = ws\n\n\t\t\tsecretsmanager, err := secretsmanager.NewStore()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"couldn't create secrets manager: %w\", err)\n\t\t\t}\n\t\t\topts.secretsmanager = secretsmanager\n\t\t\topts.box = templates.Box()\n\n\t\t\terr = opts.runner.Run(\"git\", []string{\"remote\", \"-v\"}, command.Stdout(&opts.buffer))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"get remote repository info: %w, run `git remote add` first please\", err)\n\t\t\t}\n\t\t\turls, err := opts.parseGitRemoteResult(strings.TrimSpace(opts.buffer.String()))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\topts.repoURLs = urls\n\t\t\topts.buffer.Reset()\n\n\t\t\treturn nil\n\t\t}),\n\t\tRunE: runCmdE(func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := opts.Ask(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn opts.Execute()\n\t\t}),\n\t\tPostRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tlog.Infoln()\n\t\t\tlog.Infoln(\"Recommended follow-up actions:\")\n\t\t\tfor _, followup := range opts.RecommendedActions() {\n\t\t\t\tlog.Infof(\"- %s\\n\", followup)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.Flags().StringVarP(&opts.GitHubURL, githubURLFlag, githubURLFlagShort, \"\", githubURLFlagDescription)\n\tcmd.Flags().StringVarP(&opts.GitHubAccessToken, githubAccessTokenFlag, githubAccessTokenFlagShort, \"\", githubAccessTokenFlagDescription)\n\tcmd.Flags().StringVarP(&opts.GitBranch, gitBranchFlag, gitBranchFlagShort, \"\", gitBranchFlagDescription)\n\tcmd.Flags().StringSliceVarP(&opts.Environments, envsFlag, envsFlagShort, []string{}, pipelineEnvsFlagDescription)\n\n\treturn cmd\n}", "title": "" }, { "docid": "7adf3f8eda3c4a7d7c522b3459e3fc16", "score": "0.5876528", "text": "func init() {\n\t// sequential stage list from the declared stage IDs\n\ttest_stageList = lyfecycle.StageIDsList{ // shoving this into a global variable so we can validate it later...\n\t\tLyfeCycleStage1,\n\t\tLyfeCycleStage2,\n\t\tLyfeCycleStage3,\n\t\tLyfeCycleStage4,\n\t\tLyfeCycleStage5,\n\t}\n\t// declare this stage progression with the lyfecyle system\n\tlyfecycle.DefineStages(test_stageList)\n\n\t// register your callbacks as desired\n\tlyfecycle.RegisterEvent(LyfeCycleStage1, func() {\n\t\tcalledLyfeCycleStage1 = true\n\t})\n\tlyfecycle.RegisterEvent(LyfeCycleStage2, func() {\n\t\tcalledLyfeCycleStage2 = true\n\t})\n\tlyfecycle.RegisterEvent(LyfeCycleStage3, func() {\n\t\tcalledLyfeCycleStage3 = true\n\t})\n\tlyfecycle.RegisterEvent(LyfeCycleStage4, func() {\n\t\tcalledLyfeCycleStage4 = true\n\t})\n\tlyfecycle.RegisterEvent(LyfeCycleStage5, func() {\n\t\tcalledLyfeCycleStage5 = true\n\t})\n\tlyfecycle.PerformAllStages()\n}", "title": "" }, { "docid": "7bd3c5cfd6dd15411e0f9550e487b3b9", "score": "0.5871951", "text": "func (h *HelmExecute) runHelmInit() error {\n\thelmLogFields := map[string]interface{}{}\n\thelmLogFields[\"Chart Path\"] = h.config.ChartPath\n\thelmLogFields[\"Namespace\"] = h.config.Namespace\n\thelmLogFields[\"Deployment Name\"] = h.config.DeploymentName\n\thelmLogFields[\"Context\"] = h.config.KubeContext\n\thelmLogFields[\"Kubeconfig\"] = h.config.KubeConfig\n\tlog.Entry().WithFields(helmLogFields).Debug(\"Calling Helm\")\n\n\thelmEnv := []string{fmt.Sprintf(\"KUBECONFIG=%v\", h.config.KubeConfig)}\n\n\tlog.Entry().Debugf(\"Helm SetEnv: %v\", helmEnv)\n\th.utils.SetEnv(helmEnv)\n\th.utils.Stdout(h.stdout)\n\n\treturn nil\n}", "title": "" }, { "docid": "2c7d14c91daca93b6293d2addba0d42b", "score": "0.58574975", "text": "func (p *Pipeline) Start() {\n\tgo p.Decoder.Start()\n\tgo p.Decrypter.Start()\n\tgo p.MACProcessor.Start()\n\tgo p.Scheduler.Start()\n\tgo p.Encoder.Start()\n}", "title": "" }, { "docid": "09da5766ebe6e6a108bbaa999849de21", "score": "0.58561635", "text": "func doInit(cmd *cobra.Command, root string) error {\n\t// read the genesis file if present, and populate --chain-id and --valhash\n\terr := checkGenesis(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = initConfigFile(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = initTrust()\n\treturn err\n}", "title": "" }, { "docid": "3c0a53202bd855737cb5d3e2acdd205a", "score": "0.5813618", "text": "func initialize(args []string) (context.T, string, error) {\n\t// intialize a light weight logger, use the default seelog config logger\n\tlogger := ssmlog.SSMLogger(false)\n\t// initialize appconfig, use default config\n\tconfig := appconfig.DefaultConfig()\n\tlogger.Debugf(\"parsing args: %v\", args)\n\tchannelName, instanceID, err := proc.ParseArgv(args)\n\t//cache the instanceID here in order to avoid throttle by metadata endpoint.\n\tplatform.SetInstanceID(instanceID)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to parse argv: %v\", err)\n\t}\n\t//use process as context name\n\treturn context.Default(logger, config).With(defaultWorkerContextName).With(\"[\" + channelName + \"]\"), channelName, err\n}", "title": "" }, { "docid": "f5374da3835d37e1d18d9c1847e6e201", "score": "0.5807181", "text": "func init() {\n\t// Allocate one logical processor for the scheduler to use.\n\truntime.GOMAXPROCS(1)\n}", "title": "" }, { "docid": "4c64c7a1d5cdbaba96690b6876000bc1", "score": "0.5803806", "text": "func init() {\n\n\tviper.AddConfigPath(\"$HOME/config\")\n\tviper.AddConfigPath(\"./\")\n\tviper.AddConfigPath(\"./config\")\n\tviper.AddConfigPath(\"$PIPELINE_CONFIG_DIR/\")\n\n\tviper.SetConfigName(\"config\")\n\t//viper.SetConfigType(\"toml\")\n\n\t// Set defaults TODO expand defaults\n\tviper.SetDefault(\"drone.url\", \"http://localhost:8000\")\n\tviper.SetDefault(\"helm.retryAttempt\", 30)\n\tviper.SetDefault(\"helm.retrySleepSeconds\", 15)\n\tviper.SetDefault(\"helm.stableRepositoryURL\", \"https://kubernetes-charts.storage.googleapis.com\")\n\tviper.SetDefault(\"helm.banzaiRepositoryURL\", \"http://kubernetes-charts.banzaicloud.com\")\n\tviper.SetDefault(\"cloud.gkeCredentialPath\", \"./conf/gke_credential.json\")\n\tviper.SetDefault(\"cloud.defaultProfileName\", \"default\")\n\tviper.SetDefault(\"cloud.configRetryCount\", 30)\n\tviper.SetDefault(\"cloud.configRetrySleep\", 15)\n\tviper.SetDefault(\"logging.kubicornloglevel\", \"debug\")\n\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error reading config file, %s\", err.Error())\n\t}\n\tviper.SetDefault(\"statestore.path\", fmt.Sprintf(\"%s/statestore/\", pwd))\n\n\tviper.SetDefault(\"pipeline.listenport\", 9090)\n\tviper.SetDefault(\"pipeline.uipath\", \"/account/repos\")\n\tviper.SetDefault(\"database.dialect\", \"mysql\")\n\tviper.SetDefault(\"database.port\", 3306)\n\tviper.SetDefault(\"database.host\", \"localhost\")\n\tviper.SetDefault(\"database.user\", \"kellyslater\")\n\tviper.SetDefault(\"database.password\", \"pipemaster123!\")\n\tviper.SetDefault(\"database.dbname\", \"pipelinedb\")\n\n\tReleaseName := os.Getenv(\"KUBERNETES_RELEASE_NAME\")\n\tif ReleaseName == \"\" {\n\t\tReleaseName = \"pipeline\"\n\t}\n\tviper.SetDefault(\"monitor.release\", ReleaseName)\n\tviper.SetDefault(\"monitor.enabled\", false)\n\tviper.SetDefault(\"monitor.configmap\", \"\")\n\tviper.SetDefault(\"monitor.mountpath\", \"\")\n\n\t// Find and read the config file\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tlog.Fatalf(\"Error reading config file, %s\", err)\n\t}\n\t// Confirm which config file is used\n\tfmt.Printf(\"Using config: %s\\n\", viper.ConfigFileUsed())\n\tviper.SetEnvPrefix(\"pipeline\")\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\tviper.AutomaticEnv()\n}", "title": "" }, { "docid": "4f717ff2228bd586246b4155fa8a27b9", "score": "0.5800938", "text": "func (p Pipeline) Run() {\n\tvar wg sync.WaitGroup\n\tp.SourceReader.Init(p.Tokenizer, p.ErrorHandler, &wg)\n\tp.Tokenizer.Init(p.SourceReader, p.Lexer, p.ErrorHandler, &wg)\n\tp.Lexer.Init(p.Tokenizer, p.Parser, p.ErrorHandler, &wg)\n\tp.Parser.Init(p.Lexer, p.Evaluator, p.ErrorHandler, &wg)\n\tp.Evaluator.Init(p.Parser, p.Reporter, p.ErrorHandler, &wg)\n\tp.Reporter.Init(p.Evaluator, p.ResultWriter, p.ErrorHandler, &wg)\n\tp.ResultWriter.Init(p.Reporter, p.ErrorHandler, &wg)\n\twg.Wait()\n}", "title": "" }, { "docid": "3a193be90b585f9ea8f901a2eb1054d5", "score": "0.57966244", "text": "func (p *AbstractRunProvider) Init() error {\n\treturn nil\n}", "title": "" }, { "docid": "e2e62dc20801c717cb2fcd1e7e9075a9", "score": "0.57929146", "text": "func CommonInit() {\n\tstage = GetProperty(\"STAGE\")\n}", "title": "" }, { "docid": "522b5318dbd09faa343c8538e06c9788", "score": "0.57597995", "text": "func DoInit(ctx context.Context, out io.Writer, c config.Config) error {\n\trootDir := \".\"\n\n\tif c.ComposeFile != \"\" {\n\t\tif err := runKompose(ctx, c.ComposeFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ta := newAnalysis(c)\n\n\tif err := a.analyze(rootDir); err != nil {\n\t\treturn err\n\t}\n\n\tvar deployInitializer deploymentInitializer\n\tswitch {\n\tcase c.SkipDeploy:\n\t\tdeployInitializer = &emptyDeployInit{}\n\tcase len(c.CliKubernetesManifests) > 0:\n\t\tdeployInitializer = &cliDeployInit{c.CliKubernetesManifests}\n\tdefault:\n\t\tk, err := newKubectlInitializer(a.kubectlAnalyzer.kubernetesManifests)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdeployInitializer = k\n\t}\n\n\t// Determine which builders/images require prompting\n\tpairs, unresolvedBuilderConfigs, unresolvedImages :=\n\t\tmatchBuildersToImages(\n\t\t\ta.builderAnalyzer.foundBuilders,\n\t\t\tstripTags(deployInitializer.GetImages()))\n\n\tif c.Analyze {\n\t\t// TODO: Remove backwards compatibility block\n\t\tif !c.EnableNewInitFormat {\n\t\t\treturn printAnalyzeOldFormat(out, c.SkipBuild, pairs, unresolvedBuilderConfigs, unresolvedImages)\n\t\t}\n\n\t\treturn printAnalyzeJSON(out, c.SkipBuild, pairs, unresolvedBuilderConfigs, unresolvedImages)\n\t}\n\tif !c.SkipBuild {\n\t\tif len(a.builderAnalyzer.foundBuilders) == 0 && c.CliArtifacts == nil {\n\t\t\treturn errors.New(\"one or more valid builder configuration (Dockerfile or Jib configuration) must be present to build images with skaffold; please provide at least one build config and try again or run `skaffold init --skip-build`\")\n\t\t}\n\t\tif c.CliArtifacts != nil {\n\t\t\tnewPairs, err := processCliArtifacts(c.CliArtifacts)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"processing cli artifacts\")\n\t\t\t}\n\t\t\tpairs = append(pairs, newPairs...)\n\t\t} else {\n\t\t\tresolved, err := resolveBuilderImages(unresolvedBuilderConfigs, unresolvedImages, c.Force)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpairs = append(pairs, resolved...)\n\t\t}\n\t}\n\n\tpipeline, err := yaml.Marshal(generateSkaffoldConfig(deployInitializer, pairs))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.Opts.ConfigurationFile == \"-\" {\n\t\tout.Write(pipeline)\n\t\treturn nil\n\t}\n\n\tif !c.Force {\n\t\tif done, err := promptWritingConfig(out, pipeline, c.Opts.ConfigurationFile); done {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := ioutil.WriteFile(c.Opts.ConfigurationFile, pipeline, 0644); err != nil {\n\t\treturn errors.Wrap(err, \"writing config to file\")\n\t}\n\n\tfmt.Fprintf(out, \"Configuration %s was written\\n\", c.Opts.ConfigurationFile)\n\ttips.PrintForInit(out, c.Opts)\n\n\treturn nil\n}", "title": "" }, { "docid": "0eab486fd72a2af76982264f9c0c489d", "score": "0.57459605", "text": "func (r Root) Init() tea.Cmd {\n\treturn doReloadCPULoadAvg()\n}", "title": "" }, { "docid": "cf1a0f903da5ce6dd1dbdb5d6ba16b44", "score": "0.5741809", "text": "func init() {\n\tinputs.Add(\"bashpool\", func() telegraf.Input {\n\t\treturn &BashPool{\n\t\t\tOutCh: make(chan MSGLine, 1),\n\t\t\tUserShells: make(map[string]*UserShell),\n\t\t\tCmdDefs: make(map[string]*CmdDef),\n\t\t\twg: sync.WaitGroup{},\n\t\t}\n\t})\n}", "title": "" }, { "docid": "8626aa3016b8ce8c53bc0e43520ad76e", "score": "0.57346874", "text": "func init() {\n\tif os.Getenv(\"RUN_AS_PROTOC_GEN_GO\") != \"\" {\n\t\tmain()\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "e5efc8dfb52ed8a896e4587f4a146e58", "score": "0.571942", "text": "func (cr *ConsoleRunner) Init(b core.Bot) error { return nil }", "title": "" }, { "docid": "876244f507715caca741bd32ca71c865", "score": "0.56924635", "text": "func (gps *GenProcSys) InitPrepare() {\n}", "title": "" }, { "docid": "43d01aa90cb864e64e84917d2ddbedd4", "score": "0.5681352", "text": "func (c *baseClientCommand) init(args []string) ([]string, error) {\n\t// Make sure we can work out our own location.\n\tif plugin, err := osext.Executable(); err != nil {\n\t\treturn args, errors.Annotate(err, \"finding plugin location\")\n\t} else {\n\t\tc.plugin = plugin\n\t}\n\n\tif len(args) == 0 {\n\t\treturn args, errors.Errorf(\"no environment name specified\")\n\t}\n\tc.name, args = args[0], args[1:]\n\n\tif c.needsController {\n\t\tif len(args) == 0 {\n\t\t\treturn args, errors.Errorf(\"no controller name specified\")\n\t\t}\n\t\tif err := c.SetControllerName(args[0], false); err != nil {\n\t\t\treturn args, errors.Trace(err)\n\t\t}\n\t\targs = args[1:]\n\t}\n\n\tif err := c.loadInfo(); err != nil {\n\t\treturn args, err\n\t}\n\n\treturn args, nil\n}", "title": "" }, { "docid": "328aac60951c2de9e22d5071a4dd036b", "score": "0.5649048", "text": "func init() {\n\tswitch {\n\tcase detectSequelpro():\n\t\tapp, err := ddevapp.GetActiveApp(\"\")\n\t\tif err == nil && app != nil && !nodeps.ArrayContainsString(app.OmitContainers, \"db\") {\n\t\t\tRootCmd.AddCommand(DdevSequelproCmd)\n\t\t}\n\tcase runtime.GOOS == \"darwin\":\n\t\tRootCmd.AddCommand(dummyDevSequelproCmd)\n\t}\n}", "title": "" }, { "docid": "eac1cc7b5878c0fab829d3d20ca9305e", "score": "0.5642987", "text": "func initCmd() {\n\n\t// Validate yaml file\n\tif !strings.HasSuffix(cfgFile, \".yaml\") {\n\t\tlog.WithField(\"file\", cfgFile).Error(\"Configuration file must be a yaml file\")\n\t\tos.Exit(1)\n\t}\n\n\t_, err := os.Stat(cfgFile)\n\tif os.IsNotExist(err) {\n\t\tlog.WithField(\"file\", cfgFile).Error(\"Configuration file not found\")\n\t\tos.Exit(1)\n\t}\n\n}", "title": "" }, { "docid": "ddcea03bf82fdbbe893aca69b4fb2630", "score": "0.56407404", "text": "func Init() {\n\tpopulateDefaultSlots()\n\n\t// Process default inputs\n\tprocess(input)\n}", "title": "" }, { "docid": "450f0b753e6666c42c7e76bc608b5b93", "score": "0.56311154", "text": "func init() {\n\tlastRun = 0 // So that it runs as soon as the service starts up\n\tfirstRun = true\n}", "title": "" }, { "docid": "5027f4b64ccc9b833c33bc941ce4b43b", "score": "0.56249934", "text": "func init() {\n\n\t// ensure we log all shell execs\n\tlog.SetLevel(log.DebugLevel)\n\n\t// set-up variables\n\tconfig := getKubeConfig(\"\", clientcmd.ConfigOverrides{})\n\tAppClientset = appclientset.NewForConfigOrDie(config)\n\tKubeClientset = kubernetes.NewForConfigOrDie(config)\n\tDynamicClientset = dynamic.NewForConfigOrDie(config)\n\tAppSetClientset = DynamicClientset.Resource(v1alpha1.GroupVersion.WithResource(\"applicationsets\")).Namespace(ArgoCDNamespace)\n\n}", "title": "" }, { "docid": "116be4a337be419436d6d3385b43e5aa", "score": "0.5617258", "text": "func RunInit(cfg *config.Config) error {\n\t// Only run these if project version is v3.\n\tif !cfg.IsV3() {\n\t\treturn nil\n\t}\n\n\t// Update the scaffolded Makefile with operator-sdk recipes.\n\tif err := initUpdateMakefile(\"Makefile\"); err != nil {\n\t\treturn fmt.Errorf(\"error updating Makefile: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "161da5012eab4798394ba89370082dae", "score": "0.560414", "text": "func RunInit(m map[string]interface{}) error {\n\ti, err := NewInit(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn i.Run()\n}", "title": "" }, { "docid": "e1c3949a8a38d3edf13f741b257d0e72", "score": "0.55992097", "text": "func run(c *cli.Context) error {\n\t// set the log level for the plugin\n\tswitch c.String(\"log.level\") {\n\tcase \"t\", \"trace\", \"Trace\", \"TRACE\":\n\t\tlogrus.SetLevel(logrus.TraceLevel)\n\tcase \"d\", \"debug\", \"Debug\", \"DEBUG\":\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\tcase \"w\", \"warn\", \"Warn\", \"WARN\":\n\t\tlogrus.SetLevel(logrus.WarnLevel)\n\tcase \"e\", \"error\", \"Error\", \"ERROR\":\n\t\tlogrus.SetLevel(logrus.ErrorLevel)\n\tcase \"f\", \"fatal\", \"Fatal\", \"FATAL\":\n\t\tlogrus.SetLevel(logrus.FatalLevel)\n\tcase \"p\", \"panic\", \"Panic\", \"PANIC\":\n\t\tlogrus.SetLevel(logrus.PanicLevel)\n\tcase \"i\", \"info\", \"Info\", \"INFO\":\n\t\tfallthrough\n\tdefault:\n\t\tlogrus.SetLevel(logrus.InfoLevel)\n\t}\n\n\t// create a vela client\n\tvela, err := setupClient(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// setup the compiler\n\tcompiler, err := setupCompiler(c)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\t// setup the pipeline\n\tp, err := setupPipeline(c, compiler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Pipeline: \", p)\n\n\t// setup the runtime\n\tr, err := runtime.New(&runtime.Setup{\n\t\tDriver: c.String(\"runtime.driver\"),\n\t\tConfigFile: c.String(\"runtime.config\"),\n\t\tNamespace: c.String(\"runtime.namespace\"),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Runtime: \", r)\n\n\t// setup the executor\n\te, err := executor.New(&executor.Setup{\n\t\tDriver: c.String(\"executor.driver\"),\n\t\tClient: vela,\n\t\tRuntime: r,\n\t\tBuild: setupBuild(),\n\t\tPipeline: p,\n\t\tRepo: setupRepo(),\n\t\tUser: setupUser(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Executor: \", e)\n\n\treturn nil\n}", "title": "" }, { "docid": "02d06e0981fb6a56544277208af9dcd1", "score": "0.5598693", "text": "func init() {\n\tappState.Env = make(map[string]string, 0)\n\n\tCli.SetPrintASCIILogo(func(a *grumble.App) {\n\t\tfmt.Println(` Data Migration Kit`)\n\t\tfmt.Println(` ___ _____ _____ `)\n\t\tfmt.Println(` | \\| | | |`)\n\t\tfmt.Println(` | | | | | | -|`)\n\t\tfmt.Println(` |___/|_|_|_|__|__|`)\n\t\tfmt.Println(` v` + Version)\n\t\tfmt.Println()\n\t\tfmt.Println(` type \"help\" for cmds`)\n\t\tfmt.Println(` type \"ls p\" for a list of projects`)\n\t\tfmt.Println(` type \"create p\" to create a project`)\n\t\tfmt.Println()\n\t})\n\n\tCli.OnInit(func(a *grumble.App, flags grumble.FlagMap) error {\n\t\t// Set the base directory\n\t\tdir, err := prepDirectory(flags.String(\"directory\"))\n\t\tif err != nil {\n\t\t\tCli.PrintError(errors.New(\"directory \" + dir + \" does not exist\"))\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tappState.Directory = dir\n\n\t\tCli.SetPrompt(\"dmk [\" + appState.Directory + \"] » \")\n\n\t\t// Get the default project from the command line if specified\n\t\tproject := flags.String(\"project\")\n\t\tif project != \"\" {\n\t\t\ta.RunCommand([]string{\"open\", \"p\", flags.String(\"project\")})\n\t\t}\n\t\treturn nil\n\t})\n\n}", "title": "" }, { "docid": "44a8b8f47675a1825253147fe0e03c91", "score": "0.55981636", "text": "func init() {\n\trootCmd.AddCommand(componentListCmd)\n}", "title": "" }, { "docid": "3e0ed51b94b557941117c780ee3b72aa", "score": "0.559669", "text": "func main() {\n\n\t// 1. test cellibrium - need an invariant name (non trivial in cloud)\n\n\tctx := context.Background()\n\tctx = H.SetLocationInfo(ctx, map[string]string{\n\t\t\"Pod\": \"A_pod_named_foo\",\n\t\t\"Deployment\": \"myApp_name2\", // insert instance data from env?\n\t\t\"Version\": \"1.2.3\",\n\t})\n\n\tMainLoop(ctx)\n\n\t// 2. test koalja, reads pipeline/container_description\n\n // go routine ...several parallel with same name\n\n}", "title": "" }, { "docid": "00e20e35718507302b630ae0193f7a2b", "score": "0.55899364", "text": "func initEnvForCreateIdentityProviderCmd(cmd *cobra.Command, args []string) {\n\tif CreateIdentityProviderOpts.TargetDir == \"\" {\n\t\tpwd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to get current directory: %s\", err)\n\t\t}\n\n\t\tCreateIdentityProviderOpts.TargetDir = pwd\n\t}\n\n\tfPath, err := filepath.Abs(CreateIdentityProviderOpts.TargetDir)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to resolve full path: %s\", err)\n\t}\n\n\t// create target dir if necessary\n\terr = provisioning.EnsureDir(fPath)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create target directory at %s\", fPath)\n\t}\n\n\t// create manifests dir if necessary\n\tmanifestsDir := filepath.Join(fPath, provisioning.ManifestsDirName)\n\terr = provisioning.EnsureDir(manifestsDir)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create manifests directory at %s\", manifestsDir)\n\t}\n}", "title": "" }, { "docid": "4fb90a9cd77f325b479546e55149e996", "score": "0.5586914", "text": "func init() {\n\trootCmd.AddCommand(appsCmd)\n}", "title": "" }, { "docid": "5725144667e7fb9cf87eb74e1048de9e", "score": "0.55863464", "text": "func (sr *SetupCfgRunner) Start() {\n\tlogp.Debug(\"fileset\", \"Loading ingest pipelines for modules from modules.d\")\n\tpipelineLoader, err := sr.pipelineLoaderFactory()\n\tif err != nil {\n\t\tlogp.Err(\"Error loading pipeline: %+v\", err)\n\t\treturn\n\t}\n\n\terr = sr.moduleRegistry.LoadPipelines(pipelineLoader, sr.overwritePipelines)\n\tif err != nil {\n\t\tlogp.Err(\"Error loading pipeline: %s\", err)\n\t}\n}", "title": "" }, { "docid": "e8532d069255944adf9e03c836f07f6e", "score": "0.5584417", "text": "func (cg *CmdGroup) init() {\n\tcg.CmdUnits = []CmdUnit{}\n\tpipedStmts := strings.Split(cg.Stmt, \"|\")\n\tfor _, pipedStmt := range pipedStmts {\n\t\tcmdUnit := CmdUnit{\n\t\t\tStmt: pipedStmt,\n\t\t}\n\t\tcmdUnit.init()\n\t\tcg.CmdUnits = append(cg.CmdUnits, cmdUnit)\n\t}\n}", "title": "" }, { "docid": "65e424c89600acdef62737339d55f132", "score": "0.5580746", "text": "func (cs *containerSetup) initWait() {\n\tcs.initWaitch = make(chan struct{})\n\tcs.initProcess.Wait()\n\tclose(cs.initWaitch)\n\n\tif cs.isShuttingDown() {\n\t\treturn\n\t}\n\n\tcs.log.Error(\"The init process has exited, but the pod is not tearing down. Stager exiting.\")\n\tfmt.Fprintln(os.Stderr, \"The stager init process has exited. Stager exiting.\")\n\tcs.stop()\n\tos.Exit(1)\n}", "title": "" }, { "docid": "23c048f9d8c53cbb40f7248c98c69960", "score": "0.5577143", "text": "func (r *Runner) Init(c *providers.Config, providerMap ProvidersMap) error {\n\tr.config = c\n\tr.ctx, r.cancelFunc = context.WithCancel(context.Background())\n\n\tfor name, filters := range providerMap {\n\t\tswitch name {\n\t\tcase \"urlscan\":\n\t\t\tr.providers = append(r.providers, urlscan.New(c))\n\t\tcase \"otx\":\n\t\t\to := otx.New(c)\n\t\t\tr.providers = append(r.providers, o)\n\t\tcase \"wayback\":\n\t\t\tr.providers = append(r.providers, wayback.New(c, filters))\n\t\tcase \"commoncrawl\":\n\t\t\tcc, err := commoncrawl.New(c, filters)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error instantiating commoncrawl: %v\\n\", err)\n\t\t\t}\n\t\t\tr.providers = append(r.providers, cc)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "96b11f6a6f23d420a95713a98547ca52", "score": "0.55724436", "text": "func init() {\n\tjob.RegisterPlugin(\"com.telemetryapp.process\", ProcessPluginFactory)\n}", "title": "" }, { "docid": "06cf8f11ced11addd747b327405899e1", "score": "0.5568771", "text": "func init() {\n\tcfg, _, err := common.LoadConfig()\n\tif err != nil {\n\t\tlog.Fatal(\"[error] config error,please check it.[\", err, \"]\")\n\t\treturn\n\t}\n\t//init miner robot\n\trobotminer = GetRobot(cfg)\n}", "title": "" }, { "docid": "5223c103f239cada2c7edf96024dcdd9", "score": "0.5566853", "text": "func (br *BoxRunner) Init() error {\n\tparams := []string{}\n\tparams = append(\n\t\tparams,\n\t\t\"--cg\",\n\t\t\"--box-id=\"+strconv.Itoa(int(br.B.ID)),\n\t\t\"--init\",\n\t)\n\tvar outBuf, outErr bytes.Buffer\n\t_, err := Exec(os.Stdin, &outBuf, &outErr, \"isolate\", params...)\n\tif err != nil {\n\t\tfmt.Println(\"!!! \", outErr.String())\n\t\treturn err\n\t}\n\n\tbr.B.Path = strings.TrimSpace(outBuf.String()) + \"/box\"\n\treturn nil\n}", "title": "" }, { "docid": "781516a54e33e4f5bb577b5bd02b7463", "score": "0.5555919", "text": "func init() {\n\tlogs.InitLogs()\n\trootCmd.Version = Version\n\trootCmd.AddCommand(bootstrap.Cmd, controller.Cmd, docsCmd, versionCmd)\n\n\t// Setup glog\n\trootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)\n\trootCmd.Flag(\"logtostderr\").DefValue = \"true\"\n\trootCmd.Flag(\"logtostderr\").Value.Set(\"true\")\n\tflag.CommandLine.Parse(nil)\n}", "title": "" }, { "docid": "145c94d6aad762243d14bd8f15ab4aa5", "score": "0.5551587", "text": "func (fsp *FSProbe) init() error {\n\t// Set a unique seed to prepare the generation of IDs\n\trand.Seed(time.Now().UnixNano())\n\t// Get boot time\n\tbt, err := host.BootTime()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfsp.bootTime = time.Unix(int64(bt), 0)\n\t// Get host netns\n\tfsp.hostPidns = utils.GetPidnsFromPid(1)\n\t// Register monitors\n\tfsp.monitors = monitor.RegisterMonitors()\n\treturn nil\n}", "title": "" }, { "docid": "c607d64b933974f4bd3ab21f54c2d49d", "score": "0.55489266", "text": "func (runner *wrkRunner) Init() error {\n\trunner.initialized = true\n\n\tpullCommand := \"docker pull williamyeh/wrk\"\n\tcmd := exec.Command(\"bash\", \"-c\", pullCommand)\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "581fbbf39e9bab5ec88a5ebfb5ced3e8", "score": "0.5546049", "text": "func init() {\n\tPreload(pluginipldgit.Plugins...)\n\tPreload(pluginiplddagjose.Plugins...)\n\tPreload(pluginbadgerds.Plugins...)\n\tPreload(pluginflatfs.Plugins...)\n\tPreload(pluginlevelds.Plugins...)\n\tPreload(pluginpeerlog.Plugins...)\n\tPreload(pluginfxtest.Plugins...)\n}", "title": "" }, { "docid": "3e64f79aa0647f07e69b958f0e354622", "score": "0.5545963", "text": "func init() {\n\tvar syncCmd SyncCommand\n\tparser.AddCommand(\"sync\", \"synchronise\", \"synchronise the vehicle store with an external data source\", &syncCmd)\n}", "title": "" }, { "docid": "5f26e7020ff6357b5c92e9cadb3fdac1", "score": "0.55394435", "text": "func (cfg *CliConfig) init(version string, build string) {\n\tcfg.setDefault()\n\tcfg.loadConfigUsingEnvVariable()\n\t//cfg.displayConfig(version, build)\n}", "title": "" }, { "docid": "a48a8484a0221cebe854880b1c892b80", "score": "0.5532655", "text": "func (B *BashPool) init() error {\n\tbConfShell := false\n\tfor _, cs := range B.ConfUserShells {\n\n\t\tcs.bashPool = B\n\t\tcs.Mutex = &sync.Mutex{}\n\t\tcs.readyCh = make(chan bool, 1)\n\t\tB.UserShells[cs.ID] = cs\n\n\t\tbConfShell = true\n\t}\n\tif !bConfShell {\n\t\treturn fmt.Errorf(\"none of usershell defined in config file\")\n\t}\n\n\tbConfCmdDef := false\n\tfor _, cc := range B.ConfCmdDefs {\n\n\t\tcc.bashPool = B\n\t\tB.CmdDefs[cc.ID] = cc\n\n\t\tbConfCmdDef = true\n\t}\n\tif !bConfCmdDef {\n\t\treturn fmt.Errorf(\"none of CmdDef defined in config file\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bce86bbe0013e2fb00e764d73894c220", "score": "0.5530592", "text": "func InitRunner(year int, dataDir string) Runner {\n\treturn Runner{year, dataDir, make([]puzzle, 0)}\n}", "title": "" }, { "docid": "0aeae62902979f4ba2d5fdc5412adb8c", "score": "0.55231106", "text": "func init() {\n\tsupportBundleCmd.Flags().StringVarP(&user, \"user\", \"u\", \"\", \"ssh username for the nodes\")\n\tsupportBundleCmd.Flags().StringVarP(&password, \"password\", \"p\", \"\", \"ssh password for the nodes (use 'single quotes' to pass password)\")\n\tsupportBundleCmd.Flags().StringVarP(&sshKey, \"ssh-key\", \"s\", \"\", \"ssh key file for connecting to the nodes\")\n\tsupportBundleCmd.Flags().StringSliceVarP(&ips, \"ip\", \"i\", []string{}, \"IP address of host to be prepared\")\n\n\trootCmd.AddCommand(supportBundleCmd)\n}", "title": "" }, { "docid": "4cc149da564e246b2091892d4d392731", "score": "0.5518639", "text": "func (s *KGSupervisor) Initization(args interface{}) error {\n\tif argsValue, ok := args.([]int); ok {\n\t\tif len(argsValue) != 2 {\n\t\t\treturn errors.New(\"Invalid Args\")\n\t\t}\n\t\t// start work\n\t\ts.onceDo.Do(s.start)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f689dd824f10986b65b5d6d61e1c205", "score": "0.5516119", "text": "func (*Executor) Init() {\n\tif os.Getenv(\"SWARM_MULTI_TENANT\") == \"false\" {\n\t\tlog.Debug(\"SWARM_MULTI_TENANT is false\")\n\t\treturn\n\t}\n\tquotaPlugin := quota.NewQuota(nil)\n\tauthorizationPlugin := authorization.NewAuthorization(quotaPlugin.Handle)\n\tnameScoping := namescoping.NewNameScoping(authorizationPlugin.Handle)\n\tmappingPlugin := dataInit.NewMapping(nameScoping.Handle)\n\tflavorsPlugin := flavors.NewPlugin(mappingPlugin.Handle)\n\tapiFilterPlugin := apifilter.NewPlugin(flavorsPlugin.Handle)\n\tauthenticationPlugin := authentication.NewAuthentication(apiFilterPlugin.Handle)\n\tkeystonePlugin := keystone.NewPlugin(authenticationPlugin.Handle)\n\tstartHandler = keystonePlugin.Handle\n}", "title": "" }, { "docid": "58d9e798519f184e5c613a273d351ca3", "score": "0.55092543", "text": "func (kcli *CLI) Init(flags ...string) (string, error) {\n\targs := []string{\"init\"}\n\targs = append(args, flags...)\n\tkcli.Runner.SetArgs(args)\n\tout, err := kcli.Runner.RunWithoutRetry()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "45e4b720dffe333e3e587d97893fa9f4", "score": "0.5508396", "text": "func init() {\n\t// Figure out path to get-images.sh. Note it won't work\n\t// in case the compiled test binary is moved elsewhere.\n\t_, ex, _, _ := runtime.Caller(0)\n\tgetImages, err := filepath.Abs(filepath.Join(filepath.Dir(ex), \"..\", \"..\", \"tests\", \"integration\", \"get-images.sh\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Call it to make sure images are downloaded, and to get the paths.\n\tout, err := exec.Command(getImages).CombinedOutput()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"getImages error %w (output: %s)\", err, out))\n\t}\n\t// Extract the value of BUSYBOX_IMAGE.\n\tfound := regexp.MustCompile(`(?m)^BUSYBOX_IMAGE=(.*)$`).FindSubmatchIndex(out)\n\tif len(found) < 4 {\n\t\tpanic(fmt.Errorf(\"unable to find BUSYBOX_IMAGE=<value> in %q\", out))\n\t}\n\tbusyboxTar = string(out[found[2]:found[3]])\n\t// Finally, check the file is present\n\tif _, err := os.Stat(busyboxTar); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "a26f88daaa166024198d434193e0963e", "score": "0.5507395", "text": "func (p *Pipeline) Init(reportChannel chan *report.OnionScanReport) {\n\tp.Reports = reportChannel\n}", "title": "" }, { "docid": "fbf39822772c9fb65531d0699a030b01", "score": "0.550483", "text": "func (blc *BucketLifeCycleCommand) Init(args []string, options OptionMapType) error {\n\treturn blc.command.Init(args, options, blc)\n}", "title": "" }, { "docid": "cf0dc6a2d824f1933d8809ebe0d2ede2", "score": "0.55022776", "text": "func (o *PipelineRunnerOptions) Run() error {\n\tuseMetaPipeline := viper.GetBool(useMetaPipelineOptionName)\n\n\tif !o.NoGitCredentialsInit && !useMetaPipeline {\n\t\terr := o.InitGitConfigAndUser()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = o.stepGitCredentials()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tjxClient, ns, err := o.getClientsAndNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmetapipelineClient, err := metapipeline.NewMetaPipelineClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontroller := controller{\n\t\tbindAddress: o.BindAddress,\n\t\tpath: o.Path,\n\t\tport: o.Port,\n\t\tuseMetaPipeline: useMetaPipeline,\n\t\tmetaPipelineImage: viper.GetString(metaPipelineImageOptionName),\n\t\tsemanticRelease: o.SemanticRelease,\n\t\tserviceAccount: o.ServiceAccount,\n\t\tjxClient: jxClient,\n\t\tns: ns,\n\t\tmetaPipelineClient: metapipelineClient,\n\t}\n\n\tcontroller.Start()\n\treturn nil\n}", "title": "" }, { "docid": "bb0ae3b32fee3fcd7131aba9143c497b", "score": "0.5494556", "text": "func (pc *PsCommand) Init() {\n\tpc.Cmd = \"pwsh\"\n\tpc.Arguments = []string{\"-File\", pc.FilePath}\n\n\tif len(pc.RunArgs) > 0 {\n\t\tfor _, ra := range pc.RunArgs {\n\t\t\tpc.Arguments = append(pc.Arguments, ra)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "89b18f598d5dd72cdb0d403c8daf64f8", "score": "0.54894257", "text": "func (g *Generic) Init(p *event.Processor) {\n\tg.muInit.Lock()\n\tdefer g.muInit.Unlock()\n\n\tif g.init {\n\t\treturn\n\t}\n\t// Do initialization things\n\t//\n\tg.processor = p\n\tg.init = true\n}", "title": "" }, { "docid": "0e25d3882d0dcd6b4e51636d3ecd8d96", "score": "0.54876405", "text": "func init() {\n\tingestion.Register(config.CONSTRUCTOR_GOLD, newGoldProcessor)\n}", "title": "" }, { "docid": "d60ccfef0c352826caf2da2dbcaf762c", "score": "0.5481935", "text": "func (t *dummyMaster) Init(taskID uint64, framework taskgraph.Framework) {\n\tt.taskID = taskID\n\tt.framework = framework\n\tt.logger = log.New(os.Stdout, \"\", log.Ldate|log.Ltime|log.Lshortfile)\n\n\tt.epochChange = make(chan *event, 1)\n\tt.getP = make(chan *event, 1)\n\tt.childDataReady = make(chan *event, 1)\n\tt.exitChan = make(chan struct{})\n\tgo t.run()\n}", "title": "" }, { "docid": "3f3d37562e27ee5c5692b8a0f9169340", "score": "0.5480919", "text": "func init() {\n\tloadTheEnv()\n\tcreateDBInstance()\n}", "title": "" }, { "docid": "e9aee25292a4b16b2ea2fd3a0b640b33", "score": "0.547869", "text": "func init() {\n\tgo webhook.ProcessRouteStatus(controller)\n}", "title": "" }, { "docid": "e9aee25292a4b16b2ea2fd3a0b640b33", "score": "0.547869", "text": "func init() {\n\tgo webhook.ProcessRouteStatus(controller)\n}", "title": "" }, { "docid": "a1983b3e42e7fb531d450ba12bc79efa", "score": "0.54578084", "text": "func init() {\n\texeName, err := osext.Executable()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"[ERROR] [config] could not get a path to binary file: %s\\n\", err.Error())\n\t\t//fallback to os.Args\n\t\texeName = os.Args[0]\n\t}\n\n\texecutable = exeName\n\texecutableDir = filepath.Dir(executable)\n\n\t//read command line before config loading\n\treadOsArgs(&cfg)\n\n\tdefaultLogF(\"[config] exe:%s\\n\", executable)\n\tdefaultLogF(\"[config] dir:%s\\n\", executableDir)\n\n\tinitConfigPath()\n\n\tdefaultLogF(\"[config] file:%s\\n\", configPath)\n\tdefaultLogF(\"[config] source:%s\\n\", configPathSource)\n\n\t//read config\n\tReadGlobalConfig(&cfg, \"default config\")\n}", "title": "" }, { "docid": "6815262665a6e985e306e0405979a9fa", "score": "0.5451502", "text": "func init() {\n\trun.Builtin.Add(&run.BuiltinRunner{\n\t\tKey: PluginName,\n\t\tStart: StartDashboard,\n\t\tHandler: Handler,\n\t})\n\t// Runs schema creation on database create instead of on first start\n\tdatabase.AddCreateHook(run.WithNilInfo(dbUpdate))\n}", "title": "" }, { "docid": "f94fdd12bd10f776e0b63eb2bf80354b", "score": "0.54485524", "text": "func init() {\n\tRootCmd.AddCommand(setCmd)\n}", "title": "" }, { "docid": "e1eb13dbd531501663947037c19379aa", "score": "0.5445107", "text": "func (i *BulkAddJob) Init(jproc *Processor) {}", "title": "" }, { "docid": "9334a3ad55143dd4e470244578ea38f3", "score": "0.5437299", "text": "func TestCliInitialized(t *testing.T) {\n\trun, _, cleanup := prepare(t)\n\tdefer cleanup()\n\n\tvar apiversion string\n\tt.Run(\"withhook\", func(t *testing.T) {\n\t\tres := icmd.RunCmd(run(\"helloworld\", \"--pre-run\", \"apiversion\"))\n\t\tres.Assert(t, icmd.Success)\n\t\tassert.Assert(t, res.Stdout() != \"\")\n\t\tapiversion = res.Stdout()\n\t\tassert.Assert(t, is.Equal(res.Stderr(), \"Plugin PersistentPreRunE called\"))\n\t})\n\tt.Run(\"withouthook\", func(t *testing.T) {\n\t\tres := icmd.RunCmd(run(\"nopersistentprerun\"))\n\t\tres.Assert(t, icmd.Success)\n\t\tassert.Assert(t, is.Equal(res.Stdout(), apiversion))\n\t})\n}", "title": "" }, { "docid": "da4d1763f55a98ede053c55c8b91b9cf", "score": "0.54372346", "text": "func (fs *effs) initRepo() {\n\tfs.run(\"fossil\", \"init\", fs.repoName)\n}", "title": "" }, { "docid": "3c4838fa8fa958d10ae08ac4db5b217f", "score": "0.5429767", "text": "func InitProcessor(tfile string, mfile string) I_Processor {\n return &Processor{\n executor: InitExecutor(),\n torg: InitTaskOrg(tfile),\n morg: InitMachineOrg(mfile),\n }\n}", "title": "" }, { "docid": "42cf2594d152aa61e1744eddddcb4407", "score": "0.5428519", "text": "func testPipeline() *library.Pipeline {\n\tp := new(library.Pipeline)\n\n\tp.SetID(1)\n\tp.SetRepoID(1)\n\tp.SetCommit(\"48afb5bdc41ad69bf22588491333f7cf71135163\")\n\tp.SetFlavor(\"large\")\n\tp.SetPlatform(\"docker\")\n\tp.SetRef(\"refs/heads/master\")\n\tp.SetRef(\"yaml\")\n\tp.SetVersion(\"1\")\n\tp.SetExternalSecrets(false)\n\tp.SetInternalSecrets(false)\n\tp.SetServices(true)\n\tp.SetStages(false)\n\tp.SetSteps(true)\n\tp.SetTemplates(false)\n\n\treturn p\n}", "title": "" }, { "docid": "c9fc3291bd135772a00e85a1fb46d68f", "score": "0.54261875", "text": "func beforeProcessWithInternalServices(cliContext *cli.Context) (err error) {\n\tif !cliContext.IsSet(\"reddit-url\") {\n\t\tcli.ShowCommandHelp(cliContext, cliContext.Command.Name)\n\t\terr = fmt.Errorf(\"A Reddit URL was not given\")\n\t}\n\n\t// TODO: Context\n\tctx := context.TODO()\n\n\t// Initialize the queue\n\tif err = services.Queue.Init(ctx); err != nil {\n\t\treturn\n\t}\n\n\t// Initialize the store\n\tif err = services.Store.Init(ctx); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9dd846458310c8eb08156f085bdcb338", "score": "0.5425513", "text": "func init() {\n\n\tcmdSend.Flags().BoolP(\"encrypt\", \"e\", false, \"Encrypt the file using the pre-defined crypto data\")\n\tcmdRoot.AddCommand(cmdSend)\n}", "title": "" }, { "docid": "60ee5c91163432af4786a9fcb545cd74", "score": "0.54118544", "text": "func (m Model) Init() tea.Cmd {\n\treturn m.tick()\n}", "title": "" }, { "docid": "509071a7198fcf4a849257b6e4697476", "score": "0.5410329", "text": "func (b backends) init(t *targetrunner, starting bool) {\n\tbackend.Init()\n\n\tais := backend.NewAIS(t)\n\tb[cmn.ProviderAIS] = ais // ais cloud is always present\n\n\tconfig := cmn.GCO.Get()\n\tif aisConf, ok := config.Backend.ProviderConf(cmn.ProviderAIS); ok {\n\t\tif err := ais.Apply(aisConf, \"init\"); err != nil {\n\t\t\tglog.Errorf(\"%s: %v - proceeding to start anyway...\", t.si, err)\n\t\t}\n\t}\n\n\tb[cmn.ProviderHTTP], _ = backend.NewHTTP(t, config)\n\tif err := b.initExt(t, starting); err != nil {\n\t\tcos.ExitLogf(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "fa2d4d923621151697155667d496c0c6", "score": "0.54026115", "text": "func (a *Applier) Initialize(cmd *cobra.Command, paths []string) error {\n\tfileNameFlags, err := common.DemandOneDirectory(paths)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.ApplyOptions.DeleteFlags.FileNameFlags = &fileNameFlags\n\terr = a.ApplyOptions.Complete(a.factory, cmd)\n\tif err != nil {\n\t\treturn errors.WrapPrefix(err, \"error setting up ApplyOptions\", 1)\n\t}\n\ta.ApplyOptions.PostProcessorFn = nil // Turn off the default kubectl pruning\n\terr = a.PruneOptions.Initialize(a.factory)\n\tif err != nil {\n\t\treturn errors.WrapPrefix(err, \"error setting up PruneOptions\", 1)\n\t}\n\n\tstatusPoller, err := a.newStatusPoller()\n\tif err != nil {\n\t\treturn errors.WrapPrefix(err, \"error creating resolver\", 1)\n\t}\n\ta.StatusPoller = statusPoller\n\treturn nil\n}", "title": "" }, { "docid": "f70c1f077e10d66c079206eb24bc7bc2", "score": "0.5402148", "text": "func init() {\n\tflag.IntVar(&ID, \"id\", ID, \"id of the server {0, ..., n-1}\")\n\tflag.IntVar(&NUM_PROCS, \"n\", NUM_PROCS, \"total number of servers\")\n\tflag.IntVar(&MASTER_PORT, \"port\", MASTER_PORT, \"number of the \"+\n\t\t\"master-facing port\")\n\tflag.Parse()\n\n\tsetArgsPositional()\n\n\tif NUM_PROCS <= 0 {\n\t\tFatal(\"invalid number of servers: \", NUM_PROCS)\n\t}\n\n\tPORT = START_PORT + ID\n\tLastTimestamp.value = make([]time.Time, NUM_PROCS)\n}", "title": "" }, { "docid": "8a2f86dd973fcf2d5ef2c34e5181ac52", "score": "0.5396203", "text": "func init() {\n\tclilib.InitConfig(configName)\n}", "title": "" }, { "docid": "9afd5b145fac7faed4a5454d6477e988", "score": "0.5395535", "text": "func (opts *InitPipelineOpts) Execute() error {\n\tsecretName := opts.createSecretName()\n\t_, err := opts.secretsmanager.CreateSecret(secretName, opts.GitHubAccessToken)\n\n\tif err != nil {\n\t\tvar existsErr *secretsmanager.ErrSecretAlreadyExists\n\t\tif !errors.As(err, &existsErr) {\n\t\t\treturn err\n\t\t}\n\t\tlog.Successf(\"Secret already exists for %s! Do nothing.\\n\", color.HighlightUserInput(opts.GitHubRepo))\n\t}\n\topts.secretName = secretName\n\n\t// write pipeline.yml file, populate with:\n\t// - github repo as source\n\t// - stage names (environments)\n\t// - enable/disable transition to prod envs\n\n\tmanifestPath, err := opts.createPipelineManifest()\n\tif err != nil {\n\t\treturn err\n\t}\n\topts.manifestPath = manifestPath\n\n\tbuildspecPath, err := opts.createBuildspec()\n\tif err != nil {\n\t\treturn err\n\t}\n\topts.buildspecPath = buildspecPath\n\n\tlog.Successf(\"Wrote the pipeline manifest for %s at '%s'\\n\", color.HighlightUserInput(opts.GitHubRepo), color.HighlightResource(relPath(opts.manifestPath)))\n\tlog.Successf(\"Wrote the buildspec for the pipeline's build stage at '%s'\\n\", color.HighlightResource(relPath(opts.buildspecPath)))\n\tlog.Infoln(\"The manifest contains configurations for your CodePipeline resources, such as your pipeline stages and build steps.\")\n\tlog.Infoln(\"The buildspec contains the commands to build and push your container images to your ECR repositories.\")\n\n\t// TODO deploy manifest file\n\n\treturn nil\n}", "title": "" }, { "docid": "e281c649de0f03c83a39f3b0fbf429f2", "score": "0.5394577", "text": "func init() {\n\trootCmd.AddCommand(versionCmd)\n}", "title": "" }, { "docid": "e281c649de0f03c83a39f3b0fbf429f2", "score": "0.5394577", "text": "func init() {\n\trootCmd.AddCommand(versionCmd)\n}", "title": "" }, { "docid": "a8ba78fc6ab73d9488a9d9572f0847ce", "score": "0.5394382", "text": "func (c *HubCommand) Init(args []string) error {\n\treturn c.fs.Parse(args)\n}", "title": "" }, { "docid": "c247b87b5465741de6b1302655ac84e3", "score": "0.53892046", "text": "func (r *RunFns) init() {\n\tif r.NoFunctionsFromInput == nil {\n\t\t// default no functions from input if any function sources are explicitly provided\n\t\tnfn := len(r.FunctionPaths) > 0 || len(r.Functions) > 0\n\t\tr.NoFunctionsFromInput = &nfn\n\t}\n\n\t// if no path is specified, default reading from stdin and writing to stdout\n\tif r.Path == \"\" {\n\t\tif r.Output == nil {\n\t\t\tr.Output = os.Stdout\n\t\t}\n\t\tif r.Input == nil {\n\t\t\tr.Input = os.Stdin\n\t\t}\n\t}\n\n\t// functionFilterProvider set the filter provider\n\tif r.functionFilterProvider == nil {\n\t\tr.functionFilterProvider = r.ffp\n\t}\n\n\t// if LogSteps is enabled and LogWriter is not specified, use stderr\n\tif r.LogSteps && r.LogWriter == nil {\n\t\tr.LogWriter = os.Stderr\n\t}\n}", "title": "" }, { "docid": "03b09b8220c4440da78e21adb2fccd45", "score": "0.5386842", "text": "func (r *RunnerGitRepo) Init(args *InitArgs) error {\n\tcmdArgs := []string{\n\t\t\"-C\",\n\t\tr.WorkingDir,\n\t\t\"init\",\n\t}\n\n\tif args.Bare {\n\t\tcmdArgs = append(cmdArgs, \"--bare\")\n\t}\n\n\treturn run(cmdArgs...)\n}", "title": "" }, { "docid": "f95be88bca940fbcf2ea1b0d45fdaee5", "score": "0.53837734", "text": "func (i *imgTestEnv) runImgTestInitCmd(cmd *cobra.Command, args []string) { notImplemented(cmd) }", "title": "" }, { "docid": "1b6090b7343179a3073c84bcadd97faf", "score": "0.5383563", "text": "func Init(\n\tcmd *cobra.Command,\n\tconfig *tmconfig.Config,\n\tcdc codec.JSONCodec,\n\tmbm module.BasicManager,\n\tchainID,\n\tminGasPrices string,\n) error {\n\tif chainID == \"\" {\n\t\tchainID = \"provenance-chain-\" + tmrand.NewRand().Str(6)\n\t}\n\t// Get bip39 mnemonic\n\tvar mnemonic string\n\trecover, _ := cmd.Flags().GetBool(FlagRecover)\n\tif recover {\n\t\tinBuf := bufio.NewReader(cmd.InOrStdin())\n\t\tmnemonic, err := input.GetString(\"Enter your bip39 mnemonic\", inBuf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !bip39.IsMnemonicValid(mnemonic) {\n\t\t\treturn errors.New(\"invalid mnemonic\")\n\t\t}\n\t}\n\n\tnodeID, _, err := genutil.InitializeNodeValidatorFilesFromMnemonic(config, mnemonic)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgenFile := config.GenesisFile()\n\tif !viper.GetBool(FlagOverwrite) && tmos.FileExists(genFile) {\n\t\treturn fmt.Errorf(\"genesis.json file already exists: %v\", genFile)\n\t}\n\tif err := initGenFile(cdc, mbm, config.Moniker, chainID, nodeID, genFile); err != nil {\n\t\treturn err\n\t}\n\ttmconfig.WriteConfigFile(filepath.Join(config.RootDir, \"config\", \"config.toml\"), config)\n\treturn nil\n}", "title": "" }, { "docid": "296a4fe955deed25d37eb2aa9fa3380e", "score": "0.5383036", "text": "func Init() {\n\tflag.UintVar(&C.Lightning.IndexConcurrency, \"lightning.index-concurrency\", 0, \"lightning.index-concurrency\")\n\tflag.UintVar(&C.Lightning.IOConcurrency, \"lightning.io-concurrency\", 0, \"lightning.io-concurrency\")\n\tflag.UintVar(&C.Lightning.TableConcurrency, \"lightning.table-concurrency\", 0, \"lightning.table-concurrency\")\n\tflag.UintVar(&C.Lightning.RegionSplitSize, \"lightning.region-split-size\", 0, \"tikv-importer.region-split-size\")\n\tflag.UintVar(&C.Lightning.SendKVPairs, \"lightning.send-kv-pairs\", 0, \"tikv-importer.send-kv-pairs\")\n\tflag.UintVar(&C.Lightning.RangeConcurrency, \"lightning.range-concurrency\", 0, \"tikv-importer.range-concurrency\")\n\n\tflag.StringVar(&C.Component, \"component\", \"\", \"specify the component to test\")\n\tflag.StringVar(&C.Hash, \"hash\", \"\", \"specify the component commit hash\")\n\tflag.StringVar(&C.Repo, \"repo\", \"\", \"specify the repository the bench uses\")\n\tflag.StringVar(&C.Workload, \"workload-name\", \"\", \"specify the workload name\")\n\tflag.StringVar(&C.WorkloadStorage, \"workload-storage\", \"\", \"(with br syntax) specify the storage for workload\")\n\tflag.BoolVar(&C.DebugComponent, \"debug-component\", false, \"component will generate debug level log if enabled\")\n\tflag.BoolVar(&C.Disturbance, \"disturbance\", false, \"enable shuffle-{leader,region,hot-region}-scheduler to simulate extreme environment\")\n\tflag.StringSliceVar(&C.ComponentArgs, \"cargs\", []string{}, \"(unsafe) pass extra argument to the component, may conflict with args provided by the framework\")\n\tflag.StringVar(&C.TemporaryStorage, \"temp-storage\", \"\", \"(with br syntax) specify the storage where the intermedia data stores\")\n\n\tflag.BoolVar(&C.SaveStdout, \"save-stdout\", true, \"save stdout and stderr of the component, allowing more detailed log when failed\")\n\tflag.BoolVar(&C.Dumpling.SkipCSV, \"dumpling.skip-csv\", false, \"skip dumpling to csv step in dumpling benching\")\n\tflag.BoolVar(&C.Dumpling.SkipSQL, \"dumpling.skip-sql\", false, \"skip dumpling to sql step in dumpling benching\")\n\tflag.BoolVar(&C.BR.SkipBackup, \"br.skip-backup\", false, \"skip the backup step of br benching\")\n\tflag.StringVar(&C.Lightning.Backend, \"lightning.backend\", \"local\", \"the backend that lightning uses for benching\")\n\tflag.Parse()\n}", "title": "" }, { "docid": "cccb02be762cbb248db1e1f7c5ded2a7", "score": "0.5379721", "text": "func init() {\n\tcommon.Logger.Name(BinaryName)\n\n\thelp.Customize(\n\t\t\"[OPTIONS] (domain|IP)[:port] ...\",\n\t\tdescription,\n\t\ttorBehaviour,\n\t\tBinaryName, &opts,\n\t)\n\n\t// read parameters passed to a binary\n\taddresses, commonOpts = help.Parse()\n\n\t// check for stuff being piped-in\n\tstat, _ := os.Stdin.Stat()\n\tif (stat.Mode() & os.ModeCharDevice) == 0 {\n\t\trawStdin, err := ioutil.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\tfmt.Printf(`\"%s\"\\n`, err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// process input, split into addresses and trim possible whitespaces & quotes\n\t\tvar stdinAddresses []string\n\t\tfor _, a := range strings.Split(string(rawStdin), \"\\n\") {\n\t\t\t// if there are extra whitespaces in the source file\n\t\t\ttrimmedAddress := strings.TrimSpace(a)\n\n\t\t\t// if addresses are piped from `jq` w/o `-r` provided\n\t\t\ttrimmedAddress = strings.Trim(trimmedAddress, \"\\\"\")\n\n\t\t\tstdinAddresses = append(stdinAddresses, trimmedAddress)\n\t\t}\n\n\t\t// pipe data first, and then command ones seems more natural\n\t\taddresses = append(stdinAddresses, addresses...)\n\t}\n\n\tif len(addresses) < 1 {\n\t\tfmt.Println(`\"At least one IP address or hostname needs to be provided\"`)\n\t\tos.Exit(1)\n\t}\n}", "title": "" } ]
73070c3f1837bd7fcfa0e1b2fb60caf0
AddToManager adds a new Controller to mgr with r as the reconcile.Reconciler
[ { "docid": "b23f5b0d4b586deaafb72831cd8db5a9", "score": "0.771133", "text": "func AddToManager(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clusterdeployment-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ClusterDeployment\n\terr = c.Watch(&source.Kind{Type: &hivev1.ClusterDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for jobs created by a ClusterDeployment:\n\terr = c.Watch(&source.Kind{Type: &kbatch.Job{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hivev1.ClusterDeployment{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f07a6b8eb507497b992b2704f5600bf3", "score": "0.8222546", "text": "func (r *Reconciler) AddToManager(ctx context.Context, mgr manager.Manager, gardenCluster cluster.Cluster) error {\n\tif r.GardenClient == nil {\n\t\tr.GardenClient = gardenCluster.GetClient()\n\t}\n\tif r.GardenConfig == nil {\n\t\tr.GardenConfig = gardenCluster.GetConfig()\n\t}\n\tif r.Clock == nil {\n\t\tr.Clock = clock.RealClock{}\n\t}\n\n\treturn builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: pointer.IntDeref(r.Config.Controllers.ControllerInstallation.ConcurrentSyncs, 0),\n\t\t}).\n\t\tWatches(\n\t\t\tsource.NewKindWithCache(&gardencorev1beta1.ControllerInstallation{}, gardenCluster.GetCache()),\n\t\t\t&handler.EnqueueRequestForObject{},\n\t\t\tbuilder.WithPredicates(\n\t\t\t\tr.ControllerInstallationPredicate(),\n\t\t\t\tr.HelmTypePredicate(ctx, gardenCluster.GetClient()),\n\t\t\t),\n\t\t).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "8acf7f0238b2773ed8460371876ba9d7", "score": "0.8085568", "text": "func AddToManager(ctx *context.ControllerManagerContext, mgr manager.Manager) error {\n\tvar (\n\t\tcontrolledType = &vmopv1alpha1.VirtualMachineClass{}\n\t\tcontrolledTypeName = reflect.TypeOf(controlledType).Elem().Name()\n\n\t\tcontrollerNameShort = fmt.Sprintf(\"%s-controller\", strings.ToLower(controlledTypeName))\n\t\tcontrollerNameLong = fmt.Sprintf(\"%s/%s/%s\", ctx.Namespace, ctx.Name, controllerNameShort)\n\t)\n\n\tr := NewReconciler(\n\t\tmgr.GetClient(),\n\t\tctrl.Log.WithName(\"controllers\").WithName(controlledTypeName),\n\t\trecord.New(mgr.GetEventRecorderFor(controllerNameLong)),\n\t)\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(controlledType).\n\t\tWithOptions(controller.Options{MaxConcurrentReconciles: 1}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "c17fd4c5e0162aa96c78e1f0bae0f232", "score": "0.7944685", "text": "func (r *Reconciler) AddToManager(mgr manager.Manager, targetCluster cluster.Cluster) error {\n\tif r.TargetReader == nil {\n\t\tr.TargetReader = targetCluster.GetAPIReader()\n\t}\n\tif r.TargetWriter == nil {\n\t\tr.TargetWriter = targetCluster.GetClient()\n\t}\n\tif r.MinimumObjectLifetime == nil {\n\t\tr.MinimumObjectLifetime = pointer.Duration(10 * time.Minute)\n\t}\n\n\treturn builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: 1,\n\t\t}).\n\t\tWatches(controllerutils.EnqueueOnce, nil).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "3e6bedf8b6986653dda1e34bd50d89d4", "score": "0.7828821", "text": "func AddToManager(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clusterdeployment-federation-controller\", mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: controllerutils.GetConcurrentReconciles()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ClusterDeployment\n\terr = c.Watch(&source.Kind{Type: &hivev1.ClusterDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f46de6b681fd338f9c60ac1ecb8ff4fe", "score": "0.7806958", "text": "func AddToManager(ctx *context.ControllerManagerContext, mgr manager.Manager) error {\n\tvar (\n\t\tcontrolledType = &vmopv1alpha1.VirtualMachineSetResourcePolicy{}\n\t\tcontrolledTypeName = reflect.TypeOf(controlledType).Elem().Name()\n\t)\n\n\tr := NewReconciler(\n\t\tmgr.GetClient(),\n\t\tctrl.Log.WithName(\"controllers\").WithName(controlledTypeName),\n\t\tctx.VMProvider,\n\t)\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(controlledType).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "a7dbc4bad760869e56589553aa190148", "score": "0.7771985", "text": "func AddToManager(m manager.Manager, kubeClient *kubernetes.Clientset) error {\n\n\tproviderController, err := provider.NewProviderController(m, kubeClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfarmController, err := farm.NewFarmController(m, providerController, kubeClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceController, err := service.NewServiceController(m, kubeClient, farmController)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = node.NewNodeController(m, kubeClient, serviceController)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = endpoint.NewEndPointController(m, kubeClient, serviceController)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ea3252f70d0bad708afefe7591f03e9d", "score": "0.7765498", "text": "func AddToManager(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"syncset-controller\", mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: controllerutils.GetConcurrentReconciles()})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ClusterDeployment\n\terr = c.Watch(&source.Kind{Type: &hivev1.ClusterDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for SyncSet\n\terr = c.Watch(&source.Kind{Type: &hivev1.SyncSet{}}, &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: handler.ToRequestsFunc(syncSetHandlerFunc),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for SelectorSyncSet\n\treconciler := r.(*ReconcileSyncSet)\n\terr = c.Watch(&source.Kind{Type: &hivev1.SelectorSyncSet{}}, &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: handler.ToRequestsFunc(reconciler.selectorSyncSetHandlerFunc),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b70f050668765443e7951bb3467439e4", "score": "0.7704053", "text": "func (ctrl *providerIDController) AddToManager(mgr manager.Manager) error {\n\tc, err := controller.New(ctrl.Name, mgr, controller.Options{Reconciler: ctrl})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error setting up watch on node changes\")\n\t}\n\n\t//Watch node changes\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f4d7d6c5cc4d1955f63da1c6697f459", "score": "0.76611763", "text": "func AddToManager(ctx *context.ControllerManagerContext, mgr manager.Manager) error {\n\tvar (\n\t\tcontrolledType = &vmopv1alpha1.VirtualMachine{}\n\t\tcontrolledTypeName = reflect.TypeOf(controlledType).Elem().Name()\n\n\t\tcontrollerNameShort = fmt.Sprintf(\"%s-controller\", strings.ToLower(controlledTypeName))\n\t\tcontrollerNameLong = fmt.Sprintf(\"%s/%s/%s\", ctx.Namespace, ctx.Name, controllerNameShort)\n\t)\n\n\tproberManager, err := prober.AddToManager(mgr, ctx.VMProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr := NewReconciler(\n\t\tmgr.GetClient(),\n\t\tctx.MaxConcurrentReconciles,\n\t\tctrl.Log.WithName(\"controllers\").WithName(controlledTypeName),\n\t\trecord.New(mgr.GetEventRecorderFor(controllerNameLong)),\n\t\tctx.VMProvider,\n\t\tproberManager,\n\t)\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(controlledType).\n\t\tWithOptions(controller.Options{MaxConcurrentReconciles: ctx.MaxConcurrentReconciles}).\n\t\tWatches(&source.Kind{Type: &vmopv1alpha1.VirtualMachineClassBinding{}},\n\t\t\thandler.EnqueueRequestsFromMapFunc(classBindingToVMMapperFn(ctx, r.Client))).\n\t\tWatches(&source.Kind{Type: &vmopv1alpha1.ContentSourceBinding{}},\n\t\t\thandler.EnqueueRequestsFromMapFunc(csBindingToVMMapperFn(ctx, r.Client))).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "b5f418c43b8448b8cc751563ef744781", "score": "0.7649535", "text": "func (r *Reconciler) AddToManager(mgr manager.Manager, gardenCluster cluster.Cluster) error {\n\tif r.GardenClient == nil {\n\t\tr.GardenClient = gardenCluster.GetClient()\n\t}\n\tif r.Recorder == nil {\n\t\tr.Recorder = gardenCluster.GetEventRecorderFor(ControllerName + \"-controller\")\n\t}\n\tif r.Clock == nil {\n\t\tr.Clock = clock.RealClock{}\n\t}\n\n\t// It's not possible to call builder.Build() without adding atleast one watch, and without this, we can't get the controller logger.\n\t// Hence, we have to build up the controller manually.\n\tc, err := controller.New(\n\t\tControllerName,\n\t\tmgr,\n\t\tcontroller.Options{\n\t\t\tReconciler: r,\n\t\t\tMaxConcurrentReconciles: pointer.IntDeref(r.Config.Controllers.Shoot.ConcurrentSyncs, 0),\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(\n\t\tsource.NewKindWithCache(&gardencorev1beta1.Shoot{}, gardenCluster.GetCache()),\n\t\tr.EventHandler(c.GetLogger()),\n\t\tpredicateutils.SeedNamePredicate(r.Config.SeedConfig.Name, gardenerutils.GetShootSeedNames),\n\t\t&predicate.GenerationChangedPredicate{},\n\t)\n}", "title": "" }, { "docid": "adbe788139ac2d4109156240cd81357f", "score": "0.73631454", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"podmanager-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to PodManager\n\terr = c.Watch(&source.Kind{Type: &extensionsv1alpha1.PodManager{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9984e2e741b7d4b8130939e804e9d2b", "score": "0.73493177", "text": "func (r *Reconciler) AddToManager(ctx context.Context, mgr manager.Manager, targetCluster cluster.Cluster) error {\n\tif r.TargetReader == nil {\n\t\tr.TargetReader = targetCluster.GetAPIReader()\n\t}\n\tif r.TargetClient == nil {\n\t\tr.TargetClient = targetCluster.GetClient()\n\t}\n\n\tsecret := &metav1.PartialObjectMetadata{}\n\tsecret.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind(\"Secret\"))\n\n\tc, err := builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: 1,\n\t\t\tRateLimiter: r.RateLimiter,\n\t\t}).\n\t\tWatches(\n\t\t\tsource.NewKindWithCache(secret, targetCluster.GetCache()),\n\t\t\t&handler.EnqueueRequestForObject{},\n\t\t\tbuilder.WithPredicates(r.SecretPredicate()),\n\t\t).\n\t\tBuild(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(\n\t\tsource.NewKindWithCache(&corev1.ServiceAccount{}, targetCluster.GetCache()),\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapServiceAccountToSecrets), mapper.UpdateWithOldAndNew, c.GetLogger()),\n\t\tr.ServiceAccountPredicate(),\n\t)\n}", "title": "" }, { "docid": "c28e87a436625f8532fd264701eacb9c", "score": "0.7308443", "text": "func (r *Reconciler) AddToManager(ctx context.Context, mgr manager.Manager) error {\n\tif r.Client == nil {\n\t\tr.Client = mgr.GetClient()\n\t}\n\tif r.APIReader == nil {\n\t\tr.APIReader = mgr.GetAPIReader()\n\t}\n\n\tc, err := builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tFor(&gardencorev1beta1.Seed{}, builder.WithPredicates(r.SeedPredicate())).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: pointer.IntDeref(r.Config.ConcurrentSyncs, 0),\n\t\t}).\n\t\tBuild(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.ControllerRegistration{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapToAllSeeds), mapper.UpdateWithNew, c.GetLogger()),\n\t\tpredicateutils.ForEventTypes(predicateutils.Create, predicateutils.Update),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.BackupBucket{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapBackupBucketToSeed), mapper.UpdateWithNew, c.GetLogger()),\n\t\tr.BackupBucketPredicate(),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.BackupEntry{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapBackupEntryToSeed), mapper.UpdateWithNew, c.GetLogger()),\n\t\tr.BackupEntryPredicate(),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.ControllerInstallation{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapControllerInstallationToSeed), mapper.UpdateWithNew, c.GetLogger()),\n\t\tr.ControllerInstallationPredicate(),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.ControllerDeployment{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapControllerDeploymentToAllSeeds), mapper.UpdateWithNew, c.GetLogger()),\n\t\tpredicateutils.ForEventTypes(predicateutils.Create, predicateutils.Update),\n\t); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(\n\t\t&source.Kind{Type: &gardencorev1beta1.Shoot{}},\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapShootToSeed), mapper.UpdateWithNew, c.GetLogger()),\n\t\tr.ShootPredicate(),\n\t)\n}", "title": "" }, { "docid": "ef74f97ea95e91690cddea91e1ab3e94", "score": "0.73040605", "text": "func (r *Reconciler) AddToManager(mgr manager.Manager) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// ClusterAutoscaler is effectively a singleton resource. A\n\t// deployment is only created if an instance is found matching the\n\t// name set at runtime.\n\tp := predicate.Funcs{\n\t\tCreateFunc: func(e event.CreateEvent) bool {\n\t\t\treturn r.NamePredicate(e.Object)\n\t\t},\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\treturn r.NamePredicate(e.ObjectNew)\n\t\t},\n\t\tDeleteFunc: func(e event.DeleteEvent) bool {\n\t\t\treturn r.NamePredicate(e.Object)\n\t\t},\n\t\tGenericFunc: func(e event.GenericEvent) bool {\n\t\t\treturn r.NamePredicate(e.Object)\n\t\t},\n\t}\n\n\t// Watch for changes to primary resource ClusterAutoscaler\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &autoscalingv1.ClusterAutoscaler{}), &handler.EnqueueRequestForObject{}, p); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resources owned by a ClusterAutoscaler\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &appsv1.Deployment{}), handler.EnqueueRequestForOwner(\n\t\tmgr.GetScheme(),\n\t\tmgr.GetRESTMapper(),\n\t\t&autoscalingv1.ClusterAutoscaler{},\n\t\thandler.OnlyControllerOwner(),\n\t)); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to monitoring resources owned by a ClusterAutoscaler\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &corev1.Service{}), handler.EnqueueRequestForOwner(\n\t\tmgr.GetScheme(),\n\t\tmgr.GetRESTMapper(),\n\t\t&autoscalingv1.ClusterAutoscaler{},\n\t\thandler.OnlyControllerOwner(),\n\t)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.Watch(source.Kind(mgr.GetCache(), &monitoringv1.ServiceMonitor{}), handler.EnqueueRequestForOwner(\n\t\tmgr.GetScheme(),\n\t\tmgr.GetRESTMapper(),\n\t\t&autoscalingv1.ClusterAutoscaler{},\n\t\thandler.OnlyControllerOwner(),\n\t)); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(source.Kind(mgr.GetCache(), &monitoringv1.PrometheusRule{}), handler.EnqueueRequestForOwner(\n\t\tmgr.GetScheme(),\n\t\tmgr.GetRESTMapper(),\n\t\t&autoscalingv1.ClusterAutoscaler{},\n\t\thandler.OnlyControllerOwner(),\n\t))\n}", "title": "" }, { "docid": "c8dab2497e1b64f6b4b68e2b098c7adc", "score": "0.72814244", "text": "func (r *Reconciler) AddToManager(mgr manager.Manager, sourceCluster, targetCluster cluster.Cluster) error {\n\tif r.SourceClient == nil {\n\t\tr.SourceClient = sourceCluster.GetClient()\n\t}\n\tif r.TargetClient == nil {\n\t\tr.TargetClient = targetCluster.GetClient()\n\t}\n\n\treturn builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: pointer.IntDeref(r.Config.ConcurrentSyncs, 0),\n\t\t}).\n\t\tWatches(\n\t\t\tsource.NewKindWithCache(&certificatesv1.CertificateSigningRequest{}, targetCluster.GetCache()),\n\t\t\t&handler.EnqueueRequestForObject{},\n\t\t\tbuilder.WithPredicates(\n\t\t\t\tpredicateutils.ForEventTypes(predicateutils.Create, predicateutils.Update),\n\t\t\t\tpredicate.NewPredicateFuncs(func(obj client.Object) bool {\n\t\t\t\t\tcsr, ok := obj.(*certificatesv1.CertificateSigningRequest)\n\t\t\t\t\treturn ok && csr.Spec.SignerName == certificatesv1.KubeletServingSignerName\n\t\t\t\t}),\n\t\t\t),\n\t\t).Complete(r)\n}", "title": "" }, { "docid": "026a3e4a4fb73166bb1867ae6466f723", "score": "0.7204946", "text": "func Add(mgr manager.Manager) error {\n return add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "2ad873121f409e1156ec44ab4ed9fbc0", "score": "0.7200984", "text": "func Add(mgr manager.Manager) error {\n\tr, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn r.add(mgr)\n}", "title": "" }, { "docid": "d2e83116541aa5b5affcc27e850aef3c", "score": "0.71676105", "text": "func Add(mgr manager.Manager) error {\n\tr, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn add(mgr, r)\n}", "title": "" }, { "docid": "68ea8b435b497a88bba94ceaa47ea6e9", "score": "0.71631724", "text": "func Add(mgr manager.Manager) error {\n\tr, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, r)\n}", "title": "" }, { "docid": "9bb4ab49a8f1150554eea5c956bb1107", "score": "0.71352565", "text": "func Add(mgr manager.Manager) error {\n\tlogger := log.WithField(\"controller\", ControllerName)\n\tconcurrentReconciles, clientRateLimiter, queueRateLimiter, err := controllerutils.GetControllerConfig(mgr.GetClient(), ControllerName)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"could not get controller configurations\")\n\t\treturn err\n\t}\n\treturn AddToManager(mgr, NewReconciler(mgr, clientRateLimiter), concurrentReconciles, queueRateLimiter)\n}", "title": "" }, { "docid": "2332cb6e6cb7f2df1035663bf02f3559", "score": "0.71068037", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"apimanager-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource APIManager\n\terr = c.Watch(&source.Kind{Type: &appsv1alpha1.APIManager{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to DeploymentConfigs to update deployment status\n\townerHandler := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appsv1alpha1.APIManager{},\n\t}\n\terr = c.Watch(&source.Kind{Type: &appsv1.DeploymentConfig{}}, ownerHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &v1beta1.PodDisruptionBudget{}}, ownerHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "42a5b487ec5e7b5d97e5e8022979c92c", "score": "0.71014196", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nodemanagerset-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NodeManagerSet\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.NodeManagerSet{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NodeManagerSet\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appv1alpha1.NodeManagerSet{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a340da9f0612b13bbb50ede92e8bffc", "score": "0.70884687", "text": "func Add(mgr manager.Manager) error {\n\trc := newReconciler(mgr)\n\treturn add(mgr, rc)\n}", "title": "" }, { "docid": "619bd2651efb0274346d3e8bf1c4b001", "score": "0.70718247", "text": "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tkube: mgr.GetClient(),\n\t\tkubeclient: kubernetes.NewForConfigOrDie(mgr.GetConfig()),\n\t\tfactory: &handlerFactory{},\n\t\texecutorInfoDiscovery: &executorInfoDiscoverer{kube: mgr.GetClient()},\n\t}\n\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ExtensionRequest\n\treturn c.Watch(&source.Kind{Type: &v1alpha1.ExtensionRequest{}}, &controllerHandler.EnqueueRequestForObject{})\n}", "title": "" }, { "docid": "388925b458469e9a48e6ac35da8c7460", "score": "0.7063389", "text": "func Add(mgr manager.Manager, args *controllerutil.Args) error {\n\treturn add(mgr, newReconciler(mgr, args))\n}", "title": "" }, { "docid": "78f6618a41c0f559ea7a2adbbc0d26d1", "score": "0.69939834", "text": "func Add(mgr manager.Manager) error {\n\treconciler, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, reconciler)\n}", "title": "" }, { "docid": "78f6618a41c0f559ea7a2adbbc0d26d1", "score": "0.69939834", "text": "func Add(mgr manager.Manager) error {\n\treconciler, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, reconciler)\n}", "title": "" }, { "docid": "78f6618a41c0f559ea7a2adbbc0d26d1", "score": "0.69939834", "text": "func Add(mgr manager.Manager) error {\n\treconciler, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, reconciler)\n}", "title": "" }, { "docid": "81df6bad665289ae8ac5b57086ffc04c", "score": "0.6979771", "text": "func AddToMgr(log logr.Logger, mgr manager.Manager) error {\n\tc := &secretController{\n\t\tlog: log,\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tErrorReporter: errors.NewErrorReporter(mgr.GetEventRecorderFor(\"SecretReplicationSecretController\")),\n\t}\n\treturn ctrl.NewControllerManagedBy(mgr).For(&corev1.Secret{}).Complete(c)\n}", "title": "" }, { "docid": "1d0b5b7fa1ee0a22344f21f8ff1d17ea", "score": "0.6885398", "text": "func Add(mgr manager.Manager, cm *remoteclusters.Manager) error {\n\treturn add(mgr, newReconciler(mgr, cm))\n}", "title": "" }, { "docid": "679fabb6d035b38ef525893a36d06b57", "score": "0.6855566", "text": "func AddToManager(m manager.Manager, client *opa.Client, wm *watch.Manager, cs *watch.ControllerSwitch) error {\n\t// Reset cache on start - this is to allow for the future possibility that the OPA cache is stored remotely\n\tif err := client.Reset(context.Background()); err != nil {\n\t\treturn err\n\t}\n\tfor _, a := range Injectors {\n\t\ta.InjectOpa(client)\n\t\ta.InjectWatchManager(wm)\n\t\ta.InjectControllerSwitch(cs)\n\t\tif err := a.Add(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, f := range AddToManagerFuncs {\n\t\tif err := f(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca89e02659b89870734d89b547a2a0fe", "score": "0.6836845", "text": "func (r *Reconciler) AddToManager(\n\tctx context.Context,\n\tmgr manager.Manager,\n\tgardenCluster cluster.Cluster,\n\tseedCluster cluster.Cluster,\n) error {\n\tif r.GardenClient == nil {\n\t\tr.GardenClient = gardenCluster.GetClient()\n\t}\n\tif r.Clock == nil {\n\t\tr.Clock = clock.RealClock{}\n\t}\n\tif r.GardenNamespaceGarden == \"\" {\n\t\tr.GardenNamespaceGarden = v1beta1constants.GardenNamespace\n\t}\n\tif r.GardenNamespaceShoot == \"\" {\n\t\tr.GardenNamespaceShoot = v1beta1constants.GardenNamespace\n\t}\n\tif r.ChartsPath == \"\" {\n\t\tr.ChartsPath = charts.Path\n\t}\n\n\tif r.Actuator == nil {\n\t\tr.Actuator = newActuator(\n\t\t\tgardenCluster.GetConfig(),\n\t\t\tgardenCluster.GetAPIReader(),\n\t\t\tgardenCluster.GetClient(),\n\t\t\tseedCluster.GetClient(),\n\t\t\tr.ShootClientMap,\n\t\t\tr.Clock,\n\t\t\tNewValuesHelper(&r.Config, r.ImageVector),\n\t\t\tgardenCluster.GetEventRecorderFor(ControllerName+\"-controller\"),\n\t\t\tr.ChartsPath,\n\t\t\tr.GardenNamespaceShoot,\n\t\t)\n\t}\n\n\tc, err := builder.\n\t\tControllerManagedBy(mgr).\n\t\tNamed(ControllerName).\n\t\tWithOptions(controller.Options{\n\t\t\tMaxConcurrentReconciles: pointer.IntDeref(r.Config.Controllers.ManagedSeed.ConcurrentSyncs, 0),\n\t\t}).\n\t\tWatches(\n\t\t\tsource.NewKindWithCache(&seedmanagementv1alpha1.ManagedSeed{}, gardenCluster.GetCache()),\n\t\t\tr.EnqueueWithJitterDelay(),\n\t\t\tbuilder.WithPredicates(\n\t\t\t\tr.ManagedSeedPredicate(ctx, r.Config.SeedConfig.SeedTemplate.Name),\n\t\t\t\t&predicate.GenerationChangedPredicate{},\n\t\t\t),\n\t\t).\n\t\tBuild(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(\n\t\tsource.NewKindWithCache(&gardencorev1beta1.Seed{}, gardenCluster.GetCache()),\n\t\tmapper.EnqueueRequestsFrom(ctx, mgr.GetCache(), mapper.MapFunc(r.MapSeedToManagedSeed), mapper.UpdateWithNew, c.GetLogger()),\n\t\tr.SeedOfManagedSeedPredicate(ctx, r.Config.SeedConfig.SeedTemplate.Name),\n\t)\n}", "title": "" }, { "docid": "95f8e783da5a14c5ec78090c656bfcca", "score": "0.6835326", "text": "func Add(mgr manager.Manager) error {\n\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "9069c77345cd4946947b90cc5f7b3e73", "score": "0.68326885", "text": "func Add(mgr manager.Manager, name string) error {\n\treturn add(mgr, newReconciler(mgr.GetClient(), mgr.GetScheme(), name))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" }, { "docid": "7f2668b21615828475e683011292812f", "score": "0.68308216", "text": "func Add(mgr manager.Manager) error {\n\treturn add(mgr, newReconciler(mgr))\n}", "title": "" } ]
12e34fd4c671d9551c532de7d7decef8
Update mocks base method
[ { "docid": "6e6888a5bf32806154f2886a32c8d9d1", "score": "0.74928665", "text": "func (m *MockUseCase) Update(arg0 uint64, arg1 string) (*entity_email.Email, error) {\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(*entity_email.Email)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "ae5d2615c1bf27d6dd01e736578068f4", "score": "0.8095274", "text": "func (m *Mockupdatable) Update(arg0 interface{}) {\n\tm.ctrl.Call(m, \"Update\", arg0)\n}", "title": "" }, { "docid": "2a0e43bfd366839fee6574a7e8276a9d", "score": "0.79881406", "text": "func (m *MockRes) Update(arg0 string, arg1 []byte) error {\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "236e64e774c650e39bc4a60e47f5c4cd", "score": "0.789032", "text": "func (m *MockSyncablesStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "12f47131413c25d36fb053098d4ce3b1", "score": "0.7882943", "text": "func (m *MockManager) Update(arg0 context.Context, arg1 Policy) error {\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3147f2d0662c4c52baae479bed6ba6f3", "score": "0.78813756", "text": "func (m *MockInterface) Update(arg0 ...interface{}) jorm.Interface {\n\tvarargs := []interface{}{}\n\tfor _, a := range arg0 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(jorm.Interface)\n\treturn ret0\n}", "title": "" }, { "docid": "9f4119dcf21292d2a3ad9e73993a09a6", "score": "0.77920663", "text": "func (m *MockSystemEventsStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "504d7ddef876bc0e5be4f4deccf2212e", "score": "0.77323574", "text": "func (m *MockStorage) Update(arg0 string, arg1 []byte) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e2910dba8c1eb464bd583c486bf9f46c", "score": "0.77074605", "text": "func (m *MockSystemService) Update(id string, system types.System) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", id, system)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "980552003df065f919956ae9fbd84b67", "score": "0.7696758", "text": "func (m *MockStakingSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ffa40e446dffd4198436eaf9e7a2abc3", "score": "0.7691343", "text": "func (m *MockDelegationSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c8cd037ed6619f2fd14fa2bd7e670558", "score": "0.76668894", "text": "func (m *MockReportsStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b8bee79008d36fbb4cf0337ca5bfd701", "score": "0.76637655", "text": "func (m *MockValidatorSummaryStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5b353ccaf4643ffe47e78def08112d1d", "score": "0.76554155", "text": "func (m *MockReposInterface) Update(executeQuery string, params []interface{}) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", executeQuery, params)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0901c5b2c7fa52830f09706496d772ae", "score": "0.76534134", "text": "func (m *MockTaskRepositoryInterface) Update(ctx context.Context, req object.TaskUpdateObjRequest) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, req)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6265d2a34927c9d63969ec3f83533ed9", "score": "0.7649595", "text": "func (m *MockValidatorSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "068b631d9f1eafc9f5349f579346cb4e", "score": "0.7620075", "text": "func (m *MockDebondingDelegationSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "256f0f55276e813068eba86a23f47453", "score": "0.7610234", "text": "func (m *MockBlockSummaryStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e3a74746b6beba7edfaf188c1367d13b", "score": "0.7607457", "text": "func (m *MockSaaSSystemManager) Update(id string, system sdao.SaaSSystem) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", id, system)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "21efc3a6c11d877d850f455ad810a460", "score": "0.7586746", "text": "func (m *MockBlockSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ae7add98b2112152e783f6d4cba65d96", "score": "0.75831527", "text": "func (m *MockServerInterface) Update(arg0 *v1.Server) (*v1.Server, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(*v1.Server)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "afec8a376f138858a77482cf3a8ec412", "score": "0.7575255", "text": "func (m *MockNamespaceableResourceInterface) Update(arg0 context.Context, arg1 *unstructured.Unstructured, arg2 v1.UpdateOptions, arg3 ...string) (*unstructured.Unstructured, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1, arg2}\n\tfor _, a := range arg3 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(*unstructured.Unstructured)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "09260fb5ac003b4e94f8bdcaf86a08bf", "score": "0.7567271", "text": "func (m *MockTransactionSeqStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6280bcb1494bd565c62098f4005617e5", "score": "0.7558519", "text": "func (m *MockFarmInterface) Update(arg0 *v1.Farm) (*v1.Farm, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(*v1.Farm)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b2501ea7183fd9415dcb679e582a1595", "score": "0.75388086", "text": "func (m *MockOAuthIdentityProvider) Update(i *identity.OAuth) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", i)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "203818d73fefa3ab76be03d9be050a1e", "score": "0.7537049", "text": "func (m *MockValidatorAggStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b92df1d7c636e54b1f9661172dc747b0", "score": "0.75055224", "text": "func (m *MockIProductLocationRepository) Update(arg0 context.Context, arg1 *domain.ProductLocation) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c9fe9d122212cc1d966d81cb1558f752", "score": "0.75054556", "text": "func (m *MockAccountAggStore) Update(arg0 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "61bc936427d9325995c58705b6f3d71e", "score": "0.74885744", "text": "func (m *Mockclient) Update(ctx context.Context, u entity.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, u)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7030a974fb91a1f3b1c12d1aefbb8d47", "score": "0.74745446", "text": "func (m *MockOAuthIdentityProvider) Update(i *oauth.Identity) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", i)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6e8cb113d3c0d0a83c07da955fbcb4ae", "score": "0.7468152", "text": "func (m *MockPgRepository) Update(ctx context.Context, userID int64, u *domain.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, userID, u)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e3ade580c1331b628a6c478ab9177ad3", "score": "0.74407226", "text": "func (m *MockTaskCallback) Update(pt Task) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", pt)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5fecbd4239eb3069980ca55ac90e0f70", "score": "0.74394643", "text": "func (m *MockInterface) Updates(arg0 interface{}, arg1 ...bool) jorm.Interface {\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Updates\", varargs...)\n\tret0, _ := ret[0].(jorm.Interface)\n\treturn ret0\n}", "title": "" }, { "docid": "e4e9cef0f820012169115300b11f52a8", "score": "0.74296826", "text": "func (m *MockOauthApplicationRepository) Update(ktx kontext.Context, ID int, data entity.OauthApplicationUpdateable, tx db.TX) exception.Exception {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ktx, ID, data, tx)\n\tret0, _ := ret[0].(exception.Exception)\n\treturn ret0\n}", "title": "" }, { "docid": "0347ca6687003f1b2184e291a3e5ba59", "score": "0.7411964", "text": "func (m *MockRepository) Update(ctx context.Context, ar *entity.Article) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, ar)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ffde98b367c7abee6168ddc52cef8ee0", "score": "0.7389066", "text": "func (m *MockOptionsManager) Update(value Options) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", value)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "10a8d7d7df5c71a0103e607059745245", "score": "0.73851526", "text": "func (m *MockAgentInterface) Update(arg0 *v1.Agent) (*v1.Agent, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(*v1.Agent)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "be927cc866c2b8cd3faa293a412dc46c", "score": "0.738315", "text": "func (m *MockUserRepository) Update(arg0 domain.User) (domain.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(domain.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fe7043c059140c5ad6e6cd6bc1870fc9", "score": "0.73823166", "text": "func (m *MockConfigFileStoreInterface) Update(arg0 *model.ConfigFile) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f5b547eba8dd6b202b4dbb25211215cf", "score": "0.7377409", "text": "func (m *MockActorRepository) Update(actor *models.Actor) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", actor)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ec17b0db526f23691d3ac8c1025c4846", "score": "0.73710346", "text": "func (m *MockResources) Update(obj client.Object, opts ...func(*ResourcesConfig)) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{obj}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "fb5689b1c7d7578cf8f8a840a49ca28b", "score": "0.7366995", "text": "func (m *FakeVirtualServiceInterface) Update(arg0 *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(*v1alpha3.VirtualService)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3f50d5d009312fb4f3fb026830790af2", "score": "0.7365932", "text": "func (m *MockUsersRepo) Update(arg0 *types.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "bfa40ebf55c83821bbad04c48fc60e11", "score": "0.7365098", "text": "func (m *MockCollectionManager) Update(selector, update interface{}) error {\n\tret := m.ctrl.Call(m, \"Update\", selector, update)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "52d564a61c2a44b06efc41733759e380", "score": "0.73582983", "text": "func (_m *MockOptionsManager) Update(value Options) error {\n\tret := _m.ctrl.Call(_m, \"Update\", value)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e1522605f6cf82faf6ea647aa80d697e", "score": "0.73554796", "text": "func (m *MockUsersRepository) Update(arg0 context.Context, arg1 *model.User) (*model.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(*model.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "72c2efa0c0083d74cf7671e3994eb336", "score": "0.73477125", "text": "func (m *MockTaskRepository) Update(ctx context.Context, subject *todolist.Task) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, subject)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "569f2e006aee1f97e0a2c539a4c1f321", "score": "0.7342356", "text": "func (m *MockUserRepository) Update(arg0 context.Context, arg1 *entity.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "129ac904a41cc792268e409a76bdcd3b", "score": "0.7341212", "text": "func (m *MockItemDetailRepository) Update(ctx context.Context, f *firestore.Client, i domain.ItemDetailRecord, key domain.ItemDetailKey) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, f, i, key)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "013fe00faca0f1f8647728f3484fe691", "score": "0.73377115", "text": "func (m *MockLevel1PrefetchListKeeper) Update(arg0 drkey.Level1PrefetchInfo) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Update\", arg0)\n}", "title": "" }, { "docid": "a8c0050c531597eb3fe83a09c432ff5e", "score": "0.73243815", "text": "func (m *MockRepoUser) Update(usrUpd models.User) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", usrUpd)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "1c147f3b0e0cccfeb93513dfff1b650d", "score": "0.7322821", "text": "func (m *MockClient) Update(ctx context.Context, obj *unstructured.Unstructured, options v1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, obj, options}\n\tfor _, a := range subresources {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Update\", varargs...)\n\tret0, _ := ret[0].(*unstructured.Unstructured)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "bfe715c4b00bdaa2be986022639a435f", "score": "0.7315792", "text": "func (m *MockVersionRepo) Update(version *entity.Version) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", version)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f80e102dc57a61d0dfd969cc176c4267", "score": "0.72949415", "text": "func (m *MockUserService) Update(arg0 string, arg1 entity.User) (entity.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(entity.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1050bf5a38802e228bce95ab1d5589e5", "score": "0.7291986", "text": "func (m *MockUserWriter) Update(arg0 entity.User) (entity.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(entity.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "824dc83558ce661ae73165ad8d90d2d0", "score": "0.72710365", "text": "func (m *MockTodoRepository) Update(todo *model.Todo) (*model.Todo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", todo)\n\tret0, _ := ret[0].(*model.Todo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7c37c1ab7d93d324cf0e27940d896ae2", "score": "0.72529495", "text": "func (m *MockUseCase) Update(user models.User, input models.UserSettings) (SameUserExists, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", user, input)\n\tret0, _ := ret[0].(SameUserExists)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c0c06df543a4d220275880a2ddff270b", "score": "0.72466075", "text": "func (m *MockAccountUpdater) Update(arg0 types.Account) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "ec56b770c3dba41daaf6939e7c58d1c0", "score": "0.7244248", "text": "func (m *MockGameService) Update(arg0 context.Context, arg1 *service.UpdateGameData) (*entity.GameEx, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(*entity.GameEx)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cb1089e2b7d0d86edf51c8d616dac03d", "score": "0.7238836", "text": "func (m *MockRowUpdater) Update(key int64, row sql.Row) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", key, row)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3ae2837e44fecb33321c56947d094037", "score": "0.7215428", "text": "func (m *MockUsersImpl) Update(user *models.Users) (*models.Users, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", user)\n\tret0, _ := ret[0].(*models.Users)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7238ac87becb10b2ce353a1b3b070199", "score": "0.7214794", "text": "func (m *MockProductUsecase) Update(productID int64, title, description string) (*product.Product, error) {\n\tret := m.ctrl.Call(m, \"Update\", productID, title, description)\n\tret0, _ := ret[0].(*product.Product)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cfb113ffeb788efc65234df181e857fd", "score": "0.7206054", "text": "func (m *MockClusterInterface) Update(arg0 *v1.Cluster) (*v1.Cluster, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0)\n\tret0, _ := ret[0].(*v1.Cluster)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "05f6e6b8cd904968fac18ae36feba33d", "score": "0.7197105", "text": "func (m *MockLoginIDIdentityProvider) Update(i *loginid.Identity) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", i)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "b78a3cd07ede611c31f0b1c4a576140c", "score": "0.71643543", "text": "func (m *MockProduct) Update(id int, inp jewerly.UpdateProductInput) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", id, inp)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "80c84bfc65d0ada2acb9fa81c335afac", "score": "0.71556556", "text": "func (m *MockUpdateCardRepository) Update(ctx context.Context, card *entity.UserCard) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, card)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "7f794f7523e76d16ae94eff0b33ee039", "score": "0.71548134", "text": "func (m *MockLocalRepo) RefUpdate(arg0, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefUpdate\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2969ba749b36faa8c2abcdccc0a3f53c", "score": "0.7152888", "text": "func (m *MockService) Update(ctx context.Context, id string, clinic *clinics.Clinic) (*clinics.Clinic, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, id, clinic)\n\tret0, _ := ret[0].(*clinics.Clinic)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "920f558652afb2127b50b74b8ebd4f41", "score": "0.71286714", "text": "func (_m *IProjectStore) Update(project *models.Project) error {\n\tret := _m.Called(project)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*models.Project) error); ok {\n\t\tr0 = rf(project)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "5622a1d766e1302abb29cf3712ceff5b", "score": "0.70940495", "text": "func (m *MockUpdateCard) Update(ctx context.Context, card *entity.UserCard) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, card)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "25402b7b016b60394a9939a12c51eea5", "score": "0.7086637", "text": "func (m *MockRepository) UpdateAPIKeyLastUsed(keyGUID string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateAPIKeyLastUsed\", keyGUID)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "0acef894d09ddcd5be1688d261ad8ad2", "score": "0.7076976", "text": "func (m *MockTenant) Update(ctx context.Context, tenant *model.Tenant) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", ctx, tenant)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5a8c49282d587d248ad469e7de365afa", "score": "0.7062224", "text": "func (m *MockScheduleInfo) UpdateScheduleInfoCache() {\n\tm.ctrl.Call(m, \"UpdateScheduleInfoCache\")\n}", "title": "" }, { "docid": "502ed2aeb23a4d32726e6dbfe3c569da", "score": "0.7057659", "text": "func (m *MockDisksClientAPI) Update(arg0 context.Context, arg1, arg2 string, arg3 compute.DiskUpdate) (compute.DisksUpdateFuture, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(compute.DisksUpdateFuture)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "11775995060ced68d2a7bc36eb9c8c45", "score": "0.70458823", "text": "func (m *MockLoginIDIdentityProvider) Update(i *identity.LoginID) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", i)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "bca30c6f2f2a80973af8a90ee49be692", "score": "0.7017843", "text": "func (repository UserRepositoryMock) Update(userID uint64, user model.User) error {\n\treturn nil\n}", "title": "" }, { "docid": "b56837a508a0a0d14ef8ded048a1c0c1", "score": "0.69613165", "text": "func (m *MockDBService) UpdateRuntime(arg0 *dbclient.Runtime) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateRuntime\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "00e758c788149edae05efaec5d0cf0c5", "score": "0.69574916", "text": "func (m *MockCommand) UpdateSubscriber() {\n\tm.ctrl.Call(m, \"UpdateSubscriber\")\n}", "title": "" }, { "docid": "a76043969c798bb86a63960bcf5d0f29", "score": "0.69339496", "text": "func (m *MockContext) UpdateInfinispan(arg0 func()) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateInfinispan\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "2e691afdb8f8db847254c6ac227081b0", "score": "0.6901505", "text": "func (m *MockService) UpdateAbout(arg0 context.Context, arg1 uint, arg2 string) error {\n\tret := m.ctrl.Call(m, \"UpdateAbout\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "24a14914d6c8a1e0937fe086edec9207", "score": "0.6880298", "text": "func (m *MockService) UpdateUserInfo(arg0 model.UserInfo) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateUserInfo\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "16d2d70d95e7bedec141b9dc4b524a69", "score": "0.68751526", "text": "func (_m *Repository) Update(a album.Album) error {\n\tret := _m.Called(a)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(album.Album) error); ok {\n\t\tr0 = rf(a)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "906ee9cc76e143b972e9531d892d65b8", "score": "0.68518025", "text": "func (m *MockInterface) UserUpdate(ctx context.Context, username string, user *sdk.AuthentifiedUser) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserUpdate\", ctx, username, user)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d0525688559bf37acc944e4a81ad948e", "score": "0.684854", "text": "func (m *MockClienter) UpdateOne(arg0 context.Context, arg1 string, arg2, arg3 interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateOne\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f88c0a2aeff7657a62d4cf3d91f53f06", "score": "0.68450266", "text": "func (k *K8Client) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error {\n\targs := k.Mock.Called(ctx, obj, opts)\n\treturn args.Error(0)\n}", "title": "" }, { "docid": "a7fd6b0c0448080adff0747b001f134d", "score": "0.6839456", "text": "func (_m *TodoRepository) Update(todo entity.Todo) error {\n\tret := _m.Called(todo)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(entity.Todo) error); ok {\n\t\tr0 = rf(todo)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "312bc0cb26778bfc33935b4053e10856", "score": "0.6814026", "text": "func (m *MockInterface) ApplicationUpdate(projectKey, appName string, app *sdk.Application) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ApplicationUpdate\", projectKey, appName, app)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "c85563880d81c570e4aa6f5eec7bc207", "score": "0.6806999", "text": "func (m *MockAPI) UpdateHwInfo(ctx context.Context, h *models.Host, hwInfo string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateHwInfo\", ctx, h, hwInfo)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f064632a972ced6991925ad07d48b4a4", "score": "0.68056816", "text": "func (m *MockGitModule) RefUpdate(arg0, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefUpdate\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "20969e66631f0427243625aa4c83a98b", "score": "0.6805005", "text": "func (_m *SubscriptionI) Update(_a0 string, _a1 *covenantmodels.Subscription) error {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, *covenantmodels.Subscription) 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": "221fa2d84d011852eaba70d722587d02", "score": "0.6802084", "text": "func (m *RepositoryService) Update(arg0 context.Context, arg1 model0.Repository) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Update\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "aba148dfe147db08602786a6c5afcc79", "score": "0.6755906", "text": "func (_m *SearchEngine) Update(ctx context.Context, _a1 *model.User) error {\n\tret := _m.Called(ctx, _a1)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *model.User) error); ok {\n\t\tr0 = rf(ctx, _a1)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "5cfe3505f1770aa21b982136de253271", "score": "0.6753516", "text": "func (_m *BooksStorage) Update(ctx context.Context, id int64, author int, title int, issue int, string int, pages int) error {\n\tret := _m.Called(ctx, id, author, title, issue, string, pages)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, int64, int, int, int, int, int) error); ok {\n\t\tr0 = rf(ctx, id, author, title, issue, string, pages)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e5269cf583e2bdd1ff397fe7f0a71e94", "score": "0.67532486", "text": "func (m *MockUserUsecase) UpdateLocation(arg0 uint64, arg1 *models.LocationRequest) (*models.UserData, *errors.Error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateLocation\", arg0, arg1)\n\tret0, _ := ret[0].(*models.UserData)\n\tret1, _ := ret[1].(*errors.Error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fd01144d110874ab3e579337d9572672", "score": "0.6738602", "text": "func (_m *BookRepository) Update(book *model.Book) error {\n\tret := _m.Called(book)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*model.Book) error); ok {\n\t\tr0 = rf(book)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "6756feec41e412a0d53fa4c84bbf19b0", "score": "0.6730346", "text": "func (_m *MockAttestation) UpdateEntry(baseSpiffeID string, cert []byte) error {\n\tret := _m.ctrl.Call(_m, \"UpdateEntry\", baseSpiffeID, cert)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "a36747e093a5405bc1c69ceb4a50df23", "score": "0.6727149", "text": "func (_m *VoteRepository) Update(_a0 string, _a1 domain.Vote) (*domain.Vote, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *domain.Vote\n\tif rf, ok := ret.Get(0).(func(string, domain.Vote) *domain.Vote); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*domain.Vote)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, domain.Vote) 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": "d277339fc3b1c00260daa5d44816e9b4", "score": "0.6722426", "text": "func TestUpdate(t *testing.T) {\n\tmockClient, mockFile, done := managerSetup(t)\n\tdefer done()\n\n\tmockDockerID := dockerID\n\tmockTaskARN := validTaskARN\n\tmockTask := &apitask.Task{Arn: mockTaskARN}\n\tmockContainerName := containerName\n\tmockState := types.ContainerState{\n\t\tRunning: true,\n\t}\n\n\tmockConfig := &dockercontainer.Config{Image: \"image\"}\n\n\tmockNetworks := map[string]*network.EndpointSettings{}\n\tmockNetworkSettings := types.NetworkSettings{Networks: mockNetworks}\n\n\tmockContainer := types.ContainerJSON{\n\t\tContainerJSONBase: &types.ContainerJSONBase{\n\t\t\tState: &mockState,\n\t\t},\n\t\tConfig: mockConfig,\n\t\tNetworkSettings: &mockNetworkSettings,\n\t}\n\n\tnewManager := &metadataManager{\n\t\tclient: mockClient,\n\t}\n\n\ttempOpenFile := openFile\n\topenFile = func(name string, flag int, perm os.FileMode) (oswrapper.File, error) {\n\t\treturn mockFile, nil\n\t}\n\tdefer func() {\n\t\topenFile = tempOpenFile\n\t}()\n\n\tgomock.InOrder(\n\t\tmockClient.EXPECT().InspectContainer(gomock.Any(), mockDockerID, dockerclient.InspectContainerTimeout).Return(&mockContainer, nil),\n\t)\n\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\terr := newManager.Update(ctx, mockDockerID, mockTask, mockContainerName)\n\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "ad5bd0dec8dc5366a4cc8c67a3c93344", "score": "0.6720738", "text": "func (m *MockRepository) UpdateResource(obj interface{}) (*domain.Resource, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateResource\", obj)\n\tret0, _ := ret[0].(*domain.Resource)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c6215fb11361dc3a9e70ae481aaea68f", "score": "0.6709349", "text": "func (_m *ContentUsecase) Update(ctx context.Context, ar *domain.Content) error {\n\tret := _m.Called(ctx, ar)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *domain.Content) error); ok {\n\t\tr0 = rf(ctx, ar)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "f93c73b34f20118b27fc75217ffcf2df", "score": "0.6707525", "text": "func (r *userRepoMock) Update(user *model.User) (*model.User, error) {\n\treturn nil, errors.New(\"Not implemented\")\n}", "title": "" } ]
ffd4aa094102b5ca149b6ba7bf84f568
Bytes of a Compact grammar SymbolID, including all of the symbols that it contains.
[ { "docid": "13a36007d4bf1c42149fdf9c3773bd9c", "score": "0.69743925", "text": "func (comp *Compact) Bytes(sid SymbolID) []byte {\n\tif sid == EmptySymbolID || comp == nil {\n\t\treturn nil\n\t}\n\tif uint64(sid) <= maxRuneOrByte {\n\t\treturn runeOrByte(sid).appendBytes(make([]byte, 0, utf8.UTFMax))\n\t}\n\treturn comp.Map[sid].IDs.Bytes(comp)\n}", "title": "" } ]
[ { "docid": "ccc4c3bf7861ff67ff0e061d6b7ba215", "score": "0.73118013", "text": "func (sid SymbolID) Bytes(comp *Compact) []byte {\n\tif sid == EmptySymbolID || comp == nil {\n\t\treturn nil\n\t}\n\tif sid.IsRule() {\n\t\tentry := comp.Map[sid]\n\t\tresult := make([]byte, 0, len(entry.IDs)*utf8.UTFMax)\n\t\tfor _, eid := range entry.IDs {\n\t\t\tresult = append(result, eid.Bytes(comp)...)\n\t\t}\n\t\treturn result\n\t}\n\treturn runeOrByte(sid).appendBytes(make([]byte, 0, utf8.UTFMax))\n}", "title": "" }, { "docid": "c710c0464dd762f9837b37d8b5fbe573", "score": "0.6221381", "text": "func (sids SymbolIDslice) Bytes(comp *Compact) []byte {\n\tif len(sids) == 0 || comp == nil {\n\t\treturn nil\n\t}\n\tresult := make([]byte, 0, len(sids)*utf8.UTFMax)\n\tfor _, id := range sids {\n\t\tresult = append(result, id.Bytes(comp)...)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "304a58a63ea42c7dc25d939de05fc6b5", "score": "0.59414566", "text": "func (id SegmentID) Bytes() []byte { return id[:] }", "title": "" }, { "docid": "07ccd5a2ef8f7503156bccd0105b1f3d", "score": "0.586623", "text": "func (i Ident) Bytes() []byte {\n\treturn i[hashSize:]\n}", "title": "" }, { "docid": "ffb29b25b7951dfd3f0910ac549e7ef4", "score": "0.57434505", "text": "func (name PeerName) bytes() []byte {\n\treturn intmac(uint64(name))\n}", "title": "" }, { "docid": "15328cadc4e6b14aa353c064ba8fa9d8", "score": "0.57079005", "text": "func (id PieceID) Bytes() []byte { return id[:] }", "title": "" }, { "docid": "588787b04ccecf14c3878ddafd473289", "score": "0.5686976", "text": "func (id BlockID) Bytes() []byte {\n\treturn id.h.Bytes()\n}", "title": "" }, { "docid": "72c4977e6aa5ffd6bbbbd41faa94e51b", "score": "0.56819326", "text": "func (id MdID) Bytes() []byte {\n\treturn id.h.Bytes()\n}", "title": "" }, { "docid": "593a6123056a2add33fd7942b411363c", "score": "0.56717205", "text": "func (i AllocationID) Bytes() []byte {\n\treturn []byte(i.id)\n}", "title": "" }, { "docid": "583852f7a646fb6d526475f3130a5b5e", "score": "0.56583774", "text": "func (id BlockID) Bytes() []byte {\n\treturn id.AsHash32().Bytes()\n}", "title": "" }, { "docid": "0980e7d9bc4ef9e42cf49c40bd487787", "score": "0.5611337", "text": "func (id NodeID) Bytes() []byte { return id[:] }", "title": "" }, { "docid": "2208479b5d44a193b084543d8fe1121d", "score": "0.5597756", "text": "func (z *ChannelID) Bytes() []byte {\n\treturn leb128.FromBigInt(z.val)\n}", "title": "" }, { "docid": "622a4b8c35f8666c64e8f1326f0bfcae", "score": "0.55851036", "text": "func (_Dai *DaiSession) Symbol() ([32]byte, error) {\n\treturn _Dai.Contract.Symbol(&_Dai.CallOpts)\n}", "title": "" }, { "docid": "695ea0fe75917b51c1f4c4ad05d46a9e", "score": "0.55689085", "text": "func BipIDSymbol(id uint32) string {\n\treturn bipIDs[id]\n}", "title": "" }, { "docid": "375feecb284a830846490c669765ab8d", "score": "0.5550423", "text": "func (id ContractID) ToBytes() []byte {\n\tdata, err := protobuf.Marshal(id._ToProtobuf())\n\tif err != nil {\n\t\treturn make([]byte, 0)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "4418155504ee6fc45f5d82333c303dec", "score": "0.5506408", "text": "func (s *Symbol) Bytes() []byte {\n\tif s == nil {\n\t\treturn nil\n\t}\n\tif s.rule != nil {\n\t\tvar b bytes.Buffer\n\t\t_ = rawPrint(&b, s.rule) // ignore error\n\t\treturn b.Bytes()\n\t}\n\treturn runeOrByte(s.value).appendBytes(make([]byte, 0, utf8.UTFMax))\n}", "title": "" }, { "docid": "0e6eeb7a77755647098a72896f1626a3", "score": "0.5473784", "text": "func (c ConnectionID) Bytes() []byte {\n\treturn c.b[:c.l]\n}", "title": "" }, { "docid": "9b887ad383f49cb454a4aed0d5b891d3", "score": "0.5454781", "text": "func (c Cid) Bytes() []byte {\n\treturn []byte(c.str)\n}", "title": "" }, { "docid": "c2e264528a14a0037485871ab5fddf43", "score": "0.53579366", "text": "func (id id8) Hex() string { return strings.TrimLeft(strconv.FormatUint(uint64(id), 16), \"0\") }", "title": "" }, { "docid": "3951966d4f47fd6104bdbe359bd89505", "score": "0.53438175", "text": "func (msg MsgBond) GetSignBytes() []byte {\n\treturn cosmos.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "e5fa89feef88cf44ce7be3557b65e051", "score": "0.53329504", "text": "func (i BroadcastID) Bytes() []byte {\n\tif i.id == \"\" {\n\t\treturn nil\n\t}\n\treturn []byte(i.id)\n}", "title": "" }, { "docid": "4f8e4287782244be04e3882dbc7410e6", "score": "0.5324645", "text": "func (msg MsgUnBond) GetSignBytes() []byte {\n\treturn cosmos.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "2f9b61968c39fad3e97c80921ec939cf", "score": "0.5305552", "text": "func (id BlockID) String() string {\n\treturn hex.EncodeToString(id[:])\n}", "title": "" }, { "docid": "13664bf7ed908c3a35883a42b622749e", "score": "0.5294837", "text": "func makeIDBytes(id ID) []byte {\n\tb := make([]byte, lenID)\n\tcopy(b[0:8], id.Name[:])\n\tbinary.BigEndian.PutUint64(b[8:16], id.BinSize)\n\tbinary.BigEndian.PutUint64(b[16:24], id.ZipSize)\n\n\treturn b\n}", "title": "" }, { "docid": "140f9cf0001ad08b8bf8b8ac996479fe", "score": "0.5291712", "text": "func (msg MsgRemoveIndexingNode) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "6da36e17107c4e1faa0e9eac085380b8", "score": "0.5275632", "text": "func (c CidStr) Bytes() []byte {\n\tswitch c.Version() {\n\tcase 0:\n\t\treturn c.Multihash()\n\tcase 1:\n\t\treturn []byte(c)\n\tdefault:\n\t\tpanic(\"not possible to reach this point\")\n\t}\n}", "title": "" }, { "docid": "a6bceec6e5d5bcdd63ef7aee17a4419e", "score": "0.5274662", "text": "func (m MsgDefineResolver) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))\n}", "title": "" }, { "docid": "40518e26b313045a790ffd70bd6dba2a", "score": "0.5263522", "text": "func (id LocalID) Bytes() []byte {\n\tbuf := make([]byte, 2, 2)\n\tbinary.LittleEndian.PutUint16(buf, uint16(id))\n\treturn buf\n}", "title": "" }, { "docid": "9e9fdaa8578311c306914e6619de180e", "score": "0.52461153", "text": "func (c Cid) ByteLen() int {\n\treturn len(c.str)\n}", "title": "" }, { "docid": "012d8ff0290e9152d4bbc1cc632b3b57", "score": "0.5239475", "text": "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_contractspv3_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "47e7b9737de59b58db9fa5a183ca31c6", "score": "0.52326435", "text": "func (n NetID) Bytes() []byte {\n\treturn n[:]\n}", "title": "" }, { "docid": "bcab7ee1f90933939c37260515145b17", "score": "0.5229964", "text": "func (v ResourceIdSpec) Bytes() []byte {\n\tbuf := make([]byte, 8)\n\tb := 0\n\n\txgb.Put32(buf[b:], v.Resource)\n\tb += 4\n\n\txgb.Put32(buf[b:], v.Type)\n\tb += 4\n\n\treturn buf[:b]\n}", "title": "" }, { "docid": "e74bb4a37eff58ccc906b620061ed865", "score": "0.52279913", "text": "func (*Symbol) Descriptor() ([]byte, []int) {\n\treturn file_query_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b8ea9c3cb7e6663238c45cd1a581b8ed", "score": "0.52209115", "text": "func (v ClientIdSpec) Bytes() []byte {\n\tbuf := make([]byte, 8)\n\tb := 0\n\n\txgb.Put32(buf[b:], v.Client)\n\tb += 4\n\n\txgb.Put32(buf[b:], v.Mask)\n\tb += 4\n\n\treturn buf[:b]\n}", "title": "" }, { "docid": "d30d52a0572c89a472890bfee19790d8", "score": "0.5210044", "text": "func (e Encoder) SizeBySymbol() []byte {\n\tnumSymbols := Symbol(len(e.codes))\n\tout := make([]byte, numSymbols)\n\tfor symbol := Symbol(0); symbol < numSymbols; symbol++ {\n\t\thc := e.codes[symbol]\n\t\tout[symbol] = hc.Size\n\t}\n\treturn out\n}", "title": "" }, { "docid": "a071d9ceb11c21ae58c3884a35bbbd7b", "score": "0.52034", "text": "func (c OpaqueCode) Bytes() []byte { return []byte(c) }", "title": "" }, { "docid": "2c563d8fb2a915788dba6855e145969b", "score": "0.5195796", "text": "func (id *TxId) Bytes() []byte {\n\treturn id.data[:]\n}", "title": "" }, { "docid": "e6dc18f959eb33c29d91682cbe8184df", "score": "0.51888806", "text": "func (id HashID) Bytes() []byte {\n\tif id == emptyHashID {\n\t\treturn nil\n\t}\n\treturn id[:]\n}", "title": "" }, { "docid": "b652331c9165597d8cb4cafee1c513e2", "score": "0.5187367", "text": "func (id FileID) Bytes() []byte {\n\treturn id[:]\n}", "title": "" }, { "docid": "d67730acc999ea1428e51459404501dc", "score": "0.51870346", "text": "func (id ID) Bytes() []byte {\n\treturn id[:]\n}", "title": "" }, { "docid": "dbaa68648d0221a091e8993ecb4ba42d", "score": "0.5172476", "text": "func (msg MsgDeleteName) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "6590d15e226c5e210f83cd5e6a0fb2b7", "score": "0.51640403", "text": "func (_ALPHA *ALPHACaller) Symbol(opts *bind.CallOpts) (string, error) {\n\tvar out []interface{}\n\terr := _ALPHA.contract.Call(opts, &out, \"symbol\")\n\n\tif err != nil {\n\t\treturn *new(string), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(string)).(*string)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "7d64b350a8d0ead6a7b699063d9b1a09", "score": "0.51577824", "text": "func (f *OSPFFlags) GetPrefixSIDFlagByte() byte {\n\tb := byte(0)\n\n\tif f.NPFlag {\n\t\tb += 0x40\n\t}\n\tif f.MFlag {\n\t\tb += 0x20\n\t}\n\tif f.EFlag {\n\t\tb += 0x10\n\t}\n\tif f.VFlag {\n\t\tb += 0x08\n\t}\n\tif f.LFlag {\n\t\tb += 0x04\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "4ac30e9e365cfbb7d60cf628f6937fe5", "score": "0.5156146", "text": "func (comp *Compact) String() string {\n\tif comp.RootID == EmptySymbolID {\n\t\treturn comp.RootID.String()\n\t}\n\tvar b bytes.Buffer\n\tif err := comp.PrettyPrint(&b); err != nil {\n\t\treturn err.Error()\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "279d26dab89e1c5c0839e79c89865b7c", "score": "0.51518434", "text": "func (f *ISISFlags) GetPrefixSIDFlagByte() byte {\n\tb := byte(0)\n\tif f.RFlag {\n\t\tb += 0x80\n\t}\n\tif f.NFlag {\n\t\tb += 0x40\n\t}\n\tif f.PFlag {\n\t\tb += 0x20\n\t}\n\tif f.EFlag {\n\t\tb += 0x10\n\t}\n\tif f.VFlag {\n\t\tb += 0x08\n\t}\n\tif f.LFlag {\n\t\tb += 0x04\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "2fe73b31419b983fee1a68af9001a2fb", "score": "0.5149556", "text": "func (_Dai *DaiCallerSession) Symbol() ([32]byte, error) {\n\treturn _Dai.Contract.Symbol(&_Dai.CallOpts)\n}", "title": "" }, { "docid": "b634f72ca943d17d4c912230b93d2b45", "score": "0.5120708", "text": "func (id LocalID) Bytes() []byte {\n\tbuf := make([]byte, LocalIDSize, LocalIDSize)\n\tbinary.BigEndian.PutUint16(buf, uint16(id))\n\treturn buf\n}", "title": "" }, { "docid": "396041701a4aca2ffca5460a0960a727", "score": "0.5116601", "text": "func (id WalletID) Bytes() []byte {\n\treturn siaencoding.EncUint64(uint64(id))\n}", "title": "" }, { "docid": "9050b8f5af848dba17b86c93ccbbe07f", "score": "0.51158303", "text": "func (id DBID) Bytes() []byte {\n\treturn []byte(id.String())\n}", "title": "" }, { "docid": "ed8b763724611819b264afac20bafcaf", "score": "0.51151556", "text": "func GetPopIDBytes(id uint64) []byte {\n\tbz := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(bz, id)\n\treturn bz\n}", "title": "" }, { "docid": "5b995de705b88408c4a6b9b4fc97aa62", "score": "0.5112312", "text": "func (a *APDUCommand) Bytes() []byte {\n\tif a.Raw != nil {\n\t\treturn a.Raw\n\t}\n\tbuf := make([]byte, 4, 5+len(a.Data))\n\tbuf[0] = a.Cla\n\tbuf[1] = a.Ins\n\tbuf[2] = a.P1\n\tbuf[3] = a.P2\n\tif a.ForceLc || len(a.Data) != 0 {\n\t\tbuf = append(buf, uint8(len(a.Data)&0xff))\n\t}\n\tbuf = append(buf, a.Data...)\n\treturn buf\n}", "title": "" }, { "docid": "b4fa46f05deb49e5dfb50114c56379e3", "score": "0.51092035", "text": "func (id NodeID) Bytes() []byte {\n\treturn append([]byte{NodeIDPrefix}, append(id.NS[:], id.Digest[:]...)...)\n}", "title": "" }, { "docid": "af1dd4a9e4d5debc98fdec61c5159dde", "score": "0.50970817", "text": "func (id SegmentID) String() string { return base32Encoding.EncodeToString(id.Bytes()) }", "title": "" }, { "docid": "0e857c166f569c7c2c2e8d17e289fd87", "score": "0.5096834", "text": "func (r RandomID) Bytes() []byte {\n\tdecoded, err := hex.DecodeString(string(r))\n\tif err != nil {\n\t\tpanic(\"kademlia: failed to decode RandomID: \" + err.Error())\n\t}\n\treturn decoded\n}", "title": "" }, { "docid": "3757c07a4b8a3672a33483329124b9bd", "score": "0.50830704", "text": "func (id BlockID) String() string {\n\treturn id.AsHash32().ShortString()\n}", "title": "" }, { "docid": "0b591ad1f8923cb7f1332a68e680c932", "score": "0.50826496", "text": "func (msg MsgUpdateIndexingNode) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "027f31400be868d82995627171c5dd2a", "score": "0.50771004", "text": "func oidToByteString(oid string) string {\n\treturn oid\n}", "title": "" }, { "docid": "7df4b476ebbcaccf6a29985d62e3fb4e", "score": "0.507679", "text": "func GetBaseNftIDBytes(id uint64) []byte {\n\tbz := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(bz, id)\n\treturn bz\n}", "title": "" }, { "docid": "352557899c1c9bb21e69400a92df5068", "score": "0.5074145", "text": "func (o *OptServerIdentifier) ToBytes() []byte {\n\tret := []byte{byte(o.Code()), byte(o.Length())}\n\treturn append(ret, o.ServerID.To4()...)\n}", "title": "" }, { "docid": "d963a25fdecd09ae22efc8be485accde", "score": "0.50674796", "text": "func (msg MsgUnpeg) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "68bb20f92a097b7e6ca1b571d8787a94", "score": "0.50626534", "text": "func GetCdpIDBytes(cdpID uint64) (cdpIDBz []byte) {\n\tcdpIDBz = make([]byte, 8)\n\tbinary.BigEndian.PutUint64(cdpIDBz, cdpID)\n\treturn\n}", "title": "" }, { "docid": "8a888cf2243d5bc428456e38d226166a", "score": "0.50585043", "text": "func (msg MsgPlaceBid) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "ca09741e180381158d6b08a01a527b69", "score": "0.50565183", "text": "func (msg MsgRemoveResourceNode) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "a89e376c87831cb4737b768952adb299", "score": "0.50556403", "text": "func (c Cid) String() string {\n\tswitch c.Version() {\n\tcase 0:\n\t\treturn c.Hash().B58String()\n\tcase 1:\n\t\tmbstr, err := mbase.Encode(mbase.Base32, c.Bytes())\n\t\tif err != nil {\n\t\t\tpanic(\"should not error with hardcoded mbase: \" + err.Error())\n\t\t}\n\n\t\treturn mbstr\n\tdefault:\n\t\tpanic(\"not possible to reach this point\")\n\t}\n}", "title": "" }, { "docid": "99a6f51e6ebf5c8029f4acccb9a6cee4", "score": "0.50518435", "text": "func (t TraceID) Bytes() []byte {\n\treturn bytesID(t).Bytes()\n}", "title": "" }, { "docid": "86839b6c7a89393c080107fbfc07b971", "score": "0.50475514", "text": "func (msg MsgBorrow) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "24c869b42b1fc140f4d395956fb747f8", "score": "0.50279725", "text": "func (msg MsgNotifyCosigned) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "b621f975860e9bb7da961b51707a0264", "score": "0.5021433", "text": "func (msg MsgSwapExactForTokens) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "ac52e204c08bfb5644020fb12c350e94", "score": "0.50184864", "text": "func (msg MsgSwapForExactTokens) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "ecf333fbfcd54d15ec4f10da740fa6ff", "score": "0.5016145", "text": "func (*StockSymbol) Descriptor() ([]byte, []int) {\n\treturn file_myStockService_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0aefee386cca41731dd6831beeae2037", "score": "0.50155187", "text": "func (msg MsgBeginRedelegate) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "05932280fff534c3c6ee4ae36de1cced", "score": "0.5012118", "text": "func GetContractBin() []byte {\n\treturn hexutil.MustDecode(\"0x6080604052600436106105fb5760003560e01c80638b0e9f3f1161030e578063c65ee0e11161019b578063de67f215116100e7578063ebdf104c116100a0578063f3ae5b1a1161007a578063f3ae5b1a14611899578063f8b18d8a146115e7578063f99837e6146118c3578063fd5e6dd1146118f3576105fb565b8063ebdf104c146116e6578063ec6a7f1c14611851578063f2fde38b14611866576105fb565b8063de67f21514611581578063df00c922146115b7578063df0e307a146115e7578063df4f49d414611611578063e08d7e661461163b578063e261641a146116b6576105fb565b8063cfd5fa0c11610154578063d9a7c1f91161012e578063d9a7c1f9146114d3578063dc31e1af146114e8578063dc599bb114611518578063dd099bb614611548576105fb565b8063cfd5fa0c1461141c578063cfdbb7cd14611455578063d845fc901461148e576105fb565b8063c65ee0e114611348578063c7be95de14611372578063cb1c4e671461068e578063cc8343aa14611387578063cda5826a146113b9578063cfd47663146113e3576105fb565b8063b1e643391161025a578063bb03a4bd11610213578063c3de580e116101ed578063c3de580e146112f4578063c41b64051461131e578063c4b5dd7e1461068e578063c5f530af14611333576105fb565b8063bb03a4bd146112a9578063bed9d861146112df578063c312eb0714610fe9576105fb565b8063b1e6433914611122578063b5d896271461114c578063b6d9edd5146111b7578063b810e411146111e1578063b82b84271461121a578063b88a37e21461122f576105fb565b806396c7ee46116102c7578063a4b89fab116102a1578063a4b89fab14611036578063a5a470ad14611066578063a7786515146110d4578063a86a056f146110e9576105fb565b806396c7ee4614610f8a5780639fa6dd3514610fe9578063a198d22914611006576105fb565b80638b0e9f3f14610e905780638b1a0d1114610ea55780638cddb01514610ed55780638da5cb5b14610f0e5780638f32d59b14610f3f57806396060e7114610f54576105fb565b80633d0317fe1161048c5780636099ecb2116103d85780636f498663116103915780637cacb1d61161036b5780637cacb1d614610d9e5780637f664d8714610db357806381d9dc7a146106a3578063854873e114610df1576105fb565b80636f49866314610d3b578063715018a614610d745780637667180814610d89576105fb565b80636099ecb214610c5157806360c7e37f1461068e57806361e53fcc14610c8a57806363321e2714610cba578063650acd6614610ced578063670322f814610d02576105fb565b80634feb92f3116104455780635601fe011161041f5780635601fe0114610be257806358f95b8014610c0c5780635e2308d2146109715780635fab23a814610c3c576105fb565b80634feb92f314610b0757806354d77ed21461081957806354fd4d5014610bb0576105fb565b80633d0317fe14610a475780633fee10a814610819578063441a3e7014610a5c5780634bd202dc14610a8c5780634f7c4efb14610aa15780634f864df414610ad1576105fb565b80631d58179c1161054b5780632709275e116105045780632cedb097116104de5780632cedb097146109c557806330fa9929146109f3578063375b3c0a14610a0857806339b80c0014610a1d576105fb565b80632709275e1461097157806328f7314814610986578063295cccba1461099b576105fb565b80631d58179c146108195780631e702f831461082e5780631f2701521461085e578063223fae09146108bb5780632265f2841461092c57806326682c7114610941576105fb565b80630d4955e3116105b857806318160ddd1161059257806318160ddd1461076f57806318f628d41461078457806319ddb54f1461068e5780631d3ac42c146107e9576105fb565b80630d4955e31461070c5780630d7b26091461072157806312622d0e14610736576105fb565b80630135b1db14610600578063019e272914610645578063029859921461068e57806308728f6e146106a357806308c36874146106b85780630962ef79146106e2575b600080fd5b34801561060c57600080fd5b506106336004803603602081101561062357600080fd5b50356001600160a01b0316611979565b60408051918252519081900360200190f35b34801561065157600080fd5b5061068c6004803603608081101561066857600080fd5b508035906020810135906001600160a01b036040820135811691606001351661198b565b005b34801561069a57600080fd5b50610633611a92565b3480156106af57600080fd5b50610633611a98565b3480156106c457600080fd5b5061068c600480360360208110156106db57600080fd5b5035611a9e565b3480156106ee57600080fd5b5061068c6004803603602081101561070557600080fd5b5035611b6a565b34801561071857600080fd5b50610633611c47565b34801561072d57600080fd5b50610633611c4f565b34801561074257600080fd5b506106336004803603604081101561075957600080fd5b506001600160a01b038135169060200135611c56565b34801561077b57600080fd5b50610633611cdf565b34801561079057600080fd5b5061068c60048036036101208110156107a857600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a08101359060c08101359060e0810135906101000135611ce5565b3480156107f557600080fd5b506106336004803603604081101561080c57600080fd5b5080359060200135611e45565b34801561082557600080fd5b50610633611fd8565b34801561083a57600080fd5b5061068c6004803603604081101561085157600080fd5b5080359060200135611fe7565b34801561086a57600080fd5b5061089d6004803603606081101561088157600080fd5b506001600160a01b038135169060208101359060400135612085565b60408051938452602084019290925282820152519081900360600190f35b3480156108c757600080fd5b506108f4600480360360408110156108de57600080fd5b506001600160a01b0381351690602001356120b7565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b34801561093857600080fd5b5061063361212b565b34801561094d57600080fd5b5061068c6004803603604081101561096457600080fd5b508035906020013561213d565b34801561097d57600080fd5b5061063361215d565b34801561099257600080fd5b50610633612179565b3480156109a757600080fd5b5061068c600480360360208110156109be57600080fd5b503561217f565b3480156109d157600080fd5b506109da612198565b6040805192835260208301919091528051918290030190f35b3480156109ff57600080fd5b506106336121a2565b348015610a1457600080fd5b506106336121b5565b348015610a2957600080fd5b506108f460048036036020811015610a4057600080fd5b50356121bf565b348015610a5357600080fd5b50610633612201565b348015610a6857600080fd5b5061068c60048036036040811015610a7f57600080fd5b5080359060200135612212565b348015610a9857600080fd5b50610633612556565b348015610aad57600080fd5b5061068c60048036036040811015610ac457600080fd5b508035906020013561255b565b348015610add57600080fd5b5061068c60048036036060811015610af457600080fd5b508035906020810135906040013561268d565b348015610b1357600080fd5b5061068c6004803603610100811015610b2b57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b811115610b5a57600080fd5b820183602082011115610b6c57600080fd5b803590602001918460018302840111600160201b83111715610b8d57600080fd5b9193509150803590602081013590604081013590606081013590608001356129f9565b348015610bbc57600080fd5b50610bc5612a9f565b604080516001600160e81b03199092168252519081900360200190f35b348015610bee57600080fd5b5061063360048036036020811015610c0557600080fd5b5035612aa9565b348015610c1857600080fd5b5061063360048036036040811015610c2f57600080fd5b5080359060200135612adf565b348015610c4857600080fd5b50610633612afc565b348015610c5d57600080fd5b5061063360048036036040811015610c7457600080fd5b506001600160a01b038135169060200135612b02565b348015610c9657600080fd5b5061063360048036036040811015610cad57600080fd5b5080359060200135612b40565b348015610cc657600080fd5b5061063360048036036020811015610cdd57600080fd5b50356001600160a01b0316612b61565b348015610cf957600080fd5b50610633612b7c565b348015610d0e57600080fd5b5061063360048036036040811015610d2557600080fd5b506001600160a01b038135169060200135612b81565b348015610d4757600080fd5b5061063360048036036040811015610d5e57600080fd5b506001600160a01b038135169060200135612bc2565b348015610d8057600080fd5b5061068c612c2c565b348015610d9557600080fd5b50610633612cbd565b348015610daa57600080fd5b50610633612cc6565b348015610dbf57600080fd5b50610ddd60048036036020811015610dd657600080fd5b5035612ccc565b604080519115158252519081900360200190f35b348015610dfd57600080fd5b50610e1b60048036036020811015610e1457600080fd5b5035612cf1565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610e55578181015183820152602001610e3d565b50505050905090810190601f168015610e825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610e9c57600080fd5b50610633612d8c565b348015610eb157600080fd5b5061068c60048036036040811015610ec857600080fd5b5080359060200135612d92565b348015610ee157600080fd5b5061068c60048036036040811015610ef857600080fd5b506001600160a01b038135169060200135612e22565b348015610f1a57600080fd5b50610f23612e70565b604080516001600160a01b039092168252519081900360200190f35b348015610f4b57600080fd5b50610ddd612e7f565b348015610f6057600080fd5b5061089d60048036036060811015610f7757600080fd5b5080359060208101359060400135612e90565b348015610f9657600080fd5b50610fc360048036036040811015610fad57600080fd5b506001600160a01b038135169060200135612ee8565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61068c60048036036020811015610fff57600080fd5b5035612f1a565b34801561101257600080fd5b506106336004803603604081101561102957600080fd5b5080359060200135612f28565b34801561104257600080fd5b5061068c6004803603604081101561105957600080fd5b5080359060200135612f49565b61068c6004803603602081101561107c57600080fd5b810190602081018135600160201b81111561109657600080fd5b8201836020820111156110a857600080fd5b803590602001918460018302840111600160201b831117156110c957600080fd5b509092509050612f71565b3480156110e057600080fd5b50610633613055565b3480156110f557600080fd5b506106336004803603604081101561110c57600080fd5b506001600160a01b03813516906020013561306b565b34801561112e57600080fd5b5061068c6004803603602081101561114557600080fd5b5035613088565b34801561115857600080fd5b506111766004803603602081101561116f57600080fd5b50356130d5565b604080519788526020880196909652868601949094526060860192909252608085015260a08401526001600160a01b031660c0830152519081900360e00190f35b3480156111c357600080fd5b5061068c600480360360208110156111da57600080fd5b503561311b565b3480156111ed57600080fd5b5061089d6004803603604081101561120457600080fd5b506001600160a01b0381351690602001356131fb565b34801561122657600080fd5b50610633613227565b34801561123b57600080fd5b506112596004803603602081101561125257600080fd5b503561322e565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561129557818101518382015260200161127d565b505050509050019250505060405180910390f35b3480156112b557600080fd5b5061068c600480360360608110156112cc57600080fd5b5080359060208101359060400135613293565b3480156112eb57600080fd5b5061068c61329e565b34801561130057600080fd5b50610ddd6004803603602081101561131757600080fd5b50356132eb565b34801561132a57600080fd5b5061068c613088565b34801561133f57600080fd5b50610633613302565b34801561135457600080fd5b506106336004803603602081101561136b57600080fd5b5035613311565b34801561137e57600080fd5b50610633613323565b34801561139357600080fd5b5061068c600480360360408110156113aa57600080fd5b50803590602001351515613329565b3480156113c557600080fd5b5061068c600480360360208110156113dc57600080fd5b503561350b565b3480156113ef57600080fd5b506106336004803603604081101561140657600080fd5b506001600160a01b038135169060200135613524565b34801561142857600080fd5b50610ddd6004803603604081101561143f57600080fd5b506001600160a01b038135169060200135613541565b34801561146157600080fd5b50610ddd6004803603604081101561147857600080fd5b506001600160a01b038135169060200135613549565b34801561149a57600080fd5b5061089d600480360360808110156114b157600080fd5b506001600160a01b0381351690602081013590604081013590606001356135b1565b3480156114df57600080fd5b506106336135ef565b3480156114f457600080fd5b506106336004803603604081101561150b57600080fd5b50803590602001356135f5565b34801561152457600080fd5b5061068c6004803603604081101561153b57600080fd5b5080359060200135613616565b34801561155457600080fd5b5061089d6004803603604081101561156b57600080fd5b506001600160a01b03813516906020013561361f565b34801561158d57600080fd5b5061068c600480360360608110156115a457600080fd5b508035906020810135906040013561368b565b3480156115c357600080fd5b50610633600480360360408110156115da57600080fd5b508035906020013561398c565b3480156115f357600080fd5b5061068c6004803603602081101561160a57600080fd5b503561329e565b34801561161d57600080fd5b5061089d6004803603602081101561163457600080fd5b50356139ad565b34801561164757600080fd5b5061068c6004803603602081101561165e57600080fd5b810190602081018135600160201b81111561167857600080fd5b82018360208201111561168a57600080fd5b803590602001918460208302840111600160201b831117156116ab57600080fd5b5090925090506139e3565b3480156116c257600080fd5b50610633600480360360408110156116d957600080fd5b5080359060200135613ac3565b3480156116f257600080fd5b5061068c6004803603608081101561170957600080fd5b810190602081018135600160201b81111561172357600080fd5b82018360208201111561173557600080fd5b803590602001918460208302840111600160201b8311171561175657600080fd5b919390929091602081019035600160201b81111561177357600080fd5b82018360208201111561178557600080fd5b803590602001918460208302840111600160201b831117156117a657600080fd5b919390929091602081019035600160201b8111156117c357600080fd5b8201836020820111156117d557600080fd5b803590602001918460208302840111600160201b831117156117f657600080fd5b919390929091602081019035600160201b81111561181357600080fd5b82018360208201111561182557600080fd5b803590602001918460208302840111600160201b8311171561184657600080fd5b509092509050613ae4565b34801561185d57600080fd5b50610633613cc0565b34801561187257600080fd5b5061068c6004803603602081101561188957600080fd5b50356001600160a01b0316613cca565b3480156118a557600080fd5b5061068c600480360360208110156118bc57600080fd5b5035613d1a565b3480156118cf57600080fd5b5061068c600480360360408110156118e657600080fd5b5080359060200135613d3d565b3480156118ff57600080fd5b5061191d6004803603602081101561191657600080fd5b5035613d46565b604080519a8b5260208b0199909952898901979097526060890195909552608088019390935260a087019190915260c086015260e08501526001600160a01b039081166101008501521661012083015251908190036101400190f35b60696020526000908152604090205481565b600054610100900460ff16806119a457506119a4613e69565b806119b2575060005460ff16155b6119ed5760405162461bcd60e51b815260040180806020018281038252602e815260200180615baa602e913960400191505060405180910390fd5b600054610100900460ff16158015611a18576000805460ff1961ff0019909116610100171660011790555b611a2182613e6f565b6067859055606680546001600160a01b0319166001600160a01b03851617905560768490556755cfe697852e904c6075556103e86078556203f480607955611a67613f60565b6000868152607760205260409020600701558015611a8b576000805461ff00191690555b5050505050565b60015b90565b606b5490565b33611aa7615981565b611ab18284613f64565b60208101518151919250600091611acd9163ffffffff61405816565b9050611af08385611aeb85604001518561405890919063ffffffff16565b6140b2565b6001600160a01b0383166000818152607360209081526040808320888452825291829020805485019055845185820151868401518451928352928201528083019190915290518692917f4119153d17a36f9597d40e3ab4148d03261a439dddbec4e91799ab7159608e26919081900360600190a350505050565b33611b73615981565b611b7d8284613f64565b9050816001600160a01b03166108fc611bbb8360400151611baf8560200151866000015161405890919063ffffffff16565b9063ffffffff61405816565b6040518115909202916000818181858888f19350505050158015611be3573d6000803e3d6000fd5b5082826001600160a01b03167fc1d8eb6e444b89fb8ff0991c19311c070df704ccb009e210d1462d5b2410bf4583600001518460200151856040015160405180848152602001838152602001828152602001935050505060405180910390a3505050565b6301e1338090565b6212750090565b6000611c628383613549565b611c9057506001600160a01b0382166000908152607260209081526040808320848452909152902054611cd9565b6001600160a01b038316600081815260736020908152604080832086845282528083205493835260728252808320868452909152902054611cd69163ffffffff6141af16565b90505b92915050565b60765481565b611cee336141f1565b611d295760405162461bcd60e51b8152600401808060200182810382526029815260200180615b406029913960400191505060405180910390fd5b611d34898989614205565b6001600160a01b0389166000908152606f602090815260408083208b84529091529020600201819055611d668761436a565b8515611e3a5786861115611dab5760405162461bcd60e51b815260040180806020018281038252602c815260200180615c4a602c913960400191505060405180910390fd5b6001600160a01b03891660008181526073602090815260408083208c845282528083208a8155600181018a90556002810189905560038101889055848452607483528184208d855283529281902086905580518781529182018a9052805192938c9390927f138940e95abffcd789b497bf6188bba3afa5fbd22fb5c42c2f6018d1bf0f4e7892908290030190a3505b505050505050505050565b336000818152607360209081526040808320868452909152812090919083611ea2576040805162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b611eac8286613549565b611eed576040805162461bcd60e51b815260206004820152600d60248201526c06e6f74206c6f636b656420757609c1b604482015290519081900360640190fd5b8054841115611f43576040805162461bcd60e51b815260206004820152601760248201527f6e6f7420656e6f756768206c6f636b6564207374616b65000000000000000000604482015290519081900360640190fd5b611f4d82866143d1565b506000611f608387878560000154614519565b825486900383556001600160a01b03841660008181526072602090815260408083208b8452825291829020805485900390558151898152908101849052815193945089937fef6c0c14fe9aa51af36acd791464dec3badbde668b63189b47bfa4e25be9b2b9929181900390910190a395945050505050565b6000611fe2612b7c565b905090565b611ff0336141f1565b61202b5760405162461bcd60e51b8152600401808060200182810382526029815260200180615b406029913960400191505060405180910390fd5b8061206c576040805162461bcd60e51b815260206004820152600c60248201526b77726f6e672073746174757360a01b604482015290519081900360640190fd5b6120768282614662565b612081826000613329565b5050565b607160209081526000938452604080852082529284528284209052825290208054600182015460029092015490919083565b6001600160a01b03821660009081526072602090815260408083208484529091528120548190819081908190819081908061210857506000965086955085945084935083925082915081905061211f565b600197508796506000955085945092508591508790505b92959891949750929550565b600061213561478c565b601002905090565b3360009081526069602052604090205461215881848461268d565b505050565b6000606461216961478c565b601e028161217357fe5b04905090565b606d5481565b3360009081526069602052604090205461208181611b6a565b6078546079549091565b60006121ac612201565b606c5403905090565b6000611fe2613302565b607760205280600052604060002060009150905080600701549080600801549080600901549080600a01549080600b01549080600c01549080600d0154905087565b60006064606c546018028161217357fe5b3361221b615981565b506001600160a01b0381166000908152607160209081526040808320868452825280832085845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526122b7576040805162461bcd60e51b81526020600482015260156024820152741c995c5d595cdd08191bd95cdb89dd08195e1a5cdd605a1b604482015290519081900360640190fd5b602080820151825160008781526068909352604090922060010154909190158015906122f3575060008681526068602052604090206001015482115b15612314575050600084815260686020526040902060018101546002909101545b61231c613227565b8201612326613f60565b1015612372576040805162461bcd60e51b81526020600482015260166024820152751b9bdd08195b9bdd59da081d1a5b59481c185cdcd95960521b604482015290519081900360640190fd5b61237a612b7c565b8101612384612cbd565b10156123d7576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420656e6f7567682065706f636873207061737365640000000000000000604482015290519081900360640190fd5b6001600160a01b0384166000908152607160209081526040808320898452825280832088845290915281206002015490612410886132eb565b905060006124328383607a60008d815260200190815260200160002054614798565b6001600160a01b03881660009081526071602090815260408083208d845282528083208c845290915281208181556001810182905560020155606e80548201905590508083116124c2576040805162461bcd60e51b81526020600482015260166024820152751cdd185ad9481a5cc8199d5b1b1e481cdb185cda195960521b604482015290519081900360640190fd5b6001600160a01b0387166108fc6124df858463ffffffff6141af16565b6040518115909202916000818181858888f19350505050158015612507573d6000803e3d6000fd5b508789886001600160a01b03167f75e161b3e824b114fc1a33274bd7091918dd4e639cede50b78b15a4eea956a21866040518082815260200191505060405180910390a4505050505050505050565b600090565b612563612e7f565b6125a2576040805162461bcd60e51b81526020600482018190526024820152600080516020615b8a833981519152604482015290519081900360640190fd5b6125ab826132eb565b6125fc576040805162461bcd60e51b815260206004820152601760248201527f76616c696461746f722069736e277420736c6173686564000000000000000000604482015290519081900360640190fd5b61260461478c565b8111156126425760405162461bcd60e51b8152600401808060200182810382526021815260200180615bd86021913960400191505060405180910390fd5b6000828152607a60209081526040918290208390558151838152915184927f047575f43f09a7a093d94ec483064acfc61b7e25c0de28017da442abf99cb91792908290030190a25050565b3361269881856143d1565b50600082116126dc576040805162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b6126e68185611c56565b82111561273a576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420656e6f75676820756e6c6f636b6564207374616b6500000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526071602090815260408083208784528252808320868452909152902060020154156127b1576040805162461bcd60e51b81526020600482015260136024820152727772494420616c72656164792065786973747360681b604482015290519081900360640190fd5b6001600160a01b038116600090815260726020908152604080832087845282528083208054869003905560689091529020600301546127f6908363ffffffff6141af16565b600085815260686020526040902060030155606c5461281b908363ffffffff6141af16565b606c5560008481526068602052604090205461284857606d54612844908363ffffffff6141af16565b606d555b600061285385612aa9565b905080156128fa57612863613302565b8110156128b1576040805162461bcd60e51b8152602060048201526017602482015276696e73756666696369656e742073656c662d7374616b6560481b604482015290519081900360640190fd5b6128ba856147fa565b6128f55760405162461bcd60e51b8152600401808060200182810382526029815260200180615c216029913960400191505060405180910390fd5b612905565b612905856001614662565b6001600160a01b03821660009081526071602090815260408083208884528252808320878452909152902060020183905561293e612cbd565b6001600160a01b03831660009081526071602090815260408083208984528252808320888452909152902055612972613f60565b6001600160a01b038316600090815260716020908152604080832089845282528083208884529091528120600101919091556129af908690613329565b8385836001600160a01b03167fd3bb4e423fbea695d16b982f9f682dc5f35152e5411646a8a5a79a6b02ba8d57866040518082815260200191505060405180910390a45050505050565b612a02336141f1565b612a3d5760405162461bcd60e51b8152600401808060200182810382526029815260200180615b406029913960400191505060405180910390fd5b612a85898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a91508990508888614842565b606b54881115611e3a57606b889055505050505050505050565b6203330360ec1b90565b6000818152606860209081526040808320600601546001600160a01b03168352607282528083208484529091529020545b919050565b600091825260776020908152604080842092845291905290205490565b606e5481565b6000612b0c615981565b612b1684846149f1565b805160208201516040830151929350612b3892611baf9163ffffffff61405816565b949350505050565b60009182526077602090815260408084209284526001909201905290205490565b6001600160a01b031660009081526069602052604090205490565b600390565b6000612b8d8383613549565b612b9957506000611cd9565b506001600160a01b03919091166000908152607360209081526040808320938352929052205490565b6000612bcc615981565b506001600160a01b0383166000908152606f6020908152604080832085845282529182902082516060810184528154808252600183015493820184905260029092015493810184905292612b38929091611baf919063ffffffff61405816565b612c34612e7f565b612c73576040805162461bcd60e51b81526020600482018190526024820152600080516020615b8a833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b60675460010190565b60675481565b600081815260686020526040812060060154611cd9906001600160a01b031683613549565b606a6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015612d845780601f10612d5957610100808354040283529160200191612d84565b820191906000526020600020905b815481529060010190602001808311612d6757829003601f168201915b505050505081565b606c5481565b612d9a612e7f565b612dd9576040805162461bcd60e51b81526020600482018190526024820152600080516020615b8a833981519152604482015290519081900360640190fd5b60798190556078829055604080518381526020810183905281517f702756a07c05d0bbfd06fc17b67951a5f4deb7bb6b088407e68a58969daf2a34929181900390910190a15050565b612e2c82826143d1565b612081576040805162461bcd60e51b815260206004820152601060248201526f0dcdee8d0d2dcce40e8de40e6e8c2e6d60831b604482015290519081900360640190fd5b6033546001600160a01b031690565b6033546001600160a01b0316331490565b600083815260686020526040812060060154819081908190612ebb906001600160a01b031688612b02565b905080612ed357506000925060019150829050612edf565b60675490935091508190505b93509350939050565b607360209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b612f253382346140b2565b50565b60009182526077602090815260408084209284526005909201905290205490565b336000908152607260209081526040808320848452909152902054612081908290849061368b565b612f79613302565b341015612fc7576040805162461bcd60e51b8152602060048201526017602482015276696e73756666696369656e742073656c662d7374616b6560481b604482015290519081900360640190fd5b80613008576040805162461bcd60e51b815260206004820152600c60248201526b656d707479207075626b657960a01b604482015290519081900360640190fd5b6130483383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250614a5f92505050565b61208133606b54346140b2565b6000606461306161478c565b600f028161217357fe5b607060209081526000928352604080842090915290825290205481565b6040805162461bcd60e51b815260206004820152601f60248201527f75736520534643763320756e64656c656761746528292066756e6374696f6e00604482015290519081900360640190fd5b606860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391929091906001600160a01b031687565b613123612e7f565b613162576040805162461bcd60e51b81526020600482018190526024820152600080516020615b8a833981519152604482015290519081900360640190fd5b6801c985c8903591eb208111156131c0576040805162461bcd60e51b815260206004820152601b60248201527f746f6f206c617267652072657761726420706572207365636f6e640000000000604482015290519081900360640190fd5b60758190556040805182815290517f8cd9dae1bbea2bc8a5e80ffce2c224727a25925130a03ae100619a8861ae23969181900360200190a150565b607460209081526000928352604080842090915290825290208054600182015460029092015490919083565b62093a8090565b60008181526077602090815260409182902060060180548351818402810184019094528084526060939283018282801561328757602002820191906000526020600020905b815481526020019060010190808311613273575b50505050509050919050565b61215882848361268d565b6040805162461bcd60e51b815260206004820152601d60248201527f75736520534643763320776974686472617728292066756e6374696f6e000000604482015290519081900360640190fd5b600090815260686020526040902054608016151590565b6a02a055184a310c1260000090565b607a6020526000908152604090205481565b606b5481565b61333282614a8a565b61337d576040805162461bcd60e51b81526020600482015260176024820152761d985b1a59185d1bdc88191bd95cdb89dd08195e1a5cdd604a1b604482015290519081900360640190fd5b6000828152606860205260409020600381015490541561339b575060005b6066546040805163520337df60e11b8152600481018690526024810184905290516001600160a01b039092169163a4066fbe9160448082019260009290919082900301818387803b1580156133ef57600080fd5b505af1158015613403573d6000803e3d6000fd5b5050505081801561341357508015155b15612158576066546000848152606a602052604090819020815163242a6e3f60e01b81526004810187815260248201938452825460026000196001831615610100020190911604604483018190526001600160a01b039095169463242a6e3f948994939091606490910190849080156134cd5780601f106134a2576101008083540402835291602001916134cd565b820191906000526020600020905b8154815290600101906020018083116134b057829003601f168201915b50509350505050600060405180830381600087803b1580156134ee57600080fd5b505af1158015613502573d6000803e3d6000fd5b50505050505050565b3360009081526069602052604090205461208181611a9e565b607260209081526000928352604080842090915290825290205481565b6000611cd683835b6001600160a01b038216600090815260736020908152604080832084845290915281206002015415801590611cd657506001600160a01b03831660009081526073602090815260408083208584529091529020600201546135a8613f60565b11159392505050565b6000806000806135c18888612b02565b9050806135d9575060009250600191508290506135e5565b60675490935091508190505b9450945094915050565b60755481565b60009182526077602090815260408084209284526003909201905290205490565b61208181611a9e565b600080600061362c6159a2565b505050506001600160a01b03919091166000908152607360209081526040808320938352928152908290208251608081018452815481526001820154928101839052600282015493810184905260039091015460609091018190529092565b33816136cc576040805162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b6136d68185613549565b1561371c576040805162461bcd60e51b81526020600482015260116024820152700616c7265616479206c6f636b656420757607c1b604482015290519081900360640190fd5b6137268185611c56565b82111561376d576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420656e6f756768207374616b6560801b604482015290519081900360640190fd5b600084815260686020526040902054156137c7576040805162461bcd60e51b815260206004820152601660248201527576616c696461746f722069736e27742061637469766560501b604482015290519081900360640190fd5b6137cf611c4f565b83101580156137e557506137e1611c47565b8311155b61382b576040805162461bcd60e51b815260206004820152601260248201527134b731b7b93932b1ba10323ab930ba34b7b760711b604482015290519081900360640190fd5b600061383984611baf613f60565b6000868152606860205260409020600601549091506001600160a01b0390811690831681146138c7576001600160a01b03811660009081526073602090815260408083208984529091529020600201548211156138c75760405162461bcd60e51b8152600401808060200182810382526028815260200180615bf96028913960400191505060405180910390fd5b6138d183876143d1565b506001600160a01b03831660009081526073602090815260408083208984529091529020848155613900612cbd565b6001808301919091556002808301859055600383018890556001600160a01b03861660008181526074602090815260408083208d845282528083208381559586018390559490930155825189815291820188905282518a9391927f138940e95abffcd789b497bf6188bba3afa5fbd22fb5c42c2f6018d1bf0f4e7892908290030190a350505050505050565b60009182526077602090815260408084209284526002909201905290205490565b600081815260686020526040812060060154819081906139d6906001600160a01b03168561361f565b9250925092509193909250565b6139ec336141f1565b613a275760405162461bcd60e51b8152600401808060200182810382526029815260200180615b406029913960400191505060405180910390fd5b600060776000613a35612cbd565b8152602001908152602001600020905060008090505b82811015613aae576000848483818110613a6157fe5b60209081029290920135600081815260688452604080822060030154948890529020839055600c860154909350613a9f91508263ffffffff61405816565b600c8501555050600101613a4b565b50613abd6006820184846159ca565b50505050565b60009182526077602090815260408084209284526004909201905290205490565b613aed336141f1565b613b285760405162461bcd60e51b8152600401808060200182810382526029815260200180615b406029913960400191505060405180910390fd5b600060776000613b36612cbd565b81526020019081526020016000209050606081600601805480602002602001604051908101604052809291908181526020018280548015613b9657602002820191906000526020600020905b815481526020019060010190808311613b82575b50505050509050613c1d82828c8c80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508b8b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250614aa192505050565b613c8c828288888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a918291850190849080828437600092019190915250614bb092505050565b613c94612cbd565b606755613c9f613f60565b600783015550607554600b820155607654600d909101555050505050505050565b6000611fe2613227565b613cd2612e7f565b613d11576040805162461bcd60e51b81526020600482018190526024820152600080516020615b8a833981519152604482015290519081900360640190fd5b612f25816151d0565b336000908152606960205260409020546120818183613d3882612aa9565b61368b565b61208181611b6a565b600080600080600080600080600080613d5d615a15565b5060008b815260686020908152604091829020825160e08101845281548082526001830154938201939093526002820154938101939093526003810154606084015260048101546080840152600581015460a0840152600601546001600160a01b031660c083015260081415613dd7576101008152613df9565b805160801415613dea5760018152613df9565b805160011415613df957600081525b6000613e048d612aa9565b9050816000015182608001518360a0015184604001518560200151856001613e39888a606001516141af90919063ffffffff16565b8960c001518a60c001518393509b509b509b509b509b509b509b509b509b509b5050509193959799509193959799565b303b1590565b600054610100900460ff1680613e885750613e88613e69565b80613e96575060005460ff16155b613ed15760405162461bcd60e51b815260040180806020018281038252602e815260200180615baa602e913960400191505060405180910390fd5b600054610100900460ff16158015613efc576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a38015612081576000805461ff00191690555050565b4290565b613f6c615981565b613f7683836143d1565b50506001600160a01b0382166000908152606f6020908152604080832084845282528083208151606081018352815480825260018301549482018590526002909201549281018390529392613fd492611baf9163ffffffff61405816565b905080614017576040805162461bcd60e51b815260206004820152600c60248201526b7a65726f207265776172647360a01b604482015290519081900360640190fd5b6001600160a01b0384166000908152606f60209081526040808320868452909152812081815560018101829055600201556140518161436a565b5092915050565b600082820183811015611cd6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6140bb82614a8a565b614106576040805162461bcd60e51b81526020600482015260176024820152761d985b1a59185d1bdc88191bd95cdb89dd08195e1a5cdd604a1b604482015290519081900360640190fd5b60008281526068602052604090205415614160576040805162461bcd60e51b815260206004820152601660248201527576616c696461746f722069736e27742061637469766560501b604482015290519081900360640190fd5b61416b838383614205565b614174826147fa565b6121585760405162461bcd60e51b8152600401808060200182810382526029815260200180615c216029913960400191505060405180910390fd5b6000611cd683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615271565b6066546001600160a01b0390811691161490565b60008111614248576040805162461bcd60e51b815260206004820152600b60248201526a1e995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b61425283836143d1565b506001600160a01b0383166000908152607260209081526040808320858452909152902054614287908263ffffffff61405816565b6001600160a01b03841660009081526072602090815260408083208684528252808320939093556068905220600301546142c7818363ffffffff61405816565b600084815260686020526040902060030155606c546142ec908363ffffffff61405816565b606c5560008381526068602052604090205461431957606d54614315908363ffffffff61405816565b606d555b614324838215613329565b60408051838152905184916001600160a01b038716917f9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb9181900360200190a350505050565b606654604080516366e7ea0f60e01b81523060048201526024810184905290516001600160a01b03909216916366e7ea0f9160448082019260009290919082900301818387803b1580156143bd57600080fd5b505af1158015611a8b573d6000803e3d6000fd5b60006143db615981565b6143e58484615308565b90506143f083615440565b6001600160a01b0385166000818152607060209081526040808320888452825280832094909455918152606f825282812086825282528290208251606081018452815481526001820154928101929092526002015491810191909152614456908261549b565b6001600160a01b0385166000818152606f60209081526040808320888452825280832085518155858301516001808301919091559582015160029182015593835260748252808320888452825291829020825160608101845281548152948101549185019190915290910154908201526144d0908261549b565b6001600160a01b03851660009081526074602090815260408083208784528252918290208351815590830151600180830191909155929091015160029091015591505092915050565b6001600160a01b03841660009081526074602090815260408083208684529091528120548190614561908490614555908763ffffffff61550d16565b9063ffffffff61556616565b6001600160a01b0387166000908152607460209081526040808320898452909152812060010154919250906145a2908590614555908863ffffffff61550d16565b905060028104820160006145ba86614555848a61550d565b6001600160a01b038a1660009081526074602090815260408083208c84529091529020549091506145f1908563ffffffff6141af16565b6001600160a01b038a1660009081526074602090815260408083208c845290915290209081556001015461462590846141af565b6001600160a01b038a1660009081526074602090815260408083208c84529091529020600101558681106146565750855b98975050505050505050565b60008281526068602052604090205415801561467d57508015155b156146aa57600082815260686020526040902060030154606d546146a69163ffffffff6141af16565b606d555b60008281526068602052604090205481111561208157600082815260686020526040902081815560020154614752576146e1612cbd565b6000838152606860205260409020600201556146fb613f60565b6000838152606860209081526040918290206001810184905560020154825190815290810192909252805184927fac4801c32a6067ff757446524ee4e7a373797278ac3c883eac5c693b4ad72e4792908290030190a25b60408051828152905183917fcd35267e7654194727477d6c78b541a553483cff7f92a055d17868d3da6e953e919081900360200190a25050565b670de0b6b3a764000090565b60008215806147ae57506147aa61478c565b8210155b156147bb575060006147f3565b6147e66001611baf6147cb61478c565b614555866147d761478c565b8a91900363ffffffff61550d16565b9050838111156147f35750825b9392505050565b600061482761480761478c565b61455561481261212b565b61481b86612aa9565b9063ffffffff61550d16565b60008381526068602052604090206003015411159050919050565b6001600160a01b038816600090815260696020526040902054156148ad576040805162461bcd60e51b815260206004820152601860248201527f76616c696461746f7220616c7265616479206578697374730000000000000000604482015290519081900360640190fd5b6001600160a01b03881660008181526069602090815260408083208b90558a8352606882528083208981556004810189905560058101889055600181018690556002810187905560060180546001600160a01b031916909417909355606a8152919020875161491e92890190615a5b565b50876001600160a01b0316877f49bca1ed2666922f9f1690c26a569e1299c2a715fe57647d77e81adfabbf25bf8686604051808381526020018281526020019250505060405180910390a381156149aa576040805183815260208101839052815189927fac4801c32a6067ff757446524ee4e7a373797278ac3c883eac5c693b4ad72e47928290030190a25b84156149e75760408051868152905188917fcd35267e7654194727477d6c78b541a553483cff7f92a055d17868d3da6e953e919081900360200190a25b5050505050505050565b6149f9615981565b614a01615981565b614a0b8484615308565b6001600160a01b0385166000908152606f602090815260408083208784528252918290208251606081018452815481526001820154928101929092526002015491810191909152909150612b38908261549b565b606b8054600101908190556121588382846000614a7a612cbd565b614a82613f60565b600080614842565b600090815260686020526040902060050154151590565b60005b8351811015611a8b57607854828281518110614abc57fe5b6020026020010151118015614ae65750607954838281518110614adb57fe5b602002602001015110155b15614b2757614b09848281518110614afa57fe5b60200260200101516008614662565b614b27848281518110614b1857fe5b60200260200101516000613329565b828181518110614b3357fe5b6020026020010151856004016000868481518110614b4d57fe5b6020026020010151815260200190815260200160002081905550818181518110614b7357fe5b6020026020010151856005016000868481518110614b8d57fe5b602090810291909101810151825281019190915260400160002055600101614aa4565b614bb8615ac9565b6040518060c001604052808551604051908082528060200260200182016040528015614bee578160200160208202803883390190505b508152602001600081526020018551604051908082528060200260200182016040528015614c26578160200160208202803883390190505b508152602001600081526020016000815260200160008152509050600060776000614c606001614c54612cbd565b9063ffffffff6141af16565b81526020810191909152604001600020600160808401526007810154909150614c87613f60565b1115614ca1578060070154614c9a613f60565b0360808301525b60005b8551811015614d6c578260800151858281518110614cbe57fe5b6020026020010151858381518110614cd257fe5b60200260200101510281614ce257fe5b0483604001518281518110614cf357fe5b602002602001018181525050614d2d83604001518281518110614d1257fe5b6020026020010151846060015161405890919063ffffffff16565b60608401528351614d5f90859083908110614d4457fe5b60200260200101518460a0015161405890919063ffffffff16565b60a0840152600101614ca4565b5060005b8551811015614e3d578260800151858281518110614d8a57fe5b60200260200101518460800151878481518110614da357fe5b60200260200101518a60000160008b8781518110614dbd57fe5b60200260200101518152602001908152602001600020540281614ddc57fe5b040281614de557fe5b0483600001518281518110614df657fe5b602002602001018181525050614e3083600001518281518110614e1557fe5b6020026020010151846020015161405890919063ffffffff16565b6020840152600101614d70565b5060005b85518110156151a8576000614e79846080015160755486600001518581518110614e6757fe5b602002602001015187602001516155a8565b9050614eb5614ea88560a0015186604001518581518110614e9657fe5b602002602001015187606001516155e9565b829063ffffffff61405816565b90506000878381518110614ec557fe5b6020908102919091018101516000818152606890925260408220600601549092506001600160a01b031690614f0184614efc613055565b615646565b6001600160a01b038316600090815260726020908152604080832087845290915290205490915080156150a857600081614f3b8587612b81565b840281614f4457fe5b049050808303614f52615981565b6001600160a01b03861660009081526073602090815260408083208a8452909152902060030154614f84908490615663565b9050614f8e615981565b614f99836000615663565b6001600160a01b0388166000908152606f602090815260408083208c84528252918290208251606081018452815481526001820154928101929092526002015491810191909152909150614fee908383615754565b6001600160a01b0388166000818152606f602090815260408083208d84528252808320855181558583015160018083019190915595820151600291820155938352607482528083208d845282529182902082516060810184528154815294810154918501919091529091015490820152615069908383615754565b6001600160a01b03881660009081526074602090815260408083208c845282529182902083518155908301516001820155910151600290910155505050505b6000848152606860205260408120600301548387039181156150da57816150cd61478c565b8402816150d657fe5b0490505b808a600101600089815260200190815260200160002054018f6001016000898152602001908152602001600020819055508b898151811061511757fe5b60200260200101518a600301600089815260200190815260200160002054018f6003016000898152602001908152602001600020819055508c898151811061515b57fe5b60200260200101518a600201600089815260200190815260200160002054018f60020160008981526020019081526020016000208190555050505050505050508080600101915050614e41565b505060a081015160088601556020810151600986015560600151600a90940193909355505050565b6001600160a01b0381166152155760405162461bcd60e51b8152600401808060200182810382526026815260200180615b1a6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156153005760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156152c55781810151838201526020016152ad565b50505050905090810190601f1680156152f25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b615310615981565b6001600160a01b03831660009081526070602090815260408083208584529091528120549061533e84615440565b9050600061534c868661576f565b9050818111156153595750805b828110156153645750815b6001600160a01b038616600081815260736020908152604080832089845282528083209383526072825280832089845290915281205482549091906153b090839063ffffffff6141af16565b905060006153c484600001548a898861582e565b90506153ce615981565b6153dc828660030154615663565b90506153ea838b8a8961582e565b91506153f4615981565b6153ff836000615663565b905061540d858c898b61582e565b9250615417615981565b615422846000615663565b905061542f838383615754565b9d9c50505050505050505050505050565b6000818152606860205260408120600201541561549357600082815260686020526040902060020154606754101561547b5750606754612ada565b50600081815260686020526040902060020154612ada565b505060675490565b6154a3615981565b60408051606081019091528251845182916154c4919063ffffffff61405816565b81526020016154e48460200151866020015161405890919063ffffffff16565b81526020016155048460400151866040015161405890919063ffffffff16565b90529392505050565b60008261551c57506000611cd9565b8282028284828161552957fe5b0414611cd65760405162461bcd60e51b8152600401808060200182810382526021815260200180615b696021913960400191505060405180910390fd5b6000611cd683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061589c565b6000826155b757506000612b38565b60006155c9868663ffffffff61550d16565b90506155df83614555838763ffffffff61550d16565b9695505050505050565b6000826155f8575060006147f3565b600061560e83614555878763ffffffff61550d16565b905061563d61561b61478c565b61455561562661215d565b61562e61478c565b8591900363ffffffff61550d16565b95945050505050565b6000611cd661565361478c565b614555858563ffffffff61550d16565b61566b615981565b60405180606001604052806000815260200160008152602001600081525090508160001461572657600061569d61215d565b6156a561478c565b03905060006156c56156b5611c47565b614555848763ffffffff61550d16565b905060006156ee6156d461478c565b614555846156e061215d565b8a910163ffffffff61550d16565b90506157136156fb61478c565b61455561570661215d565b899063ffffffff61550d16565b602085018190529003835250611cd99050565b61574961573161478c565b61455561573c61215d565b869063ffffffff61550d16565b604082015292915050565b61575c615981565b612b38615769858561549b565b8361549b565b6001600160a01b03821660009081526073602090815260408083208484529091528120600101546067546157a4858583615901565b156157b2579150611cd99050565b6157bd858584615901565b6157cc57600092505050611cd9565b808211156157df57600092505050611cd9565b80821015615812576002818301046157f8868683615901565b156158085780600101925061580c565b8091505b506157df565b8061582257600092505050611cd9565b60001901949350505050565b600081831061583f57506000612b38565b60008381526077602081815260408084208885526001908101835281852054878652938352818520898652019091529091205461589161587d61478c565b6145558961481b858763ffffffff6141af16565b979650505050505050565b600081836158eb5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156152c55781810151838201526020016152ad565b5060008385816158f757fe5b0495945050505050565b6001600160a01b03831660009081526073602090815260408083208584529091528120600101548210801590612b3857506001600160a01b03841660009081526073602090815260408083208684529091529020600201546159628361596c565b1115949350505050565b60009081526077602052604090206007015490565b60405180606001604052806000815260200160008152602001600081525090565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b828054828255906000526020600020908101928215615a05579160200282015b82811115615a055782358255916020019190600101906159ea565b50615a11929150615aff565b5090565b6040518060e0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615a9c57805160ff1916838001178555615a05565b82800160010185558215615a05579182015b82811115615a05578251825591602001919060010190615aae565b6040518060c001604052806060815260200160008152602001606081526020016000815260200160008152602001600081525090565b611a9591905b80821115615a115760008155600101615b0556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737363616c6c6572206973206e6f7420746865204e6f64654472697665724175746820636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a65646d757374206265206c657373207468616e206f7220657175616c20746f20312e3076616c696461746f72206c6f636b757020706572696f642077696c6c20656e64206561726c69657276616c696461746f7227732064656c65676174696f6e73206c696d69742069732065786365656465646c6f636b6564207374616b652069732067726561746572207468616e207468652077686f6c65207374616b65a265627a7a7231582068a2eef0a6cf0c5b39dc3f21daab05a006fbd4ba3e09bc65ee4da456a539535664736f6c63430005110032\")\n}", "title": "" }, { "docid": "66be18bcfd35f43125acf7243d6638ec", "score": "0.5007591", "text": "func (n *NodeID) ToBytes() []byte {\n\treturn n.id\n}", "title": "" }, { "docid": "d4c7ef40e417abea4c1e7d704320c73f", "score": "0.5002821", "text": "func (msg MsgClaimUSDXMintingReward) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "60405e824f39a49a55d0cd7c887c6690", "score": "0.500104", "text": "func GenSym() DataKey { return DataKey{id: atomic.AddInt32(&lastId, 1)} }", "title": "" }, { "docid": "b4b77fc7c6ab025264d4b4f8f9e734ed", "score": "0.49947777", "text": "func (g *Grammar) Compact() *Compact {\n\tgs := g.Symbol()\n\tid := gs.ID()\n\tfm := &Compact{\n\t\tRootID: id,\n\t\tMap: make(map[SymbolID]CompactEntry),\n\t}\n\tif id != EmptySymbolID {\n\t\tfm.addSymbol(gs)\n\t}\n\treturn fm\n}", "title": "" }, { "docid": "8771844418e94a001755965ce27d35ec", "score": "0.49772176", "text": "func GetContractBin() []byte {\n\treturn hexutil.MustDecode(\"0x6080604052600436106103f95760003560e01c80636f4986631161020d578063b5d8962711610128578063cfd47663116100bb578063deb6fb0d1161008a578063e59488661161006f578063e5948866146110a2578063ebdf104c146110de578063f2fde38b14611251576103f9565b8063deb6fb0d14610ff5578063e08d7e6614611025576103f9565b8063cfd4766314610f38578063cfdbb7cd14610f71578063d9a7c1f914610faa578063de67f21514610fbf576103f9565b8063c641ea28116100f7578063c641ea2814610e4d578063c65ee0e114610ec7578063c7be95de14610ef1578063cc8343aa14610f06576103f9565b8063b5d8962714610d79578063b6d9edd514610de4578063c3de580e14610e0e578063c5f530af14610e38576103f9565b80638cddb015116101a05780639fa6dd351161016f5780639fa6dd3514610ca7578063a1f0174f14610cc4578063a5a470ad14610cf4578063a778651514610d64576103f9565b80638cddb01514610bb05780638da5cb5b14610be95780638f32d59b14610c1a57806396c7ee4614610c43576103f9565b8063854873e1116101dc578063854873e114610acc5780638914d4c0146105f35780638b0e9f3f14610b6b5780638b1a0d1114610b80576103f9565b80636f49866314610a54578063715018a614610a8d5780637667180814610aa25780637cacb1d614610ab7576103f9565b80632cedb097116103185780634f864df4116102ab5780635ccfe1e81161027a5780635fab23a81161025f5780635fab23a8146109cd5780636099ecb2146109e2578063670322f814610a1b576103f9565b80635ccfe1e8146109945780635e2308d2146106aa576103f9565b80634f864df4146108395780634feb92f31461086f57806352b60bf31461091a57806354fd4d501461094a576103f9565b806341a19472116102e757806341a1947214610779578063441a3e70146107a95780634aa5ff6d146107d95780634f7c4efb14610809576103f9565b80632cedb097146106d45780632d296a9b1461070257806339b80c00146107175780633fee10a814610702576103f9565b806318f628d4116103905780631f2701521161035f5780631f270152146106385780632265f284146106955780632709275e146106aa57806328f73148146106bf576103f9565b806318f628d41461055e5780631d3ac42c146105c35780631d58179c146105f35780631e702f8314610608576103f9565b80630d7b2609116103cc5780630d7b2609146104cb57806312622d0e146104e0578063173a2c3c1461051957806318160ddd14610549576103f9565b80630135b1db146103fe578063019e2729146104435780630962ef791461048c5780630d4955e3146104b6575b600080fd5b34801561040a57600080fd5b506104316004803603602081101561042157600080fd5b50356001600160a01b0316611284565b60408051918252519081900360200190f35b34801561044f57600080fd5b5061048a6004803603608081101561046657600080fd5b508035906020810135906001600160a01b0360408201358116916060013516611296565b005b34801561049857600080fd5b5061048a600480360360208110156104af57600080fd5b50356113f3565b3480156104c257600080fd5b506104316114de565b3480156104d757600080fd5b506104316114e7565b3480156104ec57600080fd5b506104316004803603604081101561050357600080fd5b506001600160a01b0381351690602001356114ee565b34801561052557600080fd5b506104316004803603604081101561053c57600080fd5b5080359060200135611577565b34801561055557600080fd5b50610431611598565b34801561056a57600080fd5b5061048a600480360361012081101561058257600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a08101359060c08101359060e081013590610100013561159e565b3480156105cf57600080fd5b50610431600480360360408110156105e657600080fd5b50803590602001356116ef565b3480156105ff57600080fd5b506104316118b2565b34801561061457600080fd5b5061048a6004803603604081101561062b57600080fd5b50803590602001356118b7565b34801561064457600080fd5b506106776004803603606081101561065b57600080fd5b506001600160a01b038135169060208101359060400135611966565b60408051938452602084019290925282820152519081900360600190f35b3480156106a157600080fd5b50610431611998565b3480156106b657600080fd5b506104316119aa565b3480156106cb57600080fd5b506104316119c6565b3480156106e057600080fd5b506106e96119cc565b6040805192835260208301919091528051918290030190f35b34801561070e57600080fd5b506104316119d6565b34801561072357600080fd5b506107416004803603602081101561073a57600080fd5b50356119dd565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b34801561078557600080fd5b506104316004803603604081101561079c57600080fd5b5080359060200135611a1f565b3480156107b557600080fd5b5061048a600480360360408110156107cc57600080fd5b5080359060200135611a40565b3480156107e557600080fd5b50610431600480360360408110156107fc57600080fd5b5080359060200135611d57565b34801561081557600080fd5b5061048a6004803603604081101561082c57600080fd5b5080359060200135611d78565b34801561084557600080fd5b5061048a6004803603606081101561085c57600080fd5b5080359060208101359060400135611ebc565b34801561087b57600080fd5b5061048a600480360361010081101561089357600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156108c357600080fd5b8201836020820111156108d557600080fd5b803590602001918460018302840111640100000000831117156108f757600080fd5b9193509150803590602081013590604081013590606081013590608001356121aa565b34801561092657600080fd5b506104316004803603604081101561093d57600080fd5b5080359060200135612250565b34801561095657600080fd5b5061095f612271565b604080517fffffff00000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b3480156109a057600080fd5b50610431600480360360408110156109b757600080fd5b506001600160a01b038135169060200135612295565b3480156109d957600080fd5b506104316122b2565b3480156109ee57600080fd5b5061043160048036036040811015610a0557600080fd5b506001600160a01b0381351690602001356122b8565b348015610a2757600080fd5b5061043160048036036040811015610a3e57600080fd5b506001600160a01b038135169060200135612305565b348015610a6057600080fd5b5061043160048036036040811015610a7757600080fd5b506001600160a01b038135169060200135612346565b348015610a9957600080fd5b5061048a612363565b348015610aae57600080fd5b5061043161241e565b348015610ac357600080fd5b50610431612427565b348015610ad857600080fd5b50610af660048036036020811015610aef57600080fd5b503561242d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610b30578181015183820152602001610b18565b50505050905090810190601f168015610b5d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610b7757600080fd5b506104316124e6565b348015610b8c57600080fd5b5061048a60048036036040811015610ba357600080fd5b50803590602001356124ec565b348015610bbc57600080fd5b5061048a60048036036040811015610bd357600080fd5b506001600160a01b03813516906020013561258e565b348015610bf557600080fd5b50610bfe6125e9565b604080516001600160a01b039092168252519081900360200190f35b348015610c2657600080fd5b50610c2f6125f8565b604080519115158252519081900360200190f35b348015610c4f57600080fd5b50610c7c60048036036040811015610c6657600080fd5b506001600160a01b038135169060200135612609565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b61048a60048036036020811015610cbd57600080fd5b5035612643565b348015610cd057600080fd5b5061043160048036036040811015610ce757600080fd5b5080359060200135612651565b61048a60048036036020811015610d0a57600080fd5b810190602081018135640100000000811115610d2557600080fd5b820183602082011115610d3757600080fd5b80359060200191846001830284011164010000000083111715610d5957600080fd5b50909250905061266e565b348015610d7057600080fd5b50610431612717565b348015610d8557600080fd5b50610da360048036036020811015610d9c57600080fd5b503561272d565b604080519788526020880196909652868601949094526060860192909252608085015260a08401526001600160a01b031660c0830152519081900360e00190f35b348015610df057600080fd5b5061048a60048036036020811015610e0757600080fd5b5035612773565b348015610e1a57600080fd5b50610c2f60048036036020811015610e3157600080fd5b5035612865565b348015610e4457600080fd5b5061043161287f565b348015610e5957600080fd5b50610e7760048036036020811015610e7057600080fd5b503561288e565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610eb3578181015183820152602001610e9b565b505050509050019250505060405180910390f35b348015610ed357600080fd5b5061043160048036036020811015610eea57600080fd5b50356128f3565b348015610efd57600080fd5b50610431612905565b348015610f1257600080fd5b5061048a60048036036040811015610f2957600080fd5b5080359060200135151561290b565b348015610f4457600080fd5b5061043160048036036040811015610f5b57600080fd5b506001600160a01b038135169060200135612b44565b348015610f7d57600080fd5b50610c2f60048036036040811015610f9457600080fd5b506001600160a01b038135169060200135612b61565b348015610fb657600080fd5b50610431612bc9565b348015610fcb57600080fd5b5061048a60048036036060811015610fe257600080fd5b5080359060208101359060400135612bcf565b34801561100157600080fd5b506104316004803603604081101561101857600080fd5b5080359060200135612ef8565b34801561103157600080fd5b5061048a6004803603602081101561104857600080fd5b81019060208101813564010000000081111561106357600080fd5b82018360208201111561107557600080fd5b8035906020019184602083028401116401000000008311171561109757600080fd5b509092509050612f19565b3480156110ae57600080fd5b50610431600480360360808110156110c557600080fd5b5080359060208101359060408101359060600135613016565b3480156110ea57600080fd5b5061048a6004803603608081101561110157600080fd5b81019060208101813564010000000081111561111c57600080fd5b82018360208201111561112e57600080fd5b8035906020019184602083028401116401000000008311171561115057600080fd5b91939092909160208101903564010000000081111561116e57600080fd5b82018360208201111561118057600080fd5b803590602001918460208302840111640100000000831117156111a257600080fd5b9193909290916020810190356401000000008111156111c057600080fd5b8201836020820111156111d257600080fd5b803590602001918460208302840111640100000000831117156111f457600080fd5b91939092909160208101903564010000000081111561121257600080fd5b82018360208201111561122457600080fd5b8035906020019184602083028401116401000000008311171561124657600080fd5b50909250905061309c565b34801561125d57600080fd5b5061048a6004803603602081101561127457600080fd5b50356001600160a01b0316613278565b60696020526000908152604090205481565b600054610100900460ff16806112af57506112af6132da565b806112bd575060005460ff16155b6112f85760405162461bcd60e51b815260040180806020018281038252602e815260200180614a8f602e913960400191505060405180910390fd5b600054610100900460ff1615801561135e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b611367826132e0565b6067859055606680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03851617905560748490556755cfe697852e904c6073556103e86076556203f48060775580156113ec57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b336113fe8183613441565b506001600160a01b0381166000908152606f6020908152604080832085845290915290205480611475576040805162461bcd60e51b815260206004820152600c60248201527f7a65726f20726577617264730000000000000000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152606f602090815260408083208684529091528120556114a281613505565b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156114d8573d6000803e3d6000fd5b50505050565b6301e133805b90565b6212750090565b60006114fa8383612b61565b61152857506001600160a01b0382166000908152607160209081526040808320848452909152902054611571565b6001600160a01b03831660008181526072602090815260408083208684528252808320549383526071825280832086845290915290205461156e9163ffffffff61358516565b90505b92915050565b60009182526075602090815260408084209284526002909201905290205490565b60745481565b6115a7336135c7565b6115e25760405162461bcd60e51b8152600401808060200182810382526029815260200180614a456029913960400191505060405180910390fd5b6115ed8989896135db565b6001600160a01b0389166000908152606f602090815260408083208b8452909152902081905561161c87613505565b85156116e457868611156116615760405162461bcd60e51b815260040180806020018281038252602c815260200180614b2f602c913960400191505060405180910390fd5b6001600160a01b03891660008181526072602090815260408083208c84528252918290208981556001810189905560028101889055600381018790556004810186905582518781529182018a9052825190938c9390927f138940e95abffcd789b497bf6188bba3afa5fbd22fb5c42c2f6018d1bf0f4e78929081900390910190a3505b505050505050505050565b33600081815260726020908152604080832086845290915281209091908361175e576040805162461bcd60e51b815260206004820152600b60248201527f7a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b6117688286612b61565b6117b9576040805162461bcd60e51b815260206004820152600d60248201527f6e6f74206c6f636b656420757000000000000000000000000000000000000000604482015290519081900360640190fd5b805484111561180f576040805162461bcd60e51b815260206004820152601760248201527f6e6f7420656e6f756768206c6f636b6564207374616b65000000000000000000604482015290519081900360640190fd5b6118198286613441565b50600061182f826004015486846000015461370c565b6004830180548290039055825486900383556001600160a01b03841660008181526071602090815260408083208b8452825291829020805485900390558151898152908101849052815193945089937fef6c0c14fe9aa51af36acd791464dec3badbde668b63189b47bfa4e25be9b2b9929181900390910190a395945050505050565b600390565b6118c0336135c7565b6118fb5760405162461bcd60e51b8152600401808060200182810382526029815260200180614a456029913960400191505060405180910390fd5b8061194d576040805162461bcd60e51b815260206004820152600c60248201527f77726f6e67207374617475730000000000000000000000000000000000000000604482015290519081900360640190fd5b6119578282613739565b61196282600061290b565b5050565b607060209081526000938452604080852082529284528284209052825290208054600182015460029092015490919083565b60006119a26137e8565b601002905090565b600060646119b66137e8565b601e02816119c057fe5b04905090565b606d5481565b6076546077549091565b62093a8090565b607560205280600052604060002060009150905080600701549080600801549080600901549080600a01549080600b01549080600c01549080600d0154905087565b60009182526075602090815260408084209284526003909201905290205490565b33611a496148f4565b506001600160a01b038116600090815260706020908152604080832086845282528083208584528252918290208251606081018452815480825260018301549382019390935260029091015492810192909252611aed576040805162461bcd60e51b815260206004820152601560248201527f7265717565737420646f65736e27742065786973740000000000000000000000604482015290519081900360640190fd5b60208082015182516000878152606890935260409092206001015490919015801590611b29575060008681526068602052604090206001015482115b15611b4a575050600084815260686020526040902060018101546002909101545b611b526119d6565b8201611b5c6137f4565b1015611baf576040805162461bcd60e51b815260206004820152601660248201527f6e6f7420656e6f7567682074696d652070617373656400000000000000000000604482015290519081900360640190fd5b611bb76118b2565b8101611bc161241e565b1015611c14576040805162461bcd60e51b815260206004820152601860248201527f6e6f7420656e6f7567682065706f636873207061737365640000000000000000604482015290519081900360640190fd5b6001600160a01b0384166000908152607060209081526040808320898452825280832088845290915281206002015490611c4d88612865565b90506000611c6f8383607860008d8152602001908152602001600020546137f8565b6001600160a01b03881660009081526070602090815260408083208d845282528083208c845290915281208181556001810182905560020155606e8054820190559050808311611d06576040805162461bcd60e51b815260206004820152601660248201527f7374616b652069732066756c6c7920736c617368656400000000000000000000604482015290519081900360640190fd5b6001600160a01b0387166108fc611d23858463ffffffff61358516565b6040518115909202916000818181858888f19350505050158015611d4b573d6000803e3d6000fd5b50505050505050505050565b60009182526075602090815260408084209284526001909201905290205490565b611d806125f8565b611dd1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b611dda82612865565b611e2b576040805162461bcd60e51b815260206004820152601760248201527f76616c696461746f722069736e277420736c6173686564000000000000000000604482015290519081900360640190fd5b611e336137e8565b811115611e715760405162461bcd60e51b8152600401808060200182810382526021815260200180614abd6021913960400191505060405180910390fd5b6000828152607860209081526040918290208390558151838152915184927f047575f43f09a7a093d94ec483064acfc61b7e25c0de28017da442abf99cb91792908290030190a25050565b33611ec78185613441565b5060008211611f1d576040805162461bcd60e51b815260206004820152600b60248201527f7a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b611f2781856114ee565b821115611f7b576040805162461bcd60e51b815260206004820152601960248201527f6e6f7420656e6f75676820756e6c6f636b6564207374616b6500000000000000604482015290519081900360640190fd5b6001600160a01b0381166000908152607060209081526040808320878452825280832086845290915290206002015415611ffc576040805162461bcd60e51b815260206004820152601360248201527f7772494420616c72656164792065786973747300000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526071602090815260408083208784528252808320805486900390556068909152902060030154612041908363ffffffff61358516565b600085815260686020526040902060030155606c54612066908363ffffffff61358516565b606c5560008481526068602052604090205461209357606d5461208f908363ffffffff61358516565b606d555b61209c84613857565b806120ad57506120ab84613893565b155b6120e85760405162461bcd60e51b8152600401808060200182810382526029815260200180614b066029913960400191505060405180910390fd5b6120f184613893565b61210057612100846001613739565b6001600160a01b03811660009081526070602090815260408083208784528252808320868452909152902060020182905561213961241e565b6001600160a01b0382166000908152607060209081526040808320888452825280832087845290915290205561216d6137f4565b6001600160a01b038216600090815260706020908152604080832088845282528083208784529091528120600101919091556114d890859061290b565b6121b3336135c7565b6121ee5760405162461bcd60e51b8152600401808060200182810382526029815260200180614a456029913960400191505060405180910390fd5b612236898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a915089905088886138c5565b606b548811156116e457606b889055505050505050505050565b60009182526075602090815260408084209284526005909201905290205490565b7f323032000000000000000000000000000000000000000000000000000000000090565b607960209081526000928352604080842090915290825290205481565b606e5481565b6000806122c584846139b9565b506001600160a01b0385166000908152606f602090815260408083208784529091529020549091506122fd908263ffffffff613b0716565b949350505050565b60006123118383612b61565b61231d57506000611571565b506001600160a01b03919091166000908152607260209081526040808320938352929052205490565b606f60209081526000928352604080842090915290825290205481565b61236b6125f8565b6123bc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60675460010190565b60675481565b606a6020908152600091825260409182902080548351601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600186161502019093169290920491820184900484028101840190945280845290918301828280156124de5780601f106124b3576101008083540402835291602001916124de565b820191906000526020600020905b8154815290600101906020018083116124c157829003601f168201915b505050505081565b606c5481565b6124f46125f8565b612545576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60778190556076829055604080518381526020810183905281517f702756a07c05d0bbfd06fc17b67951a5f4deb7bb6b088407e68a58969daf2a34929181900390910190a15050565b6125988282613441565b611962576040805162461bcd60e51b815260206004820152601060248201527f6e6f7468696e6720746f20737461736800000000000000000000000000000000604482015290519081900360640190fd5b6033546001600160a01b031690565b6033546001600160a01b0316331490565b6072602090815260009283526040808420909152908252902080546001820154600283015460038401546004909401549293919290919085565b61264e338234613b61565b50565b600091825260756020908152604080842092845291905290205490565b61267661287f565b3410156126ca576040805162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e742073656c662d7374616b65000000000000000000604482015290519081900360640190fd5b61270a3383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c6b92505050565b61196233606b5434613b61565b600060646127236137e8565b600f02816119c057fe5b606860205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391929091906001600160a01b031687565b61277b6125f8565b6127cc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6801c985c8903591eb2081111561282a576040805162461bcd60e51b815260206004820152601b60248201527f746f6f206c617267652072657761726420706572207365636f6e640000000000604482015290519081900360640190fd5b60738190556040805182815290517f8cd9dae1bbea2bc8a5e80ffce2c224727a25925130a03ae100619a8861ae23969181900360200190a150565b60008181526068602052604090205460801615155b919050565b6a02a055184a310c1260000090565b6000818152607560209081526040918290206006018054835181840281018401909452808452606093928301828280156128e757602002820191906000526020600020905b8154815260200190600101908083116128d3575b50505050509050919050565b60786020526000908152604090205481565b606b5481565b61291482613c96565b612965576040805162461bcd60e51b815260206004820152601760248201527f76616c696461746f7220646f65736e2774206578697374000000000000000000604482015290519081900360640190fd5b60008281526068602052604090206003810154905415612983575060005b606654604080517fa4066fbe000000000000000000000000000000000000000000000000000000008152600481018690526024810184905290516001600160a01b039092169163a4066fbe9160448082019260009290919082900301818387803b1580156129f057600080fd5b505af1158015612a04573d6000803e3d6000fd5b50505050818015612a1457508015155b15612b3f576066546000848152606a60205260409081902081517f242a6e3f0000000000000000000000000000000000000000000000000000000081526004810187815260248201938452825460027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001831615610100020190911604604483018190526001600160a01b039095169463242a6e3f94899493909160649091019084908015612b055780601f10612ada57610100808354040283529160200191612b05565b820191906000526020600020905b815481529060010190602001808311612ae857829003601f168201915b50509350505050600060405180830381600087803b158015612b2657600080fd5b505af1158015612b3a573d6000803e3d6000fd5b505050505b505050565b607160209081526000928352604080842090915290825290205481565b6001600160a01b03821660009081526072602090815260408083208484529091528120600201541580159061156e57506001600160a01b0383166000908152607260209081526040808320858452909152902060020154612bc06137f4565b11159392505050565b60735481565b3381612c22576040805162461bcd60e51b815260206004820152600b60248201527f7a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b612c2c8185612b61565b15612c7e576040805162461bcd60e51b815260206004820152601160248201527f616c7265616479206c6f636b6564207570000000000000000000000000000000604482015290519081900360640190fd5b612c8881856114ee565b821115612cdc576040805162461bcd60e51b815260206004820152601060248201527f6e6f7420656e6f756768207374616b6500000000000000000000000000000000604482015290519081900360640190fd5b60008481526068602052604090205415612d3d576040805162461bcd60e51b815260206004820152601660248201527f76616c696461746f722069736e27742061637469766500000000000000000000604482015290519081900360640190fd5b612d456114e7565b8310158015612d5b5750612d576114de565b8311155b612dac576040805162461bcd60e51b815260206004820152601260248201527f696e636f7272656374206475726174696f6e0000000000000000000000000000604482015290519081900360640190fd5b6000612dc684612dba6137f4565b9063ffffffff613b0716565b6000868152606860205260409020600601549091506001600160a01b039081169083168114612e54576001600160a01b0381166000908152607260209081526040808320898452909152902060020154821115612e545760405162461bcd60e51b8152600401808060200182810382526028815260200180614ade6028913960400191505060405180910390fd5b612e5e8387613441565b506001600160a01b03831660009081526072602090815260408083208984529091529020848155612e8d61241e565b60018201556002810183905560038101869055600060048201556040805187815260208101879052815189926001600160a01b038816927f138940e95abffcd789b497bf6188bba3afa5fbd22fb5c42c2f6018d1bf0f4e78929081900390910190a350505050505050565b60009182526075602090815260408084209284526004909201905290205490565b612f22336135c7565b612f5d5760405162461bcd60e51b8152600401808060200182810382526029815260200180614a456029913960400191505060405180910390fd5b600060756000612f6b61241e565b8152602001908152602001600020905060008090505b8281101561300757600060686000868685818110612f9b57fe5b90506020020135815260200190815260200160002060030154905080836000016000878786818110612fc957fe5b90506020020135815260200190815260200160002081905550612ff98184600c0154613b0790919063ffffffff16565b600c84015550600101612f81565b506114d8600682018484614915565b6000818310613027575060006122fd565b6000838152607560208181526040808420888552600190810183528185205487865293835281852089865201909152909120546130916130656137e8565b61308589613079858763ffffffff61358516565b9063ffffffff613cad16565b9063ffffffff613d0616565b979650505050505050565b6130a5336135c7565b6130e05760405162461bcd60e51b8152600401808060200182810382526029815260200180614a456029913960400191505060405180910390fd5b6000607560006130ee61241e565b8152602001908152602001600020905060608160060180548060200260200160405190810160405280929190818152602001828054801561314e57602002820191906000526020600020905b81548152602001906001019080831161313a575b505050505090506131d582828c8c80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508b8b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613d4892505050565b613244828288888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a918291850190849080828437600092019190915250613e5792505050565b61324c61241e565b6067556132576137f4565b600783015550607354600b820155607454600d909101555050505050505050565b6132806125f8565b6132d1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61264e816143fd565b303b1590565b600054610100900460ff16806132f957506132f96132da565b80613307575060005460ff16155b6133425760405162461bcd60e51b815260040180806020018281038252602e815260200180614a8f602e913960400191505060405180910390fd5b600054610100900460ff161580156133a857600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116610100171660011790555b603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3801561196257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555050565b600080600061345085856139b9565b9150915061345d846144b6565b6001600160a01b0386166000818152607960209081526040808320898452825280832094909455918152606f825282812087825290915220546134a6908363ffffffff613b0716565b6001600160a01b0386166000818152606f60209081526040808320898452825280832094909455918152607282528281208782529091522060048101546134f3908363ffffffff613b0716565b60049091015550600191505092915050565b606654604080517f66e7ea0f0000000000000000000000000000000000000000000000000000000081523060048201526024810184905290516001600160a01b03909216916366e7ea0f9160448082019260009290919082900301818387803b15801561357157600080fd5b505af11580156113ec573d6000803e3d6000fd5b600061156e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614511565b6066546001600160a01b0390811691161490565b60008111613630576040805162461bcd60e51b815260206004820152600b60248201527f7a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b61363a8383613441565b506001600160a01b038316600090815260716020908152604080832085845290915290205461366f908263ffffffff613b0716565b6001600160a01b03841660009081526071602090815260408083208684528252808320939093556068905220600301546136af818363ffffffff613b0716565b600084815260686020526040902060030155606c546136d4908363ffffffff613b0716565b606c5560008381526068602052604090205461370157606d546136fd908363ffffffff613b0716565b606d555b6114d883821561290b565b60008061372383613085878763ffffffff613cad16565b905083811061372f5750825b90505b9392505050565b60008281526068602052604090205415801561375457508015155b1561378157600082815260686020526040902060030154606d5461377d9163ffffffff61358516565b606d555b60008281526068602052604090205481111561196257600082815260686020526040902081815560020154611962576137b86137f4565b6000838152606860205260409020600101556137d261241e565b6000838152606860205260409020600201555050565b670de0b6b3a764000090565b4290565b600082158061380e575061380a6137e8565b8210155b1561381b57506000613732565b6138466001612dba61382b6137e8565b613085866138376137e8565b8a91900363ffffffff613cad16565b905083811115613732575082613732565b60006138786138646137e8565b61308561386f611998565b61307986613893565b60008381526068602052604090206003015411159050919050565b6000818152606860209081526040808320600601546001600160a01b0316835260718252808320938352929052205490565b6001600160a01b03881660009081526069602052604090205415613930576040805162461bcd60e51b815260206004820152601860248201527f76616c696461746f7220616c7265616479206578697374730000000000000000604482015290519081900360640190fd5b6001600160a01b03881660008181526069602090815260408083208b90558a8352606882528083208981556004810189905560058101889055600181018690556002810187905560060180547fffffffffffffffffffffffff000000000000000000000000000000000000000016909417909355606a815291902087516116e492890190614960565b6001600160a01b03821660009081526079602090815260408083208484529091528120548190816139e9856144b6565b905060006139f787876145a8565b905081811115613a045750805b82811015613a0f5750815b6001600160a01b03871660008181526072602090815260408083208a84528252808320938352607182528083208a84529091528120548254909190613a5b90839063ffffffff61358516565b90506000613a6f84600001548b8988613016565b9050600080613a82838760030154614685565b91509150613a92848d8b8a613016565b9250600080613aa2856000614685565b91509150613ab2878f8b8d613016565b9450600080613ac2876000614685565b9092509050613adb82612dba888763ffffffff613b0716565b613aef82612dba888763ffffffff613b0716565b9e509e50505050505050505050505050509250929050565b60008282018381101561156e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b613b6a82613c96565b613bbb576040805162461bcd60e51b815260206004820152601760248201527f76616c696461746f7220646f65736e2774206578697374000000000000000000604482015290519081900360640190fd5b60008281526068602052604090205415613c1c576040805162461bcd60e51b815260206004820152601660248201527f76616c696461746f722069736e27742061637469766500000000000000000000604482015290519081900360640190fd5b613c278383836135db565b613c3082613857565b612b3f5760405162461bcd60e51b8152600401808060200182810382526029815260200180614b066029913960400191505060405180910390fd5b606b805460010190819055612b3f8382846000613c8661241e565b613c8e6137f4565b6000806138c5565b600090815260686020526040902060050154151590565b600082613cbc57506000611571565b82820282848281613cc957fe5b041461156e5760405162461bcd60e51b8152600401808060200182810382526021815260200180614a6e6021913960400191505060405180910390fd5b600061156e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614754565b60005b83518110156113ec57607654828281518110613d6357fe5b6020026020010151118015613d8d5750607754838281518110613d8257fe5b602002602001015110155b15613dce57613db0848281518110613da157fe5b60200260200101516008613739565b613dce848281518110613dbf57fe5b6020026020010151600061290b565b828181518110613dda57fe5b6020026020010151856004016000868481518110613df457fe5b6020026020010151815260200190815260200160002081905550818181518110613e1a57fe5b6020026020010151856005016000868481518110613e3457fe5b602090810291909101810151825281019190915260400160002055600101613d4b565b613e5f6149ce565b6040518060c001604052808551604051908082528060200260200182016040528015613e95578160200160208202803883390190505b508152602001600081526020018551604051908082528060200260200182016040528015613ecd578160200160208202803883390190505b508152602001600081526020016000815260200160008152509050600060756000613f076001613efb61241e565b9063ffffffff61358516565b81526020810191909152604001600020600160808401526007810154909150613f2e6137f4565b1115613f48578060070154613f416137f4565b0360808301525b60005b855181101561401e57613f958360800151613085878481518110613f6b57fe5b6020026020010151878581518110613f7f57fe5b6020026020010151613cad90919063ffffffff16565b83604001518281518110613fa557fe5b602002602001018181525050613fdf83604001518281518110613fc457fe5b60200260200101518460600151613b0790919063ffffffff16565b6060840152835161401190859083908110613ff657fe5b60200260200101518460a00151613b0790919063ffffffff16565b60a0840152600101613f4b565b5060005b85518110156140f5576140a0836080015161308587848151811061404257fe5b602002602001015161307987608001516130858b888151811061406157fe5b60200260200101518e60000160008f8b8151811061407b57fe5b6020026020010151815260200190815260200160002054613cad90919063ffffffff16565b83518051839081106140ae57fe5b6020026020010181815250506140e8836000015182815181106140cd57fe5b60200260200101518460200151613b0790919063ffffffff16565b6020840152600101614022565b5060005b85518110156143d557600061413184608001516073548660000151858151811061411f57fe5b602002602001015187602001516147b9565b905061416d6141608560a001518660400151858151811061414e57fe5b602002602001015187606001516147fa565b829063ffffffff613b0716565b9050600087838151811061417d57fe5b6020908102919091018101516000818152606883526040808220600601546001600160a01b03168083526072855281832084845290945281209193506141ca856141c5612717565b614857565b6001600160a01b0384166000908152607160209081526040808320888452909152812054919250906141fc8587612305565b83028161420557fe5b04905060008183039050600080614220848760030154614685565b91509150600080614232856000614685565b6001600160a01b038b166000908152606f602090815260408083208f84529091529020549193509150614271908390612dba908763ffffffff613b0716565b6001600160a01b038a166000908152606f602090815260408083208e845290915290205560048801546142b0908290612dba908663ffffffff613b0716565b60048901555050606c54858a039450600093506142e2925090506130856142d56137e8565b859063ffffffff613cad16565b600087815260018b016020526040902054909150614306908263ffffffff613b0716565b8e60010160008881526020019081526020016000208190555061435a8b898151811061432e57fe5b60200260200101518a600301600089815260200190815260200160002054613b0790919063ffffffff16565b8e6003016000888152602001908152602001600020819055506143ae8c898151811061438257fe5b60200260200101518a600201600089815260200190815260200160002054613b0790919063ffffffff16565b600096875260028f016020526040909620959095555050600190940193506140f992505050565b505060a081015160088601556020810151600986015560600151600a90940193909355505050565b6001600160a01b0381166144425760405162461bcd60e51b8152600401808060200182810382526026815260200180614a1f6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600081815260686020526040812060020154156145095760008281526068602052604090206002015460675410156144f1575060675461287a565b5060008181526068602052604090206002015461287a565b505060675490565b600081848411156145a05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561456557818101518382015260200161454d565b50505050905090810190601f1680156145925780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03821660009081526072602090815260408083208484529091528120600101546067546145dd858583614874565b156145eb5791506115719050565b6145f6858584614874565b61460557600092505050611571565b8082111561461857600092505050611571565b8082101561464b57600281830104614631868683614874565b1561464157806001019250614645565b8091505b50614618565b8061465b57600092505050611571565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01949350505050565b60008082156147235760006146986119aa565b6146a06137e8565b03905060006146c06146b06114de565b613085848863ffffffff613cad16565b90506146e76146cd6137e8565b613085836146d96119aa565b8a910163ffffffff613cad16565b935061471a6146f46137e8565b6130858360026147026119aa565b8161470957fe5b040189613cad90919063ffffffff16565b9250505061474d565b61474661472e6137e8565b6130856147396119aa565b879063ffffffff613cad16565b9150600090505b9250929050565b600081836147a35760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561456557818101518382015260200161454d565b5060008385816147af57fe5b0495945050505050565b6000826147c8575060006122fd565b60006147da868663ffffffff613cad16565b90506147f083613085838763ffffffff613cad16565b9695505050505050565b60008261480957506000613732565b600061481f83613085878763ffffffff613cad16565b905061484e61482c6137e8565b6130856148376119aa565b61483f6137e8565b8591900363ffffffff613cad16565b95945050505050565b600061156e6148646137e8565b613085858563ffffffff613cad16565b6001600160a01b0383166000908152607260209081526040808320858452909152812060010154821080159061372f57506001600160a01b03841660009081526072602090815260408083208684529091529020600201546148d5836148df565b1115949350505050565b60009081526075602052604090206007015490565b60405180606001604052806000815260200160008152602001600081525090565b828054828255906000526020600020908101928215614950579160200282015b82811115614950578235825591602001919060010190614935565b5061495c929150614a04565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106149a157805160ff1916838001178555614950565b82800160010185558215614950579182015b828111156149505782518255916020019190600101906149b3565b6040518060c001604052806060815260200160008152602001606081526020016000815260200160008152602001600081525090565b6114e491905b8082111561495c5760008155600101614a0a56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737363616c6c6572206973206e6f7420746865204e6f64654472697665724175746820636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a65646d757374206265206c657373207468616e206f7220657175616c20746f20312e3076616c696461746f72206c6f636b757020706572696f642077696c6c20656e64206561726c69657276616c696461746f7227732064656c65676174696f6e73206c696d69742069732065786365656465646c6f636b6564207374616b652069732067726561746572207468616e207468652077686f6c65207374616b65a265627a7a72315820da3049c03b6bfaab44d6627e2b4c8571aa8cd3c36aa38f4e85c4c46d4a9318fb64736f6c634300050c0032\")\n}", "title": "" }, { "docid": "b0b256ed09b2810daa2b2745061744d6", "score": "0.497574", "text": "func (b Block) String() string {\n\treturn hex.EncodeToString(b.ID[:])\n}", "title": "" }, { "docid": "8cbea465f4ce322aeedc7538b10d95a2", "score": "0.497476", "text": "func (msg MsgBuyName) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "f6b6bd7b8ab41b538605c4259ed05d73", "score": "0.49730584", "text": "func (sid SID) Bytes() []byte {\n\treturn sid[:]\n}", "title": "" }, { "docid": "efdbaaf5383d3f493d4f392bce6ac595", "score": "0.49697813", "text": "func (f *UnknownProtoFlags) GetPrefixSIDFlagByte() byte {\n\treturn f.Flags\n}", "title": "" }, { "docid": "3b6c86f30dbf4ab5ffa8f6221e1de9eb", "score": "0.4961492", "text": "func (m MsgCancel) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))\n}", "title": "" }, { "docid": "a84aa2491bf16254d7f4f209793d3124", "score": "0.49607205", "text": "func (*ContractID) Descriptor() ([]byte, []int) {\n\treturn file_proto_BasicTypes_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a84aa2491bf16254d7f4f209793d3124", "score": "0.49607205", "text": "func (*ContractID) Descriptor() ([]byte, []int) {\n\treturn file_proto_BasicTypes_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "b291630bdfb82ac79db51798b51c723b", "score": "0.49599597", "text": "func (i TransactionID) Bytes() []byte {\n\treturn i[:]\n}", "title": "" }, { "docid": "59dc409b5de0ceae4f0ffa273d31c69e", "score": "0.49569634", "text": "func (msg MsgSetName) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "47b463d4b83f3061ba4dd8a2c0ba5bb1", "score": "0.49514544", "text": "func (msg MsgDelegateMintDeposit) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "956b136a9bef6cb422e1ddc11d7d7b6b", "score": "0.49485934", "text": "func (msg MsgDelete) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "2b8e29f1d599e68defca6f96e35ef455", "score": "0.4945676", "text": "func (id ObjectID) Hex() string {\n\treturn primitive.ObjectID(id).Hex()\n}", "title": "" }, { "docid": "e201114185171dcb48efd1f65a6de74b", "score": "0.49366528", "text": "func (msg MsgRecordUnpeg) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "ca36e65b687cc98deacaf8da34059c54", "score": "0.49337944", "text": "func (msg MsgCreateChannel) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(&msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "65170a9e96285975420482a82585f425", "score": "0.4924877", "text": "func (msg MsgTokenMint) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(msgCdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "c9d9b929efb19b2e47e808b2ed0384c0", "score": "0.4918884", "text": "func (_CardBattles *CardBattlesSession) Symbol() (string, error) {\n\treturn _CardBattles.Contract.Symbol(&_CardBattles.CallOpts)\n}", "title": "" }, { "docid": "af311e8b3937a0e45d99937a59291682", "score": "0.49156037", "text": "func buildBytesID(id string) []byte {\n\treturn []byte(buildID(id))\n}", "title": "" }, { "docid": "51919aeeb377f59a4a06021bb4fce519", "score": "0.49129474", "text": "func (u Uint160) String() string {\n\treturn hex.EncodeToString(u.ToSlice())\n}", "title": "" }, { "docid": "e179a856cb8fdbbf22408c6dcdb84496", "score": "0.49113998", "text": "func (m MsgAnchor) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))\n}", "title": "" }, { "docid": "6ec5c8b2dcd03fb06bb9a31e41fa2ca2", "score": "0.49089125", "text": "func (msg MsgDelete) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(cdc.MustMarshalJSON(msg))\n}", "title": "" }, { "docid": "0e84db114e50480effe0e2911fa6e52d", "score": "0.49049938", "text": "func (msg MsgNewCosignerInvited) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "e26e25ede2513305792192b8c1eaddfb", "score": "0.49002603", "text": "func (msg MsgUpgrade) GetSignBytes() []byte {\n\tbz := ModuleCdc.MustMarshalJSON(msg)\n\treturn sdk.MustSortJSON(bz)\n}", "title": "" }, { "docid": "6de442b016008469d81b9eda74a56662", "score": "0.4895874", "text": "func (msg MsgWithdrawProgram) GetSignBytes() []byte {\n\treturn sdk.MustSortJSON(msgCdc.MustMarshalJSON(msg))\n}", "title": "" } ]
8158ad5a073576ef001728b7ad6b1f56
processEthDAta switches by kind of element to store the obtained content in the DB, for further processing. (i.e. making it available to IPFS)
[ { "docid": "5b675901bf6973c8867f799341dd65ad", "score": "0.5898337", "text": "func (e *EthManager) processEthData(kind, key, value string) error {\n\t// DEBUG\n\tlog.Printf(\"DEBUG: Processing the result for %v %v\", kind, key)\n\t// DEBUG\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "71e7d6f8a8d5104154aff59aba4ab31a", "score": "0.51548576", "text": "func extractData(PC processedCandidate, types []filteredHTLCType, chain string) (*htlc, error) {\n\tlength := len(PC.Ops)\n\ttypeFound := false\n\tmatchingType := \"\"\n\tmatchingTypeNumber := -1\n\t\n\tif chain == \"dcr\" {\n\t\tfor i, op := range(PC.Ops) {\n\t\t\t// dcr replaced OP_SHA256 with OP_BLAKE256\n\t\t\tif op == \"OP_SHA256\" {\n\t\t\t\tPC.Ops[i] = \"OP_BLAKE256\"\n\t\t\t}\n\t\t\t// and moved OP_SHA256 to OP_UNKNOWN192\n\t\t\tif op == \"OP_UNKNOWN192\" {\n\t\t\t\tPC.Ops[i] = \"OP_SHA256\"\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// iterate over all types\n\tfor i, thisType := range(types) {\n\t\t\n\t\t// if length is not matching, continue\n\t\tif length != thisType.Length {\n\t\t\tcontinue\n\t\t}\n\t\t\n\t\t// iterate over all ops\n\t\tfor j, op := range(PC.Ops) {\n\t\t\t\n\t\t\t// if it is an OP_DATA opcode\n\t\t\tif strings.Contains(op, \" \") {\n\t\t\t\tindex := strings.Index(op, \" \")\n\t\t\t\top = op[:index]\n\t\t\t}\n\t\t\t\n\t\t\t// if it is an OP_1 ... OP_16 opcode\n\t\t\tif len(op) == 4 || (len(op) == 5 && strings.HasPrefix(op, \"OP_1\")) {\n\t\t\t\t// replace them with OP_\n\t\t\t\t// as locktimes can be set with OP_1 ... OP_16\n\t\t\t\t// but HTLCs with different locktimes can nonetheless be part of the same AS\n\t\t\t\top = \"OP_\"\n\t\t\t}\n\t\t\t\n\t\t\t// if they are not matching, break the search\n\t\t\tif op != thisType.Ops[j] {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t\n\t\t\t// if it is the last round and it did not break yet\n\t\t\tif j == (length - 1) {\n\t\t\t\ttypeFound = true\n\t\t\t\tmatchingType = thisType.Name\n\t\t\t\tmatchingTypeNumber = i\n\t\t\t}\n\t\t}\n\t\t\n\t\t// if the matching type was found, break\n\t\tif typeFound {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\t// if no matching type found, return an error\n\tif !typeFound {\n\t\treturn nil, fmt.Errorf(\"No matching type found!\")\n\t}\n\t\n\tvar thisType filteredHTLCType\n\tthisType = types[matchingTypeNumber]\n\tindex := 0\n\t\n\t// get the timelock\n\tthisOp := PC.Ops[thisType.LocktimePos]\n\ttimelock := \"\"\n\tif strings.Contains(thisOp, \" \") {\n\t\tindex = strings.Index(thisOp, \" \") + 1\n\t\ttimelock = thisOp[index:]\n\t} else {\n\t\ttimelock = thisOp[3:]\n\t}\n\t\n\t\n\tpubKeys1 := []string{}\n\t// get the public keys 1\n\tfor _, pkPos := range(thisType.PublicKeys1Pos) {\n\t\tthisOp = PC.Ops[pkPos]\n\t\tindex = strings.Index(thisOp, \" \") + 1\n\t\tpubKeys1 = append(pubKeys1, thisOp[index:])\n\t}\n\t\n\t// get the public key 2\n\tthisOp = PC.Ops[thisType.PublicKey2Pos]\n\tindex = strings.Index(thisOp, \" \") + 1\n\tpubKey2 := thisOp[index:]\n\t\n\tsecretHashes := []string{}\n\t// get the secret hashes\n\tfor _, shPos := range(thisType.SecrethashPos) {\n\t\tthisOp = PC.Ops[shPos]\n\t\tindex = strings.Index(thisOp, \" \") + 1\n\t\tsecretHashes = append(secretHashes, thisOp[index:])\n\t}\n\t\n\tsecrets := []string{}\n\tasmLength := len(PC.Asm)\n//\thashType := 0\n\t\n\t// Das Nachfolgende ist ein ziemliches Wirr-Warr...\n\t// Hier werden abhängig vom identifizierten HTLC-Typen die Secrets identifiziert.\n\t// Da die meisten HTLCs mit einem IF beginnen, muss geprüft werden, in welchen Zwieg es geht (== \"0\" oder != \"0\").\n\t// Abhängig vom Typ befindet sich das Secret an unterschiedlichen Stellen im ASM.\n\tswitch matchingType {\n\tcase \"Type1a\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 1\n\tcase \"Type1b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 1\n\tcase \"Type2\":\n\t\tsecrets = append(secrets, PC.Asm[asmLength - 2])\n//\t\thashType = 1\n\tcase \"Type3a\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 1\n\tcase \"Type3b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 1\n\tcase \"Type3c\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 1\n\tcase \"Type4\":\n\t\tsecrets = append(secrets, PC.Asm[asmLength - 2])\n//\t\thashType = 2\n\tcase \"Type5a\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 2\n\tcase \"Type5b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 2\n\tcase \"Type6a\":\n\t\tsecrets = append(secrets, PC.Asm[asmLength - 2])\n//\t\thashType = 2\n\tcase \"Type6b\":\n\t\tsecrets = append(secrets, PC.Asm[asmLength - 2])\n//\t\thashType = 2\n\tcase \"Type7\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 3\n\tcase \"Type8a\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tfor i := 15; i > 0; i-- {\n\t\t\t\tsecrets = append(secrets, PC.Asm[i])\n\t\t\t}\n\t\t} else {\n\t\t\tfor i := 15; i > 0; i-- {\n\t\t\t\tsecrets = append(secrets, \"none\")\n\t\t\t}\n\t\t}\n//\t\thashType = 2\n\tcase \"Type8b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tfor i := 15; i > 0; i-- {\n\t\t\t\tsecrets = append(secrets, PC.Asm[i])\n\t\t\t}\n\t\t} else {\n\t\t\tfor i := 15; i > 0; i-- {\n\t\t\t\tsecrets = append(secrets, \"none\")\n\t\t\t}\n\t\t}\n//\t\thashType = 2\n\tcase \"Type9a\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type9b\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type10a\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 4])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type10b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 4])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type11\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type12\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 5])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type13\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type14\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 5])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type15\":\n\t\tif PC.Asm[asmLength - 2] == \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 5])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type16\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type17\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type18\":\n\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n//\t\thashType = 4\n\tcase \"Type19a\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type19b\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type19c\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\tcase \"Type20\":\n\t\tif PC.Asm[asmLength - 2] != \"0\" {\n\t\t\tsecrets = append(secrets, PC.Asm[asmLength - 3])\n\t\t} else {\n\t\t\tsecrets = append(secrets, \"none\")\n\t\t}\n//\t\thashType = 4\n\t}\n\t\n//\tfoundCount := 0\n//\t\n//\tif secrets[0] != \"none\" {\n//\t\tfor i, thisSecret := range(secrets) {\n//\t\t\tnewHash := []byte{}\n//\t\t\t\n//\t\t\tswitch hashType {\n//\t\t\t\tcase 1:\n//\t\t\t\t\tthisHash := sha256.New()\n//\t\t\t\t\thexByte, err := hex.DecodeString(thisSecret)\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\n//\t\t\t\t\tthisHash.Write(hexByte)\n//\t\t\t\t\tnewHash = thisHash.Sum(nil)\n//\t\t\t\tcase 2:\n//\t\t\t\t\tthisHash := ripemd160.New()\n//\t\t\t\t\thexByte, err := hex.DecodeString(thisSecret)\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\n//\t\t\t\t\tthisHash.Write(hexByte)\n//\t\t\t\t\tnewHash = thisHash.Sum(nil)\n//\t\t\t\tcase 3:\n//\t\t\t\t\tthisHash := ripemd160.New()\n//\t\t\t\t\thexByte, err := hex.DecodeString(thisSecret)\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\n//\t\t\t\t\tthisHash.Write(hexByte)\n//\t\t\t\t\tnewHash = thisHash.Sum(nil)\n//\t\t\t\t\t\n//\t\t\t\t\tthisHash.Write(newHash)\n//\t\t\t\t\tnewHash = thisHash.Sum(nil)\n//\t\t\t\t\t\n//\t\t\t\t\tthisHash.Write(newHash)\n//\t\t\t\t\tnewHash = thisHash.Sum(nil)\n//\t\t\t\tcase 4:\n//\t\t\t\t\tthisHash1 := sha256.New()\n//\t\t\t\t\thexByte, err := hex.DecodeString(thisSecret)\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\n//\t\t\t\t\tthisHash1.Write(hexByte)\n//\t\t\t\t\tshaHash := thisHash1.Sum(nil)\n//\t\t\t\t\t\n//\t\t\t\t\tthisHash2 := ripemd160.New()\n//\t\t\t\t\tthisHash2.Write(shaHash)\n//\t\t\t\t\tnewHash = thisHash2.Sum(nil)\n//\t\t\t}\n//\t\t\t\n//\t\t\tthisSecretHash := secretHashes[i]\n//\t\t\t\n//\t\t\tif hex.EncodeToString(newHash) == thisSecretHash {\n//\t\t\t\tfoundCount++\n//\t\t\t}\n//\t\t}\n//\t\t\n//\t\tif foundCount != len(secrets) && !(foundCount == 1 && matchingType == \"Type18\") {\n//\t\t\treturn nil, fmt.Errorf(\"Not all Secrets are matching.\")\n//\t\t}\n//\t}\n\t\n\tnewHTLC := new(htlc)\n\t\n\t*newHTLC = htlc{\n\t\tChain: chain,\n\t\tBlock: PC.Block,\n\t\tTimestamp: PC.Timestamp,\n\t\tTransaction: PC.Transaction,\n\t\tInputTx: PC.InputTx,\n\t\tInputValue: PC.InputValue,\n\t\tType: matchingType,\n\t\tTimelock: timelock,\n\t\tPubKeys1: pubKeys1,\n\t\tPubKey2: pubKey2,\n\t\tSecrets: secrets,\n\t\tSecretHashes: secretHashes,\n\t}\n\t\n\treturn newHTLC, nil\n}", "title": "" }, { "docid": "0228c3b7d5d3c46b87ccb5b4d7fc5cb5", "score": "0.47214454", "text": "func GenerateL2switchingDomainActionLnletEntryDs(oc *TomiObjectContext, tmTpidValue []byte, tmVidValue []byte) gopacket.SerializableLayer {\n\n\ttibitData := &L2switchingDomainRequest{\n\t\t// IEEE 1904.2\n\t\tOpcode: 0x03,\n\t\t// OAM Protocol\n\t\tFlags: 0x0050,\n\t\tOAMPDUCode: 0xfe,\n\t\tOUId: []byte{0x2a, 0xea, 0x15},\n\t\t// TiBit OLT Management Interface\n\t\tTOMIOpcode: 0x03,\n\t\t// Correlation Tag\n\t\tCTBranch: 0x0c,\n\t\tCTType: 0x0c7a,\n\t\tCTLength: 4,\n\t\tCTInstance: getOltInstance(),\n\t\t// Object Context\n\t\tOCBranch: oc.Branch,\n\t\tOCType: oc.Type,\n\t\tOCLength: oc.Length,\n\t\tOCInstance: oc.Instance,\n\t\t// Vc\n\t\tVcBranch: 0x5d,\n\t\tVcLeaf: 0x7001,\n\t\t//VcLength: uint8(24 + len(tmTpidValue) + len(tmVidValue)), //27\n\t\tVcLength: uint8(23 + len(tmTpidValue) + len(tmVidValue)), //26\n\t\t// Source OC\n\t\tSOLength: 5,\n\t\tSOBranch: 0x0c,\n\t\tSOType: 0x0eca,\n\t\tSOValLength: 1,\n\t\tSOInstance: 0x00,\n\t\t// TagMatchList\n\t\t//TMLLength: uint8(7 + len(tmTpidValue) + len(tmVidValue)), //10\n\t\tTMLLength: uint8(6 + len(tmTpidValue) + len(tmVidValue)), //9\n\t\tTMLList: []TpidVid{\n\t\t\t{Length: uint8(2 + len(tmTpidValue) + len(tmVidValue)),\n\t\t\t\tTpIDLength: uint8(len(tmTpidValue)),\n\t\t\t\tTpIDValue: tmTpidValue,\n\t\t\t\tVIdLength: uint8(len(tmVidValue)),\n\t\t\t\tVIdValue: tmVidValue},\n\t\t\t////{Length: 5, TpIdLength: 2, TpIdValue: []byte{0x88, 0xa8}, VIdLength: 1, VIdValue: []byte{0x64}}\n\n\t\t\t//{Length: 3, TpIdLength: 128, TpIdValue: []byte{0}, VIdLength: 1, VIdValue: []byte{0x00}}},\n\t\t\t{Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0x00}}},\n\t\t// TagOpPop(UI)\n\t\tTOPopLength: 1,\n\t\tTOPopValue: 0x01,\n\t\t// TagOpSetList\n\t\tTOSLength: 3,\n\t\tTOSList: []TpidVid{\n\t\t\t{Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0}}},\n\t\t// TagOpPushList\n\t\tTOPushLength: 3,\n\t\tTOPushList: []TpidVid{\n\t\t\t{Length: 2, TpIDLength: 128, TpIDValue: []byte{0}, VIdLength: 128, VIdValue: []byte{0}}},\n\t\t// End\n\t\tEndBranch: 0x00,\n\t}\n\n\treturn tibitData\n}", "title": "" }, { "docid": "833643ec38047381c399a5ad7dce46ba", "score": "0.46045268", "text": "func (e *EthManager) dispatcher(kind, key string) {\n\t// add it to our query manager\n\tqmKey := \"kind\" + \"_\" + \"key\"\n\te.qm.addQuery(qmKey)\n\n\tvalue, err := e.rpcCall(kind, key)\n\tif err != nil {\n\t\tlog.Printf(\"Error on RPC Call (%v) (%v)\", kind, key)\n\t\treturn\n\t}\n\n\tif err = e.processEthData(kind, key, value); err != nil {\n\t\tlog.Printf(\"Error on Eth Data processing (%v) (%v)\", kind, key)\n\t\treturn\n\t}\n\n\t// we good?\n\t// remove the kind/key from the manager\n\te.qm.removeQuery(qmKey)\n\n\t// write the sucess timestamp into the DB\n\t_, err = e.dbMap.Exec(\n\t\tupdateSuccessTSSQLQuery,\n\t\tkind,\n\t\tkey,\n\t\ttime.Now().UnixNano())\n\tif err != nil {\n\t\tlog.Printf(\"Erorr updating success_ts in (%v) (%v)\", kind, key)\n\t}\n}", "title": "" }, { "docid": "1090fabdfb5920381b1912fea9213b74", "score": "0.45594984", "text": "func fillTrunkVlansForInterface(d *db.DB, ifName *string, ifVlanInfo *ifVlan) (error) {\n var err error\n var vlanKeys []db.Key\n vlanTable, err := d.GetTable(&db.TableSpec{Name: VLAN_MEMBER_TN})\n if err != nil {\n return err\n }\n\n vlanKeys, err = vlanTable.GetKeys()\n if err != nil {\n return err\n }\n\n for _, vlanKey := range vlanKeys {\n if len(vlanKeys) < 2 {\n continue\n }\n if vlanKey.Get(1) == *ifName {\n memberPortEntry, err := d.GetEntry(&db.TableSpec{Name:VLAN_MEMBER_TN}, vlanKey)\n if err != nil {\n log.Errorf(\"Error found on fetching Vlan member info from App DB for Interface Name : %s\", *ifName)\n return err\n }\n tagInfo, ok := memberPortEntry.Field[\"tagging_mode\"]\n if ok {\n if tagInfo == \"tagged\" {\n ifVlanInfo.trunkVlans = append(ifVlanInfo.trunkVlans, vlanKey.Get(0))\n }\n }\n }\n }\n return err\n}", "title": "" }, { "docid": "220858b417459b56d9bae286fefdde76", "score": "0.45448303", "text": "func (c *central) handleReadByType(b []byte) []byte {\n\tstart, end := readHandleRange(b[:4])\n\tt := UUID{b[4:]}\n\n\tw := newL2capWriter(c.mtu)\n\tw.WriteByteFit(attOpReadByTypeRsp)\n\tuuidLen := -1\n\tfor _, a := range c.attrs.Subrange(start, end) {\n\t\tif !a.typ.Equal(t) {\n\t\t\tcontinue\n\t\t}\n\t\tif (a.secure&CharRead) != 0 && c.security > securityLow {\n\t\t\treturn attErrorRsp(attOpReadByTypeReq, start, attEcodeAuthentication)\n\t\t}\n\t\tv := a.value\n\t\tif v == nil {\n\t\t\trsp := newResponseWriter(int(c.mtu - 1))\n\t\t\treq := &ReadRequest{\n\t\t\t\tRequest: Request{Central: c},\n\t\t\t\tCap: int(c.mtu - 1),\n\t\t\t\tOffset: 0,\n\t\t\t}\n\t\t\tif c, ok := a.pvt.(*Characteristic); ok {\n\t\t\t\tc.rhandler.ServeRead(rsp, req)\n\t\t\t} else if d, ok := a.pvt.(*Descriptor); ok {\n\t\t\t\td.rhandler.ServeRead(rsp, req)\n\t\t\t}\n\t\t\tv = rsp.bytes()\n\t\t}\n\t\tif uuidLen == -1 {\n\t\t\tuuidLen = len(v)\n\t\t\tw.WriteByteFit(byte(uuidLen) + 2)\n\t\t}\n\t\tif len(v) != uuidLen {\n\t\t\tbreak\n\t\t}\n\t\tw.Chunk()\n\t\tw.WriteUint16Fit(a.h)\n\t\tw.WriteFit(v)\n\t\tif ok := w.Commit(); !ok {\n\t\t\tbreak\n\t\t}\n\t}\n\tif uuidLen == -1 {\n\t\treturn attErrorRsp(attOpReadByTypeReq, start, attEcodeAttrNotFound)\n\t}\n\treturn w.Bytes()\n}", "title": "" }, { "docid": "5ee129f79bf8b7f472e9ecc9cd69b4ab", "score": "0.45376387", "text": "func Recupera_network_elements_u2000_y_guarda_en_db(t telnet.Telnet,tabla string){\n\tlst_ne:=\"LST NE:;\\r\\n\"\n\tfmt.Println(tabla)\t\n\tt.Write(lst_ne)\n\tne1, err := t.Read_con_tiempo(\"--- END\",60)\n\tif err != nil {\n\t\terr=nil\n\t\tfmt.Println(\"reg ne no responde\",lst_ne)\n\t}\n\t\n\t//limpia la tabla network elements\n\tqq_insertar:=[]string{\"DROP TABLE IF EXISTS \"+tabla+\"_copia;\",\n\t\"RENAME TABLE \"+tabla+\" TO \"+tabla+\"_copia;\",\n\t\"CREATE TABLE \"+tabla+\" LIKE \"+tabla+\"_copia;\",}\n\t//fmt.Println(qq_insertar)\n\tbd.Inserta_actualiza_registros_db(qq_insertar)\n\n\n\tdata:=[]byte(ne1)\n\tre := regexp.MustCompile(\" +\")\n\treplaced := re.ReplaceAll(bytes.TrimSpace(data), []byte(\" \"))\n \n\tne2:=strings.Split(string(replaced),\"\\r\\n\")\n\tvar ne3 []string\n\tre1 := regexp.MustCompile(\"[;, ] *\")\n\tfor _,v:=range ne2{\n\t\t\n\t\tne3=re1.Split(strings.Trim(v,\" \"),-1)\n\t\tif len(ne3)>2{\n\t\t\tswitch ne3[0] {\n\t\t\t\tcase\n\t\t\t\t\t\"+++\",\n\t\t\t\t\t\"%%LST\",\n\t\t\t\t\t\"RETCODE\",\n\t\t\t\t\t\"LST\",\n\t\t\t\t\t\"NE\":\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tne_type:=ne3[0]\n\t\t\tne_name:=ne3[1]\n\t\t\tip_address:=ne3[2]\n\t\t\testado:=\"operativo\"\n\t\t\thoy := time.Now().Format(time.RFC3339)\n\t\t\tupdated_at:=hoy\n\t\t\tcreated_at:=hoy\n\t\t\tinsertar_ne_a_db(tabla,ne_type,ne_name,ip_address,estado,updated_at,created_at)\n\t//\t\tfmt.Println(tabla,ne_type,ne_name,ip_address,estado,updated_at,created_at)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "912a1aa7742fcebd19681a47727e59b6", "score": "0.44771463", "text": "func (p *Parser) handleTrak(te *TrackEntry, trak *Element) error {\n\tvar el *Element\n\tvar err error\n\tfor el, err = trak.Next(); err == nil; el, err = trak.Next() {\n\t\tswitch el.Id {\n\t\tcase \"tkhd\":\n\t\t\terr = el.ParseFlags()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif el.Version == 1 {\n\t\t\t\t_, err = el.R.Seek(16, 1)\n\t\t\t} else {\n\t\t\t\t_, err = el.R.Seek(8, 1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tte.Id, err = el.readInt32()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\terr = el.Skip()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a324f15d0a4f96f2ce1b40065a297adf", "score": "0.44472706", "text": "func writeEthernetHeader(eh ethernetHeader, b []byte) {\n\tcopy(parse.GetBytes(&b, 6), eh.dst[:])\n\tcopy(parse.GetBytes(&b, 6), eh.src[:])\n\tif eh.Has8021Q() {\n\t\t// explicitly set the TPID\n\t\teh.ieee8021Q &= 0xFFFF\n\t\teh.ieee8021Q |= 0x81000000\n\t\tparse.PutUint32(&b, eh.ieee8021Q)\n\t}\n\tparse.PutUint16(&b, uint16(eh.et))\n}", "title": "" }, { "docid": "b42db27e19a1925b72551a1f210fb228", "score": "0.44285047", "text": "func (p *Parser) handleStbl(te *TrackEntry, stbl *Element) error {\n\tvar el *Element\n\tvar err error\n\tfor el, err = stbl.Next(); err == nil; el, err = stbl.Next() {\n\t\tswitch el.Id {\n\t\tcase \"stsd\":\n\t\t\terr = p.handleStsd(te, el)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\terr = el.Skip()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "65439c177710e406ab899c6dab461c9b", "score": "0.4424378", "text": "func handleConn(conn net.Conn) {\r\n\tvar c Container\r\n\tdefer conn.Close()\r\n\tdecoder := json.NewDecoder(conn)\r\n\tif err := decoder.Decode(&c); ( err != nil && err != io.EOF ){\r\n\t\tfmt.Println(\"decoder.Decode(&c) err: \", err)\r\n\t} else {\r\n\t//\tt := time.Now().UTC()\r\n\t//\tfmt.Println(\"==========================\")\r\n\t//\tfmt.Println(\"My External IP: \" + ext_ip );\r\n\t//\tfmt.Println(\"My Internal IP: \" + lan_ip );\r\n\t\tswitch c.Type {\r\n\t\tcase \"TX\":\r\n\t\t\t\tprocess_TX(c)\r\n\t\tcase \"BL\":\r\n\t\t//\tfmt.Println(\"=== RECEIVED BLOCK from other nodes\")\r\n\t\t\tprocess_BL(c)\r\n\t\tcase \"BC\":\r\n\t\t\tprocess_BC(c)\r\n\t\tcase \"PC\":\r\n\t\t\tprocess_PC(c)\r\n\t\tcase \"IP\":\r\n\t\t\tprocess_IP(c)\r\n\t\tcase \"IPS\":\r\n\t\t\tprocess_IPS(c)\r\n\r\n\t\tdefault:\r\n\t\t\tfmt.Println(\"Can not process data received\")\r\n\t\t}\r\n\t//\tspew.Dump(received_blockchain)\r\n\t}\r\n}", "title": "" }, { "docid": "6795fde7a20e5881d6945c6b05f69ac2", "score": "0.44146344", "text": "func intfVlanMemberAdd(swVlanConfig *swVlanMemberPort_t,\n inParams *XfmrParams, ifName *string,\n vlanMap map[string]db.Value,\n vlanMemberMap map[string]db.Value,\n stpVlanPortMap map[string]db.Value,\n stpPortMap map[string]db.Value, intfType E_InterfaceType) error {\n\n var err error\n var accessVlanId uint16 = 0\n var trunkVlanSlice []string\n var ifMode ocbinds.E_OpenconfigVlan_VlanModeType\n\n accessVlanFound := false\n trunkVlanFound := false\n\n intTbl := IntfTypeTblMap[IntfTypeVlan]\n vlanMembersListMap := make(map[string]map[string]db.Value)\n\n switch intfType {\n case IntfTypeEthernet:\n /* Retrieve the Access VLAN Id */\n if swVlanConfig.swEthMember == nil || swVlanConfig.swEthMember.Config == nil {\n errStr := \"Not supported switched-vlan request for Interface: \" + *ifName\n log.Error(errStr)\n return errors.New(errStr)\n }\n if swVlanConfig.swEthMember.Config.AccessVlan != nil {\n accessVlanId = *swVlanConfig.swEthMember.Config.AccessVlan\n log.Infof(\"Vlan id : %d observed for Untagged Member port addition configuration!\", accessVlanId)\n accessVlanFound = true\n }\n\n /* Retrieve the list of trunk-vlans */\n if swVlanConfig.swEthMember.Config.TrunkVlans != nil {\n vlanUnionList := swVlanConfig.swEthMember.Config.TrunkVlans\n if len(vlanUnionList) != 0 {\n trunkVlanFound = true\n }\n for _, vlanUnion := range vlanUnionList {\n vlanUnionType := reflect.TypeOf(vlanUnion).Elem()\n\n switch vlanUnionType {\n\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_String{}):\n val := (vlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_String)\n err = extractVlanIdsfrmRng(inParams.d, val.String, &trunkVlanSlice)\n if err != nil {\n return err\n }\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_Uint16{}):\n val := (vlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_Uint16)\n trunkVlanSlice = append(trunkVlanSlice, \"Vlan\"+strconv.Itoa(int(val.Uint16)))\n }\n }\n }\n if swVlanConfig.swEthMember.Config.InterfaceMode != ocbinds.OpenconfigVlan_VlanModeType_UNSET {\n ifMode = swVlanConfig.swEthMember.Config.InterfaceMode\n }\n case IntfTypePortChannel:\n /* Retrieve the Access VLAN Id */\n if swVlanConfig.swPortChannelMember == nil || swVlanConfig.swPortChannelMember.Config == nil {\n errStr := \"Not supported switched-vlan request for Interface: \" + *ifName\n log.Error(errStr)\n return errors.New(errStr)\n }\n if swVlanConfig.swPortChannelMember.Config.AccessVlan != nil {\n accessVlanId = *swVlanConfig.swPortChannelMember.Config.AccessVlan\n log.Infof(\"Vlan id : %d observed for Untagged Member port addition configuration!\", accessVlanId)\n accessVlanFound = true\n }\n\n /* Retrieve the list of trunk-vlans */\n if swVlanConfig.swPortChannelMember.Config.TrunkVlans != nil {\n vlanUnionList := swVlanConfig.swPortChannelMember.Config.TrunkVlans\n if len(vlanUnionList) != 0 {\n trunkVlanFound = true\n }\n for _, vlanUnion := range vlanUnionList {\n vlanUnionType := reflect.TypeOf(vlanUnion).Elem()\n\n switch vlanUnionType {\n\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_String{}):\n val := (vlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_String)\n err = extractVlanIdsfrmRng(inParams.d, val.String, &trunkVlanSlice)\n if err != nil {\n return err\n }\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_Uint16{}):\n val := (vlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_Uint16)\n trunkVlanSlice = append(trunkVlanSlice, \"Vlan\"+strconv.Itoa(int(val.Uint16)))\n }\n }\n }\n if swVlanConfig.swPortChannelMember.Config.InterfaceMode != ocbinds.OpenconfigVlan_VlanModeType_UNSET {\n ifMode = swVlanConfig.swPortChannelMember.Config.InterfaceMode\n }\n }\n\n /* Update the DS based on access-vlan/trunk-vlans config */\n if accessVlanFound {\n accessVlan := \"Vlan\" + strconv.Itoa(int(accessVlanId))\n\n err = validateVlanExists(inParams.d, &accessVlan)\n if err != nil {\n errStr := \"Invalid VLAN: \" + strconv.Itoa(int(accessVlanId))\n err = tlerr.InvalidArgsError{Format: errStr}\n log.Error(err)\n return err\n }\n var cfgredAccessVlan string\n exists, err := validateUntaggedVlanCfgredForIf(inParams.d, &intTbl.cfgDb.memberTN, ifName, &cfgredAccessVlan)\n if err != nil {\n return err\n }\n if exists {\n if cfgredAccessVlan == accessVlan {\n log.Infof(\"Untagged VLAN: %s already configured, not updating the cache!\", accessVlan)\n goto TRUNKCONFIG\n }\n vlanId := cfgredAccessVlan[len(\"Vlan\"):len(cfgredAccessVlan)]\n errStr := \"Untagged VLAN: \" + vlanId + \" configuration exists\"\n log.Error(errStr)\n err = tlerr.InvalidArgsError{Format: errStr}\n return err\n }\n if vlanMembersListMap[accessVlan] == nil {\n vlanMembersListMap[accessVlan] = make(map[string]db.Value)\n }\n vlanMembersListMap[accessVlan][*ifName] = db.Value{Field:make(map[string]string)}\n vlanMembersListMap[accessVlan][*ifName].Field[\"tagging_mode\"] = \"untagged\"\n }\n\n TRUNKCONFIG:\n if trunkVlanFound {\n memberPortEntryMap := make(map[string]string)\n memberPortEntry := db.Value{Field: memberPortEntryMap}\n memberPortEntry.Field[\"tagging_mode\"] = \"tagged\"\n for _, vlanId := range trunkVlanSlice {\n err = validateVlanExists(inParams.d, &vlanId)\n if err != nil {\n id := vlanId[len(\"Vlan\"):len(vlanId)]\n errStr := \"Invalid VLAN: \" + id\n log.Error(errStr)\n err = tlerr.InvalidArgsError{Format: errStr}\n return err\n }\n\n if vlanMembersListMap[vlanId] == nil {\n vlanMembersListMap[vlanId] = make(map[string]db.Value)\n }\n vlanMembersListMap[vlanId][*ifName] = db.Value{Field:make(map[string]string)}\n vlanMembersListMap[vlanId][*ifName].Field[\"tagging_mode\"] = \"tagged\"\n }\n }\n if accessVlanFound || trunkVlanFound {\n err = processIntfVlanMemberAdd(inParams.d, vlanMembersListMap, vlanMap, vlanMemberMap, stpVlanPortMap, stpPortMap)\n if err != nil {\n log.Info(\"Processing Interface VLAN addition failed!\")\n return err\n }\n return err\n }\n\n if ifMode == ocbinds.OpenconfigVlan_VlanModeType_UNSET {\n return nil\n }\n /* Handling the request just for setting Interface Mode */\n log.Info(\"Request is for Configuring just the Mode for Interface: \", *ifName)\n var mode intfModeReq\n\n switch ifMode {\n case ocbinds.OpenconfigVlan_VlanModeType_ACCESS:\n /* Configuring Interface Mode as ACCESS only without VLAN info*/\n mode = intfModeReq{ifName: *ifName, mode: ACCESS}\n log.Info(\"Access Mode Config for Interface: \", *ifName)\n case ocbinds.OpenconfigVlan_VlanModeType_TRUNK:\n }\n /* Switchport access/trunk mode config without VLAN */\n /* This mode will be set in the translate fn, when request is just for mode without VLAN info. */\n if mode.mode != MODE_UNSET {\n err = intfModeReqConfig(inParams.d, mode, vlanMap, vlanMemberMap)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "3ea0f1f1dcdaf985dd7932d1bae018d8", "score": "0.43615964", "text": "func processAgentData(data *agent.MsgTunData) {\n\tpayloadSplit := strings.Split(data.Payload, agent.OpSep)\n\top := payloadSplit[0]\n\n\tagent := GetTargetFromTag(data.Tag)\n\tcontrlIf := Targets[agent]\n\n\tswitch op {\n\n\t// cmd output from agent\n\tcase \"cmd\":\n\t\tcmd := payloadSplit[1]\n\t\tout := strings.Join(payloadSplit[2:], \" \")\n\t\toutLines := strings.Split(out, \"\\n\")\n\n\t\t// headless mode\n\t\tif IsHeadless {\n\t\t\t// send to socket\n\t\t\tvar resp APIResponse\n\t\t\tmsg := fmt.Sprintf(\"%s:\\n%s\", cmd, out)\n\t\t\tresp.Cmd = cmd\n\t\t\tresp.MsgData = []byte(msg)\n\t\t\tresp.Alert = false\n\t\t\tresp.MsgType = CMD\n\t\t\tdata, err := json.Marshal(resp)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"processAgentData cmd output: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_, err = APIConn.Write([]byte(data))\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"processAgentData cmd output: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\t// if cmd is `bash`, our shell is likey broken\n\t\tif strings.HasPrefix(cmd, \"bash\") {\n\t\t\tshellToken := strings.Split(cmd, \" \")[1]\n\t\t\tRShellStatus[shellToken] = fmt.Errorf(\"Reverse shell error: %v\", out)\n\t\t}\n\n\t\t// ls command\n\t\tif strings.HasPrefix(cmd, \"ls\") {\n\t\t\tvar dents []util.Dentry\n\t\t\terr = json.Unmarshal([]byte(out), &dents)\n\t\t\tif err != nil {\n\t\t\t\tCliPrintError(\"ls: %v:\\n%s\", err, out)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// write to emp3r0r console\n\t\t\tt := tabby.New()\n\t\t\tt.AddHeader(\"Name\", \"Type\", \"Size\", \"Permission\")\n\t\t\tfor _, d := range dents {\n\t\t\t\tt.AddLine(color.HiBlueString(d.Name),\n\t\t\t\t\tcolor.BlueString(d.Ftype),\n\t\t\t\t\tcolor.BlueString(d.Size),\n\t\t\t\t\tcolor.BlueString(d.Permission))\n\t\t\t}\n\t\t\tCliPrintInfo(\"Listing current path:\\n%s\", t.String())\n\t\t\tCliPrintInfo(\"End of listing\\n\")\n\t\t\treturn\n\t\t}\n\n\t\t// optimize output\n\t\tif len(outLines) > 20 {\n\t\t\tt := time.Now()\n\t\t\tlogname := fmt.Sprintf(\"%scmd-%d-%02d-%02dT%02d:%02d:%02d.log\",\n\t\t\t\tTemp,\n\t\t\t\tt.Year(), t.Month(), t.Day(),\n\t\t\t\tt.Hour(), t.Minute(), t.Second())\n\n\t\t\tCliPrintInfo(\"Output will be displayed in new window\")\n\t\t\terr := ioutil.WriteFile(logname, []byte(out), 0600)\n\t\t\tif err != nil {\n\t\t\t\tCliPrintWarning(err.Error())\n\t\t\t}\n\n\t\t\tviewCmd := fmt.Sprintf(`less -f -r %s`,\n\t\t\t\tlogname)\n\n\t\t\t// split window vertically\n\t\t\tif err = TmuxSplit(\"v\", viewCmd); err == nil {\n\t\t\t\tCliPrintSuccess(\"View result in new window (press q to quit)\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tCliPrintError(\"Failed to opent tmux window: %v\", err)\n\t\t}\n\n\t\tlog.Printf(\"\\n[%s] %s:\\n%s\\n\\n\", color.CyanString(\"%d\", contrlIf.Index), color.HiMagentaString(cmd), color.HiWhiteString(out))\n\n\t// save file from #get\n\tcase \"FILE\":\n\t\tfilepath := payloadSplit[1]\n\n\t\t// we only need the filename\n\t\tfilename := FileBaseName(filepath)\n\n\t\tb64filedata := payloadSplit[2]\n\t\tfiledata, err := base64.StdEncoding.DecodeString(b64filedata)\n\t\tif err != nil {\n\t\t\tCliPrintError(\"processAgentData failed to decode file data: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// save to /tmp for security\n\t\tif _, err := os.Stat(FileGetDir); os.IsNotExist(err) {\n\t\t\terr = os.MkdirAll(FileGetDir, 0700)\n\t\t\tif err != nil {\n\t\t\t\tCliPrintError(\"mkdir -p /tmp/emp3r0r/file-get: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\terr = ioutil.WriteFile(FileGetDir+filename, filedata, 0600)\n\t\tif err != nil {\n\t\t\tCliPrintError(\"processAgentData failed to save file: %v\", err)\n\t\t\treturn\n\t\t}\n\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "4d06b5af04774bb4e43736cdd60cf146", "score": "0.43363595", "text": "func processIntfVlanMemberAdd(d *db.DB, vlanMembersMap map[string]map[string]db.Value, vlanMap map[string]db.Value,\n vlanMemberMap map[string]db.Value, stpVlanPortMap map[string]db.Value,\n stpPortMap map[string]db.Value) error {\n var err error\n var isMembersListUpdate bool\n\n /* Updating the VLAN member table */\n for vlanName, ifEntries := range vlanMembersMap {\n log.Info(\"Processing VLAN: \", vlanName)\n var memberPortsListStrB strings.Builder\n var memberPortsList []string\n var stpInterfacesList []string\n isMembersListUpdate = false\n\n vlanEntry, _ := d.GetEntry(&db.TableSpec{Name:VLAN_TN}, db.Key{Comp: []string{vlanName}})\n if !vlanEntry.IsPopulated() {\n errStr := \"Failed to retrieve memberPorts info of VLAN : \" + vlanName\n log.Error(errStr)\n return errors.New(errStr)\n }\n memberPortsExists := false\n memberPortsListStr, ok := vlanEntry.Field[\"members@\"]\n if ok {\n if len(memberPortsListStr) != 0 {\n memberPortsListStrB.WriteString(vlanEntry.Field[\"members@\"])\n memberPortsList = generateMemberPortsSliceFromString(&memberPortsListStr)\n memberPortsExists = true\n }\n }\n\n for ifName, ifEntry := range ifEntries {\n log.Infof(\"Processing Interface: %s for VLAN: %s\", ifName, vlanName)\n /* Adding the following validation, just to avoid an another db-get in translate fn */\n /* Reason why it's ignored is, if we return, it leads to sync data issues between VlanT and VlanMembT */\n if memberPortsExists {\n var existingIfMode intfModeType\n if checkMemberPortExistsInListAndGetMode(d, memberPortsList, &ifName, &vlanName, &existingIfMode) {\n /* Since translib doesn't support rollback, we need to keep the DB consistent at this point,\n and throw the error message */\n var cfgReqIfMode intfModeType\n tagMode := ifEntry.Field[\"tagging_mode\"]\n convertTaggingModeToInterfaceModeType(&tagMode, &cfgReqIfMode)\n\n if cfgReqIfMode == existingIfMode {\n continue\n } else {\n vlanId := vlanName[len(\"Vlan\"):len(vlanName)]\n var errStr string\n switch existingIfMode {\n case ACCESS:\n errStr = \"Untagged VLAN: \" + vlanId + \" configuration exists for Interface: \" + ifName\n case TRUNK:\n errStr = \"Tagged VLAN: \" + vlanId + \" configuration exists for Interface: \" + ifName\n }\n log.Error(errStr)\n return tlerr.InvalidArgsError{Format: errStr}\n }\n }\n }\n\n isMembersListUpdate = true\n stpInterfacesList = append(stpInterfacesList, ifName)\n vlanMemberKey := vlanName + \"|\" + ifName\n vlanMemberMap[vlanMemberKey] = db.Value{Field:make(map[string]string)}\n vlanMemberMap[vlanMemberKey].Field[\"tagging_mode\"] = ifEntry.Field[\"tagging_mode\"] \n log.Infof(\"Updated Vlan Member Map with vlan member key: %s and tagging-mode: %s\", vlanMemberKey, ifEntry.Field[\"tagging_mode\"])\n\n if len(memberPortsList) == 0 && len(ifEntries) == 1 {\n memberPortsListStrB.WriteString(ifName)\n } else {\n memberPortsListStrB.WriteString(\",\" + ifName)\n }\n }\n log.Infof(\"Member ports = %s\", memberPortsListStrB.String())\n if !isMembersListUpdate {\n continue\n }\n vlanMap[vlanName] = db.Value{Field:make(map[string]string)}\n vlanMap[vlanName].Field[\"members@\"] = memberPortsListStrB.String()\n enableStpOnInterfaceVlanMembership(d, &vlanName, stpInterfacesList, stpVlanPortMap, stpPortMap)\n\n log.Infof(\"Updated VLAN Map with VLAN: %s and Member-ports: %s\", vlanName, memberPortsListStrB.String())\n }\n return err\n}", "title": "" }, { "docid": "c5c90d31ec311aef4ee4adeec8948f84", "score": "0.43298984", "text": "func GenerateL2switchingDomainActionLnletEntryUs(oc *TomiObjectContext,\n\tpushTpidValue []byte, pushVidValue []byte, onuID *TomiObjectContext) gopacket.SerializableLayer {\n\n\ttibitData := &L2switchingDomainRequest{\n\t\t// IEEE 1904.2\n\t\tOpcode: 0x03,\n\t\t// OAM Protocol\n\t\tFlags: 0x0050,\n\t\tOAMPDUCode: 0xfe,\n\t\tOUId: []byte{0x2a, 0xea, 0x15},\n\t\t// TiBit OLT Management Interface\n\t\tTOMIOpcode: 0x03,\n\t\t// Correlation Tag\n\t\tCTBranch: 0x0c,\n\t\tCTType: 0x0c7a,\n\t\tCTLength: 4,\n\t\tCTInstance: getOltInstance(),\n\t\t// Object Context\n\t\tOCBranch: oc.Branch,\n\t\tOCType: oc.Type,\n\t\tOCLength: oc.Length,\n\t\tOCInstance: oc.Instance,\n\t\t// Vc\n\t\tVcBranch: 0x5d,\n\t\tVcLeaf: 0x7001,\n\t\tVcLength: uint8(24 + len(pushTpidValue) + len(pushVidValue)), //27\n\t\t// Source OC\n\t\tSOLength: 5,\n\t\tSOBranch: 0x0c,\n\t\tSOType: 0x0011,\n\t\tSOValLength: 1,\n\t\tSOInstance: uint8(onuID.Instance),\n\t\t// TagMatchList\n\t\tTMLLength: 7,\n\t\tTMLList: []TpidVid{\n\t\t\t{\n\t\t\t\tLength: 3,\n\t\t\t\tTpIDLength: 0x80,\n\t\t\t\tTpIDValue: []byte{0},\n\t\t\t\tVIdLength: 1,\n\t\t\t\tVIdValue: []byte{0x00},\n\t\t\t},\n\t\t\t{\n\t\t\t\tLength: 2,\n\t\t\t\tTpIDLength: 0x80,\n\t\t\t\tTpIDValue: []byte{0},\n\t\t\t\tVIdLength: 0x80,\n\t\t\t\tVIdValue: []byte{0},\n\t\t\t}},\n\t\t// TagOpPop(UI)\n\t\tTOPopLength: 1,\n\t\tTOPopValue: 0x00,\n\t\t// TagOpSetList\n\t\tTOSLength: 3,\n\t\tTOSList: []TpidVid{\n\t\t\t{\n\t\t\t\tLength: 2,\n\t\t\t\tTpIDLength: 0x80,\n\t\t\t\tTpIDValue: []byte{0},\n\t\t\t\tVIdLength: 0x80,\n\t\t\t\tVIdValue: []byte{0},\n\t\t\t}},\n\t\t// TagOpPushList\n\t\tTOPushLength: uint8(3 + len(pushTpidValue) + len(pushVidValue)), //6\n\t\tTOPushList: []TpidVid{\n\t\t\t{Length: uint8(2 + len(pushTpidValue) + len(pushVidValue)),\n\t\t\t\tTpIDLength: uint8(len(pushTpidValue)),\n\t\t\t\tTpIDValue: pushTpidValue,\n\t\t\t\tVIdLength: uint8(len(pushVidValue)),\n\t\t\t\tVIdValue: pushVidValue}}, ///{Length: 5, TpIdLength: 2, TpIdValue: []byte{0x88, 0xa8}, VIdLength: 1, VIdValue: []byte{0x64}}\n\t\t// End\n\t\tEndBranch: 0x00,\n\t}\n\n\treturn tibitData\n}", "title": "" }, { "docid": "e85803d1cc221c6a36baf7a852e4da2b", "score": "0.43233415", "text": "func writeDataToPsql(psql *db.Transaction, data *DataLine, numProcess int) (int, error) {\n\t// 1. Разбираем данные\n\t// 2. Фильтруем данные\n\t// 3. Сохраняем actions\n\tjsonData := map[string]interface{}{}\n\terr := json.Unmarshal([]byte(data.Line), &jsonData)\n\tif err != nil {\n\t\tapp.Error.Printf(\"Error unmarhsul JSON data: %s\", err)\n\t\treturn 0, err\n\t}\n\n\t// Фильтруем по msg_type\n\tmsgTypeI, ok := jsonData[\"msg_type\"]\n\tif !ok {\n\t\treturn 0, nil\n\t}\n\tmsgType, ok := msgTypeI.(string)\n\tif !ok {\n\t\treturn 0, nil\n\t}\n\tif msgType != \"ApplyTrx\" {\n\t\treturn 0, nil\n\t}\n\n\t// Проверяем что нет \"except\" - ошибки\n\t_, ok = jsonData[\"except\"]\n\tif ok {\n\t\treturn 0, nil\n\t}\n\n\t// Цикл по actions\n\tactionsI, ok := jsonData[\"actions\"]\n\tif !ok {\n\t\treturn 0, nil\n\t}\n\tactions, ok := actionsI.([]interface{})\n\tif !ok {\n\t\treturn 0, nil\n\t}\n\n\tactIdx := 1\n\tfor _, actI := range actions {\n\t\tact := actI.(map[string]interface{})\n\t\tactName := act[\"action\"].(string)\n\n\t\t// Ignore actions without usable information\n\t\tif actName == \"onblock\" || actName == \"pick\" || actName == \"use\" || actName == \"providebw\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tactJson, err := json.Marshal(act)\n\t\tif err != nil {\n\t\t\tapp.Error.Printf(\"Json marshal error: %s\", err)\n\t\t\tactIdx++\n\t\t\tcontinue\n\t\t}\n\n\t\tid, err := psql.Insert(`\n\t\t\tINSERT INTO cyberway_actions\n\t\t\t\t(trx_id, block_num, block_time, action_idx, action)\n\t\t\tVALUES\n\t\t\t\t($1, $2, $3, $4, $5)\n\t\t\tON CONFLICT \n\t\t\t\tDO NOTHING`,\n\t\t\tjsonData[\"id\"], jsonData[\"block_num\"], jsonData[\"block_time\"], actIdx, actJson,\n\t\t)\n\t\tif err != nil {\n\t\t\tapp.Error.Printf(\"Error insert blockchain event to db: %s\", err)\n\t\t\treturn actIdx-1, err\n\t\t}\n\n\t\tapp.Info.Printf(\"[%d] Add action %d - %s (%d)\", numProcess, id, act[\"action\"].(string), actIdx)\n\n\t\tactIdx++\n\t}\n\n\treturn actIdx-1, nil\n}", "title": "" }, { "docid": "51b551a14237ddb70a73e2fc0af96ffc", "score": "0.43173712", "text": "func importAISTrafficMessage(msg *aisnmea.VdmPacket) {\n\tvar ti TrafficInfo\n\n\tvar header *ais.Header = msg.Packet.GetHeader()\n\tvar key = header.UserID\n\n\ttrafficMutex.Lock()\n\tdefer trafficMutex.Unlock()\n\n\tif existingTi, ok := traffic[key]; ok {\n\t\tti = existingTi\n\t} else {\n\t\tti.Reg = fmt.Sprintf(\"%d\", header.UserID)\n\t\tti.Emitter_category = 18 // Ground Vehicle, see also gdl90EmitterCatToNMEA\n\t\tti.TargetType = TARGET_TYPE_AIS\n\t\tti.Last_source = TRAFFIC_SOURCE_AIS\n\t\tti.Alt = 0\n\t\tti.Addr_type = uint8(1) // Non-ICAO Address\n\t\tti.SignalLevel = 0.0\n\t\tti.Squawk = 0\n\t\tti.AltIsGNSS = false\n\t\tti.GnssDiffFromBaroAlt = 0\n\t\tti.NIC = 0\n\t\tti.NACp = 0\n\t\tti.Vvel = 0\n\t\tti.PriorityStatus = 0\n\n\t\tti.Age = 0\n\t\tti.AgeLastAlt = 0\n\t}\n\n\tti.Icao_addr = header.UserID\n\tti.Timestamp = time.Now().UTC()\n\tti.Last_seen = stratuxClock.Time\n\tti.Last_alt = stratuxClock.Time\n\n\t// Handle ShipStaticData\n\tif header.MessageID == 5 {\n\t\tvar shipStaticData ais.ShipStaticData = msg.Packet.(ais.ShipStaticData)\n\n\t\tti.Tail = strings.TrimSpace(shipStaticData.Name)\n\t\tti.Reg = strings.TrimSpace(shipStaticData.CallSign)\n\t\tti.SurfaceVehicleType = uint16(shipStaticData.Type)\n\t\t// Store in case this was the first message and we disgard die to GPS not available \n\t\ttraffic[key] = ti\n\t}\n\n\t// Handle LongRangeAisBroadcastMessage\n\tif header.MessageID == 27 {\n\t\tvar positionReport ais.LongRangeAisBroadcastMessage = msg.Packet.(ais.LongRangeAisBroadcastMessage)\n\n\t\tti.Lat = float32(positionReport.Latitude)\n\t\tti.Lng = float32(positionReport.Longitude)\n\n\t\tif positionReport.Cog != 511 {\n\t\t\tcog := float32(positionReport.Cog)\n\t\t\tti.Track = cog\n\t\t}\n\t\tif positionReport.Sog < 63 {\n\t\t\tti.Speed = uint16(positionReport.Sog)\n\t\t\tti.Speed_valid = true\n\t\t}\n\t}\n\n\t// Handle MessageID 1,2 & 3 Position reports\n\tif header.MessageID == 1 || header.MessageID == 2 || header.MessageID == 3 {\n\t\tvar positionReport ais.PositionReport = msg.Packet.(ais.PositionReport)\n\n\t\tti.OnGround = true\n\t\tti.Position_valid = true\n\t\tti.Lat = float32(positionReport.Latitude)\n\t\tti.Lng = float32(positionReport.Longitude)\n\n\t\tif positionReport.Sog < 102.3 {\n\t\t\tti.Speed = uint16(positionReport.Sog) // I think Sog is in knt\n\t\t\tti.Speed_valid = true\n\t\t\tti.Last_speed = ti.Last_seen\n\t\t}\n\n\t\t// We assume that when we have speed, \n\t\t// we also have a proper course over ground so we take that over heading.\n\t\t// Otherwise Track will be heading so boats will orient correctly\n\t\tif positionReport.Sog > 0.0 && positionReport.Sog < 102.3 {\n\t\t\tvar cog float32 = 0.0\n\t\t\tif positionReport.Cog != 360 {\n\t\t\t\tcog = float32(positionReport.Cog)\n\t\t\t}\n\t\t\tti.Track = cog\n\t\t} else {\n\t\t\tvar heading float32 = 0.0\n\t\t\tif positionReport.TrueHeading != 511 {\n\t\t\t\theading = float32(positionReport.TrueHeading)\n\t\t\t}\n\t\t\tti.Track = heading\n\t\t}\n\n\t\tvar rot float32 = 0.0\n\t\tif positionReport.RateOfTurn != -128 {\n\t\t\trot = float32(positionReport.RateOfTurn)\n\t\t}\n\t\tti.TurnRate = (rot / 4.733) * (rot / 4.733)\n\n\t\tti.ExtrapolatedPosition = false\n\t}\n\n\t// Prevent wild lat/long coordinates\n\tif ti.Lat > 360 || ti.Lat < -360 || ti.Lng > 360 || ti.Lng < -360 {\n\t\treturn\n\t}\n\n\t// Validate the position report\n\tif isGPSValid() && (ti.Lat != 0 && ti.Lng != 0) {\n\t\tti.Distance, ti.Bearing = common.Distance(float64(mySituation.GPSLatitude), float64(mySituation.GPSLongitude), float64(ti.Lat), float64(ti.Lng))\n\t\tti.BearingDist_valid = true\n\t}\n\n\t// Do not display targets more than 150km\n\tif ti.BearingDist_valid == false || ti.Distance >= 150000 {\n\t\treturn\n\t}\n\n\ttraffic[key] = ti\n\tpostProcessTraffic(&ti) // This will not estimate distance for non ES sources, pffff\n\tregisterTrafficUpdate(ti) // Sends this one to the web interface\n\tseenTraffic[key] = true\n\n\tif globalSettings.DEBUG {\n\t\ttxt, _ := json.Marshal(ti)\n\t\tlog.Printf(\"AIS traffic imported: \" + string(txt))\n\t}\n}", "title": "" }, { "docid": "8ac596914f95dd9eb2179428eafef17b", "score": "0.43079636", "text": "func jsonIntoDB(database *sql.DB, url string, structInterface interface{}) interface{}{\r\n fmt.Printf(\".\")\r\n res, err := http.Get(url)\r\n if err != nil {\r\n panic(err.Error())\r\n }\r\n body, err := ioutil.ReadAll(res.Body)\r\n if err != nil {\r\n panic(err.Error())\r\n }\r\n //STORES THE INTERFACE INTO A VARIABLE SO WE CAN USE IT AS ANY STRUCT TYPE LATER ON\r\n structDummy := structInterface\r\n error := json.Unmarshal(body, &structDummy)\r\n if(error != nil){\r\n fmt.Println(\"An error has ocurred:\", error)\r\n }\r\n //WE GET THE STRUCT TYPE, IF ITS A CharacterAPIResponse TYPE WE PROCESS IT BECAUSE IT'S A CHARACTER AND WE NEED TO STORE THE INFO INTO THE DATABASE\r\n //EVERYTIME WE CALL THE FUNCION jsonIntoDB() IT RETURNS THE DESIRED STRUCT SO WE CAN EXTRACT ANY INFORMATION FROM IT\r\n switch result := structDummy.(type) {\r\n case *CharacterAPIResponse:\t\r\n for i:=0;i<len(result.Characters);i++{\r\n //GET THE PLANET NAME\r\n var planetStruct Planet\r\n\t \t\tplanet:=jsonIntoDB(database,result.Characters[i].HomeWorld,&planetStruct).(*Planet);\r\n\t \t\tresult.Characters[i].HomeWorld=planet.Name\r\n\t \t\t//GET THE SPECIE NAME\r\n var specieName string\r\n if len(result.Characters[i].Species)>0{\r\n var specieStruct Specie\r\n specie:=jsonIntoDB(database,result.Characters[i].Species[0],&specieStruct).(*Specie);\r\n specieName=specie.Name\r\n }else{\r\n specieName=\"\"\r\n }\r\n //INSERT BASIC INFO INTO THE CHARACTER'S TABLE\r\n statement, error := database.Prepare(\"INSERT INTO character (name, height, mass, hairColor, skinColor, eyeColor, birthYear, gender, homeWorld, species) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"character\\\" table:\", error)\r\n }\r\n statement.Exec(result.Characters[i].Name,result.Characters[i].Height,result.Characters[i].Mass,result.Characters[i].HairColor,result.Characters[i].SkinColor,result.Characters[i].EyeColor,result.Characters[i].BirthYear,result.Characters[i].Gender,result.Characters[i].HomeWorld,specieName)\r\n \r\n //ADDING VEHICLES\r\n\t\t \tfor j:=0;j<len(result.Characters[i].Films);j++{\r\n\t\t \t\tvar filmStruct Film\r\n\t\t \t\tfilm:=jsonIntoDB(database,result.Characters[i].Films[j],&filmStruct).(*Film);\r\n\t\t \t\tresult.Characters[i].Films[j]=film.Title\r\n\t\t \t\t\r\n //CHECK IF THE FILM EXISTS IN THE DATABASE, IF DOESN'T EXISTS WE DONT INSERT IT INTO THE DB\r\n rows, e := database.Query(\"SELECT COUNT(title) FROM film WHERE title='\"+film.Title+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"film\\\" table:\", e)\r\n }\r\n var repeat int\r\n for rows.Next() {\r\n rows.Scan(&repeat)\r\n }\r\n if(repeat==0){\r\n statement, error = database.Prepare(\"INSERT INTO film (title) VALUES (?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"film\\\" table:\", error)\r\n }\r\n statement.Exec(result.Characters[i].Films[j])\r\n }\r\n //WE GET THE FILM ID\r\n rows, e = database.Query(\"SELECT idFilm FROM film WHERE title='\"+film.Title+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"film\\\" table:\", e)\r\n }\r\n var idFilm int\r\n for rows.Next() {\r\n rows.Scan(&idFilm)\r\n }\r\n //INSERT BOTH, THE CHARACTER ID AND FILM ID, IN THEIR RELATIONAL TABLE\r\n statement, error = database.Prepare(\"INSERT INTO filmCharacter (character,film) VALUES (?, ?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"filmCharacter\\\" table:\", error)\r\n }\r\n statement.Exec(countReg(database,\"name\", \"character\"),idFilm)\r\n \r\n\t\t \t}\r\n\r\n\t\t \t//ADDING VEHICLES\r\n\t\t \tfor j:=0;j<len(result.Characters[i].Vehicles);j++{\r\n\t\t \t\tvar vehicleStruct Vehicle\r\n\t\t \t\tvehicle:=jsonIntoDB(database,result.Characters[i].Vehicles[j],&vehicleStruct).(*Vehicle);\r\n\t\t \t\tresult.Characters[i].Vehicles[j]=vehicle.Name\r\n\t\t \t\t\r\n //CHECK IF THE VEHICLE EXISTS IN THE DATABASE, IF DOESN'T EXISTS WE DONT INSERT IT INTO THE DB\r\n rows, e := database.Query(\"SELECT COUNT(vehicleName) FROM vehicle WHERE vehicleName='\"+vehicle.Name+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"vehicle\\\" table:\", e)\r\n }\r\n var repeat int\r\n for rows.Next() {\r\n rows.Scan(&repeat)\r\n }\r\n if(repeat==0){\r\n statement, error = database.Prepare(\"INSERT INTO vehicle (vehicleName) VALUES (?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"vehicles\\\" table:\", error)\r\n }\r\n statement.Exec(result.Characters[i].Vehicles[j])\r\n }\r\n //WE GET THE VEHICLE ID\r\n rows, e = database.Query(\"SELECT idVehicle FROM vehicle WHERE vehicleName='\"+vehicle.Name+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"vehicle\\\" table:\", e)\r\n }\r\n var idVehicle int\r\n for rows.Next() {\r\n rows.Scan(&idVehicle)\r\n }\r\n //INSERT BOTH, THE CHARACTER ID AND STARSHIP ID, IN THEIR RELATIONAL TABLE\r\n statement, error = database.Prepare(\"INSERT INTO driver (character,vehicle) VALUES (?, ?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"driver\\\" table:\", error)\r\n }\r\n statement.Exec(countReg(database,\"name\", \"character\"),idVehicle)\r\n\t\t \t}\r\n\r\n\t\t \t//ADDING STARSHIPS\r\n for j:=0;j<len(result.Characters[i].Starships);j++{\r\n\t\t \t\tvar StarshipStruct Starship\r\n\t\t \t\tstarship:=jsonIntoDB(database,result.Characters[i].Starships[j],&StarshipStruct).(*Starship);\r\n\t\t \t\tresult.Characters[i].Starships[j]=starship.Name\r\n \r\n //CHECK IF THE STARSHIP EXISTS IN THE DATABASE, IF DOESN'T EXISTS WE DONT INSERT IT INTO THE DB\r\n rows, e := database.Query(\"SELECT COUNT(starshipName) FROM starship WHERE starshipName='\"+starship.Name+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"starshipName\\\" table:\", e)\r\n }\r\n var repeat int\r\n for rows.Next() {\r\n rows.Scan(&repeat)\r\n }\r\n if(repeat==0){\r\n statement, error = database.Prepare(\"INSERT INTO starship (starshipName) VALUES (?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"starship\\\" table:\", error)\r\n }\r\n statement.Exec(result.Characters[i].Starships[j])\r\n }\r\n //WE GET THE STARSHIP ID\r\n rows, e = database.Query(\"SELECT idStarship FROM starship WHERE starshipName='\"+starship.Name+\"'\")\r\n if e != nil {\r\n fmt.Println(\"Failed to reach the \\\"starshipName\\\" table:\", e)\r\n }\r\n \r\n var idStars int\r\n for rows.Next() {\r\n rows.Scan(&idStars)\r\n }\r\n //INSERT BOTH, THE CHARACTER ID AND STARSHIP ID, IN THEIR RELATIONAL TABLE\r\n statement, error = database.Prepare(\"INSERT INTO pilot (character,starship) VALUES (?, ?)\")\r\n if error != nil {\r\n fmt.Println(\"Failed to insert a row into the source database \\\"pilot\\\" table:\", error)\r\n }\r\n statement.Exec(countReg(database,\"name\", \"character\"),idStars)\r\n\t\t \t}\r\n\t\t }\r\n //GET THE NEXT CHARACTER PAGE AND TAKE ITS INFO\r\n if result.Next!=\"\" {\r\n var characterAPIResponseStruct CharacterAPIResponse\r\n jsonIntoDB(database, result.Next,&characterAPIResponseStruct);\r\n }\r\n\t}\r\n return structDummy\r\n}", "title": "" }, { "docid": "5389b4c0dc91ebea4c91916dd15f58a4", "score": "0.42948034", "text": "func (sc *SensorflowClient) SaveOtherData(unum int) {\n\tfor i := 0; i < unum; i++ {\n\t\tfor j := 0; j < sc.UKeyNumber; j++ {\n\t\t\tmstart := 32 + (i*sc.UKeyNumber+j)*32\n\t\t\tustart := 64 + j*36\n\n\t\t\t// tag id, 14 bytes\n\t\t\tfor k := 0; k < 14; k++ {\n\t\t\t\tmi := mstart + k\n\t\t\t\tui := ustart + k\n\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t}\n\n\t\t\t// tag rgb, 6 bytes\n\t\t\tfor k := 0; k < 6; k++ {\n\t\t\t\tmi := mstart + 14 + k\n\t\t\t\tui := ustart + 18 + k\n\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t}\n\n\t\t\t/** original difinition, reserve\n\t\t\t// resistance temperature, 2 bytes\n\t\t\t// for k := 0; k < 2; k++ {\n\t\t\t// \tmi := mstart + 20 + k\n\t\t\t// \tui := ustart + 24 + k\n\t\t\t// \tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t// }\n\n\t\t\t// reserve, 2 bytes, pass\n\t\t\t**/\n\n\t\t\t// custom difinition, save data by tag type, type at id's last byte\n\t\t\tti := ustart + 13\n\t\t\tltype := sc.Data[i][ti]\n\n\t\t\tswitch ltype {\n\t\t\tcase TagTypeRFID:\n\t\t\t\t// save resistance temperature (2 bytes), reserve (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 24 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\t\t\tcase TagTypeTH:\n\t\t\t\t// save humidity and temperature, 4 bytes\n\t\t\t\tfor k := 0; k < 4; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 26 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\t\t\tcase TagTypeDoorMagnetic:\n\t\t\t\t// save resistance temperature (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 24 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\n\t\t\t\t// save sensor data (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 22 + k\n\t\t\t\t\tui := ustart + 32 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\t\t\tcase TagTypeAcoustoOptic:\n\t\t\t\t// TODO\n\t\t\tcase TagTypeSmoke:\n\t\t\t\t// TODO\n\t\t\tcase TagTypePT100:\n\t\t\t\t// save resistance temperature (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 24 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\n\t\t\t\t// compute pt100\n\t\t\t\tdi := ustart + 32\n\t\t\t\td := uint(sc.Data[i][di])\n\t\t\t\tfA := float64(39)\n\t\t\t\tfI := 0.00125\n\t\t\t\tfR2 := 78.7\n\t\t\t\tfd := public.PT100(d, fA, fI, fR2)\n\t\t\t\tmd := uint16(fd * 100)\n\n\t\t\t\ttmp := make([]byte, 2)\n\t\t\t\tbinary.BigEndian.PutUint16(tmp, md)\n\n\t\t\t\t// save sensor data (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 22 + k\n\t\t\t\t\tsc.ModbusData[mi] = tmp[k]\n\t\t\t\t}\n\t\t\tcase TagTypeElectricity:\n\t\t\t\t// save resistance temperature (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 24 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\n\t\t\t\t// compute electricity\n\t\t\t\tdi := ustart + 32\n\t\t\t\td := uint(sc.Data[i][di])\n\t\t\t\tfd := public.Electricity(d)\n\t\t\t\tmd := uint16(fd * 100)\n\n\t\t\t\ttmp := make([]byte, 2)\n\t\t\t\tbinary.BigEndian.PutUint16(tmp, md)\n\n\t\t\t\t// save sensor data (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 22 + k\n\t\t\t\t\tsc.ModbusData[mi] = tmp[k]\n\t\t\t\t}\n\t\t\tcase TagTypeVoltage:\n\t\t\t\t// save resistance temperature (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 20 + k\n\t\t\t\t\tui := ustart + 24 + k\n\t\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t\t}\n\n\t\t\t\t// compute voltage\n\t\t\t\tdi := ustart + 32\n\t\t\t\td := uint(sc.Data[i][di])\n\t\t\t\tfd := public.Voltage(d)\n\t\t\t\tmd := uint16(fd * 100)\n\n\t\t\t\ttmp := make([]byte, 2)\n\t\t\t\tbinary.BigEndian.PutUint16(tmp, md)\n\n\t\t\t\t// save sensor data (2 bytes)\n\t\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\t\tmi := mstart + 22 + k\n\t\t\t\t\tsc.ModbusData[mi] = tmp[k]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// u led rgb, 6 bytes\n\t\t\tustart = 12 + j*3\n\t\t\tfor k := 0; k < 6; k++ {\n\t\t\t\tmi := mstart + 24 + k\n\t\t\t\tui := ustart + k\n\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t}\n\n\t\t\t// u key value\n\t\t\tustart = j\n\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\tmi := mstart + 30 + k\n\t\t\t\tui := ustart + k\n\t\t\t\tsc.ModbusData[mi] = sc.Data[i][ui]\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "adfed25e7bf02fa3ee5c552c5d0d7937", "score": "0.42916718", "text": "func ProcessLine(raw string, data map[string]interface{}) {\n list := strings.Split(raw, \" \")\n command := list[0]\n args := list[1:]\n switch command {\n case \"q\", \"quit\", \"exit\":\n v(\"getting out of here\\n\")\n os.Exit(0)\n case \"e\", \"echo\":\n fmt.Printf(\"%s\\n\", strings.Join(args, \",\") )\n \n case \"c\", \"create\":\n Create(data, args[0], strings.Join(args[1:], \" \") )\n case \"r\", \"read\":\n Read(data, args[0])\n case \"u\", \"update\":\n Update(data, args[0], strings.Join(args[1:], \" \") )\n case \"d\", \"delete\":\n Delete(data, args[0])\n \n case \"add\":\n Math(data, args[0], func(left float64, right float64) float64 {\n return left + right\n })\n\n case \"sub\":\n Math(data, args[0], func(left float64, right float64) float64 {\n return left - right\n })\n\n case \"dump\":\n Dump(data)\n case \"l\", \"ls\", \"list\":\n List(data)\n case \"L\", \"load\":\n app_data.active_file = args[0]\n data := Load(app_data.active_file)\n app_data.data = data\n \n case \"t\", \"table\":\n Table(data)\n case \"S\", \"save\":\n Save(data, app_data.active_file)\n case \"h\", \"help\":\n Help()\n default:\n Help()\n }\n}", "title": "" }, { "docid": "ecd6de385167519892a0b70e3f2b1501", "score": "0.42894334", "text": "func processAgentData(data *emp3r0r_data.MsgTunData) {\n\tTargetsMutex.RLock()\n\tdefer TargetsMutex.RUnlock()\n\tpayloadSplit := strings.Split(data.Payload, emp3r0r_data.MagicString)\n\top := payloadSplit[0]\n\n\ttarget := GetTargetFromTag(data.Tag)\n\tcontrlIf := Targets[target]\n\tif target == nil || contrlIf == nil {\n\t\tCliPrintError(\"Target %s cannot be found, however, it left a message saying:\\n%v\",\n\t\t\tdata.Tag, payloadSplit)\n\t\treturn\n\t}\n\n\tif op != \"cmd\" {\n\t\treturn\n\t}\n\n\t// cmd output from agent\n\tcmd := payloadSplit[1]\n\tcmd_slice := util.ParseCmd(cmd)\n\tout := strings.Join(payloadSplit[2:len(payloadSplit)-1], \" \")\n\t// outLines := strings.Split(out, \"\\n\")\n\n\tis_builtin_cmd := strings.HasPrefix(cmd, \"!\")\n\n\t// time spent on this cmd\n\tcmd_id := payloadSplit[len(payloadSplit)-1]\n\t// cache this cmd response\n\tCmdResultsMutex.Lock()\n\tCmdResults[cmd_id] = out\n\tCmdResultsMutex.Unlock()\n\tstart_time, err := time.Parse(\"2006-01-02 15:04:05.999999999 -0700 MST\", CmdTime[cmd_id])\n\tif err != nil {\n\t\tCliPrintWarning(\"Parsing timestamp '%s': %v\", CmdTime[cmd_id], err)\n\t} else {\n\t\ttime_spent := time.Since(start_time)\n\t\tif is_builtin_cmd {\n\t\t\tCliPrintDebug(\"Command %s took %s\", strconv.Quote(cmd), time_spent)\n\t\t} else {\n\t\t\tCliPrintInfo(\"Command %s took %s\", strconv.Quote(cmd), time_spent)\n\t\t}\n\t}\n\n\t// headless mode\n\tif IsAPIEnabled {\n\t\t// send to socket\n\t\tvar resp APIResponse\n\t\tmsg := fmt.Sprintf(\"%s:\\n%s\", cmd, out)\n\t\tresp.Cmd = cmd\n\t\tresp.MsgData = []byte(msg)\n\t\tresp.Alert = false\n\t\tresp.MsgType = CMD\n\t\tdata, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"processAgentData cmd output: %v\", err)\n\t\t\treturn\n\t\t}\n\t\t_, err = APIConn.Write([]byte(data))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"processAgentData cmd output: %v\", err)\n\t\t}\n\t}\n\n\tswitch cmd_slice[0] {\n\t// screenshot command\n\tcase \"screenshot\":\n\t\tgo func() {\n\t\t\terr = processScreenshot(out, target)\n\t\t\tif err != nil {\n\t\t\t\tCliPrintError(\"%v\", err)\n\t\t\t}\n\t\t}()\n\n\t\t// ps command\n\tcase \"#ps\":\n\t\tvar procs []util.ProcEntry\n\t\terr = json.Unmarshal([]byte(out), &procs)\n\t\tif err != nil {\n\t\t\tCliPrintError(\"ps: %v:\\n%s\", err, out)\n\t\t\treturn\n\t\t}\n\n\t\t// build table\n\t\ttdata := [][]string{}\n\t\ttableString := &strings.Builder{}\n\t\ttable := tablewriter.NewWriter(tableString)\n\t\ttable.SetHeader([]string{\"Name\", \"PID\", \"PPID\", \"User\"})\n\t\ttable.SetBorder(true)\n\t\ttable.SetRowLine(true)\n\t\ttable.SetAutoWrapText(true)\n\t\ttable.SetColWidth(20)\n\n\t\t// color\n\t\ttable.SetHeaderColor(tablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\n\t\ttable.SetColumnColor(tablewriter.Colors{tablewriter.FgHiBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor})\n\n\t\t// fill table\n\t\tfor _, p := range procs {\n\t\t\tpname := util.SplitLongLine(p.Name, 20)\n\t\t\ttdata = append(tdata, []string{pname, strconv.Itoa(p.PID), strconv.Itoa(p.PPID), p.Token})\n\t\t}\n\t\ttable.AppendBulk(tdata)\n\t\ttable.Render()\n\t\tout = tableString.String()\n\n\t\t// resize pane since table might mess up\n\t\tx := len(strings.Split(out, \"\\n\")[0])\n\t\tFitPanes(x)\n\n\t\t// ls command\n\tcase \"ls\":\n\t\tvar dents []util.Dentry\n\t\terr = json.Unmarshal([]byte(out), &dents)\n\t\tif err != nil {\n\t\t\tCliPrintError(\"ls: %v:\\n%s\", err, out)\n\t\t\treturn\n\t\t}\n\n\t\tLsDir = nil // clear cache\n\n\t\t// build table\n\t\ttdata := [][]string{}\n\t\ttableString := &strings.Builder{}\n\t\ttable := tablewriter.NewWriter(tableString)\n\t\ttable.SetHeader([]string{\"Name\", \"Type\", \"Size\", \"Time\", \"Permission\"})\n\t\ttable.SetRowLine(true)\n\t\ttable.SetBorder(true)\n\t\ttable.SetColWidth(20)\n\t\ttable.SetAutoWrapText(true)\n\n\t\t// color\n\t\ttable.SetHeaderColor(tablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\n\t\ttable.SetColumnColor(tablewriter.Colors{tablewriter.FgHiBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor},\n\t\t\ttablewriter.Colors{tablewriter.FgBlueColor})\n\n\t\t// fill table\n\t\tfor _, d := range dents {\n\t\t\tdname := util.SplitLongLine(d.Name, 20)\n\t\t\ttdata = append(tdata, []string{dname, d.Ftype, d.Size, d.Date, d.Permission})\n\t\t\tif len(cmd_slice) == 1 {\n\t\t\t\tif d.Ftype == \"file\" {\n\t\t\t\t\tLsDir = append(LsDir, d.Name)\n\t\t\t\t} else {\n\t\t\t\t\tLsDir = append(LsDir, d.Name+\"/\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// print table\n\t\ttable.AppendBulk(tdata)\n\t\ttable.Render()\n\t\tout = tableString.String()\n\n\t\t// resize pane since table might mess up\n\t\tx := len(strings.Split(out, \"\\n\")[0])\n\t\tFitPanes(x)\n\t}\n\n\t// Command output\n\tis_critical := strings.Contains(out, \"Error\") ||\n\t\tstrings.Contains(out, \"Warning\")\n\tif DebugLevel < 3 && !is_critical {\n\t\t// ignore some cmds\n\t\tif strings.HasPrefix(cmd, \"!port_fwd\") ||\n\t\t\tstrings.HasPrefix(cmd, \"!sshd\") {\n\t\t\treturn\n\t\t}\n\t}\n\tAgentOutputPane.Printf(false,\n\t\t\"\\n[%s] %s:\\n%s\\n\\n\",\n\t\tcolor.CyanString(\"%d\", contrlIf.Index),\n\t\tcolor.HiMagentaString(cmd),\n\t\tcolor.HiWhiteString(out))\n}", "title": "" }, { "docid": "dd8bb52518847b1207eb5749a3fbf124", "score": "0.42846957", "text": "func (c *Controller) CheckThresholdSwitchEntries(dataPoint float64, db *sqlx.DB) {\n\tif !c.Active {\n\t\treturn\n\t}\n\tvar ts []Thresholdswitch\n\terr := json.Unmarshal(*c.Items, &ts)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] unable to unmarshal thresholdswitch json: %v\", err)\n\t}\n\tfor _, item := range ts {\n\t\t// threshold switch operation\n\t\tswitch item.Operation {\n\t\tcase \"greather than\":\n\t\t\t// switching state based on threshold\n\t\t\tif dataPoint > item.ThresholdLimit {\n\t\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_ON)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\t// fmt.Printf(\"gt switch on: %s -> t:%v -> d:%v - state: %d\\n\", c.Title, item.ThresholdLimit, dataPoint, c.Switch)\n\t\t\t\tc.Switch = SWITCH_ON\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_OFF)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tc.Switch = SWITCH_OFF\n\t\t\t// fmt.Printf(\"gt switch off %v - state: %d\\n\", dataPoint, c.Switch)\n\t\t\t// fmt.Printf(\"gt switch off: %s -> t:%v -> d:%v - state: %d\\n\", c.Title, item.ThresholdLimit, dataPoint, c.Switch)\n\n\t\tcase \"less than\":\n\t\t\t// switching state based on threshold\n\t\t\t// fmt.Println(\"datapoint\", dataPoint, \"threshold\", item.ThresholdLimit)\n\t\t\tif dataPoint < item.ThresholdLimit {\n\t\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_ON)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\t// c.Switch = 1\n\t\t\t\t// fmt.Printf(\"lt switch on: %s -> %v - state: %d\\n\", c.Title, dataPoint, c.Switch)\n\t\t\t\t// fmt.Printf(\"lt switch on: %s -> t:%v -> d:%v - state: %d\\n\", c.Title, item.ThresholdLimit, dataPoint, c.Switch)\n\t\t\t\tc.Switch = SWITCH_ON\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_OFF)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tc.Switch = SWITCH_OFF\n\t\t\t// fmt.Printf(\"lt switch off: %s -> t:%v -> d:%v - state: %d\\n\", c.Title, item.ThresholdLimit, dataPoint, c.Switch)\n\t\t\t// fmt.Printf(\"ls switch off %v - state: %d\\n\", dataPoint, c.Switch)\n\t\tcase \"equal\":\n\t\t\tif dataPoint == item.ThresholdLimit {\n\t\t\t\tfmt.Println(\"equal not implemented\")\n\t\t\t}\n\t\tcase \"not equal\":\n\t\t\tif dataPoint == item.ThresholdLimit {\n\t\t\t\tfmt.Println(\"not equal not implemented\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "87732bba57e4517952b3ce08bc2d5087", "score": "0.42788872", "text": "func insertFW(tblName, div, dir, sip, dip string, stime, etime uint32, protocol, port, reason string) int {\r\n\tquery := \"INSERT INTO \" + tblName + \" (DIV, DIR, SIP, DIP, STIME, ETIME, PROTOCOL, PORT, ACT, REASON) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\"\r\n\tlprintf(4, \"[INFO] insert query : %s -> sip (%s), tblName (%s) \\n\", query, sip, tblName)\r\n\r\n\tstatement, err := cls.SqliteDB.Prepare(query)\r\n\tif err != nil {\r\n\t\tlprintf(1, \"[ERROR] sql prepare error : %s\\n\", err.Error())\r\n\t\treturn FAIL\r\n\t}\r\n\tdefer statement.Close()\r\n\t_, err = statement.Exec(div, dir, sip, dip, stime, etime, protocol, port, \"1\", reason)\r\n\tif err != nil {\r\n\t\tlprintf(1, \"[ERROR] sql insert exec error : %s\\n\", err.Error())\r\n\t\treturn FAIL\r\n\t}\r\n\r\n\tlprintf(4, \"[INFO] statement query finished \\n\")\r\n\treturn SUCCESS\r\n}", "title": "" }, { "docid": "90d0dfed33a963e8e440435a2aeb440a", "score": "0.42744726", "text": "func (fn *LogFn) ProcessElement(ctx context.Context, elm []byte) {\n\tlog.Infof(ctx, \"Ride info: %v\", string(elm))\n}", "title": "" }, { "docid": "69b616515eadbd925f52dcbe9f314d2f", "score": "0.42739442", "text": "func HandleAddLiquidityETH(tx *types.Transaction, client *ethclient.Client, topSnipe chan *big.Int) {\n\t// parse the info of the swap so that we can access it easily\n\tvar addLiquidity = buildAddLiquidityEthData(tx)\n\tsender := getTxSenderAddressQuick(tx, client)\n\ttknBalanceSender, _ := global.Snipe.Tkn.BalanceOf(&bind.CallOpts{}, sender)\n\tcheckBalanceLP := addLiquidity.AmountTokenMin.Cmp(tknBalanceSender)\n\n\t// security checks:\n\t// does the liquidity addition deals with the token i'm targetting?\n\tif addLiquidity.TokenAddress == global.Snipe.TokenAddress {\n\t\t// we check if the liquidity provider really possess the liquidity he wants to add, because it is possible tu be lured by other bots that fake liquidity addition.\n\t\tif checkBalanceLP == 0 || checkBalanceLP == -1 {\n\t\t\t// we check if the liquidity provider add enough collateral (WBNB or BUSD) as expected by our configuration. Bc sometimes the dev fuck the pleb and add way less liquidity that was advertised on telegram.\n\t\t\tif tx.Value().Cmp(global.Snipe.MinLiq) == 1 {\n\t\t\t\tif addLiquidity.AmountETHMin.Cmp(global.Snipe.MinLiq) == 1 {\n\t\t\t\t\tif SNIPEBLOCK == false {\n\t\t\t\t\t\t// reminder: the Clogg goroutine launched in dark_forester.go is still blocking and is waiting for the gas price value. Here we unblock it. And all the armed bees are launched, which clogg the mempool and increase the chances of successful sniping.\n\t\t\t\t\t\ttopSnipe <- tx.GasPrice()\n\n\t\t\t\t\t\t// following is just verbose / design thing\n\t\t\t\t\t\tvar final = buildAddLiquidityEthFinal(tx, client, &addLiquidity)\n\t\t\t\t\t\tout, _ := json.MarshalIndent(final, \"\", \"\\t\")\n\t\t\t\t\t\tfmt.Println(\"PankakeSwap: New BNB Liquidity addition:\")\n\t\t\t\t\t\tfmt.Println(string(out))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"SNIPEBLOCK activated. Must relaunch Clogger to perform another snipe\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"liquidity added but lower than expected : \", formatEthWeiToEther(tx.Value()), \" BNB\", \" vs\", formatEthWeiToEther(global.Snipe.MinLiq), \" expected\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5634df440b7c506dcacce043d474136d", "score": "0.4272393", "text": "func (*Qos_ClassifierTemplate_TrafficClassifiers_TrafficClassifier_RuleEthTypes_RuleEthType) Descriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_proto_rawDescGZIP(), []int{0, 2, 1, 0, 7, 0}\n}", "title": "" }, { "docid": "cb104556fff5e760f4d35e9fa327042e", "score": "0.42368606", "text": "func handleIBVEP(conn net.Conn, notify chan bool, data chan *CIBVAddress) error {\n\tdefer conn.Close()\n\tlenBuf := make([]byte, 4)\n\tvar ulen uint32\n\tn, err := conn.Read(lenBuf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tulen = binary.BigEndian.Uint32(lenBuf)\n\tfmt.Printf(\"length : %d\\n\", ulen)\n\tpacketBuf := make([]byte, ulen)\n\tn, err = conn.Read(packetBuf)\t\n\tif err != nil {\n\t\treturn err\n\t}\n\tif uint32(n) != ulen {\n\t\treturn fmt.Errorf(\"incorrect buffer read : %d of %d\\n\", n, lenBuf)\n\t}\n\tfmt.Printf(\"read : %s\\n\", hex.Dump( packetBuf ) )\n\tstrBuf := string(packetBuf)\n\tvals := strings.Split(strBuf, \"|\")\n\tfmt.Printf(\"vals : %+v\\n\", vals)\n\thandler := ResolveHandler(vals[0])\n\thandler.FromStringArray( StringArray(vals[2:]) )\n\treply, err := handler.Process(data)\n\tif err != nil {\nfmt.Printf(\"Process() error : %+v\\n\", err)\n\t\treturn err\n\t}\n\treply_buf := reply.Marshal()\n\twritePacket(conn, reply_buf)\n\treturn nil\n}", "title": "" }, { "docid": "62f917939b2b6d61f6d7a49093a703a0", "score": "0.42078495", "text": "func (cli *Client) handleNetbotsPacket(groups [2]string) {\n\tif cli.characters[groups[0]] == nil {\n\t\tcha := GetPaperdollInstance(groups[0], groups[1])\n\t\tcli.characters[groups[0]] = GetCharacterInstance(cha, cli)\n\t} else {\n\t\tcha := cli.characters[groups[0]]\n\t\tcha.UpdatePaperdoll(groups[1])\n\t}\n}", "title": "" }, { "docid": "61778b2b9e16ed1b0d32ecc3d8ecf76c", "score": "0.42022777", "text": "func SendTableEntries(client bfrt.BFRuntimeClient, iterations int, batchSize int) {\n\n\ttableID, err := p4infoHelper.GetP4Id(\"pipe.SwitchIngress.rib_24\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tactionID, err := p4infoHelper.GetP4Id(\"SwitchIngress.hit_route_port\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Prepare write requests for all iterations\n\trequests := make([]*p4.WriteRequest, iterations)\n\tfor i := 0; i < iterations; i++ {\n\t\tupdates := make([]*p4.Update, batchSize)\n\t\tfor j := 0; j < batchSize; j++ {\n\t\t\tipOri := int2ip(uint32((i*batchSize + j)))\n\t\t\tip := net.IPv4(ipOri[1], ipOri[2], ipOri[3], ipOri[0])\n\n\t\t\tupdates[j] = &p4.Update{\n\t\t\t\tType: p4.Update_INSERT,\n\t\t\t\tEntity: &p4.Entity{Entity: &p4.Entity_TableEntry{\n\t\t\t\t\tTableEntry: &p4.TableEntry{\n\t\t\t\t\t\tTableId: tableID, // FabricIngress.forwarding.routing_v4\n\t\t\t\t\t\tKey: &p4.TableKey{\n\t\t\t\t\t\t\tFields: []*p4.KeyField{\n\t\t\t\t\t\t\t\tutil.GenKeyField(f.MATCH_EXACT,\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\tutil.Ipv4ToBytes(ip.String())[0:3]),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tData: &p4.TableData{\n\t\t\t\t\t\t\tActionId: actionID,\n\t\t\t\t\t\t\tFields: []*p4.DataField{\n\t\t\t\t\t\t\t\tutil.GenDataField(1, util.Int16ToBytes(128)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\treq := &p4.WriteRequest{\n\t\t\tClientId: client.ClientId(),\n\t\t\tTarget: &p4.TargetDevice{\n\t\t\t\tDeviceId: client.DeviceID(),\n\t\t\t\tPipeId: 0xffff,\n\t\t\t},\n\t\t\tUpdates: updates,\n\t\t}\n\t\trequests[i] = req\n\t}\n\n\tfor _, req := range requests {\n\t\tres := client.Write(req)\n\t\tgo CountFailed(proto.Clone(req).(*p4.WriteRequest), res)\n\t}\n}", "title": "" }, { "docid": "28974f75e0f4c61495c04fa2c78cc8b6", "score": "0.41949955", "text": "func (m *ThreatIntelligence) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetArticleIndicators() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetArticleIndicators()))\n for i, v := range m.GetArticleIndicators() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"articleIndicators\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetArticles() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetArticles()))\n for i, v := range m.GetArticles() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"articles\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHostComponents() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHostComponents()))\n for i, v := range m.GetHostComponents() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hostComponents\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHostCookies() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHostCookies()))\n for i, v := range m.GetHostCookies() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hostCookies\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHostPairs() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHostPairs()))\n for i, v := range m.GetHostPairs() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hostPairs\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHosts() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHosts()))\n for i, v := range m.GetHosts() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hosts\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHostSslCertificates() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHostSslCertificates()))\n for i, v := range m.GetHostSslCertificates() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hostSslCertificates\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetHostTrackers() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHostTrackers()))\n for i, v := range m.GetHostTrackers() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"hostTrackers\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetIntelligenceProfileIndicators() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetIntelligenceProfileIndicators()))\n for i, v := range m.GetIntelligenceProfileIndicators() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"intelligenceProfileIndicators\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetIntelProfiles() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetIntelProfiles()))\n for i, v := range m.GetIntelProfiles() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"intelProfiles\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetPassiveDnsRecords() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetPassiveDnsRecords()))\n for i, v := range m.GetPassiveDnsRecords() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"passiveDnsRecords\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetSslCertificates() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSslCertificates()))\n for i, v := range m.GetSslCertificates() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"sslCertificates\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetSubdomains() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSubdomains()))\n for i, v := range m.GetSubdomains() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"subdomains\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetVulnerabilities() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetVulnerabilities()))\n for i, v := range m.GetVulnerabilities() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"vulnerabilities\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetWhoisRecords() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetWhoisRecords()))\n for i, v := range m.GetWhoisRecords() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"whoisRecords\", cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "49efb4617cbaec59511b02531b6188b4", "score": "0.41900933", "text": "func Add(tag string, content []byte, passphrase string) error {\n\tif hop != nil && hop.peer != nil {\n\t\tbuf := bytes.NewReader(nil)\n\t\tshouldEncrypt := true\n\t\tif passphrase == \"\" {\n\t\t\tshouldEncrypt = false\n\t\t}\n\t\tif shouldEncrypt {\n\t\t\tbyteContent, err := security.Encrypt(content, passphrase)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Encryption failed :%s\", err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf = bytes.NewReader(byteContent)\n\t\t} else {\n\t\t\tbuf = bytes.NewReader(content)\n\t\t}\n\t\tn, err := hop.peer.AddFile(context.Background(), buf, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkind, _ := filetype.Match(content)\n\t\tmeta := &replication.Metatag{\n\t\t\tSize: int64(len(content)),\n\t\t\tType: kind.MIME.Value,\n\t\t\tName: tag,\n\t\t\tHash: n.Cid(),\n\t\t\tTimestamp: time.Now().Unix(),\n\t\t\tOwner: hop.peer.Host.ID(),\n\t\t\tTag: tag,\n\t\t\tIsEncrypted: shouldEncrypt,\n\t\t}\n\t\terr = hop.peer.Manager.Tag(tag, meta)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Update advertise info\n\t\tbf, err := FilterFromState()\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to filter state\")\n\t\t\treturn err\n\t\t}\n\t\thop.discService.AddAdvertisingInfo(CRDTStatus, bf)\n\t\treturn nil\n\t}\n\treturn errors.New(\"datahop ipfs-lite node is not running\")\n}", "title": "" }, { "docid": "34514b6e5af2357f49358ec97d7d9176", "score": "0.41875327", "text": "func (*Qos_ClassifierTemplate_TrafficClassifiers_TrafficClassifier_RuleEthTypes) Descriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_proto_rawDescGZIP(), []int{0, 2, 1, 0, 7}\n}", "title": "" }, { "docid": "1c67c4728583c5394756c3e6e4680756", "score": "0.41776076", "text": "func (tp *turnProcessor) runSwitch(ctx context.Context, public bool, user *battleTrainerData) error {\n\t// Load request-specific objects\n\tclient := ctx.Value(\"client\").(messaging.Client)\n\n\t// Switch Pokemon\n\tprevPkmn := user.battleInfo.GetTrainerBattleInfo().CurrPkmnSlot\n\tnewPkmn := user.battleInfo.GetTrainerBattleInfo().NextBattleAction.Val\n\tuser.battleInfo.GetTrainerBattleInfo().CurrPkmnSlot = newPkmn\n\n\tvar err error\n\n\t// Send the switch message\n\ttemplInfo := struct {\n\t\tSwitcher string\n\t\tWithdrawnPokemon string\n\t\tSelectedPokemon string\n\t\tSelectedLevel int\n\t}{\n\t\tSwitcher: user.trainer.GetTrainer().Name,\n\t\tWithdrawnPokemon: user.pkmn[prevPkmn].GetPokemon().Name,\n\t\tSelectedPokemon: user.pkmn[newPkmn].GetPokemon().Name,\n\t\tSelectedLevel: user.pkmn[newPkmn].GetPokemon().Level}\n\terr = messaging.SendTempl(client, user.lastContactURL, messaging.TemplMessage{\n\t\tPublic: public,\n\t\tTempl: switchPokemonTemplate,\n\t\tTemplInfo: templInfo})\n\tif err != nil {\n\t\treturn handlerError{user: \"could not populate switch Pokemon template\", err: err}\n\t}\n\n\t// Send the new action options to the requester\n\terr = makeActionOptions(ctx, tp.Services, user.basicTrainerData, user.battleInfo)\n\tif err != nil {\n\t\treturn handlerError{user: \"could not send action options\", err: err}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08874f15cefcc9da74a46c459d410fc8", "score": "0.41715667", "text": "func main() {\n\tsaveEveCables(`{\"_key\":\"420527197812010018\", \"name\":\"董爱华\", \"tel\":\"13511111111\", \"landline\":\"02888888888\",\"address\":\"成都市科环北路\", \"city\":\"成都\"}`)\n\tsaveEntIdCards(`{\"_key\":\"420527197812010018\"}`)\n\tsaveEntPersons(`{\"name\":\"董爱华\", \"id\":\"420527197812010018\", \"tels\":[\"13511111111\"], \"landlines\":[\"02888888888\"],\"addresses\":[\"成都市科环北路\"], \"cities\":[\"成都\"]}`)\n\tsaveEntTels(`{\"_key\":\"13511111111\"}`)\n\tsaveEntLandlines(`{\"_key\":\"02888888888\"}`)\n\n\tsaveEveCables(`{\"_key\":\"520527197901010018\", \"name\":\"喻波\", \"tel\":\"13611111111\", \"landline\":\"01000000000\",\"address\":\"北京市东城区\", \"city\":\"北京\"}`)\n\tsaveEntIdCards(`{\"_key\":\"520527197901010018\"}`)\n\tsaveEntPersons(`{\"name\":\"喻波\", \"id\":\"520527197901010018\", \"tels\":[\"13611111111\"], \"landlines\":[\"01000000000\"], \"addresses\":[\"北京市东城区\"], \"cities\":[\"北京\"]}`)\n\tsaveEntTels(`{\"_key\":\"13611111111\"}`)\n\tsaveEntLandlines(`{\"_key\":\"01000000000\"}`)\n\n\tsaveEveCables(`{\"_key\":\"620527196901010018\", \"name\":\"王志海\", \"tel\":\"13711111111\", \"landline\":\"01011111111\",\"address\":\"北京市西城区\", \"city\":\"北京\"}`)\n\tsaveEntIdCards(`{\"_key\":\"620527196901010018\"}`)\n\tsaveEntPersons(`{\"name\":\"王志海\", \"id\":\"620527196901010018\", \"tels\":[\"13711111111\"], \"landlines\":[\"01011111111\"], \"addresses\":[\"北京市西城区\"], \"cities\":[\"北京\"]}`)\n\tsaveEntTels(`{\"_key\":\"13711111111\"}`)\n\tsaveEntLandlines(`{\"_key\":\"01011111111\"}`)\n\n\tsaveEveCables(`{\"_key\":\"720527197003010018\", \"name\":\"薛晓文\", \"tel\":\"13811111111\", \"landline\":\"01022222222\",\"address\":\"北京市海淀区\", \"city\":\"北京\"}`)\n\tsaveEntIdCards(`{\"_key\":\"720527197003010018\"}`)\n\tsaveEntPersons(`{\"name\":\"薛晓文\", \"id\":\"720527197003010018\", \"tels\":[\"13811111111\"], \"landlines\":[\"01022222222\"], \"addresses\":[\"北京市海淀区\"], \"cities\":[\"北京\"]}`)\n\tsaveEntTels(`{\"_key\":\"13811111111\"}`)\n\tsaveEntLandlines(`{\"_key\":\"01022222222\"}`)\n\n\tsaveEveStudies(`{\"_key\":\"420527200905010018\", \"name\":\"董懿萱\", \"sex\":\"女\", \"address\":\"成都市科环北路\", \"tel\":\"13568984989\", \"school\":\"贵溪小学\"}`)\n\tsaveEntSchools(`{\"name\":\"贵溪小学\",\"_key\":\"school1\"}`)\n\tsaveEntPersons(`{\"name\":\"董懿萱\", \"sex\":\"女\", \"id\":\"420527200905010018\", \"tels\":[\"13568984989\"], \"addresses\":[\"成都市科环北路\"], \"schools\":[\"贵溪小学\"]}`)\n\tsaveEntTels(`{\"_key\":\"13568984989\"}`)\n\tsaveEntPersons(`{\"name\":\"王一\", \"id\":\"420527198903010018\"}`)\n\tsaveEntIdCards(`{\"_key\":\"420527200905010018\"}`)\n\tsaveEntIdCards(`{\"_key\":\"420527198903010018\"}`)\n\n\tsaveEveStudies(`{\"_key\":\"520527199904010018\", \"name\":\"喻小小\", \"sex\":\"男\", \"address\":\"北京市东城区\", \"tel\":\"13611111111\", \"school\":\"北京中学\"}`)\n\tsaveEntSchools(`{\"name\":\"北京中学\",\"_key\":\"school2\"}`)\n\tsaveEntPersons(`{\"name\":\"喻小小\", \"sex\":\"男\", \"id\":\"520527199904010018\", \"tels\":[\"13611111111\"], \"addresses\":[\"北京市东城区\"], \"schools\":[\"北京中学\"]}`)\n\tsaveEntPersons(`{\"name\":\"李一\", \"id\":\"520527198802010018\"}`)\n\tsaveEntIdCards(`{\"_key\":\"520527199904010018\"}`)\n\tsaveEntIdCards(`{\"_key\":\"520527198802010018\"}`)\n\n\tsaveEveKuaidis(`{\"_key\":\"12345678\",\"from\":{\"address\":\"成都\", \"name\":\"董爱华\", \"tel\":\"13568984989\"},\"to\":{\"address\":\"北京\", \"name\":\"喻波\", \"tel\":\"13568984988\"},\"receiver\":{\"name\":\"王小二\", \"tel\":\"13534567891\", \"address\":\"成都\", \"company\":\"顺丰\"},\"sender\":{\"name\":\"李小二\", \"tel\":\"13423456781\", \"address\":\"北京\"},\"__time\":1493668984000,\"updatedAt\":1493678984000}`)\n\tsaveEveKuaidis(`{\"_key\":\"22345678\",\"from\":{\"address\":\"北京\", \"name\":\"喻波\", \"tel\":\"13568984988\"},\"to\":{\"address\":\"北京\", \"name\":\"王志海\", \"tel\":\"13568984987\"},\"receiver\":{\"name\":\"王小三\", \"tel\":\"14534567891\", \"address\":\"北京\", \"company\":\"顺丰\"},\"sender\":{\"name\":\"李小三\", \"tel\":\"13523456781\", \"address\":\"北京\"},\"__time\":1493678984000,\"updatedAt\":1493778984000}`)\n\tsaveEveKuaidis(`({\"_key\":\"32345678\",\"from\":{\"address\":\"北京\", \"name\":\"王志海\", \"tel\":\"13568984987\"},\"to\":{\"address\":\"北京\", \"name\":\"薛晓文\", \"tel\":\"13568984986\"},\"receiver\":{\"name\":\"王小三\", \"tel\":\"14534567891\", \"address\":\"北京\", \"company\":\"顺丰\"},\"sender\":{\"name\":\"李小三\", \"tel\":\"13523456781\", \"address\":\"北京\"},\"__time\":1493778984000,\"updatedAt\":1493878984000}`)\n\n\tsaveEntTels(`{\"_key\":\"13568984988\"}`)\n\tsaveEntTels(`{\"_key\":\"13568984987\"}`)\n\tsaveEntTels(`{\"_key\":\"13568984986\"}`)\n}", "title": "" }, { "docid": "789a93063f320b9204efe80a20247105", "score": "0.417017", "text": "func (ht *MasterHashTable) run() {\n actives := make([]bool, 2048)\n changes := make([]bool, 2048)\n\n for {\n select {\n case idx := <-ht.changed_idx: {\n if actives[idx] {\n changes[idx] = true\n } else {\n ht2 := ht.data[idx]\n active := actives[idx]\n change := changes[idx]\n\n active = true\n change = false\n go ht2.cleanup(&active, &change, idx, true)\n }\n }\n /*\n case <-ht.stop: {\n actives = make(map[int] bool)\n changes = make(map[int] bool)\n }\n */\n }\n }\n}", "title": "" }, { "docid": "71f7773711af8d20f4b8ade497e8c1f2", "score": "0.41496852", "text": "func appendIFD(b []byte, enc byteOrder, entries map[uint16]interface{}) []byte {\n\tvar tags []uint16\n\tfor tag := range entries {\n\t\ttags = append(tags, tag)\n\t}\n\tsort.Slice(tags, func(i, j int) bool {\n\t\treturn tags[i] < tags[j]\n\t})\n\n\tvar ifd []byte\n\tfor _, tag := range tags {\n\t\tifd = enc.AppendUint16(ifd, tag)\n\t\tswitch v := entries[tag].(type) {\n\t\tcase uint16:\n\t\t\tifd = enc.AppendUint16(ifd, dtShort)\n\t\t\tifd = enc.AppendUint32(ifd, 1)\n\t\t\tifd = enc.AppendUint16(ifd, v)\n\t\t\tifd = enc.AppendUint16(ifd, v)\n\t\tcase uint32:\n\t\t\tifd = enc.AppendUint16(ifd, dtLong)\n\t\t\tifd = enc.AppendUint32(ifd, 1)\n\t\t\tifd = enc.AppendUint32(ifd, v)\n\t\tcase []uint16:\n\t\t\tifd = enc.AppendUint16(ifd, dtShort)\n\t\t\tifd = enc.AppendUint32(ifd, uint32(len(v)))\n\t\t\tswitch len(v) {\n\t\t\tcase 0:\n\t\t\t\tifd = enc.AppendUint32(ifd, 0)\n\t\t\tcase 1:\n\t\t\t\tifd = enc.AppendUint16(ifd, v[0])\n\t\t\t\tifd = enc.AppendUint16(ifd, v[1])\n\t\t\tdefault:\n\t\t\t\tifd = enc.AppendUint32(ifd, uint32(len(b)))\n\t\t\t\tfor _, e := range v {\n\t\t\t\t\tb = enc.AppendUint16(b, e)\n\t\t\t\t}\n\t\t\t}\n\t\tcase []uint32:\n\t\t\tifd = enc.AppendUint16(ifd, dtLong)\n\t\t\tifd = enc.AppendUint32(ifd, uint32(len(v)))\n\t\t\tswitch len(v) {\n\t\t\tcase 0:\n\t\t\t\tifd = enc.AppendUint32(ifd, 0)\n\t\t\tcase 1:\n\t\t\t\tifd = enc.AppendUint32(ifd, v[0])\n\t\t\tdefault:\n\t\t\t\tifd = enc.AppendUint32(ifd, uint32(len(b)))\n\t\t\t\tfor _, e := range v {\n\t\t\t\t\tb = enc.AppendUint32(b, e)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unhandled type %T\", v))\n\t\t}\n\t}\n\n\tenc.PutUint32(b[4:8], uint32(len(b)))\n\tb = enc.AppendUint16(b, uint16(len(entries)))\n\tb = append(b, ifd...)\n\tb = enc.AppendUint32(b, 0)\n\treturn b\n}", "title": "" }, { "docid": "d253aa2dafb3f753e4f593e1fa79e027", "score": "0.41492793", "text": "func ProcessTrSokets(msg []byte) {\n\tvar UserId uint64\n\tvar InOut uint64\n\tvar ConfirmedBlocks uint64\n\tvar TrTime uint64\n\tvar CoinID uint64\n\n\tvar TransactionHash string\n\tvar TrFrom string\n\tvar TrTo string\n\tvar TrValue string\n\n\tvar TransactionHashLen uint64\n\tvar TrFromLen uint64\n\tvar TrToLen uint64\n\tvar TrValueLen uint64\n\tvar CoinIDLen uint64\n\tvar MailValue uint64\n\n\tvar typeFl int\n\n\tif len(msg)%198 == 0 {\n\t\tTransactionHashLen = 98\n\t\tTrFromLen = 140\n\t\tTrToLen = 182\n\t\tTrValueLen = 190\n\t\tCoinIDLen = 198\n\t\ttypeFl = 198\n\t} else {\n\t\tTransactionHashLen = 96\n\t\tTrFromLen = 138\n\t\tTrToLen = 180\n\t\tTrValueLen = 200\n\t\tCoinIDLen = 208\n\t\ttypeFl = 208\n\t}\n\n\tvar offset uint64\n\toffset = 0\n\tfor ij:=0; ij < (len(msg)/typeFl); ij++ {\n\n\t\tUserId = binary.LittleEndian.Uint64(msg[0+offset:8+offset])\n\t\tInOut = binary.LittleEndian.Uint64(msg[8+offset:16+offset])\n\t\tConfirmedBlocks = binary.LittleEndian.Uint64(msg[16+offset:24+offset])\n\t\tTrTime = binary.LittleEndian.Uint64(msg[24+offset:32+offset])\n\n\t\tTransactionHash = string(bytes.Trim(msg[32+offset:TransactionHashLen+offset], \"\\x00\"))\n\t\tTrFrom = string(bytes.Trim(msg[TransactionHashLen+offset:TrFromLen+offset], \"\\x00\"))\n\t\tTrTo = string(bytes.Trim(msg[TrFromLen+offset:TrToLen+offset], \"\\x00\"))\n\n\t\tif len(msg)%198 == 0 {\n\t\t\tTrValue2 := binary.LittleEndian.Uint64(msg[TrToLen+offset:TrValueLen+offset])\n\t\t\tTrValue = fmt.Sprintf(\"%v\", TrValue2)\n\t\t\tMailValue = TrValue2\n\t\t} else {\n\t\t\tTrValue = string(bytes.Trim(msg[TrToLen+offset:TrValueLen+offset], \"\\x00\"))\n\t\t\tMailValue, _ = strconv.ParseUint(TrValue, 10, 64)\n\t\t}\n\n\t\tCoinID = binary.LittleEndian.Uint64(msg[TrValueLen+offset:CoinIDLen+offset])\n\n\t\toffset = offset + uint64(typeFl)\n\n\t\t//Send info about receiving coins\n\t\tif InOut == 1 && UserId != 1 && ConfirmedBlocks >= 6 {\n\t\t\tvar MailData mailStruct\n\t\t\tMailData.sndTo = TrTo\n\t\t\tMailData.sndFrom = TrFrom\n\t\t\tMailData.CoinID = CoinID\n\t\t\tMailData.value = MailValue\n\t\t\tMailData.InOut = InOut\n\t\t\tMailData.mail = WclientsId.data[UserId].email\n\t\t\tgo sendMail(MailData)\n\t\t}\n\n\t\tif UserId == 1 { // COLD WALLET TRANSACTION!!!\n\t\t\t//ColdWalletTransactions.db\n\t\t\tif InOut == 1 {\n\t\t\t\tColdWalletTrunsactionsIN[TransactionHash] = UserTrunsaction{UserId: UserId, TransactionHash: TransactionHash, InOut: InOut, TrTime: TrTime, ConfirmedBlocks: ConfirmedBlocks, TrTo: TrTo, TrValue: TrValue, TrFrom: TrFrom, CoinID: CoinID}\n\t\t\t} else {\n\t\t\t\tColdWalletTrunsactionsOUT[TransactionHash] = UserTrunsaction{UserId: UserId, TransactionHash: TransactionHash, InOut: InOut, TrTime: TrTime, ConfirmedBlocks: ConfirmedBlocks, TrTo: TrTo, TrValue: TrValue, TrFrom: TrFrom, CoinID: CoinID}\n\t\t\t}\n\t\t} else {\n\t\t\tif len(TransactionHash) > 10 && len(TrValue) > 2 {\n\t\t\t\tvar updateFlag bool\n\t\t\t\tupdateFlag = false\n\n\t\t\t\t//searching for the transaction that already exist in a binary array\n\t\t\t\tj := 0\n\t\t\t\tglobalCounter++\n\t\t\t\tAllHistoryBin.mux.Lock()\n\t\t\t\tfor n := 0; n < (len(AllHistoryBin.data) / 192); n++ {\n\t\t\t\t\tCoinIDCMP := binary.LittleEndian.Uint16(AllHistoryBin.data[10+j:12+j])\n\t\t\t\t\tif CoinIDCMP != uint16(CoinID) {\n\t\t\t\t\t\tj = j + 192\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tuIDCMP := binary.LittleEndian.Uint64(AllHistoryBin.data[0+j:8+j])\n\t\t\t\t\tInOutCMP := binary.LittleEndian.Uint16(AllHistoryBin.data[8+j:10+j])\n\n\t\t\t\t\tTrToCMP := string(bytes.Trim(AllHistoryBin.data[24+j:66+j], \"\\x00\"))\n\t\t\t\t\tTrFromCMP := string(bytes.Trim(AllHistoryBin.data[66+j:108+j], \"\\x00\"))\n\t\t\t\t\tTransactionHashCMP := string(bytes.Trim(AllHistoryBin.data[126+j:192+j], \"\\x00\"))\n\n\t\t\t\t\tif uIDCMP == UserId && InOutCMP == uint16(InOut) && TrToCMP == TrTo && TrFromCMP == TrFrom && TransactionHashCMP == TransactionHash {\n\t\t\t\t\t\t//update comfirmed number\n\t\t\t\t\t\t//DON'T USE PutUint in AllHistoryBin!!!\n\t\t\t\t\t\tvar tmpBuf= make([]byte, 2)\n\t\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[0:2], uint16(ConfirmedBlocks))\n\t\t\t\t\t\tcopy(AllHistoryBin.data[14+j:16+j], tmpBuf)\n\t\t\t\t\t\tupdateFlag = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif CoinID == 1 && InOut == 0 || CoinID == 3 && InOut == 0 { // sent Bitcoin\n\t\t\t\t\t\tif uIDCMP == UserId && InOutCMP == uint16(InOut) && strings.ToLower(TrToCMP) == strings.ToLower(TrTo) && TransactionHashCMP == TransactionHash {\n\t\t\t\t\t\t\t//update comfirmed number\n\t\t\t\t\t\t\t//DON'T USE PutUint in AllHistoryBin!!!\n\t\t\t\t\t\t\tvar tmpBuf= make([]byte, 2)\n\t\t\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[0:2], uint16(ConfirmedBlocks))\n\t\t\t\t\t\t\tcopy(AllHistoryBin.data[14+j:16+j], tmpBuf)\n\t\t\t\t\t\t\tupdateFlag = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj = j + 192\n\t\t\t\t}\n\t\t\t\tAllHistoryBin.mux.Unlock()\n\n\t\t\t\t//adding new transaction\n\t\t\t\tif updateFlag == false {\n\t\t\t\t\tvar tmpBuf= make([]byte, 192)\n\t\t\t\t\tUid := UserId\n\t\t\t\t\tbinary.LittleEndian.PutUint64(tmpBuf[0:8], Uid)\n\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[8:10], uint16(InOut))\n\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[10:12], uint16(CoinID))\n\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[12:14], 0)\n\t\t\t\t\tbinary.LittleEndian.PutUint16(tmpBuf[14:16], uint16(ConfirmedBlocks))\n\t\t\t\t\tbinary.LittleEndian.PutUint64(tmpBuf[16:24], TrTime)\n\n\t\t\t\t\tcopy(tmpBuf[24:66], []byte(TrTo))\n\t\t\t\t\tcopy(tmpBuf[66:108], []byte(TrFrom))\n\t\t\t\t\tcopy(tmpBuf[108:126], []byte(TrValue))\n\t\t\t\t\tcopy(tmpBuf[126:192], []byte(TransactionHash))\n\n\t\t\t\t\tif len(AllHistoryBin.data) <= 1 {\n\t\t\t\t\t\tAllHistoryBin.mux.Lock()\n\t\t\t\t\t\tAllHistoryBin.data = tmpBuf\n\t\t\t\t\t\tAllHistoryBin.mux.Unlock()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tAllHistoryBin.mux.Lock()\n\t\t\t\t\t\tAllHistoryBin.data = append(AllHistoryBin.data, tmpBuf...)\n\t\t\t\t\t\tAllHistoryBin.mux.Unlock()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//globalCounter++\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b941206fa1432d48bc30decffd4dbd1", "score": "0.4145095", "text": "func (p *Parser) handleStsd(te *TrackEntry, stsd *Element) error {\n\terr := stsd.ParseFlags()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentrycount, err := stsd.readInt32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif entrycount > 0 {\n\t\tcodec, err := stsd.Next()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif te.Handler == \"soun\" {\n\t\t\terr = p.handleSoun(te, codec)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6bdee107b03d60acab119d0c4d83c5d1", "score": "0.4133961", "text": "func ByteArrayToDecisionTable(inBuf []byte) map[string][3]string {\n\n\tdecisionTable := make(map[string][3]string)\n\tSID := string(inBuf[:16])\n\thopsArray := inBuf[16:]\n\tfmt.Println(\"Hops Array:\", string(hopsArray))\n\thopStringsArray := [3]string{}\n\taddrCount := 0\n\taddrString := \"\"\n\n\tfor _, value := range hopsArray {\n\t\tif addrCount < 3 {\n\t\t\tif string(value) != \"!\" {\n\t\t\t\taddrString += string(value)\n\t\t\t} else {\n\t\t\t\thopStringsArray[addrCount] = addrString\n\t\t\t\tfmt.Println(\"addrCount\", addrCount, \"addrString\", addrString, \"hopStringsArray\", hopStringsArray)\n\t\t\t\taddrCount++\n\t\t\t\taddrString = \"\"\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tdecisionTable[SID] = hopStringsArray\n fmt.Println(\"From Byte Array:\", decisionTable)\n\n\treturn decisionTable\n}", "title": "" }, { "docid": "b440cf4553eadf15f5abad3bbd0e256e", "score": "0.41000462", "text": "func serveTestTable(w http.ResponseWriter, r *http.Request) {\n\ta := make([]web.Advert, 0)\n\ta = append(a, web.Advert{\n\t\tSource: \"TST\",\n\t\tAdNum: \"TT1\",\n\t\tCat: \"NONE\",\n\t\tDesc: \"SOME DESC\",\n\t\tLink: \"example@mail.com\",\n\t\tContact: \"01/12331\",\n\t\tRate: \"0.00\",\n\t\tDate: \"2016-05-06\",\n\t})\n\ta = append(a, web.Advert{\n\t\tSource: \"TST\",\n\t\tAdNum: \"TT2\",\n\t\tCat: \"NONE\",\n\t\tDesc: \"SOME DESC that is way longer than the previous\",\n\t\tLink: \"example2@mail.com\",\n\t\tContact: \"01/1s56a331; 1568132/65\",\n\t\tRate: \"30.00\",\n\t\tDate: \"2016-05-06\",\n\t})\n\tselect {\n\tcase <-r.Context().Done():\n\t\tfmt.Println(\"CLIENT DISCONNECTED FROM INDX PG\")\n\t\treturn\n\n\tdefault:\n\t\tt, err := template.ParseFiles(\"./commands/tst_serv/templates/agregator.html\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Println(\"TEST TABLE RAN\")\n\t\terr = t.Execute(w, a)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"FAILED EXEC TEMPL:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e3cc830d1a6b9a0f326fb11199bbd5c1", "score": "0.40957502", "text": "func (self *Boxfile) AddStorageNode() {\n for _, node := range self.Nodes() {\n name := regexp.MustCompile(`\\d+`).ReplaceAllString(node, \"\")\n if (name == \"web\" || name == \"worker\") && self.Node(node).Value(\"network_dirs\") != nil {\n found := false\n for _, storage := range self.Node(node).Node(\"network_dirs\").Nodes() {\n found = true\n if !self.Node(storage).Valid {\n self.Parsed[storage] = map[string]interface{}{\"found\": true}\n }\n }\n\n // if i dont find anything but they did have a network_dirs.. just try adding a new one\n if !found {\n if !self.Node(\"nfs1\").Valid {\n self.Parsed[\"nfs1\"] = map[string]interface{}{\"found\": true}\n }\n }\n }\n }\n}", "title": "" }, { "docid": "a63a1a1380857e1c54c99e62429321b1", "score": "0.40947962", "text": "func insertInDatabase(tx *sql.Tx, objectInstanceIdentifier int64, element Element, objectType ObjectType, domain String, archiveDetails ArchiveDetails) error {\n\t// Encode the Element and the ObjectId from the ArchiveDetails\n\tencodedElement, encodedObjectID, err := utils.EncodeElements(element, *archiveDetails.Details.Source)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Execute the query to insert all the values in the database\n\t_, err = tx.Exec(\"INSERT INTO \"+TABLE+\" VALUES ( NULL , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )\",\n\t\tobjectInstanceIdentifier,\n\t\tencodedElement,\n\t\tobjectType.Area,\n\t\tobjectType.Service,\n\t\tobjectType.Version,\n\t\tobjectType.Number,\n\t\tdomain,\n\t\ttime.Time(*archiveDetails.Timestamp),\n\t\t*archiveDetails.Details.Related,\n\t\t*archiveDetails.Network,\n\t\t*archiveDetails.Provider,\n\t\tencodedObjectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bc244fd5b209569090185dfc6b807682", "score": "0.40903494", "text": "func (c *Controller) onTopologyChanges(added []*topology.Segment, removed []*topology.Segment) {\n\tklog.V(3).Infof(\"Capacity Controller: topology changed: added %v, removed %v\", added, removed)\n\n\tstorageclasses, err := c.scInformer.Lister().List(labels.Everything())\n\tif err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn\n\t}\n\n\tc.capacitiesLock.Lock()\n\tdefer c.capacitiesLock.Unlock()\n\n\tfor _, sc := range storageclasses {\n\t\tif sc.Provisioner != c.driverName {\n\t\t\tcontinue\n\t\t}\n\t\tif !c.immediateBinding && sc.VolumeBindingMode != nil && *sc.VolumeBindingMode == storagev1.VolumeBindingImmediate {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, segment := range added {\n\t\t\tc.addWorkItem(segment, sc)\n\t\t}\n\t\tfor _, segment := range removed {\n\t\t\tc.removeWorkItem(segment, sc)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2183caa355668ac4d5915bf1d5eef693", "score": "0.4086806", "text": "func handleChainEvent(elem Event) {\n\tswitch elem.etype {\n\tcase \"block\":\n\t\t//bc := BlockEvent{\"xxx\", \"yyy\"}\n\t\tnotifyEvent(\"block\", elem.payload)\n\tcase \"transaction\":\n\t\t//tx := TxEvent{\"xxx\", \"yyy\"}\n\t\tnotifyEvent(\"Tx\", elem.payload)\n\tdefault:\n\t\t//ud := userDefined{\"xxx\", \"yyy\"}\n\t\tnotifyEvent(elem.etype, elem.payload)\n\t}\n}", "title": "" }, { "docid": "0021110b074d1980945e091be72a2ea7", "score": "0.40777683", "text": "func prepareRoTdata(index int) ([]string, [][]interface{}) {\n\tvar queryArray []string // mark it as Max Queries\n\tvar docArray [][]interface{}\n\tswitch index {\n\tcase firstIndex:\n\t\t// For the first array element\n\t\tqvar := \"FOR d IN hwid_collection FILTER d.HardwareIdentity.`psa-hardware-rot`.`implementation-id` == @platformId RETURN d\"\n\t\tqueryArray = append(queryArray, qvar)\n\t\tdocList := []interface{}{}\n\t\tvar qRsp = [1]HardwareIdentityWrapper{HardwareIdentityWrapper{ID: HardwareIdentity{TagID: hwTag, Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\"}}}, HardwareRot: PsaHardwareRot{ImplementationID: tImplID, HwVer: \"acme-rr-trap\"}}}}\n\t\tdocList = append(docList, qRsp[0])\n\t\tdocArray = append(docArray, docList)\n\t\tquery := \"FOR swid, link IN INBOUND \" + \"'hwid_collection/example.acme.roadrunner-hw-v1-0-0'\" + \" \" + \"edge_verif_scheme\"\n\t\tquery += \"\\n\" + \" FILTER link.rel == 'psa-rot-compound' RETURN swid\"\n\t\tqueryArray = append(queryArray, query)\n\t\tvar swRsp = [4]SoftwareIdentityWrapper{\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: blBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner boot loader\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"BL\", Description: \"TF-M_SHA256MemPreXIP\", MeasurementValue: blMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: pRotBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner PRoT\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M1\", Description: \"\", MeasurementValue: pRotMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: aRotBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner ARoT\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M2\", Description: \"\", MeasurementValue: aRotMeasVal, SignerID: \"\"}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: appBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner App\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M3\", Description: \"\", MeasurementValue: appMeasVal, SignerID: \"\"}}}}}},\n\t\t}\n\t\tdocList = []interface{}{}\n\t\tfor _, swid := range swRsp {\n\t\t\tdocList = append(docList, swid)\n\t\t}\n\t\tdocArray = append(docArray, docList)\n\n\tcase secondIndex:\n\t\t// For second test, the measurement does not match the Platform RoT, but one of the patches\n\t\t// For the first array element\n\t\tqvar := \"FOR d IN hwid_collection FILTER d.HardwareIdentity.`psa-hardware-rot`.`implementation-id` == @platformId RETURN d\"\n\t\tqueryArray = append(queryArray, qvar)\n\t\tdocList := []interface{}{}\n\t\tvar qRsp = [1]HardwareIdentityWrapper{HardwareIdentityWrapper{ID: HardwareIdentity{TagID: hwTag, Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\"}}}, HardwareRot: PsaHardwareRot{ImplementationID: tImplID, HwVer: \"acme-rr-trap\"}}}}\n\t\tdocList = append(docList, qRsp[0])\n\t\tdocArray = append(docArray, docList)\n\t\tquery := \"FOR swid, link IN INBOUND \" + \"'hwid_collection/example.acme.roadrunner-hw-v1-0-0'\" + \" \" + \"edge_verif_scheme\"\n\t\tquery += \"\\n\" + \" FILTER link.rel == 'psa-rot-compound' RETURN swid\"\n\t\tqueryArray = append(queryArray, query)\n\t\tvar swRsp = [4]SoftwareIdentityWrapper{\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: blBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner boot loader\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"BL\", Description: \"TF-M_SHA256MemPreXIP\", MeasurementValue: blMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: pRotBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner PRoT\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M1\", Description: \"\", MeasurementValue: pRotMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: aRotBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner ARoT\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M2\", Description: \"\", MeasurementValue: aRotMeasVal, SignerID: \"\"}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: appBaseTag, TagVersion: 0, SoftwareName: \"Roadrunner App\", SoftwareVersion: \"1.0.0\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M3\", Description: \"\", MeasurementValue: appMeasVal, SignerID: \"\"}}}}}},\n\t\t}\n\t\tdocList = []interface{}{}\n\t\tfor _, swid := range swRsp {\n\t\t\tdocList = append(docList, swid)\n\t\t}\n\t\tdocArray = append(docArray, docList)\n\t\t// return patch node with matching measurements, when queried for all relations\n\t\tquery = \"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-app-v1-0-0'\" + space\n\t\tquery += \"edge_rel_scheme\" + newline + \" RETURN swid\"\n\t\tqueryArray = append(queryArray, query)\n\t\tswRsp1 := []SoftwareIdentityWrapper{\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: appPV1, TagVersion: 0, SoftwareName: \"Roadrunner App Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M3\", Description: \"\", MeasurementValue: appPMeasVal, SignerID: \"\"}}}}}},\n\t\t}\n\t\tdocList = []interface{}{}\n\t\tfor _, swid := range swRsp1 {\n\t\t\tdocList = append(docList, swid)\n\t\t}\n\t\tdocArray = append(docArray, docList)\n\t}\n\treturn queryArray, docArray\n}", "title": "" }, { "docid": "15694ab2b412c008e335299c5a94fd1d", "score": "0.40722567", "text": "func (p *Parser) onCDemoSendTables(m *dota.CDemoSendTables) error {\n\tr := newReader(m.GetData())\n\tbuf := r.readBytes(r.readVarUint32())\n\n\tmsg := &dota.CSVCMsg_FlattenedSerializer{}\n\tif err := proto.Unmarshal(buf, msg); err != nil {\n\t\treturn err\n\t}\n\n\tpatches := []fieldPatch{}\n\tfor _, h := range fieldPatches {\n\t\tif h.shouldApply(p.GameBuild) {\n\t\t\tpatches = append(patches, h)\n\t\t}\n\t}\n\n\tfields := map[int32]*field{}\n\tfieldTypes := map[string]*fieldType{}\n\n\tfor _, s := range msg.GetSerializers() {\n\t\tserializer := &serializer{\n\t\t\tname: msg.GetSymbols()[s.GetSerializerNameSym()],\n\t\t\tversion: s.GetSerializerVersion(),\n\t\t\tfields: []*field{},\n\t\t}\n\n\t\tfor _, i := range s.GetFieldsIndex() {\n\t\t\tif _, ok := fields[i]; !ok {\n\t\t\t\t// create a new field\n\t\t\t\tfield := newField(msg, msg.GetFields()[i])\n\n\t\t\t\t// patch parent name in builds <= 990\n\t\t\t\tif p.GameBuild <= 990 {\n\t\t\t\t\tfield.parentName = serializer.name\n\t\t\t\t}\n\n\t\t\t\t// find or create a field type\n\t\t\t\tif _, ok := fieldTypes[field.varType]; !ok {\n\t\t\t\t\tfieldTypes[field.varType] = newFieldType(field.varType)\n\t\t\t\t}\n\t\t\t\tfield.fieldType = fieldTypes[field.varType]\n\n\t\t\t\t// find associated serializer\n\t\t\t\tif field.serializerName != \"\" {\n\t\t\t\t\tfield.serializer = p.serializers[field.serializerName]\n\t\t\t\t}\n\n\t\t\t\t// apply any build-specific patches to the field\n\t\t\t\tfor _, h := range patches {\n\t\t\t\t\th.patch(field)\n\t\t\t\t}\n\n\t\t\t\t// determine field model\n\t\t\t\tif field.serializer != nil {\n\t\t\t\t\tif field.fieldType.pointer || pointerTypes[field.fieldType.baseType] {\n\t\t\t\t\t\tfield.setModel(fieldModelFixedTable)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfield.setModel(fieldModelVariableTable)\n\t\t\t\t\t}\n\t\t\t\t} else if field.fieldType.count > 0 && field.fieldType.baseType != \"char\" {\n\t\t\t\t\tfield.setModel(fieldModelFixedArray)\n\t\t\t\t} else if field.fieldType.baseType == \"CUtlVector\" || field.fieldType.baseType == \"CNetworkUtlVectorBase\" {\n\t\t\t\t\tfield.setModel(fieldModelVariableArray)\n\t\t\t\t} else {\n\t\t\t\t\tfield.setModel(fieldModelSimple)\n\t\t\t\t}\n\n\t\t\t\t// store the field\n\t\t\t\tfields[i] = field\n\t\t\t}\n\n\t\t\t// add the field to the serializer\n\t\t\tserializer.fields = append(serializer.fields, fields[i])\n\t\t}\n\n\t\t// store the serializer for field reference\n\t\tp.serializers[serializer.name] = serializer\n\n\t\tif _, ok := p.classesByName[serializer.name]; ok {\n\t\t\tp.classesByName[serializer.name].serializer = serializer\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e3d9efdb1aead896b202eb672f82dba8", "score": "0.4066037", "text": "func processVMNet(spec string) (res NetConfig, err error) {\n\t// example: my_bridge,100,00:00:00:00:00:00\n\tf := strings.Split(spec, \",\")\n\n\tvar b string\n\tvar v string\n\tvar m string\n\tvar d string\n\tswitch len(f) {\n\tcase 1:\n\t\tv = f[0]\n\tcase 2:\n\t\tif isMac(f[1]) {\n\t\t\t// vlan, mac\n\t\t\tv = f[0]\n\t\t\tm = f[1]\n\t\t} else if _, err := strconv.Atoi(f[0]); err == nil {\n\t\t\t// vlan, driver\n\t\t\tv = f[0]\n\t\t\td = f[1]\n\t\t} else {\n\t\t\t// bridge, vlan\n\t\t\tb = f[0]\n\t\t\tv = f[1]\n\t\t}\n\tcase 3:\n\t\tif isMac(f[2]) {\n\t\t\t// bridge, vlan, mac\n\t\t\tb = f[0]\n\t\t\tv = f[1]\n\t\t\tm = f[2]\n\t\t} else if isMac(f[1]) {\n\t\t\t// vlan, mac, driver\n\t\t\tv = f[0]\n\t\t\tm = f[1]\n\t\t\td = f[2]\n\t\t} else {\n\t\t\t// bridge, vlan, driver\n\t\t\tb = f[0]\n\t\t\tv = f[1]\n\t\t\td = f[2]\n\t\t}\n\tcase 4:\n\t\tb = f[0]\n\t\tv = f[1]\n\t\tm = f[2]\n\t\td = f[3]\n\tdefault:\n\t\terr = errors.New(\"malformed netspec\")\n\t\treturn\n\t}\n\n\tlog.Debug(\"vm_net got b=%v, v=%v, m=%v, d=%v\", b, v, m, d)\n\n\t// VLAN ID, with optional bridge\n\tvlan, err := strconv.Atoi(v) // the vlan id\n\tif err != nil {\n\t\terr = errors.New(\"malformed netspec, vlan must be an integer\")\n\t\treturn\n\t}\n\n\tif m != \"\" && !isMac(m) {\n\t\terr = errors.New(\"malformed netspec, invalid mac address: \" + m)\n\t\treturn\n\t}\n\n\tvar currBridge *bridge\n\tcurrBridge, err = getBridge(b)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = currBridge.LanCreate(vlan)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif b == \"\" {\n\t\tb = DEFAULT_BRIDGE\n\t}\n\tif d == \"\" {\n\t\td = VM_NET_DRIVER_DEFAULT\n\t}\n\n\tres = NetConfig{\n\t\tVLAN: vlan,\n\t\tBridge: b,\n\t\tMAC: strings.ToLower(m),\n\t\tDriver: d,\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4e8264a2d2c375ed35edbcf602506772", "score": "0.4063537", "text": "func getElement(col string, id string) ([]byte, error) {\n\n\tcc := collections[col]\n\n\t//Get the element from the map\n\telemento := cc.Mapa[id]\n\n\t//checks if the element exists in the cache\n\tif elemento==nil {\n\t\tfmt.Println(\"Elemento not in memory, reading disk, ID: \",id)\n\n\t\t//read the disk\n\t\tcontent, er:=readJsonFromDisK(col, id)\n\n\t\t//if file doesnt exists cache the not found and return nil\n\t\tif er!= nil {\n\t\t\t//create the element and set it as deleted\n\t\t\tcreateElement(col, id, \"\", false, true) // set as deleted and do not save to disk\n\t\t} else {\n\t\t\t//Create the element from the disk content\n\t\t\t_,err := createElement(col, id, string(content), false,false) // set to not save to disk\n\t\t\tif err!=nil{\n\t\t\t\treturn nil, errors.New(\"Invalid Disk JSON\")\n\t\t\t}\n\t\t}\n\n\t\t//call get element again (recursively)\n\t\treturn getElement(col,id)\n\t}\n\n\t//If the Not-found is cached, return false directely\n\tif elemento.Value.(node).Deleted==true {\n\t\tfmt.Println(\"Not-Found cached detected on getting, ID: \",id)\n\t\treturn nil, nil\n\t}\n\n\t//Move the element to the front of the LRU-List using a goru\n\tgo moveFront(elemento)\n\n\t//Verifica si esta swapeado\n\tif elemento.Value.(node).Swap==true {\n\n\t\t//Read the swapped json from disk\n\t\tb, _:=readJsonFromDisK(col, id)\n\n\t\t//TODO: read if there was an error and do something...\n\n\t\t//convert the content into json\n\t\tvar f interface{}\n\t\terr := json.Unmarshal(b, &f)\n\n\t\tif err != nil {\n\t\t\treturn nil,err\n\t\t}\n\n\t\tm := f.(map[string]interface{})\n\n\t\t//save the map in the node, mark it as un-swapped\n\t\tvar unswappedNode node\n\t\tunswappedNode.V = m\n\t\tunswappedNode.Swap = false\n\t\telemento.Value=unswappedNode\n\n\t\t//increase de memory counter\n\t\tmemBytes += int64(len(b))\n\n\t\t//as we have load content from disk, we have to purge LRU\n\t\tgo purgeLRU()\n\t}\n\n\t//Return the element\n\tb, err := json.Marshal(elemento.Value.(node).V)\n\treturn b, err\n\n}", "title": "" }, { "docid": "325117ac1b266302cae1b22a241e9457", "score": "0.40601185", "text": "func insertReplaceFW(tblName, div, dir, sip, dip string, stime, etime uint32, protocol, port, reason string) int {\r\n\tquery := \"INSERT OR REPLACE INTO \" + tblName + \" (DIV, DIR, SIP, DIP, STIME, ETIME, PROTOCOL, PORT, ACT, REASON) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\"\r\n\tlprintf(4, \"[INFO] insert query : %s -> sip (%s), tblName (%s) \\n\", query, sip, tblName)\r\n\r\n\tstatement, err := cls.SqliteDB.Prepare(query)\r\n\tif err != nil {\r\n\t\tlprintf(1, \"[ERROR] sql prepare error : %s\\n\", err.Error())\r\n\t\treturn FAIL\r\n\t}\r\n\tdefer statement.Close()\r\n\t_, err = statement.Exec(div, dir, sip, dip, stime, etime, protocol, port, \"1\", reason)\r\n\tif err != nil {\r\n\t\tlprintf(1, \"[ERROR] sql insert exec error : %s\\n\", err.Error())\r\n\t\treturn FAIL\r\n\t}\r\n\r\n\tlprintf(4, \"[INFO] statement query finished \\n\")\r\n\treturn SUCCESS\r\n}", "title": "" }, { "docid": "2f0b1f37d00cc8652fece6326140cf38", "score": "0.40579185", "text": "func (tr *trooper) attach() {\n\tfor _, b := range tr.bits {\n\t\tif b.attach() {\n\t\t\treturn\n\t\t}\n\t}\n\ttr.evolve()\n}", "title": "" }, { "docid": "2ec59c66c6d93da75415442d5ecc6677", "score": "0.40575498", "text": "func tableManager(communicator *tableCom, done chan bool) {\n\tstorage := make(map[string]string)\n\tvar i int = 0 //keep track of # of requests\n\tfor task := range communicator.request {\n\t\ti++\n\t\tswitch task[0] {\n\t\tcase 'R':\n\t\t\t//read the value from storage and send it\n\t\t\tvalue, present := processRead(storage, task[1:])\n\t\t\tif present {\n\t\t\t\tcommunicator.response <- \"T\" + value //indicate a value was found\n\t\t\t} else {\n\t\t\t\tcommunicator.response <- \"F\"\n\t\t\t}\n\t\tcase 'W':\n\t\t\tprocessWrite(storage, task[1:])\n\t\t}\n\t}\n\t//Once loop exits the channel should be closed\n\t//fmt.Println(\"On Exit: Size:\",len(storage),\" #Requests:\",i)\n}", "title": "" }, { "docid": "aa0bc7b3f619fb7a201e28d1f30e0f59", "score": "0.4052872", "text": "func processNodeSpecificConfig(nodeConfig *contiv.NodeConfig) (nicToSteal string, useDHCP bool) {\n\tnicToSteal = nodeConfig.StealInterface\n\tif nicToSteal != \"\" {\n\t\tlogger.Debugf(\"Found interface to be stolen: %s\", nodeConfig.StealInterface)\n\t\tif nodeConfig.MainVPPInterface.UseDHCP == true {\n\t\t\tuseDHCP = true\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a3806ccd9ad96c8c760be12032b41d2", "score": "0.40526977", "text": "func (c *InterfaceStateUpdater) processInterfaceStatEntry(ifCounters govppapi.InterfaceCounters) {\n\n\tifState, found := c.getIfStateDataWLookup(ifCounters.InterfaceIndex)\n\tif !found {\n\t\treturn\n\t}\n\n\tifState.Statistics = &intf.InterfaceState_Statistics{\n\t\tDropPackets: ifCounters.Drops,\n\t\tPuntPackets: ifCounters.Punts,\n\t\tIpv4Packets: ifCounters.IP4,\n\t\tIpv6Packets: ifCounters.IP6,\n\t\tInNobufPackets: ifCounters.RxNoBuf,\n\t\tInMissPackets: ifCounters.RxMiss,\n\t\tInErrorPackets: ifCounters.RxErrors,\n\t\tOutErrorPackets: ifCounters.TxErrors,\n\t\tInPackets: ifCounters.RxPackets,\n\t\tInBytes: ifCounters.RxBytes,\n\t\tOutPackets: ifCounters.TxPackets,\n\t\tOutBytes: ifCounters.TxBytes,\n\t}\n\n\tc.publishIfState(&intf.InterfaceNotification{\n\t\tType: intf.InterfaceNotification_COUNTERS, State: ifState})\n}", "title": "" }, { "docid": "5d137c47344cbcdf206b59395ea61b2a", "score": "0.40479216", "text": "func saveHandler(ctx context.Context, in *common.InvocationEvent) (out *common.Content, err error) {\n\tsaveReqCtr.Inc()\n\tvar req frontend.SaveReq\n\tif err := json.Unmarshal(in.Data, &req); err != nil {\n\t\tlogger.Printf(\"saveHandler json.Unmarshal err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\t// create the client\n\tclient, err := dapr.NewClient()\n\tif err != nil {\n\t\tlogger.Printf(\"saveHandler dapr err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\t// update latency metric\n\tepoch := time.Now()\n\tservLat := epoch.UnixMilli() - req.SendUnixMilli\n\t// generate a post id\n\tpostId := util.PostId(req.UserId, req.SendUnixMilli)\n\t// decode & save images if any\n\timages := make([]string, 0)\n\tif len(req.Images) > 0 {\n\t\titems := make([]*dapr.SetStateItem, 0)\n\t\t// decode\n\t\tfor i, d := range(req.Images) {\n\t\t\timageId := util.ImageId(postId, i)\n\t\t\tdbytes, err := base64.StdEncoding.DecodeString(d)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Printf(\"saveHandler err decoding base64 image %s: %s\",\n\t\t\t\t\timageId, err.Error())\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\timages = append(images, imageId)\n\t\t\t\tnewItem := &dapr.SetStateItem{\n\t\t\t\t\tEtag: nil,\n\t\t\t\t\tKey: imageId,\n\t\t\t\t\t// Metadata: map[string]string{\n\t\t\t\t\t// \t\"created-on\": time.Now().UTC().String(),\n\t\t\t\t\t// },\n\t\t\t\t\tMetadata: nil,\n\t\t\t\t\tValue: dbytes,\n\t\t\t\t\tOptions: &dapr.StateOptions{\n\t\t\t\t\t\t// Concurrency: dapr.StateConcurrencyLastWrite,\n\t\t\t\t\t\tConsistency: dapr.StateConsistencyStrong,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\titems = append(items, newItem)\n\t\t\t}\n\t\t}\n\t\t// update latency metric\n\t\tservLat += time.Now().UnixMilli() - epoch.UnixMilli()\n\t\tepoch = time.Now()\n\t\t// save\n\t\terr := client.SaveBulkState(ctx, imageStore, items...)\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"saveHandler err saving to %s: %s\",\n\t\t\t\timageStore, err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\t// update latency metric\n\t\tstoreLat := time.Now().UnixMilli() - epoch.UnixMilli()\n\t\tupdateStoreLatHist.Observe(float64(storeLat))\n\t\tepoch = time.Now()\n\t}\n\n\t// save the PostCont\n\tsaveReq := post.SavePostReq{\n\t\tPostId: postId,\n\t\tPostCont: post.PostCont{\n\t\t\tUserId: req.UserId,\n\t\t\tText: req.Text,\n\t\t\tImages: images,\n\t\t},\n\t\t// sender side timestamp in unix millisecond\n\t\tSendUnixMilli: time.Now().UnixMilli(),\n\t}\n\tsaveReqData, err := json.Marshal(saveReq)\n\tif err != nil {\n\t\tlogger.Printf(\"saveHanlder json.Marshal (saveReq) err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tcontent := &dapr.DataContent{\n\t\tContentType: \"application/json\",\n\t\tData: saveReqData,\n\t}\n\t// update latency metric\n\tservLat += time.Now().UnixMilli() - epoch.UnixMilli()\n\t// invoke dapr-post\n\tsaveRespData, err := client.InvokeMethodWithContent(ctx, \"dapr-post\", \"save\", \"post\", content)\t\n\tif err != nil {\n\t\tlogger.Printf(\"invoke dapr-post:save err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\t// update latency metric\n\tvar saveResp post.UpdatePostResp\n\tif err := json.Unmarshal(saveRespData, &saveResp); err != nil {\n\t\tlogger.Printf(\"saveHandler json.Unmarshal (saveRespData) err: %s\", err.Error())\n\t\treturn nil, err\n\t} else {\n\t\tservLat += time.Now().UnixMilli() - saveResp.SendUnixMilli\n\t\tepoch = time.Now()\n\t}\n\t// issue request for timeline update\n\ttimelineReq := timeline.UpdateReq{\n\t\tUserId: req.UserId,\n\t\tPostId: postId,\n\t\tAdd: true,\n\t\tImageIncluded: len(images) > 0,\n\t\tClientUnixMilli: req.SendUnixMilli, \n\t\tSendUnixMilli: time.Now().UnixMilli(),\n\t}\n\ttlUpdateReqCtr.Inc()\n\tif err := client.PublishEventfromCustomContent(ctx, timelinePubsub, timelineTopic, timelineReq); err != nil {\n\t\tlogger.Printf(\"saveHandler err publish to pubsub %s topic %s: %s\", \n\t\t\ttimelinePubsub, timelineTopic, err.Error())\n\t\treturn nil, err\n\t}\n\t// issue request for object detection\n\tif len(images) > 0 {\n\t\tobjReq := objectdetect.Req{\n\t\t\tPostId: postId,\n\t\t\tImages: images,\n\t\t\tClientUnixMilli: req.SendUnixMilli, \n\t\t\tSendUnixMilli: time.Now().UnixMilli(),\n\t\t}\n\t\tif err := client.PublishEventfromCustomContent(ctx, objectPubsub, objectTopic, objReq); err != nil {\n\t\t\tlogger.Printf(\"saveHandler err publish to pubsub %s topic %s: %s\", \n\t\t\t\tobjectPubsub, objectTopic, err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\tobjDetReqCtr.Inc()\n\t}\n\t// issue request for sentiment analysis\n\tsentiReq := sentiment.Req{\n\t\tPostId: postId,\n\t\tText: req.Text,\n\t\tImageIncluded: len(images) > 0,\n\t\tClientUnixMilli: req.SendUnixMilli, \n\t\tSendUnixMilli: time.Now().UnixMilli(),\n\t}\n\tif err := client.PublishEventfromCustomContent(ctx, sentiPubsub, sentiTopic, sentiReq); err != nil {\n\t\tlogger.Printf(\"saveHandler err publish to pubsub %s topic %s: %s\", \n\t\t\tsentiPubsub, sentiTopic, err.Error())\n\t\treturn nil, err\n\t}\n\tsentiReqCtr.Inc()\n\t// update latency metric\n\tendEpoch := time.Now()\n\tservLat += endEpoch.UnixMilli() - epoch.UnixMilli()\n\tif len(images) > 0 {\n\t\tsaveReqImgLatHist.Observe(float64(servLat))\n\t\t// end-to-end latency metric\n\t\te2ePostSaveImgLatHist.Observe(float64(endEpoch.UnixMilli() - req.SendUnixMilli))\n\t} else {\n\t\tsaveReqLatHist.Observe(float64(servLat))\n\t\t// end-to-end latency metric\n\t\te2ePostSaveLatHist.Observe(float64(endEpoch.UnixMilli() - req.SendUnixMilli))\n\t}\n\t\n\t// create response\n\tresp := frontend.UpdateResp{\n PostId: postId,\n }\n respData, err := json.Marshal(resp)\n\tif err != nil {\n\t\tlogger.Printf(\"saveHandler json.Marshal (respData) err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tout = &common.Content{\n\t\tContentType: \"application/json\",\n\t\tData: respData,\n\t}\n\treturn\n}", "title": "" }, { "docid": "253afc9c432be63269480358e42ac764", "score": "0.40425217", "text": "func writeElement(w io.Writer, element interface{}) error {\n\treturn binary.Write(w, binary.LittleEndian, element)\n}", "title": "" }, { "docid": "b3ae8117c9856f8c5b3e8e707d7f2771", "score": "0.40363917", "text": "func (d *Device) executePingSlotInfoAns(payload []byte) {\n\n\tif !d.Info.Configuration.SupportedClassB {\n\t\treturn\n\t}\n\n\td.SwitchClass(classes.ClassB)\n\n}", "title": "" }, { "docid": "eb69a84a50134a03a0799ae3456528b3", "score": "0.4031516", "text": "func (g *installerGenerator) modifyBMHFile(file *config_latest_types.File, bmh *bmh_v1alpha1.BareMetalHost, host *models.Host) error {\n\tinventory := models.Inventory{}\n\terr := json.Unmarshal([]byte(host.Inventory), &inventory)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thw := bmh_v1alpha1.HardwareDetails{\n\t\tCPU: bmh_v1alpha1.CPU{\n\t\t\tArch: inventory.CPU.Architecture,\n\t\t\tModel: inventory.CPU.ModelName,\n\t\t\tClockMegahertz: bmh_v1alpha1.ClockSpeed(inventory.CPU.Frequency),\n\t\t\tFlags: inventory.CPU.Flags,\n\t\t\tCount: int(inventory.CPU.Count),\n\t\t},\n\t\tHostname: host.RequestedHostname,\n\t\tNIC: make([]bmh_v1alpha1.NIC, len(inventory.Interfaces)),\n\t\tStorage: make([]bmh_v1alpha1.Storage, len(inventory.Disks)),\n\t}\n\tif inventory.Memory != nil {\n\t\thw.RAMMebibytes = int(inventory.Memory.PhysicalBytes / 1024 / 1024)\n\t}\n\tfor i, iface := range inventory.Interfaces {\n\t\thw.NIC[i] = bmh_v1alpha1.NIC{\n\t\t\tName: iface.Name,\n\t\t\tModel: iface.Product,\n\t\t\tMAC: iface.MacAddress,\n\t\t\tSpeedGbps: int(iface.SpeedMbps / 1024),\n\t\t}\n\t\tswitch {\n\t\tcase len(iface.IPV4Addresses) > 0:\n\t\t\thw.NIC[i].IP = g.selectInterfaceIPInsideMachineCIDR(iface.IPV4Addresses)\n\t\tcase len(iface.IPV6Addresses) > 0:\n\t\t\thw.NIC[i].IP = g.selectInterfaceIPInsideMachineCIDR(iface.IPV6Addresses)\n\t\t}\n\t}\n\tfor i, disk := range inventory.Disks {\n\t\tdevice := disk.Path\n\t\tif disk.ByPath != \"\" {\n\t\t\tdevice = disk.ByPath\n\t\t}\n\t\thw.Storage[i] = bmh_v1alpha1.Storage{\n\t\t\tName: device,\n\t\t\tVendor: disk.Vendor,\n\t\t\tSizeBytes: bmh_v1alpha1.Capacity(disk.SizeBytes),\n\t\t\tModel: disk.Model,\n\t\t\tWWN: disk.Wwn,\n\t\t\tHCTL: disk.Hctl,\n\t\t\tSerialNumber: disk.Serial,\n\t\t\tRotational: (disk.DriveType == models.DriveTypeHDD),\n\t\t}\n\t}\n\tif inventory.SystemVendor != nil {\n\t\thw.SystemVendor = bmh_v1alpha1.HardwareSystemVendor{\n\t\t\tManufacturer: inventory.SystemVendor.Manufacturer,\n\t\t\tProductName: inventory.SystemVendor.ProductName,\n\t\t\tSerialNumber: inventory.SystemVendor.SerialNumber,\n\t\t}\n\t}\n\tstatus := bmh_v1alpha1.BareMetalHostStatus{\n\t\tHardwareDetails: &hw,\n\t\tPoweredOn: true,\n\t}\n\tstatusJSON, err := json.Marshal(status)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetav1.SetMetaDataAnnotation(&bmh.ObjectMeta, bmh_v1alpha1.StatusAnnotation, string(statusJSON))\n\tif g.enableMetal3Provisioning {\n\t\tbmh.Spec.ExternallyProvisioned = true\n\t}\n\n\tserializer := k8sjson.NewSerializerWithOptions(\n\t\tk8sjson.DefaultMetaFactory, nil, nil,\n\t\tk8sjson.SerializerOptions{\n\t\t\tYaml: true,\n\t\t\tPretty: true,\n\t\t\tStrict: true,\n\t\t},\n\t)\n\tbuf := bytes.Buffer{}\n\terr = serializer.Encode(bmh, &buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// remove status if exists\n\tres := bytes.Split(buf.Bytes(), []byte(\"status:\\n\"))\n\tencodedBMH := base64.StdEncoding.EncodeToString(res[0])\n\tsource := \"data:text/plain;charset=utf-8;base64,\" + encodedBMH\n\tfile.Contents.Source = &source\n\n\treturn nil\n}", "title": "" }, { "docid": "d91ddc44065e2fa4fc85a1379cf95435", "score": "0.4021461", "text": "func WifiAddEntry(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\tvar vifi zs.Wifi\n\tlog.Debugf(\"request POSTed: %+v\", r.Body)\n\tlog.Debugf(\"vifi POSTed: %+v\", vifi)\n\terr := decoder.Decode(&vifi)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError) // \"Some problem occurred.\"\n\t\treturn\n\t}\n\tvifi.EncryptPassword()\n\tws := &zs.Wifis{}\n\tws.ParseViperWifi()\n\tws.AddWifiToList(vifi)\n\n\tlog.Debugf(\"vifi POSTed: %+v\", vifi)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tresponse, _ := json.Marshal(vifi)\n\tw.Write(response)\n}", "title": "" }, { "docid": "a8e758e0af2638f29b7a8c7086b7535e", "score": "0.40209708", "text": "func MakeBpForIfTable(id collectdevice.ID, dev *SnmpDevice) {\n\tfor j := 0; j < len(dev.IfTable.ifEntry); j++ {\n\t\t// remove loopback interface\n\t\tif dev.IfTable.ifEntry[j].ifName == \"lo\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Table name, tags, fields\n\t\tname := reflect.TypeOf(dev.IfTable).Name()\n\t\ttags := MakeTagForInfluxDB(id, dev.Device.Ip)\n\t\t//fields := MakeFieldForInfluxDB(dev.IfTable.ifEntry[j])\n\t\tfields := map[string]interface{}{\n\t\t\t\"ifindex\" \t\t: dev.IfTable.ifEntry[j].ifIndex,\n\t\t\t\"descr\" \t\t: dev.IfTable.ifEntry[j].ifDescr,\n\t\t\t\"type\" \t\t\t: dev.IfTable.ifEntry[j].ifType,\n\t\t\t\"mtu\" \t\t\t: dev.IfTable.ifEntry[j].ifMTU,\n\t\t\t\"speed\" \t\t: dev.IfTable.ifEntry[j].ifSpeed,\n\t\t\t\"physaddress\" \t: dev.IfTable.ifEntry[j].ifPhysAddress,\n\t\t\t\"adminstatus\" \t: dev.IfTable.ifEntry[j].ifAdminStatus,\n\t\t\t\"operstatus\" \t: dev.IfTable.ifEntry[j].ifOperStatus,\n\t\t\t\"lastchange\" \t: dev.IfTable.ifEntry[j].ifLastChange,\n\t\t\t\"in-octets\" \t: dev.IfTable.ifEntry[j].ifInOctets,\n\t\t\t\"in-ucastpkts\" \t: dev.IfTable.ifEntry[j].ifInUcastPkts,\n\t\t\t\"in-n-ucastpkts\" : dev.IfTable.ifEntry[j].ifInNUcastPkts,\n\t\t\t\"in-discards\" \t: dev.IfTable.ifEntry[j].ifInDiscards,\n\t\t\t\"in-errors\" \t: dev.IfTable.ifEntry[j].ifInErrors,\n\t\t\t\"out-octets\" \t: dev.IfTable.ifEntry[j].ifOutOctets,\n\t\t\t\"out-ucastpkts\" : dev.IfTable.ifEntry[j].ifOutUcastPkts,\n\t\t\t\"out-n-ucastpkts\" : dev.IfTable.ifEntry[j].ifOutNUcastPkts,\n\t\t\t\"out-discards\" \t: dev.IfTable.ifEntry[j].ifOutDiscards,\n\t\t\t\"out-errors\" \t: dev.IfTable.ifEntry[j].ifOutErrors,\n\t\t\t\"out-qlen\" \t\t: dev.IfTable.ifEntry[j].ifOutQLen,\n\t\t\t\"ifspecific\" \t: dev.IfTable.ifEntry[j].ifSpecific,\n\t\t\t\"ifname\" \t\t: dev.IfTable.ifEntry[j].ifName,\n\t\t\t\"hc-in-octets\" \t: dev.IfTable.ifEntry[j].ifHCInOctets,\n\t\t\t\"hc-out-octets\" : dev.IfTable.ifEntry[j].ifHCOutOctets,\n\t\t}\n\n\t\t// Add batch point\n\t\tif AddBpToInflux(name, tags, fields) != nil {\n\t\t\tlib.LogWarn(\"Failed to store IfTable info.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "48d95d45dae5150d22d7a2f9cd3be0ce", "score": "0.40158984", "text": "func (r *linuxRouter) addBaseNetfilter4() error {\n\t// Create our own filtering chains, and hook them into the head of\n\t// various main tables. If the hooks already exist, we don't try\n\t// to fight for first place, because other software does the\n\t// same. We're happy with \"someplace up before most other stuff\".\n\tdivert := func(table, chain string) error {\n\t\ttsChain := \"ts-\" + strings.ToLower(chain)\n\n\t\tchains, err := r.ipt4.ListChains(table)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"listing iptables chains: %v\", err)\n\t\t}\n\t\tfound := false\n\t\tfor _, chain := range chains {\n\t\t\tif chain == tsChain {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif found {\n\t\t\terr = r.ipt4.ClearChain(table, tsChain)\n\t\t} else {\n\t\t\terr = r.ipt4.NewChain(table, tsChain)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"setting up %s/%s: %v\", table, tsChain, err)\n\t\t}\n\n\t\targs := []string{\"-j\", tsChain}\n\t\texists, err := r.ipt4.Exists(table, chain, args...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"checking for %v in %s/%s: %v\", args, table, chain, err)\n\t\t}\n\t\tif exists {\n\t\t\treturn nil\n\t\t}\n\t\tif err := r.ipt4.Insert(table, chain, 1, args...); err != nil {\n\t\t\treturn fmt.Errorf(\"adding %v in %s/%s: %v\", args, table, chain, err)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := divert(\"filter\", \"INPUT\"); err != nil {\n\t\treturn err\n\t}\n\tif err := divert(\"filter\", \"FORWARD\"); err != nil {\n\t\treturn err\n\t}\n\tif err := divert(\"nat\", \"POSTROUTING\"); err != nil {\n\t\treturn err\n\t}\n\n\t// Only allow CGNAT range traffic to come from tailscale0. There\n\t// is an exception carved out for ranges used by ChromeOS, for\n\t// which we fall out of the Tailscale chain.\n\t//\n\t// Note, this will definitely break nodes that end up using the\n\t// CGNAT range for other purposes :(.\n\targs := []string{\"!\", \"-i\", r.tunname, \"-s\", chromeOSVMRange, \"-m\", \"comment\", \"--comment\", \"ChromeOS VM connectivity\", \"-j\", \"RETURN\"}\n\tif err := r.ipt4.Append(\"filter\", \"ts-input\", args...); err != nil {\n\t\treturn fmt.Errorf(\"adding %v in filter/ts-input: %v\", args, err)\n\t}\n\targs = []string{\"!\", \"-i\", r.tunname, \"-s\", \"100.64.0.0/10\", \"-j\", \"DROP\"}\n\tif err := r.ipt4.Append(\"filter\", \"ts-input\", args...); err != nil {\n\t\treturn fmt.Errorf(\"adding %v in filter/ts-input: %v\", args, err)\n\t}\n\n\t// Forward and mark packets that have the Tailscale subnet route\n\t// bit set. The bit gets set by rules inserted into filter/FORWARD\n\t// later on. We use packet marks here so both filter/FORWARD and\n\t// nat/POSTROUTING can match on these packets of interest.\n\t//\n\t// In particular, we only want to apply SNAT rules in\n\t// nat/POSTROUTING to packets that originated from the Tailscale\n\t// interface, but we can't match on the inbound interface in\n\t// POSTROUTING. So instead, we match on the inbound interface and\n\t// destination IP in filter/FORWARD, and set a packet mark that\n\t// nat/POSTROUTING can use to effectively run that same test\n\t// again.\n\targs = []string{\"-m\", \"mark\", \"--mark\", tailscaleSubnetRouteMark, \"-j\", \"ACCEPT\"}\n\tif err := r.ipt4.Append(\"filter\", \"ts-forward\", args...); err != nil {\n\t\treturn fmt.Errorf(\"adding %v in filter/ts-forward: %v\", args, err)\n\t}\n\targs = []string{\"-i\", r.tunname, \"-j\", \"DROP\"}\n\tif err := r.ipt4.Append(\"filter\", \"ts-forward\", args...); err != nil {\n\t\treturn fmt.Errorf(\"adding %v in filter/ts-forward: %v\", args, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f6e0fb621f5b9dc5c59d44a24ca34334", "score": "0.4008364", "text": "func InsertNoticeData( elem models.Element, folder string) bool {\n\n var err error\n var stmt *sql.Stmt\n switch folder {\n case \"Results\" : stmt, err = Db.Prepare(\"INSERT results_ipu SET title=?, date=?, url=?, remoteUrl=?\")\n case \"Notice\" : stmt, err = Db.Prepare(\"INSERT notice_ipu SET title=?, date=?, url=?, remoteUrl=?\")\n case \"Datesheet\" : stmt, err = Db.Prepare(\"INSERT datesheet_ipu SET title=?, date=?, url=?, remoteUrl=?\")\n }\n\n if err != nil {\n fmt.Println(\"Error in preparing insert statement\")\n return false\n }\n _, err1 := stmt.Exec(elem.Title, elem.Date, elem.Url, elem.RemoteUrl)\n if err1 != nil {\n fmt.Println(\"Error inserting in database \")\n return false\n }\n return true\n}", "title": "" }, { "docid": "a2a39a6f7272b0348e0b526e96f1fa0e", "score": "0.40070537", "text": "func (s *State) handler(id *key.Identity, msg []byte) {\n\tbuff, err := encoder.Unmarshal(msg)\n\tif err != nil {\n\t\tslog.Debugf(\"dsign: <%s> sent unknown packet\", id.Address)\n\t\treturn\n\t}\n\t// if it panics, that means something's wrong with the encoder code, not\n\t// because of user input.\n\tpacket := buff.(*ProtocolPacket)\n\tswitch {\n\tcase packet.NewKeyPair != nil:\n\t\ts.handleNewKeyPair(id, packet.NewKeyPair)\n\tcase packet.NewSignature != nil:\n\t\ts.handleNewSignature(id, packet.NewSignature)\n\tdefault:\n\t\tslog.Debugf(\"disgn: <%s> sent null packet\", id.Address)\n\t}\n}", "title": "" }, { "docid": "bde14b8df35898b66b39396e92183bd8", "score": "0.40061057", "text": "func IngestionEngine(packet LogPacket) error {\n\t//First we send the packet off to the WAL to ensure its recorded incase of failure\n\tWriteToWAL(packet)\n\t//fmt.Println(packet.DataType)\n\n\treturn nil\n}", "title": "" }, { "docid": "c03d221da77c92bb9b36f2850b509ff5", "score": "0.39988902", "text": "func (m *Manager) protocolHandler(p *p2p.Peer, rw p2p.MsgReadWriter) error {\n\t// this peer is formatted as an eth peer\n\tethPeer := &Peer{\n\t\tname: p.Name(),\n\t\tid: p.ID(),\n\t\tremoteAddr: p.RemoteAddr(),\n\t\trw: rw,\n\t\tbyzantiumChecked: false,\n\t}\n\n\tif err := ethPeer.DoEthereumHandshake(); err != nil {\n\t\t// log.Debug(\"failed eth protocol handshake\", p, \"error\", err)\n\t\tm.peerScrapper(ethPeer.String(), \"39-ethereum handshake failed\", err.Error()) // hook\n\t\treturn err\n\t}\n\n\t// To the hook, to be updated if active\n\tm.peerScrapper(ethPeer.String(), \"40-waiting byzantium check\", \"wait\")\n\n\t// in the lifecycle of a peer, after the ethereum handshake is succesful,\n\t// we add this peer into our store, which will make them indirectly available\n\t// to the caller of the manager, to do requests to the devp2p network.\n\t// once the loop for this connection (implemented below) is broke, the peer\n\t// will be removed from the store.\n\tm.peerstore.add(ethPeer)\n\tdefer m.peerstore.remove(ethPeer.String())\n\n\t// we don't want peers that aren't in the byzantium hard fork.\n\t// we will send a message to the peer asking for its block\n\t// we have logic inside handleIncomingMsg() to deal with this specific block header.\n\tp2p.Send(ethPeer.rw,\n\t\tGetBlockHeadersMsg,\n\t\t&getBlockHeadersData{\n\t\t\tOrigin: hashOrNumber{\n\t\t\t\tNumber: uint64(ByzantiumBlockNumber)},\n\t\t\tAmount: uint64(1),\n\t\t\tSkip: uint64(0),\n\t\t\tReverse: true,\n\t\t})\n\n\t// this is a permanent loop, it waits for the p2p library to ReadMsg()\n\t// and then switches over the code of the message (New block, Get receipts, etc, etc)\n\t// for further processing. This loop is broken at the first error,\n\t// triggering the removal of the peer from our store also.\n\tfor {\n\t\tif err := m.handleIncomingMsg(ethPeer); err != nil {\n\t\t\tlog.Debug(\"failed ethereum message handling\", \"peer\", ethPeer.String(), \"err\", err)\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61676f4de3b8c6271794377b1eadb183", "score": "0.39987004", "text": "func (c *ColumnarTable) processTicket(ctx context.Context, ticket string, patterns []*regexp.Regexp, allowedKinds stringset.Set, reply *gpb.EdgesReply) error {\n\tsrcURI, err := kytheuri.Parse(ticket)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrc := srcURI.VName()\n\tprefix, err := keys.Append(columnar.EdgesKeyPrefix, src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tit, err := c.DB.ScanPrefix(ctx, prefix, &keyvalue.Options{LargeRead: true})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer it.Close()\n\n\tk, val, err := it.Next()\n\tif err == io.EOF || !bytes.Equal(k, prefix) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\t// Decode Edges Index\n\tvar idx gspb.Edges_Index\n\tif err := proto.Unmarshal(val, &idx); err != nil {\n\t\treturn fmt.Errorf(\"error decoding index: %v\", err)\n\t}\n\tif len(patterns) > 0 {\n\t\tif info := filterNode(patterns, idx.Node); len(info.Facts) > 0 {\n\t\t\treply.Nodes[ticket] = info\n\t\t}\n\t}\n\n\tedges := &gpb.EdgeSet{Groups: make(map[string]*gpb.EdgeSet_Group)}\n\treply.EdgeSets[ticket] = edges\n\ttargets := stringset.New()\n\n\t// Main loop to scan over each columnar kv entry.\n\tfor {\n\t\tk, val, err := it.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkey := string(k[len(prefix):])\n\n\t\t// TODO(schroederc): only parse needed entries\n\t\te, err := columnar.DecodeEdgesEntry(src, key, val)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch e := e.Entry.(type) {\n\t\tcase *gspb.Edges_Edge_:\n\t\t\tedge := e.Edge\n\n\t\t\tkind := edge.GetGenericKind()\n\t\t\tif kind == \"\" {\n\t\t\t\tkind = schema.EdgeKindString(edge.GetKytheKind())\n\t\t\t}\n\t\t\tif edge.Reverse {\n\t\t\t\tkind = \"%\" + kind\n\t\t\t}\n\n\t\t\tif len(allowedKinds) != 0 && !allowedKinds.Contains(kind) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttarget := kytheuri.ToString(edge.Target)\n\t\t\ttargets.Add(target)\n\n\t\t\tg := edges.Groups[kind]\n\t\t\tif g == nil {\n\t\t\t\tg = &gpb.EdgeSet_Group{}\n\t\t\t\tedges.Groups[kind] = g\n\t\t\t}\n\t\t\tg.Edge = append(g.Edge, &gpb.EdgeSet_Group_Edge{\n\t\t\t\tTargetTicket: target,\n\t\t\t\tOrdinal: edge.Ordinal,\n\t\t\t})\n\t\tcase *gspb.Edges_Target_:\n\t\t\tif len(patterns) == 0 || len(targets) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttarget := e.Target\n\t\t\tticket := kytheuri.ToString(target.Node.Source)\n\t\t\tif targets.Contains(ticket) {\n\t\t\t\tif info := filterNode(patterns, target.Node); len(info.Facts) > 0 {\n\t\t\t\t\treply.Nodes[ticket] = info\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown Edges entry: %T\", e)\n\t\t}\n\t}\n\n\tif len(edges.Groups) == 0 {\n\t\tdelete(reply.EdgeSets, ticket)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc88d6565e2b5234640131eae9e50498", "score": "0.39978328", "text": "func handleTCPConnection(conn net.Conn){\n\n\tfmt.Println(\"Connection stablished\")\n\n\t//Create the array to hold the command\n\tvar command []byte = make([]byte,100)\n\n\tfor {\n\t\t//Read from connection waiting for a command\n\t\tcant, err := conn.Read(command)\n\t\tif err == nil {\n\n\t\t\t//read the command and create the string\n\t\t\tvar commandStr string = string(command)\n\n\t\t\t//Exit the connection\n\t\t\tif commandStr[0:4] == \"exit\" {\n\t\t\t\tfmt.Println(\"Cerrando Conexion\")\n\t\t\t\tconn.Close()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t//Get the element\n\t\t\tif commandStr[0:3] == \"get\" {\n\n\t\t\t\tcomandos := strings.Split(commandStr[:cant-2],\" \")\n\n\t\t\t\tfmt.Println(\"Collection: \",comandos[1], \" - \",len(comandos[1]))\n\t\t\t\tfmt.Println(\"Id: \",comandos[2],\" - \",len(comandos[2]))\n\n\t\t\t\tb,err := getElement(comandos[1],comandos[2])\n\n\t\t\t\tif b!=nil {\n\t\t\t\t\tconn.Write(b)\n\t\t\t\t\tconn.Write([]byte(\"\\n\"))\n\t\t\t\t} else {\n\t\t\t\t\tif err==nil{\n\t\t\t\t\t\tconn.Write([]byte(\"Key not found\\n\"))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Error: \", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//Get the total quantity of elements\n\t\t\tif commandStr[0:8] == \"elements\" {\n\n\t\t\t\tcomandos := strings.Split(commandStr[:cant-2],\" \")\n\n\t\t\t\tfmt.Println(\"Collection: \",comandos[1], \" - \",len(comandos[1]))\n\n\t\t\t\tb, err := getElements(comandos[1])\n\t\t\t\tif err==nil {\n\t\t\t\t\tconn.Write(b)\n\t\t\t\t\tconn.Write([]byte(\"\\n\"))\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Error: \", err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//return the bytes used\n\t\t\tif commandStr[0:6] == \"memory\" {\n\n\t\t\t\tresult := \"Uses: \"+strconv.FormatInt(memBytes,10)+\"bytes, \"+ strconv.FormatInt((memBytes/(maxMemBytes/100)),10)+\"%\\n\"\n\t\t\t\t//result := \"Uses: \"+strconv.FormatInt(memBytes,10)+\"bytes\\n\"\n\t\t\t\tconn.Write([]byte(result))\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\n\t\t\t//POST elements\n\t\t\tif commandStr[0:4] == \"post\" {\n\n\t\t\t\tcomandos := strings.Split(commandStr[:cant-2],\" \")\n\n\t\t\t\tfmt.Println(\"Collection: \",comandos[1], \" - \",len(comandos[1]))\t\n\t\t\t\tfmt.Println(\"JSON: \",comandos[2],\" - \",len(comandos[2]))\n\n\t\t\t\tid,err := createElement(comandos[1],\"\",comandos[3],true,false)\n\n\t\t\t\tvar result string\n\t\t\t\tif err!=nil{\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t} else {\n\t\t\t\t\t//result = \"Element Created: \"+strconv.Itoa(id)+\"\\n\"\n\t\t\t\t\tresult = \"Element Created: \"+id+\"\\n\"\n\t\t\t\t\tconn.Write([]byte(result))\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif commandStr[0:6] == \"delete\" {\n\n\t\t\t\tcomandos := strings.Split(commandStr[:cant-2],\" \")\n\n\t\t\t\t//Get the vale from the cache\n\t\t\t\t//result := deleteElement(comandos[1],atoi(comandos[2]))\n\t\t\t\tresult := deleteElement(comandos[1],comandos[2])\n\n\t\t\t\tif result==false {\n\t\t\t\t\t//Return a not-found\t\t\t\t\n\t\t\t\t\tconn.Write([]byte(\"Key not found\"))\n\t\t\t\t} else {\n\t\t\t\t\t//Return a Ok\n\t\t\t\t\tresponse := \"Key: \"+comandos[2]+\" from: \"+comandos[1]+\" deleted\\n\"\n\t\t\t\t\tconn.Write([]byte(response))\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\n\t\t\t}\n\n\t\t\tif commandStr[0:6] == \"search\" {\n\n\t\t\t\tcomandos := strings.Split(commandStr[:cant-2],\" \")\n\n\t\t\t\tresult, err := search(comandos[1],comandos[2],comandos[3])\n\n\t\t\t\tif err!=nil {\n\t\t\t\t\tfmt.Println(result)\n\t\t\t\t\tconn.Write([]byte(\"Error searching\\n\"))\n\t\t\t\t} else {\n\t\t\t\t\tconn.Write([]byte(result))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//Exit the connection\n\t\t\tif commandStr[0:4] == \"help\" {\n\t\t\t\tresult := showHelp()\n\t\t\t\tconn.Write([]byte(result))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//Default Message\n\t\t\tfmt.Println(\"Comando no definido: \", commandStr)\n\t\t\tconn.Write([]byte(\"Unknown Command\\n\"))\n\n\t\t} else {\n\t\t\tfmt.Println(\"Error: \", err)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "45c1e10b83fc894a322e6e8a38bae8f9", "score": "0.39961815", "text": "func handleScanLine(line string, banMode string) {\n\tsplit := strings.Split(line, \"\\\"\")\n\tip := getIPaddress(split[0])\n\tbrowser := split[5]\n\trequestLine := strings.Fields(split[1])\n\trequest := handleRequestLine(requestLine)\n\n\tif banMode != \"\" && checkIPLogs(ip) {\n\t\treturn\n\t}\n\n\tswitch banMode {\n\tcase \"browser\":\n\t\thandleBan(browser, rules, ip)\n\tcase \"request-path\":\n\t\thandleBan(request.requestPath, rules, ip)\n\tcase \"request-method\":\n\t\thandleBan(request.method, rules, ip)\n\t}\n\n\thandleLogging(ip, browser, request)\n}", "title": "" }, { "docid": "e13089c7f827718d14ad1496b89c75dd", "score": "0.39894223", "text": "func prepareAllSoftComp(index int) ([]string, [][]interface{}) {\n\tvar queryArray []string // mark it as Max Queries\n\tvar docArray [][]interface{}\n\tswitch index {\n\tcase firstIndex:\n\t\t// the following function sets the naked nodes linked to a platform id, through psa-rot\n\t\tqueryArray, docArray = prepareRoTdata(0)\n\t\tqArray := []string{\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-bl-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-prot-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-arot-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-app-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t}\n\t\tqueryArray = append(queryArray, qArray...)\n\t\tswRsp := []SoftwareIdentityWrapper{\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: blPTagV1, TagVersion: 0, SoftwareName: \"Roadrunner boot loader patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"BL\", Description: \"TF-M_SHA256MemPreXIP\", MeasurementValue: \"76543210fedcba9817161514131211101f1e1d1c1b1a1920\", SignerID: \"tSignerID2\"}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: pRotPV1, TagVersion: 0, SoftwareName: \"Roadrunner PRoT Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M1\", Description: \"\", MeasurementValue: pRotPMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: aRotPV1, TagVersion: 0, SoftwareName: \"Roadrunner ARoT Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M2\", Description: \"\", MeasurementValue: aRotPMeasVal, SignerID: \"tSignerID2\"}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: appPV1, TagVersion: 0, SoftwareName: \"Roadrunner App Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M3\", Description: \"\", MeasurementValue: \"76543210fedcba9817161514131211101f1e1d1c1b1a2019\", SignerID: tSignerID3}}}}}},\n\t\t}\n\t\t// populate one document per query above\n\t\tfor _, swdoc := range swRsp {\n\t\t\tdocList := []interface{}{}\n\t\t\tdocList = append(docList, swdoc)\n\t\t\tdocArray = append(docArray, docList)\n\t\t}\n\n\t}\n\treturn queryArray, docArray\n}", "title": "" }, { "docid": "7fd184d04a5666f28145836364185284", "score": "0.3979931", "text": "func propagate_BL(the_bl Block) {\r\n\traw_bl, err := json.Marshal(the_bl)\r\n\tif ( err != nil ){\r\n\t\t\tfmt.Println(\"raw_bl Marshal error : \" , err.Error())\r\n\t}\r\n\tjson_data := Container{Type:\"BL\", Object:raw_bl}\r\n\tfor i := range peer_ip_pool{\r\n\t\t//YS: do not dial itself\r\n\t\tif (peer_ip_pool[i] == production_ip) {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tconn, err := net.Dial(\"tcp\", peer_ip_pool[i] + \":\" + TCP_PORT)\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(\"CONNECTION ERROR:\", err.Error())\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tencoder := json.NewEncoder(conn)\r\n\t\tif err := encoder.Encode(json_data); err != nil {\r\n\t\t\t\t fmt.Println(\"broadcast_BL() encode.Encode error: \", err)\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "dde098dd9999307295ca0da9225e94f1", "score": "0.3979504", "text": "func (w *Worker) onElement(conn *websocket.Conn, userID string) {\n\tfor {\n\t\telement := &Element{}\n\t\terr := conn.ReadJSON(element)\n\t\tif err != nil {\n\t\t\tw.logger.Println(\"Error reading from websocket: \", err)\n\t\t\tdelete(w.clients, userID)\n\t\t\treturn\n\t\t} else {\n\t\t\tw.logger.Println(\"Got element from \"+userID+\": \", element)\n\t\t}\n\n\t\tif w.addToSession(*element) {\n\t\t\tw.sendToClients(*element)\n\t\t}\n\n\t\tw.elementsToAck = append(w.elementsToAck, *element)\n\t}\n}", "title": "" }, { "docid": "0afa1bd8f009ba59edfba46f153956e5", "score": "0.3978776", "text": "func (cl *Cleaner) AddElement(element *storage.MetaDataObj) {\n\tduration := element.CreationDate.Add(time.Duration(element.TTL) * time.Second).Sub(time.Now())\n\tif duration < 0 {\n\t\tduration = 0\n\t}\n\tnearestStep := cl.step + (int64(duration.Seconds()) / cl.period) + 1\n\tcl.commands <- func() {\n\t\tif _, ok := cl.expirables[nearestStep]; !ok {\n\t\t\tcl.expirables[nearestStep] = make([]*storage.MetaDataObj, 0)\n\t\t\t//log.Printf(\"Create list for step %d\\r\\n\",nearestStep)\n\t\t}\n\t\tcl.expirables[nearestStep] = append(cl.expirables[nearestStep], element)\n\t\t//log.Printf(\"Added element to the cleaner for step %d TTL %d list element %d\\r\\n\",nearestStep, element.TTL, len(cl.expirables[nearestStep]))\n\t}\n}", "title": "" }, { "docid": "af06ea1ebc5ce4ac7db3c1a03136bcf4", "score": "0.3977844", "text": "func SendInfo2Etcd(status int32) (error){\n\t// send info to master for timeinterval 1, 5, 15 \n\tvar last [3]int\n\tvar send util.Machine \n\tsend.Status = status\n\n\tsend.MemInfo = res.MemInfo\n\tfor i:=0 ; i< util.TimeIntervalNum; i++{\n\t\tlast[i] = index - util.TimeInterval[i]*2;\t\n\t\tif last[i]<0 {\n\t\t\tlast[i]= last[i]+size\n\t\t}\n\t}\t\t\n\thistory := []util.CpuRaw{cache[last[0]].CpuInfo, cache[last[1]].CpuInfo, cache[last[2]].CpuInfo}\n\tsend.CpuInfo = util.HandleCPU(res.CpuInfo, history)\n\tsend.FailTime = 0\n\tif value, err := json.Marshal(&send) ; err != nil{\n\t\tpanic(err)\n\t}else{\n\t\tmachines := []string{\"http://\" + ClientConfig.EtcdNode.Ip +\":\" + ClientConfig.EtcdNode.Port}\n\t\tif *flagD{\n\t\t\tfmt.Fprintf(os.Stderr, \"SendInfo2Etcd: Store data to etcd %s:%s\\n\", ClientConfig.EtcdNode.Ip,ClientConfig.EtcdNode.Port)\t\n\t\t\tfmt.Fprintf(os.Stderr, \"ip is %s and data is %s\\n\", res.Ip, string(value))\n\t\t}\n\t\tvar newerr error\n\t\tfor i:=0;i<5;i++{\n\t\t\tnewerr = Store(machines, res.Ip, string(value), 0 )\t\t\n\t\t\tif newerr!= nil{\n\t\t\t\tfmt.Fprintf(os.Stderr, \"SendInfo2Etcd: Store failed--%s, it will try %d times\\n\", newerr,4-i)\t\n\t\t\t}else{\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn newerr\n\t}\n}", "title": "" }, { "docid": "bbbf19b8a96a296bd141c15686c1f114", "score": "0.39722016", "text": "func (g *SLSStateGenerator) getHardwareForMountainCab(cabXname string, cabClass sls_common.CabinetType) (nodes []sls_common.GenericHardware) {\n\tlogger := g.logger\n\n\tvar chassisList []string\n\tswitch cabClass {\n\tcase sls_common.ClassMountain:\n\t\tchassisList = mountainChassisList\n\tcase sls_common.ClassHill:\n\t\tchassisList = tdsChassisList\n\tdefault:\n\t\tlogger.Fatal(\"Unable to genreate mountain hardware for cabinet class\",\n\t\t\tzap.Any(\"cabClass\", cabClass),\n\t\t\tzap.String(\"cabNname\", cabXname),\n\t\t)\n\t}\n\n\tfor _, chassis := range chassisList {\n\t\t// Start with the CMM\n\t\tcmm := sls_common.GenericHardware{\n\t\t\tParent: cabXname,\n\t\t\tXname: fmt.Sprintf(\"%s%s\", cabXname, chassis),\n\t\t\tType: \"comptype_chassis_bmc\",\n\t\t\tClass: sls_common.CabinetType(cabClass),\n\t\t\tTypeString: \"ChassisBMC\",\n\t\t}\n\t\tnodes = append(nodes, cmm)\n\n\t\tfor slot := 0; slot < 8; slot++ {\n\t\t\tfor bmc := 0; bmc < 2; bmc++ {\n\t\t\t\tfor node := 0; node < 2; node++ {\n\t\t\t\t\tnewNode := sls_common.GenericHardware{\n\t\t\t\t\t\tParent: fmt.Sprintf(\"%s%ss%db%d\", cabXname, chassis, slot, bmc),\n\t\t\t\t\t\tXname: fmt.Sprintf(\"%s%ss%db%dn%d\", cabXname, chassis, slot, bmc, node),\n\t\t\t\t\t\tType: \"comptype_node\",\n\t\t\t\t\t\tClass: sls_common.CabinetType(cabClass),\n\t\t\t\t\t\tTypeString: \"Node\",\n\t\t\t\t\t\tExtraPropertiesRaw: sls_common.ComptypeNode{\n\t\t\t\t\t\t\tNID: g.currentMountainNID,\n\t\t\t\t\t\t\tRole: \"Compute\",\n\t\t\t\t\t\t\tAliases: []string{fmt.Sprintf(\"nid%06d\", g.currentMountainNID)},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t\tnodes = append(nodes, newNode)\n\n\t\t\t\t\tg.currentMountainNID++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d81be3f8978b15c06e7ae07ae57dfe10", "score": "0.3956667", "text": "func (shm *StorageHostManager) updateInteraction(id enode.ID, interactionType InteractionType, success bool) error {\n\tshm.lock.Lock()\n\tdefer shm.lock.Unlock()\n\n\t// get the storage host\n\tinfo, exist := shm.storageHostTree.RetrieveHostInfo(id)\n\tif !exist {\n\t\treturn fmt.Errorf(\"failed to retrive host info [%v]\", id)\n\t}\n\tinfo = calcInteractionUpdate(info, interactionType, success, uint64(time.Now().Unix()))\n\t// Evaluate the score and update the host info\n\tscore := shm.hostEvaluator.Evaluate(info)\n\tif err := shm.storageHostTree.HostInfoUpdate(info, score); err != nil {\n\t\treturn fmt.Errorf(\"failed to update host info: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba46a523bedb2e322f9a09e701c59997", "score": "0.39560154", "text": "func (c *Controller) CheckTimeSwitchEntries(db *sqlx.DB) {\n\tif !c.Active {\n\t\treturn\n\t}\n\tvar ts []Timeswitch\n\terr := json.Unmarshal(*c.Items, &ts)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] unable to unmarshal %s json: %v\", c.Category, err)\n\t}\n\t// var tsModified []Timeswitch\n\tfor _, item := range ts {\n\t\tswitch c.Category {\n\t\tcase \"timeswitchrepeat\":\n\t\t\tif item.Duration == \"\" {\n\t\t\t\tlog.Printf(\"[ERROR] missing duration for '%s', unable to perform check\", c.Description)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// we estimate cutoff time based on today's date, if cutoff is empty we initialize it\n\t\t\tparsed, _ := time.ParseInLocation(\"2006-01-02 15:04:05\", time.Now().Format(\"2006-01-02\")+\" \"+item.TimeOn, time.Local)\n\t\t\tif item.Cutoff == \"\" {\n\t\t\t\t// log.Printf(\"[WARNING] missing cutoffdate for '%s', initializing...\", c.Description)\n\t\t\t\t// fmt.Println(\"PARSED:\", parsed.Local())\n\t\t\t\titem.Cutoff = parsed.String()\n\t\t\t\titem.Repeat = true\n\t\t\t\titem.On = true\n\t\t\t\t// since this is an array of items we need update the whole collection\n\t\t\t\t// tsModified = append(tsModified, item)\n\t\t\t\t// fmt.Printf(\"update item with this value: %+v\\n\", item)\n\t\t\t}\n\n\t\t\t// getting total duration in seconds\n\t\t\tduration, err := strconv.Atoi(item.Duration)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"unable to parse duration:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// endTime is calculated based on the duration\n\t\t\tendTime := parsed.Add(time.Second * time.Duration(duration))\n\t\t\tdiff := endTime.Sub(parsed)\n\t\t\tfinal := parsed.Add(diff)\n\n\t\t\t// fmt.Printf(\"start (parsed): %s\\n\", parsed)\n\t\t\t// fmt.Printf(\"final: %s\\n\", final)\n\n\t\t\t// checking if timespan falls within time range\n\t\t\tif helper.InTimeSpan(parsed, final, time.Now()) && item.On {\n\t\t\t\t// fmt.Println(\"should be on ..\")\n\t\t\t\t// fmt.Println(\"remaining:\", time.Until(final))\n\t\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_ON)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\t\t\t\tc.Switch = SWITCH_ON\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// turning off the timeswitchrepeat\n\t\t\terr = c.UpdateDynamicControllerSwitchState(db, SWITCH_OFF)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] unable to update controller switch state: %v\", err)\n\t\t\t}\n\t\t\tc.Switch = SWITCH_OFF\n\t\tcase \"timeswitch\":\n\t\t\tif helper.InDateTimeSpanString(item.TimeOn, item.TimeOff) {\n\t\t\t\t// fmt.Printf(\"timeswitch: %s status 'on'\\n\", item.Description)\n\t\t\t\terr := c.UpdateDynamicControllerSwitchState(db, SWITCH_ON)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"[ERROR] unable to update controller switch state: %v\", err)\n\t\t\t\t}\n\t\t\t\tc.Switch = SWITCH_ON\n\t\t\t\treturn\n\t\t\t}\n\t\t} // end switch\n\t\terr = c.UpdateDynamicControllerSwitchState(db, SWITCH_OFF)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[ERROR] unable to update controller switch state: %v\", err)\n\t\t}\n\t\tc.Switch = SWITCH_OFF\n\t}\n\t// updating jsonRawMessage when timeswitchrepeat is modified\n\t//TODO: we need to update controller items in memory, and the database.\n\t// As of now this code will never fire.\n\t// if len(tsModified) > 0 {\n\t// \tlog.Printf(\"[INFO] updating timeswitchrepeat jsonRawMessage for '%s'\\n%+v\", c.Description, tsModified)\n\t// \tb, err := json.Marshal(tsModified)\n\t// \tif err != nil {\n\t// \t\tlog.Printf(\"[ERROR] unable to marshal: %v\", err)\n\t// \t}\n\t// \tbArr := json.RawMessage(b)\n\t// \tfmt.Println(\"JSON RAW:\", string(bArr))\n\t// \tc.Items = &bArr\n\t// }\n}", "title": "" }, { "docid": "e27c41efd5a08f02a85eefd4bd6f8cad", "score": "0.39541623", "text": "func (ew *EventWatcher) AfterProcessBlock(kn *kernel.Kernel, b *block.Block, s *block.ObserverSigned, ctx *data.Context) {\n\tfor i, t := range b.Body.Transactions {\n\t\tvar addr common.Address\n\t\tvar userID string\n\t\tswitch tx := t.(type) {\n\t\tcase *citygame.CreateAccountTx:\n\t\t\tcoord := &common.Coordinate{Height: b.Header.Height(), Index: uint16(i)}\n\t\t\taddr = common.NewAddress(coord, 0)\n\t\t\tuserID = tx.UserID\n\t\t\tew.ce.CreatAddr(addr, tx)\n\t\tcase *citygame.DemolitionTx:\n\t\t\taddr = tx.Address\n\t\tcase *citygame.ConstructionTx:\n\t\t\taddr = tx.Address\n\t\tcase *citygame.UpgradeTx:\n\t\t\taddr = tx.Address\n\t\tcase *citygame.GetCoinTx:\n\t\t\taddr = tx.Address\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\n\t\tgd, err := getWebTileNotify(ctx, addr, b.Header.Height(), uint16(i))\n\t\tif err != nil {\n\t\t\tif err != citygame.ErrNotExistGameData {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tew.ce.UpdateScore(gd, b.Header.Height(), addr, userID, kn.Loader())\n\t}\n}", "title": "" }, { "docid": "73ed6746048d9b66099396ceda0bb294", "score": "0.3947584", "text": "func intfVlanMemberRemoval(swVlanConfig *swVlanMemberPort_t,\n inParams *XfmrParams, ifName *string,\n vlanMap map[string]db.Value,\n vlanMemberMap map[string]db.Value,\n stpVlanPortMap map[string]db.Value,\n stpPortMap map[string]db.Value, intfType E_InterfaceType) error {\n var err error\n var ifVlanInfo ifVlan\n var ifVlanInfoList []*ifVlan\n\n targetUriPath, err := getYangPathFromUri(inParams.uri)\n log.Info(\"Target URI Path = \", targetUriPath)\n switch intfType {\n case IntfTypeEthernet:\n /* Handling the deletion of trunk-vlans leaf-list. YGOT target for leaf-list is nil,\n This is the reason why we do string comparison of targetUri */\n if swVlanConfig.swEthMember.Config.TrunkVlans == nil && targetUriPath == \"/openconfig-interfaces:interfaces/interface/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/trunk-vlans\" {\n ifVlanInfo.mode = TRUNK\n err = fillTrunkVlansForInterface(inParams.d, ifName, &ifVlanInfo)\n if err != nil {\n return err\n }\n }\n if swVlanConfig.swEthMember.Config.AccessVlan != nil {\n ifVlanInfo.mode = ACCESS\n }\n if swVlanConfig.swEthMember.Config.TrunkVlans != nil {\n trunkVlansUnionList := swVlanConfig.swEthMember.Config.TrunkVlans\n ifVlanInfo.mode = TRUNK\n\n for _, trunkVlanUnion := range trunkVlansUnionList {\n trunkVlanUnionType := reflect.TypeOf(trunkVlanUnion).Elem()\n\n switch trunkVlanUnionType {\n\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_String{}):\n val := (trunkVlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_String)\n vlansList := strings.Split(val.String, \",\")\n for _, vlan := range vlansList {\n /* Handle case if multiple/range of VLANs given */\n if strings.Contains(vlan, \"..\") {\n err = extractVlanIdsfrmRng(inParams.d, vlan, &ifVlanInfo.trunkVlans)\n if err != nil {\n return err\n }\n } else {\n vlanName := \"Vlan\" + vlan\n err = validateVlanExists(inParams.d, &vlanName)\n if err != nil {\n errStr := \"Invalid VLAN\"\n err = tlerr.InvalidArgsError{Format: errStr}\n return err\n }\n ifVlanInfo.trunkVlans = append(ifVlanInfo.trunkVlans, vlanName)\n }\n }\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_Uint16{}):\n val := (trunkVlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Ethernet_SwitchedVlan_Config_TrunkVlans_Union_Uint16)\n ifVlanInfo.trunkVlans = append(ifVlanInfo.trunkVlans, \"Vlan\"+strconv.Itoa(int(val.Uint16)))\n }\n }\n }\n case IntfTypePortChannel:\n /* Handling the deletion of trunk-vlans leaf-list. YGOT target for leaf-list is nil,\n This is the reason why we do string comparison of targetUri */\n if swVlanConfig.swPortChannelMember.Config.TrunkVlans == nil && targetUriPath == \"/openconfig-interfaces:interfaces/interface/openconfig-if-aggregate:aggregation/openconfig-vlan:switched-vlan/config/trunk-vlans\" {\n ifVlanInfo.mode = TRUNK\n err = fillTrunkVlansForInterface(inParams.d, ifName, &ifVlanInfo)\n if err != nil {\n return err\n }\n }\n if swVlanConfig.swPortChannelMember.Config.AccessVlan != nil {\n ifVlanInfo.mode = ACCESS\n }\n if swVlanConfig.swPortChannelMember.Config.TrunkVlans != nil {\n trunkVlansUnionList := swVlanConfig.swPortChannelMember.Config.TrunkVlans\n ifVlanInfo.mode = TRUNK\n\n for _, trunkVlanUnion := range trunkVlansUnionList {\n trunkVlanUnionType := reflect.TypeOf(trunkVlanUnion).Elem()\n\n switch trunkVlanUnionType {\n\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_String{}):\n val := (trunkVlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_String)\n vlansList := strings.Split(val.String, \",\")\n for _, vlan := range vlansList {\n /* Handle case if multiple/range of VLANs given */\n if strings.Contains(vlan, \"..\") {\n err = extractVlanIdsfrmRng(inParams.d, vlan, &ifVlanInfo.trunkVlans)\n if err != nil {\n return err\n }\n } else {\n vlanName := \"Vlan\" + vlan\n err = validateVlanExists(inParams.d, &vlanName)\n if err != nil {\n errStr := \"Invalid VLAN\"\n return tlerr.InvalidArgsError{Format: errStr}\n }\n ifVlanInfo.trunkVlans = append(ifVlanInfo.trunkVlans, vlanName)\n }\n }\n case reflect.TypeOf(ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_Uint16{}):\n val := (trunkVlanUnion).(*ocbinds.OpenconfigInterfaces_Interfaces_Interface_Aggregation_SwitchedVlan_Config_TrunkVlans_Union_Uint16)\n ifVlanInfo.trunkVlans = append(ifVlanInfo.trunkVlans, \"Vlan\"+strconv.Itoa(int(val.Uint16)))\n }\n }\n }\n }\n if ifVlanInfo.mode != MODE_UNSET {\n ifVlanInfo.ifName = ifName\n ifVlanInfoList = append(ifVlanInfoList, &ifVlanInfo)\n }\n err = processIntfVlanMemberRemoval(inParams.d, ifVlanInfoList, vlanMap, vlanMemberMap, stpVlanPortMap, stpPortMap)\n if(err != nil) {\n log.Errorf(\"Interface VLAN member removal for Interface: %s failed!\", *ifName)\n return err\n }\n return err\n}", "title": "" }, { "docid": "accdf63f4e1c2d863ac472b5b44b9ab5", "score": "0.39467138", "text": "func (g *gateio) processWs(ctx context.Context, wr *wsRespGateio, cd *commitData, itv *influxTimeVal) error {\n\tswitch wr.Channel {\n\tcase \"ticker\":\n\t\tticker := storage.Ticker{}\n\t\tticker.Exchange = \"gateio\"\n\t\tticker.MktID = wr.Result.CurrencyPair\n\t\tticker.MktCommitName = wr.mktCommitName\n\n\t\tprice, err := strconv.ParseFloat(wr.Result.TickerPrice, 64)\n\t\tif err != nil {\n\t\t\tlogErrStack(err)\n\t\t\treturn err\n\t\t}\n\t\tticker.Price = price\n\n\t\t// Time sent is in seconds.\n\t\tticker.Timestamp = time.Unix(wr.TickerTime, 0).UTC()\n\n\t\tkey := cfgLookupKey{market: ticker.MktID, channel: \"ticker\"}\n\t\tval := g.cfgMap[key]\n\t\tif val.terStr {\n\t\t\tcd.terTickersCount++\n\t\t\tcd.terTickers = append(cd.terTickers, ticker)\n\t\t\tif cd.terTickersCount == g.connCfg.Terminal.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsTerTickers <- cd.terTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.terTickersCount = 0\n\t\t\t\tcd.terTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.mysqlStr {\n\t\t\tcd.mysqlTickersCount++\n\t\t\tcd.mysqlTickers = append(cd.mysqlTickers, ticker)\n\t\t\tif cd.mysqlTickersCount == g.connCfg.MySQL.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsMysqlTickers <- cd.mysqlTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.mysqlTickersCount = 0\n\t\t\t\tcd.mysqlTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.esStr {\n\t\t\tcd.esTickersCount++\n\t\t\tcd.esTickers = append(cd.esTickers, ticker)\n\t\t\tif cd.esTickersCount == g.connCfg.ES.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsEsTickers <- cd.esTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.esTickersCount = 0\n\t\t\t\tcd.esTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.influxStr {\n\t\t\tval := itv.TickerMap[ticker.MktCommitName]\n\t\t\tif val == 0 || val == 999999 {\n\t\t\t\tval = 1\n\t\t\t} else {\n\t\t\t\tval++\n\t\t\t}\n\t\t\titv.TickerMap[ticker.MktCommitName] = val\n\t\t\tticker.InfluxVal = val\n\n\t\t\tcd.influxTickersCount++\n\t\t\tcd.influxTickers = append(cd.influxTickers, ticker)\n\t\t\tif cd.influxTickersCount == g.connCfg.InfluxDB.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsInfluxTickers <- cd.influxTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.influxTickersCount = 0\n\t\t\t\tcd.influxTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.natsStr {\n\t\t\tcd.natsTickersCount++\n\t\t\tcd.natsTickers = append(cd.natsTickers, ticker)\n\t\t\tif cd.natsTickersCount == g.connCfg.NATS.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsNatsTickers <- cd.natsTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.natsTickersCount = 0\n\t\t\t\tcd.natsTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.clickHouseStr {\n\t\t\tcd.clickHouseTickersCount++\n\t\t\tcd.clickHouseTickers = append(cd.clickHouseTickers, ticker)\n\t\t\tif cd.clickHouseTickersCount == g.connCfg.ClickHouse.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsClickHouseTickers <- cd.clickHouseTickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.clickHouseTickersCount = 0\n\t\t\t\tcd.clickHouseTickers = nil\n\t\t\t}\n\t\t}\n\t\tif val.s3Str {\n\t\t\tcd.s3TickersCount++\n\t\t\tcd.s3Tickers = append(cd.s3Tickers, ticker)\n\t\t\tif cd.s3TickersCount == g.connCfg.S3.TickerCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsS3Tickers <- cd.s3Tickers:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.s3TickersCount = 0\n\t\t\t\tcd.s3Tickers = nil\n\t\t\t}\n\t\t}\n\tcase \"trade\":\n\t\ttrade := storage.Trade{}\n\t\ttrade.Exchange = \"gateio\"\n\t\ttrade.MktID = wr.Result.CurrencyPair\n\t\ttrade.MktCommitName = wr.mktCommitName\n\n\t\t// Trade ID sent is in int format for websocket, string format for REST.\n\t\tif tradeIDFloat, ok := wr.Result.TradeID.(float64); ok {\n\t\t\ttrade.TradeID = strconv.FormatFloat(tradeIDFloat, 'f', 0, 64)\n\t\t} else {\n\t\t\tlog.Error().Str(\"exchange\", \"gateio\").Str(\"func\", \"processWs\").Interface(\"trade id\", wr.Result.TradeID).Msg(\"\")\n\t\t\treturn errors.New(\"cannot convert trade data field trade id to float\")\n\t\t}\n\n\t\ttrade.Side = wr.Result.Side\n\n\t\tsize, err := strconv.ParseFloat(wr.Result.Amount, 64)\n\t\tif err != nil {\n\t\t\tlogErrStack(err)\n\t\t\treturn err\n\t\t}\n\t\ttrade.Size = size\n\n\t\tprice, err := strconv.ParseFloat(wr.Result.TradePrice, 64)\n\t\tif err != nil {\n\t\t\tlogErrStack(err)\n\t\t\treturn err\n\t\t}\n\t\ttrade.Price = price\n\n\t\t// Time sent is in fractional seconds string format.\n\t\ttimeFloat, err := strconv.ParseFloat(wr.Result.CreateTimeMs, 64)\n\t\tif err != nil {\n\t\t\tlogErrStack(err)\n\t\t\treturn err\n\t\t}\n\t\tintPart, _ := math.Modf(timeFloat)\n\t\ttrade.Timestamp = time.Unix(0, int64(intPart)*int64(time.Millisecond)).UTC()\n\n\t\tkey := cfgLookupKey{market: trade.MktID, channel: \"trade\"}\n\t\tval := g.cfgMap[key]\n\t\tif val.terStr {\n\t\t\tcd.terTradesCount++\n\t\t\tcd.terTrades = append(cd.terTrades, trade)\n\t\t\tif cd.terTradesCount == g.connCfg.Terminal.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsTerTrades <- cd.terTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.terTradesCount = 0\n\t\t\t\tcd.terTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.mysqlStr {\n\t\t\tcd.mysqlTradesCount++\n\t\t\tcd.mysqlTrades = append(cd.mysqlTrades, trade)\n\t\t\tif cd.mysqlTradesCount == g.connCfg.MySQL.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsMysqlTrades <- cd.mysqlTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.mysqlTradesCount = 0\n\t\t\t\tcd.mysqlTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.esStr {\n\t\t\tcd.esTradesCount++\n\t\t\tcd.esTrades = append(cd.esTrades, trade)\n\t\t\tif cd.esTradesCount == g.connCfg.ES.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsEsTrades <- cd.esTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.esTradesCount = 0\n\t\t\t\tcd.esTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.influxStr {\n\t\t\tval := itv.TradeMap[trade.MktCommitName]\n\t\t\tif val == 0 || val == 999999 {\n\t\t\t\tval = 1\n\t\t\t} else {\n\t\t\t\tval++\n\t\t\t}\n\t\t\titv.TradeMap[trade.MktCommitName] = val\n\t\t\ttrade.InfluxVal = val\n\n\t\t\tcd.influxTradesCount++\n\t\t\tcd.influxTrades = append(cd.influxTrades, trade)\n\t\t\tif cd.influxTradesCount == g.connCfg.InfluxDB.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsInfluxTrades <- cd.influxTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.influxTradesCount = 0\n\t\t\t\tcd.influxTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.natsStr {\n\t\t\tcd.natsTradesCount++\n\t\t\tcd.natsTrades = append(cd.natsTrades, trade)\n\t\t\tif cd.natsTradesCount == g.connCfg.NATS.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsNatsTrades <- cd.natsTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.natsTradesCount = 0\n\t\t\t\tcd.natsTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.clickHouseStr {\n\t\t\tcd.clickHouseTradesCount++\n\t\t\tcd.clickHouseTrades = append(cd.clickHouseTrades, trade)\n\t\t\tif cd.clickHouseTradesCount == g.connCfg.ClickHouse.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsClickHouseTrades <- cd.clickHouseTrades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.clickHouseTradesCount = 0\n\t\t\t\tcd.clickHouseTrades = nil\n\t\t\t}\n\t\t}\n\t\tif val.s3Str {\n\t\t\tcd.s3TradesCount++\n\t\t\tcd.s3Trades = append(cd.s3Trades, trade)\n\t\t\tif cd.s3TradesCount == g.connCfg.S3.TradeCommitBuf {\n\t\t\t\tselect {\n\t\t\t\tcase g.wsS3Trades <- cd.s3Trades:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t\tcd.s3TradesCount = 0\n\t\t\t\tcd.s3Trades = nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ce3a782f40c0958e01b6d2cc4fb28f5", "score": "0.3946141", "text": "func ProcessMeasurement(ethClient ComponentConfig, body map[string]interface{}) error {\n\t// Convert the body to JSON data []byte\n\tjsonData, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sign the measurement\n\tsignedBody, err := cipher.SignData(ethClient.PrivateKey, jsonData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Append the signature to the measurement\n\tmsg := append(jsonData, signedBody...)\n\n\t/* Send encrypted measurement to storage module */\n\tfmt.Println(\"+ Sending Measurement to: \" + ethClient.GeneralConfig[\"dbBroker\"].(string) + \"/store\")\n\n\turl, err := sendMeasurementToDB(msg,\n\t\tethClient.GeneralConfig[\"dbBroker\"].(string)+\"/store\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"+ Measurement Stored successfully in the Storage module\")\n\tfmt.Println(\"+ URL received: \" + url)\n\n\t/* Prepare the data that is going to be stored in the Blockchain */\n\tsensorID := body[\"id\"].(string)\n\tobservationDate := body[\"dateObserved\"].(map[string]interface{})[\"value\"].(string)\n\tgatewayID := ethClient.GeneralConfig[\"gatewayID\"].(string)\n\tdescription := sensorID + \" by \" + gatewayID + \" at \" + observationDate\n\tmeasurementHashBytes := cipher.HashData(jsonData)\n\n\t// Get the public key of the marketplace from the Blockchain\n\tadminPubKeyString, err := ethClient.AccessCon.AdminPublicKey(nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tlog.Fatal(err)\n\t}\n\n\t// Convert the string public key to bytes\n\tadminPubKeyBytes, err := hex.DecodeString(adminPubKeyString)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tlog.Fatal(err)\n\t}\n\n\t// Convert the public key to ecdsa.PublicKey\n\tadminPubKey, err := crypto.UnmarshalPubkey(adminPubKeyBytes)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tlog.Fatal(err)\n\t}\n\n\t// Encrypt the url with the public key of the marketplace\n\tencryptedURL, err := cipher.EncryptWithPublicKey(*adminPubKey, []byte(url))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdataStruct := DataBlockchain{\n\t\tByteToByte32(measurementHashBytes),\n\t\tdescription,\n\t\tfmt.Sprintf(\"%x\", encryptedURL),\n\t}\n\n\t/* Introduce data in the Blockchain */\n\terr = insertDataInBlockchain(ethClient, dataStruct)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tfmt.Println(fmt.Sprintf(\"+ Information stored in the Blockchain at the following hash: 0x%x\\n\\n\", measurementHashBytes))\n\n\treturn nil\n}", "title": "" }, { "docid": "8b694fda5e4e697a06b55d524b7a3b7a", "score": "0.3945419", "text": "func ProcessHandshakeTAP(conn *Connection, c CreateRequest) error {\n\t// Reference: https://github.com/torproject/torspec/blob/f9eeae509344dcfd1f185d0130a0055b00131cea/tor-spec.txt#L1027-L1037\n\t//\n\t//\t The payload for a CREATE cell is an 'onion skin', which consists of\n\t//\t the first step of the DH handshake data (also known as g^x). This\n\t//\t value is encrypted using the \"legacy hybrid encryption\" algorithm\n\t//\t (see 0.4 above) to the server's onion key, giving a client handshake:\n\t//\n\t//\t PK-encrypted:\n\t//\t Padding [PK_PAD_LEN bytes]\n\t//\t Symmetric key [KEY_LEN bytes]\n\t//\t First part of g^x [PK_ENC_LEN-PK_PAD_LEN-KEY_LEN bytes]\n\t//\t Symmetrically encrypted:\n\t//\t Second part of g^x [DH_LEN-(PK_ENC_LEN-PK_PAD_LEN-KEY_LEN)\n\t//\n\n\tkeys := conn.router.config.Keys\n\tpub, err := torcrypto.HybridDecrypt(keys.Onion, c.HandshakeData)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to decrypt TAP handshake data\")\n\t}\n\n\tdh, err := torcrypto.GenerateDiffieHellmanKey()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to generate DH key\")\n\t}\n\n\ts, err := dh.ComputeSharedSecret(pub)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not compute shared secret\")\n\t}\n\n\t// Reference: https://github.com/torproject/torspec/blob/f9eeae509344dcfd1f185d0130a0055b00131cea/tor-spec.txt#L1059-L1060\n\t//\n\t//\t Once both parties have g^xy, they derive their shared circuit keys\n\t//\t and 'derivative key data' value via the KDF-TOR function in 5.2.1.\n\t//\n\tk, err := BuildCircuitKeysKDFTOR(s)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build circuit keys\")\n\t}\n\n\terr = LaunchCircuit(conn, c.CircID, k)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to launch circuit\")\n\t}\n\n\t// Reference: https://github.com/torproject/torspec/blob/f9eeae509344dcfd1f185d0130a0055b00131cea/tor-spec.txt#L1040-L1043\n\t//\n\t//\t The payload for a CREATED cell, or the relay payload for an\n\t//\t EXTENDED cell, contains:\n\t//\t DH data (g^y) [DH_LEN bytes]\n\t//\t Derivative key data (KH) [HASH_LEN bytes] <see 5.2 below>\n\t//\n\n\tcell := NewFixedCell(c.CircID, CommandCreated)\n\tp := cell.Payload()\n\tcopy(p, dh.Public[:])\n\tcopy(p[torcrypto.DiffieHellmanPublicSize:], k.KH)\n\n\terr = conn.SendCell(cell)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not send created cell\")\n\t}\n\n\tconn.logger.Info(\"circuit created\")\n\n\treturn nil\n}", "title": "" }, { "docid": "50330ae768b259274f0af0a36e0e696d", "score": "0.39424962", "text": "func PlyPutElement(plyfile CPlyFile, element interface{}) {\n\n\t// write the passed in element to a buffer\n\tbuf := new(bytes.Buffer)\n\terr := binary.Write(buf, binary.LittleEndian, element)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\telement_bytes := buf.Bytes()\n\n\t// pass a pointer to the buffer\n\tC.ply_put_element(plyfile, unsafe.Pointer(&element_bytes[0]))\n}", "title": "" }, { "docid": "7460bbc1d5830def9c6f346de7c76d64", "score": "0.3942079", "text": "func (db *DB) ProcessAtx(ctx context.Context, atx *types.ActivationTx) error {\n\tdb.processAtxMutex.Lock()\n\tdefer db.processAtxMutex.Unlock()\n\n\texistingATX, _ := db.GetAtxHeader(atx.ID())\n\tif existingATX != nil { // Already processed\n\t\treturn nil\n\t}\n\tepoch := atx.PubLayerID.GetEpoch()\n\tdb.log.WithContext(ctx).With().Info(\"processing atx\",\n\t\tatx.ID(),\n\t\tepoch,\n\t\tlog.FieldNamed(\"atx_node_id\", atx.NodeID),\n\t\tatx.PubLayerID)\n\tif err := db.ContextuallyValidateAtx(atx.ActivationTxHeader); err != nil {\n\t\tdb.log.WithContext(ctx).With().Error(\"atx failed contextual validation\",\n\t\t\tatx.ID(),\n\t\t\tlog.FieldNamed(\"atx_node_id\", atx.NodeID),\n\t\t\tlog.Err(err))\n\t\t// TODO: Blacklist this miner\n\t} else {\n\t\tdb.log.WithContext(ctx).With().Info(\"atx is valid\", atx.ID())\n\t}\n\tif err := db.StoreAtx(ctx, epoch, atx); err != nil {\n\t\treturn fmt.Errorf(\"cannot store atx %s: %w\", atx.ShortString(), err)\n\t}\n\tif err := db.StoreNodeIdentity(atx.NodeID); err != nil {\n\t\tdb.log.WithContext(ctx).With().Error(\"cannot store node identity\",\n\t\t\tlog.FieldNamed(\"atx_node_id\", atx.NodeID),\n\t\t\tatx.ID(),\n\t\t\tlog.Err(err))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77d70cb8eb0a3154504474739a035e91", "score": "0.39317414", "text": "func Pipe_line_st_show(w http.ResponseWriter, r *http.Request) {\n\n// IN w  : レスポンスライター\n// IN r  : リクエストパラメータ\n\n var water2 type4.Water2\n\n var idmy int64\n\n new_flag := 1\n\n bucket := \"sample-7777\"\n\n///\n/// get key-in-inf\n///\n\n\twater2.Name = r.FormValue(\"water_name\")\n\n\twater_high := r.FormValue(\"water_high\")\n\twater2.High,_ =strconv.ParseFloat(water_high,64)\n\n\tr_facter := r.FormValue(\"r_facter\")\n\twater2.Roughness_Factor,_ =strconv.ParseFloat(r_facter,64)\n\n//\tfmt.Fprintf( w, \"pipe_line_ds_keyin : water2.Name %v\\n\", water2.Name )\n//\tfmt.Fprintf( w, \"pipe_line_ds_keyin : water2.High %v\\n\", water2.High )\n\n///\n/// check whether or not exist file \"Water2\"\n///\n\n objects_minor , _ := storage2.Storage_basic( \"list2\" ,bucket ,idmy, w , r )\n\n objects, _ := objects_minor.([]string)\n\n// objects := storage2.Object_List ( w ,r , bucket )\n\n for _ , objectsw := range objects {\n\n if objectsw == \"Water2.txt\" {\n\n\t new_flag = 0\n\n\t }\n\n }\n\n// fmt.Fprintf(w, \"process2.pipe_line_ds_keyin : new_flag %v\\n\", new_flag )\n\n///\n/// put Water2 inf. in storage\n///\n\n if new_flag == 0 {\n\n _ , _ = storage3.Storage_tokura( \"Water2\" ,\"put\" ,water2 , idmy , w , r )\n\n// put1.Water2 ( w , r ,water2 ) // add an existing file\n\n } else { // make a new file\n\n _ , _ = storage3.Storage_tokura( \"Water2\" ,\"put2\" ,water2 , idmy , w , r )\n\n//\t put1.Water2_new ( w , r ,water2 )\n\n\t}\n\n///\n/// show water inf. on web\n///\n\n process2.Pipe_line_st_show(w , r )\n\n}", "title": "" }, { "docid": "ca2ab4ffa985ed9289223cd1527b75a1", "score": "0.39142865", "text": "func (p *Parser) scanBoxData(b *Box) (err error) {\n\t// savedOffset, _ := p.file.Seek(0, seekFromCurrent)\n\t// defer p.file.Seek(savedOffset, seekFromStart)\n\n\tswitch b.boxType {\n\n\tcase \"trak\": //get track data\n\n\t\thdlrBox := newHDLR(b.innerBoxs[\"mdia\"][0].innerBoxs[\"hdlr\"][0])\n\t\terr = hdlrBox.scan(p.file)\n\t\tp.currentTrack = hdlrBox.handlerType //update parsing track type\n\n\t\tif p.currentTrack == \"vide\" {\n\t\t\ttkhdBox := newTKHD(b.innerBoxs[\"tkhd\"][0])\n\t\t\terr = tkhdBox.scan(p.file)\n\n\t\t\tp.mediaInfo.height = tkhdBox.height\n\t\t\tp.mediaInfo.width = tkhdBox.width\n\t\t\tp.rootBox.videoTracks = append(p.rootBox.videoTracks, newTRAK(b))\n\t\t} else if p.currentTrack == \"soun\" {\n\t\t\tmdhdBox := newMDHD(b.innerBoxs[\"mdia\"][0].innerBoxs[\"mdhd\"][0])\n\t\t\tmdhdBox.scan(p.file)\n\n\t\t\tp.mediaInfo.soundSamplingRate = mdhdBox.timeScale\n\t\t\tp.rootBox.soundTracks = append(p.rootBox.soundTracks, newTRAK(b))\n\t\t}\n\n\tcase \"mvhd\":\n\t\tmvhdBox := newMVHD(b)\n\t\terr = mvhdBox.scan(p.file)\n\n\t\tduration, _ := time.ParseDuration(fmt.Sprintf(\"%ds\", mvhdBox.duration/mvhdBox.timeScale))\n\t\tp.mediaInfo.duration = &duration\n\t\tp.mediaInfo.creationTime = mvhdBox.creationTime\n\t\tp.mediaInfo.modifTime = mvhdBox.modifTime\n\n\t\tp.dataBoxs[b.boxType] = append(p.dataBoxs[b.boxType], mvhdBox)\n\tcase \"stsc\":\n\t\tstscBox := newSTSC(b)\n\t\terr = stscBox.scan(p.file)\n\t\tp.dataBoxs[b.boxType] = append(p.dataBoxs[b.boxType], stscBox)\n\n\tcase \"stco\":\n\t\tstcoBox := newSTCO(b)\n\t\terr = stcoBox.scan(p.file)\n\t\tp.dataBoxs[b.boxType] = append(p.dataBoxs[b.boxType], stcoBox)\n\n\t\t// default:\n\t\t// \treturn fmt.Errorf(\"unexcepted box type:%v\", b.boxType)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9352572da2e2985f51a8fe603a8853dc", "score": "0.3913818", "text": "func Decapsulate(packet gopacket.Packet)[]byte{\n\ti := len(packet.Layers())\n\tethPacket := packet.Layers()[i-2].(*layers.Ethernet)\n\tArpPacket := packet.Layer(layers.LayerTypeARP).(*layers.ARP)\n\tIpPacket := packet.Layer(layers.LayerTypeIPv4).(*layers.IPv4)\n\t// Try and make the packet\n\toptions := gopacket.SerializeOptions{}\n\tbuffer := gopacket.NewSerializeBuffer()\n\tgopacket.SerializeLayers(buffer, options,\n\t\tethPacket,\n\t\tIpPacket,\n\t\tArpPacket,\n\t)\n\t//fmt.Println(ArpPacket)\n\trawOut := buffer.Bytes()\n\treturn rawOut\n\t/*\n\tfor layer := range packet.Layers(){\n\t\tfmt.Printf(\"Layer %d: \", layer)\n\t\tCurrLayer := packet.Layers()[layer]\n\t\tif CurrLayer.LayerType() == layers.LayerTypeIPv4{\n\t\t\t//fmt.Printf(\"IP Layer\\n\")\n\t\t\tIpPacket := CurrLayer.(*layers.IPv4)\n\t\t\tfmt.Printf(\"\\tIP Src: %s\\n\", IpPacket.SrcIP)\n\t\t\t//fmt.Printf(\"\\tIP Dst: %s\\n\", IpPacket.DstIP)\n\t\t}\n\t\tif CurrLayer.LayerType() == layers.LayerTypeGRE{\n\t\t\tfmt.Printf(\"GRE Layer\\n\")\n\t\t\tGREPacket := CurrLayer.(*layers.GRE)\n\t\t\tfmt.Printf(\"\\t%d\\n\", GREPacket.Flags)\n\t\t}\n\t\tif CurrLayer.LayerType() == layers.LayerTypeEthernet{\n\t\t\tfmt.Printf(\"Eth Layer\\n\")\n\t\t\t//EthPacket := CurrLayer.(*layers.Ethernet)\n\t\t\t//fmt.Printf()\n\t\t}\n\t\n\t}\n\t*/\n}", "title": "" }, { "docid": "9b1d0e334489920c3b36ef29e2e5880a", "score": "0.3900241", "text": "func (p *Protocol) processType(typearr map[layers.DNSType]int, dnstype layers.DNSType) {\n\ttypearr[dnstype]++\n}", "title": "" }, { "docid": "d760a64e814b3218be6aa50c2cfb6501", "score": "0.3892831", "text": "func (s *BaseMySqlParserListener) EnterTablespaceStorage(ctx *TablespaceStorageContext) {}", "title": "" }, { "docid": "867f36340e117a68c28e830785ef89d3", "score": "0.38861758", "text": "func (when *WhenIface) StoreIf(data *intf.Interfaces_Interface, opts ...interface{}) {\n\twhen.Log.Debug(\"When_StoreIf begin\")\n\terr := when.NewChange(pluginName).Put().Interface(data).Send().ReceiveReply()\n\tif err != nil {\n\t\twhen.Log.Panic(err)\n\t}\n\twhen.Log.Debug(\"When_StoreIf end\")\n}", "title": "" }, { "docid": "daf460989fb9241acbbe39a65c1592ef", "score": "0.38847017", "text": "func (c *client) ReceiveCommunication(sender shared.ClientID, data map[shared.CommunicationFieldName]shared.CommunicationContent) {\n\tc.Communications[sender] = append(c.Communications[sender], data)\n\t// c.clientPrint(\"Received communication: %+v\", data)\n\tfor contentType, content := range data {\n\t\tswitch contentType {\n\t\tcase shared.IIGOTaxDecision:\n\t\t\tc.iigoInfo.taxationAmount = shared.Resources(content.IntegerData)\n\t\tcase shared.IIGOAllocationDecision:\n\t\t\tc.iigoInfo.commonPoolAllocation = shared.Resources(content.IntegerData)\n\t\tcase shared.RuleName:\n\t\t\tcurrentRuleID := content.TextData\n\t\t\t// Rule voting\n\t\t\tif _, ok := data[shared.RuleVoteResult]; ok {\n\t\t\t\tif _, ok := c.iigoInfo.ruleVotingResults[currentRuleID]; ok {\n\t\t\t\t\tc.iigoInfo.ruleVotingResults[currentRuleID].resultAnnounced = true\n\t\t\t\t\tc.iigoInfo.ruleVotingResults[currentRuleID].result = data[shared.RuleVoteResult].BooleanData\n\t\t\t\t} else {\n\t\t\t\t\tc.iigoInfo.ruleVotingResults[currentRuleID] = &ruleVoteInfo{resultAnnounced: true, result: data[shared.RuleVoteResult].BooleanData}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Rule sanctions\n\t\t\tif _, ok := data[shared.IIGOSanctionScore]; ok {\n\t\t\t\t// c.clientPrint(\"Received sanction info: %+v\", data)\n\t\t\t\tc.iigoInfo.sanctions.rulePenalties[currentRuleID] = roles.IIGOSanctionScore(data[shared.IIGOSanctionScore].IntegerData)\n\t\t\t}\n\t\tcase shared.RoleMonitored:\n\t\t\tc.iigoInfo.monitoringDeclared[content.IIGORoleData] = true\n\t\t\tc.iigoInfo.monitoringOutcomes[content.IIGORoleData] = data[shared.MonitoringResult].BooleanData\n\t\tcase shared.SanctionClientID:\n\t\t\tc.iigoInfo.sanctions.islandSanctions[shared.ClientID(content.IntegerData)] = roles.IIGOSanctionTier(data[shared.IIGOSanctionTier].IntegerData)\n\t\tcase shared.IIGOSanctionTier:\n\t\t\tc.iigoInfo.sanctions.tierInfo[roles.IIGOSanctionTier(content.IntegerData)] = roles.IIGOSanctionScore(data[shared.IIGOSanctionScore].IntegerData)\n\t\tcase shared.SanctionAmount:\n\t\t\tc.iigoInfo.sanctions.ourSanction = roles.IIGOSanctionScore(content.IntegerData)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4b4f3cfb8094c7816f8342f76ab54423", "score": "0.38806957", "text": "func (c *central) handleFindByTypeValue(b []byte) []byte {\n\tstart, end := readHandleRange(b[:4])\n\tt := UUID{b[4:6]}\n\tu := UUID{b[6:]}\n\n\t// Only support the ATT ReadByGroupReq for GATT Primary Service Discovery.\n\t// More sepcifically, the \"Discover Primary Services By Service UUID\" sub-procedure\n\tif !t.Equal(attrPrimaryServiceUUID) {\n\t\treturn attErrorRsp(attOpFindByTypeValueReq, start, attEcodeAttrNotFound)\n\t}\n\n\tw := newL2capWriter(c.mtu)\n\tw.WriteByteFit(attOpFindByTypeValueRsp)\n\n\tvar wrote bool\n\tfor _, a := range c.attrs.Subrange(start, end) {\n\t\tif !a.typ.Equal(attrPrimaryServiceUUID) {\n\t\t\tcontinue\n\t\t}\n\t\tif !(UUID{a.value}.Equal(u)) {\n\t\t\tcontinue\n\t\t}\n\t\ts := a.pvt.(*Service)\n\t\tw.Chunk()\n\t\tw.WriteUint16Fit(s.h)\n\t\tw.WriteUint16Fit(s.endh)\n\t\tif ok := w.Commit(); !ok {\n\t\t\tbreak\n\t\t}\n\t\twrote = true\n\t}\n\tif !wrote {\n\t\treturn attErrorRsp(attOpFindByTypeValueReq, start, attEcodeAttrNotFound)\n\t}\n\n\treturn w.Bytes()\n}", "title": "" }, { "docid": "c189a6b58ebdc2fe7a6347e807319c77", "score": "0.38730872", "text": "func parseTabletsFromHtml(body string) (map[string]TabletInfo, error) {\n tablets := map[string]TabletInfo{}\n // Regex for getting the table from html\n tableRegex, err := regexp.Compile(`(?ms)<table class='table table-striped'>(.*?)<\\/table>`)\n if err != nil {\n return tablets, err\n }\n rowRegex, err := regexp.Compile(\n `(?ms)<tr><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td>`+\n `<td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td>`)\n if err != nil {\n return tablets, err\n }\n tableHtml := tableRegex.FindString(body)\n\n rowMatches := rowRegex.FindAllStringSubmatch(tableHtml, -1)\n if err != nil {\n return tablets, err\n }\n linkRegex, err := regexp.Compile(`(?ms)<a.*?>(.*?)</a>`)\n if err != nil {\n return tablets, err\n }\n for _, row := range rowMatches {\n defer func() {\n if r := recover(); r != nil {\n logger.Log.Debugf(\"Recovered from index out of range error: \", row)\n }\n }()\n namespace := row[1]\n tableName := row[2]\n tableUuid := row[3]\n tabletId := linkRegex.FindStringSubmatch(row[4])[1]\n state := row[6]\n raftConfig := row[10]\n hasLeader := strings.Contains(raftConfig, \"LEADER\")\n tablets[tabletId] = TabletInfo{\n Namespace: namespace,\n TableName: tableName,\n TableUuid: tableUuid,\n State: state,\n HasLeader: hasLeader,\n }\n }\n return tablets, nil\n}", "title": "" }, { "docid": "12fe8bc36538f91c9a94ac63a13de659", "score": "0.38720843", "text": "func process_IP(c Container){\r\n\tvar received_ip string\r\n\tjson.Unmarshal(c.Object, &received_ip)\r\n\tpeer_ip_pool = append_if_missing(peer_ip_pool, received_ip)\r\n\tfmt.Println(\"Received IP added to dynamic ip pool: \" + received_ip)\r\n\tfor ele := range peer_ip_pool{\r\n\t\tfmt.Println(\"dynamic ip pool: \" + peer_ip_pool[ele])\r\n\t}\r\n\tif (contains_str(SEED_IP_POOL, production_ip) || len(SEED_IP_POOL) == 0 ){\r\n\t\t//YS: Seed node receive new IP and send whole blockchain\r\n\t\tdialConn_bc(received_ip)\r\n\t\tfmt.Println(\"Seed sending blockchain to new node: \" + received_ip)\r\n\t\tdialConn_pc(received_ip)\r\n\t\tfmt.Println(\"Seed sending potential_chains to new node: \" + received_ip)\r\n\t\t//YS: Seed node receive new node IP and broadcast to all nodes\r\n\t\tbroadcast_IPS()\r\n\t\tfmt.Println(\"Seed sending IP POOL to new node: \" + received_ip)\r\n\t}\r\n}", "title": "" }, { "docid": "4dce67e3dff136342614e3bd78ca7712", "score": "0.38688275", "text": "func ParseEagleSchematic(r io.Reader) ([]PartsStruct, []NetsStruct, error) {\n\tvar sch Eagle\n\n\tbyteValue, _ := ioutil.ReadAll(r)\n\terr := xml.Unmarshal(byteValue, &sch)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Get the relay attributes for on/off-bounce times\n\tenergizing := \"^\" // Default is to be energized immediately\n\treleasing := \"v\" // Default is to be released immediately\n\tfor _, d1 := range sch.Drawing.Schematic.Libraries.Library {\n\t\tif d1.Name == libName {\n\t\t\tfor _, d2 := range d1.Devicesets.Deviceset {\n\t\t\t\tif d2.Name == \"SPDT\" || d2.Name == \"DPDT\" || d2.Name == \"4PDT\" {\n\t\t\t\t\tfor _, d3 := range d2.Devices.Device[0].Technologies.Technology.Attribute {\n\t\t\t\t\t\tswitch d3.Name {\n\t\t\t\t\t\tcase \"ENERGIZING\":\n\t\t\t\t\t\t\tenergizing = d3.Value\n\t\t\t\t\t\tcase \"RELEASING\":\n\t\t\t\t\t\t\treleasing = d3.Value\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\tparts := make([]PartsStruct, 0)\n\tfor _, part := range sch.Drawing.Schematic.Parts.Part {\n\t\t//\t\tfmt.Println(part.Deviceset)\n\t\tswitch part.Deviceset {\n\t\tcase \"SPDT\":\n\t\t\tfallthrough\n\t\tcase \"DPDT\":\n\t\t\tfallthrough\n\t\tcase \"4PDT\":\n\t\t\tparts = append(parts, PartsStruct{Name: part.Name, Typ: part.Deviceset, Value1: releasing, Value2: energizing})\n\t\tcase \"CLOCK_LH\":\n\t\t\tparts = append(parts, PartsStruct{Name: part.Name, Typ: part.Deviceset, Value1: part.Value, Value2: \"\"})\n\t\tcase \"GND\": // Ignore GND as a part\n\t\tcase \"PWR\": // Ignore PWR as a part\n\t\tdefault:\n\t\t\treturn nil, nil, errors.New(\"unknown device type: \" + part.Deviceset)\n\t\t}\n\t}\n\n\tnets := make([]NetsStruct, 0)\n\tfor _, sheet := range sch.Drawing.Schematic.Sheets.Sheet {\n\t\tfor _, net := range sheet.Nets.Net {\n\t\t\ttn := NetsStruct{Net: net.Name, Conns: make([]ConnStruct, 0)}\n\t\t\tfor _, pa := range net.Segment.Pinref {\n\t\t\t\tif pa.Part[0] != '_' {\n\t\t\t\t\ttn.Conns = append(tn.Conns, ConnStruct{Part: pa.Part, Pin: pa.Pin})\n\t\t\t\t}\n\t\t\t}\n\t\t\tnets = append(nets, tn)\n\t\t}\n\t\t// TODO Only store text block from a particular layer\n\t\t// BODY This allows for comment-only texts in the schematic\n\t\t// The text blocks ends up inside the ...Sheets... but needs to be handled as a part\n\t\tfor cnt, txt := range sheet.Plains.Texts {\n\t\t\tt := strings.Replace(txt.Text, \" \", \"\", -1)\n\t\t\tt = strings.Replace(t, \"\\t\", \"\", -1)\n\t\t\tt = strings.Trim(t, \"\\n\")\n\t\t\tparts = append(parts, PartsStruct{Name: fmt.Sprintf(\"TEXT%d\", cnt), Typ: \"TEXT\", Value1: t, Value2: \"\"})\n\t\t}\n\t}\n\n\tspew.Dump(parts)\n\n\treturn parts, nets, nil\n}", "title": "" }, { "docid": "000a2f3c194d03d0266ebfc8180b447a", "score": "0.38636106", "text": "func(server *HermesServer) ProcessPayload(packet []byte) {\n log.Debug(fmt.Sprintf(\"processing new hermes payload %s\", string(packet)))\n var payload HermesPayload\n err := json.Unmarshal(packet, &payload)\n if err != nil {\n log.Error(fmt.Errorf(\"unable to parse udp packet to required JSON format: %v\", err))\n return\n }\n // determine metric type based on metric name from local mappings of metrics\n metricType, err := GetMetricType(payload.MetricName)\n if err != nil {\n log.Error(fmt.Sprintf(\"cannot process metric %s: metric not registered\", payload.MetricName))\n return\n }\n\n bytesPayload, _ := json.Marshal(payload.Payload)\n // process payload depending on metric type\n switch metricType {\n\n // process counter metrics\n case \"counter\":\n log.Debug(fmt.Sprintf(\"processing 'counter' payload %+v\", payload.Payload))\n var counter CounterJSON\n err := json.Unmarshal(bytesPayload, &counter)\n if err != nil {\n log.Error(fmt.Sprintf(\"cannot process 'counter' metric. invalid JSON\"))\n return\n }\n IncrementCounter(payload.MetricName, counter)\n\n // process gauge metrics\n case \"gauge\":\n log.Debug(fmt.Sprintf(\"processing 'gauge' payload %+v\", payload.Payload))\n var gauge GaugeJSON\n err := json.Unmarshal(bytesPayload, &gauge)\n if err != nil {\n log.Error(fmt.Sprintf(\"cannot process 'gauge' metric. invalid JSON\"))\n return\n }\n ProcessGauge(payload.MetricName, gauge)\n\n // process histogram metrics\n case \"histogram\":\n log.Debug(fmt.Sprintf(\"processing 'histogram' payload %+v\", payload.Payload))\n var histogram HistogramJSON\n err := json.Unmarshal(bytesPayload, &histogram)\n if err != nil {\n log.Error(fmt.Sprintf(\"cannot process 'histogram' metric. invalid JSON\"))\n return\n }\n ObserveHistogram(payload.MetricName, histogram)\n\n // process summary metrics\n case \"summary\":\n log.Debug(fmt.Sprintf(\"processing 'summary' payload %+v\", payload.Payload))\n var summary SummaryJSON\n err := json.Unmarshal(bytesPayload, &summary)\n if err != nil {\n log.Error(fmt.Sprintf(\"cannot process 'summary' metric. invalid JSON\"))\n return\n }\n ObserveSummary(payload.MetricName, summary)\n }\n}", "title": "" }, { "docid": "fbbc7360256c776edf9468f37757bc20", "score": "0.3861872", "text": "func (rn *RaftNode) doActions(actions []interface{}) {\n\t// fmt.Printf(\"%v actions called %v \\n\", rn.Id(), actions)\n\tfor _, action := range actions {\n\t\tswitch action.(type) {\n\t\tcase AlarmAc:\n\t\t\t// rn.parTOs += 1\n\t\t\tcmd := action.(AlarmAc)\n\t\t\tgo rn.ProcessAlarmAc(cmd)\n\t\tcase SendAc:\n\t\t\tcmd := action.(SendAc)\n\t\t\trn.ProcessSendAc(cmd)\n\t\tcase CommitAc:\n\t\t\tcmd := action.(CommitAc)\n\t\t\trn.ProcessCommitAc(cmd)\n\t\tcase LogStoreAc:\n\t\t\tcmd := action.(LogStoreAc)\n\t\t\trn.ProcessLogStoreAc(cmd)\n\t\tcase StateStoreAc:\n\t\t\tcmd := action.(StateStoreAc)\n\t\t\trn.ProcessStateStoreAc(cmd)\n\t\tdefault:\n\t\t\tprintln(\"ERROR : Invalid Action Type\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4be8497a56bf0267a02e3fd4b09d25e6", "score": "0.3856932", "text": "func getUsedPortsAndMode(url string) (portmodeusagemap map[int]ConnectedDeviceInfo, err error) {\n\n\t// cid can be any number\n\tvar payload = []byte(`{\n \"code\":\"request\",\n \"cid\":42,\n \"adr\":\"/getdatamulti\",\n \"data\":{\n \"datatosend\":[\n \"/iolinkmaster/port[1]/mastercycletime_actual\",\n \"/iolinkmaster/port[2]/mastercycletime_actual\",\n \"/iolinkmaster/port[3]/mastercycletime_actual\",\n \"/iolinkmaster/port[4]/mastercycletime_actual\",\n \"/iolinkmaster/port[5]/mastercycletime_actual\",\n \"/iolinkmaster/port[6]/mastercycletime_actual\",\n \"/iolinkmaster/port[7]/mastercycletime_actual\",\n \"/iolinkmaster/port[8]/mastercycletime_actual\",\n \"/iolinkmaster/port[1]/mode\",\n \"/iolinkmaster/port[2]/mode\",\n \"/iolinkmaster/port[3]/mode\",\n \"/iolinkmaster/port[4]/mode\",\n \"/iolinkmaster/port[5]/mode\",\n \"/iolinkmaster/port[6]/mode\",\n \"/iolinkmaster/port[7]/mode\",\n \"/iolinkmaster/port[8]/mode\",\n\t\t\t\"/iolinkmaster/port[1]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[2]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[3]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[4]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[5]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[6]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[7]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[8]/iolinkdevice/deviceid\",\n\t\t\t\"/iolinkmaster/port[1]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[2]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[3]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[4]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[5]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[6]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[7]/iolinkdevice/vendorid\",\n\t\t\t\"/iolinkmaster/port[8]/iolinkdevice/vendorid\"\n ]\n }\n}`)\n\n\treq, err := http.NewRequestWithContext(context.Background(), \"POST\", url, bytes.NewBuffer(payload))\n\tif err != nil {\n\t\tzap.S().Warnf(\"Failed to create post request for url: %s\", url)\n\t\treturn\n\t}\n\tclient := GetHTTPClient(url)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\tzap.S().Debugf(\"Response status not 200 but instead: %d\", resp.StatusCode)\n\t\treturn\n\t}\n\n\tvar body []byte\n\tbody, err = io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar portmodesraw RawUsedPortsAndMode\n\tportmodesraw, err = UnmarshalUsedPortsAndMode(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif portmodesraw.Code != 200 {\n\t\terr = fmt.Errorf(\"getusedPortsAndMode returned non 200 code: %d\", portmodesraw.Code)\n\t}\n\n\tportmodeusagemap = make(map[int]ConnectedDeviceInfo)\n\n\tfor key, value := range portmodesraw.Data {\n\t\tvar port int\n\t\tport, err = extractIntFromString(key)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tvar val ConnectedDeviceInfo\n\t\tvar ok bool\n\t\tif val, ok = portmodeusagemap[port]; !ok {\n\t\t\tval = ConnectedDeviceInfo{\n\t\t\t\tMode: 0,\n\t\t\t\tConnected: false,\n\t\t\t\tDeviceId: 0,\n\t\t\t\tVendorId: 0,\n\t\t\t}\n\t\t\tzap.S().Debugf(\"Adding new port %d to map\", port)\n\t\t\tportmodeusagemap[port] = val\n\t\t}\n\t\t// mastercycletime_actual will return 200 for analog sensors, if they are connected\n\t\tif strings.Contains(key, \"mastercycletime_actual\") {\n\t\t\tif value.Code == 200 {\n\t\t\t\tval.Connected = true\n\t\t\t\tzap.S().Debugf(\"Got MasterCycleTime, connection is true for port %d\", port)\n\t\t\t\tportmodeusagemap[port] = val\n\t\t\t}\n\t\t} else if strings.Contains(key, \"mode\") {\n\t\t\tif value.Code == 200 && value.Data != nil {\n\t\t\t\tval.Mode = uint(*value.Data)\n\t\t\t\tzap.S().Debugf(\"Got Mode, mode is %d for port %d\", val.Mode, port)\n\t\t\t\tval.Connected = val.Mode != 0\n\t\t\t\tportmodeusagemap[port] = val\n\t\t\t}\n\t\t} else if strings.Contains(key, \"deviceid\") {\n\t\t\tif value.Code == 200 {\n\t\t\t\tzap.S().Debugf(\"Got DeviceId, deviceid is %d for port %d\", *value.Data, port)\n\t\t\t\tval.DeviceId = uint(*value.Data)\n\t\t\t\tportmodeusagemap[port] = val\n\t\t\t}\n\t\t} else if strings.Contains(key, \"vendorid\") {\n\t\t\tif value.Code == 200 {\n\t\t\t\tzap.S().Debugf(\"Got VendorId, vendorid is %d for port %d\", *value.Data, port)\n\t\t\t\tval.VendorId = uint(*value.Data)\n\t\t\t\tportmodeusagemap[port] = val\n\t\t\t}\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"invalid data returned from IO-Link Master: %v -> %v\", key, value)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6371150b9f92669b6e4de4f237048942", "score": "0.38559926", "text": "func (self *Net) getNetWorkInfoFromIaas(subID string) error {\n\tnwt, err := self.GetByID()\n\tif err != nil {\n\t\tklog.Error(\"Net Create call self.GetById ERROR:\", err)\n\t\treturn err\n\t}\n\tself.Network = *nwt\n\n\tsub, err := self.GetSubnetByID(subID)\n\tif err != nil {\n\t\tklog.Error(\"Net Create call self.GetSubnetById ERROR:\", err)\n\t\treturn err\n\t}\n\tself.Subnet = *sub\n\n\tnetExt, err := self.GetExtenByID()\n\tif err != nil {\n\t\tklog.Errorf(\"Net Create call self.GetExtenByID ERROR:%v\", err)\n\t\treturn err\n\t}\n\tself.Provider = *netExt\n\n\treturn nil\n}", "title": "" }, { "docid": "7157aaa49368874e0677d6154739cd0e", "score": "0.38551274", "text": "func prepareGetSoftComp(index int) ([]string, [][]interface{}) {\n\tvar queryArray []string // mark it as Max Queries\n\tvar docArray [][]interface{}\n\tswitch index {\n\tcase firstIndex, secondIndex:\n\t\t// the following function sets the naked nodes linked to a platform id, through psa-rot\n\t\tqueryArray, docArray = prepareRoTdata(0)\n\t\tqArray := []string{\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-bl-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-prot-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-arot-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t\t\"FOR swid IN \" + mindepth + to + maxdepth + \" ANY \" + \"'swid_collection/example.acme.roadrunner-sw-app-v1-0-0'\" + space + \"edge_rel_scheme\" + newline + \" RETURN swid\",\n\t\t}\n\t\tqueryArray = append(queryArray, qArray...)\n\t\tswRsp := []SoftwareIdentityWrapper{\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: blPTagV1, TagVersion: 0, SoftwareName: \"Roadrunner Boot Loader patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"BL\", Description: \"TF-M_SHA256MemPreXIP\", MeasurementValue: blPMeasVal, SignerID: tSignerID2}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: pRotPV1, TagVersion: 0, SoftwareName: \"Roadrunner PRoT Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M1\", Description: \"\", MeasurementValue: pRotPMeasVal, SignerID: tSignerID1}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: aRotPV1, TagVersion: 0, SoftwareName: \"Roadrunner ARoT Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M2\", Description: \"\", MeasurementValue: aRotPMeasVal, SignerID: tSignerID2}}}}}},\n\t\t\tSoftwareIdentityWrapper{ID: SoftwareIdentity{TagID: appPV1, TagVersion: 0, SoftwareName: \"Roadrunner App Patch V1\", SoftwareVersion: \"1.0.1\", Entity: []PsaEntity{PsaEntity{Name: \"ACME Ltd\", RegID: \"acme.example\", Role: []string{\"tagCreator\", \"aggregator\"}}}, Payload: []ResourceCollection{ResourceCollection{Resources: []Resource{Resource{Type: armResType, MeasType: \"M3\", Description: \"\", MeasurementValue: appPMeasVal, SignerID: tSignerID3}}}}}},\n\t\t}\n\t\t// populate one document per query above\n\t\tfor _, swdoc := range swRsp {\n\t\t\tdocList := []interface{}{}\n\t\t\tdocList = append(docList, swdoc)\n\t\t\tdocArray = append(docArray, docList)\n\t\t}\n\t}\n\treturn queryArray, docArray\n}", "title": "" }, { "docid": "e0b5c257bdfba633e2261c99d9d01572", "score": "0.3855062", "text": "func decodeExtendedSwitchFlowRecord(data *[]byte) (SFlowExtendedSwitchFlowRecord, error) {\n\tes := SFlowExtendedSwitchFlowRecord{}\n\tvar fdf SFlowFlowDataFormat\n\n\t*data, fdf = (*data)[4:], SFlowFlowDataFormat(binary.BigEndian.Uint32((*data)[:4]))\n\tes.EnterpriseID, es.Format = fdf.decode()\n\t*data, es.FlowDataLength = (*data)[4:], binary.BigEndian.Uint32((*data)[:4])\n\t*data, es.IncomingVLAN = (*data)[4:], binary.BigEndian.Uint32((*data)[:4])\n\t*data, es.IncomingVLANPriority = (*data)[4:], binary.BigEndian.Uint32((*data)[:4])\n\t*data, es.OutgoingVLAN = (*data)[4:], binary.BigEndian.Uint32((*data)[:4])\n\t*data, es.OutgoingVLANPriority = (*data)[4:], binary.BigEndian.Uint32((*data)[:4])\n\treturn es, nil\n}", "title": "" }, { "docid": "794f354978553a5f91beaf6182de5f51", "score": "0.38522926", "text": "func (client *MemcachedClient4B) store(opr uint8, e *common.Element) error {\n\tif e == nil {\n\t\treturn fmt.Errorf(\"Memcached : nil pointer error\")\n\t}\n\n\treturn client.parse.Store(opr, e.Key, e.Flags, e.Exptime, e.Cas, e.Value)\n}", "title": "" }, { "docid": "22d4961d69d1b794fe4c1473ccf75282", "score": "0.38487968", "text": "func (p HostSwitch) Add(host string, h fasthttp.RequestHandler) {\n\tfor _, s := range strings.Split(host, \",\") {\n\t\tp[s] = h\n\t}\n}", "title": "" } ]
0c08c8a61de656d0a519b5c0e05dd316
Respond writes a http response only with status, without body
[ { "docid": "9f277a7aa16711a962cd3a628d13d5b4", "score": "0.0", "text": "func Respond(w http.ResponseWriter, status int) {\n\tw.Header().Add(HeaderContentTypeKey, ContentTypeApplicationJSON)\n\tw.WriteHeader(status)\n}", "title": "" } ]
[ { "docid": "2e518bda4b9936319249e9d0e356c4db", "score": "0.74354094", "text": "func (w *responseWriter) Write(b []byte) (int, error) {\n if w.status == 0 {\n w.WriteHeader(http.StatusOK)\n }\n return w.ResponseWriter.Write(b)\n}", "title": "" }, { "docid": "4c849fc125cd5d643820b688a5026792", "score": "0.7038459", "text": "func (h HttpUtil) Write(res http.ResponseWriter, status int, data []byte) (int, error) {\n\tres.WriteHeader(status)\n\treturn res.Write(data)\n}", "title": "" }, { "docid": "fc7bd996d9da197dd770d9677717c888", "score": "0.6978416", "text": "func (w *wrapResponseWriter) Write(data []byte) (int, error) {\n\tif w.statusCode == 0 {\n\t\tw.statusCode = http.StatusOK\n\t}\n\treturn w.ResponseWriter.Write(data)\n}", "title": "" }, { "docid": "ac067121deaf4de22872915d512cb530", "score": "0.6953278", "text": "func (r *response) Respond(statusCode int) {\n\tr.responseWriter.WriteHeader(statusCode)\n\tif _, err := r.responseWriter.Write([]byte{}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "3e9a85415f8197b8995e57c68a7b80bb", "score": "0.6877273", "text": "func BlankResponse(w http.ResponseWriter) {\n\tw.Header().Set(\"Connection\", \"close\")\n\tw.Header().Set(\"Cache-control\", \"no-cache\")\n\tw.Header().Set(\"Pragma\", \"no-cache\")\n\tw.Header().Set(\"Cache-control\", \"no-store\")\n\tw.Header().Set(\"X-Frame-Options\", \"DENY\")\n\tw.WriteHeader(200)\n}", "title": "" }, { "docid": "3fd089eb6af0efaa7de7d4e950441a07", "score": "0.68517995", "text": "func (o *StopDroneNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "7cd170326c743affae2076d36ca00a2c", "score": "0.68294924", "text": "func (nophandler) WriteResponse(_ http.ResponseWriter, _ *http.Request) error { return nil }", "title": "" }, { "docid": "700f540fd6d443f6413c2fc3fe4db8b9", "score": "0.6794435", "text": "func respond(w http.ResponseWriter, r *http.Request, status int, data interface{}) {\n\tw.WriteHeader(status)\n\tif data != nil {\n\t\tencodeBody(w, r, data)\n\t}\n}", "title": "" }, { "docid": "52e3916a933286cbcb643517ebbb004b", "score": "0.6767501", "text": "func WriteSuccess(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "69b287ec7f6f74c12dd218c79334fe35", "score": "0.6753833", "text": "func respondHTTPErr(w http.ResponseWriter, r *http.Request, status int) {\n\trespondErr(w, r, status, http.StatusText(status))\n}", "title": "" }, { "docid": "f632b941dc553b2bf3b7ee370a174c64", "score": "0.67398584", "text": "func (o *SetDebugStepNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "ce30d212a39401117b563c8540bccf62", "score": "0.67304105", "text": "func (o *DeleteProgramNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "6a31c1b3c533f5a7edb1c7d32a6e8289", "score": "0.673012", "text": "func (o *GetCampaignNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "ac86ec021920d1cf5f4ef8adddfc964a", "score": "0.6726574", "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": "817d3f46c0861bb0b4a9772b0970a54c", "score": "0.67099196", "text": "func writeOk(ctx *macaron.Context, mime string, data []byte) {\n\tctx.Resp.Header().Set(\"Content-Type\", mime)\n\tctx.Resp.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", len(data)))\n\tctx.Resp.WriteHeader(http.StatusOK)\n\tctx.Resp.Write(data)\n}", "title": "" }, { "docid": "eae596bfa9dab427ecc5ee7ead590ec6", "score": "0.67011464", "text": "func (o *RightDroneNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "e4fbd3349739f7a014861d279eccd112", "score": "0.66892815", "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": "5220a41a8feac79b0615482bd75650e3", "score": "0.66849875", "text": "func respond(w http.ResponseWriter, r *http.Request, status int, response types.Response) {\n\tw.WriteHeader(status)\n\trender.JSON(w, r, response)\n}", "title": "" }, { "docid": "e9b510f059e799066748a2cba7606165", "score": "0.667567", "text": "func (o *GetJingDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "74780e7a7034dfc86dddc62b7cd7b89b", "score": "0.66694087", "text": "func Empty(w http.ResponseWriter, statusCode int) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "0e195cdd4dab5cb29ef4212bf91a489d", "score": "0.6664873", "text": "func (o *UpdateStatusNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "6cf4b0db3588f88e9cbf6b3207ee6e76", "score": "0.6653462", "text": "func (o *DeleteTodoItemNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "a1380ac5f92689246f5736f88a0c4db2", "score": "0.66444135", "text": "func (o *GetV1PingOK) 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": "e2dd1ccbde9ef8712a4b94ca93af944b", "score": "0.66439706", "text": "func Write(w http.ResponseWriter, opts ...Option) error {\n\tif len(opts) == 0 {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn nil\n\t}\n\n\tr := &response{code: http.StatusOK}\n\n\tfor _, opt := range opts {\n\t\topt(r)\n\t}\n\n\tif r.code == 0 {\n\t\treturn errors.New(\"0 is not a valid code\")\n\t}\n\n\tfor k, v := range r.headers {\n\t\tw.Header().Add(k, v)\n\t}\n\n\tif !isBodyAllowed(r.code) {\n\t\tw.WriteHeader(r.code)\n\t\treturn nil\n\t}\n\n\tbody, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(r.code)\n\n\tif _, err := w.Write(body); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b7b30abee4cd39d502be802cc71a19b7", "score": "0.66422886", "text": "func (o *GetEndpointIDLogInvalid) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "2e2f9bd24a006de39edebc600d7ec960", "score": "0.66328627", "text": "func writeResponse(resp interface{}, err error, errCode int, w http.ResponseWriter) {\n\tif err != nil {\n\t\tw.WriteHeader(503)\n\t\treturn\n\t}\n\n\tif errCode == 0 {\n\t\terrCode = 200\n\t}\n\n\tjtext, err2 := json.MarshalIndent(resp, \"\", \" \")\n\tif err2 != nil {\n\t\tw.WriteHeader(504)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tw.WriteHeader(errCode)\n\t_, _ = w.Write(jtext)\n}", "title": "" }, { "docid": "f256639a85b8a95d9e459a8a19b28afe", "score": "0.6625776", "text": "func (o *ListTemplateBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "7d331f57f70b51e0e1bc4f0833042714", "score": "0.66196805", "text": "func (r *Response) Write(w http.ResponseWriter) error {\n\tif r.fn != nil {\n\t\treturn r.fn(w)\n\t}\n\n\tif r.redirect != \"\" {\n\t\tw.Header().Set(location, r.redirect)\n\t}\n\n\tstatus := r.status\n\tif status == 0 {\n\t\tstatus = http.StatusOK\n\t}\n\n\tif r.json == nil {\n\t\tw.WriteHeader(status)\n\t\treturn nil\n\t}\n\tw.Header().Set(contentType, applicationJSON)\n\tw.WriteHeader(status)\n\n\treturn json.NewEncoder(w).Encode(r.json)\n}", "title": "" }, { "docid": "420f990bdbec69e6f730c6758b41cbc2", "score": "0.6575847", "text": "func health(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Header().Set(\"Content-Length\", \"0\")\n\tw.WriteHeader(200)\n}", "title": "" }, { "docid": "346fba0569a3c8710c4eb83e04b53f8a", "score": "0.657251", "text": "func (o *UpdateStatusBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "3ca424e75a68273691b0d4538a854d6b", "score": "0.656937", "text": "func write200Msg(w http.ResponseWriter, message []byte) {\n w.Header().Set(\"Content-Type\", \"application/json\")\n w.WriteHeader(http.StatusOK)\n w.Write(message)\n}", "title": "" }, { "docid": "0e92a016f87efe43bee7612c14934fc8", "score": "0.65606236", "text": "func (o *GetPlantByIDBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "0048c483059d9efbe560339f0caa745a", "score": "0.65595686", "text": "func WriteResponse(response interface{}, code int, r *http.Request, w http.ResponseWriter) {\n\tw.WriteHeader(code)\n\tw.Header().Set(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\tw.Header().Set(\"Pragma\", \"no-cache\")\n\tw.Header().Set(\"Expires\", \"0\")\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=UTF-8\")\n\tfmt.Fprintf(w, \"%d %q\", code, response)\n}", "title": "" }, { "docid": "ec21b785d58358a34d9c3cfa6a22a2dd", "score": "0.65593475", "text": "func (o *GetIdentityNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "f35829e7c17d02d30668224f1317e742", "score": "0.6559162", "text": "func (o *LoggedInOK) 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": "6908e2c6c1d27355738141129d377ec3", "score": "0.6549753", "text": "func (o *GetLostBlocksAggCountNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "58c98ca61fe1814f88fdd20b562cd9f7", "score": "0.65443045", "text": "func (res *responseWriter) WriteHeader(status int) {\n\tif res.status != 0 {\n\t\treturn\n\t}\n\tif status == 0 {\n\t\tstatus = http.StatusOK\n\t}\n\tres.status = status\n\tres.hasBody = status >= 200 &&\n\t\tstatus != http.StatusNoContent &&\n\t\tstatus != http.StatusNotModified\n\n\t// The chunkWriter's buffer is unused for now, we'll use it to write the\n\t// status line and avoid a couple of memory allocations (because byte\n\t// slices sent to the bufio.Writer will be seen as escaping to the\n\t// underlying io.Writer).\n\tvar b = res.cw.b[:0]\n\tvar c = res.conn\n\tvar h = res.header\n\n\tif timeout := res.timeout; timeout != 0 {\n\t\tc.SetWriteDeadline(time.Now().Add(timeout))\n\t}\n\n\tif res.hasBody {\n\t\tif s, hasLen := h[\"Content-Length\"]; !hasLen {\n\t\t\th.Set(\"Transfer-Encoding\", \"chunked\")\n\t\t\tres.chunked = true\n\t\t\tres.cw.w = res.conn\n\t\t\tres.cw.n = 0\n\t\t} else if res.remain, res.err = strconv.ParseUint(s[0], 10, 64); res.err != nil {\n\t\t\t// The program put an invalid value in Content-Length, that's a\n\t\t\t// programming error.\n\t\t\tres.err = errors.New(\"bad Content-Length: \" + s[0])\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t// In case the application mistakenly added these.\n\t\th.Del(\"Transfer-Encoding\")\n\t\th.Del(\"Content-Length\")\n\t}\n\n\tif _, hasDate := h[\"Date\"]; !hasDate {\n\t\th.Set(\"Date\", now().Format(time.RFC1123))\n\t}\n\n\tb = append(b, res.req.Proto...)\n\tb = append(b, ' ')\n\tb = strconv.AppendInt(b, int64(status), 10)\n\tb = append(b, ' ')\n\tb = append(b, http.StatusText(status)...)\n\tb = append(b, '\\r', '\\n')\n\n\tif _, err := c.Write(b); err != nil {\n\t\tres.err = err\n\t\treturn\n\t}\n\tif err := h.Write(c); err != nil {\n\t\tres.err = err\n\t\treturn\n\t}\n\tif _, err := c.WriteString(\"\\r\\n\"); err != nil {\n\t\tres.err = err\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "4b54b2cbd1c8c43e4a352459a747092f", "score": "0.6535462", "text": "func (o *PostUsersIDBackgroundimageJpegNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "d315a4c873370856a5e9b95a3ebfa014", "score": "0.65301955", "text": "func WriteNormalResponse(w http.ResponseWriter, content string) {\n\tWriteResponse(w, http.StatusOK, content)\n}", "title": "" }, { "docid": "2cb793e216694134cc6133fa5df240b4", "score": "0.6529292", "text": "func (o *WeaviateWellknownLivenessOK) 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": "e87d539d254a88f60116e91a51c6773a", "score": "0.6528946", "text": "func (o *DeleteEventByIDNoContent) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "081d841ff6e1abe7cdd86de754b2d5e6", "score": "0.65286106", "text": "func WriteResponse(w http.ResponseWriter, code int, value interface{}) {\n\t// RFC2616 explicitly states that the following status codes \"MUST NOT\n\t// include a message-body\":\n\tswitch code {\n\tcase http.StatusNoContent, http.StatusNotModified: // 204, 304\n\t\tw.WriteHeader(code)\n\t\treturn\n\t}\n\n\tswitch v := value.(type) {\n\tcase string:\n\t\tw.Header().Set(\"Content-Type\", \"text/plain; charset=us-ascii\")\n\t\tw.WriteHeader(code)\n\n\t\tif _, err := fmt.Fprintln(w, v); err != nil {\n\t\t\tlogrus.Errorf(\"unable to send string response: %q\", err)\n\t\t}\n\tcase *os.File:\n\t\tw.Header().Set(\"Content-Type\", \"application/octet; charset=us-ascii\")\n\t\tw.WriteHeader(code)\n\n\t\tif _, err := io.Copy(w, v); err != nil {\n\t\t\tlogrus.Errorf(\"unable to copy to response: %q\", err)\n\t\t}\n\tcase io.Reader:\n\t\tw.Header().Set(\"Content-Type\", \"application/x-tar\")\n\t\tw.WriteHeader(code)\n\n\t\tif _, err := io.Copy(w, v); err != nil {\n\t\t\tlogrus.Errorf(\"unable to copy to response: %q\", err)\n\t\t}\n\tdefault:\n\t\tWriteJSON(w, code, value)\n\t}\n}", "title": "" }, { "docid": "1d7fddfc2f350efb614034143a1b18ce", "score": "0.6526216", "text": "func Write(w http.ResponseWriter, response APIResponse) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(response.HTTPCode)\n\tjs, err := json.Marshal(response)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif _, err := w.Write(js); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b9297d866cd4f450450f0503ab981f76", "score": "0.6515894", "text": "func (o *GetPlantByIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "2a2a98ee80cb8cf7852cf8df8e07c214", "score": "0.6514463", "text": "func (o *PutUserStarredOwnerRepoNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "79988db86e4f5377c2be8f388216aa27", "score": "0.6514162", "text": "func NoContent(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "fd0c537adbfdb61da8d69c64be0254c2", "score": "0.65141344", "text": "func (o *LogoutNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "433eb2a5293f4af1996e34a765c06c8d", "score": "0.65129405", "text": "func (o *SetDeploymentStatusBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "fa433634f70394db5b29a24387b144f3", "score": "0.651181", "text": "func (o *SetDeploymentStatusNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "71676af349faefa25aa72d9abb5b0172", "score": "0.64985305", "text": "func Bytes(w http.ResponseWriter, code int, bs []byte) {\n\tw.WriteHeader(code)\n\tif code == 204 {\n\t\treturn\n\t}\n\t_, _ = w.Write(bs)\n}", "title": "" }, { "docid": "09b9aa2b308e75f9497ef5be50a4b159", "score": "0.6489811", "text": "func (o *GetEditTestsFromUserGone) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(410)\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": "69200833f55cac60d748ed4bd86af0b3", "score": "0.6484885", "text": "func (o *DeleteTaskBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "a7601192ea57a61386f0601f9bf68091", "score": "0.64847463", "text": "func (w responseWriterNoBody) Write(data []byte) (int, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "9412d9019d4506b07e3c05704a507880", "score": "0.64802295", "text": "func (o *DeleteNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "df750430a10db3c4c3abfa1837c9e12e", "score": "0.6474448", "text": "func (o *FireTriggerNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "7cae02e8c2b8904582665c8e98434fdf", "score": "0.6469171", "text": "func (o *DeleteProjectAdminNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "bd2a772692452cf74607387c6b23ff5c", "score": "0.6468027", "text": "func (o *IndexClientCertificatesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "7dc4acc7dedc4f1d2d6b4eca18925ea5", "score": "0.6466491", "text": "func (o *PostIdentityVerifyOK) 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": "1f8f3ac9855ed18a3e5ebb19081b1712", "score": "0.6461791", "text": "func (o *DeviceGetNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "a0e19a6b08b2fa4248978f211dabd738", "score": "0.6450377", "text": "func (o *PutProductsNameNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "f242f649ef1349a30388114f2c19b872", "score": "0.6447777", "text": "func (o *GetTeamFromUserGone) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(410)\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": "9e330018943df9989ea4f909df2c4112", "score": "0.64472216", "text": "func httpResponse(w http.ResponseWriter, code int, body string) {\n\tlog.Printf(\"Response: %d %s\", code, body)\n\tw.WriteHeader(code)\n\tfmt.Fprint(w, body)\n}", "title": "" }, { "docid": "8dceee0ab62e98127a81fb292a20ba46", "score": "0.6445456", "text": "func (o *GetSettingsObjectNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "6f5b457edd8e4b12cf50a49465b8f0a6", "score": "0.64394873", "text": "func (o *GetEndpointIDLogNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "78e74c7faca4c0a904f07ee7378c7c8b", "score": "0.64393795", "text": "func (o *GetBlocksListNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "f349736923c6a716721fea41aecad606", "score": "0.6438211", "text": "func (o *GetOrgsOrgPublicMembersUsernameNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "a0d94957ecf97cc33cbc082f1f99c61b", "score": "0.64379305", "text": "func (o *PostIpamIPDisabled) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "78a0fcce61c294002d04535d07708d69", "score": "0.6437368", "text": "func writeResponse(w *http.ResponseWriter, res responseData, status int) {\n\tresJSON, err := json.Marshal(res)\n\tif err != nil {\n\t\thttp.Error(*w, \"Failed to parse struct `responseData` into JSON object\", http.StatusInternalServerError)\n\t}\n\n\t(*w).Header().Set(\"Content-Type\", \"application/json\")\n\t(*w).WriteHeader(status)\n\t(*w).Write(resJSON)\n}", "title": "" }, { "docid": "272bf134002ee72fcf007f2f467c08f2", "score": "0.643507", "text": "func (o *PostIpamIPInvalid) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "84e65188cefcacf9e1cd715fc95815b0", "score": "0.643158", "text": "func Status(response http.ResponseWriter, status int) {\n\tresponse.WriteHeader(status)\n}", "title": "" }, { "docid": "b65d6cbf4ef00c93433dee9bdeae6fd5", "score": "0.6431268", "text": "func (o *StartVMNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "922abbae57e2fe35b5d57bf0d16f5a98", "score": "0.6430033", "text": "func (o *GetUploadBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "8cf82d93f7aa720fecbbcb7e2bd05543", "score": "0.6421636", "text": "func (o *DeleteTaskNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "809e3254f8f67ed72b7effdc8201e6db", "score": "0.64190257", "text": "func (o *PatchMoveNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "f1280e97cb37658678870b7c788ab9b4", "score": "0.6412831", "text": "func (o *GetConcatOK) 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": "311eb26d5b9fad333a4d5cdfe8bf5af5", "score": "0.6410223", "text": "func (o *GetBallotsByPeriodIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "dc1189a10513a5f3e5a179f4f3f78b37", "score": "0.64070714", "text": "func (o *PostIpamIPOK) 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": "9c854507238aaee0dcf2b61d8698abf7", "score": "0.64044285", "text": "func respondWithError(res http.ResponseWriter, status int, message string) {\n\tlog.Printf(\"Error %d: %s\", status, message)\n\tres.Header().Add(\"Content-Type\", \"text/html;charset=utf-8\")\n\tres.WriteHeader(status)\n\tfmt.Fprintf(res, \"<html><head><title>%[1]d</title></head><body>Error %[1]d: %[2]s</body></html>\", status, message)\n}", "title": "" }, { "docid": "062d8e1d03923a149d20388662596c51", "score": "0.6404294", "text": "func (o *GetAnswersFromUserAnsweredTestInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "c92049ad4972352205ea91471d8d741e", "score": "0.6402417", "text": "func (o *GetLostBlocksAggCountBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "127bcc770b0f2436bf2fa7c1224425ab", "score": "0.6400994", "text": "func (o *GetLostEndorsermentsAggCountNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "b8f2c139f7d9ced5700280413a37e739", "score": "0.63997895", "text": "func (o *GetEmployeeByIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "1d4365424570eddc1bbc8b6b1388a9f7", "score": "0.63948077", "text": "func (o *PatchMoveBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "cb619ad26f4fecf16eec2f0fe6bb99a3", "score": "0.63890797", "text": "func (o *SetDeploymentStatusMethodNotAllowed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(405)\n}", "title": "" }, { "docid": "fd74186bf2edc90264ec6abb0f68c22c", "score": "0.6387537", "text": "func (o *CreateWeightTicketDocumentBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(400)\n}", "title": "" }, { "docid": "b3497987633544dfa6b53323c6f87b8b", "score": "0.6386829", "text": "func (o *GetBakersVotingNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "0e1f9622825a747481819af968c7020f", "score": "0.6385983", "text": "func (o *CurrentFloorNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "2c448df793015a5647e9dc4673337e6d", "score": "0.6383667", "text": "func (o *CreateVaccinatorOK) 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": "daf8b562b411ff25d48232ca68eebd03", "score": "0.63803494", "text": "func (o *DeletePlanNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "be16c5e9346eec51e6f20c95edfafdda", "score": "0.637781", "text": "func response(w http.ResponseWriter, errMessage string, id string, status int) {\n\tw.WriteHeader(status)\n\n\tvalidate := PostResponses{errMessage, id, strconv.Itoa(status)}\n\tbytes, errs := json.Marshal(&validate)\n\tif errs != nil {\n\t\tfmt.Println(errs) // this errors is only for execution no need to output to user\n\t} else {\n\t\tw.Write(bytes)\n\t}\n}", "title": "" }, { "docid": "5abef56537256ea483ca45bdb6ba4310", "score": "0.6371806", "text": "func (o *GetIPNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "572076450e19700551bb07683e9e3ba8", "score": "0.6370035", "text": "func (o *GetUploadNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "835f1bc9aacbd32842dcf4ccd63dbbf6", "score": "0.6369758", "text": "func respondNotFound(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "title": "" }, { "docid": "9ce7ec1a34ccc6b0eec05927f44dc182", "score": "0.6369301", "text": "func (o *GetServiceInstancesInstanceIDLastOperationGone) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(410)\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": "71571912bc7529168acc0b3e3319f4a2", "score": "0.63678956", "text": "func (o *LogsGetUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "title": "" }, { "docid": "753b4ebc8389d5f63bf47999547970a5", "score": "0.6366639", "text": "func (o *InitializeGroupBackupDeletionNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(204)\n}", "title": "" }, { "docid": "0fd71f7920a7757187e5fa635cfa21df", "score": "0.63641846", "text": "func (o *LogsGetForbidden) 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": "27c3b7f595eb41f5c3c72dc3dc2022d0", "score": "0.635979", "text": "func (o *UpdatePetNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "05a058de29e00c9aaee06963687d6d44", "score": "0.63552654", "text": "func (o *UpdateBookNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "252396bfb677cd62d57cbbc89de2f9d5", "score": "0.63544506", "text": "func (o *WeaviateThingsUpdateNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(404)\n}", "title": "" }, { "docid": "a759068809aa48a7ef620f11f5d9ee60", "score": "0.6353696", "text": "func write200Response(payload interface{}, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\n\terr := json.NewEncoder(w).Encode(payload)\n\ttypes.PanicIfError(types.Error{Message: \"Not possible to write 200 response\", Code: 500, Err: err})\n\n\tlogrus.Infof(\"200 Response sent. Payload: %s\", payload)\n}", "title": "" } ]
45f596d96f753d6cfa90c8e4f4083d3e
PageBuilds lists the builds of a given page
[ { "docid": "e08da4906641459be8f54e869482e97b", "score": "0.7928562", "text": "func (g *PagesService) PageBuilds(uri *Hyperlink, uriParams M) (builds []PageBuild,\n\tresult *Result) {\n\turl, err := ExpandWithDefault(uri, &PagesBuildsURL, uriParams)\n\tif err != nil {\n\t\treturn nil, &Result{Err: err}\n\t}\n\tresult = g.client.get(url, &builds)\n\treturn\n}", "title": "" } ]
[ { "docid": "06c7534515c40073a64b9d2470537f2c", "score": "0.7676689", "text": "func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opt *ListOptions) ([]*PagesBuild, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/pages/builds\", owner, repo)\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar pages []*PagesBuild\n\tresp, err := s.client.Do(ctx, req, &pages)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn pages, resp, nil\n}", "title": "" }, { "docid": "b7cfe27d31a244cedfa535b2cc5e6e81", "score": "0.64294875", "text": "func (c *restClient) ListBuilds(ctx context.Context, req *cloudbuildpb.ListBuildsRequest, opts ...gax.CallOption) *BuildIterator {\n\tit := &BuildIterator{}\n\treq = proto.Clone(req).(*cloudbuildpb.ListBuildsRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*cloudbuildpb.Build, string, error) {\n\t\tresp := &cloudbuildpb.ListBuildsResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1/projects/%v/builds\", req.GetProjectId())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetFilter() != \"\" {\n\t\t\tparams.Add(\"filter\", fmt.Sprintf(\"%v\", req.GetFilter()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\t\tif req.GetParent() != \"\" {\n\t\t\tparams.Add(\"parent\", fmt.Sprintf(\"%v\", req.GetParent()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\theaders := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs(\"Content-Type\", \"application/json\"))\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := ioutil.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn maybeUnknownEnum(err)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetBuilds(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "title": "" }, { "docid": "0d05e00fe0912db8c03556ad4e728914", "score": "0.64036363", "text": "func GetBuilderPage(c context.Context, bid *buildbucketpb.BuilderID, pageSize int, pageToken string) (*ui.BuilderPage, error) {\n\tnowTS := timestamppb.New(clock.Now(c))\n\n\thost, err := GetHost(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif pageSize <= 0 {\n\t\tpageSize = 20\n\t}\n\n\tresult := &ui.BuilderPage{}\n\n\tbuildsClient, err := BuildsClient(c, host, auth.AsUser)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbuildersClient, err := BuildersClient(c, host, auth.AsUser)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfetch := func(status buildbucketpb.Status, pageSize int, pageToken string) (builds []*ui.Build, nextPageToken string, complete bool, err error) {\n\t\treq := &buildbucketpb.SearchBuildsRequest{\n\t\t\tPredicate: &buildbucketpb.BuildPredicate{\n\t\t\t\tBuilder: bid,\n\t\t\t\tStatus: status,\n\t\t\t\tIncludeExperimental: true,\n\t\t\t},\n\t\t\tPageToken: pageToken,\n\t\t\tPageSize: int32(pageSize),\n\t\t\tFields: builderPageBuildFields,\n\t\t}\n\n\t\tstart := clock.Now(c)\n\t\tres, err := buildsClient.SearchBuilds(c, req)\n\t\tif err != nil {\n\t\t\terr = utils.TagGRPC(c, err)\n\t\t\treturn\n\t\t}\n\n\t\tlogging.Infof(c, \"Fetched %d %s builds in %s\", len(res.Builds), status, clock.Since(c, start))\n\n\t\tnextPageToken = res.NextPageToken\n\t\tcomplete = nextPageToken == \"\"\n\n\t\tbuilds = make([]*ui.Build, len(res.Builds))\n\t\tfor i, b := range res.Builds {\n\t\t\tbuilds[i] = &ui.Build{\n\t\t\t\tBuild: b,\n\t\t\t\tNow: nowTS,\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\terr = parallel.FanOutIn(func(work chan<- func() error) {\n\t\twork <- func() (err error) {\n\t\t\tresult.MachinePool, err = getPool(c, bid)\n\t\t\treturn\n\t\t}\n\n\t\twork <- func() (err error) {\n\t\t\tresult.Views, err = viewsForBuilder(c, bid)\n\t\t\treturn\n\t\t}\n\n\t\twork <- func() (err error) {\n\t\t\tresult.ScheduledBuilds, _, result.ScheduledBuildsComplete, err = fetch(buildbucketpb.Status_SCHEDULED, 100, \"\")\n\t\t\treturn\n\t\t}\n\t\twork <- func() (err error) {\n\t\t\tresult.StartedBuilds, _, result.StartedBuildsComplete, err = fetch(buildbucketpb.Status_STARTED, 100, \"\")\n\t\t\treturn\n\t\t}\n\t\twork <- func() (err error) {\n\t\t\tresult.EndedBuilds, result.NextPageToken, _, err = fetch(buildbucketpb.Status_ENDED_MASK, pageSize, pageToken)\n\t\t\tresult.PrevPageToken = backPageToken(c, bid, pageSize, pageToken, result.NextPageToken) // Safe to do even with error.\n\t\t\treturn\n\t\t}\n\t\twork <- func() (err error) {\n\t\t\treq := &buildbucketpb.GetBuilderRequest{\n\t\t\t\tId: bid,\n\t\t\t}\n\t\t\tresult.Builder, err = buildersClient.GetBuilder(c, req)\n\t\t\tif err != nil {\n\t\t\t\terr = utils.TagGRPC(c, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Handle inconsistencies.\n\texclude := make(map[int64]struct{}, len(result.EndedBuilds)+len(result.StartedBuilds))\n\taddBuildIDs(exclude, result.EndedBuilds)\n\tresult.StartedBuilds = excludeBuilds(result.StartedBuilds, exclude)\n\taddBuildIDs(exclude, result.StartedBuilds)\n\tresult.ScheduledBuilds = excludeBuilds(result.ScheduledBuilds, exclude)\n\n\treturn result, nil\n}", "title": "" }, { "docid": "b7f83a169842505a19598cd5102dbdc2", "score": "0.6402412", "text": "func ExampleBuildServiceClient_NewListBuildsPager() {\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 := armappplatform.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewBuildServiceClient().NewListBuildsPager(\"myResourceGroup\", \"myservice\", \"default\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.BuildCollection = armappplatform.BuildCollection{\n\t\t// \tValue: []*armappplatform.Build{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"myBuild\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AppPlatform/Spring/buildServices/builds\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice/buildServices/default/builds/myBuild\"),\n\t\t// \t\t\tSystemData: &armappplatform.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:16:03.944Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"sample-user\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armappplatform.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:17:03.944Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"sample-user\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armappplatform.LastModifiedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armappplatform.BuildProperties{\n\t\t// \t\t\t\tAgentPool: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice/buildServices/default/agentPools/default\"),\n\t\t// \t\t\t\tBuilder: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice/buildServices/default/builders/default\"),\n\t\t// \t\t\t\tEnv: map[string]*string{\n\t\t// \t\t\t\t\t\"environmentVariable\": to.Ptr(\"test\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armappplatform.BuildProvisioningStateSucceeded),\n\t\t// \t\t\t\tRelativePath: to.Ptr(\"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855-20210601-3ed9f4a2-986b-4bbd-b833-a42dccb2f777\"),\n\t\t// \t\t\t\tResourceRequests: &armappplatform.BuildResourceRequests{\n\t\t// \t\t\t\t\tCPU: to.Ptr(\"1\"),\n\t\t// \t\t\t\t\tMemory: to.Ptr(\"2Gi\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "a34ea6622e11247cb7ce461ee579cb01", "score": "0.6387822", "text": "func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/pages/builds\", owner, repo)\n\treq, err := s.client.NewRequest(\"POST\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// TODO: remove custom Accept header when this API fully launches.\n\treq.Header.Set(\"Accept\", mediaTypePagesPreview)\n\n\tbuild := new(PagesBuild)\n\tresp, err := s.client.Do(ctx, req, build)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn build, resp, nil\n}", "title": "" }, { "docid": "090ac1bc2c985a37cda56d686409a9a9", "score": "0.63339937", "text": "func (p *Provider) BuildList(app string, opts structs.BuildListOptions) (structs.Builds, error) {\n\ta, err := p.AppGet(app)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlimit := 10\n\tif opts.Limit != nil {\n\t\tlimit = *opts.Limit\n\t}\n\n\treq := &dynamodb.QueryInput{\n\t\tKeyConditions: map[string]*dynamodb.Condition{\n\t\t\t\"app\": {\n\t\t\t\tAttributeValueList: []*dynamodb.AttributeValue{{S: aws.String(a.Name)}},\n\t\t\t\tComparisonOperator: aws.String(\"EQ\"),\n\t\t\t},\n\t\t},\n\t\tIndexName: aws.String(\"app.created\"),\n\t\tLimit: aws.Int64(int64(limit)),\n\t\tScanIndexForward: aws.Bool(false),\n\t\tTableName: aws.String(p.DynamoBuilds),\n\t}\n\n\tres, err := p.dynamodb().Query(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuilds := make(structs.Builds, len(res.Items))\n\n\tfor i, item := range res.Items {\n\t\tbuilds[i] = *p.buildFromItem(item)\n\t}\n\n\treturn builds, nil\n}", "title": "" }, { "docid": "b8ef711c01665e3132114f5024763099", "score": "0.6269823", "text": "func (c *Client) getOnePage(url string) ([]*Build, string, error) {\n\tresp, err := c.Get(url)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tdefer util.Close(resp.Body)\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, \"\", fmt.Errorf(\"Request got response %s\", resp.Status)\n\t}\n\tvar result struct {\n\t\tBuilds []*Build `json:\"builds\"`\n\t\tNextCursor string `json:\"next_cursor\"`\n\t}\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treturn result.Builds, result.NextCursor, nil\n}", "title": "" }, { "docid": "be75edc209e5369c7b26b5967b33e971", "score": "0.6259637", "text": "func (c client) GetBuilds(count int) ([]Build, error) {\n\tdebugf(\"GetBuilds(%d)\", count)\n\targs := url.Values{}\n\targs.Set(\"locator\", fmt.Sprintf(\"count:%d,running:any\", count))\n\targs.Set(\"fields\", \"build(id,number,status,state,buildTypeId,statusText,running,percentageComplete)\")\n\n\tvar list buildList\n\terr := c.httpGet(\"/builds\", &args, &list)\n\tif err != nil {\n\t\terrorf(\"GetBuilds(%d) failed with %s\", count, err)\n\t\treturn nil, err\n\t}\n\n\tdebugf(\"GetBuilds(%d): OK\", count)\n\treturn createBuildsFromJSON(list.Builds), nil\n}", "title": "" }, { "docid": "eb9abb13320bb8e27abb0e341ac93a87", "score": "0.625258", "text": "func (a *API) onePage(branch string, endBuildId int64, collect map[int64]int64, pageToken string) (string, error) {\n\tfor i := 0; i < RETRIES; i++ {\n\t\tsklog.Infof(\"Querying for %q %d\", branch, endBuildId)\n\t\trequest := a.service.Build.List().BuildType(\"submitted\").Branch(branch).MaxResults(PAGE_SIZE).Fields(\"builds(buildId,creationTimestamp),nextPageToken\")\n\t\trequest.EndBuildId(fmt.Sprintf(\"%d\", endBuildId))\n\t\tif pageToken != \"\" {\n\t\t\trequest.PageToken(pageToken)\n\t\t}\n\t\tresp, err := request.Do()\n\t\tif err != nil {\n\t\t\tsklog.Infof(\"Call failed: %s\", err)\n\t\t\ttime.Sleep(SLEEP_DURATION)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, build := range resp.Builds {\n\t\t\t// Convert build.BuildId to int64.\n\t\t\tbuildId, err := strconv.ParseInt(build.BuildId, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tsklog.Errorf(\"Got an invalid buildid %q: %s \", build.BuildId, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ts, ok := collect[buildId]; !ok {\n\t\t\t\tcollect[buildId] = build.CreationTimestamp / 1000\n\t\t\t} else {\n\t\t\t\t// Check if timestamp is earlier than ts we've already recorded.\n\t\t\t\tif ts < build.CreationTimestamp/1000 {\n\t\t\t\t\tcollect[buildId] = build.CreationTimestamp / 1000\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn resp.NextPageToken, nil\n\t}\n\treturn \"\", fmt.Errorf(\"No valid responses from API after %d requests.\", RETRIES)\n}", "title": "" }, { "docid": "966b48890481a8cb9aa6cf0f99cbecd1", "score": "0.621848", "text": "func GetBuilds(smap ServiceMap) []Build {\n\tconfig := LoadConfig()\n\tvar builds []Build\n\tfor _, svc := range smap.Test {\n\t\tfor _, build := range config.Builds {\n\t\t\tif svc == build.Name {\n\t\t\t\tbuilds = append(builds, build)\n\t\t\t}\n\t\t}\n\t}\n\treturn builds\n}", "title": "" }, { "docid": "e1e312eaa4d4e82ac650fe59de1bb96d", "score": "0.6207915", "text": "func (client *Client) Builds() (builds []Build, err error) {\n\ttry := func(loc Location) (builds []Build, err error) {\n\t\tformat, resp, err := client.Get(loc, \"\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer resp.Close()\n\n\t\tswitch format {\n\t\tcase \".json\":\n\t\t\terr = json.NewDecoder(resp).Decode(&builds)\n\t\t\treturn builds, err\n\t\tcase \".txt\":\n\t\t\tb, err := ioutil.ReadAll(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstream := rbxdhist.Lex(b)\n\t\t\t// Builds after this date are interoperable.\n\t\t\tepoch := time.Date(2018, 8, 7, 0, 0, 0, 0, rbxdhist.ZonePST())\n\t\t\t// Builds after this date use Studio64 instead of Studio.\n\t\t\tepoch64 := time.Date(2023, 6, 1, 0, 0, 0, 0, rbxdhist.ZonePST())\n\t\t\tfor i := 0; i < len(stream); i++ {\n\t\t\t\tswitch job := stream[i].(type) {\n\t\t\t\tcase *rbxdhist.Job:\n\t\t\t\t\t// Only Studio builds.\n\t\t\t\t\tif job.Build != \"Studio\" && job.Build != \"Studio64\" {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif !job.Time.After(epoch) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif job.Build == \"Studio64\" && !job.Time.After(epoch64) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only completed builds.\n\t\t\t\t\tif job.GitHash == \"\" {\n\t\t\t\t\t\t// Jobs that have a git hash are not accompanied by a\n\t\t\t\t\t\t// Status, so just assume that they're Done.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t//TODO: May be better to use another epoch instead.\n\t\t\t\t\t\tif i+1 >= len(stream) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif status, ok := stream[i+1].(*rbxdhist.Status); !ok || *status != \"Done\" {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbuilds = append(builds, Build{\n\t\t\t\t\t\tHash: job.Hash,\n\t\t\t\t\t\tDate: job.Time,\n\t\t\t\t\t\tVersion: job.Version,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn builds, nil\n\t\t}\n\t\treturn nil, errUnsupportedFormat(format)\n\t}\n\tlocs := client.Config.Builds\n\tfor i, loc := range locs {\n\t\tif builds, err = try(loc); err == nil || i == len(locs)-1 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn builds, err\n}", "title": "" }, { "docid": "73e16533edf376500f4ad6971259bc55", "score": "0.6186587", "text": "func (a *API) List(branch string, endBuildId int64) ([]Build, error) {\n\tif endBuildId == 0 {\n\t\treturn nil, fmt.Errorf(\"endBuildId must be a non-zero value, got %d\", endBuildId)\n\t}\n\tpageToken := \"\"\n\tvar err error\n\t// collect is a map[buildid]timestamp.\n\tcollect := map[int64]int64{}\n\tfor {\n\t\tpageToken, err = a.onePage(branch, endBuildId, collect, pageToken)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// We've reached the last page when no pageToken is returned.\n\t\tif pageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Turn 'collect' into a []Build, sorted by ascending timestamp.\n\tret := []Build{}\n\tkeys := []int64{}\n\tfor key := range collect {\n\t\tkeys = append(keys, key)\n\t}\n\tsort.Sort(util.Int64Slice(keys))\n\tfor _, key := range keys {\n\t\tret = append(ret, Build{\n\t\t\tBuildId: key,\n\t\t\tTS: collect[key],\n\t\t})\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "0a79227c9d43f9247e3b00ea3c3d4985", "score": "0.6157853", "text": "func handlePageBuild(ctx context.Context, event *github.PageBuildEvent) error {\n\tctx, span := trace.StartSpan(ctx, \"Event PageBuild\")\n\tspan.AddAttributes(\n\t\ttrace.StringAttribute(\"/github/event\", \"PageBuild\"),\n\t)\n\tdefer span.End()\n\n\twg := sync.WaitGroup{}\n\tch := make(chan error)\n\n\tfor name, hndl := range pageBuildHandlers {\n\t\twg.Add(1)\n\n\t\tgo func(name string, hndl func(context.Context, *github.PageBuildEvent) error) {\n\t\t\tdefer wg.Done()\n\n\t\t\tctx, span := trace.StartSpan(ctx, \"Action \"+name)\n\t\t\tspan.AddAttributes(\n\t\t\t\ttrace.StringAttribute(\"/github/bot/action\", name),\n\t\t\t)\n\t\t\tdefer span.End()\n\n\t\t\tif err := hndl(ctx, event); err != nil {\n\t\t\t\tch <- fmt.Errorf(\"%q PageBuild handler: %v\", name, err)\n\t\t\t}\n\t\t}(name, hndl)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(ch)\n\t}()\n\n\tvar lastErr error\n\tfor err := range ch {\n\t\tif lastErr != nil {\n\t\t\tlog.Print(lastErr)\n\t\t}\n\t\tlastErr = err\n\t}\n\n\treturn lastErr\n}", "title": "" }, { "docid": "cd9c64af13b745d476933f6de962c29f", "score": "0.60696864", "text": "func ListBuilds(parent context.Context, lister Lister, gcsPath Path, after *Path) ([]Build, error) {\n\tctx, cancel := context.WithCancel(parent)\n\tdefer cancel()\n\tvar offset string\n\tif after != nil {\n\t\toffset = after.Object()\n\t}\n\toffsetBaseName := hackOffset(&offset)\n\tif !strings.HasSuffix(offset, \"/\") {\n\t\toffset += \"/\"\n\t}\n\tit := lister.Objects(ctx, gcsPath, \"/\", offset)\n\tvar all []Build\n\tfor {\n\t\tobjAttrs, err := it.Next()\n\t\tif errors.Is(err, iterator.Done) {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"list objects: %w\", err)\n\t\t}\n\n\t\t// if this is a link under directory/, resolve the build value\n\t\t// This is used for PR type jobs which we store in a PR specific prefix.\n\t\t// The directory prefix contains a link header to the result\n\t\t// under the PR specific prefix.\n\t\tif link := readLink(objAttrs); link != \"\" {\n\t\t\t// links created by bootstrap.py have a space\n\t\t\tlink = strings.TrimSpace(link)\n\t\t\tu, err := url.Parse(link)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse %s link: %v\", objAttrs.Name, err)\n\t\t\t}\n\t\t\tif !strings.HasSuffix(u.Path, \"/\") {\n\t\t\t\tu.Path += \"/\"\n\t\t\t}\n\t\t\tvar linkPath Path\n\t\t\tif err := linkPath.SetURL(u); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"bad %s link path %s: %w\", objAttrs.Name, u, err)\n\t\t\t}\n\t\t\tall = append(all, Build{\n\t\t\t\tPath: linkPath,\n\t\t\t\tbaseName: path.Base(objAttrs.Name),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif objAttrs.Prefix == \"\" {\n\t\t\tcontinue // not a symlink to a directory\n\t\t}\n\n\t\tloc := \"gs://\" + gcsPath.Bucket() + \"/\" + objAttrs.Prefix\n\t\tgcsPath, err := NewPath(loc)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"bad path %q: %w\", loc, err)\n\t\t}\n\n\t\tall = append(all, Build{\n\t\t\tPath: *gcsPath,\n\t\t\tbaseName: path.Base(objAttrs.Prefix),\n\t\t})\n\t}\n\n\tSort(all)\n\n\tif offsetBaseName != \"\" {\n\t\t// GCS will return 200 2000 30 for a prefix of 100\n\t\t// testgrid expects this as 2000 200 (dropping 30)\n\t\tfor i, b := range all {\n\t\t\tif sortorder.NaturalLess(b.baseName, offsetBaseName) || b.baseName == offsetBaseName {\n\t\t\t\treturn all[:i], nil // b <= offsetBaseName, so skip this one\n\t\t\t}\n\t\t}\n\t}\n\treturn all, nil\n}", "title": "" }, { "docid": "013b6f8f01bb604600a960da4e0d3ad1", "score": "0.6051786", "text": "func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/pages/builds/%v\", owner, repo, id)\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbuild := new(PagesBuild)\n\tresp, err := s.client.Do(ctx, req, build)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn build, resp, nil\n}", "title": "" }, { "docid": "5d4cb51609eba1a905c26a7a899e37c2", "score": "0.59713745", "text": "func (c client) GetBuildsForBuildType(id string, count int) ([]Build, error) {\n\tdebugf(\"GetBuildsForBuildType('%s', %d)\", id, count)\n\targs := url.Values{}\n\targs.Set(\"locator\", fmt.Sprintf(\"buildType:%s,count:%d,running:any\", url.QueryEscape(id), count))\n\targs.Set(\"fields\", \"build(id,number,status,state,buildTypeId,statusText,running,percentageComplete,queuedDate,startDate,finishDate)\")\n\n\tvar list buildList\n\terr := c.httpGet(\"/builds\", &args, &list)\n\tif err != nil {\n\t\terrorf(\"GetBuildsForBuildType('%s', %d) failed with %s\", id, count, err)\n\t\treturn nil, err\n\t}\n\n\tdebugf(\"GetBuildsForBuildType('%s', %d): OK\", id, count)\n\treturn createBuildsFromJSON(list.Builds), nil\n}", "title": "" }, { "docid": "dec72828639a819359ad5ee98807c9d0", "score": "0.5966864", "text": "func (c *ApiController) GetBuildsAll() {\n\tlog.Info(\"Get all builds\")\n\n\tbuilds := models.GetAllBuilds()\n\n\tc.Data[\"json\"] = builds\n\tc.ServeJson()\n}", "title": "" }, { "docid": "80a4af4fa6dd1573b6fbffdfb7fc3189", "score": "0.58636624", "text": "func GetBuildPage(c *router.Context, br buildbucketpb.GetBuildRequest) (*ui.BuildPage, error) {\n\tbr.Fields = fullBuildMask\n\thost, err := getHost(c.Context)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb, err := GetBuild(c.Context, host, br)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblame, err := getBlame(c.Context, host, b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlink, err := getBugLink(c, b)\n\n\tbp := ui.NewBuildPage(c.Context, b)\n\tbp.Blame = blame\n\tbp.BuildBugLink = link\n\treturn bp, err\n}", "title": "" }, { "docid": "c5efb2d26483c0aeb0306a8475452115", "score": "0.58476514", "text": "func (a *AMP) ListBuilds(repo string, latest bool) (*build.BuildList, error) {\n\tclient := build.NewAmpBuildClient(a.Conn)\n\tctx := context.Background()\n\trequest, err := createProjectRequest(repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.ListBuilds(ctx, request)\n}", "title": "" }, { "docid": "c5ed3fd807946d2bfba3fa76c8f525ea", "score": "0.5838906", "text": "func BuildPage(filename, contents string) {\r\n\tEnsureDir(\"ui\")\r\n\tfileError := WriteToFile(\"./ui/\"+filename+\".gtpl\", contents)\r\n\tif fileError != nil {\r\n\t\tlog.Fatal(fileError)\r\n\t}\r\n}", "title": "" }, { "docid": "799302c72978c1fcc496a0c5372e0367", "score": "0.5790095", "text": "func buildBoardPages(board *Board) (html string) {\n\terr := initTemplates(\"boardpage\")\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tstart_time := benchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), time.Now(), true)\n\tvar current_page_file *os.File\n\tvar threads []interface{}\n\tvar thread_pages [][]interface{}\n\tvar stickied_threads []interface{}\n\tvar nonstickied_threads []interface{}\n\n\t// Check that the board's configured directory is indeed a directory\n\tresults, err := os.Stat(path.Join(config.DocumentRoot, board.Dir))\n\tif err != nil {\n\t\t// Try creating the board's configured directory if it doesn't exist\n\t\terr = os.Mkdir(path.Join(config.DocumentRoot, board.Dir), 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed creating /\"+board.Dir+\"/: \"+err.Error())\n\t\t\treturn\n\t\t}\n\t} else if !results.IsDir() {\n\t\t// If the file exists, but is not a folder, notify the user\n\t\thtml += handleError(1, \"Error: /\"+board.Dir+\"/ exists, but is not a folder.\")\n\t\treturn\n\t}\n\n\t// Get all top level posts for the board.\n\top_posts, err := getPostArr(map[string]interface{}{\n\t\t\"boardid\": board.ID,\n\t\t\"parentid\": 0,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}, \" ORDER BY bumped DESC\")\n\tif err != nil {\n\t\thtml += handleError(1, \"Error getting OP posts for /%s/: %s\", board.Dir, err.Error()) + \"<br />\\n\"\n\t\top_posts = nil\n\t\treturn\n\t}\n\n\t// For each top level post, start building a Thread struct\n\tfor _, op := range op_posts {\n\t\tvar thread Thread\n\t\tvar postsInThread []Post\n\n\t\t// Get the number of replies to this thread.\n\t\tqueryStr := \"SELECT COUNT(*) FROM \" + config.DBprefix + \"posts WHERE boardid = ? AND parentid = ? AND deleted_timestamp = ?\"\n\n\t\tif err = queryRowSQL(queryStr,\n\t\t\t[]interface{}{board.ID, op.ID, nilTimestamp},\n\t\t\t[]interface{}{&thread.NumReplies},\n\t\t); err != nil {\n\t\t\thtml += handleError(1,\n\t\t\t\t\"Error getting replies to /%s/%d: %s\",\n\t\t\t\tboard.Dir, op.ID, err.Error()) + \"<br />\\n\"\n\t\t}\n\n\t\t// Get the number of image replies in this thread\n\t\tqueryStr += \" AND filesize <> 0\"\n\t\tif err = queryRowSQL(queryStr,\n\t\t\t[]interface{}{board.ID, op.ID, op.DeletedTimestamp},\n\t\t\t[]interface{}{&thread.NumImages},\n\t\t); err != nil {\n\t\t\thtml += handleError(1,\n\t\t\t\t\"Error getting number of image replies to /%s/%d: %s\",\n\t\t\t\tboard.Dir, op.ID, err.Error()) + \"<br />\\n\"\n\t\t}\n\n\t\tthread.OP = op\n\n\t\tvar numRepliesOnBoardPage int\n\n\t\tif op.Stickied {\n\t\t\t// If the thread is stickied, limit replies on the archive page to the\n\t\t\t// configured value for stickied threads.\n\t\t\tnumRepliesOnBoardPage = config.StickyRepliesOnBoardPage\n\t\t} else {\n\t\t\t// Otherwise, limit the replies to the configured value for normal threads.\n\t\t\tnumRepliesOnBoardPage = config.RepliesOnBoardPage\n\t\t}\n\n\t\tpostsInThread, err = getPostArr(map[string]interface{}{\n\t\t\t\"boardid\": board.ID,\n\t\t\t\"parentid\": op.ID,\n\t\t\t\"deleted_timestamp\": nilTimestamp,\n\t\t}, fmt.Sprintf(\" ORDER BY id DESC LIMIT %d\", numRepliesOnBoardPage))\n\t\tif err != nil {\n\t\t\thtml += handleError(1,\n\t\t\t\t\"Error getting posts in /%s/%d: %s\",\n\t\t\t\tboard.Dir, op.ID, err.Error()) + \"<br />\\n\"\n\t\t}\n\n\t\tvar reversedPosts []Post\n\t\tfor i := len(postsInThread); i > 0; i-- {\n\t\t\treversedPosts = append(reversedPosts, postsInThread[i-1])\n\t\t}\n\n\t\tif len(postsInThread) > 0 {\n\t\t\t// Store the posts to show on board page\n\t\t\t//thread.BoardReplies = postsInThread\n\t\t\tthread.BoardReplies = reversedPosts\n\n\t\t\t// Count number of images on board page\n\t\t\timage_count := 0\n\t\t\tfor _, reply := range postsInThread {\n\t\t\t\tif reply.Filesize != 0 {\n\t\t\t\t\timage_count++\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Then calculate number of omitted images.\n\t\t\tthread.OmittedImages = thread.NumImages - image_count\n\t\t}\n\n\t\t// Add thread struct to appropriate list\n\t\tif op.Stickied {\n\t\t\tstickied_threads = append(stickied_threads, thread)\n\t\t} else {\n\t\t\tnonstickied_threads = append(nonstickied_threads, thread)\n\t\t}\n\t}\n\n\tnum, _ := deleteMatchingFiles(path.Join(config.DocumentRoot, board.Dir), \"\\\\d.html$\")\n\tprintf(2, \"Number of files deleted: %d\\n\", num)\n\t// Order the threads, stickied threads first, then nonstickied threads.\n\tthreads = append(stickied_threads, nonstickied_threads...)\n\n\t// If there are no posts on the board\n\tif len(threads) == 0 {\n\t\tboard.CurrentPage = 1\n\t\t// Open board.html for writing to the first page.\n\t\tboard_page_file, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"board.html\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1,\n\t\t\t\t\"Failed opening /%s/board.html: %s\", board.Dir, err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\n\t\t// Render board page template to the file,\n\t\t// packaging the board/section list, threads, and board info\n\t\tif err = img_boardpage_tmpl.Execute(board_page_file, map[string]interface{}{\n\t\t\t\"config\": config,\n\t\t\t\"boards\": allBoards,\n\t\t\t\"sections\": allSections,\n\t\t\t\"threads\": threads,\n\t\t\t\"board\": board,\n\t\t}); err != nil {\n\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\n\t\thtml += \"/\" + board.Dir + \"/ built successfully, no threads to build.\\n\"\n\t\tbenchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), start_time, false)\n\t\treturn\n\t} else {\n\t\t// Create the archive pages.\n\t\tthread_pages = paginate(config.ThreadsPerPage, threads)\n\t\tboard.NumPages = len(thread_pages) - 1\n\n\t\t// Create array of page wrapper objects, and open the file.\n\t\tpagesArr := make([]map[string]interface{}, board.NumPages)\n\n\t\tcatalog_json_file, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"catalog.json\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tdefer closeHandle(catalog_json_file)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed opening /\"+board.Dir+\"/catalog.json: \"+err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcurrentBoardPage := board.CurrentPage\n\t\tfor _, page_threads := range thread_pages {\n\t\t\tboard.CurrentPage++\n\t\t\tvar current_page_filepath string\n\t\t\tpageFilename := strconv.Itoa(board.CurrentPage) + \".html\"\n\t\t\tcurrent_page_filepath = path.Join(config.DocumentRoot, board.Dir, pageFilename)\n\t\t\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\t\tdefer closeHandle(current_page_file)\n\t\t\tif err != nil {\n\t\t\t\thtml += handleError(1, \"Failed opening board page: \"+err.Error()) + \"<br />\"\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Render the boardpage template, don't forget config\n\t\t\tif err = img_boardpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\t\t\"config\": config,\n\t\t\t\t\"boards\": allBoards,\n\t\t\t\t\"sections\": allSections,\n\t\t\t\t\"threads\": page_threads,\n\t\t\t\t\"board\": board,\n\t\t\t\t\"posts\": []interface{}{\n\t\t\t\t\tPost{BoardID: board.ID},\n\t\t\t\t},\n\t\t\t}); err != nil {\n\t\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/ boardpage: \"+err.Error()) + \"<br />\"\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif board.CurrentPage == 1 {\n\t\t\t\tboardPage := path.Join(config.DocumentRoot, board.Dir, \"board.html\")\n\t\t\t\tos.Remove(boardPage)\n\t\t\t\tif err = syscall.Symlink(current_page_filepath, boardPage); !os.IsExist(err) && err != nil {\n\t\t\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/: \"+err.Error()) + \"<br />\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Collect up threads for this page.\n\t\t\tpageMap := make(map[string]interface{})\n\t\t\tpageMap[\"page\"] = board.CurrentPage\n\t\t\tpageMap[\"threads\"] = page_threads\n\t\t\tpagesArr = append(pagesArr, pageMap)\n\t\t}\n\t\tboard.CurrentPage = currentBoardPage\n\n\t\tcatalog_json, err := json.Marshal(pagesArr)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed to marshal to JSON: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\t\tif _, err = catalog_json_file.Write(catalog_json); err != nil {\n\t\t\thtml += handleError(1, \"Failed writing /\"+board.Dir+\"/catalog.json: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\t\thtml += \"/\" + board.Dir + \"/ built successfully.\\n\"\n\t}\n\tbenchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), start_time, false)\n\treturn\n}", "title": "" }, { "docid": "765e9c2c6ab2290b5657dbb65a68f68d", "score": "0.57731545", "text": "func (b *builder) buildListPages() error {\n\tb.model.\n\t\tWalkRoutes(func(r *Route) {\n\t\t\tr.ListPage = &model.ArticleListPage{\n\t\t\t\tPage: model.Page{Path: r.Path},\n\t\t\t\tArticles: make([]*model.Article, len(r.Pages)),\n\t\t\t}\n\n\t\t\tfor i, page := range r.Pages {\n\t\t\t\tr.ListPage.Articles[i] = &page.Article\n\t\t\t}\n\t\t}, -1)\n\n\treturn nil\n}", "title": "" }, { "docid": "32d0f5767b3ec0133d7671a1084ed796", "score": "0.572783", "text": "func buildThreads(all bool, boardid, threadid int) (html string) {\n\t// TODO: detect which page will be built and only build that one and the board page\n\t// if all is set to true, ignore which, otherwise, which = build only specified boardid\n\tif !all {\n\t\tthreads, _ := getPostArr(map[string]interface{}{\n\t\t\t\"boardid\": boardid,\n\t\t\t\"id\": threadid,\n\t\t\t\"parentid\": 0,\n\t\t\t\"deleted_timestamp\": nilTimestamp,\n\t\t}, \"\")\n\t\tthread := threads[0]\n\t\thtml += buildThreadPages(&thread) + \"<br />\\n\"\n\t\treturn\n\t}\n\n\tthreads, _ := getPostArr(map[string]interface{}{\n\t\t\"boardid\": boardid,\n\t\t\"parentid\": 0,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}, \"\")\n\tif len(threads) == 0 {\n\t\treturn\n\t}\n\n\tfor _, op := range threads {\n\t\thtml += buildThreadPages(&op) + \"<br />\\n\"\n\t}\n\treturn\n}", "title": "" }, { "docid": "519578bb2c584970d5ece1c81f783b6b", "score": "0.5713769", "text": "func (j *Job) GetBuilds() []Build {\n\tbuildIDs := j.GetBuildIDs()\n\tbuilds := make([]Build, 0, len(buildIDs))\n\tfor _, ID := range buildIDs {\n\t\tbuilds = append(builds, *j.NewBuild(ID))\n\t}\n\treturn builds\n}", "title": "" }, { "docid": "f5357776e2f662c36859835421459f28", "score": "0.5712068", "text": "func buildBoardPages(board *BoardsTable) (html string) {\n\tstart_time := benchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), time.Now(), true)\n\tvar current_page_file *os.File\n\tvar threads []interface{}\n\tvar thread_pages [][]interface{}\n\tvar stickied_threads []interface{}\n\tvar nonstickied_threads []interface{}\n\n\tdefer func() {\n\t\t// Recover and print, log error (if there is one)\n\t\t/* if errmsg, panicked := recover().(error); panicked {\n\t\t\thandleError(0, \"Recovered from panic: \"+errmsg.Error())\n\t\t} */\n\t}()\n\n\t// Check that the board's configured directory is indeed a directory\n\tresults, err := os.Stat(path.Join(config.DocumentRoot, board.Dir))\n\tif err != nil {\n\t\t// Try creating the board's configured directory if it doesn't exist\n\t\terr = os.Mkdir(path.Join(config.DocumentRoot, board.Dir), 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed creating /\"+board.Dir+\"/: \"+err.Error())\n\t\t\treturn\n\t\t}\n\t} else if !results.IsDir() {\n\t\t// If the file exists, but is not a folder, notify the user\n\t\thtml += handleError(1, \"Error: /\"+board.Dir+\"/ exists, but is not a folder.\")\n\t\treturn\n\t}\n\n\t// Get all top level posts for the board.\n\top_posts, err := getPostArr(map[string]interface{}{\n\t\t\"boardid\": board.ID,\n\t\t\"parentid\": 0,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}, \" ORDER BY `bumped` DESC\")\n\tif err != nil {\n\t\thtml += handleError(1, err.Error()) + \"<br />\"\n\t\top_posts = nil\n\t\treturn\n\t}\n\n\t// For each top level post, start building a Thread struct\n\tfor _, op := range op_posts {\n\t\tvar thread Thread\n\t\tvar posts_in_thread []PostTable\n\t\tthread.IName = \"thread\"\n\n\t\t// Get the number of replies to this thread.\n\t\tif err = queryRowSQL(\"SELECT COUNT(*) FROM `\"+config.DBprefix+\"posts` WHERE `boardid` = ? AND `parentid` = ? AND `deleted_timestamp` = ?\",\n\t\t\t[]interface{}{board.ID, op.ID, nilTimestamp},\n\t\t\t[]interface{}{&thread.NumReplies},\n\t\t); err != nil {\n\t\t\thtml += err.Error() + \"<br />\\n\"\n\t\t}\n\n\t\t// Get the number of image replies in this thread\n\t\tif err = queryRowSQL(\"SELECT COUNT(*) FROM `\"+config.DBprefix+\"posts` WHERE `boardid` = ? AND `parentid` = ? AND `deleted_timestamp` = ? AND `filesize` <> 0\",\n\t\t\t[]interface{}{board.ID, op.ID, nilTimestamp},\n\t\t\t[]interface{}{&thread.NumImages},\n\t\t); err != nil {\n\t\t\thtml += err.Error() + \"<br />\\n\"\n\t\t}\n\n\t\tthread.OP = op\n\n\t\tvar numRepliesOnBoardPage int\n\n\t\tif op.Stickied {\n\t\t\t// If the thread is stickied, limit replies on the archive page to the\n\t\t\t// configured value for stickied threads.\n\t\t\tnumRepliesOnBoardPage = config.StickyRepliesOnBoardPage\n\t\t} else {\n\t\t\t// Otherwise, limit the replies to the configured value for normal threads.\n\t\t\tnumRepliesOnBoardPage = config.RepliesOnBoardPage\n\t\t}\n\n\t\tposts_in_thread, err = getPostArr(map[string]interface{}{\n\t\t\t\"boardid\": board.ID,\n\t\t\t\"parentid\": op.ID,\n\t\t\t\"deleted_timestamp\": nilTimestamp,\n\t\t}, fmt.Sprintf(\" ORDER BY `id` DESC LIMIT %d\", numRepliesOnBoardPage))\n\t\tif err != nil {\n\t\t\thtml += err.Error() + \"<br />\"\n\t\t}\n\n\t\tvar reversedPosts []PostTable\n\t\tfor i := len(posts_in_thread); i > 0; i-- {\n\t\t\treversedPosts = append(reversedPosts, posts_in_thread[i-1])\n\t\t}\n\n\t\tif len(posts_in_thread) > 0 {\n\t\t\t// Store the posts to show on board page\n\t\t\t//thread.BoardReplies = posts_in_thread\n\t\t\tthread.BoardReplies = reversedPosts\n\n\t\t\t// Count number of images on board page\n\t\t\timage_count := 0\n\t\t\tfor _, reply := range posts_in_thread {\n\t\t\t\tif reply.Filesize != 0 {\n\t\t\t\t\timage_count++\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Then calculate number of omitted images.\n\t\t\tthread.OmittedImages = thread.NumImages - image_count\n\t\t}\n\n\t\t// Add thread struct to appropriate list\n\t\tif op.Stickied {\n\t\t\tstickied_threads = append(stickied_threads, thread)\n\t\t} else {\n\t\t\tnonstickied_threads = append(nonstickied_threads, thread)\n\t\t}\n\t}\n\n\tnum, _ := deleteMatchingFiles(path.Join(config.DocumentRoot, board.Dir), \"\\\\d.html$\")\n\tprintf(2, \"Number of files deleted: %d\\n\", num)\n\t// Order the threads, stickied threads first, then nonstickied threads.\n\tthreads = append(stickied_threads, nonstickied_threads...)\n\n\t// If there are no posts on the board\n\tif len(threads) == 0 {\n\t\tboard.CurrentPage = 1\n\t\t// Open board.html for writing to the first page.\n\t\tboard_page_file, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"board.html\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed opening /\"+board.Dir+\"/board.html: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\n\t\t// Render board page template to the file,\n\t\t// packaging the board/section list, threads, and board info\n\t\tif err = img_boardpage_tmpl.Execute(board_page_file, map[string]interface{}{\n\t\t\t\"config\": config,\n\t\t\t\"boards\": allBoards,\n\t\t\t\"sections\": allSections,\n\t\t\t\"threads\": threads,\n\t\t\t\"board\": board,\n\t\t}); err != nil {\n\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\n\t\thtml += \"/\" + board.Dir + \"/ built successfully, no threads to build.\\n\"\n\t\tbenchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), start_time, false)\n\t\treturn\n\t} else {\n\t\t// Create the archive pages.\n\t\tthread_pages = paginate(config.ThreadsPerPage_img, threads)\n\t\tboard.NumPages = len(thread_pages) - 1\n\n\t\t// Create array of page wrapper objects, and open the file.\n\t\tvar pages_obj []BoardPageJSON\n\n\t\tcatalog_json_file, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"catalog.json\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tdefer closeFile(catalog_json_file)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed opening /\"+board.Dir+\"/catalog.json: \"+err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcurrentBoardPage := board.CurrentPage\n\t\tfor _, page_threads := range thread_pages {\n\t\t\tboard.CurrentPage++\n\t\t\tvar current_page_filepath string\n\t\t\tpageFilename := strconv.Itoa(board.CurrentPage) + \".html\"\n\t\t\tcurrent_page_filepath = path.Join(config.DocumentRoot, board.Dir, pageFilename)\n\t\t\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\t\tdefer closeFile(current_page_file)\n\t\t\tif err != nil {\n\t\t\t\thtml += handleError(1, \"Failed opening board page: \"+err.Error()) + \"<br />\"\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Render the boardpage template, don't forget config\n\t\t\tif err = img_boardpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\t\t\"config\": config,\n\t\t\t\t\"boards\": allBoards,\n\t\t\t\t\"sections\": allSections,\n\t\t\t\t\"threads\": page_threads,\n\t\t\t\t\"board\": board,\n\t\t\t\t\"posts\": []interface{}{\n\t\t\t\t\tPostTable{BoardID: board.ID},\n\t\t\t\t},\n\t\t\t}); err != nil {\n\t\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/ boardpage: \"+err.Error()) + \"<br />\"\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif board.CurrentPage == 1 {\n\t\t\t\tboardPage := path.Join(config.DocumentRoot, board.Dir, \"board.html\")\n\t\t\t\tos.Remove(boardPage)\n\t\t\t\tif err = syscall.Symlink(current_page_filepath, boardPage); !os.IsExist(err) && err != nil {\n\t\t\t\t\thtml += handleError(1, \"Failed building /\"+board.Dir+\"/: \"+err.Error()) + \"<br />\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Collect up threads for this page.\n\t\t\tvar page_obj BoardPageJSON\n\t\t\tpage_obj.Page = board.CurrentPage\n\n\t\t\tfor _, thread_int := range page_threads {\n\t\t\t\tthread := thread_int.(Thread)\n\t\t\t\tpost_json := makePostJSON(thread.OP, board.Anonymous)\n\t\t\t\tvar thread_json ThreadJSON\n\t\t\t\tthread_json.PostJSON = &post_json\n\t\t\t\tthread_json.Replies = thread.NumReplies\n\t\t\t\tthread_json.ImagesOnArchive = thread.NumImages\n\t\t\t\tthread_json.OmittedImages = thread.OmittedImages\n\t\t\t\tif thread.Stickied {\n\t\t\t\t\tif thread.NumReplies > config.StickyRepliesOnBoardPage {\n\t\t\t\t\t\tthread_json.OmittedPosts = thread.NumReplies - config.StickyRepliesOnBoardPage\n\t\t\t\t\t}\n\t\t\t\t\tthread_json.Sticky = 1\n\t\t\t\t} else {\n\t\t\t\t\tif thread.NumReplies > config.RepliesOnBoardPage {\n\t\t\t\t\t\tthread_json.OmittedPosts = thread.NumReplies - config.RepliesOnBoardPage\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif thread.OP.Locked {\n\t\t\t\t\tthread_json.Locked = 1\n\t\t\t\t}\n\t\t\t\tpage_obj.Threads = append(page_obj.Threads, thread_json)\n\t\t\t}\n\n\t\t\tpages_obj = append(pages_obj, page_obj)\n\t\t}\n\t\tboard.CurrentPage = currentBoardPage\n\n\t\tcatalog_json, err := json.Marshal(pages_obj)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed to marshal to JSON: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\t\tif _, err = catalog_json_file.Write(catalog_json); err != nil {\n\t\t\thtml += handleError(1, \"Failed writing /\"+board.Dir+\"/catalog.json: \"+err.Error()) + \"<br />\"\n\t\t\treturn\n\t\t}\n\t\thtml += \"/\" + board.Dir + \"/ built successfully.\\n\"\n\t}\n\tbenchmarkTimer(\"buildBoard\"+strconv.Itoa(board.ID), start_time, false)\n\treturn\n}", "title": "" }, { "docid": "b0fab5f9ebcbebe6b8c9a00174021dd6", "score": "0.57070243", "text": "func (c *Client) SelectBuildTypeBuilds(selector string) (*Builds, error) {\n\tv := &Builds{}\n\tif err := c.doRequest(\"GET\", path.Join(buildTypesPath, selector, buildsPath), \"\", nil, v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "0c6fa56936ffa219eee22b1ba5139698", "score": "0.56627566", "text": "func PageBuildHandler(name string, hndl func(context.Context, *github.PageBuildEvent) error) {\n\tpageBuildHandlers[name] = hndl\n}", "title": "" }, { "docid": "ac89d39da8ef582baa1f54ba3fd477a7", "score": "0.5657585", "text": "func (g *PagesService) PageBuildLatest(uri *Hyperlink, uriParams M) (build *PageBuild,\n\tresult *Result) {\n\turl, err := ExpandWithDefault(uri, &PagesLatestBuildURL, uriParams)\n\tif err != nil {\n\t\treturn nil, &Result{Err: err}\n\t}\n\tresult = g.client.get(url, &build)\n\treturn\n}", "title": "" }, { "docid": "542c338d2c2996af6d8dbccd9ee783dd", "score": "0.5620789", "text": "func (s *Service) LastBuilds(w http.ResponseWriter, req *http.Request) {\n\tbuilds, err := s.r.ListGetLastElements(\"all-builds\", 10)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlastBuilds := make([]qfarm.Report, 0)\n\tfor _, b := range builds {\n\t\tvar single qfarm.Report\n\t\tif err := json.Unmarshal(b, &single); err != nil {\n\t\t\twriteErrJSON(w, err, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tlastBuilds = append(lastBuilds, single)\n\t}\n\n\tfor i, j := 0, len(lastBuilds)-1; i < j; i, j = i+1, j-1 {\n\t\tlastBuilds[i], lastBuilds[j] = lastBuilds[j], lastBuilds[i]\n\t}\n\n\tif err := writeJSON(w, lastBuilds); err != nil {\n\t\twriteErrJSON(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "67978b5cfdf753e52f2711ed91720371", "score": "0.559035", "text": "func BuildAll(w http.ResponseWriter, r *http.Request) {\n\tc := appengine.NewContext(r)\n\n\tif u := user.Current(c); u != nil {\n\t}\n\n\toffset := r.Header.Get(\"Offset\")\n\tlimit := r.Header.Get(\"Limit\")\n\n\tq := datastore.NewQuery(\"Building\")\n\tq = q.Order(\"Address.Street\")\n\tq = q.Order(\"Address.StreetNumber\")\n\tq = q.Order(\"Address.Area\")\n\n\ti, err := strconv.ParseInt(offset, 10, 32)\n\tif err == nil {\n\t\tq = q.Offset(int(i))\n\t}\n\ti, err = strconv.ParseInt(limit, 10, 32)\n\tif err == nil {\n\t\tq = q.Limit(int(i))\n\t}\n\n\tresult := []Building{}\n\n\tkeys, err := q.GetAll(c, &result)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tfor i := 0; i < len(result); i++ {\n\t\tresult[i].Id = keys[i].IntID()\n\t}\n\n\tjsonResponse(result, w)\n}", "title": "" }, { "docid": "c69e89293a1b2d352cc4284258af6d18", "score": "0.5583215", "text": "func (c *Client) ListRecentBuilds(limit, offset int) ([]*Build, error) {\n\treturn c.recentBuilds(\"recent-builds\", nil, limit, offset)\n}", "title": "" }, { "docid": "59da40ac5fde59b19677a52b28f481c5", "score": "0.557196", "text": "func (c *Client) Search(url string) ([]*Build, error) {\n\trv := []*Build{}\n\tcursor := \"\"\n\tfor {\n\t\tnewUrl := url\n\t\tif cursor != \"\" {\n\t\t\tnewUrl += fmt.Sprintf(\"&start_cursor=%s\", cursor)\n\t\t}\n\t\tvar builds []*Build\n\t\tvar err error\n\t\tbuilds, cursor, err = c.getOnePage(newUrl)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trv = append(rv, builds...)\n\t\tif cursor == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "4d380fb779fac358858f2d1a07d480c7", "score": "0.55657077", "text": "func (c *Client) SelectBuilds(selector string) (*Builds, error) {\n\tv := &Builds{}\n\tpath := buildsPath + locatorParamKey + selector\n\tif err := c.doRequest(\"GET\", path, \"\", nil, v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "c565a5fdb98f87882052d71c92863215", "score": "0.5549597", "text": "func GetBuildings(c *gin.Context) {\n\toffset := query.ParseInt(c.Query(\"offset\"), 0, math.MaxInt32, 0)\n\tlimit := query.ParseInt(c.Query(\"limit\"), 1, config.TopLimit, config.DefaultLimit)\n\n\tdata := query.AutoQuery(\n\t\tdatabase.DB.BuildingsData,\n\t\tc.Request.URL.Query(),\n\t\tlimit,\n\t\toffset,\n\t)\n\n\tres, _ := json.Marshal(data)\n\tvar buildings []database.Building\n\tjson.Unmarshal(res, &buildings)\n\tif len(buildings) == 0 {\n\t\tresponse.SendEmptySuccess(c)\n\t} else {\n\t\tresponse.SendSuccess(c, buildings)\n\t}\n}", "title": "" }, { "docid": "90b5c427725f2d08c3d9472fab064c70", "score": "0.553982", "text": "func (c *ApiController) GetSearchBuilds() {\n\tlog.Info(\"Get search builds\")\n\n\tresult := \"Not implemented\"\n\tc.Ctx.WriteString(result)\n}", "title": "" }, { "docid": "d1c391f7188263677b960b6a10156a6a", "score": "0.55085975", "text": "func (c *Client) ListBuilds(ctx context.Context, req *cloudbuildpb.ListBuildsRequest, opts ...gax.CallOption) *BuildIterator {\n\treturn c.internalClient.ListBuilds(ctx, req, opts...)\n}", "title": "" }, { "docid": "471fa088c21ed8802059d0b3aa2c4df5", "score": "0.54996705", "text": "func (a *androidCommits) findCommitsPage(branch, target, endBuildID string, ret map[string]*vcsinfo.ShortCommit, pageToken string) (string, error) {\n\t// We explicitly don't use exponential backoff since that increases the\n\t// likelihood of getting a bad response.\n\tfor i := 0; i < NUM_RETRIES; i++ {\n\t\tsklog.Infof(\"Querying for %q %q %q\", branch, target, endBuildID)\n\t\trequest := a.service.Build.List().Successful(true).BuildType(\"submitted\").Branch(branch).Target(target).ExtraFields(\"changeInfo\").MaxResults(PAGE_SIZE)\n\t\tif pageToken != \"\" {\n\t\t\trequest.PageToken(pageToken)\n\t\t}\n\t\tif endBuildID != \"\" {\n\t\t\trequest.EndBuildId(endBuildID)\n\t\t}\n\t\tresp, err := request.Do()\n\t\tif err != nil {\n\t\t\tsklog.Infof(\"Call failed: %s\", err)\n\t\t\ttime.Sleep(SLEEP_DURATION * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tif len(resp.Builds) == 0 {\n\t\t\tsklog.Infof(\"No builds in response.\")\n\t\t\ttime.Sleep(SLEEP_DURATION * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tif len(resp.Builds[0].Changes) == 0 {\n\t\t\tsklog.Infof(\"No Changes in builds.\")\n\t\t\ttime.Sleep(SLEEP_DURATION * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tsklog.Infof(\"Success after %d attempts.\", i+1)\n\n\t\tfor _, buildInfo := range resp.Builds {\n\t\t\tsklog.Infof(\"BuildID: %s : %s\", buildInfo.BuildId, buildInfo.Target.Name)\n\t\t}\n\n\t\tfor _, build := range resp.Builds {\n\t\t\tfor _, change := range CommitsFromChanges(build.Changes) {\n\t\t\t\tret[build.BuildId] = change\n\t\t\t}\n\t\t}\n\t\treturn resp.NextPageToken, nil\n\t}\n\treturn \"\", fmt.Errorf(\"No valid responses from API after %d requests.\", NUM_RETRIES)\n}", "title": "" }, { "docid": "569ea3955c34b709e3711d6251052ed5", "score": "0.5497055", "text": "func (client StaticSitesClient) GetStaticSiteBuilds(ctx context.Context, resourceGroupName string, name string) (result StaticSiteBuildCollectionPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StaticSitesClient.GetStaticSiteBuilds\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ssbc.Response.Response != nil {\n\t\t\t\tsc = result.ssbc.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+[^\\.]$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"web.StaticSitesClient\", \"GetStaticSiteBuilds\", err.Error())\n\t}\n\n\tresult.fn = client.getStaticSiteBuildsNextResults\n\treq, err := client.GetStaticSiteBuildsPreparer(ctx, resourceGroupName, name)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.StaticSitesClient\", \"GetStaticSiteBuilds\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetStaticSiteBuildsSender(req)\n\tif err != nil {\n\t\tresult.ssbc.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"web.StaticSitesClient\", \"GetStaticSiteBuilds\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ssbc, err = client.GetStaticSiteBuildsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.StaticSitesClient\", \"GetStaticSiteBuilds\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ssbc.hasNextLink() && result.ssbc.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0dfdbf5bf30dbb38e19d35e0944792a8", "score": "0.5459073", "text": "func buildThreads(all bool, boardid, threadid int) (html string) {\n\tvar threads []Post\n\tvar err error\n\n\tqueryMap := map[string]interface{}{\n\t\t\"boardid\": boardid,\n\t\t\"parentid\": 0,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}\n\tif !all {\n\t\tqueryMap[\"id\"] = threadid\n\t}\n\tif threads, err = getPostArr(queryMap, \"\"); err != nil {\n\t\treturn handleError(0, err.Error()) + \"<br />\\n\"\n\t}\n\tif len(threads) == 0 {\n\t\treturn \"No threads to build<br />\\n\"\n\t}\n\n\tfor _, op := range threads {\n\t\thtml += buildThreadPages(&op) + \"<br />\\n\"\n\t}\n\treturn\n}", "title": "" }, { "docid": "c516adbec146624300ca2203f4c95374", "score": "0.5423321", "text": "func buildBoards(all bool, which int) (html string) {\n\t// if all is set to true, ignore which, otherwise, which = build only specified boardid\n\tif !all {\n\t\tboardArr, _ := getBoardArr(map[string]interface{}{\"id\": which}, \"\")\n\t\tboard := boardArr[0]\n\t\thtml += buildBoardPages(&board) + \"<br />\\n\"\n\t\thtml += buildThreads(true, board.ID, 0)\n\t\treturn\n\t}\n\tboards, _ := getBoardArr(nil, \"\")\n\tif len(boards) == 0 {\n\t\treturn html + \"No boards to build.<br />\\n\"\n\t}\n\n\tfor _, board := range boards {\n\t\thtml += buildBoardPages(&board) + \"<br />\\n\"\n\t\thtml += buildThreads(true, board.ID, 0)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8af439a4deef10b16be91252f802393", "score": "0.5399461", "text": "func getBuilds(tx *bolt.Tx, ids []BuildID, stop <-chan struct{}) ([]*Build, error) {\n\trv := make([]*Build, 0, len(ids))\n\tfor _, id := range ids {\n\t\tif err := checkInterrupt(stop); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb, err := getBuild(tx, id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := checkInterrupt(stop); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trv = append(rv, b)\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "77006ed74a2c75948e0d911b220e2674", "score": "0.5391553", "text": "func (p *Builder) Build() (*Page, error) {\n\terr := p.pageable.Check()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Pageable error,err=%s\", err)\n\t}\n\tp.page.PageIndex = p.pageable.PageIndex\n\tp.page.PageSize = p.pageable.PageSize\n\n\tsc := p.session.Clone()\n\tif reflect.TypeOf(p.page.Data).Elem().Kind() != reflect.Slice {\n\t\treturn nil, fmt.Errorf(\"Data() parameter must be a slice pointer,not %v\", reflect.TypeOf(p.page.Data))\n\t}\n\tLogger().Debugf(\"type: %+v\\n\", reflect.TypeOf(p.page.Data))\n\tLogger().Debugf(\"type: %+v\\n\", reflect.TypeOf(p.page.Data).Elem().Elem())\n\telementType := reflect.TypeOf(p.page.Data).Elem().Elem()\n\telement := reflect.New(elementType)\n\tcount, err := sc.Count(element.Interface())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Get count failed,err=%s\", err)\n\t}\n\n\tp.total(count)\n\tLogger().Debugf(\"limit: %d,%d\", p.pageable.PageSize, p.pageable.offset())\n\terr = p.session.Limit(p.pageable.PageSize, p.pageable.offset()).Find(p.page.Data)\n\tif err != nil {\n\t\tLogger().Debug(err)\n\t\treturn nil, err\n\t}\n\n\tLogger().Debugf(\"DATA :%+v\\n\", p.page.Data)\n\tLogger().Debugf(\"index:%d,size:%d\\n\", p.pageable.PageIndex, p.pageable.PageSize)\n\n\tif p.page.Total%int64(p.page.PageSize) == 0 {\n\t\tp.page.Pages = p.page.Total / int64(p.page.PageSize)\n\t} else {\n\t\tp.page.Pages = p.page.Total/int64(p.page.PageSize) + 1\n\t}\n\tdefer p.session.Close()\n\treturn &(p.page), nil\n}", "title": "" }, { "docid": "b2ec2b06484a476a8eba8c7b4ab94e2f", "score": "0.53513914", "text": "func (d *DB) RefBuilds(t BuildType, ref string, start, end int) ([]Build, error) {\n\terr := validate(start, end)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif start == end {\n\t\treturn nil, nil\n\t}\n\n\tids, err := d.refBuilds(t, ref, start, end)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.idsToBuilds(ids)\n}", "title": "" }, { "docid": "5646bdb68812db17126d36a965217e6e", "score": "0.5350858", "text": "func buildBoards(which ...int) (html string) {\n\tvar boards []Board\n\n\tif which == nil {\n\t\tboards = allBoards\n\t} else {\n\t\tfor _, b := range which {\n\t\t\tboard, err := getBoardFromID(b)\n\t\t\tif err != nil {\n\t\t\t\thtml += handleError(0, err.Error()) + \"<br />\\n\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tboards = append(boards, *board)\n\t\t}\n\t}\n\n\tif len(boards) == 0 {\n\t\treturn html + \"No boards to build.<br />\\n\"\n\t}\n\tfor _, board := range boards {\n\t\tboardPath := path.Join(config.DocumentRoot, board.Dir)\n\t\tif _, err := os.Stat(boardPath); err != nil {\n\t\t\t// Board was most likely just recently created\n\t\t\tif err = os.Mkdir(boardPath, 0666); err != nil {\n\t\t\t\thtml += handleError(0, \"Error creating board directory: %s\\n\", err.Error()) + \"<br />\\n\"\n\t\t\t}\n\t\t}\n\n\t\tif board.EnableCatalog {\n\t\t\thtml += buildCatalog(board.ID) + \"<br />\\n\"\n\t\t}\n\t\thtml += buildBoardPages(&board) + \"<br />\\n\" +\n\t\t\tbuildThreads(true, board.ID, 0) + \"<br />\\n\"\n\t}\n\treturn\n}", "title": "" }, { "docid": "40126d9b8a675d8457bbc609e1fd7575", "score": "0.5323848", "text": "func GetBuilds(c context.Context, q Query) (*QueryResult, error) {\n\tswitch {\n\tcase q.Master == \"\":\n\t\treturn nil, errors.New(\"master is required\")\n\tcase q.Builder == \"\":\n\t\treturn nil, errors.New(\"builder is required\")\n\t}\n\treturn getDatastoreBuilds(c, q, true)\n}", "title": "" }, { "docid": "58b6cfc135897834272749ad4f94e16f", "score": "0.5321185", "text": "func getCBBuildsWithFilter(start, end time.Time, projectID string) ([]*build, error) {\n\tctx := context.Background()\n\tcloudbuildService, err := cloudbuild.NewService(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating cloudbuild service: %v\", err)\n\t}\n\n\tfilter := fmt.Sprintf(\"create_time>=\\\"%s\\\" AND create_time<\\\"%s\\\"\", formatTimeCB(start), formatTimeCB(end))\n\tc, err := cloudbuildService.Projects.Builds.List(projectID).Filter(filter).Do()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing builds with filter %s in project %s: %v\", filter, projectID, err)\n\t}\n\tcbBuilds := c.Builds\n\tif len(cbBuilds) < 1 {\n\t\treturn nil, fmt.Errorf(\"no builds found with filter %s in project %s\", filter, projectID)\n\t}\n\n\tfor {\n\t\tc, err = cloudbuildService.Projects.Builds.List(projectID).Filter(filter).PageToken(c.NextPageToken).Do()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error retriving next page with token %s: %v\", c.NextPageToken, err)\n\t\t}\n\t\tcbBuilds = append(cbBuilds, c.Builds...)\n\t\tif c.NextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tbuilds := []*build{}\n\tfor _, b := range cbBuilds {\n\t\t// filter out builds not triggered from source repos\n\t\tcommit, commitExists := b.Substitutions[\"COMMIT_SHA\"]\n\t\tif !commitExists {\n\t\t\tcontinue\n\t\t}\n\t\trepoName, repoNameExists := b.Substitutions[\"REPO_NAME\"]\n\t\tif !repoNameExists {\n\t\t\tcontinue\n\t\t}\n\t\ttriggerName, triggerNameExists := b.Substitutions[\"TRIGGER_NAME\"]\n\t\tif !triggerNameExists {\n\t\t\tcontinue\n\t\t}\n\t\tbuilds = append(builds, &build{commitSHA: commit, repoName: repoName, jobName: triggerName, id: b.Id, status: b.Status})\n\t}\n\treturn builds, nil\n}", "title": "" }, { "docid": "f6b51b831038b91a74dd37dc7045f0f2", "score": "0.5296807", "text": "func ExampleBuildServiceClient_NewListBuildResultsPager() {\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 := armappplatform.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewBuildServiceClient().NewListBuildResultsPager(\"myResourceGroup\", \"myservice\", \"default\", \"mybuild\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.BuildResultCollection = armappplatform.BuildResultCollection{\n\t\t// \tValue: []*armappplatform.BuildResult{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"123\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AppPlatform/Spring/buildServices/builds/results\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.AppPlatform/Spring/myservice/buildServices/default/builds/mybuild/results/123\"),\n\t\t// \t\t\tSystemData: &armappplatform.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:16:03.944Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"sample-user\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armappplatform.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-08-11T03:17:03.944Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"sample-user\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armappplatform.LastModifiedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armappplatform.BuildResultProperties{\n\t\t// \t\t\t\tName: to.Ptr(\"123\"),\n\t\t// \t\t\t\tBuildPodName: to.Ptr(\"mybuild-default-1\"),\n\t\t// \t\t\t\tBuildStages: []*armappplatform.BuildStageProperties{\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"prepare\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"0\"),\n\t\t// \t\t\t\t\t\tReason: to.Ptr(\"Completed\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"detect\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"0\"),\n\t\t// \t\t\t\t\t\tReason: to.Ptr(\"Completed\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"analyze\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"0\"),\n\t\t// \t\t\t\t\t\tReason: to.Ptr(\"Completed\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"restore\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"0\"),\n\t\t// \t\t\t\t\t\tReason: to.Ptr(\"Completed\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateSucceeded),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"build\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"51\"),\n\t\t// \t\t\t\t\t\tReason: to.Ptr(\"Error\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateFailed),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\t{\n\t\t// \t\t\t\t\t\tName: to.Ptr(\"export\"),\n\t\t// \t\t\t\t\t\tExitCode: to.Ptr(\"-1\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armappplatform.KPackBuildStageProvisioningStateNotStarted),\n\t\t// \t\t\t\t}},\n\t\t// \t\t\t\tError: &armappplatform.Error{\n\t\t// \t\t\t\t\tCode: to.Ptr(\"51\"),\n\t\t// \t\t\t\t\tMessage: to.Ptr(\"Build failed in stage build with reason OOMKilled, please refer to https://aka.ms/buildexitcode\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armappplatform.BuildResultProvisioningStateSucceeded),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "f17d0c0fb7850f3cf4813e09205e6123", "score": "0.52942187", "text": "func (s *Service) LastRepoBuilds(w http.ResponseWriter, req *http.Request) {\n\trepo := req.URL.Query().Get(\"repo\")\n\tif repo == \"\" {\n\t\twriteErrJSON(w, errors.New(\"Repo should be set!\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tbuilds, err := s.r.ListGetLastElements(\"builds:\"+repo, 10)\n\tif err != nil {\n\t\twriteErrJSON(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlastBuilds := make([]qfarm.Report, 0)\n\tfor _, b := range builds {\n\t\tvar single qfarm.Report\n\t\tif err := json.Unmarshal(b, &single); err != nil {\n\t\t\twriteErrJSON(w, err, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tlastBuilds = append(lastBuilds, single)\n\t}\n\n\tfor i, j := 0, len(lastBuilds)-1; i < j; i, j = i+1, j-1 {\n\t\tlastBuilds[i], lastBuilds[j] = lastBuilds[j], lastBuilds[i]\n\t}\n\n\tif err := writeJSON(w, lastBuilds); err != nil {\n\t\twriteErrJSON(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "13328926a8f23789a098869374ba4090", "score": "0.5291492", "text": "func GetBranchHistory(db database.Querier, projectKey, appName string, page, nbPerPage int) ([]sdk.PipelineBuild, error) {\n\tpbs := []sdk.PipelineBuild{}\n\n\tif page < 1 {\n\t\tpage = 1\n\t}\n\toffset := nbPerPage * (page - 1)\n\tquery := `\n\t\tWITH lastestBuild AS (\n\t\t\t(\n\t\t\t\tSELECT\n\t\t\t\t\tpb.application_id, pb.pipeline_id, pb.environment_id,\n\t\t\t\t\tappName, pipName, envName,\n\t\t\t\t\tpb.start, pb.done, pb.status, pb.version, pb.build_number,\n\t\t\t\t\tpb.manual_trigger, pb.triggered_by, pb.vcs_changes_branch, pb.vcs_changes_hash, pb.vcs_changes_author\n\t\t\t\tFROM\n\t\t\t\t\tpipeline_build pb\n\t\t\t\tJOIN (\n\t\t\t\t\tSELECT distinct(pipeline_id, environment_id, vcs_changes_branch) record, pipeline_id, environment_id, vcs_changes_branch, max(start) as start,\n\t\t\t\t\t\tapplication_id, application.name as appName, pipeline.name as pipName, environment.name as envName\n\t\t\t\t\tFROM pipeline_build\n\t\t\t\t\tJOIN application ON application.id = application_id\n\t\t\t\t\tJOIN pipeline ON pipeline.id = pipeline_id\n\t\t\t\t\tJOIN project ON project.id = application.project_id AND project.id = pipeline.project_id\n\t\t\t\t\tJOIN environment ON environment.id = environment_id AND\n\t\t\t\t\t(\n\t\t\t\t\t\tenvironment.project_id is NULL\n\t\t\t\t\t\tOR\n\t\t\t\t\t\tenvironment.project_id = project.id\n\t\t\t\t\t)\n\t\t\t\t\tWHERE vcs_changes_branch != ''\n\t\t\t\t\t\tAND vcs_changes_branch IS NOT NULL\n\t\t\t\t\t\tAND project.projectkey= $1\n\t\t\t\t\t\tAND application.name = $2\n\t\t\t\t\t\tAND pipeline.type = 'build'\n\t\t\t\t\tGROUP by pipeline_id, environment_id, application_id, vcs_changes_branch, appName, pipName, envName\n\t\t\t\t\tORDER BY start DESC\n\t\t\t\t) hh ON hh.pipeline_id = pb.pipeline_id AND hh.application_id =pb.application_id AND hh.environment_id = pb.environment_id AND hh.start = pb.start\n\t\t\t)\n\t\t\tUNION ALL\n\t\t\t(\n\t\t\t\tSELECT\n\t\t\t\t\tph.application_id, ph.pipeline_id, ph.environment_id,\n\t\t\t\t\tappName, pipName, envName,\n\t\t\t\t\tph.start, ph.done, ph.status, ph.version, ph.build_number,\n\t\t\t\t\tph.manual_trigger, ph.triggered_by, ph.vcs_changes_branch, ph.vcs_changes_hash, ph.vcs_changes_author\n\t\t\t\tFROM\n\t\t\t\t\tpipeline_history ph\n\t\t\t\tJOIN (\n\t\t\t\t\tSELECT distinct(pipeline_id, environment_id, vcs_changes_branch) record, pipeline_id, environment_id, vcs_changes_branch, max(start) as start,\n\t\t\t\t\t\tapplication_id, application.name as appName, pipeline.name as pipName, environment.name as envName\n\t\t\t\t\tFROM pipeline_history\n\t\t\t\t\tJOIN application ON application.id = application_id\n\t\t\t\t\tJOIN pipeline ON pipeline.id = pipeline_id\n\t\t\t\t\tJOIN project ON project.id = application.project_id AND project.id = pipeline.project_id\n\t\t\t\t\tJOIN environment ON environment.id = environment_id AND\n\t\t\t\t\t(\n\t\t\t\t\t\tenvironment.project_id is NULL\n\t\t\t\t\t\tOR\n\t\t\t\t\t\tenvironment.project_id = project.id\n\t\t\t\t\t)\n\t\t\t\t\tWHERE vcs_changes_branch != ''\n\t\t\t\t\t\tAND vcs_changes_branch IS NOT NULL\n\t\t\t\t\t\tAND project.projectkey= $1\n\t\t\t\t\t\tAND application.name = $2\n\t\t\t\t\t\tAND pipeline.type = 'build'\n\t\t\t\t\tGROUP by pipeline_id, environment_id, application_id, vcs_changes_branch, appName, pipName, envName\n\t\t\t\t\tORDER BY start DESC\n\t\t\t\t) hh ON hh.pipeline_id = ph.pipeline_id AND hh.application_id = ph.application_id AND hh.environment_id = ph.environment_id AND hh.start = ph.start\n\t\t\t)\n\t\t)\n\t\tSELECT\n\t\t\tlastestBuild.pipeline_id, lastestBuild.application_id, lastestBuild.environment_id,\n\t\t\tlastestBuild.appName, lastestBuild.pipName, lastestBuild.envName,\n\t\t\tlastestBuild.start, lastestBuild.done, lastestBuild.status, lastestBuild.version, lastestBuild.build_number,\n\t\t\tlastestBuild.manual_trigger, \"user\".username, lastestBuild.vcs_changes_branch, lastestBuild.vcs_changes_hash, lastestBuild.vcs_changes_author\n\t\tFROM lastestBuild\n\t\tJOIN (\n\t\t\tSELECT max(start) as start , application_id, pipeline_id, environment_id ,vcs_changes_branch\n\t\t\tFROM lastestBuild\n\t\t\tGROUP BY application_id, pipeline_id, environment_id ,vcs_changes_branch\n\t\t) m ON\n\t\t\tm.start = lastestBuild.start AND\n\t\t\tm.application_id = lastestBuild.application_id AND\n\t\t\tm.pipeline_id = lastestBuild.pipeline_id AND\n\t\t\tm.environment_id = lastestBuild.environment_id AND\n\t\t\tm.vcs_changes_branch = lastestBuild.vcs_changes_branch\n\t\tLEFT JOIN \"user\" ON \"user\".id = lastestBuild.triggered_by\n\t\tORDER by lastestBuild.start DESC\n\t\tOFFSET $3\n\t\tLIMIT $4\n\t`\n\trows, err := db.Query(query, projectKey, appName, offset, nbPerPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar pb sdk.PipelineBuild\n\t\tvar status string\n\t\tvar user sdk.User\n\t\tvar manual sql.NullBool\n\t\tvar hash, author, username sql.NullString\n\n\t\terr = rows.Scan(&pb.Pipeline.ID, &pb.Application.ID, &pb.Environment.ID,\n\t\t\t&pb.Application.Name, &pb.Pipeline.Name, &pb.Environment.Name,\n\t\t\t&pb.Start, &pb.Done, &status, &pb.Version, &pb.BuildNumber,\n\t\t\t&manual, &username, &pb.Trigger.VCSChangesBranch, &hash, &author,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif username.Valid {\n\t\t\tuser.Username = username.String\n\t\t}\n\t\tpb.Trigger.TriggeredBy = &user\n\n\t\tpb.Status = sdk.StatusFromString(status)\n\n\t\tif manual.Valid {\n\t\t\tpb.Trigger.ManualTrigger = manual.Bool\n\t\t}\n\t\tif hash.Valid {\n\t\t\tpb.Trigger.VCSChangesHash = hash.String\n\t\t}\n\t\tif author.Valid {\n\t\t\tpb.Trigger.VCSChangesAuthor = author.String\n\t\t}\n\t\tpbs = append(pbs, pb)\n\t}\n\treturn pbs, nil\n}", "title": "" }, { "docid": "b54534e73635af0c6270773ede0a9022", "score": "0.5275915", "text": "func buildThreadPages(op *PostTable) (html string) {\n\tvar replies []PostTable\n\tvar current_page_file *os.File\n\tboard, err := getBoardFromID(op.BoardID)\n\tif err != nil {\n\t\thtml += handleError(1, err.Error())\n\t}\n\n\treplies, err = getPostArr(map[string]interface{}{\n\t\t\"boardid\": op.BoardID,\n\t\t\"parentid\": op.ID,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}, \"ORDER BY `id` ASC\")\n\tif err != nil {\n\t\thtml += handleError(1, \"Error building thread \"+strconv.Itoa(op.ID)+\":\"+err.Error())\n\t\treturn\n\t}\n\tos.Remove(path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".html\"))\n\n\tvar repliesInterface []interface{}\n\tfor _, reply := range replies {\n\t\trepliesInterface = append(repliesInterface, reply)\n\t}\n\n\t//thread_pages := paginate(config.PostsPerThreadPage, replies)\n\tthread_pages := paginate(config.PostsPerThreadPage, repliesInterface)\n\tdeleteMatchingFiles(path.Join(config.DocumentRoot, board.Dir, \"res\"), \"^\"+strconv.Itoa(op.ID)+\"p\")\n\n\top.NumPages = len(thread_pages)\n\n\tcurrent_page_filepath := path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".html\")\n\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed opening \"+current_page_filepath+\": \"+err.Error())\n\t\treturn\n\t}\n\t// render main page\n\tif err = img_threadpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\"config\": config,\n\t\t\"boards\": allBoards,\n\t\t\"board\": board,\n\t\t\"sections\": allSections,\n\t\t\"posts\": replies,\n\t\t\"op\": op,\n\t}); err != nil {\n\t\thtml += handleError(1, \"Failed building /%s/res/%d threadpage: \", board.Dir, op.ID, err.Error()) + \"<br />\\n\"\n\t\treturn\n\t}\n\n\t// Put together the thread JSON\n\tthreadJSONFile, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".json\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\tdefer closeFile(threadJSONFile)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed opening /%s/res/%d.json: %s\", board.Dir, op.ID, err.Error())\n\t\treturn\n\t}\n\n\t// Create the wrapper object\n\tthread_json_wrapper := new(ThreadJSONWrapper)\n\n\t// Handle the OP, of type *PostTable\n\top_post_obj := makePostJSON(*op, board.Anonymous)\n\tthread_json_wrapper.Posts = append(thread_json_wrapper.Posts, op_post_obj)\n\n\t// Iterate through each reply, which are of type PostTable\n\tfor _, reply := range replies {\n\t\tpostJSON := makePostJSON(reply, board.Anonymous)\n\t\tthread_json_wrapper.Posts = append(thread_json_wrapper.Posts, postJSON)\n\t}\n\tthreadJSON, err := json.Marshal(thread_json_wrapper)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed to marshal to JSON: %s\", err.Error()) + \"<br />\"\n\t\treturn\n\t}\n\n\tif _, err = threadJSONFile.Write(threadJSON); err != nil {\n\t\thtml += handleError(1, \"Failed writing /%s/res/%d.json: %s\", board.Dir, op.ID, err.Error()) + \"<br />\"\n\t\treturn\n\t}\n\n\tsuccess_text := fmt.Sprintf(\"Built /%s/%d successfully\", board.Dir, op.ID)\n\thtml += success_text + \"<br />\\n\"\n\tprintln(2, success_text)\n\n\tfor page_num, page_posts := range thread_pages {\n\t\top.CurrentPage = page_num + 1\n\t\tcurrent_page_filepath := path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\"p\"+strconv.Itoa(op.CurrentPage)+\".html\")\n\t\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"Failed opening \"+current_page_filepath+\": \"+err.Error()) + \"<br />\\n\"\n\t\t\treturn\n\t\t}\n\n\t\tif err = img_threadpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\t\"config\": config,\n\t\t\t\"boards\": allBoards,\n\t\t\t\"board\": board,\n\t\t\t\"sections\": allSections,\n\t\t\t\"posts\": page_posts,\n\t\t\t\"op\": op,\n\t\t}); err != nil {\n\t\t\thtml += handleError(1, \"Failed building /%s/%d: %s\", board.Dir, op.ID, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tsuccess_text := fmt.Sprintf(\"Built /%s/%dp%d successfully\", board.Dir, op.ID, op.CurrentPage)\n\t\thtml += success_text + \"<br />\\n\"\n\t\tprintln(2, success_text)\n\t}\n\treturn\n}", "title": "" }, { "docid": "434ee4c8e2724c02aa0333c820a6a3d6", "score": "0.5268762", "text": "func (c *ApiController) GetActiveBuilds() {\n\t// TODO(tobe): this is not implemented because nobody uses it yet.\n\tlog.Info(\"Get active builds\")\n\n\tresult := \"Not implemented\"\n\tc.Ctx.WriteString(result)\n}", "title": "" }, { "docid": "377668f4e5b4fffca14b8c93ff61d061", "score": "0.52644235", "text": "func (js *JobsService) ListByBuild(ctx context.Context, buildId uint) ([]Job, *http.Response, error) {\n\tu, err := urlWithOptions(fmt.Sprintf(\"/build/%d/jobs\", buildId), nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := js.client.NewRequest(http.MethodGet, u, nil, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar getJobsResponse getJobsResponse\n\tresp, err := js.client.Do(ctx, req, &getJobsResponse)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn getJobsResponse.Jobs, resp, err\n}", "title": "" }, { "docid": "5bd71305bb43ac9b62c3b4a000dbb929", "score": "0.52623725", "text": "func (c *ApiController) GetBuildLogsAll() {\n\tlog.Info(\"Get all build logs\")\n\n\t//buildId := c.GetString(\":buildId\")\n\t//field := 0\n\t//result := redisutil.HgetString(buildId, field)\n\t//c.Ctx.WriteString(result)\n\n\t// TODO(tobe): change to hgetall from redis\n\tmystruct := `{0: \"apt-get install\", 1: \"go test\"}`\n\n\tc.Data[\"json\"] = &mystruct\n\tc.ServeJson()\n}", "title": "" }, { "docid": "fbd4ea40fae38688ca6336e7e9b0c7c7", "score": "0.5254931", "text": "func buildThreadPages(op *Post) (html string) {\n\terr := initTemplates(\"threadpage\")\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\tvar replies []Post\n\tvar current_page_file *os.File\n\tvar board *Board\n\tif board, err = getBoardFromID(op.BoardID); err != nil {\n\t\thtml += handleError(1, err.Error())\n\t}\n\n\treplies, err = getPostArr(map[string]interface{}{\n\t\t\"boardid\": op.BoardID,\n\t\t\"parentid\": op.ID,\n\t\t\"deleted_timestamp\": nilTimestamp,\n\t}, \"ORDER BY id ASC\")\n\tif err != nil {\n\t\thtml += handleError(1, \"Error building thread \"+strconv.Itoa(op.ID)+\":\"+err.Error())\n\t\treturn\n\t}\n\tos.Remove(path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".html\"))\n\n\tvar repliesInterface []interface{}\n\tfor _, reply := range replies {\n\t\trepliesInterface = append(repliesInterface, reply)\n\t}\n\n\tthread_pages := paginate(config.PostsPerThreadPage, repliesInterface)\n\tdeleteMatchingFiles(path.Join(config.DocumentRoot, board.Dir, \"res\"), \"^\"+strconv.Itoa(op.ID)+\"p\")\n\n\top.NumPages = len(thread_pages)\n\n\tcurrent_page_filepath := path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".html\")\n\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed opening \"+current_page_filepath+\": \"+err.Error())\n\t\treturn\n\t}\n\n\t// render main page\n\tif err = img_threadpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\"config\": config,\n\t\t\"boards\": allBoards,\n\t\t\"board\": board,\n\t\t\"sections\": allSections,\n\t\t\"posts\": replies,\n\t\t\"op\": op,\n\t}); err != nil {\n\t\thtml += handleError(1, \"Failed building /%s/res/%d threadpage: %s\", board.Dir, op.ID, err.Error()) + \"<br />\\n\"\n\t\treturn\n\t}\n\n\t// Put together the thread JSON\n\tthreadJSONFile, err := os.OpenFile(path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\".json\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\tdefer closeHandle(threadJSONFile)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed opening /%s/res/%d.json: %s\", board.Dir, op.ID, err.Error())\n\t\treturn\n\t}\n\n\tthreadMap := make(map[string][]Post)\n\n\t// Handle the OP, of type *Post\n\tthreadMap[\"posts\"] = []Post{*op}\n\n\t// Iterate through each reply, which are of type Post\n\tfor _, reply := range replies {\n\t\tthreadMap[\"posts\"] = append(threadMap[\"posts\"], reply)\n\t}\n\tthreadJSON, err := json.Marshal(threadMap)\n\tif err != nil {\n\t\thtml += handleError(1, \"Failed to marshal to JSON: %s\", err.Error()) + \"<br />\"\n\t\treturn\n\t}\n\n\tif _, err = threadJSONFile.Write(threadJSON); err != nil {\n\t\thtml += handleError(1, \"Failed writing /%s/res/%d.json: %s\", board.Dir, op.ID, err.Error()) + \"<br />\"\n\t\treturn\n\t}\n\n\thtml += fmt.Sprintf(\"Built /%s/%d successfully\", board.Dir, op.ID)\n\n\tfor page_num, page_posts := range thread_pages {\n\t\top.CurrentPage = page_num + 1\n\t\tcurrent_page_filepath := path.Join(config.DocumentRoot, board.Dir, \"res\", strconv.Itoa(op.ID)+\"p\"+strconv.Itoa(op.CurrentPage)+\".html\")\n\t\tcurrent_page_file, err = os.OpenFile(current_page_filepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\t\tif err != nil {\n\t\t\thtml += handleError(1, \"<br />Failed opening \"+current_page_filepath+\": \"+err.Error()) + \"<br />\\n\"\n\t\t\treturn\n\t\t}\n\n\t\tif err = img_threadpage_tmpl.Execute(current_page_file, map[string]interface{}{\n\t\t\t\"config\": config,\n\t\t\t\"boards\": allBoards,\n\t\t\t\"board\": board,\n\t\t\t\"sections\": allSections,\n\t\t\t\"posts\": page_posts,\n\t\t\t\"op\": op,\n\t\t}); err != nil {\n\t\t\thtml += handleError(1, \"<br />Failed building /%s/%d: %s\", board.Dir, op.ID, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\thtml += fmt.Sprintf(\"<br />Built /%s/%dp%d successfully\", board.Dir, op.ID, op.CurrentPage)\n\t}\n\treturn\n}", "title": "" }, { "docid": "68e0000bbd9e8d420f3e6a311bc53120", "score": "0.5253193", "text": "func (a *Client) ServeBuilds(params *ServeBuildsParams, authInfo runtime.ClientAuthInfoWriter) (*ServeBuildsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewServeBuildsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"serveBuilds\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/app/rest/projects/{projectLocator}/buildTypes/{btLocator}/builds\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ServeBuildsReader{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.(*ServeBuildsOK)\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 serveBuilds: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "5a7899010a9fd1774b1b601ebe0e6206", "score": "0.52520686", "text": "func GenerateListPage(events *[]Event) []string {\n\n\t// Get list of UofT buildings.\n\tbuildings, err := getUofTBuildingsList()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Add each event's listing lines to the list.\n\tlines := []string{}\n\tfor _, event := range *events {\n\t\tlines = append(lines, event.insertListEntry(&buildings, true)...)\n\t}\n\n\treturn lines\n}", "title": "" }, { "docid": "06754cc16917c7732c157a14a71fd77a", "score": "0.5229501", "text": "func (c *Client) ListRecentBuildsForProject(account, repo, branch, status string, limit, offset int) ([]*Build, error) {\n\tpath := fmt.Sprintf(\"project/%s/%s\", account, repo)\n\tif branch != \"\" {\n\t\tpath = fmt.Sprintf(\"%s/tree/%s\", path, branch)\n\t}\n\n\tparams := url.Values{}\n\tif status != \"\" {\n\t\tparams.Set(\"filter\", status)\n\t}\n\n\treturn c.recentBuilds(path, params, limit, offset)\n}", "title": "" }, { "docid": "53875c2908f8387767211bde043a1cd0", "score": "0.5223068", "text": "func BuildPagination(pageNum, pageSize string) string {\n\tif len(pageNum) == 0 {\n\t\treturn \"\"\n\t} else if len(pageSize) == 0 {\n\t\treturn pageNumberLabel + pageNum + \"&\" +\n\t\t\tpageSizeLabel + configs.Properties().HttpDefaultPageSize\n\t}\n\n\treturn pageNumberLabel + pageNum + \"&\" +\n\t\tpageSizeLabel + pageSize\n}", "title": "" }, { "docid": "56f9edd868f5c69ab3fbf64fa2f3e432", "score": "0.52115244", "text": "func ReadBuilds(parent context.Context, group config.TestGroup, builds Builds, max int, dur time.Duration, concurrency int) (*state.Grid, error) {\n\t// Spawn build readers\n\tif concurrency == 0 {\n\t\treturn nil, fmt.Errorf(\"zero readers for %s\", group.Name)\n\t}\n\tctx, cancel := context.WithCancel(parent)\n\tvar stop time.Time\n\tif dur != 0 {\n\t\tstop = time.Now().Add(-dur)\n\t}\n\tlb := len(builds)\n\tif lb > max {\n\t\tlog.Printf(\" Truncating %d %s results to %d\", lb, group.Name, max)\n\t\tlb = max\n\t}\n\tcols := make([]*Column, lb)\n\tlog.Printf(\"UPDATE: %s since %s (%d)\", group.Name, stop, stop.Unix())\n\tec := make(chan error)\n\told := make(chan int)\n\tvar wg sync.WaitGroup\n\n\t// Send build indices to readers\n\tindices := make(chan int)\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tdefer close(indices)\n\t\tfor i := range builds[:lb] {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-old:\n\t\t\t\treturn\n\t\t\tcase indices <- i:\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Concurrently receive indices and read builds\n\tfor i := 0; i < concurrency; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\tcase i, open := <-indices:\n\t\t\t\t\tif !open {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tb := builds[i]\n\t\t\t\t\tc, err := ReadBuild(b)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tec <- err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tcols[i] = c\n\t\t\t\t\tif c.Started < stop.Unix() {\n\t\t\t\t\t\tselect {\n\t\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\tcase old <- i:\n\t\t\t\t\t\t\tlog.Printf(\"STOP: %d %s started at %d < %d\", i, b.Prefix, c.Started, stop.Unix())\n\t\t\t\t\t\tdefault: // Someone else may have already reported an old result\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// Wait for everyone to finish\n\tgo func() {\n\t\twg.Wait()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase ec <- nil: // No error\n\t\t}\n\t}()\n\n\t// Determine if we got an error\n\tselect {\n\tcase <-ctx.Done():\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"interrupted reading %s\", group.Name)\n\tcase err := <-ec:\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"error reading %s: %v\", group.Name, err)\n\t\t}\n\t}\n\n\t// Add the columns into a grid message\n\tgrid := &state.Grid{}\n\trows := map[string]*state.Row{} // For fast target => row lookup\n\th := Headers(group)\n\tnc := makeNameConfig(group.TestNameConfig)\n\tfor _, c := range cols {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"interrupted appending columns to %s\", group.Name)\n\t\tdefault:\n\t\t}\n\t\tif c == nil {\n\t\t\tcontinue\n\t\t}\n\t\tAppendColumn(h, nc, grid, rows, *c)\n\t\tif c.Started < stop.Unix() { // There may be concurrency results < stop.Unix()\n\t\t\tlog.Printf(\" %s#%s before %s, stopping...\", group.Name, c.ID, stop)\n\t\t\tbreak // Just process the first result < stop.Unix()\n\t\t}\n\t}\n\tsort.Stable(Rows(grid.Rows))\n\tcancel()\n\treturn grid, nil\n}", "title": "" }, { "docid": "578bcd92b77a443d0aa3c937ff60106a", "score": "0.5174485", "text": "func (s *Service) TagsByBuild(appName, env, zone, name string, ps, pn, treeID int64) (tagPager *model.TagConfigPager, err error) {\n\tvar (\n\t\tapp *model.App\n\t\tbuild *model.Build\n\t\ttags []*model.Tag\n\t\tconfIDs []int64\n\t\tconfs []*model.Config\n\t\ttotal int64\n\t)\n\ttagConfigs := make([]*model.TagConfig, 0)\n\tif app, err = s.AppByTree(treeID, env, zone); err != nil {\n\t\tif err == ecode.NothingFound {\n\t\t\terr = s.CreateApp(appName, env, zone, treeID)\n\t\t\treturn\n\t\t}\n\t}\n\tif build, err = s.BuildByName(app.ID, name); err != nil {\n\t\tif err == ecode.NothingFound {\n\t\t\terr = nil\n\t\t}\n\t\treturn\n\t}\n\tif err = s.dao.DB.Where(\"app_id = ? and build_id =?\", app.ID, build.ID).Order(\"id desc\").Offset((pn - 1) * ps).Limit(ps).Find(&tags).Error; err != nil {\n\t\tlog.Error(\"TagsByBuild() findTags() error(%v)\", err)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil\n\t\t}\n\t\treturn\n\t}\n\ttmp := make(map[int64]struct{})\n\tfor _, tag := range tags {\n\t\ttmpIDs := strings.Split(tag.ConfigIDs, \",\")\n\t\tfor _, tmpID := range tmpIDs {\n\t\t\tvar id int64\n\t\t\tif id, err = strconv.ParseInt(tmpID, 10, 64); err != nil {\n\t\t\t\tlog.Error(\"strconv.ParseInt() error(%v)\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif _, ok := tmp[id]; !ok {\n\t\t\t\ttmp[id] = struct{}{}\n\t\t\t\tconfIDs = append(confIDs, id)\n\t\t\t}\n\t\t}\n\t}\n\tif confs, err = s.ConfigsByIDs(confIDs); err != nil {\n\t\treturn\n\t}\n\tfor _, tag := range tags {\n\t\ttagConfig := new(model.TagConfig)\n\t\ttagConfig.Tag = tag\n\t\ttagConfigs = append(tagConfigs, tagConfig)\n\t\ttmpIDs := strings.Split(tag.ConfigIDs, \",\")\n\t\tfor _, tmpID := range tmpIDs {\n\t\t\tvar id int64\n\t\t\tif id, err = strconv.ParseInt(tmpID, 10, 64); err != nil {\n\t\t\t\tlog.Error(\"strconv.ParseInt() error(%v)\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, conf := range confs {\n\t\t\t\tif id != conf.ID { //judge config is in build.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttagConfig.Confs = append(tagConfig.Confs, conf)\n\t\t\t}\n\t\t}\n\t}\n\tif err = s.dao.DB.Where(\"app_id = ? and build_id =?\", app.ID, build.ID).Model(&model.Tag{}).Count(&total).Error; err != nil {\n\t\tlog.Error(\"TagsByBuild() count() error(%v)\", err)\n\t\treturn\n\t}\n\ttagPager = &model.TagConfigPager{Ps: ps, Pn: pn, Total: total, Items: tagConfigs}\n\treturn\n}", "title": "" }, { "docid": "fb87f7bd3f755bc246905ce422034d97", "score": "0.5139751", "text": "func BuildList() []module.Version {\n\treturn buildList\n}", "title": "" }, { "docid": "4ade7adeabecf4b5e34e414869143eef", "score": "0.51339877", "text": "func GetBuilds(c context.Context, q Query) (*QueryResult, error) {\n\tswitch {\n\tcase q.Master == \"\":\n\t\treturn nil, errors.New(\"master is required\")\n\tcase q.Builder == \"\":\n\t\treturn nil, errors.New(\"builder is required\")\n\t}\n\n\tif !EmulationEnabled(c) {\n\t\treturn getDatastoreBuilds(c, q, true)\n\t}\n\n\tvar emulatedBuilds, buildbotBuilds []*buildbot.Build\n\terr := parallel.FanOutIn(func(work chan<- func() error) {\n\t\twork <- func() (err error) {\n\t\t\tres, err := getDatastoreBuilds(c, q, false)\n\t\t\tif res != nil {\n\t\t\t\tbuildbotBuilds = res.Builds\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\twork <- func() (err error) {\n\t\t\temulatedBuilds, err = getEmulatedBuilds(c, q)\n\t\t\treturn\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"could not load builds\").Err()\n\t}\n\n\tmergedBuilds := mergeBuilds(emulatedBuilds, buildbotBuilds)\n\tif q.Limit > 0 && len(mergedBuilds) > q.Limit {\n\t\tmergedBuilds = mergedBuilds[:q.Limit]\n\t}\n\treturn &QueryResult{Builds: mergedBuilds}, nil\n}", "title": "" }, { "docid": "43c96c7cdc271e27d593c29c97e99f90", "score": "0.5097723", "text": "func Build(builders []Builder) ([]Artifact, error) {\n\tdur, err := time.ParseDuration(\"1s\")\n\tif err != nil {\n\t\treturn nil, utils.FormatError(err)\n\t}\n\n\truntime.GOMAXPROCS(runtime.NumCPU() - 1)\n\n\tvar artifacts []Artifact\n\tch := make(chan *buildResult, len(builders))\n\n\tfor _, b := range builders {\n\t\ttime.Sleep(dur)\n\t\tgo func(b Builder) {\n\t\t\tartifact, err := b.Run()\n\t\t\t// Forwards created artifact to the channel.\n\t\t\tch <- &buildResult{artifact, err}\n\t\t}(b)\n\t}\n\tfor i := 0; i < len(builders); i++ {\n\t\tselect {\n\t\tcase result := <-ch:\n\t\t\tif result.err != nil {\n\t\t\t\t//defer close(ch)\n\t\t\t\treturn nil, utils.FormatError(result.err)\n\t\t\t}\n\t\t\tartifacts = append(artifacts, result.artifact)\n\t\t}\n\t}\n\treturn artifacts, nil\n}", "title": "" }, { "docid": "f69d858e0d5e361f7ea7ac74261678b1", "score": "0.5072343", "text": "func (j *Job) GetLatestBuilds(count int) []Build {\n\t// The timestamp of gcs directories are not usable,\n\t// as they are all set to '0001-01-01 00:00:00 +0000 UTC',\n\t// so use 'started.json' creation date for latest builds\n\tbuilds := j.GetFinishedBuilds()\n\tsort.Slice(builds, func(i, j int) bool {\n\t\tif builds[i].StartTime == nil {\n\t\t\treturn false\n\t\t}\n\t\tif builds[j].StartTime == nil {\n\t\t\treturn true\n\t\t}\n\t\treturn *builds[i].StartTime > *builds[j].StartTime\n\t})\n\tif len(builds) < count {\n\t\treturn builds\n\t}\n\treturn builds[:count]\n}", "title": "" }, { "docid": "d3488490a3928937dd81dd9cb897dbbb", "score": "0.50647223", "text": "func (p *Project) Build(root string) (*BuildRecord, error) {\n\tlog.Println(\"Build started\")\n\thash := md5.New()\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Println(\"Build failed: \", r)\n\t\t}\n\t}()\n\trecord := NewBuildRecord(*p)\n\tbuildStart := time.Now()\n\tbuildFailed := false\n\tio.WriteString(hash, \"Components:\\n\")\n\tcomponentNames := make([]string, len(p.Components))\n\ti := 0\n\tfor componentName, _ := range p.Components {\n\t\tcomponentNames[i] = componentName\n\t\ti += 1\n\t}\n\tlog.Println(\"Git Checkout\")\n\tsort.Strings(componentNames)\n\tfor index := range componentNames {\n\t\tcomponent := p.Components[componentNames[index]]\n\t\tstart := time.Now()\n\t\tcommit, err := runGitCheckout(component.Url, component.Name, component.Revision, root)\n\t\tend := time.Now()\n\t\tif err != nil {\n\t\t\tbuildFailed = true\n\t\t\trecord.SetRevision(componentNames[index], commit, end.Sub(start), BuildFailed)\n\t\t} else {\n\t\t\trecord.SetRevision(componentNames[index], commit, end.Sub(start), BuildOk)\n\t\t}\n\t\tio.WriteString(hash, fmt.Sprintf(\"%s %s %s\\n\", component.Url, component.Name, commit))\n\t}\n\tlog.Println(\"Build Steps\")\n\tio.WriteString(hash, \"Steps:\\n\")\n\tfor index, step := range p.Steps {\n\t\tstart := time.Now()\n\t\tif !buildFailed {\n\t\t\tdirectory := fmt.Sprintf(\"%s/%s\", root, step.Directory)\n\t\t\t// Compute the environment to be passed to the command here.\n\t\t\tenvironment := ExpandEnvironment(root, p.Env, step.Env)\n\t\t\terr := runCommand(directory, environment, step.Command[0], step.Command[1:]...)\n\t\t\tend := time.Now()\n\t\t\tif err != nil {\n\t\t\t\tbuildFailed = true\n\t\t\t\trecord.SetStatus(index, BuildFailed, end.Sub(start))\n\t\t\t} else {\n\t\t\t\trecord.SetStatus(index, BuildOk, end.Sub(start))\n\t\t\t}\n\t\t} else {\n\t\t\t// Skip build steps if a failure already occured.\n\t\t\tend := time.Now()\n\t\t\trecord.SetStatus(index, BuildSkipped, end.Sub(start))\n\t\t}\n\t\tio.WriteString(hash, step.Directory)\n\t\tfor i, arg := range step.Command {\n\t\t\tio.WriteString(hash, fmt.Sprintf(\"%d: %s\\n\", i, arg))\n\t\t}\n\t\tio.WriteString(hash, \"\\n\")\n\t}\n\tlog.Printf(\"Hash: %x\\n\", hash.Sum(nil))\n\trecord.Hash = fmt.Sprintf(\"%x\", hash.Sum(nil))\n\tbuildEnd := time.Now()\n\trecord.Duration = buildEnd.Sub(buildStart)\n\treturn record, nil\n}", "title": "" }, { "docid": "662e504d4c28766f1ad7a4cc435767d5", "score": "0.5062598", "text": "func (client StaticSitesClient) GetStaticSiteBuildsComplete(ctx context.Context, resourceGroupName string, name string) (result StaticSiteBuildCollectionIterator, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/StaticSitesClient.GetStaticSiteBuilds\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response().Response.Response != nil {\n\t\t\t\tsc = result.page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.page, err = client.GetStaticSiteBuilds(ctx, resourceGroupName, name)\n\treturn\n}", "title": "" }, { "docid": "5074c095c9879b199d99539aeef3f104", "score": "0.50587904", "text": "func (d *localDB) GetBuildsFromDateRange(start, end time.Time) ([]*Build, error) {\n\treturn d.getBuildsFromDateRange(start, end, make(chan struct{}))\n}", "title": "" }, { "docid": "cde2a82d3c09dfe5b5742ff1f7ff6b5d", "score": "0.5041291", "text": "func (s *Server) BuildInfo(w http.ResponseWriter, r *http.Request) {\n\tctx := context.TODO()\n\n\tident := identity(mux.Vars(r))\n\n\tb, err := s.client.FindBuild(ctx, ident)\n\tif err != nil {\n\t\tencodeErr(w, err)\n\t\treturn\n\t}\n\n\tencode(w, newBuild(b))\n}", "title": "" }, { "docid": "e069bf6d4534ce1f7510b3126e416ba5", "score": "0.50377953", "text": "func mergeBuilds(a, b []*buildbotapi.Build) []*buildbotapi.Build {\n\tret := make([]*buildbotapi.Build, len(a), len(a)+len(b))\n\tcopy(ret, a)\n\n\t// add builds from b that have unique build numbers.\n\taNumbers := make(map[int]struct{}, len(a))\n\tfor _, build := range a {\n\t\taNumbers[build.Number] = struct{}{}\n\t}\n\tfor _, build := range b {\n\t\tif _, ok := aNumbers[build.Number]; !ok {\n\t\t\tret = append(ret, build)\n\t\t}\n\t}\n\tsort.Slice(ret, func(i, j int) bool {\n\t\treturn ret[i].Number > ret[j].Number\n\t})\n\treturn ret\n}", "title": "" }, { "docid": "ccff38be60d93ec8643c4aafc3bac104", "score": "0.5030853", "text": "func mergeBuilds(a, b []*buildbot.Build) []*buildbot.Build {\n\tret := make([]*buildbot.Build, len(a), len(a)+len(b))\n\tcopy(ret, a)\n\n\t// add builds from b that have unique build numbers.\n\taNumbers := make(map[int]struct{}, len(a))\n\tfor _, build := range a {\n\t\taNumbers[build.Number] = struct{}{}\n\t}\n\tfor _, build := range b {\n\t\tif _, ok := aNumbers[build.Number]; !ok {\n\t\t\tret = append(ret, build)\n\t\t}\n\t}\n\tsort.Slice(ret, func(i, j int) bool {\n\t\treturn ret[i].Number > ret[j].Number\n\t})\n\treturn ret\n}", "title": "" }, { "docid": "2f27b93f8c04c87023e83942b041ceb5", "score": "0.50274956", "text": "func Build(username string, name string, path string) (store.BuildInfo, error) {\n\n\tvar commands []Step\n\n\tvar buildInfo = store.BuildInfo{BuildPath: path, BuildTime: time.Now()}\n\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\tcommands = initCommandsNewSite(username, name, path)\n\t} else {\n\t\tcommands = initCommandsExistingSite(username, name, path)\n\t}\n\n\tfor i := range commands {\n\t\terr := commands[i].ExecuteCommand()\n\t\tbuildInfo.BuildLog += commands[i].Stdout\n\t\tbuildInfo.BuildErrorLog += commands[i].Stderr\n\t\tif err != nil {\n\t\t\tbuildInfo.BuildDuration = time.Since(buildInfo.BuildTime)\n\t\t\tbuildInfo.BuildStatus = \"fail\"\n\t\t\treturn buildInfo, err\n\t\t}\n\t}\n\tbuildInfo.BuildDuration = time.Since(buildInfo.BuildTime)\n\tbuildInfo.BuildStatus = \"ok\"\n\treturn buildInfo, nil\n}", "title": "" }, { "docid": "fd722a2c213437f6978201fc2f336073", "score": "0.5010147", "text": "func (s *CommitsService) ListPage(ctx context.Context, projectKey, repositorySlug, branch string, perPage, page int) ([]*CommitObject, error) {\n\tstart := 0\n\tif page > 0 {\n\t\tstart = (perPage * page) + 1\n\t}\n\n\topts := &PagingOptions{Limit: int64(perPage), Start: int64(start)}\n\tlist, err := s.List(ctx, projectKey, repositorySlug, branch, opts)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn list.Commits, nil\n}", "title": "" }, { "docid": "824edfc2d4588aba03042a87e7ea59af", "score": "0.5005716", "text": "func GetAllBuilders(c context.Context) (*resp.CIService, error) {\n\tresult := &resp.CIService{Name: \"Buildbot\"}\n\t// Fetch all Master entries from datastore\n\tq := ds.NewQuery(\"buildbotMasterEntry\")\n\t// TODO(hinoka): Maybe don't look past like a month or so?\n\tentries := []*buildbotMasterEntry{}\n\terr := (&ds.Batcher{}).GetAll(c, q, &entries)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add each builder from each master entry into the result.\n\t// TODO(hinoka): FanInOut this?\n\tfor _, entry := range entries {\n\t\tif entry.Internal {\n\t\t\t// Bypass the master if it's an internal master and the user is not\n\t\t\t// part of the buildbot-private project.\n\t\t\tallowed, err := common.IsAllowedInternal(c)\n\t\t\tif err != nil {\n\t\t\t\tlogging.WithError(err).Errorf(c, \"Could not process master %s\", entry.Name)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !allowed {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tmaster := &buildbotMaster{}\n\t\terr = decodeMasterEntry(c, entry, master)\n\t\tif err != nil {\n\t\t\tlogging.WithError(err).Errorf(c, \"Could not decode %s\", entry.Name)\n\t\t\tcontinue\n\t\t}\n\t\tml := resp.BuilderGroup{Name: entry.Name}\n\t\t// Sort the builder listing.\n\t\tsb := make([]string, 0, len(master.Builders))\n\t\tfor bn := range master.Builders {\n\t\t\tsb = append(sb, bn)\n\t\t}\n\t\tsort.Strings(sb)\n\t\tfor _, bn := range sb {\n\t\t\t// Go templates escapes this for us, and also\n\t\t\t// slashes are not allowed in builder names.\n\t\t\tml.Builders = append(ml.Builders, *resp.NewLink(\n\t\t\t\tbn, fmt.Sprintf(\"/buildbot/%s/%s\", entry.Name, bn)))\n\t\t}\n\t\tresult.BuilderGroups = append(result.BuilderGroups, ml)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "d0e1418925c375e055c8e2f038091a1d", "score": "0.49931198", "text": "func Builds(ctx context.Context) sourcegraph.BuildsServer {\n\ts, ok := ctx.Value(_BuildsKey).(sourcegraph.BuildsServer)\n\tif !ok || s == nil {\n\t\tpanic(\"no Builds set in context\")\n\t}\n\treturn s\n}", "title": "" }, { "docid": "9453ba118376a14bf537e7cb1a64cd8f", "score": "0.49825796", "text": "func TestBuilder_Dispatch(t *testing.T) {\n\ttests := map[string]struct {\n\t\tsite model.Site\n\t}{\n\t\t\"site with multiple page references\": {\n\t\t\tsite: model.Site{\n\t\t\t\tRoot: &model.Node{\n\t\t\t\t\tListPage: model.ListPage{\n\t\t\t\t\t\tPages: []*model.Page{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tDate: time.Date(2020, 03, 16, 0, 0, 0, 0, time.UTC),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tDate: time.Date(2020, 01, 28, 0, 0, 0, 0, time.UTC),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tDate: time.Date(2020, 11, 3, 0, 0, 0, 0, time.UTC),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor name, testCase := range tests {\n\t\tt.Log(name)\n\n\t\tbuilder := New(&config.Config{})\n\t\tbuilder.site = testCase.site\n\n\t\tsite, err := builder.Dispatch()\n\t\ttest.Ok(t, err)\n\n\t\t// Test if all page references in list pages are sorted correctly.\n\t\t_ = tree.Walk(site.Root, func(_ string, node tree.Node) error {\n\t\t\tn := node.(*model.Node)\n\n\t\t\tisSorted := sort.SliceIsSorted(n.ListPage.Pages, func(i, j int) bool {\n\t\t\t\treturn n.ListPage.Pages[i].Date.After(n.ListPage.Pages[j].Date)\n\t\t\t})\n\n\t\t\ttest.Assert(t, isSorted, \"page references should be sorted\")\n\t\t\treturn nil\n\t\t}, -1)\n\t}\n}", "title": "" }, { "docid": "f5215e916f64481467ba12b274a34d83", "score": "0.4978009", "text": "func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/pages/builds/latest\", owner, repo)\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbuild := new(PagesBuild)\n\tresp, err := s.client.Do(ctx, req, build)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn build, resp, nil\n}", "title": "" }, { "docid": "130d9b72fed6b35eace409286ee19570", "score": "0.4974487", "text": "func (q *Query) Build(cond map[string]interface{}) error {\n\tq.Page = q.Query.Page\n\tq.Size = q.Query.Size\n\tq.Range = q.Query.Range\n\tq.Preload = q.Query.Preload\n\n\terr := q.BuildCond(cond)\n\terr = q.BuildPipe()\n\treturn err\n}", "title": "" }, { "docid": "e1a632a36bb1802f2dae210357f2f06c", "score": "0.49552846", "text": "func fetchVersionsAndAssociatedBuilds(project *model.Project, skip int, numVersions int) ([]version.Version, map[string][]build.Build, error) {\n\n\t// fetch the versions from the db\n\tversionsFromDB, err := version.Find(version.ByProjectId(project.Identifier).\n\t\tWithFields(\n\t\t\tversion.RevisionKey,\n\t\t\tversion.ErrorsKey,\n\t\t\tversion.WarningsKey,\n\t\t\tversion.IgnoredKey,\n\t\t\tversion.MessageKey,\n\t\t\tversion.AuthorKey,\n\t\t\tversion.RevisionOrderNumberKey,\n\t\t\tversion.CreateTimeKey,\n\t\t).Sort([]string{\"-\" + version.RevisionOrderNumberKey}).Skip(skip).Limit(numVersions))\n\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error fetching versions from database: %v\", err)\n\t}\n\n\t// create a slice of the version ids (used to fetch the builds)\n\tversionIds := make([]string, 0, len(versionsFromDB))\n\tfor _, v := range versionsFromDB {\n\t\tversionIds = append(versionIds, v.Id)\n\t}\n\n\t// fetch all of the builds (with only relevant fields)\n\tbuildsFromDb, err := build.Find(\n\t\tbuild.ByVersions(versionIds).\n\t\t\tWithFields(build.BuildVariantKey, build.TasksKey, build.VersionKey))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error fetching builds from database: %v\", err)\n\t}\n\n\t// sort the builds by version\n\tbuildsByVersion := map[string][]build.Build{}\n\tfor _, build := range buildsFromDb {\n\t\tbuildsByVersion[build.Version] = append(\n\t\t\tbuildsByVersion[build.Version], build)\n\t}\n\n\treturn versionsFromDB, buildsByVersion, nil\n}", "title": "" }, { "docid": "151f09a60f7b8ee5963dc4f05be1cbab", "score": "0.49388885", "text": "func BuildGetAll() (*model.BuildCollection, error) {\n\t// TODO\n\treturn &model.BuildCollection{}, nil\n}", "title": "" }, { "docid": "d59013d7fd685aca5d8f75fcb4422ec1", "score": "0.49252558", "text": "func buildsFind(tx *sqlx.Tx, buildID string) (*Build, error) {\n\tconst (\n\t\tfindBuildSql = `SELECT * FROM builds where id = ?`\n\t\tfindArtifactsSql = `SELECT image FROM artifacts WHERE build_id = ?`\n\t)\n\n\tvar b Build\n\terr := tx.Get(&b, tx.Rebind(findBuildSql), buildID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = tx.Select(&b.Artifacts, tx.Rebind(findArtifactsSql), buildID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &b, err\n}", "title": "" }, { "docid": "779bb0b10b9a022757fef77571f4ff4f", "score": "0.49233922", "text": "func GetAllLastBuildByApplicationAndVersion(db database.Querier, applicationID int64, branchName string, version int) ([]sdk.PipelineBuild, error) {\n\tpb := []sdk.PipelineBuild{}\n\n\tquery := `\n\t\tWITH load_pb AS (%s), load_history AS (%s)\n\t\tSELECT \tdistinct on(pipeline_id, environment_id) pipeline_id, application_id, environment_id, 0, project_id,\n\t\t\tenvName, appName, pipName, projectkey,\n\t\t\ttype,\n\t\t\tbuild_number, version, status,\n\t\t\tstart, done,\n\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\tFROM (\n\t\t\t(SELECT\n\t\t\t\tdistinct on (pipeline_id, environment_id) pipeline_id, environment_id, application_id, project_id,\n\t\t\t\tenvName, appName, pipName, projectkey,\n\t\t\t\ttype,\n\t\t\t\tbuild_number, version, status,\n\t\t\t\tstart, done,\n\t\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\t\tFROM load_pb\n\t\t\tORDER BY pipeline_id, environment_id, build_number DESC)\n\n\t\t\tUNION\n\n\t\t\t(SELECT\n\t\t\t\tdistinct on (pipeline_id, environment_id) pipeline_id, environment_id, application_id, project_id,\n\t\t\t\tenvName, appName, pipName, projectkey,\n\t\t\t\ttype,\n\t\t\t\tbuild_number, version, status,\n\t\t\t\tstart, done,\n\t\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\t\tFROM load_history\n\t\t\tORDER BY pipeline_id, environment_id, build_number DESC)\n\t\t) as pb\n\t\tORDER BY pipeline_id, environment_id, build_number DESC\n\t\tLIMIT 100\n\t`\n\n\tquery = fmt.Sprintf(query,\n\t\tfmt.Sprintf(LoadPipelineBuildRequest,\n\t\t\t\"\",\n\t\t\t\"pb.application_id = $1 AND pb.vcs_changes_branch = $2 AND pb.version = $3\",\n\t\t\t\"LIMIT 100\"),\n\t\tfmt.Sprintf(LoadPipelineHistoryRequest,\n\t\t\t\"\",\n\t\t\t\"ph.application_id = $1 AND ph.vcs_changes_branch = $2 AND ph.version = $3\",\n\t\t\t\"LIMIT 100\"))\n\trows, err := db.Query(query, applicationID, branchName, version)\n\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn pb, err\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tp := sdk.PipelineBuild{}\n\t\terr = scanPbShort(&p, rows)\n\n\t\tpb = append(pb, p)\n\t}\n\treturn pb, nil\n}", "title": "" }, { "docid": "f1f6c3f5b9d923b321af729a6c988cb3", "score": "0.49177682", "text": "func buildFrontPage() string {\n\terr := initTemplates(\"front\")\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tvar recentPostsArr []interface{}\n\n\tos.Remove(path.Join(config.DocumentRoot, \"index.html\"))\n\tfront_file, err := os.OpenFile(path.Join(config.DocumentRoot, \"index.html\"), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)\n\tdefer closeHandle(front_file)\n\tif err != nil {\n\t\treturn handleError(1, \"Failed opening front page for writing: \"+err.Error()) + \"<br />\\n\"\n\t}\n\n\t// get recent posts\n\trecentQueryStr := \"SELECT \" +\n\t\tconfig.DBprefix + \"posts.id, \" +\n\t\tconfig.DBprefix + \"posts.parentid, \" +\n\t\tconfig.DBprefix + \"boards.dir as boardname, \" +\n\t\tconfig.DBprefix + \"posts.boardid as boardid, \" +\n\t\tconfig.DBprefix + \"posts.name, \" +\n\t\tconfig.DBprefix + \"posts.tripcode, \" +\n\t\tconfig.DBprefix + \"posts.message, \" +\n\t\tconfig.DBprefix + \"posts.filename, \" +\n\t\tconfig.DBprefix + \"posts.thumb_w, \" +\n\t\tconfig.DBprefix + \"posts.thumb_h \" +\n\t\t\"FROM \" + config.DBprefix + \"posts, \" + config.DBprefix + \"boards \" +\n\t\t\"WHERE \" + config.DBprefix + \"posts.deleted_timestamp = ? \"\n\n\tif !config.RecentPostsWithNoFile {\n\t\trecentQueryStr += \"AND \" + config.DBprefix + \"posts.filename != '' AND \" + config.DBprefix + \"posts.filename != 'deleted' \"\n\t}\n\trecentQueryStr += \"AND boardid = \" + config.DBprefix + \"boards.id \" +\n\t\t\"ORDER BY timestamp DESC LIMIT ?\"\n\n\trows, err := querySQL(recentQueryStr, nilTimestamp, config.MaxRecentPosts)\n\tdefer closeHandle(rows)\n\tif err != nil {\n\t\treturn handleError(1, err.Error())\n\t}\n\n\tfor rows.Next() {\n\t\trecentPost := new(RecentPost)\n\t\tif err = rows.Scan(\n\t\t\t&recentPost.PostID, &recentPost.ParentID, &recentPost.BoardName, &recentPost.BoardID,\n\t\t\t&recentPost.Name, &recentPost.Tripcode, &recentPost.Message, &recentPost.Filename, &recentPost.ThumbW, &recentPost.ThumbH,\n\t\t); err != nil {\n\t\t\treturn handleError(1, \"Failed getting list of recent posts for front page: \"+err.Error())\n\t\t}\n\t\trecentPostsArr = append(recentPostsArr, recentPost)\n\t}\n\n\tfor _, board := range allBoards {\n\t\tif board.Section == 0 {\n\t\t\tboard.Section = 1\n\t\t}\n\t}\n\n\tif err = front_page_tmpl.Execute(front_file, map[string]interface{}{\n\t\t\"config\": config,\n\t\t\"sections\": allSections,\n\t\t\"boards\": allBoards,\n\t\t\"recent_posts\": recentPostsArr,\n\t}); err != nil {\n\t\treturn handleError(1, \"Failed executing front page template: \"+err.Error())\n\t}\n\treturn \"Front page rebuilt successfully.\"\n}", "title": "" }, { "docid": "4411927873986e1806bdb93252496528", "score": "0.4914286", "text": "func FetchVersionsBuildsAndTasks(project *Project, skip int, numVersions int, showTriggered bool) ([]Version, map[string][]build.Build, map[string][]task.Task, error) {\n\t// fetch the versions from the db\n\tversionsFromDB, err := VersionFind(VersionByProjectAndTrigger(project.Identifier, showTriggered).\n\t\tWithFields(\n\t\t\tVersionRevisionKey,\n\t\t\tVersionErrorsKey,\n\t\t\tVersionWarningsKey,\n\t\t\tVersionIgnoredKey,\n\t\t\tVersionMessageKey,\n\t\t\tVersionAuthorKey,\n\t\t\tVersionRevisionOrderNumberKey,\n\t\t\tVersionCreateTimeKey,\n\t\t\tVersionTriggerIDKey,\n\t\t\tVersionTriggerTypeKey,\n\t\t\tVersionGitTagsKey,\n\t\t).Sort([]string{\"-\" + VersionCreateTimeKey}).Skip(skip).Limit(numVersions))\n\n\tif err != nil {\n\t\treturn nil, nil, nil, errors.Wrap(err, \"fetching versions from database\")\n\t}\n\n\t// create a slice of the version ids (used to fetch the builds)\n\tversionIds := make([]string, 0, len(versionsFromDB))\n\tfor _, v := range versionsFromDB {\n\t\tversionIds = append(versionIds, v.Id)\n\t}\n\n\t// fetch all of the builds (with only relevant fields)\n\tbuildsFromDb, err := build.Find(\n\t\tbuild.ByVersions(versionIds).\n\t\t\tWithFields(\n\t\t\t\tbuild.BuildVariantKey,\n\t\t\t\tbsonutil.GetDottedKeyName(build.TasksKey, build.TaskCacheIdKey),\n\t\t\t\tbuild.VersionKey,\n\t\t\t\tbuild.DisplayNameKey,\n\t\t\t\tbuild.RevisionKey,\n\t\t\t))\n\tif err != nil {\n\t\treturn nil, nil, nil, errors.Wrap(err, \"fetching builds from database\")\n\t}\n\n\t// group the builds by version\n\tbuildsByVersion := map[string][]build.Build{}\n\tfor _, build := range buildsFromDb {\n\t\tbuildsByVersion[build.Version] = append(buildsByVersion[build.Version], build)\n\t}\n\n\t// Filter out execution tasks because they'll be dropped when iterating through the build task cache anyway.\n\t// maxTime ensures the query won't go on indefinitely when the request is cancelled.\n\ttasksFromDb, err := task.FindAll(db.Query(task.NonExecutionTasksByVersions(versionIds)).WithFields(task.StatusFields...).MaxTime(waterfallTasksQueryMaxTime))\n\tif err != nil {\n\t\treturn nil, nil, nil, errors.Wrap(err, \"fetching tasks from database\")\n\t}\n\ttaskMap := task.TaskSliceToMap(tasksFromDb)\n\n\ttasksByBuild := map[string][]task.Task{}\n\tfor _, b := range buildsFromDb {\n\t\tfor _, t := range b.Tasks {\n\t\t\ttasksByBuild[b.Id] = append(tasksByBuild[b.Id], taskMap[t.Id])\n\t\t}\n\t}\n\n\treturn versionsFromDB, buildsByVersion, tasksByBuild, nil\n}", "title": "" }, { "docid": "3f36fa3adc96af2d3ee481830ba332d7", "score": "0.49137616", "text": "func (client *Client) Live() (builds []Build, err error) {\n\ttry := func(loc Location) (build Build, err error) {\n\t\tformat, resp, err := client.Get(loc, \"\")\n\t\tif err != nil {\n\t\t\treturn build, err\n\t\t}\n\t\tdefer resp.Close()\n\n\t\tswitch format {\n\t\tcase \".json\":\n\t\t\terr = json.NewDecoder(resp).Decode(&build)\n\t\t\treturn build, err\n\t\tdefault:\n\t\t\tb, err := ioutil.ReadAll(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn build, err\n\t\t\t}\n\t\t\treturn Build{Hash: string(b)}, nil\n\t\t}\n\t}\n\tfor _, loc := range client.Config.Live {\n\t\tbuild, err := try(loc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuilds = append(builds, build)\n\t}\n\treturn builds, nil\n}", "title": "" }, { "docid": "af5deaa954bd867dc1aaf9eab49e03a8", "score": "0.49106258", "text": "func sortBuilds(strBuilds []string) []int {\n\tvar res []int\n\tfor _, buildStr := range strBuilds {\n\t\tnum, err := strconv.Atoi(buildStr)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Non-int build number found: '%s'\", buildStr)\n\t\t} else {\n\t\t\tres = append(res, num)\n\t\t}\n\t}\n\tsort.Sort(sort.Reverse(sort.IntSlice(res)))\n\treturn res\n}", "title": "" }, { "docid": "90a0ab332e3abbe1ee9c027b2a180a73", "score": "0.48968366", "text": "func (d *localDB) putBuilds(tx *bolt.Tx, builds []*Build) error {\n\tfor _, b := range builds {\n\t\tid := b.Id()\n\t\tif tx.Bucket(BUCKET_BUILDS).Get(id) != nil {\n\t\t\tif err := deleteBuild(tx, id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor _, b := range builds {\n\t\tif err := d.insertBuild(tx, b); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97b51066c8f07753a303dca8ecd11dd6", "score": "0.48958778", "text": "func (p *PrintingKubeClient) BuildTable(_ io.Reader, _ bool) (kube.ResourceList, error) {\n\treturn []*resource.Info{}, nil\n}", "title": "" }, { "docid": "103270a87bd8110d032708642919eb2a", "score": "0.4892163", "text": "func QueryBuildData(datas *dashboard) error {\n\trows, err := database.Db.Query(`\n\t\tSELECT\n\t\t\t*\n\t\tFROM build\n\t\tORDER BY id DESC`)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tdata := dashboardSummary{}\n\t\terr = rows.Scan(\n\t\t\t&data.ID,\n\t\t\t&data.Sha,\n\t\t\t&data.Ref,\n\t\t\t&data.Status,\n\t\t\t&data.WebURL,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdatas.Dashboard = append(datas.Dashboard, data)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2efef7fd7bea3c1cb938f2f1b242d528", "score": "0.4878939", "text": "func (d *DB) SHABuilds(sha string) ([]Build, error) {\n\tids, err := d.shaBuilds(sha)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d.idsToBuilds(ids)\n}", "title": "" }, { "docid": "9123edfdc41ab1c5b4ff1ae2a89ec4bb", "score": "0.4863742", "text": "func (t *TektonLogger) GetRunningBuildLogs(pa *v1.PipelineActivity, buildName string, noWaitForRuns bool) <-chan LogLine {\n\tch := make(chan LogLine)\n\tgo func() {\n\t\tdefer close(ch)\n\t\terr := t.getRunningBuildLogs(pa, buildName, noWaitForRuns, ch)\n\t\tif err != nil {\n\t\t\tt.err = err\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "b339ffd2cb7f5dcd8b41140f9008dfd7", "score": "0.48570538", "text": "func LoadBuildingPipelines(db *sql.DB, args ...FuncArg) ([]sdk.PipelineBuild, error) {\n\tquery := `\nSELECT DISTINCT ON (project.projectkey, application.name, pb.application_id, pb.pipeline_id, pb.environment_id, pb.vcs_changes_branch)\n\tpb.pipeline_id, pb.application_id, pb.environment_id, pb.id, project.id as project_id,\n\tenvironment.name as envName, application.name as appName, pipeline.name as pipName, project.projectkey,\n\tpipeline.type,\n\tpb.build_number, pb.version, pb.status, pb.args,\n\tpb.start, pb.done,\n\tpb.manual_trigger, pb.triggered_by, pb.parent_pipeline_build_id, pb.vcs_changes_branch, pb.vcs_changes_hash, pb.vcs_changes_author,\n\t\"user\".username, pipTriggerFrom.name as pipTriggerFrom, pbTriggerFrom.version as versionTriggerFrom\nFROM pipeline_build pb\nJOIN environment ON environment.id = pb.environment_id\nJOIN application ON application.id = pb.application_id\nJOIN pipeline ON pipeline.id = pb.pipeline_id\nJOIN project ON project.id = pipeline.project_id\nLEFT JOIN \"user\" ON \"user\".id = pb.triggered_by\nLEFT JOIN pipeline_build as pbTriggerFrom ON pbTriggerFrom.id = pb.parent_pipeline_build_id\nLEFT JOIN pipeline as pipTriggerFrom ON pipTriggerFrom.id = pbTriggerFrom.pipeline_id\nWHERE pb.status = $1\nORDER BY project.projectkey, application.name, pb.application_id, pb.pipeline_id, pb.environment_id, pb.vcs_changes_branch, pb.id\nLIMIT 1000`\n\trows, err := db.Query(query, sdk.StatusBuilding.String())\n\tif err != nil {\n\t\tlog.Warning(\"LoadBuildingPipelines>Cannot load buliding pipelines: %s\", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar pip []sdk.PipelineBuild\n\tfor rows.Next() {\n\t\tp := sdk.PipelineBuild{}\n\n\t\tvar status, typePipeline, argsJSON string\n\t\tvar manual sql.NullBool\n\t\tvar trigBy, pPbID, version sql.NullInt64\n\t\tvar branch, hash, author, fromUser, fromPipeline sql.NullString\n\n\t\terr := rows.Scan(&p.Pipeline.ID, &p.Application.ID, &p.Environment.ID, &p.ID, &p.Pipeline.ProjectID,\n\t\t\t&p.Environment.Name, &p.Application.Name, &p.Pipeline.Name, &p.Pipeline.ProjectKey,\n\t\t\t&typePipeline,\n\t\t\t&p.BuildNumber, &p.Version, &status, &argsJSON,\n\t\t\t&p.Start, &p.Done,\n\t\t\t&manual, &trigBy, &pPbID, &branch, &hash, &author,\n\t\t\t&fromUser, &fromPipeline, &version)\n\t\tif err != nil {\n\t\t\tlog.Warning(\"LoadBuildingPipelines> Error while loading build information: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tp.Status = sdk.StatusFromString(status)\n\t\tp.Pipeline.Type = sdk.PipelineTypeFromString(typePipeline)\n\t\tp.Application.ProjectKey = p.Pipeline.ProjectKey\n\t\tloadPbTrigger(&p, manual, pPbID, branch, hash, author, fromUser, fromPipeline, version)\n\n\t\tif trigBy.Valid && p.Trigger.TriggeredBy != nil {\n\t\t\tp.Trigger.TriggeredBy.ID = trigBy.Int64\n\t\t}\n\n\t\t// Load parameters\n\t\tif err := json.Unmarshal([]byte(argsJSON), &p.Parameters); err != nil {\n\t\t\tlog.Warning(\"Cannot unmarshal args : %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// load pipeline actions\n\t\tif err := loadPipelineStage(db, &p.Pipeline, args...); err != nil {\n\t\t\tlog.Warning(\"Cannot load pipeline stages : %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpip = append(pip, p)\n\t}\n\n\treturn pip, nil\n}", "title": "" }, { "docid": "93c304f0fd92c1b3c9c1181f8628253b", "score": "0.48466748", "text": "func LoadBuildList() []module.Version {\n\tInitMod()\n\tReloadBuildList()\n\tWriteGoMod()\n\treturn buildList\n}", "title": "" }, { "docid": "de79c06f1402f48eeefcf296c5dda0fa", "score": "0.48265296", "text": "func GetBuildDate() string {\n\treturn buildDate\n}", "title": "" }, { "docid": "07693e78cee4404725d092b0ef8bebff", "score": "0.48235178", "text": "func GetAllLastBuildByApplication(db database.Querier, applicationID int64, branchName string) ([]sdk.PipelineBuild, error) {\n\tpb := []sdk.PipelineBuild{}\n\n\tquery := `\n\t\tWITH load_pb AS (%s), load_history AS (%s)\n\t\tSELECT \tdistinct on(pipeline_id, environment_id) pipeline_id, application_id, environment_id, 0, project_id,\n\t\t\tenvName, appName, pipName, projectkey,\n\t\t\ttype,\n\t\t\tbuild_number, version, status,\n\t\t\tstart, done,\n\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\tFROM (\n\t\t\t(SELECT\n\t\t\t\tdistinct on (pipeline_id, environment_id) pipeline_id, environment_id, application_id, project_id,\n\t\t\t\tenvName, appName, pipName, projectkey,\n\t\t\t\ttype,\n\t\t\t\tbuild_number, version, status,\n\t\t\t\tstart, done,\n\t\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\t\tFROM load_pb\n\t\t\tORDER BY pipeline_id, environment_id, build_number DESC)\n\n\t\t\tUNION\n\n\t\t\t(SELECT\n\t\t\t\tdistinct on (pipeline_id, environment_id) pipeline_id, environment_id, application_id, project_id,\n\t\t\t\tenvName, appName, pipName, projectkey,\n\t\t\t\ttype,\n\t\t\t\tbuild_number, version, status,\n\t\t\t\tstart, done,\n\t\t\t\tmanual_trigger, triggered_by, parent_pipeline_build_id, vcs_changes_branch, vcs_changes_hash, vcs_changes_author,\n\t\t\t\tusername, pipTriggerFrom, versionTriggerFrom\n\t\t\tFROM load_history\n\t\t\tORDER BY pipeline_id, environment_id, build_number DESC)\n\t\t) as pb\n\t\tORDER BY pipeline_id, environment_id, build_number DESC\n\t\tLIMIT 100\n\t`\n\n\tvar rows *sql.Rows\n\tvar err error\n\tif branchName == \"\" {\n\t\tquery = fmt.Sprintf(query,\n\t\t\tfmt.Sprintf(LoadPipelineBuildRequest,\n\t\t\t\t\"\",\n\t\t\t\t\"pb.application_id = $1\",\n\t\t\t\t\"LIMIT 100\"),\n\t\t\tfmt.Sprintf(LoadPipelineHistoryRequest,\n\t\t\t\t\"\",\n\t\t\t\t\"ph.application_id = $1\",\n\t\t\t\t\"LIMIT 100\"))\n\t\trows, err = db.Query(query, applicationID)\n\t} else {\n\t\tquery = fmt.Sprintf(query,\n\t\t\tfmt.Sprintf(LoadPipelineBuildRequest,\n\t\t\t\t\"\",\n\t\t\t\t\"pb.application_id = $1 AND pb.vcs_changes_branch = $2\",\n\t\t\t\t\"LIMIT 100\"),\n\t\t\tfmt.Sprintf(LoadPipelineHistoryRequest,\n\t\t\t\t\"\",\n\t\t\t\t\"ph.application_id = $1 AND ph.vcs_changes_branch = $2\",\n\t\t\t\t\"LIMIT 100\"))\n\t\trows, err = db.Query(query, applicationID, branchName)\n\t}\n\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn pb, err\n\t}\n\tif err != nil && err == sql.ErrNoRows {\n\t\treturn pb, nil\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tp := sdk.PipelineBuild{}\n\t\terr = scanPbShort(&p, rows)\n\n\t\tpb = append(pb, p)\n\t}\n\treturn pb, nil\n}", "title": "" }, { "docid": "36de6974b79497eff29f6c51749bd566", "score": "0.48203024", "text": "func GetBuildings() ([]structs.Building, error) {\n\tlog.L.Info(\"[dbo] getting all buildings...\")\n\turl := os.Getenv(\"CONFIGURATION_DATABASE_MICROSERVICE_ADDRESS\") + \"/buildings\"\n\tlog.L.Infof(\"[dbo] url: %s\", url)\n\tvar buildings []structs.Building\n\terr := GetData(url, &buildings)\n\n\treturn buildings, err\n}", "title": "" }, { "docid": "60e7a31e1c0b3758334296f1bfcb9cba", "score": "0.4816143", "text": "func LoadPipelineBuildChildren(db *sql.DB, pipelineID int64, applicationID int64, buildNumber int64, environmentID int64) ([]sdk.PipelineBuild, error) {\n\tpbs := []sdk.PipelineBuild{}\n\tquery := fmt.Sprintf(LoadPipelineBuildRequest, \"\", \"pbTriggerFrom.pipeline_id = $1 AND pbTriggerFrom.build_number = $2 AND pbTriggerFrom.application_id = $3 AND pbTriggerFrom.environment_id = $4\", \"\")\n\n\trows, err := db.Query(query, pipelineID, buildNumber, applicationID, environmentID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar pb sdk.PipelineBuild\n\t\terr = scanPbShort(&pb, rows)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbs = append(pbs, pb)\n\t}\n\n\treturn pbs, nil\n}", "title": "" }, { "docid": "a48e832a56c43af629c177f05b148acc", "score": "0.48043537", "text": "func (p *PrintingKubeClient) Build(_ io.Reader, _ bool) (kube.ResourceList, error) {\n\treturn []*resource.Info{}, nil\n}", "title": "" }, { "docid": "fb1d20132252f1420acca32812abcf5d", "score": "0.4775604", "text": "func Build() error {\n\tif err := clearDistFolder(); err != nil {\n\t\treturn err\n\t}\n\tdata, err := prepareData()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := index(data); err != nil {\n\t\treturn err\n\t}\n\tif err := stories(data); err != nil {\n\t\treturn err\n\t}\n\tif _, err := offline(); err != nil {\n\t\treturn err\n\t}\n\tif _, err := favourites(); err != nil {\n\t\treturn err\n\t}\n\tif err := snowpack.RunBuild(); err != nil {\n\t\treturn err\n\t}\n\tif err := saveBuildTimeToDisk(); err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"Done building!\")\n\treturn nil\n}", "title": "" }, { "docid": "925ea01c50710b63a9bb25c029b8844a", "score": "0.47605717", "text": "func (client StaticSitesClient) GetStaticSiteBuildsResponder(resp *http.Response) (result StaticSiteBuildCollection, 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": "4b74b631f0a81005efd0dd6841c600a3", "score": "0.47553948", "text": "func (d *localDB) getBuildsForCommits(commits []string, ignore map[string]bool, stop <-chan struct{}) (map[string][]*Build, error) {\n\trv := map[string][]*Build{}\n\tif err := d.view(\"GetBuildsForCommits\", func(tx *bolt.Tx) error {\n\t\tcursor := tx.Bucket(BUCKET_BUILDS_BY_COMMIT).Cursor()\n\t\tfor _, c := range commits {\n\t\t\tif err := checkInterrupt(stop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tids := []BuildID{}\n\t\t\tfor k, v := cursor.Seek([]byte(c)); bytes.HasPrefix(k, []byte(c)); k, v = cursor.Next() {\n\t\t\t\tif err := checkInterrupt(stop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tids = append(ids, v)\n\t\t\t}\n\t\t\tif err := checkInterrupt(stop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuilds, err := getBuilds(tx, ids, stop)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trv[c] = builds\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn rv, nil\n}", "title": "" } ]
4855405680eff1a64c76513d0c890c88
GetCreateParentDir returns the value of the CreateParentDir flag.
[ { "docid": "bf21b1ccadc371bf4867b7ee3c4c4b48", "score": "0.782188", "text": "func (params TransferHandler) GetCreateParentDir() bool {\n\tvar err *C.GError\n\n\tret := C.gfalt_get_create_parent_dir(params.cParams, &err)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn ret != 0\n}", "title": "" } ]
[ { "docid": "4b6fe34faa978e2b09e6930fdc885b0c", "score": "0.61988914", "text": "func (params TransferHandler) SetCreateParentDir(create bool) GError {\n\tvar err *C.GError\n\n\tvar cCreate C.gboolean\n\tif create {\n\t\tcCreate = 1\n\t}\n\n\tret := C.gfalt_set_create_parent_dir(params.cParams, cCreate, &err)\n\tif ret < 0 {\n\t\treturn errorCtoGo(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c2a08fe2bed625e0a402625df705aae", "score": "0.5780071", "text": "func GetParentDir(fullPath string, steps int) string {\n\tfullPath = filepath.Clean(fullPath)\n\tfor ; steps > 0; steps-- {\n\t\tfullPath = filepath.Dir(fullPath)\n\t}\n\treturn fullPath\n}", "title": "" }, { "docid": "7349a3c558a0f1b90f2cac7c1d8270bc", "score": "0.57642597", "text": "func (o *ApiKeyCreationReqWeb) GetParentId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.ParentId\n}", "title": "" }, { "docid": "54019d3c36755a02a3698092737866d0", "score": "0.5606931", "text": "func CreateParentFolder(fileName string) error {\n\tdirName := filepath.Dir(fileName)\n\tif _, statErr := os.Stat(dirName); statErr != nil {\n\t\tcreateErr := os.MkdirAll(dirName, os.ModePerm)\n\t\tif createErr != nil {\n\t\t\treturn createErr\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2928cda2c9a56a56a4463e18921f9caf", "score": "0.55310583", "text": "func GetParentPath() (string, error) {\n\texecPath, err := os.Executable()\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// if it's \"go run\", return simple \"..\"\n\tif execPath[:5] == \"/var/\" {\n\t\treturn \"..\", nil\n\t}\n\n\treturn filepath.Dir(filepath.Dir(execPath)), nil\n}", "title": "" }, { "docid": "113f939d1279f4825f65a6b1464558b3", "score": "0.5298313", "text": "func (o *UserDTO) GetParentGroupId() string {\n\tif o == nil || o.ParentGroupId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ParentGroupId\n}", "title": "" }, { "docid": "12ebdc3629813f03fc1a848d91b2612e", "score": "0.52865624", "text": "func (p ParentLocators) GetRelativeParentPath() string {\n\treturn p.getParentPath(PlatformCodeW2Ru)\n}", "title": "" }, { "docid": "e2f77f32e5f4304bf3398057021f0345", "score": "0.52854514", "text": "func (o *ApiKeyCreationReqWeb) GetParentIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.ParentId, true\n}", "title": "" }, { "docid": "c29cca1d5d4c685fd7e7e3fd39409ae1", "score": "0.5247689", "text": "func ExeParentDir() string {\n\tdir := \"\"\n\tif !RunningTest() {\n\t\t// Get path to the executable\n\t\t// The executable is in the path\n\t\texePath, err := os.Executable()\n\t\tif err != nil {\n\t\t\tpanic(\"Could not get current directorty\")\n\t\t}\n\t\t// fmt.Println(exePath)\n\t\t// Get path without executable in path\n\t\tbaseDir := filepath.Dir(exePath)\n\t\t// Get parent of the executable dir\n\t\tdir = filepath.Dir(baseDir)\n\t}\n\treturn dir\n}", "title": "" }, { "docid": "29db66177842336bd3db09b6dcf9f64b", "score": "0.52289146", "text": "func (p ParentLocators) GetAbsoluteParentPath() string {\n\treturn p.getParentPath(PlatformCodeW2Ku)\n}", "title": "" }, { "docid": "7904960f1ef9181c3df9e094ff05b62f", "score": "0.5190219", "text": "func MkParentDir(fpath string) error {\n\tdirPath := filepath.Dir(fpath)\n\tif !IsDir(dirPath) {\n\t\treturn os.MkdirAll(dirPath, 0775)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bbc26d963b62dc057cc262712313bb0b", "score": "0.5143116", "text": "func (p *Parent) GetParent() *uuid.UUID {\n\treturn p.ID\n}", "title": "" }, { "docid": "cf02ef6d8bc523e67f30b266dd180830", "score": "0.5100735", "text": "func (o *ViewTask) GetParentTaskId() int32 {\n\tif o == nil || o.ParentTaskId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.ParentTaskId\n}", "title": "" }, { "docid": "cad5166431620df054a2b832afc4ee88", "score": "0.50960696", "text": "func (o *LabelDTO) GetParentGroupId() string {\n\tif o == nil || o.ParentGroupId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ParentGroupId\n}", "title": "" }, { "docid": "90e7f7c949d7ece732aabd4fdcb76981", "score": "0.4921926", "text": "func (recv *Window) GetParent() *Window {\n\tretC := C.gdk_window_get_parent((*C.GdkWindow)(recv.native))\n\tretGo := WindowNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6975b1cf43f85bc4864a31a7f738b9df", "score": "0.48806396", "text": "func (rdp *referenceDomainProxy) GetParent() object.Parent {\n\treturn rdp.instance.GetParent()\n}", "title": "" }, { "docid": "1f9120f1935001f908e926ad80b320c6", "score": "0.48763627", "text": "func getCgroupParent() (string, error) {\n\tcgMap, err := cgroups.ParseCgroupFile(\"/proc/self/cgroup\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tglog.V(6).Infof(\"found cgroup values map: %v\", cgMap)\n\treturn extractParentFromCgroupMap(cgMap)\n}", "title": "" }, { "docid": "2e4f007d5314534fd30fe06a6c80fb1c", "score": "0.48742554", "text": "func (o *VirtualizationVmwareDatacenterAllOf) GetParentFolder() VirtualizationVmwareFolderRelationship {\n\tif o == nil || o.ParentFolder == nil {\n\t\tvar ret VirtualizationVmwareFolderRelationship\n\t\treturn ret\n\t}\n\treturn *o.ParentFolder\n}", "title": "" }, { "docid": "86a512daf910221a9ca480f50449ed22", "score": "0.4865842", "text": "func (o *ViewProjectCategory) GetParentOk() (*ViewRelationship, bool) {\n\tif o == nil || o.Parent == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Parent, true\n}", "title": "" }, { "docid": "fa9031c54c5207b017490a4628a243c1", "score": "0.48345616", "text": "func (image *image) ParentId() (string, error) {\n\tcmd := &getParentId{image: image}\n\tcontent, err := utils.RunCmdOutput(cmd)\n\treturn strings.Trim(string(content), \"\\n\"), err\n}", "title": "" }, { "docid": "757a2574fecaab92208d86829119f222", "score": "0.483426", "text": "func (t *Tree) calcEphemeralParent(parking, ephemeralNode node) (parent, lChild, rChild node) {\n\tswitch {\n\tcase !parking.IsEmpty() && !ephemeralNode.IsEmpty():\n\t\tlChild, rChild = parking, ephemeralNode\n\n\tcase !parking.IsEmpty() && ephemeralNode.IsEmpty():\n\t\tlChild, rChild = parking, PaddingValue\n\n\tcase parking.IsEmpty() && !ephemeralNode.IsEmpty():\n\t\tlChild, rChild = ephemeralNode, PaddingValue\n\n\tdefault: // both are empty\n\t\treturn EmptyNode, EmptyNode, EmptyNode\n\t}\n\treturn t.calcParent(nil, lChild, rChild), lChild, rChild\n}", "title": "" }, { "docid": "87328f3857cf5e54a3490c0698c7beea", "score": "0.48331973", "text": "func (fd *FileDescriptor) GetParent() Descriptor {\n\treturn nil\n}", "title": "" }, { "docid": "e0ac54241d4655fd8773e60bcae6e266", "score": "0.48323196", "text": "func (recv *Window) GetEffectiveParent() *Window {\n\tretC := C.gdk_window_get_effective_parent((*C.GdkWindow)(recv.native))\n\tretGo := WindowNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "62279aafe2ec22aa55420c2478a85570", "score": "0.4830939", "text": "func (gh *GenericHardware) GetParent() string {\n\treturn gh.Parent\n}", "title": "" }, { "docid": "0bedc0c66d40f831b7bfb69ff7456b7d", "score": "0.4811652", "text": "func (fd *FieldDescriptor) GetParent() Descriptor {\n\treturn fd.parent\n}", "title": "" }, { "docid": "f6a5866609520283069a49071deb167e", "score": "0.47893772", "text": "func (r *RamFs) getParent(startID uint64) (uint64, error) {\n\tif startID == 0 {\n\t\treturn 0, errors.New(\"root directory has no parent\")\n\t}\n\tfor p, c := range r.dirTable {\n\t\tfor _, child := range c {\n\t\t\tif child == startID {\n\t\t\t\treturn p, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn 0, errors.New(\"very bad error condition: startID not in any directory?\")\n}", "title": "" }, { "docid": "53b30fd002b0852eca40c1eaa72286dc", "score": "0.47876477", "text": "func (e *Event) GetParent() *Event {\n\tif e.Parent == nil {\n\t\treturn nil\n\t}\n\treturn &Event{\n\t\te.Parent,\n\t}\n}", "title": "" }, { "docid": "fe469d096dc334a95aa74c37a8f82480", "score": "0.4778401", "text": "func (inst *instance) ParentID() int {\n\treturn inst.parentID\n}", "title": "" }, { "docid": "88a69664e3524ad1fcf1f7e9ef3efabc", "score": "0.4766281", "text": "func (evt *BlockMove) PrevParentId() (ret string) {\n\tif p := evt.Get(\"oldParentId\"); p.Bool() {\n\t\tret = p.String()\n\t}\n\treturn\n}", "title": "" }, { "docid": "d9245f5424b2942558fa5b0d781b41b9", "score": "0.47642145", "text": "func (o FirewallPolicyOutput) ParentId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FirewallPolicy) pulumi.StringPtrOutput { return v.ParentId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a527d7e273efe89a7fd1c31fed3c371e", "score": "0.47454718", "text": "func createParentDirsIfRequired(filename string) error {\n\tdir := filepath.Dir(filename)\n\tif dir == \"\" {\n\t\treturn nil\n\t}\n\treturn os.MkdirAll(dir, 0755)\n}", "title": "" }, { "docid": "22e617f9cbf0306cfa44f824e3445400", "score": "0.47415656", "text": "func (s *Service) ParentFolder(id string) *Entry {\n\treturn &Entry{\n\t\tsvc: s,\n\t\tf: &drive.File{Id: id},\n\t}\n}", "title": "" }, { "docid": "cb51054f7d539921db58b84c97b929c6", "score": "0.47389662", "text": "func (o *ViewTask) GetParentTaskIdOk() (*int32, bool) {\n\tif o == nil || o.ParentTaskId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentTaskId, true\n}", "title": "" }, { "docid": "5698eeefc743e05c4f745d6e8cab559f", "score": "0.4734338", "text": "func (o *VirtualizationVmwareDatacenterAllOf) GetParentFolderOk() (*VirtualizationVmwareFolderRelationship, bool) {\n\tif o == nil || o.ParentFolder == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentFolder, true\n}", "title": "" }, { "docid": "d0aed06632217c5f9bc8f4c5662b5eff", "score": "0.47333148", "text": "func (s *CSGShape) GetParent() primitives.Shape {\n\treturn s.Parent\n}", "title": "" }, { "docid": "46073895f21d95e0073a2f6e5e2727cd", "score": "0.47202244", "text": "func (e *Environment) GetParent(parent ObjectType) *Object {\n\treturn e.GetClass(parent)\n}", "title": "" }, { "docid": "563da62fddf7c832dd0cb716c4d8cf0f", "score": "0.47175652", "text": "func Parent(names ...string) func(tc Context) (string, error) {\n\treturn func(tc Context) (string, error) {\n\t\twd, err := tc.Abs(\"\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tfor _, name := range names {\n\t\t\tif dir, err := traverse(wd, name); err == nil {\n\t\t\t\treturn dir, nil\n\t\t\t}\n\t\t}\n\t\tformattedNames := fmt.Sprintf(\"%#v\", names)\n\t\tformattedNames = strings.TrimPrefix(formattedNames, \"[]string{\")\n\t\tformattedNames = strings.TrimSuffix(formattedNames, \"}\")\n\t\treturn \"\", errors.New(\"could not find parent directory containing any of: \" + formattedNames)\n\t}\n}", "title": "" }, { "docid": "7bab5c34168ac4f556e0fed16b29a2a3", "score": "0.46903083", "text": "func (o *ViewProjectCategory) GetParentId() int32 {\n\tif o == nil || o.ParentId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.ParentId\n}", "title": "" }, { "docid": "1be027e4ce46eb4f710718ab543982b1", "score": "0.46902066", "text": "func (md *MessageDescriptor) GetParent() Descriptor {\n\treturn md.parent\n}", "title": "" }, { "docid": "5dfaacc6e01b81e73bc1a2c50c1bbb16", "score": "0.46725258", "text": "func (oh *OutputHierarchy) CreateParentDirectories(d BuildDirectory) error {\n\tdPath := newPathBuffer()\n\treturn oh.root.createParentDirectories(d, &dPath)\n}", "title": "" }, { "docid": "15b82d69c919ac1a2b66900e0c1b6a6c", "score": "0.46554613", "text": "func (o *UserDTO) GetParentGroupIdOk() (*string, bool) {\n\tif o == nil || o.ParentGroupId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentGroupId, true\n}", "title": "" }, { "docid": "efdd4b80700bde0ea2ab89e8d88c3ca7", "score": "0.46544698", "text": "func (p *Tag) Parent() (*Tag, bool) {\n\tif p.parent != nil {\n\t\treturn p.parent, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "ec89bba312645be2c0242ba43f6c32a4", "score": "0.4652193", "text": "func (c *Commit) ParentID(n int) (SHA1, error) {\n\tif n >= len(c.Parents) {\n\t\treturn SHA1{}, ErrNotExist{\"\", \"\"}\n\t}\n\treturn c.Parents[n], nil\n}", "title": "" }, { "docid": "813fda37d87cd46c45ce1f5059624839", "score": "0.4649743", "text": "func (o *Object) ParentID() string {\n\treturn o.parent\n}", "title": "" }, { "docid": "d17e5935a2c0dcff1e5324397b951b77", "score": "0.46346396", "text": "func parentName(path string) string {\n\treturn filepath.Base(filepath.Dir(path))\n}", "title": "" }, { "docid": "e6a1f7490f055af5d3547cb9c91c8708", "score": "0.46265543", "text": "func (t *Tree) calcParent(buf []byte, lChild, rChild node) node {\n\treturn node{\n\t\tvalue: t.hash(buf, lChild.value, rChild.value),\n\t\tOnProvenPath: lChild.OnProvenPath || rChild.OnProvenPath,\n\t}\n}", "title": "" }, { "docid": "43545c06140ead91789b5ba3c35e5019", "score": "0.46193656", "text": "func (o *DhcpAclentryDataData) GetSmartParentId() string {\n\tif o == nil || o.SmartParentId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SmartParentId\n}", "title": "" }, { "docid": "ac83bb56f46f8c90f20eb69670fd9e49", "score": "0.46165484", "text": "func (on *outputNode) createParentDirectories(d BuildDirectory, dPath *pathBuffer) error {\n\tdPath.enter()\n\tdefer dPath.leave()\n\n\tfor _, name := range on.getSubdirectoryNames() {\n\t\tdPath.setLastComponent(name)\n\t\tif err := d.Mkdir(name, 0777); err != nil && !os.IsExist(err) {\n\t\t\treturn util.StatusWrapf(err, \"Failed to create output parent directory %#v\", dPath.join())\n\t\t}\n\n\t\t// Recurse if we need to create one or more directories within.\n\t\tif child := on.subdirectories[name]; len(child.subdirectories) > 0 || len(child.directoriesToUpload) > 0 {\n\t\t\tchildDirectory, err := d.EnterBuildDirectory(name)\n\t\t\tif err != nil {\n\t\t\t\treturn util.StatusWrapf(err, \"Failed to enter output parent directory %#v\", dPath.join())\n\t\t\t}\n\t\t\terr = child.createParentDirectories(childDirectory, dPath)\n\t\t\tchildDirectory.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Although REv2 explicitly documents that only parents of\n\t// output directories are created (i.e., not the output\n\t// directory itself), Bazel changed its behaviour and now\n\t// creates output directories when using local execution. See\n\t// these issues for details:\n\t//\n\t// https://github.com/bazelbuild/bazel/issues/6262\n\t// https://github.com/bazelbuild/bazel/issues/6393\n\t//\n\t// Considering that the 'output_directories' field is deprecated\n\t// in REv2.1 anyway, be consistent with Bazel's local execution.\n\t// Once Bazel switches to REv2.1, it will be forced to solve\n\t// this matter in a protocol conforming way.\n\tfor _, name := range sortToUpload(on.directoriesToUpload) {\n\t\tif _, ok := on.subdirectories[name]; !ok {\n\t\t\tdPath.setLastComponent(name)\n\t\t\tif err := d.Mkdir(name, 0777); err != nil && !os.IsExist(err) {\n\t\t\t\treturn util.StatusWrapf(err, \"Failed to create output directory %#v\", dPath.join())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52e5c946d9f05cd71c7120e6df317597", "score": "0.46129835", "text": "func (r *Request) ParentMessageID() string {\n\treturn r.parentMessageID\n}", "title": "" }, { "docid": "e3021a5128eccdc2a9cd3de3960fd198", "score": "0.46101296", "text": "func (o MetadataOutput) ParentId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Metadata) pulumi.StringOutput { return v.ParentId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6ce42e3983a7985ddf556b9068dfdc11", "score": "0.45868215", "text": "func (k *LibKBFS) CreateDir(u User, parentDir Node, name string) (dir Node, err error) {\n\tconfig := u.(*libkbfs.ConfigLocal)\n\tkbfsOps := config.KBFSOps()\n\tctx, cancel := k.newContext(u)\n\tdefer cancel()\n\tn := parentDir.(libkbfs.Node)\n\tdir, _, err = kbfsOps.CreateDir(ctx, n, n.ChildName(name))\n\tif err != nil {\n\t\treturn dir, err\n\t}\n\tk.refs[config][dir.(libkbfs.Node)] = true\n\treturn dir, nil\n}", "title": "" }, { "docid": "68592f50a4816675fe9e01a7cd3f1931", "score": "0.45705044", "text": "func (p *Step) ParentStep() (*Step, bool) {\n\tif p.parentStep != nil {\n\t\treturn p.parentStep, true\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "2de16c3417aa02834a82b49512cc9eee", "score": "0.45702103", "text": "func Getparentdirectory(path string, level int) string {\n\treturn strings.Join(strings.Split(path, \"/\")[0:len(strings.Split(path, \"/\"))-level], \"/\")\n}", "title": "" }, { "docid": "15b1c60463a20ff7020e8f0fc874dff2", "score": "0.45650083", "text": "func (o *LabelDTO) GetParentGroupIdOk() (*string, bool) {\n\tif o == nil || o.ParentGroupId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentGroupId, true\n}", "title": "" }, { "docid": "6d32597ab838346206eb1177d8391637", "score": "0.45557854", "text": "func (m *DeptMutation) ParentID() (id uint, exists bool) {\n\tif m.parent != nil {\n\t\treturn *m.parent, true\n\t}\n\treturn\n}", "title": "" }, { "docid": "f35e2e92bcfba1080ecee7f824b32035", "score": "0.45489097", "text": "func CfdGoCreateExtkeyFromParentPath(handle uintptr, extkey string, path string, networkType int, keyType int) (childExtkey string, err error) {\n\tret := CfdCreateExtkeyFromParentPath(handle, extkey, path, networkType, keyType, &childExtkey)\n\terr = convertCfdError(ret, handle)\n\treturn childExtkey, err\n}", "title": "" }, { "docid": "e1cb528d15d99d54410aedcc2cc391eb", "score": "0.45476466", "text": "func (o AccountOutput) ParentId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Account) pulumi.StringOutput { return v.ParentId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae07e0a49d302cf2fc01ad6e6896300c", "score": "0.454407", "text": "func (o *ViewProjectCategory) GetParentIdOk() (*int32, bool) {\n\tif o == nil || o.ParentId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentId, true\n}", "title": "" }, { "docid": "8c5ab2c7bab4f39763d3019576d1a371", "score": "0.45436513", "text": "func (o DashboardPermissionsPtrOutput) Parent() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DashboardPermissions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Parent\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "14bd53fd53b4e31b3a69f617237d5c9e", "score": "0.45383826", "text": "func (o *ListPermissionRequiredByPermissionParams) SetParentID(parentID string) {\n\to.ParentID = parentID\n}", "title": "" }, { "docid": "57118c1b75e944fc8baacf87443ace66", "score": "0.4529299", "text": "func (recv *Class) GetParent() *Class {\n\tretC := C.jsc_class_get_parent((*C.JSCClass)(recv.native))\n\tretGo := ClassNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "426083b9d59642c5b64fece968229507", "score": "0.45267797", "text": "func WithPodCgroupParent(path string) PodCreateOption {\n\treturn func(pod *Pod) error {\n\t\tif pod.valid {\n\t\t\treturn define.ErrPodFinalized\n\t\t}\n\n\t\tpod.config.CgroupParent = path\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1273838e2cfbb222090273fcf29a8aae", "score": "0.4519301", "text": "func (s *FixtState) ParentValue() interface{} {\n\treturn s.entityRoot.cfg.FixtValue\n}", "title": "" }, { "docid": "aa783aff39c6982b554826de3ddab1da", "score": "0.45183915", "text": "func parentIDForRequest(dirID string) string {\n\tif dirID == \"root\" {\n\t\treturn \"\"\n\t}\n\treturn dirID\n}", "title": "" }, { "docid": "23a386d21f448bec082490a1f9245288", "score": "0.45138764", "text": "func (s deviceSysPath) getParent() (string, bool) {\n\tparts := strings.Split(s.SysPath, \"/\")\n\n\tfor i, part := range parts {\n\t\tif part == BlockSubSystem {\n\t\t\treturn parts[i+1], true\n\t\t}\n\t}\n\n\tfor i, part := range parts {\n\t\tif part == NVMeSubSystem {\n\t\t\treturn parts[i+2], true\n\t\t}\n\t}\n\n\treturn \"\", false\n}", "title": "" }, { "docid": "f5881e90599c0fe89696d36987fc304b", "score": "0.4508244", "text": "func (s *storager) parent(location string, dirMode os.FileMode) (*Folder, error) {\n\troot := s.Root\n\tparentPath, _ := path.Split(location)\n\treturn root.Folder(parentPath, dirMode)\n}", "title": "" }, { "docid": "64651ff9a6940c2f9710b5b8db9662bc", "score": "0.4507335", "text": "func (n *Component) Parent() *Component_Parent {\n\treturn &Component_Parent{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"parent\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "64651ff9a6940c2f9710b5b8db9662bc", "score": "0.45070776", "text": "func (n *Component) Parent() *Component_Parent {\n\treturn &Component_Parent{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"parent\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "26b3fc61e4008a979a650f2397d454e2", "score": "0.45033044", "text": "func (smc *SysMenuCreate) SetParentPath(s string) *SysMenuCreate {\n\tsmc.mutation.SetParentPath(s)\n\treturn smc\n}", "title": "" }, { "docid": "060bc7e12d12a1b3ce26e697e3a97e0e", "score": "0.44992602", "text": "func (o *ViewProjectCategory) HasParent() bool {\n\tif o != nil && o.Parent != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c52de23e611170be5c1f871cdd059e48", "score": "0.44904006", "text": "func ParentProcName() (string, error) {\n\tppid := os.Getppid()\n\tbs, err := ioutil.ReadFile(fmt.Sprintf(processNameFormat, ppid))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(bs)), nil\n}", "title": "" }, { "docid": "a208837ff4fc78196c418744e411dca4", "score": "0.44876125", "text": "func (lc *LocationCreate) SetParent(l *Location) *LocationCreate {\n\treturn lc.SetParentID(l.ID)\n}", "title": "" }, { "docid": "0a5a6abb775e558fdb2bec28f58c6055", "score": "0.44865116", "text": "func (c *Client) GetParentOrder(ctx context.Context, parentOrderID string, parentOrderAcceptanceID string) (*GetParentOrderOutput, error) {\n\tif len(parentOrderID) != 0 && len(parentOrderAcceptanceID) != 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"do not input both parentOrderID and parentOrderAcceptanceID. parentOrpderID=%s, parentOrderAcceptanceID=%s\",\n\t\t\tparentOrderID,\n\t\t\tparentOrderAcceptanceID,\n\t\t)\n\t}\n\n\tif len(parentOrderID) == 0 && len(parentOrderAcceptanceID) == 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"input either parentOrderID or parentOrderAcceptanceID. parentOrderID=%s, parentOrderAcceptanceID=%s\",\n\t\t\tparentOrderID,\n\t\t\tparentOrderAcceptanceID,\n\t\t)\n\t}\n\n\treq, err := c.NewRequest(ctx, \"GET\", \"getparentorder\", nil, nil, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(parentOrderID) != 0 {\n\t\tq := req.URL.Query()\n\t\tq.Add(\"parent_order_id\", parentOrderID)\n\n\t\treq.URL.RawQuery = q.Encode()\n\t}\n\n\tif len(parentOrderAcceptanceID) != 0 {\n\t\tq := req.URL.Query()\n\t\tq.Add(\"parent_order_acceptance_id\", parentOrderAcceptanceID)\n\n\t\treq.URL.RawQuery = q.Encode()\n\t}\n\n\tres, err := c.Do(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutput := GetParentOrderOutput{}\n\tif err := decodeBody(res, &output.ParentOrderDetails); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &output, nil\n}", "title": "" }, { "docid": "43b395a26130093ac01d6764a8b86d9b", "score": "0.44815773", "text": "func (o *MetaDefinition) GetParentClass() string {\n\tif o == nil || o.ParentClass == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ParentClass\n}", "title": "" }, { "docid": "ca17c2c0b084fc91b8f9633aa46f17dc", "score": "0.44704613", "text": "func (sd *ServiceDescriptor) GetParent() Descriptor {\n\treturn sd.file\n}", "title": "" }, { "docid": "56dde0a9a020a73c5820e03551bd15c0", "score": "0.44685933", "text": "func (cyl *Cylinder) GetParent() Shape {\n\treturn cyl.parent\n}", "title": "" }, { "docid": "71f9ccd53337b6969590cfda5f14e149", "score": "0.44682068", "text": "func (lc *LocationCreate) SetParentID(id string) *LocationCreate {\n\tif lc.parent == nil {\n\t\tlc.parent = make(map[string]struct{})\n\t}\n\tlc.parent[id] = struct{}{}\n\treturn lc\n}", "title": "" }, { "docid": "15eef97ac6811b4a4885f381da6eb2e6", "score": "0.44616908", "text": "func (o DocumentOutput) ParentDocumentId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Document) pulumi.StringOutput { return v.ParentDocumentId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e9478da4f50b010c9d77b63ae8006ba3", "score": "0.44475603", "text": "func (o GroupOutput) ParentName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Group) pulumi.StringOutput { return v.ParentName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "398ad1fc63d901620a3e3fb4f6f66c6a", "score": "0.4445706", "text": "func (o DashboardPermissionsOutput) Parent() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DashboardPermissions) *string { return v.Parent }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6bfd88ef39abf88e05af947aadb65abb", "score": "0.4444616", "text": "func (fmc *FlowMilestoneCreate) SetParent(f *FlowPeriod) *FlowMilestoneCreate {\n\treturn fmc.SetParentID(f.ID)\n}", "title": "" }, { "docid": "e3001ed8a40e427b25efc241f38e559a", "score": "0.4444597", "text": "func WithPodParent() PodCreateOption {\n\treturn func(pod *Pod) error {\n\t\tif pod.valid {\n\t\t\treturn define.ErrPodFinalized\n\t\t}\n\n\t\tpod.config.UsePodCgroup = true\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "25928b318bcdd2d3658b448d59996264", "score": "0.44435763", "text": "func (c *Cmd) Parent() *Cmd {\n\treturn c.parent\n}", "title": "" }, { "docid": "b0723d74d4bc0a0bbc70bb17b996cba5", "score": "0.4433457", "text": "func (smc *SysMenuCreate) SetParentID(s string) *SysMenuCreate {\n\tsmc.mutation.SetParentID(s)\n\treturn smc\n}", "title": "" }, { "docid": "85cfe59a8fea2a3f6642b9d1cde37b0e", "score": "0.44212762", "text": "func WithCgroupParent(parent string) CtrCreateOption {\n\treturn func(ctr *Container) error {\n\t\tif ctr.valid {\n\t\t\treturn define.ErrCtrFinalized\n\t\t}\n\n\t\tif parent == \"\" {\n\t\t\treturn fmt.Errorf(\"cgroup parent cannot be empty: %w\", define.ErrInvalidArg)\n\t\t}\n\n\t\tctr.config.CgroupParent = parent\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "b82cee3c5629be4e81698671e0f85b38", "score": "0.44207668", "text": "func (context *resolveContext) getParentTfVarsDir() (interface{}, error) {\n\tparentPath, err := context.pathRelativeFromInclude()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcurrentPath := filepath.Dir(context.options.TerragruntConfigPath)\n\tparentPath, err = filepath.Abs(filepath.Join(currentPath, parentPath.(string)))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.ToSlash(parentPath.(string)), nil\n}", "title": "" }, { "docid": "196e8e04c8686db35e6f3549b34143aa", "score": "0.44189042", "text": "func (o *ViewProjectCategory) GetParent() ViewRelationship {\n\tif o == nil || o.Parent == nil {\n\t\tvar ret ViewRelationship\n\t\treturn ret\n\t}\n\treturn *o.Parent\n}", "title": "" }, { "docid": "8456e879abd99ddfab48863c97ebf5a0", "score": "0.4412831", "text": "func WithCreateWorkingDir() CtrCreateOption {\n\treturn func(ctr *Container) error {\n\t\tif ctr.valid {\n\t\t\treturn define.ErrCtrFinalized\n\t\t}\n\n\t\tctr.config.CreateWorkingDir = true\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a55ae6a2c03499b7a05863044f0fccd6", "score": "0.44127724", "text": "func (o *GetDeploymentEventsUsingGETParams) SetParentID(parentID *strfmt.UUID) {\n\to.ParentID = parentID\n}", "title": "" }, { "docid": "f44c335bda8c675923505a97365bdfc3", "score": "0.44074896", "text": "func NewParentProcess(tty bool, volume, containerId, imgName string, envs []string) (*exec.Cmd, *os.File, error) {\n\tchildInitRp, parentInitWp, err := NewPipe()\n\tif err != nil {\n\t\tlog.Errorf(\"new pipe: %v\", err)\n\t\treturn nil, nil, errors.Wrap(err, \"new init pipe\")\n\t}\n\n\tcmd := exec.Command(\"/proc/self/exe\", \"init\")\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tCloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWNS |\n\t\t\tsyscall.CLONE_NEWNET | syscall.CLONE_NEWIPC,\n\t}\n\tif tty {\n\t\tcmd.Stdin = os.Stdin\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t} else {\n\t\t// mount stdout of container into /var/run/q.container/<containerId>/container.log\n\t\tdirURL := fmt.Sprintf(DefaultInfoLocation, containerId)\n\t\tif utils.IsNotExist(dirURL) {\n\t\t\tif err := os.MkdirAll(dirURL, 0622); err != nil {\n\t\t\t\treturn nil, nil, errors.Errorf(\"mkdir: %s: %v\", dirURL, err)\n\t\t\t}\n\t\t}\n\t\tcontainerStdLogFilePath := dirURL + LogFileName\n\t\tcontainerStdLogFile, err := os.Create(containerStdLogFilePath)\n\t\tif err != nil {\n\t\t\treturn nil, nil, errors.Errorf(\"create: %s: %v\", containerStdLogFilePath, err)\n\t\t}\n\t\tcmd.Stdout = containerStdLogFile\n\t}\n\n\tcmd.Env = append(os.Environ(), envs...)\n\n\tcmd.ExtraFiles = []*os.File{childInitRp}\n\tcmd.Env = append(cmd.Env,\n\t\t\"_QCONTAINER_INITPIPE=\"+strconv.Itoa(stdioFdCount+len(cmd.ExtraFiles)-1),\n\t)\n\n\tmntUrl, err := NewWorkSpace(volume, imgName, containerId)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"new workspace\")\n\t}\n\tcmd.Dir = mntUrl\n\treturn cmd, parentInitWp, nil\n}", "title": "" }, { "docid": "b201ece4787af3eeac7907f0c8a9fe24", "score": "0.44059235", "text": "func (o *ViewTask) GetParentTaskOk() (*ViewRelationship, bool) {\n\tif o == nil || o.ParentTask == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentTask, true\n}", "title": "" }, { "docid": "72fafe2beb0c7d0a115fd928e1c8fdd3", "score": "0.44029018", "text": "func ParentEUID() int {\n\treturn -1\n}", "title": "" }, { "docid": "eedf3ea52af0d01f1615fac2dc9b98f2", "score": "0.44016457", "text": "func (jbobject *JavaLangClassLoader) GetParent() *JavaLangClassLoader {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"getParent\", \"java/lang/ClassLoader\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tretconv := javabind.NewJavaToGoCallable()\n\tdst := &javabind.Callable{}\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\tunique_x := &JavaLangClassLoader{}\n\tunique_x.Callable = dst\n\treturn unique_x\n}", "title": "" }, { "docid": "22bf9ff68921411ff07f77184167ee57", "score": "0.4400257", "text": "func (tools *Tools) ParentNode(child js.Value) js.Value {\n\treturn child.Get(\"parentNode\")\n}", "title": "" }, { "docid": "f8d19b0ade9ddca053f1f23ece7c51d5", "score": "0.43870306", "text": "func (m *ContentType) GetParentId()(*string) {\n return m.parentId\n}", "title": "" }, { "docid": "d6b4af09ce5caf5261d81be54cd614c7", "score": "0.438197", "text": "func (o *VirtualizationVmwareDatacenterAllOf) HasParentFolder() bool {\n\tif o != nil && o.ParentFolder != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0414d3bac9283b841eaef85b51f5cd59", "score": "0.43783277", "text": "func (ed *EnumDescriptor) GetParent() Descriptor {\n\treturn ed.parent\n}", "title": "" }, { "docid": "fefb33fe467120c36f7fe7386324a478", "score": "0.43782857", "text": "func (n *Node) GetParent() (*Node, error) {\n\tif n.parent == nil {\n\t\treturn nil, errors.New(\"No parent node found\")\n\t}\n\treturn n.parent, nil\n}", "title": "" }, { "docid": "1241924e8b2414af9313d070ccbf8cf8", "score": "0.43705887", "text": "func (o *DhcpServer6DataData) GetSmartParentId() string {\n\tif o == nil || o.SmartParentId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SmartParentId\n}", "title": "" }, { "docid": "bdc68ec31ee87cb1e333bd6858c1e2fb", "score": "0.43675768", "text": "func (_class SessionClass) GetParent(sessionID SessionRef, self SessionRef) (_retval SessionRef, _err error) {\n\tif IsMock {\n\t\treturn _class.GetParentMock(sessionID, self)\n\t}\t\n\t_method := \"session.get_parent\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertSessionRefToXen(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 = convertSessionRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" } ]
952646437d208977f2b4ac6050eff3ef
OnDNSRequest implements the Service interface.
[ { "docid": "33d281bc8c158d723b14668e593c6acd", "score": "0.7861138", "text": "func (r *Riddler) OnDNSRequest(ctx context.Context, req *requests.DNSRequest) {\n\tcfg := ctx.Value(requests.ContextConfig).(*config.Config)\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif cfg == nil || bus == nil {\n\t\treturn\n\t}\n\n\tre := cfg.DomainRegex(req.Domain)\n\tif re == nil {\n\t\treturn\n\t}\n\n\tr.CheckRateLimit()\n\tbus.Publish(requests.SetActiveTopic, r.String())\n\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"Querying %s for %s subdomains\", r.String(), req.Domain))\n\n\turl := r.getURL(req.Domain)\n\tpage, err := http.RequestWebPage(url, nil, nil, \"\", \"\")\n\tif err != nil {\n\t\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"%s: %s: %v\", r.String(), url, err))\n\t\treturn\n\t}\n\n\tfor _, name := range re.FindAllString(page, -1) {\n\t\tbus.Publish(requests.NewNameTopic, &requests.DNSRequest{\n\t\t\tName: cleanName(name),\n\t\t\tDomain: req.Domain,\n\t\t\tTag: r.SourceType,\n\t\t\tSource: r.String(),\n\t\t})\n\t}\n}", "title": "" } ]
[ { "docid": "40a61cc8bdaed3ebf39f55a67403bc7e", "score": "0.798666", "text": "func (a *AlienVault) OnDNSRequest(ctx context.Context, req *requests.DNSRequest) {\n\tif !a.System().Config().IsDomainInScope(req.Domain) {\n\t\treturn\n\t}\n\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif bus == nil {\n\t\treturn\n\t}\n\n\ta.CheckRateLimit()\n\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"Querying %s for %s subdomains\", a.String(), req.Domain))\n\ta.executeDNSQuery(ctx, req)\n\n\ta.CheckRateLimit()\n\ta.executeURLQuery(ctx, req)\n}", "title": "" }, { "docid": "8f16de0cd06818933ca29679ca766fdf", "score": "0.7491047", "text": "func (u *Umbrella) OnDNSRequest(ctx context.Context, req *requests.DNSRequest) {\n\tcfg := ctx.Value(requests.ContextConfig).(*config.Config)\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif cfg == nil || bus == nil {\n\t\treturn\n\t}\n\n\tif u.API == nil || u.API.Key == \"\" {\n\t\treturn\n\t}\n\n\tif !cfg.IsDomainInScope(req.Domain) {\n\t\treturn\n\t}\n\n\tu.CheckRateLimit()\n\tbus.Publish(requests.SetActiveTopic, u.String())\n\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"Querying %s for %s subdomains\", u.String(), req.Domain))\n\n\theaders := u.restHeaders()\n\turl := u.restDNSURL(req.Domain)\n\tpage, err := http.RequestWebPage(url, nil, headers, \"\", \"\")\n\tif err != nil {\n\t\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"%s: %s: %v\", u.String(), url, err))\n\t\treturn\n\t}\n\t// Extract the subdomain names from the REST API results\n\tvar subs struct {\n\t\tMatches []struct {\n\t\t\tName string `json:\"name\"`\n\t\t} `json:\"matches\"`\n\t}\n\tif err := json.Unmarshal([]byte(page), &subs); err != nil {\n\t\treturn\n\t}\n\n\tfor _, m := range subs.Matches {\n\t\tif d := cfg.WhichDomain(m.Name); d != \"\" {\n\t\t\tbus.Publish(requests.NewNameTopic, &requests.DNSRequest{\n\t\t\t\tName: m.Name,\n\t\t\t\tDomain: d,\n\t\t\t\tTag: u.SourceType,\n\t\t\t\tSource: u.String(),\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "194c2c02243d196340e8aa02d36b7704", "score": "0.6364274", "text": "func (u *Umbrella) OnAddrRequest(ctx context.Context, req *requests.AddrRequest) {\n\tcfg := ctx.Value(requests.ContextConfig).(*config.Config)\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif cfg == nil || bus == nil {\n\t\treturn\n\t}\n\n\tif u.API == nil || u.API.Key == \"\" {\n\t\treturn\n\t}\n\n\tif req.Address == \"\" {\n\t\treturn\n\t}\n\n\tu.CheckRateLimit()\n\tbus.Publish(requests.SetActiveTopic, u.String())\n\n\theaders := u.restHeaders()\n\turl := u.restAddrURL(req.Address)\n\tpage, err := http.RequestWebPage(url, nil, headers, \"\", \"\")\n\tif err != nil {\n\t\tbus.Publish(requests.LogTopic, fmt.Sprintf(\"%s: %s: %v\", u.String(), url, err))\n\t\treturn\n\t}\n\t// Extract the subdomain names from the REST API results\n\tvar ip struct {\n\t\tRecords []struct {\n\t\t\tData string `json:\"rr\"`\n\t\t} `json:\"records\"`\n\t}\n\tif err := json.Unmarshal([]byte(page), &ip); err != nil {\n\t\treturn\n\t}\n\n\tfor _, record := range ip.Records {\n\t\tif name := resolvers.RemoveLastDot(record.Data); name != \"\" {\n\t\t\tif domain := cfg.WhichDomain(name); domain != \"\" {\n\t\t\t\tbus.Publish(requests.NewNameTopic, &requests.DNSRequest{\n\t\t\t\t\tName: name,\n\t\t\t\t\tDomain: req.Domain,\n\t\t\t\t\tTag: u.SourceType,\n\t\t\t\t\tSource: u.String(),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c847d674f9524cf0ae4ff49c2d3f1eb2", "score": "0.63569325", "text": "func (as *ASService) OnAddrRequest(ctx context.Context, req *requests.AddrRequest) {\n\tif r := as.sys.Cache().AddrSearch(req.Address); r != nil {\n\t\tas.Graph.InsertInfrastructure(r.ASN, r.Description, r.Address, r.Prefix, r.Source, r.Tag, as.uuid)\n\t\treturn\n\t}\n\n\tfor _, src := range as.sys.DataSources() {\n\t\tsrc.ASNRequest(ctx, &requests.ASNRequest{Address: req.Address})\n\t}\n\n\tfor i := 0; i < 30; i++ {\n\t\tif as.sys.Cache().AddrSearch(req.Address) != nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n\n\tif r := as.sys.Cache().AddrSearch(req.Address); r != nil && as.Graph != nil && as.uuid != \"\" {\n\t\tgo as.Graph.InsertInfrastructure(r.ASN, r.Description, r.Address, r.Prefix, r.Source, r.Tag, as.uuid)\n\t}\n}", "title": "" }, { "docid": "4a9a41916604315dfc61eed75dec1594", "score": "0.60306406", "text": "func (s *server) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {\n m := s.getMsgResource(req)\n\tdefer s.msgPool.EnQueue(m)\n\ttimeNow := time.Now().Local()\n\tq := req.Question[0]\n\tname := strings.ToLower(q.Name)\n\ttcp := false\n\tif tcp = isTCPQuery(w); tcp {\n\t\tatomic.AddInt64(&statsRequestCountTcp, 1)\n\t} else {\n\t\tatomic.AddInt64(&statsRequestCountUdp, 1)\n\t}\n\tatomic.AddInt64(&statsRequestCount, 1)\n\n\tglog.V(3).Infof(\"received DNS Request for %q from %q with type %d\", q.Name, w.RemoteAddr(), q.Qtype)\n\n\t// Check cache first.\n\tremoteAddr := w.RemoteAddr().String() //10.8.65.158:42158\n\tremoteIp := strings.Split(remoteAddr, \":\")\n\tm1 := s.rcache.SearchRecordInCache(q, tcp, m.Id, remoteIp[0], timeNow)\n\tif m1 != nil {\n\t\tatomic.AddInt64(&statsRequestCountCached, 1)\n\t\tglog.V(4).Infof(\"cache hit %q: %v\\n \", q.Name, m1)\n\t\ts.checkAndWtiteMsg(w,req,m1,tcp,true)\n\t\tMsgCachePool.EnQueue(m1)\n\t\treturn\n\t}\n\n\tif q.Qclass == dns.ClassCHAOS || q.Qtype == dns.TypePTR {\n\t\tm.SetReply(req)\n\t\tm.SetRcode(req, dns.RcodeServerFailure)\n\t\tif err := w.WriteMsg(m); err != nil {\n\t\t\tglog.Infof(\"failure to return reply %q\", err)\n\t\t}\n\t\treturn\n\t}\n\tatomic.AddInt64(&statsCacheMissResponse, 1)\n\t// cluster domain forward\n\tfor subKey, subVal := range s.subDomainServers {\n\t\tif strings.HasSuffix(name, subKey) {\n\t\t\tresp := s.dnsDomainForward(w, req, subVal,remoteIp[0], timeNow)\n\t\t\tglog.V(4).Infof(\"ServeSubDomainForward %q: %v \\n \", q.Name, resp.Answer)\n\t\t\treturn\n\t\t}\n\t}\n\t// domain local\n\tfor _, domain := range s.dnsDomains {\n\t\tif strings.HasSuffix(name, domain) {\n\t\t\t// find local record and insert to cache\n\t\t\ts.processLocalDomainRecord(w,req,m,remoteIp[0],domain ,timeNow)\n\t\t\treturn\n\t\t}\n\t}\n // ex-domain froward\n\tresp := s.dnsDomainForward(w, req,s.forwardNameServers, remoteIp[0], timeNow)\n\tglog.V(4).Infof(\"ServeDNSForward %q: %v \\n \", q.Name, resp.Answer)\n\treturn\n}", "title": "" }, { "docid": "008262f817740029a044f51607f1a6d7", "score": "0.5964022", "text": "func (bas *BaseService) OnRequest(ctx context.Context, args Args) {}", "title": "" }, { "docid": "f264e149e51d725bb745888ec027daeb", "score": "0.5895224", "text": "func handleDNSRequest(w dns.ResponseWriter, r *dns.Msg) {\n\tdefer w.Close()\n\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\tm.Compress = false\n\n\tswitch r.Opcode {\n\tcase dns.OpcodeQuery:\n\t\tparseQuery(m)\n\t}\n\n\tw.WriteMsg(m)\n}", "title": "" }, { "docid": "f75515f4789fc816d61b918e4ca2d308", "score": "0.5760077", "text": "func DnsHandler(ctx *gin.Context) {\n\tvar r resources.DnsRequest\n\t// Trying to unmarshal the incoming POST request body to DnsRequest struct\n\t// It also validates the Json\n\tif err := ctx.ShouldBindJSON(&r); err != nil {\n\t\tctx.JSON(http.StatusBadRequest, resources.ErrorResponse{Message: \"bad request body\"})\n\t\treturn\n\t}\n\n\t// Calculate the location with given coordinates and velocity\n\tl := services.FindLocation(*r.X, *r.Y, *r.Z, *r.Vel)\n\n\t// Create the response object and returns it as json with 200 status code\n\tres := resources.DnsResponse{Loc: l}\n\tctx.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "d0a777a9224f2abaaffecd6bf670fb62", "score": "0.57428074", "text": "func (f HandlerQueryFunc) QueryDNS(w RequestWriter, r *Msg) {\n\tgo f(w, r)\n}", "title": "" }, { "docid": "b48e99fdf0c4beaa908db183973b8daf", "score": "0.5703658", "text": "func (mux *ServeMux) ServeDNS(w ResponseWriter, req *Msg) {\n\tvar h Handler\n\tif len(req.Question) >= 1 { // allow more than one question\n\t\th = mux.match(req.Question[0].Name, req.Question[0].Qtype)\n\t}\n\n\tif h != nil {\n\t\th.ServeDNS(w, req)\n\t} else {\n\t\thandleRefused(w, req)\n\t}\n}", "title": "" }, { "docid": "70ca32fd3ef2c795213c6a571905ef2c", "score": "0.5695813", "text": "func (e *External) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tzone := plugin.Zones(e.Zones).Matches(state.Name())\n\tif zone == \"\" {\n\t\treturn plugin.NextOrFailure(e.Name(), e.Next, ctx, w, r)\n\t}\n\n\tstate.Zone = zone\n\tfor _, z := range e.Zones {\n\t\t// TODO(miek): save this in the External struct.\n\t\tif state.Name() == z { // apex query\n\t\t\tret, err := e.serveApex(state)\n\t\t\treturn ret, err\n\t\t}\n\t\tif dns.IsSubDomain(e.apex+\".\"+z, state.Name()) {\n\t\t\t// dns subdomain test for ns. and dns. queries\n\t\t\tret, err := e.serveSubApex(state)\n\t\t\treturn ret, err\n\t\t}\n\t}\n\n\tsvc, rcode := e.externalFunc(state, e.headless)\n\n\tm := new(dns.Msg)\n\tm.SetReply(state.Req)\n\tm.Authoritative = true\n\n\tif len(svc) == 0 {\n\t\tif e.Fall.Through(state.Name()) && rcode == dns.RcodeNameError {\n\t\t\treturn plugin.NextOrFailure(e.Name(), e.Next, ctx, w, r)\n\t\t}\n\n\t\tm.Rcode = rcode\n\t\tm.Ns = []dns.RR{e.soa(state)}\n\t\tw.WriteMsg(m)\n\t\treturn 0, nil\n\t}\n\n\tswitch state.QType() {\n\tcase dns.TypeA:\n\t\tm.Answer, m.Truncated = e.a(ctx, svc, state)\n\tcase dns.TypeAAAA:\n\t\tm.Answer, m.Truncated = e.aaaa(ctx, svc, state)\n\tcase dns.TypeSRV:\n\t\tm.Answer, m.Extra = e.srv(ctx, svc, state)\n\tcase dns.TypePTR:\n\t\tm.Answer = e.ptr(svc, state)\n\tdefault:\n\t\tm.Ns = []dns.RR{e.soa(state)}\n\t}\n\n\t// If we did have records, but queried for the wrong qtype return a nodata response.\n\tif len(m.Answer) == 0 {\n\t\tm.Ns = []dns.RR{e.soa(state)}\n\t}\n\n\tw.WriteMsg(m)\n\treturn 0, nil\n}", "title": "" }, { "docid": "e2dbf97309f3190ade4b3d37c9bc9c49", "score": "0.5570851", "text": "func (u *Umbrella) OnASNRequest(ctx context.Context, req *requests.ASNRequest) {\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif bus == nil {\n\t\treturn\n\t}\n\n\tif u.API == nil || u.API.Key == \"\" {\n\t\treturn\n\t}\n\n\tif req.Address == \"\" && req.ASN == 0 {\n\t\treturn\n\t}\n\n\tu.CheckRateLimit()\n\tbus.Publish(requests.SetActiveTopic, u.String())\n\n\tif req.Address != \"\" {\n\t\tu.executeASNAddrQuery(ctx, req)\n\t\treturn\n\t}\n\n\tu.executeASNQuery(ctx, req)\n}", "title": "" }, { "docid": "6414896a02462fb5a181b11bc317bf28", "score": "0.5501536", "text": "func (writer *connectivityHooks) dnsStartHook(di httptrace.DNSStartInfo) {\n\tfmt.Fprint(writer.w, dnsColorFunc(\"--- Starting DNS lookup to resolve '%v' ---\\n\", di.Host))\n}", "title": "" }, { "docid": "d963a4643368222b9d311c0472cc9bed", "score": "0.5483279", "text": "func (h *DNSHandler) ServeDNS(dc *ctx.Context) {\n\tw, req := dc.DNSWriter, dc.DNSRequest\n\n\tmsg := h.handle(w.Proto(), req)\n\n\tw.WriteMsg(msg)\n}", "title": "" }, { "docid": "d36ca34542629a0eac23dca8ab18c7d6", "score": "0.5479175", "text": "func (g GeoIP) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\treturn plugin.NextOrFailure(pluginName, g.Next, ctx, w, r)\n}", "title": "" }, { "docid": "df223358efe44e20a9fa674818beda3e", "score": "0.5440631", "text": "func getFromRealDNS(req []byte, from *net.UDPAddr) {\n\trsp := make([]byte, 0)\n\tips, err := parseNameServer()\n\tif err != nil {\n\t\tklog.Errorf(\"[EdgeMesh] parse nameserver err: %v\", err)\n\t\treturn\n\t}\n\n\tladdr := &net.UDPAddr{\n\t\tIP: net.IPv4zero,\n\t\tPort: 0,\n\t}\n\n\t// get from real dns servers\n\tfor _, ip := range ips {\n\t\traddr := &net.UDPAddr{\n\t\t\tIP: ip,\n\t\t\tPort: 53,\n\t\t}\n\t\tconn, err := net.DialUDP(\"udp\", laddr, raddr)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tdefer conn.Close()\n\t\t_, err = conn.Write(req)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err = conn.SetReadDeadline(time.Now().Add(time.Minute)); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tvar n int\n\t\tbuf := make([]byte, bufSize)\n\t\tn, err = conn.Read(buf)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif n > 0 {\n\t\t\trsp = append(rsp, buf[:n]...)\n\t\t\tif _, err = dnsConn.WriteToUDP(rsp, from); err != nil {\n\t\t\t\tklog.Errorf(\"[EdgeMesh] failed to wirte to udp, err: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a2962c6fee095171ebff93304fa85975", "score": "0.54238886", "text": "func (o *PluginDnsNs) OnEvent(msg string, a, b interface{}) {}", "title": "" }, { "docid": "cf6dadb4414b7277178458ab4440d91c", "score": "0.5404384", "text": "func startDNS() {\n\t// init meta client\n\tmetaClient = client.New()\n\t// get dns listen ip\n\tlip, err := common.GetInterfaceIP(ifi)\n\tif err != nil {\n\t\tklog.Errorf(\"[EdgeMesh] get dns listen ip err: %v\", err)\n\t\treturn\n\t}\n\n\tladdr := &net.UDPAddr{\n\t\tIP: lip,\n\t\tPort: 53,\n\t}\n\tudpConn, err := net.ListenUDP(\"udp\", laddr)\n\tif err != nil {\n\t\tklog.Errorf(\"[EdgeMesh] dns server listen on %v error: %v\", laddr, err)\n\t\treturn\n\t}\n\tdefer udpConn.Close()\n\tdnsConn = udpConn\n\tfor {\n\t\treq := make([]byte, bufSize)\n\t\tn, from, err := dnsConn.ReadFromUDP(req)\n\t\tif err != nil || n <= 0 {\n\t\t\tklog.Errorf(\"[EdgeMesh] dns server read from udp error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tque, err := parseDNSQuery(req[:n])\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tque.from = from\n\n\t\trsp := make([]byte, 0)\n\t\trsp, err = recordHandle(que, req[:n])\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"[EdgeMesh] failed to resolve dns: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = dnsConn.WriteTo(rsp, from); err != nil {\n\t\t\tklog.Warningf(\"[EdgeMesh] failed to write: %v\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1416702d585f4d8fcbc5775ba606e315", "score": "0.53792626", "text": "func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\tc := s.ctx\n\tdefer func() {\n\t\t// Closing the response tells the DNS service to terminate\n\t\tif c.Err() != nil {\n\t\t\t_ = w.Close()\n\t\t}\n\t}()\n\n\tq := &r.Question[0]\n\tatomic.AddInt64(&s.requestCount, 1)\n\n\tanswerString := func(a []dns.RR) string {\n\t\tif a == nil {\n\t\t\treturn \"\"\n\t\t}\n\t\tswitch len(a) {\n\t\tcase 0:\n\t\t\treturn \"EMPTY\"\n\t\tcase 1:\n\t\t\treturn a[0].String()\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%v\", a)\n\t\t}\n\t}\n\n\tqts := dns.TypeToString[q.Qtype]\n\tanswer, err := s.cacheResolve(q)\n\tvar rc int\n\tvar pfx dfs = func() string { return \"\" }\n\tvar txt dfs = func() string { return \"\" }\n\tvar rct dfs = func() string { return dns.RcodeToString[rc] }\n\n\tvar msg *dns.Msg\n\n\tdefer func() {\n\t\tdlog.Debugf(c, \"%s%-6s %s -> %s %s\", pfx, qts, q.Name, rct, txt)\n\t\t_ = w.WriteMsg(msg)\n\t}()\n\n\tif err == nil && answer != nil {\n\t\trc = dns.RcodeSuccess\n\t\tmsg = new(dns.Msg)\n\t\tmsg.SetReply(r)\n\t\tmsg.Answer = answer\n\t\tmsg.Authoritative = true\n\t\t// mac dns seems to fallback if you don't\n\t\t// support recursion, if you have more than a\n\t\t// single dns server, this will prevent us\n\t\t// from intercepting all queries\n\t\tmsg.RecursionAvailable = true\n\t\ttxt = func() string { return answerString(msg.Answer) }\n\t\treturn\n\t}\n\n\t// The recursion check query, or queries that end with the cluster domain name, are not dispatched to the\n\t// fallback DNS-server.\n\tif s.fallback == nil || strings.HasPrefix(q.Name, recursionCheck) || strings.HasSuffix(q.Name, s.clusterDomain) {\n\t\tif err == nil {\n\t\t\trc = dns.RcodeNameError\n\t\t} else {\n\t\t\trc = dns.RcodeServerFailure\n\t\t\tif errors.Is(err, context.DeadlineExceeded) {\n\t\t\t\ttxt = func() string { return \"timeout\" }\n\t\t\t} else {\n\t\t\t\ttxt = err.Error\n\t\t\t}\n\t\t}\n\t\tmsg = new(dns.Msg)\n\t\tmsg.SetRcode(r, rc)\n\t\treturn\n\t}\n\n\tpfx = func() string { return fmt.Sprintf(\"(%s) \", s.fallback.RemoteAddr()) }\n\tdc := dns.Client{Net: \"udp\", Timeout: 2 * time.Second}\n\tmsg, _, err = dc.ExchangeWithConn(r, s.fallback)\n\tif err != nil {\n\t\tmsg = new(dns.Msg)\n\t\trc = dns.RcodeServerFailure\n\t\ttxt = err.Error\n\t\tif err, ok := err.(net.Error); ok {\n\t\t\tswitch {\n\t\t\tcase err.Timeout():\n\t\t\t\ttxt = func() string { return \"timeout\" }\n\t\t\tcase err.Temporary():\n\t\t\t\trc = dns.RcodeRefused\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\tmsg.SetRcode(r, rc)\n\t} else {\n\t\trc = msg.Rcode\n\t\ttxt = func() string { return answerString(msg.Answer) }\n\t}\n}", "title": "" }, { "docid": "0fbb7a8defb18d753966f0daa8a76e08", "score": "0.5331405", "text": "func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error) {\n\tqname := req.Question[0].Name\n\n\tres := make(chan *dns.Msg, 1)\n\tL := func(nsPool pool.Pool) {\n\t\t//r, rtt, err := c.Exchange(req, nameserver)\n\t\tc, err := nsPool.Get()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"socket error when get conn\", err)\n\t\t\tif pc, ok := c.(*pool.PoolConn); ok == true {\n\t\t\t\tpc.MarkUnusable()\n\t\t\t}\n\t\t\tc.Close()\n\t\t\treturn\n\t\t}\n\n\t\tco := &dns.Conn{Conn: c.(*pool.PoolConn).Conn} // c is your net.Conn\n\t\terr = co.WriteMsg(req)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tr, err := co.ReadMsg()\n\t\tco.Close()\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"socket error on \", qname)\n\t\t\tfmt.Println(\"error:\", err.Error())\n\t\t\treturn\n\t\t}\n\t\t// If SERVFAIL happen, should return immediately and try another upstream resolver.\n\t\t// However, other Error code like NXDOMAIN is an clear response stating\n\t\t// that it has been verified no such domain existas and ask other resolvers\n\t\t// would make no sense. See more about #20\n\t\tif r != nil && r.Rcode != dns.RcodeSuccess {\n\t\t\tfmt.Println(\"Failed to get an valid answer \", qname)\n\t\t\tif r.Rcode == dns.RcodeServerFailure {\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\t//fmt.Println(\"resolv \", UnFqdn(qname), \" on \", r.String(), r.Len())\n\t\t}\n\t\tres <- r\n\n\t}\n\t// Start lookup on each nameserver top-down, in every second\n\tfor _, nspool := range r.NameserversPool {\n\t\tgo L(nspool)\n\t}\n\ttimeout := time.After(time.Second * 30)\n\tselect {\n\tcase r := <-res:\n\t\treturn r, nil\n\tcase <-timeout:\n\t\treturn nil, errors.New(\"Time out on dns query\")\n\t}\n}", "title": "" }, { "docid": "e4a6c1bfe40e7e1aef5aee1bdc74fe9d", "score": "0.5318992", "text": "func (a *AlienVault) OnWhoisRequest(ctx context.Context, req *requests.WhoisRequest) {\n\tif !a.System().Config().IsDomainInScope(req.Domain) {\n\t\treturn\n\t}\n\n\ta.CheckRateLimit()\n\ta.executeWhoisQuery(ctx, req)\n}", "title": "" }, { "docid": "a6ceeadca17700b7a246f043c7637ef2", "score": "0.5312938", "text": "func (e *Delay) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\n\t// Debug log that we've have seen the query. This will only be shown when the debug plugin is loaded.\n\tlog.Debug(\"Received response\")\n\n\t// Pause execution for configured interval\n\ttime.Sleep(e.Delay * time.Millisecond)\n\n\t// Call next plugin (if any).\n\treturn plugin.NextOrFailure(e.Name(), e.Next, ctx, w, r)\n}", "title": "" }, { "docid": "718995b4ae01694de9af8ef87795138c", "score": "0.52743065", "text": "func (p *plug) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstart := time.Now()\n\trequests.Inc()\n\tstate := request.Request{W: w, Req: r}\n\tip := state.IP()\n\n\t// capture the written answer\n\trrw := dnstest.NewRecorder(w)\n\trcode, result, err := p.serveDNSInternal(ctx, rrw, r)\n\tif rcode > 0 {\n\t\t// actually send the answer if we have one\n\t\tanswer := new(dns.Msg)\n\t\tanswer.SetRcode(r, rcode)\n\t\tstate.SizeAndDo(answer)\n\t\terr = w.WriteMsg(answer)\n\t\tif err != nil {\n\t\t\treturn dns.RcodeServerFailure, err\n\t\t}\n\t}\n\n\t// increment counters\n\tswitch {\n\tcase err != nil:\n\t\terrorsTotal.Inc()\n\tcase result.Reason == dnsfilter.FilteredBlackList:\n\t\tfiltered.Inc()\n\t\tfilteredLists.Inc()\n\tcase result.Reason == dnsfilter.FilteredSafeBrowsing:\n\t\tfiltered.Inc()\n\t\tfilteredSafebrowsing.Inc()\n\tcase result.Reason == dnsfilter.FilteredParental:\n\t\tfiltered.Inc()\n\t\tfilteredParental.Inc()\n\tcase result.Reason == dnsfilter.FilteredInvalid:\n\t\tfiltered.Inc()\n\t\tfilteredInvalid.Inc()\n\tcase result.Reason == dnsfilter.FilteredSafeSearch:\n\t\t// the request was passsed through but not filtered, don't increment filtered\n\t\tsafesearch.Inc()\n\tcase result.Reason == dnsfilter.NotFilteredWhiteList:\n\t\twhitelisted.Inc()\n\tcase result.Reason == dnsfilter.NotFilteredNotFound:\n\t\t// do nothing\n\tcase result.Reason == dnsfilter.NotFilteredError:\n\t\ttext := \"SHOULD NOT HAPPEN: got DNSFILTER_NOTFILTERED_ERROR without err != nil!\"\n\t\tlog.Println(text)\n\t\terr = errors.New(text)\n\t\trcode = dns.RcodeServerFailure\n\t}\n\n\t// log\n\telapsed := time.Since(start)\n\telapsedTime.Observe(elapsed.Seconds())\n\tif p.settings.QueryLogEnabled {\n\t\tlogRequest(r, rrw.Msg, result, time.Since(start), ip)\n\t}\n\treturn rcode, err\n}", "title": "" }, { "docid": "0a168b75310b251873945d52679d6f7d", "score": "0.5257227", "text": "func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\trw := &ResponseWriter{\n\t\tResponseWriter: w,\n\t\tDnstap: h,\n\t\tquery: r,\n\t\tctx: ctx,\n\t\tqueryTime: time.Now(),\n\t}\n\n\t// The query tap message should be sent before sending the query to the\n\t// forwarder. Otherwise, the tap messages will come out out of order.\n\th.tapQuery(ctx, w, r, rw.queryTime)\n\n\treturn plugin.NextOrFailure(h.Name(), h.Next, ctx, rw, r)\n}", "title": "" }, { "docid": "b780fc9902832a968201beaf2fbc63ba", "score": "0.52567446", "text": "func (v *View) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\treturn plugin.NextOrFailure(v.Name(), v.Next, ctx, w, r)\n}", "title": "" }, { "docid": "b20e688b20104352b4b0ad1c067b2e41", "score": "0.525303", "text": "func DNSsvc(d string) Option {\n\treturn func(c *Config) Option {\n\t\tprevious := c.DNSsvc\n\t\tc.DNSsvc = d\n\t\treturn DNSsvc(previous)\n\t}\n}", "title": "" }, { "docid": "a2d9c2f54dc5fab4a1ca5d3d202f0d26", "score": "0.52524084", "text": "func (d *DNSTable) OnStart() error {\n\td.BaseService.OnStart()\n\n\tgo d.processRequests()\n\treturn nil\n}", "title": "" }, { "docid": "92ae07e72f9f66d3d18c1e7d408ec65d", "score": "0.5238738", "text": "func (o *PluginDnsClient) OnCreate() (err error) {\n\n\to.dnsPktBuilder = utils.NewDnsPktBuilder(false) // Create a packet builder for Dns\n\n\tif !o.IsNameServer() {\n\t\to.cache = utils.NewDnsCache(o.Tctx.GetTimerCtx()) // Create cache\n\t}\n\n\t// Create socket\n\ttransportCtx := transport.GetTransportCtx(o.Client)\n\tif transportCtx != nil {\n\t\tif o.IsNameServer() {\n\t\t\terr = transportCtx.Listen(\"udp\", \":53\", o)\n\t\t\tif err != nil {\n\t\t\t\to.stats.invalidSocket++\n\t\t\t\treturn fmt.Errorf(\"could not create listening socket: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\to.socket, err = transportCtx.Dial(\"udp\", o.dstAddr, o, nil, nil, 0)\n\t\t\tif err != nil {\n\t\t\t\to.stats.invalidSocket++\n\t\t\t\treturn fmt.Errorf(\"could not create dialing socket: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e06241f7611950b1275ba6614e3e305", "score": "0.52379614", "text": "func (c *Conn) OnRequest(req *base.Request) {\n\tc.log(logger.Debug, \"[c->s] %v\", req)\n}", "title": "" }, { "docid": "7b94b67d65a224f9479afd5d1551997f", "score": "0.52375126", "text": "func (u *Umbrella) OnWhoisRequest(ctx context.Context, req *requests.WhoisRequest) {\n\tcfg := ctx.Value(requests.ContextConfig).(*config.Config)\n\tbus := ctx.Value(requests.ContextEventBus).(*eventbus.EventBus)\n\tif cfg == nil || bus == nil {\n\t\treturn\n\t}\n\n\tif u.API == nil || u.API.Key == \"\" {\n\t\treturn\n\t}\n\n\tif !cfg.IsDomainInScope(req.Domain) {\n\t\treturn\n\t}\n\n\twhoisRecord := u.queryWhois(ctx, req.Domain)\n\tif whoisRecord == nil {\n\t\treturn\n\t}\n\n\tdomains := stringset.New()\n\temails := u.collateEmails(ctx, whoisRecord)\n\tif len(emails) > 0 {\n\t\temailURL := u.reverseWhoisByEmailURL(emails...)\n\t\tfor _, d := range u.queryReverseWhois(ctx, emailURL) {\n\t\t\tif !cfg.IsDomainInScope(d) {\n\t\t\t\tdomains.Insert(d)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar nameservers []string\n\tfor _, ns := range whoisRecord.NameServers {\n\t\tif u.validateScope(ctx, ns) {\n\t\t\tnameservers = append(nameservers, ns)\n\t\t}\n\t}\n\tif len(nameservers) > 0 {\n\t\tnsURL := u.reverseWhoisByNSURL(nameservers...)\n\t\tfor _, d := range u.queryReverseWhois(ctx, nsURL) {\n\t\t\tif !cfg.IsDomainInScope(d) {\n\t\t\t\tdomains.Insert(d)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(domains) > 0 {\n\t\tbus.Publish(requests.NewWhoisTopic, &requests.WhoisRequest{\n\t\t\tDomain: req.Domain,\n\t\t\tNewDomains: domains.Slice(),\n\t\t\tTag: u.SourceType,\n\t\t\tSource: u.String(),\n\t\t})\n\t}\n}", "title": "" }, { "docid": "d4e29e688172cd71a7c3151c6d38987d", "score": "0.5237293", "text": "func Resolve(q string) (ip net.IP, port uint16, target string, err error) {\n c := new(dns.Client)\n m := new(dns.Msg)\n m.SetQuestion(dns.Fqdn(q), dns.TypeSRV)\n m.RecursionDesired = true\n\n dns_server := \"127.0.0.1:8600\"\n if len(os.Args) > 1 {\n dns_server = os.Args[1]\n }\n fmt.Printf(\"Using dns server: %v\\n\", dns_server)\n\n r, _, err := c.Exchange(m, dns_server)\n if r == nil {\n log.Fatalf(\"error: %s\\n\", err.Error())\n }\n\n if r.Rcode != dns.RcodeSuccess {\n log.Fatalf(\"dns lookup failed\\n\")\n }\n\n for _, srv := range r.Answer {\n port = srv.(*dns.SRV).Port\n target = srv.(*dns.SRV).Target\n\n fmt.Printf(\"%v %v\\n\", port, target)\n\n for _, a := range r.Extra {\n if target != a.(*dns.A).Hdr.Name {\n continue\n }\n ip = a.(*dns.A).A\n fmt.Printf(\"%v %v\\n\", target, ip)\n return\n }\n }\n\n log.Fatalf(\"no DNS record found\\n\")\n return\n}", "title": "" }, { "docid": "4e83fd1431ec6badb6bb85fbccf95ea5", "score": "0.5235416", "text": "func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {\n\n\tmsg := dns.Msg{}\n\tmsg.SetReply(r)\n\tmsg.Authoritative = true\n\n\torigin := r.Question[0].Name\n\n\tdomain := h.getDomain(origin)\n\tlog.Info().Msgf(\"Received DNS query for %s: \\n\", domain)\n\n\tconfig, _ := dns.ClientConfigFromFile(\"/etc/resolv.conf\")\n\n\tc := new(dns.Client)\n\n\tm := new(dns.Msg)\n\tm.SetQuestion(domain, r.Question[0].Qtype)\n\tm.RecursionDesired = true\n\n\tserver := config.Servers[0]\n\tport := config.Port\n\n\tlog.Info().Msgf(\"Exchange message for domain %s to dns server %s:%s\\n\", domain, server, port)\n\n\tres, _, err := c.Exchange(m, net.JoinHostPort(server, port))\n\n\tif res == nil {\n\t\tlog.Error().Msgf(\"*** error: %s\\n\", err.Error())\n\t}\n\n\tif res.Rcode != dns.RcodeSuccess {\n\t\tlog.Error().Msgf(\" *** invalid answer name %s after %d query for %s\\n\", domain, r.Question[0].Qtype, domain)\n\t}\n\n\t// Stuff must be in the answer section\n\tfor _, a := range res.Answer {\n\t\tlog.Info().Msgf(\"%v\\n\", a)\n\t\tmsg.Answer = append(msg.Answer, a)\n\t}\n\n\tw.WriteMsg(&msg)\n}", "title": "" }, { "docid": "f6e2f61c9092cf8daff56e1156bb4560", "score": "0.5221014", "text": "func (r *SRegionDNS) Services(state request.Request, exact bool, opt plugin.Options) (services []msg.Service, err error) {\n\tswitch state.QType() {\n\tcase dns.TypeTXT:\n\t\tt, _ := dnsutil.TrimZone(state.Name(), state.Zone)\n\n\t\tsegs := dns.SplitDomainName(t)\n\t\tif len(segs) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"yunion region: TXT query can onlyu be for dns-version: %s\", state.QName())\n\t\t}\n\t\tif segs[0] != \"dns-version\" {\n\t\t\treturn nil, nil\n\t\t}\n\t\tsvc := msg.Service{Text: \"0.0.1\", TTL: 28800, Key: msg.Path(state.QName(), \"coredns\")}\n\t\treturn []msg.Service{svc}, nil\n\tcase dns.TypeNS:\n\t\tns := r.nsAddr()\n\t\tsvc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), \"coredns\")}\n\t\treturn []msg.Service{svc}, nil\n\t}\n\n\tif state.QType() == dns.TypeA && isDefaultNS(state.Name(), state.Zone) {\n\t\t// If this is an A request for \"ns.dns\", respond with a \"fake\" record for coredns.\n\t\t// SOA records always use this hardcoded name\n\t\tns := r.nsAddr()\n\t\tsvc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), \"coredns\")}\n\t\treturn []msg.Service{svc}, nil\n\t}\n\n\tservices, err = r.Records(state, false)\n\treturn\n}", "title": "" }, { "docid": "d3db48039d8ef1dc38bfe784937f97d8", "score": "0.52095854", "text": "func (ipr *Ipref) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tif !ipr.match(state) {\n\t\treturn plugin.NextOrFailure(ipr.Name(), ipr.Next, ctx, w, r)\n\t}\n\n\tvar res *unbound.Result\n\tvar err error\n\n\tswitch {\n\n\tcase state.QClass() == dns.ClassINET && (state.QType() == dns.TypeA || state.QType() == dns.TypeAAAA):\n\n\t\tif res, err = ipr.resolve_aa(state); err == nil { // try AA first\n\t\t\tbreak\n\t\t}\n\n\t\tfallthrough\n\n\tdefault:\n\n\t\tswitch state.Proto() {\n\t\tcase \"tcp\":\n\t\t\tres, err = ipr.t.Resolve(state.QName(), state.QType(), state.QClass())\n\t\tcase \"udp\":\n\t\t\tres, err = ipr.u.Resolve(state.QName(), state.QType(), state.QClass())\n\t\t}\n\t}\n\n\trcode := dns.RcodeServerFailure\n\tif err == nil {\n\t\trcode = res.AnswerPacket.Rcode\n\t}\n\trc, ok := dns.RcodeToString[rcode]\n\tif !ok {\n\t\trc = strconv.Itoa(rcode)\n\t}\n\n\tserver := metrics.WithServer(ctx)\n\tRcodeCount.WithLabelValues(server, rc).Add(1)\n\tRequestDuration.WithLabelValues(server).Observe(res.Rtt.Seconds())\n\n\tif err != nil {\n\t\treturn dns.RcodeServerFailure, err\n\t}\n\n\t// If the client *didn't* set the opt record, and specifically not the DO bit,\n\t// strip this from the reply (unbound default to setting DO).\n\tif !state.Do() {\n\t\t// technically we can still set bufsize and fluff, for now remove the entire OPT record.\n\t\tfor i := 0; i < len(res.AnswerPacket.Extra); i++ {\n\t\t\trr := res.AnswerPacket.Extra[i]\n\t\t\tif _, ok := rr.(*dns.OPT); ok {\n\t\t\t\tres.AnswerPacket.Extra = append(res.AnswerPacket.Extra[:i], res.AnswerPacket.Extra[i+1:]...)\n\t\t\t\tbreak // TODO(miek): more than one? Think TSIG?\n\t\t\t}\n\t\t}\n\t\tfilter(res.AnswerPacket, dnssec)\n\t}\n\n\tres.AnswerPacket.Id = r.Id\n\n\t// If the advertised size of the client is smaller than we got, unbound either retried with TCP or something else happened.\n\tif state.Size() < res.AnswerPacket.Len() {\n\t\tres.AnswerPacket = state.Scrub(res.AnswerPacket)\n\t\tres.AnswerPacket.Truncated = true\n\t\tw.WriteMsg(res.AnswerPacket)\n\n\t\treturn 0, nil\n\t}\n\n\tstate.SizeAndDo(res.AnswerPacket)\n\tw.WriteMsg(res.AnswerPacket)\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "4601fbf6a06b5e1222c5ddb828d5d9b8", "score": "0.5203854", "text": "func DNS(options ...ServicerFunc) Servicer {\n\ts := &dnsService{}\n\tfor _, o := range options {\n\t\to(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b604421e723ae10ac9dbaa85f5ca0f70", "score": "0.5202849", "text": "func (c *Cache) ServeDNS(ctx context.Context, w MessageWriter, r *Query) {\n\tvar (\n\t\tmiss bool\n\n\t\tnow = time.Now()\n\t)\n\n\tc.mu.RLock()\n\tfor _, q := range r.Questions {\n\t\tif hit := c.lookup(q, w, now); !hit {\n\t\t\tmiss = true\n\t\t}\n\t}\n\tc.mu.RUnlock()\n\n\tif !miss {\n\t\treturn\n\t}\n\n\tmsg, err := w.Recur(ctx)\n\tif err != nil || msg == nil {\n\t\tw.Status(ServFail)\n\t\treturn\n\t}\n\tif msg.RCode == NoError {\n\t\tc.insert(msg, now)\n\t}\n\twriteMessage(w, msg)\n}", "title": "" }, { "docid": "b51dae4cc9893696c8decf875a90a883", "score": "0.51916426", "text": "func (s *Server) ServeDNS(w dns.ResponseWriter, m *dns.Msg) {\n\treply := new(dns.Msg)\n\n\tif m.MsgHdr.Opcode != dns.OpcodeQuery {\n\t\treply.SetRcode(m, dns.RcodeRefused)\n\t\tif err := w.WriteMsg(reply); err != nil {\n\t\t\ts.Log.Printf(\"WriteMsg: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\n\treply.SetReply(m)\n\treply.RecursionAvailable = true\n\tif s.Authoritative {\n\t\treply.Authoritative = true\n\t\treply.RecursionAvailable = false\n\t}\n\n\tq := m.Question[0]\n\n\tqname := strings.ToLower(dns.Fqdn(q.Name))\n\n\tif q.Qclass != dns.ClassINET {\n\t\treply.SetRcode(m, dns.RcodeNotImplemented)\n\t\tif err := w.WriteMsg(reply); err != nil {\n\t\t\ts.Log.Printf(\"WriteMsg: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tqnameZone, ok := s.r.Zones[qname]\n\tif !ok {\n\t\ts.writeErr(w, reply, notFound(qname))\n\t\treturn\n\t}\n\n\t// This does the lookup twice (including lookup* below).\n\t// TODO: Avoid this.\n\tad, rname, _, err := s.r.targetZone(qname)\n\tif err != nil {\n\t\ts.writeErr(w, reply, err)\n\t\treturn\n\t}\n\treply.AuthenticatedData = ad\n\n\tif rname != qname {\n\t\treply.Answer = append(reply.Answer, mkCname(qname, rname))\n\t}\n\n\tswitch q.Qtype {\n\tcase dns.TypeA:\n\t\t_, addrs, err := s.r.lookupA(context.Background(), qname)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, addr := range addrs {\n\t\t\tparsed := net.ParseIP(addr)\n\t\t\tif parsed == nil {\n\t\t\t\tpanic(\"ServeDNS: malformed IP in records\")\n\t\t\t}\n\t\t\treply.Answer = append(reply.Answer, &dns.A{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeA,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tA: parsed,\n\t\t\t})\n\t\t}\n\tcase dns.TypeAAAA:\n\t\t_, addrs, err := s.r.lookupAAAA(context.Background(), q.Name)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, addr := range addrs {\n\t\t\tparsed := net.ParseIP(addr)\n\t\t\tif parsed == nil {\n\t\t\t\tpanic(\"ServeDNS: malformed IP in records\")\n\t\t\t}\n\t\t\treply.Answer = append(reply.Answer, &dns.AAAA{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeAAAA,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tAAAA: parsed,\n\t\t\t})\n\t\t}\n\tcase dns.TypeMX:\n\t\t_, mxs, err := s.r.lookupMX(context.Background(), q.Name)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, mx := range mxs {\n\t\t\treply.Answer = append(reply.Answer, &dns.MX{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeMX,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tPreference: mx.Pref,\n\t\t\t\tMx: mx.Host,\n\t\t\t})\n\t\t}\n\tcase dns.TypeNS:\n\t\tcname, nss, err := s.r.lookupNS(context.Background(), q.Name)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tif cname != \"\" {\n\t\t\treply.Answer = append(reply.Answer, mkCname(q.Name, cname))\n\t\t}\n\t\tfor _, ns := range nss {\n\t\t\treply.Answer = append(reply.Answer, &dns.NS{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeNS,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tNs: ns.Host,\n\t\t\t})\n\t\t}\n\tcase dns.TypeSRV:\n\t\t_, srvs, err := s.r.lookupSRV(context.Background(), q.Name)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, srv := range srvs {\n\t\t\treply.Answer = append(reply.Answer, &dns.SRV{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeSRV,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tPriority: srv.Priority,\n\t\t\t\tPort: srv.Port,\n\t\t\t\tTarget: srv.Target,\n\t\t\t})\n\t\t}\n\tcase dns.TypeCNAME:\n\t\treply.AuthenticatedData = qnameZone.AD\n\tcase dns.TypeTXT:\n\t\t_, txts, err := s.r.lookupTXT(context.Background(), q.Name)\n\t\tif err != nil {\n\t\t\ts.writeErr(w, reply, err)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, txt := range txts {\n\t\t\treply.Answer = append(reply.Answer, &dns.TXT{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypeTXT,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tTxt: splitTXT(txt),\n\t\t\t})\n\t\t}\n\tcase dns.TypePTR:\n\t\trzone, ok := s.r.Zones[q.Name]\n\t\tif !ok {\n\t\t\ts.writeErr(w, reply, notFound(q.Name))\n\t\t\treturn\n\t\t}\n\n\t\tfor _, name := range rzone.PTR {\n\t\t\treply.Answer = append(reply.Answer, &dns.PTR{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: rname,\n\t\t\t\t\tRrtype: dns.TypePTR,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tPtr: name,\n\t\t\t})\n\t\t}\n\tcase dns.TypeSOA:\n\t\treply.Answer = []dns.RR{\n\t\t\t&dns.SOA{\n\t\t\t\tHdr: dns.RR_Header{\n\t\t\t\t\tName: q.Name,\n\t\t\t\t\tRrtype: dns.TypeSOA,\n\t\t\t\t\tClass: dns.ClassINET,\n\t\t\t\t\tTtl: 9999,\n\t\t\t\t},\n\t\t\t\tNs: \"localhost.\",\n\t\t\t\tMbox: \"hostmaster.localhost.\",\n\t\t\t\tSerial: 1,\n\t\t\t\tRefresh: 900,\n\t\t\t\tRetry: 900,\n\t\t\t\tExpire: 1800,\n\t\t\t\tMinttl: 60,\n\t\t\t},\n\t\t}\n\tdefault:\n\t\trzone, ok := s.r.Zones[q.Name]\n\t\tif !ok {\n\t\t\ts.writeErr(w, reply, notFound(q.Name))\n\t\t\treturn\n\t\t}\n\n\t\treply.Answer = append(reply.Answer, rzone.Misc[dns.Type(q.Qtype)]...)\n\t}\n\n\ts.Log.Printf(\"DNS TRACE %v\", reply.String())\n\n\tif err := w.WriteMsg(reply); err != nil {\n\t\ts.Log.Printf(\"WriteMsg: %v\", err)\n\t}\n}", "title": "" }, { "docid": "cdaab0f4884f048da0afae989bc9202f", "score": "0.51710033", "text": "func (o *PluginDnsClient) OnEvent(msg string, a, b interface{}) {}", "title": "" }, { "docid": "15c83c120b37b823b635030eafd7ffa1", "score": "0.51444435", "text": "func onRequestEvent(e *aah.Event) {\n\te.Data.(*aah.Context).Req.Host = \"TFB-Server:8080\"\n}", "title": "" }, { "docid": "f4ef6169bda6e16bd932981cd2ba40e6", "score": "0.51417756", "text": "func OnRequest(sef EventCallbackFunc) {\n\tif onRequestFunc == nil {\n\t\tonRequestFunc = sef\n\t\treturn\n\t}\n\tlog.Warn(\"'OnRequest' aah server extension point is already subscribed.\")\n}", "title": "" }, { "docid": "deb1d864adeeb61f5c83ed85aa260135", "score": "0.51347566", "text": "func (s *server) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {\n\tmsg := dns.Msg{}\n\tmsg.SetReply(req)\n\tmsg.Authoritative = true\n\t// Stuff must be in the answer section\n\tfor _, a := range s.query(req) {\n\t\tlog.Info().Msgf(\"%v\\n\", a)\n\t\tmsg.Answer = append(msg.Answer, a)\n\t}\n\n\t_ = w.WriteMsg(&msg)\n}", "title": "" }, { "docid": "435ba20fd8e7a75b39f8c7faad06e71c", "score": "0.5126738", "text": "func (p *unifinames) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tif !p.haveRoutine.Load() {\n\t\tp.haveRoutine.Store(true)\n\t\tgo func() {\n\t\t\tupdate := func() {\n\t\t\t\tp.mu.Lock()\n\t\t\t\tif p.Config.Debug {\n\t\t\t\t\tlog.Println(\"[unifi-names] updating clients\")\n\t\t\t\t}\n\t\t\t\tif err := p.getClients(context.Background()); err != nil {\n\t\t\t\t\tp.mu.Unlock()\n\t\t\t\t\tlog.Printf(\"[unifi-names] unable to get clients: %v\\n\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tp.mu.Unlock()\n\t\t\t\tlog.Printf(\"[unifi-names] got %d hosts\", len(p.aClients)+len(p.aaaaClients))\n\t\t\t\tp.lastUpdate = time.Now()\n\t\t\t}\n\t\t\tupdate()\n\t\t\tt := time.NewTicker(time.Duration(p.Config.TTL) * time.Second)\n\t\t\tfor range t.C {\n\t\t\t\tupdate()\n\t\t\t}\n\t\t}()\n\t}\n\tif p.resolve(w, r) {\n\t\treturn dns.RcodeSuccess, nil\n\t}\n\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n}", "title": "" }, { "docid": "605426fa86a790cb8e02e69cfec5eadc", "score": "0.51261544", "text": "func (l *LogEntry) addDns(d *guardduty.DnsRequestAction) {\n\tl.DnsDomain = aws.StringValue(d.Domain)\n}", "title": "" }, { "docid": "b966a613e4cb12222846501a5ccbe717", "score": "0.51112336", "text": "func HandleDNS(w dns.ResponseWriter, r *dns.Msg) {\n\n\t/* Response packet */\n\tm := new(dns.Msg)\n\n\tdefer func() {\n\t\tm.SetReply(r)\n\t\tm.MsgHdr.Authoritative = true\n\t\tw.WriteMsg(m)\n\t}()\n\n\t/* If there's not one question in the packet, it's not for us */\n\tif 1 != len(r.Question) {\n\t\tm = m.SetRcode(r, dns.RcodeNameError)\n\t\treturn\n\t}\n\tq := r.Question[0]\n\tq.Name = strings.ToLower(q.Name)\n\n\t/* If the question's for the A record of the bare domain, return it. */\n\tif DOMAIN == q.Name {\n\t\tif dns.TypeA == q.Qtype && nil != AREC {\n\t\t\tm.Answer = append(m.Answer, AREC)\n\t\t}\n\t\treturn\n\t}\n\n\t/* We can really only process one of these at once */\n\tdnsCacheLock.Lock()\n\tdefer dnsCacheLock.Unlock()\n\n\t/* If we already have this one, use it again */\n\tif v, ok := dnsCache.Get(q.Name); ok {\n\t\trr, ok := v.(*dns.TXT)\n\t\tif !ok {\n\t\t\tlog.Panicf(\"invalid RR type %T\", v)\n\t\t}\n\t\t/* nil means no tasking */\n\t\tif nil != rr {\n\t\t\tm.Answer = append(m.Answer, rr)\n\t\t}\n\t\treturn\n\t}\n\n\t/* Get interesting parts of request. There should be 4 */\n\tparts := strings.SplitN(dnsutil.TrimDomainName(q.Name, DOMAIN), \".\", 4)\n\tif 4 != len(parts) {\n\t\tm.SetRcode(r, dns.RcodeFormatError)\n\t\treturn\n\t}\n\tvar (\n\t\toutHex = parts[0] /* Output, in hex */\n\t\tcounter = parts[1] /* Cachebuster */\n\t\tmt = parts[2] /* Message Type */\n\t\tid = strings.ToLower(parts[3]) /* Implant ID */\n\t)\n\n\t/* Only TXT records are supported, and only message types t and o */\n\tif !((mt == TASKINGLABEL && dns.TypeTXT == q.Qtype) ||\n\t\tmt == OUTPUTLABEL) ||\n\t\t\"\" == id {\n\t\tm.SetRcode(r, dns.RcodeRefused)\n\t\treturn\n\t}\n\n\t/* Make sure we have an expected message type */\n\tswitch mt {\n\tcase OUTPUTLABEL: /* Output, no need to respond with anything */\n\t\tdnsCache.Add(q.Name, (*dns.TXT)(nil))\n\t\tupdateLastSeen(id)\n\t\tgo handleOutput(outHex, id)\n\t\treturn\n\tcase TASKINGLABEL: /* Tasking */\n\t\tbreak /* Handled below */\n\tdefault: /* Not something we expect */\n\t\tlog.Panicf(\"unpossible message type %q\", mt)\n\t}\n\n\t/* Update the last seen time for this implant */\n\tupdateLastSeen(id)\n\n\t/* Send beacon to interested clients */\n\tgo sendBeaconToClients(id, counter)\n\n\t/* Get the next tasking for this implant */\n\tt := GetTasking(id)\n\tif \"\" == t {\n\t\tdnsCache.Add(q.Name, (*dns.TXT)(nil))\n\t\treturn\n\t}\n\t/* Sanitize tasking */\n\ts := strings.Replace(t, \"`\", \"``\", -1)\n\ts = strings.Replace(s, `\\`, `\\\\`, -1)\n\tm.Answer = append(m.Answer, &dns.TXT{\n\t\tHdr: dns.RR_Header{\n\t\t\tName: q.Name,\n\t\t\tRrtype: dns.TypeTXT,\n\t\t\tClass: dns.ClassINET,\n\t\t\tTtl: TTL,\n\t\t},\n\t\tTxt: []string{s},\n\t})\n\tdnsCache.Add(q.Name, m.Answer[0])\n\tlog.Printf(\"[ID-%v] TASKING: %s (%s)\", id, t, s)\n}", "title": "" }, { "docid": "a054179e24c9b200cc8dd60f2c1d43d2", "score": "0.5110562", "text": "func (s *Server) OnFetchRequest(_ context.Context, req *discovery.DiscoveryRequest) error {\n\t// Unimplemented\n\treturn errors.New(\"Unsupported XDS server connection type\")\n}", "title": "" }, { "docid": "74a93701207a5c43d6ff3cd3241b65b7", "score": "0.5088695", "text": "func (p *DiscoveryProtocol) onDiscoveryRequest(s inet.Stream) {\n\t// get request data\n\tdata := &api.DiscoveryRequest{}\n\tdecodeProtoMessage(data, s)\n\n\t// Log the reception of the message\n\tlog.Printf(\"%s: Received discovery request from %s. Message: %s\", s.Conn().LocalPeer(), s.Conn().RemotePeer(), data.Message)\n\n\t// If the request's TTL expired or\n\t// If I received the same message again, I will skip\n\tif p.requestExpired(data) || p.checkMsgReceived(data) {\n\t\treturn\n\t}\n\t// Storing the received discovery message so as we don't process it again\n\tp.receivedMsgs[data.DiscoveryMsgData.InitHash] = data.DiscoveryMsgData.Expiry\n\n\t// Authenticate integrity and authenticity of the message\n\tif valid := authenticateProtoMsg(data, data.DiscoveryMsgData.MessageData); !valid {\n\t\tlog.Println(\"Failed to authenticate message\")\n\t\treturn\n\t}\n\n\t// Pass this message to my neighbours\n\tp.ForwardMsgToPeers(data, s.Conn().RemotePeer())\n\n\t// Even if there is possibility that we never send a reply to this Node (because of being busy),\n\t// we still store it our our Peerstore, because there is high possibility to\n\t// receive a request again.\n\n\t// If the node who sent this message is different than the initPeerID\n\t// then we need to add the init node to our neighbours before sending the message\n\tinitPeerID, _ := peer.IDB58Decode(data.DiscoveryMsgData.InitNodeID)\n\tif s.Conn().RemotePeer().String() != initPeerID.String() {\n\t\tp.dhtFindAddrAndStore(initPeerID)\n\t}\n\n\tbusy, err := NodeBusy()\n\tcommon.FatalIfErr(err, \"Error on checking if node is busy\")\n\tif busy {\n\t\t// Cache the request for a later time\n\t\tif uint16(len(p.pendingReq)) < p.maxPendingReq {\n\t\t\tp.pendingReq[data] = struct{}{}\n\t\t}\n\t\tlog.Println(\"I am busy at the moment. Returning...\")\n\t\treturn\n\t}\n\n\tp.createSendResponse(data)\n}", "title": "" }, { "docid": "f9045a5d53bfc78f8d3e9db01463b451", "score": "0.5079221", "text": "func (this Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tTransProString := r.Header.Get(\"X-Proxy-DNS-Transport\")\n\tif TransProString == \"tcp\" {\n\t\tthis.TransPro = TCPcode\n\t} else if TransProString == \"udp\" {\n\t\tthis.TransPro = UDPcode\n\t} else {\n\t\t_D(\"Transport protol not udp or tcp\")\n\t\thttp.Error(w, \"unknown transport protocol\", 415)\n\t\treturn\n\t}\n\tcontentTypeStr := r.Header.Get(\"Content-Type\")\n\tif contentTypeStr != \"application/X-DNSoverHTTP\" {\n\t\t_D(\"Content-Type illegal\")\n\t\thttp.Error(w, \"unknown content type\", 415)\n\t\treturn\n\t}\n\tvar requestBody []byte\n\trequestBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"error in reading request\", 400)\n\t\t_D(\"error in reading HTTP request, error message: %s\", err)\n\t\treturn\n\t}\n\tif len(requestBody) < (int)(r.ContentLength) {\n\t\thttp.Error(w, \"error in reading request\", 400)\n\t\t_D(\"fail to read all HTTP content\")\n\t\treturn\n\t}\n\tvar dnsRequest dns.Msg\n\terr = dnsRequest.Unpack(requestBody)\n\tif err != nil {\n\t\thttp.Error(w, \"bad DNS request\", 400)\n\t\t_D(\"error in packing HTTP response to DNS, error message: %s\", err)\n\t\treturn\n\t}\n\tdnsClient := new(dns.Client)\n\tif dnsClient == nil {\n\t\thttp.Error(w, \"Server Error\", 500)\n\t\t_D(\"cannot create DNS client\")\n\t\treturn\n\t}\n\tdnsClient.ReadTimeout = this.timeout\n\tdnsClient.WriteTimeout = this.timeout\n\tdnsClient.Net = TransProString\n\t//will use a parameter to let user address resolver in future\n\tdnsResponse, RTT, err := dnsClient.Exchange(&dnsRequest, this.SERVERS[rand.Intn(len(this.SERVERS))])\n\t//dnsResponse, RTT, err := dnsClient.Exchange(&dnsRequest, this.SERVERS[0])\n\tif err != nil {\n\t\t_D(\"error in communicate with resolver, error message: %s\", err)\n\t\thttp.Error(w, \"Server Error\", 500)\n\t\treturn\n\t} else {\n\t\t_D(\"request took %s\", RTT)\n\t}\n\tif dnsResponse == nil {\n\t\t_D(\"no response back\")\n\t\thttp.Error(w, \"Server Error:No Recursive response\", 500)\n\t\treturn\n\t}\n\tresponse_bytes, err := dnsResponse.Pack()\n\tif err != nil {\n\t\thttp.Error(w, \"error packing reply\", 500)\n\t\t_D(\"error in packing request, error message: %s\", err)\n\t\treturn\n\t}\n\t_, err = w.Write(response_bytes)\n\tif err != nil {\n\t\t_D(\"Can not write response rightly, error message: %s\", err)\n\t\treturn\n\t}\n\t//don't know how to creat a response here\n}", "title": "" }, { "docid": "487227beb701ec64bc0a020039bd456f", "score": "0.50694007", "text": "func (s *Server) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {\n\tm := new(dns.Msg)\n\tm.SetReply(req)\n\tm.Compress = false\n\n\tswitch req.Opcode {\n\tcase dns.OpcodeQuery:\n\t\tm.Authoritative = true\n\t\ts.parseQuery(m)\n\t}\n\n\terr := w.WriteMsg(m)\n\tif err != nil {\n\t\tlog.Warn().Err(err).Msg(\"failed to write response message\")\n\t}\n}", "title": "" }, { "docid": "6a111d93f8e963bc7279ad859a2ab3b2", "score": "0.50666606", "text": "func (w *worker) resolveFromWith(ip net.IP, proto string) (*nameresolver.Entry, *errors.ErrorStack) {\n\tvar ipList []net.IP\n\n\t// We first query about the IPv4 addresses associated to the request topic.\n\tclnt := new(dns.Client)\n\tclnt.Net = proto\n\n\tma := new(dns.Msg)\n\tma.SetEdns0(4096, false)\n\tma.SetQuestion(w.req.Name(), dns.TypeA)\n\tma.RecursionDesired = false\n\tans, _, err := clnt.Exchange(ma, net.JoinHostPort(ip.String(), \"53\"))\n\n\tif err != nil {\n\t\terrStack := errors.NewErrorStack(err)\n\t\terrStack.Push(fmt.Errorf(\"resolveFromWith: error while exchanging with %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeA]))\n\t\treturn nil, errStack\n\t}\n\tif ans == nil {\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got empty answer from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeA]))\n\t}\n\tif ans.Rcode != dns.RcodeSuccess {\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got DNS error %s from %s over %s for %s %s?\", dns.RcodeToString[ans.Rcode], ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeA]))\n\t}\n\tif !ans.Authoritative {\n\t\t// We expect an non-empty answer from the server, with a positive answer (no NXDOMAIN (lame delegation),\n\t\t// no SERVFAIL (broken server)). We also expect the server to be authoritative; if it is not, it is not clear\n\t\t// why, because the name is delegated to this server according to the parent zone, so we assume that this server\n\t\t// is broken, but there might be other reasons for this that I can't think off from the top of my head.\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got non-authoritative data from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeA]))\n\t}\n\n\t// If the answer is truncated, we might want to retry over TCP... except of course if the truncated answer is\n\t// already provided over TCP (see Spotify blog post about when it happened to them :))\n\tif ans.Truncated {\n\t\tif proto == \"tcp\" {\n\t\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got a truncated answer from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeA]))\n\t\t}\n\t\treturn w.resolveFromWith(ip, \"tcp\")\n\t}\n\n\tfor _, grr := range ans.Answer {\n\t\t// We only consider records from the answer section that have a owner name equal to the qname.\n\t\tif dns.CompareDomainName(grr.Header().Name, w.req.Name()) == dns.CountLabel(w.req.Name()) && dns.CountLabel(grr.Header().Name) == dns.CountLabel(w.req.Name()){\n\t\t\t// We may receive either A or CNAME records with matching owner name. We dismiss all other cases\n\t\t\t// (which are probably constituted of NSEC and DNAME and similar stuff. NSEC is of no value here, and DNAME\n\t\t\t// are not supported by this tool.\n\t\t\tswitch rr := grr.(type) {\n\t\t\tcase *dns.A:\n\t\t\t\t// We stack IPv4 addresses because the RRSet might be composed of multiple A records\n\t\t\t\tipList = append(ipList, rr.A)\n\t\t\tcase *dns.CNAME:\n\t\t\t\t// A CNAME is supposed to be the only record at a given domain name. Thus, we return this alias marker\n\t\t\t\t// and forget about all other records that might resides here.\n\t\t\t\treturn nameresolver.NewAliasEntry(w.req.Name(), rr.Target), nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// We now query for the AAAA records to also get the IPv6 addresses\n\tclnt = new(dns.Client)\n\tclnt.Net = proto\n\n\tmaaaa := new(dns.Msg)\n\tmaaaa.SetEdns0(4096, false)\n\tmaaaa.SetQuestion(w.req.Name(), dns.TypeAAAA)\n\tmaaaa.RecursionDesired = false\n\tans, _, err = clnt.Exchange(maaaa, net.JoinHostPort(ip.String(), \"53\"))\n\n\tif err != nil {\n\t\terrStack := errors.NewErrorStack(err)\n\t\terrStack.Push(fmt.Errorf(\"resolveFromWith: error while exchanging with %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t\treturn nil, errStack\n\t}\n\tif ans == nil {\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got empty answer from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t}\n\tif ans.Rcode != dns.RcodeSuccess {\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got DNS error %s from %s over %s for %s %s?\", dns.RcodeToString[ans.Rcode], ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t}\n\tif !ans.Authoritative {\n\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got non-authoritative data from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t}\n\tif ans.Truncated {\n\t\tif proto == \"tcp\" {\n\t\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got a truncated answer from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t\t}\n\t\treturn w.resolveFromWith(ip, \"tcp\")\n\t}\n\n\tfor _, grr := range ans.Answer {\n\t\tif dns.CompareDomainName(grr.Header().Name, w.req.Name()) == dns.CountLabel(w.req.Name()) && dns.CountLabel(grr.Header().Name) == dns.CountLabel(w.req.Name()){\n\t\t\tswitch rr := grr.(type) {\n\t\t\tcase *dns.AAAA:\n\t\t\t\tipList = append(ipList, rr.AAAA)\n\t\t\tcase *dns.CNAME:\n\t\t\t\t// We should have a CNAME here because the CNAME was not returned when asked for A records, and if we\n\t\t\t\t// had received a CNAME, we would already have returned.\n\t\t\t\treturn nil, errors.NewErrorStack(fmt.Errorf(\"resolveFromWith: got a CNAME that was not provided for the A query from %s over %s for %s %s?\", ip.String(), errors.PROTO_TO_STR[errors.STR_TO_PROTO[proto]], w.req.Name(), dns.TypeToString[dns.TypeAAAA]))\n\t\t\t}\n\t\t}\n\t}\n\treturn nameresolver.NewIPEntry(w.req.Name(), ipList), nil\n}", "title": "" }, { "docid": "4164cd6ed01bd907c8ef6c6bd5e61dd6", "score": "0.5062952", "text": "func (dns *EdgeDNS ) getFromRealDNS(req []byte, from *net.UDPAddr) {\n\trsp := make([]byte, 0)\n\tips, err := dns.parseNameServer()\n\tif err != nil {\n\t\tklog.Errorf(\"parse nameserver err: %v\", err)\n\t\treturn\n\t}\n\n\tladdr := &net.UDPAddr{\n\t\tIP: net.IPv4zero,\n\t\tPort: 0,\n\t}\n\n\t// get from real dns servers\n\tfor _, ip := range ips {\n\t\traddr := &net.UDPAddr{\n\t\t\tIP: ip,\n\t\t\tPort: 53,\n\t\t}\n\t\tconn, err := net.DialUDP(\"udp\", laddr, raddr)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tdefer conn.Close()\n\t\t_, err = conn.Write(req)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err = conn.SetReadDeadline(time.Now().Add(time.Minute)); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tvar n int\n\t\tbuf := make([]byte, bufSize)\n\t\tn, err = conn.Read(buf)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif n > 0 {\n\t\t\trsp = append(rsp, buf[:n]...)\n\t\t\tif _, err = dns.DNSConn.WriteToUDP(rsp, from); err != nil {\n\t\t\t\tklog.Errorf(\"failed to wirte to udp, err: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "62ea90fc3f0142535f2b3d569d5adc66", "score": "0.50525576", "text": "func (d *dht) onDHTRequest(req *types.DHTQueryRequest, from types.SwitchPorts) {\n\t// Build a response.\n\tres := types.DHTQueryResponse{\n\t\tRequestID: req.RequestID,\n\t}\n\tcopy(res.PublicKey[:], d.r.public[:])\n\n\t// Look up all nodes that we know about that are closer to\n\t// the public key being searched.\n\tfor _, f := range d.getCloser(req.PublicKey) {\n\t\tnode := types.DHTNode{\n\t\t\tPublicKey: f.PublicKey(),\n\t\t\tCoordinates: f.Coordinates(),\n\t\t}\n\t\tres.Results = append(res.Results, node)\n\t}\n\n\t// Marshal the response into binary format so we can send it\n\t// back.\n\tvar buffer [MaxPayloadSize]byte\n\tn, err := res.MarshalBinary(buffer[:], d.r.private[:])\n\tif err != nil {\n\t\tfmt.Println(\"Failed to sign DHT response:\", err)\n\t\treturn\n\t}\n\n\t// Send the DHT response back to the requestor.\n\td.r.send <- types.Frame{\n\t\tSource: d.r.Coords(),\n\t\tDestination: from,\n\t\tType: types.TypeDHTResponse,\n\t\tPayload: buffer[:n],\n\t}\n}", "title": "" }, { "docid": "a8e88e58a7f1f6376adda8788bb5adb2", "score": "0.504934", "text": "func (o *PluginDnsClient) OnRxEvent(event transport.SocketEventType) {}", "title": "" }, { "docid": "2c633d26e8099c7e3f9c016f8bd226fb", "score": "0.50489986", "text": "func (this *ProxyLite) AvailableServiceAddress(conn *net.TCPConn) (data *modelSDSResponse.SDSResponseInfo) {\n\tif conn == nil {\n\t\treturn nil\n\t}\n\n\tvar (\n\t\terr error\n\t\tr string\n\t)\n\n\tr, err = Json.StructToJsonString(this.request)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\t_, err = conn.Write([]byte(strings.Join([]string{r, \"\\n\"}, \"\")))\n\n\tif err != nil {\n\t\tlog.Println(\"proxy send request failure \\r\\n\", err)\n\t\treturn nil\n\t}\n\n\t//\tlog.Println(\"proxy send request =\\r\\n\", string(r))\n\n\tvar (\n\t\trecv_len int\n\t\tbuff []byte = make([]byte, bufferLimit)\n\t\tresponse []byte\n\t)\n\n\tfor {\n\t\ttime.Sleep(10 * time.Millisecond)\n\n\t\t//\t\tconn.SetReadDeadline(time.Now().Add(this.requestTimeout))\n\t\trecv_len, err = conn.Read(buff)\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"proxy recieve response failure \", err)\n\t\t\tresponse = nil\n\t\t\tbreak\n\t\t}\n\n\t\tresponse = append(response, buff[:recv_len]...)\n\n\t\tif recv_len < bufferLimit {\n\t\t\tbreak\n\t\t}\n\t}\n\n\teventData := string(response)\n\n\t//\tlog.Println(\"eventData==>\", eventData)\n\n\tif eventData == \"EOF\" || (response == nil && len(response) <= 0) {\n\t\t//\tif response == nil && len(response) <= 0 {\n\t\treturn nil\n\t}\n\n\terr = Json.JsonbytesToStruct(response, &data)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4b2e744de9e28155a0bbad76a986ee75", "score": "0.50481963", "text": "func svcHandler()", "title": "" }, { "docid": "29df66a2f4f559fde3fe2b27408a31c7", "score": "0.5041569", "text": "func nslookupHandler(c *gin.Context) {\n\tvar data TargetPayload\n\tif err := c.Bind(&data); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tips, err := net.LookupIP(data.Target)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"ips\": ips})\n}", "title": "" }, { "docid": "2f1c3a21a2fd83443354746b46191c46", "score": "0.50414747", "text": "func (service *discoveryService) DiscoveryRequest() error {\n\tdestAddr, err := net.ResolveUDPAddr(\"udp\", fmt.Sprintf(\"%s:%d\", udpAddress, udpPort))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tgo func(service *discoveryService, destAddr *net.UDPAddr) {\n\t\tservice.joinedMulticast.Lock()\n\t\tif service.udpConn == nil {\n\t\t\tservice.errorsChan <- errors.WithStack(ErrConnNotInitialized)\n\t\t}\n\n\t\tn, err := service.udpConn.WriteTo(searchMessage, destAddr)\n\t\tif err != nil {\n\t\t\tservice.errorsChan <- errors.WithStack(err)\n\t\t}\n\t\tif n < len(searchMessage) {\n\t\t\tservice.errorsChan <- errors.WithStack(ErrPartialDiscovery)\n\t\t}\n\t}(service, destAddr)\n\n\treturn nil\n}", "title": "" }, { "docid": "0bfe41c5b0162092d6cb95a8ab159929", "score": "0.5033203", "text": "func (t *DecodeAppDRestReq) OnRequest(data string) workspace.TaskCode {\n\terr := t.getParam(t.R)\n\tif err != nil {\n\t\tlog.Error(\"Parameters validation failed for appd request.\", nil)\n\t\treturn workspace.TaskFinish\n\t}\n\terr = t.parseBody(t.R)\n\tif err != nil {\n\t\tlog.Error(\"Parse rest body failed.\", nil)\n\t}\n\treturn workspace.TaskFinish\n}", "title": "" }, { "docid": "5b5645f12649f58cfbfe0b7e3f32e374", "score": "0.5027843", "text": "func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) {\n\t// The default dns.Mux checks the question section size, but we have our\n\t// own mux here. Check if we have a question section. If not drop them here.\n\tif r == nil || len(r.Question) == 0 {\n\t\terrorAndMetricsFunc(s.Addr, w, r, dns.RcodeServerFailure)\n\t\treturn\n\t}\n\n\tif !s.debug {\n\t\tdefer func() {\n\t\t\t// In case the user doesn't enable error plugin, we still\n\t\t\t// need to make sure that we stay alive up here\n\t\t\tif rec := recover(); rec != nil {\n\t\t\t\tif s.stacktrace {\n\t\t\t\t\tlog.Errorf(\"Recovered from panic in server: %q %v\\n%s\", s.Addr, rec, string(debug.Stack()))\n\t\t\t\t} else {\n\t\t\t\t\tlog.Errorf(\"Recovered from panic in server: %q %v\", s.Addr, rec)\n\t\t\t\t}\n\t\t\t\tvars.Panic.Inc()\n\t\t\t\terrorAndMetricsFunc(s.Addr, w, r, dns.RcodeServerFailure)\n\t\t\t}\n\t\t}()\n\t}\n\n\tif !s.classChaos && r.Question[0].Qclass != dns.ClassINET {\n\t\terrorAndMetricsFunc(s.Addr, w, r, dns.RcodeRefused)\n\t\treturn\n\t}\n\n\tif m, err := edns.Version(r); err != nil { // Wrong EDNS version, return at once.\n\t\tw.WriteMsg(m)\n\t\treturn\n\t}\n\n\t// Wrap the response writer in a ScrubWriter so we automatically make the reply fit in the client's buffer.\n\tw = request.NewScrubWriter(r, w)\n\n\tq := strings.ToLower(r.Question[0].Name)\n\tvar (\n\t\toff int\n\t\tend bool\n\t\tdshandler *Config\n\t)\n\n\tfor {\n\t\tif z, ok := s.zones[q[off:]]; ok {\n\t\t\tfor _, h := range z {\n\t\t\t\tif h.pluginChain == nil { // zone defined, but has not got any plugins\n\t\t\t\t\terrorAndMetricsFunc(s.Addr, w, r, dns.RcodeRefused)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif h.metaCollector != nil {\n\t\t\t\t\t// Collect metadata now, so it can be used before we send a request down the plugin chain.\n\t\t\t\t\tctx = h.metaCollector.Collect(ctx, request.Request{Req: r, W: w})\n\t\t\t\t}\n\n\t\t\t\t// If all filter funcs pass, use this config.\n\t\t\t\tif passAllFilterFuncs(ctx, h.FilterFuncs, &request.Request{Req: r, W: w}) {\n\t\t\t\t\tif h.ViewName != \"\" {\n\t\t\t\t\t\t// if there was a view defined for this Config, set the view name in the context\n\t\t\t\t\t\tctx = context.WithValue(ctx, ViewKey{}, h.ViewName)\n\t\t\t\t\t}\n\t\t\t\t\tif r.Question[0].Qtype != dns.TypeDS {\n\t\t\t\t\t\trcode, _ := h.pluginChain.ServeDNS(ctx, w, r)\n\t\t\t\t\t\tif !plugin.ClientWrite(rcode) {\n\t\t\t\t\t\t\terrorFunc(s.Addr, w, r, rcode)\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\t// The type is DS, keep the handler, but keep on searching as maybe we are serving\n\t\t\t\t\t// the parent as well and the DS should be routed to it - this will probably *misroute* DS\n\t\t\t\t\t// queries to a possibly grand parent, but there is no way for us to know at this point\n\t\t\t\t\t// if there is an actual delegation from grandparent -> parent -> zone.\n\t\t\t\t\t// In all fairness: direct DS queries should not be needed.\n\t\t\t\t\tdshandler = h\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toff, end = dns.NextLabel(q, off)\n\t\tif end {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif r.Question[0].Qtype == dns.TypeDS && dshandler != nil && dshandler.pluginChain != nil {\n\t\t// DS request, and we found a zone, use the handler for the query.\n\t\trcode, _ := dshandler.pluginChain.ServeDNS(ctx, w, r)\n\t\tif !plugin.ClientWrite(rcode) {\n\t\t\terrorFunc(s.Addr, w, r, rcode)\n\t\t}\n\t\treturn\n\t}\n\n\t// Wildcard match, if we have found nothing try the root zone as a last resort.\n\tif z, ok := s.zones[\".\"]; ok {\n\t\tfor _, h := range z {\n\t\t\tif h.pluginChain == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif h.metaCollector != nil {\n\t\t\t\t// Collect metadata now, so it can be used before we send a request down the plugin chain.\n\t\t\t\tctx = h.metaCollector.Collect(ctx, request.Request{Req: r, W: w})\n\t\t\t}\n\n\t\t\t// If all filter funcs pass, use this config.\n\t\t\tif passAllFilterFuncs(ctx, h.FilterFuncs, &request.Request{Req: r, W: w}) {\n\t\t\t\tif h.ViewName != \"\" {\n\t\t\t\t\t// if there was a view defined for this Config, set the view name in the context\n\t\t\t\t\tctx = context.WithValue(ctx, ViewKey{}, h.ViewName)\n\t\t\t\t}\n\t\t\t\trcode, _ := h.pluginChain.ServeDNS(ctx, w, r)\n\t\t\t\tif !plugin.ClientWrite(rcode) {\n\t\t\t\t\terrorFunc(s.Addr, w, r, rcode)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// Still here? Error out with REFUSED.\n\terrorAndMetricsFunc(s.Addr, w, r, dns.RcodeRefused)\n}", "title": "" }, { "docid": "545e5e4348439ffc9689ba3e03b9d7ec", "score": "0.5002412", "text": "func (d Config) Service() string {\n\treturn \"dns\"\n}", "title": "" }, { "docid": "baaf1c524ef32a573ad08ae47e1fefd3", "score": "0.49926016", "text": "func (d *Discovery) handleDiscoveryRequest(channelID string, req *gproto.AppDataRequest, responder appdata.Responder) {\n\tlogger.Debugf(\"[%s] Handling discovery request\", channelID)\n\n\tvar peerEndpoints []string\n\terr := d.unmarshal(req.Request, &peerEndpoints)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error unmarshalling peer endpoints in request: %s\")\n\n\t\t// Respond with nil so that the requesting peer doesn't have to wait for a timeout\n\t\tresponder.Respond(nil)\n\n\t\treturn\n\t}\n\n\tlogger.Debugf(\"[%s] Got discovery request for endpoints: %s\", channelID, peerEndpoints)\n\n\tresponse := make(servicesByPeer)\n\n\tfor _, peerEndpoint := range peerEndpoints {\n\t\tresponse[peerEndpoint] = d.forChannel(channelID).servicesForPeer(peerEndpoint)\n\t}\n\n\trespBytes, err := d.marshal(response)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error marshalling response: %s\")\n\n\t\t// Will respond with nil so that the requesting peer doesn't have to wait for a timeout\n\t}\n\n\tresponder.Respond(respBytes)\n}", "title": "" }, { "docid": "a951bf47a9fa5711fabce497da5214af", "score": "0.49510327", "text": "func (l *UDPListener) respond(b []byte, addr net.Addr, conn *net.UDPConn) {\n\tpacket := gopacket.NewPacket(b, layers.LayerTypeDNS, gopacket.Default)\n\tdnsPacket := packet.Layer(layers.LayerTypeDNS)\n\ttcp, _ := dnsPacket.(*layers.DNS)\n\tanswer := l.Factory.BuildResponse(tcp)\n\tbuf := gopacket.NewSerializeBuffer()\n\to := gopacket.SerializeOptions{}\n\terr := answer.SerializeTo(buf, o)\n\tif err != nil {\n\t\tlog.Error(\"Error writing to buffer\") //TODO improve this to handle request tracing\n\t}\n\tconn.WriteTo(buf.Bytes(), addr)\n}", "title": "" }, { "docid": "9b88ec1c997fdbac0611c297ecfbf22f", "score": "0.4939731", "text": "func recordHandle(que *dnsQuestion, req []byte) (rsp []byte, err error) {\n\tvar exist bool\n\tvar ip string\n\t// qType should be 1 for ipv4\n\tif que.name != nil && que.qType == aRecord {\n\t\tdomainName := string(que.name)\n\t\texist, ip = lookupFromMetaManager(domainName)\n\t}\n\n\tif !exist || que.event == eventUpstream {\n\t\t// if this service doesn't belongs to this cluster\n\t\tgo getFromRealDNS(req, que.from)\n\t\treturn rsp, fmt.Errorf(\"get from real dns\")\n\t}\n\n\taddress := net.ParseIP(ip).To4()\n\tif address == nil {\n\t\tque.event = eventNxDomain\n\t}\n\t// gen\n\tpre := modifyRspPrefix(que)\n\trsp = append(rsp, pre...)\n\tif que.event != eventNothing {\n\t\treturn rsp, nil\n\t}\n\t// create a deceptive resp, if no error\n\tdnsAns := &dnsAnswer{\n\t\tname: que.name,\n\t\tqType: que.qType,\n\t\tqClass: que.qClass,\n\t\tttl: ttl,\n\t\tdataLen: uint16(len(address)),\n\t\taddr: address,\n\t}\n\tans := dnsAns.getAnswer()\n\trsp = append(rsp, ans...)\n\n\treturn rsp, nil\n}", "title": "" }, { "docid": "d63ce3ca2c6782ab7891365841f81f95", "score": "0.49394965", "text": "func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\tif state.QClass() != dns.ClassCHAOS || state.QType() != dns.TypeTXT {\n\t\treturn plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)\n\t}\n\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\n\thdr := dns.RR_Header{Name: state.QName(), Rrtype: dns.TypeTXT, Class: dns.ClassCHAOS, Ttl: 0}\n\tswitch state.Name() {\n\tdefault:\n\t\treturn plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)\n\tcase \"authors.bind.\":\n\t\trnd := rand.New(rand.NewSource(time.Now().Unix()))\n\n\t\tfor _, i := range rnd.Perm(len(c.Authors)) {\n\t\t\tm.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{c.Authors[i]}})\n\t\t}\n\tcase \"version.bind.\", \"version.server.\":\n\t\tm.Answer = []dns.RR{&dns.TXT{Hdr: hdr, Txt: []string{c.Version}}}\n\tcase \"hostname.bind.\", \"id.server.\":\n\t\thostname, err := os.Hostname()\n\t\tif err != nil {\n\t\t\thostname = \"localhost\"\n\t\t}\n\t\tm.Answer = []dns.RR{&dns.TXT{Hdr: hdr, Txt: []string{trim(hostname)}}}\n\t}\n\tw.WriteMsg(m)\n\treturn 0, nil\n}", "title": "" }, { "docid": "0bac2b76f89dd5b1cedd0bde81bae2c4", "score": "0.49340597", "text": "func OptDNS(ip ...net.IP) Option {\n\treturn &optDNS{NameServers: ip}\n}", "title": "" }, { "docid": "c94ffd68d68117aa281857608412142c", "score": "0.4933101", "text": "func makeDNSHandler(blacklist *Blacklist, upstream string, logging bool) func(dns.ResponseWriter, *dns.Msg) {\n\n\t// create the logger functions\n\tlogger := func(res *dns.Msg, duration time.Duration, how string) {}\n\terrorLogger := func(err error, description string) {\n\t\tlog.Print(description, err)\n\t}\n\tif logging {\n\t\tlogger = func(msg *dns.Msg, rtt time.Duration, how string) {\n\t\t\tlog.Printf(\"Using %s, response time %s:\\n%s\\n\", how, rtt.String(), msg.String())\n\t\t}\n\t\terrorLogger = func(err error, description string) {\n\n\t\t}\n\t}\n\n\t// cache for the DNS replies from the DNS server\n\tcache := NewCache()\n\n\t// we use a single client to resolve queries against the upstream DNS\n\tclient := new(dns.Client)\n\n\t// create the real handler\n\treturn func(w dns.ResponseWriter, req *dns.Msg) {\n\t\tstart := time.Now()\n\n\t\t// the standard allows multiple DNS questions in a single query... but nobody uses it, so we disallow it\n\t\t// https://stackoverflow.com/questions/4082081/requesting-a-and-aaaa-records-in-single-dns-query/4083071\n\t\tif len(req.Question) != 1 {\n\n\t\t\t// reply with a format error\n\t\t\tres := new(dns.Msg)\n\t\t\tres.SetRcode(req, dns.RcodeFormatError)\n\t\t\terr := w.WriteMsg(res)\n\t\t\tif err != nil {\n\t\t\t\terrorLogger(err, \"Error to write DNS response message to client\")\n\t\t\t}\n\n\t\t\t// collect metrics\n\t\t\tduration := time.Since(start).Seconds()\n\t\t\tqueriesHistogram.WithLabelValues(\"malformed_query\", \"-\").Observe(duration)\n\n\t\t\treturn\n\t\t}\n\n\t\t// extract the DNS question\n\t\tquery := req.Question[0]\n\t\tdomain := strings.TrimRight(query.Name, \".\")\n\t\tqueryType := dns.TypeToString[query.Qtype]\n\n\t\t// check the cache first: if a domain is in the cache, it cannot be blocked\n\t\t// this optimized response times for allowed domains over the blocked domains\n\t\tcached, found := cache.Get(&query)\n\t\tif found {\n\n\t\t\t// cache found, use the cached answer\n\t\t\tres := cached.SetReply(req)\n\t\t\tres.Answer = cached.Answer\n\t\t\terr := w.WriteMsg(res)\n\t\t\tif err != nil {\n\t\t\t\terrorLogger(err, \"Error to write DNS response message to client\")\n\t\t\t}\n\n\t\t\t// log the query\n\t\t\tduration := time.Since(start)\n\t\t\tlogger(res, duration, \"cache\")\n\n\t\t\t// collect metrics\n\t\t\tdurationSeconds := duration.Seconds()\n\t\t\tqueriesHistogram.WithLabelValues(\"cache\", queryType).Observe(durationSeconds)\n\n\t\t\treturn\n\t\t}\n\n\t\t// then, check if the domain is blocked\n\t\tblocked := blacklist.Contains(domain)\n\t\tif blocked {\n\n\t\t\t// reply with \"domain not found\"\n\t\t\tres := new(dns.Msg)\n\t\t\tres.SetRcode(req, dns.RcodeNameError)\n\t\t\terr := w.WriteMsg(res)\n\t\t\tif err != nil {\n\t\t\t\terrorLogger(err, \"Error to write DNS response message to client\")\n\t\t\t}\n\n\t\t\t// log the query\n\t\t\tduration := time.Since(start)\n\t\t\tlogger(res, duration, \"block\")\n\n\t\t\t// collect metrics\n\t\t\tdurationSeconds := duration.Seconds()\n\t\t\tqueriesHistogram.WithLabelValues(\"block\", queryType).Observe(durationSeconds)\n\n\t\t\treturn\n\t\t}\n\n\t\t// finally, query an upstream DNS\n\t\tres, rtt, err := client.Exchange(req, upstream)\n\t\tif err == nil {\n\n\t\t\t// reply to the query\n\t\t\terr := w.WriteMsg(res)\n\t\t\tif err != nil {\n\t\t\t\terrorLogger(err, \"Error to write DNS response message to client\")\n\t\t\t}\n\n\t\t\t// cache the result if any\n\t\t\tif len(res.Answer) > 0 {\n\t\t\t\texpiration := time.Duration(res.Answer[0].Header().Ttl) * time.Second\n\t\t\t\tcache.Set(&query, res, expiration)\n\t\t\t}\n\n\t\t\t// log the query\n\t\t\tlogger(res, rtt, \"upstream\")\n\n\t\t\t// collect metrics\n\t\t\tdurationSeconds := time.Since(start).Seconds()\n\t\t\tqueriesHistogram.WithLabelValues(\"upstream\", queryType).Observe(durationSeconds)\n\n\t\t} else {\n\n\t\t\t// log the error\n\t\t\terrorLogger(err, \"Error in resolve query against upstream DNS \"+upstream)\n\n\t\t\t// collect metrics\n\t\t\tdurationSeconds := time.Since(start).Seconds()\n\t\t\tqueriesHistogram.WithLabelValues(\"upstream_error\", queryType).Observe(durationSeconds)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c41e5eb6a1403d9084abcae7cb5c7794", "score": "0.49287784", "text": "func (_class PIFClass) GetDNS(sessionID SessionRef, self PIFRef) (_retval string, _err error) {\n\t_method := \"PIF.get_DNS\"\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 := convertPIFRefToXen(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 = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "851b4cff1f97583cef2939e797945293", "score": "0.49267536", "text": "func (srv *Server) handleRequest(msg *Message) {\n\treplyPayload, err := srv.hooks.OnRequest(\n\t\tcontext.WithValue(context.Background(), Msg, *msg),\n\t)\n\tif err != nil {\n\t\tmsg.fail(*err)\n\t\treturn\n\t}\n\tmsg.fulfill(replyPayload)\n}", "title": "" }, { "docid": "2a2e307e81fe8de44ac9128ee75391c7", "score": "0.4922511", "text": "func handleRequest(w dns.ResponseWriter, r *dns.Msg) {\n\n\tvar found = false\n\tm := new(dns.Msg)\n\tm.SetReply(r)\n\n\tm.RecursionAvailable = r.RecursionDesired\n\n\tif r.Question[0].Qtype == dns.TypeA {\n\t\tfor i := range parsedDomains {\n\t\t\tif dns.IsSubDomain(dns.Fqdn(parsedDomains[i]), dns.Fqdn(m.Question[0].Name)) {\n\t\t\t\tm.Answer = make([]dns.RR, 1)\n\t\t\t\tm.Authoritative = true\n\n\t\t\t\tm.Answer[0] = &dns.A{\n\t\t\t\t\tHdr: dns.RR_Header{Name: m.Question[0].Name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 120},\n\t\t\t\t\tA: net.ParseIP(\"127.0.0.1\"),\n\t\t\t\t}\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t}\n\tif found == false {\n\t\tm.Rcode = dns.RcodeNameError\n\t}\n\tw.WriteMsg(m)\n}", "title": "" }, { "docid": "32f40bec84561058980d1c5c4c58bd55", "score": "0.49167135", "text": "func (c *AdsCallbacks) OnFetchRequest(ctxt context.Context, req *v2.DiscoveryRequest) error {\n\tlog.Printf(\"%v : OnFetchRequest %s\\n\", req.Node.Id, req.TypeUrl)\n\tif req.ErrorDetail != nil {\n\t\tlog.Printf(\"%v : Fetch Request Error in : %v\", req.Node.Id, req.ErrorDetail)\n\t\treturn NewConfigError(fmt.Sprintf(\"%v : Fetch Request Error in : %v\", req.Node.Id, req.ErrorDetail))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "363a0c25bf462fe5572b120234d4d0fa", "score": "0.4894497", "text": "func (bas *BaseService) Request(ctx context.Context, args Args) {\n\tif bas.running() {\n\t\tbas.queueRequest(bas.service.OnRequest, ctx, args)\n\t}\n}", "title": "" }, { "docid": "dd839661f88602d0d7e0dcc7944638ec", "score": "0.489149", "text": "func (d *DNS) Check(ipaddr net.IP) error {\n\t// NOTE: We are ignoring error. It says: \"nodename nor servname\n\t// provided, or not known\" if there is no DNS name for the IP address.\n\tnames, _ := net.LookupAddr(ipaddr.String())\n\td.Names = names\n\treturn nil\n}", "title": "" }, { "docid": "dd1ac89d50f134b22506c0a7d894df02", "score": "0.48912978", "text": "func newdnsController(kubeClient kubernetes.Interface, namespace, zone string, rulesCallback func([]rewrite.Rule)) *dnsControl {\n\tdns := &dnsControl{\n\t\tstopCh: make(chan struct{}),\n\t\tready: make(chan struct{}),\n\t}\n\n\tstore := cache.NewUndeltaStore(func(is []interface{}) {\n\t\tdns.readyOnce.Do(func() {\n\t\t\tclose(dns.ready)\n\t\t})\n\n\t\trules := make([]rewrite.Rule, 0, len(is))\n\n\t\tfor _, i := range is {\n\t\t\tsvc := i.(*api.Service)\n\t\t\tif svc == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfrom, ok := svc.Annotations[\"egress.monzo.com/dns-name\"]\n\t\t\tif !ok {\n\t\t\t\tlog.Warningf(\"%s is missing dns-name annotation\", svc.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tto := fmt.Sprintf(\"%s.%s.svc.%s\", svc.Name, svc.Namespace, zone)\n\n\t\t\trewriteQuestionFrom := plugin.Name(from).Normalize()\n\t\t\trewriteQuestionTo := plugin.Name(to).Normalize()\n\n\t\t\trewriteAnswerFromPattern, err := regexp.Compile(rewriteQuestionTo)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trules = append(rules, &exactNameRule{\n\t\t\t\tNextAction: \"stop\",\n\t\t\t\tFrom: rewriteQuestionFrom,\n\t\t\t\tTo: rewriteQuestionTo,\n\t\t\t\tResponseRule: rewrite.ResponseRule{\n\t\t\t\t\tActive: true,\n\t\t\t\t\tType: \"name\",\n\t\t\t\t\tPattern: rewriteAnswerFromPattern,\n\t\t\t\t\tReplacement: rewriteQuestionFrom,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\trulesCallback(rules)\n\t}, cache.MetaNamespaceKeyFunc)\n\n\ts := labels.SelectorFromSet(map[string]string{\n\t\t\"app\": \"egress-gateway\",\n\t\t\"egress.monzo.com/hijack-dns\": \"true\",\n\t})\n\n\tdns.reflector = cache.NewReflector(&cache.ListWatch{\n\t\tListFunc: serviceListFunc(kubeClient, namespace, s),\n\t\tWatchFunc: serviceWatchFunc(kubeClient, namespace, s),\n\t}, &api.Service{}, store, 0)\n\n\treturn dns\n}", "title": "" }, { "docid": "6de8a65638bd5e3e51f5910289ac214a", "score": "0.48890412", "text": "func (k *Kubernetes) Services(ctx context.Context, state request.Request, exact bool, opt plugin.Options) (svcs []msg.Service, err error) {\n\t// We're looking again at types, which we've already done in ServeDNS, but there are some types k8s just can't answer.\n\tswitch state.QType() {\n\tcase dns.TypeTXT:\n\t\t// 1 label + zone, label must be \"dns-version\".\n\t\tt, _ := dnsutil.TrimZone(state.Name(), state.Zone)\n\n\t\t// Hard code the only valid TXT - \"dns-version.<zone>\"\n\t\tsegs := dns.SplitDomainName(t)\n\t\tif len(segs) == 1 && segs[0] == \"dns-version\" {\n\t\t\tsvc := msg.Service{Text: DNSSchemaVersion, TTL: 28800, Key: msg.Path(state.QName(), coredns)}\n\t\t\treturn []msg.Service{svc}, nil\n\t\t}\n\n\t\t// Check if we have an existing record for this query of another type\n\t\tservices, _ := k.Records(ctx, state, false)\n\n\t\tif len(services) > 0 {\n\t\t\t// If so we return an empty NOERROR\n\t\t\treturn nil, nil\n\t\t}\n\n\t\t// Return NXDOMAIN for no match\n\t\treturn nil, errNoItems\n\n\tcase dns.TypeNS:\n\t\t// We can only get here if the qname equals the zone, see ServeDNS in handler.go.\n\t\tnss := k.nsAddrs(false, false, state.Zone)\n\t\tvar svcs []msg.Service\n\t\tfor _, ns := range nss {\n\t\t\tif ns.Header().Rrtype == dns.TypeA {\n\t\t\t\tsvcs = append(svcs, msg.Service{Host: ns.(*dns.A).A.String(), Key: msg.Path(ns.Header().Name, coredns), TTL: k.ttl})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ns.Header().Rrtype == dns.TypeAAAA {\n\t\t\t\tsvcs = append(svcs, msg.Service{Host: ns.(*dns.AAAA).AAAA.String(), Key: msg.Path(ns.Header().Name, coredns), TTL: k.ttl})\n\t\t\t}\n\t\t}\n\t\treturn svcs, nil\n\t}\n\n\tif isDefaultNS(state.Name(), state.Zone) {\n\t\tnss := k.nsAddrs(false, false, state.Zone)\n\t\tvar svcs []msg.Service\n\t\tfor _, ns := range nss {\n\t\t\tif ns.Header().Rrtype == dns.TypeA && state.QType() == dns.TypeA {\n\t\t\t\tsvcs = append(svcs, msg.Service{Host: ns.(*dns.A).A.String(), Key: msg.Path(state.QName(), coredns), TTL: k.ttl})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ns.Header().Rrtype == dns.TypeAAAA && state.QType() == dns.TypeAAAA {\n\t\t\t\tsvcs = append(svcs, msg.Service{Host: ns.(*dns.AAAA).AAAA.String(), Key: msg.Path(state.QName(), coredns), TTL: k.ttl})\n\t\t\t}\n\t\t}\n\t\treturn svcs, nil\n\t}\n\n\ts, e := k.Records(ctx, state, false)\n\n\t// SRV for external services is not yet implemented, so remove those records.\n\n\tif state.QType() != dns.TypeSRV {\n\t\treturn s, e\n\t}\n\n\tinternal := []msg.Service{}\n\tfor _, svc := range s {\n\t\tif t, _ := svc.HostType(); t != dns.TypeCNAME {\n\t\t\tinternal = append(internal, svc)\n\t\t}\n\t}\n\n\treturn internal, e\n}", "title": "" }, { "docid": "384162d8ede36a3d5306b045a255aa3f", "score": "0.48813784", "text": "func (d DNS64) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tdrr := &ResponseWriter{d, w}\n\treturn d.Next.ServeDNS(ctx, drr, r)\n}", "title": "" }, { "docid": "3e5dc96004aa6b648fc39bc63c6a67b3", "score": "0.48760572", "text": "func (s *DNSSeeder) loadDNS() {\n\tupdateDNS(s)\n}", "title": "" }, { "docid": "d2bad50ff64b74ee3589433a3a6eee3e", "score": "0.48376516", "text": "func (srv *server) handleRequest(clt *Client, msg *Message) {\n\treplyPayload, returnedErr := srv.impl.OnRequest(\n\t\tcontext.Background(),\n\t\tclt,\n\t\tmsg,\n\t)\n\tswitch returnedErr.(type) {\n\tcase nil:\n\t\tsrv.fulfillMsg(clt, msg, replyPayload)\n\tcase ReqErr:\n\t\tsrv.failMsg(clt, msg, returnedErr)\n\tcase *ReqErr:\n\t\tsrv.failMsg(clt, msg, returnedErr)\n\tdefault:\n\t\tsrv.errorLog.Printf(\"Internal error during request handling: %s\", returnedErr)\n\t\tsrv.failMsg(clt, msg, returnedErr)\n\t}\n}", "title": "" }, { "docid": "79d1c0f238cd9b35dbd7c586e31048d1", "score": "0.4837141", "text": "func (ss *SNSServer) DnsReady() (e error) {\n\n\t// if an SOA provider isn't given, we're done\n\tif ss.SOAProvider == \"\" {\n\t\treturn nil\n\t}\n\n\tvar (\n\t\tctx context.Context\n\t\tcancel context.CancelFunc\n\t)\n\n\tif ss.waitForDns > 0 {\n\t\tctx, cancel = context.WithTimeout(context.Background(), ss.waitForDns)\n\t} else {\n\t\tctx, cancel = context.WithCancel(context.Background())\n\t}\n\tdefer cancel()\n\n\t// Creating the dns client for our query\n\tclient := dns.Client{\n\t\tNet: \"tcp\", // tcp to connect to the SOA provider? or udp (default)?\n\t\tDialer: &net.Dialer{\n\t\t\tTimeout: ss.waitForDns,\n\t\t},\n\t}\n\t// the message contains what we are looking for - the SOA record of the host\n\tmsg := dns.Msg{}\n\tmsg.SetQuestion(strings.SplitN(ss.SelfUrl.Host, \":\", 2)[0]+\".\", dns.TypeANY)\n\n\tdefer cancel()\n\n\tvar check = func() <-chan struct{} {\n\t\tvar channel = make(chan struct{})\n\n\t\tgo func(c chan struct{}) {\n\t\t\tvar (\n\t\t\t\terr error\n\t\t\t\tresponse *dns.Msg\n\t\t\t)\n\n\t\t\tfor {\n\t\t\t\t// sending the dns query to the soa provider\n\t\t\t\tresponse, _, err = client.Exchange(&msg, ss.SOAProvider)\n\t\t\t\t// if we found a record, then we are done\n\t\t\t\tif err == nil && response != nil && response.Rcode == dns.RcodeSuccess && len(response.Answer) > 0 {\n\t\t\t\t\tc <- struct{}{}\n\t\t\t\t\tss.metrics.DnsReady.Add(1.0)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// otherwise, we keep trying\n\t\t\t\tss.metrics.DnsReadyQueryCount.Add(1.0)\n\t\t\t\tss.logger.Info(\"checking if server's DNS is ready\",\n\t\t\t\t\tzap.String(\"endpoint\", strings.SplitN(ss.SelfUrl.Host, \":\", 2)[0]+\".\"), zap.Error(err), zap.Any(\"response\", response))\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t}\n\t\t}(channel)\n\n\t\treturn channel\n\t}\n\n\tselect {\n\tcase <-check():\n\tcase <-ctx.Done():\n\t\te = ctx.Err()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7615ab9fc90929363eb772a50af51874", "score": "0.48363575", "text": "func (h errorHandler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tdefer h.recovery(ctx, w, r)\n\n\trcode, err := h.Next.ServeDNS(ctx, w, r)\n\n\tif err != nil {\n\t\tstate := request.Request{W: w, Req: r}\n\t\terrMsg := fmt.Sprintf(\"%s [ERROR %d %s %s] %v\", time.Now().Format(timeFormat), rcode, state.Name(), state.Type(), err)\n\n\t\tif h.Debug {\n\t\t\t// Write error to response as a txt message instead of to log\n\t\t\tanswer := debugMsg(rcode, r)\n\t\t\ttxt, _ := dns.NewRR(\". IN 0 TXT \" + errMsg)\n\t\t\tanswer.Answer = append(answer.Answer, txt)\n\t\t\tstate.SizeAndDo(answer)\n\t\t\tw.WriteMsg(answer)\n\t\t\treturn 0, err\n\t\t}\n\t\th.Log.Println(errMsg)\n\t}\n\n\treturn rcode, err\n}", "title": "" }, { "docid": "9d7c087e46d4b0dc59baa376ec8cac76", "score": "0.48275402", "text": "func (srv *Server) handleRequest(msg *Message) {\n\tsrv.opsLock.Lock()\n\t// Reject incoming requests during shutdown, return special shutdown error\n\tif srv.shutdown {\n\t\tsrv.opsLock.Unlock()\n\t\tmsg.failDueToShutdown()\n\t\treturn\n\t}\n\tsrv.currentOps++\n\tsrv.opsLock.Unlock()\n\n\treplyPayload, returnedErr := srv.hooks.OnRequest(\n\t\tcontext.WithValue(context.Background(), Msg, *msg),\n\t)\n\tswitch returnedErr.(type) {\n\tcase nil:\n\t\tmsg.fulfill(replyPayload)\n\tcase ReqErr:\n\t\tmsg.fail(returnedErr)\n\tcase *ReqErr:\n\t\tmsg.fail(returnedErr)\n\tdefault:\n\t\tsrv.errorLog.Printf(\"Internal error during request handling: %s\", returnedErr)\n\t\tmsg.fail(returnedErr)\n\t}\n\n\t// Mark request as done and shutdown the server if scheduled and no ops are left\n\tsrv.opsLock.Lock()\n\tsrv.currentOps--\n\tif srv.shutdown && srv.currentOps < 1 {\n\t\tclose(srv.shutdownRdy)\n\t}\n\tsrv.opsLock.Unlock()\n}", "title": "" }, { "docid": "dcc750f44d304dfbde8dca203358f32c", "score": "0.48250896", "text": "func (o *PluginDnsClient) OnRxData(d []byte) {\n\tformatError := false\n\to.stats.rxBytes += uint64(len(d))\n\tvar dns layers.DNS\n\terr := dns.DecodeFromBytes(d, o)\n\tif err != nil {\n\t\to.stats.pktRxDecodeError++\n\t\tformatError = true\n\t}\n\n\tif o.IsNameServer() {\n\t\tif formatError {\n\t\t\t// Reply with format error\n\t\t\to.Reply(0, []layers.DNSQuestion{}, o.socket)\n\t\t\treturn // Done. Can't proceed!\n\t\t}\n\t\tif dns.QR != false {\n\t\t\t// Response received in name server! Nothing to do.\n\t\t\to.stats.pktRxDnsResponse++\n\t\t} else {\n\t\t\t// Query received in name server!\n\t\t\to.stats.pktRxDnsQuery++\n\t\t\tif dns.QDCount > 0 {\n\t\t\t\to.stats.rxQuestions += uint64(dns.QDCount)\n\t\t\t\to.Reply(dns.ID, dns.Questions, o.socket)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif formatError {\n\t\t\t// Nothing to do on client!\n\t\t\treturn\n\t\t}\n\t\tif dns.QR == false {\n\t\t\t// Query received in simple client! Nothing to do.\n\t\t\to.stats.pktRxDnsQuery++\n\t\t} else {\n\t\t\t// Response received in simple client! Cache it.\n\t\t\to.stats.pktRxDnsResponse++\n\t\t\tif dns.ResponseCode == layers.DNSResponseCodeNoErr && dns.ANCount > 0 {\n\t\t\t\tutils.AddAnswersToCache(o.cache, dns.Answers)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f24c3ae18d67eb31aba2e9b040a15ce7", "score": "0.4818481", "text": "func MetricsSendDHCPRequest(Ctx *ReqCtx) (err error) {\n\tif !o.MetricsEnabled {\n\t\treturn\n\t}\n\n\tTags := map[string]string{\n\t\t\"ServerID\": o.ServerID,\n\t\t\"LocalIP\": Ctx.LocalIPStr,\n\t\t\"DHCPRequest\": Ctx.DHCPRequest.String(),\n\t\t\"DHCPResponse\": Ctx.DHCPResponse.String(),\n\t}\n\n\tif Ctx.SegmentCopy != nil {\n\t\tTags[\"SegmentId\"] = strconv.Itoa(Ctx.SegmentCopy.Id)\n\t\tTags[\"SegmentName\"] = Ctx.SegmentCopy.Name\n\t}\n\n\tif Ctx.SubnetCopy != nil {\n\t\tTags[\"Subnet\"] = Ctx.SubnetCopy.NetStr\n\t}\n\n\tif Ctx.DropReason != \"\" {\n\t\tTags[\"DropReason\"] = Ctx.DropReason\n\t}\n\n\tif Ctx.NAKReason != \"\" {\n\t\tTags[\"NAKReason\"] = Ctx.NAKReason\n\t}\n\n\tif Ctx.LeaseSource != \"\" {\n\t\tTags[\"LeaseSource\"] = Ctx.LeaseSource\n\t}\n\n\tif Ctx.NotFoundReason != \"\" {\n\t\tTags[\"NotFoundReason\"] = Ctx.NotFoundReason\n\t}\n\n\tswitch Ctx.RelayIPSource {\n\tcase STATS_RELAYIP_GIADDR:\n\t\tTags[\"RelayIPSource\"] = \"GIAddr\"\n\tcase STATS_RELAYIP_OPTION82:\n\t\tTags[\"RelayIPSource\"] = \"Option82\"\n\tcase STATS_RELAYIP_UNICAST:\n\t\tTags[\"RelayIPSource\"] = \"Unicast\"\n\t}\n\n\tFields := map[string]interface{}{\n\t\t\"RequestSize\": Ctx.RequestSize,\n\t\t\"MAC\": Ctx.MACStr,\n\t\t\"RemoteIP\": Ctx.RemoteIPStr,\n\t\t\"Duration\": int(Ctx.RequestDuration.Nanoseconds() / 1000),\n\t}\n\n\tif Ctx.ResponseSize > 0 {\n\t\tFields[\"ResponseSize\"] = Ctx.ResponseSize\n\t}\n\n\tif Ctx.RelayIP > 0 {\n\t\tFields[\"RelayIP\"] = Ctx.RelayIPStr\n\t}\n\n\tif Ctx.IP > 0 {\n\t\tFields[\"LeaseIP\"] = Ctx.IPStr\n\t}\n\n\tif Ctx.LeaseCopy != nil {\n\t\tif Ctx.LeaseCopy.Discover {\n\t\t\tFields[\"TxDuration\"] = int(Ctx.LeaseCopy.TxDuration().Nanoseconds() / 1000)\n\t\t}\n\n\t\tif Ctx.DHCPResponse == dhcp.ACK {\n\t\t\tFields[\"TTL\"] = int(Ctx.LeaseCopy.ExpiresIn())\n\t\t}\n\t}\n\n\tInfluxDB.SendMetric(&metrics.InfluxDBMetric{\n\t\tMeasurement: o.MetricsMeasurementRequests,\n\t\tTimestamp: time.Now(),\n\n\t\tTags: Tags,\n\t\tFields: Fields,\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "fe280f16d4850ac42e25bf9f7ecf91d2", "score": "0.48141354", "text": "func (ds *DNSService) dnsWildcardMatch(req *AmassRequest) bool {\n\tanswer := make(chan bool, 2)\n\n\tds.wildcards <- &wildcard{\n\t\tReq: req,\n\t\tAns: answer,\n\t}\n\treturn <-answer\n}", "title": "" }, { "docid": "a4d6d9961110edeedb3d822d3373b21f", "score": "0.4803279", "text": "func (r *subdomainTask) Process(ctx context.Context, data pipeline.Data, tp pipeline.TaskParams) (pipeline.Data, error) {\n\treq, ok := data.(*requests.DNSRequest)\n\tif !ok {\n\t\treturn data, nil\n\t}\n\tif req == nil || !r.enum.Config.IsDomainInScope(req.Name) {\n\t\treturn nil, nil\n\t}\n\n\t// Do not further evaluate service subdomains\n\tfor _, label := range strings.Split(req.Name, \".\") {\n\t\tl := strings.ToLower(label)\n\n\t\tif l == \"_tcp\" || l == \"_udp\" || l == \"_tls\" {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tr.queue.Append(&requests.ResolvedRequest{\n\t\tName: req.Name,\n\t\tDomain: req.Domain,\n\t\tRecords: append([]requests.DNSAnswer(nil), req.Records...),\n\t\tTag: req.Tag,\n\t\tSource: req.Source,\n\t})\n\n\treturn r.checkForSubdomains(ctx, req, tp)\n}", "title": "" }, { "docid": "8c9009817592ce306c1528d07cff7fbd", "score": "0.47692353", "text": "func (master *DHTNode) lookupReq(t, key string, dhtNode *DHTNode) {\n\tm := createLookupMsg(t, master.transport.bindAddress, key, master.transport.bindAddress, dhtNode.transport.bindAddress)\n \tgo func () { dhtNode.transport.send(m)} () \t\n}", "title": "" }, { "docid": "4e4b67409a9b0464c683a233911b2575", "score": "0.47463706", "text": "func updateResultDNSConfig(result *current.Result, cniConfig *CNIConfig) {\n\tresult.DNS = cniConfig.DNS\n}", "title": "" }, { "docid": "763fc2b288ed58c66356fc279f664e63", "score": "0.47415575", "text": "func (s *server) ServeDNSForward(w dns.ResponseWriter, req *dns.Msg) *dns.Msg {\n\tif s.config.NoRec {\n\t\tm := s.ServerFailure(req)\n\t\tw.WriteMsg(m)\n\t\treturn m\n\t}\n\n\tif len(s.config.Nameservers) == 0 || dns.CountLabel(req.Question[0].Name) < s.config.Ndots {\n\t\tif s.config.Verbose {\n\t\t\tif len(s.config.Nameservers) == 0 {\n\t\t\t\tlogf(\"can not forward, no nameservers defined\")\n\t\t\t} else {\n\t\t\t\tlogf(\"can not forward, name too short (less than %d labels): `%s'\", s.config.Ndots, req.Question[0].Name)\n\t\t\t}\n\t\t}\n\t\tm := s.ServerFailure(req)\n\t\tm.RecursionAvailable = true // this is still true\n\t\tw.WriteMsg(m)\n\t\treturn m\n\t}\n\n\tvar (\n\t\tr *dns.Msg\n\t\terr error\n\t)\n\n\tnsid := s.randomNameserverID(req.Id)\n\ttry := 0\nRedo:\n\tif isTCP(w) {\n\t\tr, err = exchangeWithRetry(s.dnsTCPclient, req, s.config.Nameservers[nsid])\n\t} else {\n\t\tr, err = exchangeWithRetry(s.dnsUDPclient, req, s.config.Nameservers[nsid])\n\t}\n\tif err == nil {\n\t\tr.Compress = true\n\t\tr.Id = req.Id\n\t\tw.WriteMsg(r)\n\t\treturn r\n\t}\n\t// Seen an error, this can only mean, \"server not reached\", try again\n\t// but only if we have not exausted our nameservers.\n\tif try < len(s.config.Nameservers) {\n\t\ttry++\n\t\tnsid = (nsid + 1) % len(s.config.Nameservers)\n\t\tgoto Redo\n\t}\n\n\tlogf(\"failure to forward request %q\", err)\n\tm := s.ServerFailure(req)\n\treturn m\n}", "title": "" }, { "docid": "1f99db3c06719cdf00de79e24e788c9a", "score": "0.47391093", "text": "func (ad *AutoDNS) HandleFunc(w dns.ResponseWriter, req *dns.Msg) {\n\tvar err error\n\t/* any questions? */\n\tif len(req.Question) < 1 {\n\t\treturn\n\t}\n\n\trmsg := new(dns.Msg)\n\trmsg.SetReply(req)\n\tq := req.Question[0]\n\tswitch q.Qtype {\n\tcase dns.TypeA:\n\t\tglog.V(LINFO).Infoln(\"requesting:\", q.Name, dns.TypeToString[q.Qtype])\n\n\t\tfor qName := q.Name[:len(q.Name)-1]; strings.Count(qName, `.`) > 0; qName = qName[strings.Index(qName, `.`)+1:] {\n\t\t\toffsets := ad.outsideListIndex.Lookup([]byte(qName), 1)\n\t\t\tif len(offsets) > 0 {\n\t\t\t\tglog.V(LDEBUG).Infoln(qName, \"Hit OutsideList\")\n\t\t\t\tad.outsideHandleFunc(w, req)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tad.insideHandleFunc(w, req)\n\t\treturn\n\tcase dns.TypeANY:\n\t\tglog.V(LINFO).Infoln(\"request-block\", q.Name, dns.TypeToString[q.Qtype])\n\tdefault:\n\t\tglog.V(LINFO).Infoln(\"requesting:\", q.Name, dns.TypeToString[q.Qtype])\n\t\tad.outsideHandleFunc(w, req)\n\t\treturn\n\t}\n\n\t// fmt.Println(rmsg)\n\tif err = w.WriteMsg(rmsg); nil != err {\n\t\tglog.V(LINFO).Infoln(\"Response faild, rmsg:\", err)\n\t}\n}", "title": "" }, { "docid": "8459cc89178300d72dc73c144e8063e5", "score": "0.47356117", "text": "func (p ipecho) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tif p.echoIP(w, r) {\n\t\treturn dns.RcodeSuccess, nil\n\t}\n\treturn plugin.NextOrFailure(p.Name(), p.Next, ctx, w, r)\n}", "title": "" }, { "docid": "a9868ce96e8e2b539fc13ca496228b48", "score": "0.47133958", "text": "func (client StorageTargetsClient) DNSRefreshResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "title": "" }, { "docid": "0af1f57f23c8dab21b9410670cf2cebf", "score": "0.46944013", "text": "func Start() {\n\tstartDNS()\n}", "title": "" }, { "docid": "24c3eac86ed9f9e4ea3a38c9710f9338", "score": "0.46941066", "text": "func DNSHealth() error { return get(SysDNS) }", "title": "" }, { "docid": "d51ce7465ea268561dcb25cbcb5b1095", "score": "0.46934825", "text": "func (e *EDNS) ServeDNS(dc *ctx.Context) {\n\tw, req := dc.DNSWriter, dc.DNSRequest\n\n\tnoedns := req.IsEdns0() == nil\n\n\topt, size, do := dnsutil.SetEdns0(req)\n\tif opt.Version() != 0 {\n\t\topt.SetVersion(0)\n\t\topt.SetExtendedRcode(dns.RcodeBadVers)\n\n\t\tw.WriteMsg(dnsutil.HandleFailed(req, dns.RcodeBadVers, do))\n\n\t\tdc.Abort()\n\t\treturn\n\t}\n\n\tif w.Proto() == \"tcp\" {\n\t\tsize = dns.MaxMsgSize\n\t}\n\n\tdc.DNSWriter = &DNSResponseWriter{ResponseWriter: w, opt: opt, size: size, do: do, noedns: noedns, noad: !req.AuthenticatedData}\n\n\tdc.NextDNS()\n\n\tdc.DNSWriter = w\n}", "title": "" }, { "docid": "17e7881b510bf2ef82c54c7c7eed5aad", "score": "0.46886814", "text": "func (s *Server) DiscoveryRequest(req *pool.Message, multicastAddr string, receiverFunc func(cc *client.ClientConn, resp *pool.Message), opts ...MulticastOption) error {\n\ttoken := req.Token()\n\tif len(token) == 0 {\n\t\treturn fmt.Errorf(\"invalid token\")\n\t}\n\tcfg := defaultMulticastOptions\n\tfor _, o := range opts {\n\t\to.apply(&cfg)\n\t}\n\tc := s.conn()\n\tif c == nil {\n\t\treturn fmt.Errorf(\"server doesn't serve connection\")\n\t}\n\taddr, err := net.ResolveUDPAddr(c.Network(), multicastAddr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot resolve address: %w\", err)\n\t}\n\tif !addr.IP.IsMulticast() {\n\t\treturn fmt.Errorf(\"invalid multicast address\")\n\t}\n\tdata, err := req.Marshal()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot marshal req: %w\", err)\n\t}\n\ts.multicastRequests.Store(token.String(), req)\n\tdefer s.multicastRequests.Delete(token.String())\n\terr = s.multicastHandler.Insert(token, func(w *client.ResponseWriter, r *pool.Message) {\n\t\treceiverFunc(w.ClientConn(), r)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.multicastHandler.Pop(token)\n\n\terr = c.WriteMulticast(req.Context(), addr, cfg.hopLimit, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tselect {\n\tcase <-req.Context().Done():\n\t\treturn nil\n\tcase <-s.ctx.Done():\n\t\treturn fmt.Errorf(\"server was closed: %w\", s.ctx.Err())\n\t}\n}", "title": "" }, { "docid": "119cde7b5d7af55878ebfec93aacbec6", "score": "0.46861973", "text": "func (p *DiscoveryProtocol) onNotify() {\n\tlog.Println(\" pending requests: \", p.pendingReq)\n\tfor req := range p.pendingReq {\n\t\tif !p.requestExpired(req) {\n\t\t\tlog.Println(\"Request not expired, trying to send response\")\n\t\t\tif p.createSendResponse(req) {\n\t\t\t\tdelete(p.pendingReq, req)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7ffeaf640f15235c458420baf2c7bab0", "score": "0.46774316", "text": "func respondToRequest(proxy *envoy.Proxy, discoveryRequest *xds_discovery.DiscoveryRequest) bool {\n\tvar err error\n\tvar requestVersion uint64\n\tvar requestNonce string\n\tvar lastVersion uint64\n\tvar lastNonce string\n\n\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: Request %s [nonce=%s; version=%s; resources=%v] last sent [nonce=%s; version=%d]\",\n\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), discoveryRequest.TypeUrl,\n\t\tdiscoveryRequest.ResponseNonce, discoveryRequest.VersionInfo, discoveryRequest.ResourceNames,\n\t\tproxy.GetLastSentNonce(envoy.TypeURI(discoveryRequest.TypeUrl)), proxy.GetLastSentVersion(envoy.TypeURI(discoveryRequest.TypeUrl)))\n\n\tif discoveryRequest.ErrorDetail != nil {\n\t\tlog.Error().Msgf(\"Proxy SerialNumber=%s PodUID=%s: [NACK] err: \\\"%s\\\" for nonce %s, last version applied on request %s\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), discoveryRequest.ErrorDetail, discoveryRequest.ResponseNonce, discoveryRequest.VersionInfo)\n\t\treturn false\n\t}\n\n\ttypeURL, ok := envoy.ValidURI[discoveryRequest.TypeUrl]\n\tif !ok {\n\t\tlog.Error().Msgf(\"Proxy SerialNumber=%s PodUID=%s: Unknown/Unsupported URI: %s\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), discoveryRequest.TypeUrl)\n\t\treturn false\n\t}\n\n\t// It is possible for Envoy to return an empty VersionInfo.\n\t// When that's the case - start with 0\n\tif discoveryRequest.VersionInfo != \"\" {\n\t\tif requestVersion, err = strconv.ParseUint(discoveryRequest.VersionInfo, 10, 64); err != nil {\n\t\t\t// It is probable that Envoy responded with a VersionInfo we did not understand\n\t\t\tlog.Error().Err(err).Msgf(\"Proxy SerialNumber=%s PodUID=%s: Error parsing DiscoveryRequest with TypeURL=%s VersionInfo=%s (%v)\",\n\t\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), typeURL.Short(), discoveryRequest.VersionInfo, err)\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Set last version applied\n\tproxy.SetLastAppliedVersion(typeURL, requestVersion)\n\n\trequestNonce = discoveryRequest.ResponseNonce\n\t// Handle first request on stream, should always reply to empty nonce\n\tif requestNonce == \"\" {\n\t\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: Empty nonce for %s, should be first message on stream (req resources: %v)\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), typeURL.Short(), discoveryRequest.ResourceNames)\n\t\treturn true\n\t}\n\n\t// The version of the config received along with the DiscoveryRequest (ackVersion)\n\t// is what the Envoy proxy may be acknowledging. It is acknowledging\n\t// and not requesting when the ackVersion is <= what we last sent.\n\t// It is possible however for a proxy to have a version that is higher\n\t// than what we last sent. (Perhaps the control plane restarted.)\n\t// In that case we want to make sure that we send new responses with\n\t// VersionInfo incremented starting with the version which the proxy last had.\n\tlastVersion = proxy.GetLastSentVersion(typeURL)\n\tif requestVersion > lastVersion {\n\t\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: Higher version on request %s, req ver: %d - last ver: %d. Updating to match latest.\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), typeURL.Short(), requestVersion, lastVersion)\n\t\tproxy.SetLastSentVersion(typeURL, requestVersion)\n\t\treturn true\n\t}\n\n\t// Compare Nonces\n\t// As per protocol, we can ignore any request on the TypeURL stream that has not caught up with last sent nonce, if the\n\t// nonce is non-empty.\n\tlastNonce = proxy.GetLastSentNonce(typeURL)\n\tif requestNonce != lastNonce {\n\t\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: Ignoring request for %s non-latest nonce (request: %s, current: %s)\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), typeURL.Short(), requestNonce, lastNonce)\n\t\treturn false\n\t}\n\n\t// ----\n\t// At this point, there is no error and nonces match, it is guaranteed an ACK with last version.\n\t// What's left is to check if the resources listed are the same. If they are not, we must respond\n\t// with the new resources requested.\n\t//\n\t// In case of LDS and CDS, \"Envoy will always use wildcard mode for Listener and Cluster resources\".\n\t// The following logic is not needed (though correct) for LDS and CDS as request resources are also empty in ACK case.\n\t//\n\t// This part of the code was inspired by Istio's `shouldRespond` handling of request resource difference\n\t// https://github.com/istio/istio/blob/da6178604559bdf2c707a57f452d16bee0de90c8/pilot/pkg/xds/ads.go#L347\n\t// ----\n\tresourcesLastSent := proxy.GetLastResourcesSent(typeURL)\n\tresourcesRequested := getRequestedResourceNamesSet(discoveryRequest)\n\n\t// If what we last sent is a superset of what the\n\t// requests resources subscribes to, it's ACK and nothing needs to be done.\n\t// Otherwise, envoy might be asking us for additional resources that have to be sent along last time.\n\t// Difference returns elemenets of <requested> that are not part of elements of <last sent>\n\n\trequestedResourcesDifference := resourcesRequested.Difference(resourcesLastSent)\n\tif requestedResourcesDifference.Cardinality() != 0 {\n\t\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: request difference in v:%d - requested: %v lastSent: %v (diff: %v), triggering update\",\n\t\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), requestVersion, resourcesRequested, resourcesLastSent, requestedResourcesDifference)\n\t\treturn true\n\t}\n\n\tlog.Debug().Msgf(\"Proxy SerialNumber=%s PodUID=%s: ACK received for %s, version: %d nonce: %s resources ACKd: %v\",\n\t\tproxy.GetCertificateSerialNumber(), proxy.GetPodUID(), typeURL.Short(), requestVersion, requestNonce, resourcesRequested)\n\treturn false\n}", "title": "" }, { "docid": "19a980ec4f134f829d318c978c15e881", "score": "0.4672123", "text": "func (t *TrafficRuleUpdate) OnRequest(data string) workspace.TaskCode {\n\n\ttrafficInPut, ok := t.RestBody.(*dataplane.TrafficRule)\n\tif !ok {\n\t\tt.SetFirstErrorCode(meputil.ParseInfoErr, \"rest-body failed\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\tif len(t.TrafficRuleId) == 0 {\n\t\tlog.Errorf(nil, \"Invalid app/traffic id on update request.\")\n\t\tt.SetFirstErrorCode(meputil.ParseInfoErr, \"invalid update request\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\tappDConfigDB, errCode := backend.GetRecord(meputil.AppDConfigKeyPath + t.AppInstanceId)\n\tif errCode != 0 {\n\t\tlog.Errorf(nil, \"Update traffic rules failed.\")\n\t\tt.SetFirstErrorCode(workspace.ErrCode(errCode), \"update rule retrieval failed\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\tappDConfig := models.AppDConfig{}\n\tvar trafficRule *dataplane.TrafficRule\n\tvar ruleIndex int\n\n\tjsonErr := json.Unmarshal(appDConfigDB, &appDConfig)\n\tif jsonErr != nil {\n\t\tlog.Warn(\"Could not read the traffic rule properly from etcd.\")\n\t\tt.SetFirstErrorCode(meputil.OperateDataWithEtcdErr, \"parse traffic rules from etcd failed\")\n\t\treturn workspace.TaskFinish\n\t}\n\tfor i, rule := range appDConfig.AppTrafficRule {\n\t\tif rule.TrafficRuleID == t.TrafficRuleId {\n\t\t\ttrafficRule = &rule\n\t\t\truleIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif trafficRule == nil {\n\t\tlog.Error(\"Requested traffic rule id doesn't exists.\", nil)\n\t\tt.SetFirstErrorCode(meputil.SubscriptionNotFound, \"traffic rule does not exist\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\tif reflect.DeepEqual(trafficRule, trafficInPut) {\n\t\tt.HttpRsp = trafficInPut\n\t\treturn workspace.TaskFinish\n\t}\n\n\tdataStoreEntryBytes, err := json.Marshal(trafficRule)\n\tif err != nil {\n\t\tlog.Errorf(err, \"Traffic rule parse failed.\")\n\t\tt.SetFirstErrorCode(meputil.ParseInfoErr, \"internal error on data parsing\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\t// Check for E-Tags precondition. More details could be found here: https://tools.ietf.org/html/rfc7232#section-2.3\n\tifMatchTag := t.R.Header.Get(\"If-Match\")\n\tif len(ifMatchTag) != 0 && ifMatchTag != meputil.GenerateStrongETag(dataStoreEntryBytes) {\n\t\tlog.Warn(\"E-Tag miss-match.\")\n\t\tt.SetFirstErrorCode(meputil.EtagMissMatchErr, \"e-tag miss-match\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\tif len(trafficInPut.TrafficRuleID) != 0 && trafficRule.TrafficRuleID != trafficInPut.TrafficRuleID {\n\t\tlog.Warn(\"Traffic identifier miss-match.\")\n\t\tt.SetFirstErrorCode(meputil.ParseInfoErr, \"traffic identifier miss-match\")\n\t\treturn workspace.TaskFinish\n\t}\n\n\terrCode, errString := t.applyTrafficRule(trafficRule, appDConfig, ruleIndex, appDConfigDB)\n\tif errCode != 0 {\n\t\tt.SetFirstErrorCode(workspace.ErrCode(errCode), errString)\n\t\treturn workspace.TaskFinish\n\t}\n\treturn workspace.TaskFinish\n}", "title": "" }, { "docid": "b28ded8accd2d5f8be9254be5f761101", "score": "0.46711498", "text": "func (rl *RateLimit) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\tstate := request.Request{W: w, Req: r}\n\n\tif state.Proto() == \"tcp\" {\n\t\t// No ratelimit is applied for TCP clients,\n\t\t// pass the request to the next plugin.\n\t\treturn plugin.NextOrFailure(rl.Name(), rl.Next, ctx, w, r)\n\t}\n\n\tallow, err := rl.check(state.IP())\n\tif err != nil {\n\t\treturn dns.RcodeServerFailure, err\n\t}\n\n\tif allow {\n\t\treturn plugin.NextOrFailure(rl.Name(), rl.Next, ctx, w, r)\n\t}\n\n\tDropCount.WithLabelValues(metrics.WithServer(ctx)).Inc()\n\treturn dns.RcodeRefused, nil\n}", "title": "" }, { "docid": "3beaa26168355ceea805812a7d0ef0bd", "score": "0.46689123", "text": "func updateAddr(newaddr string) error {\n\trec, err := getRec()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting DNS record: %v\", err)\n\t}\n\tif rec.Content == newaddr {\n\t\tlog.Printf(\"DNS record matches current IP\\n\")\n\t\treturn nil\n\t}\n\targs := url.Values{}\n\targs.Set(\"a\", \"rec_edit\")\n\targs.Set(\"tkn\", TKN)\n\targs.Set(\"email\", EMAIL)\n\targs.Set(\"z\", ZONE)\n\targs.Set(\"type\", \"A\")\n\targs.Set(\"id\", rec.Rec_id)\n\targs.Set(\"name\", rec.Name)\n\targs.Set(\"content\", newaddr)\n\targs.Set(\"ttl\", \"1\") // 1=Automatic, otherwise set between 120 and 4,294,967,295 seconds\n\targs.Set(\"service_mode\", \"1\") // 1 = orange cloud, 0 = grey cloud\n\tresp, err := http.PostForm(APIURL, args)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error posting request: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tdec := json.NewDecoder(resp.Body)\n\t// not exactly right, but ApiRecLoadAll will get us the result and msg\n\tvar m ApiRecLoadAll\n\terr = dec.Decode(&m)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error decoding response: %v\", err)\n\t}\n\tif m.Result != \"success\" {\n\t\treturn fmt.Errorf(\"API call returned error: %v\", m.Msg)\n\t}\n\tlog.Printf(\"Successfully updated DNS record.\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "2c19a354048b2f84f5de67541325a321", "score": "0.46643603", "text": "func (o *PluginDnsClient) OnAccept(socket transport.SocketApi) transport.ISocketCb {\n\tif !o.IsNameServer() {\n\t\treturn nil\n\t}\n\to.stats.dnsFlowAccept++ // New flow for the Name Server.\n\to.socket = socket // Store socket so we can reply.\n\treturn o\n}", "title": "" }, { "docid": "be756d855130654e4ab21cdcda37b30c", "score": "0.46602052", "text": "func (writer *connectivityHooks) dnsDoneHook(di httptrace.DNSDoneInfo) {\n\tstatusString := color.GreenString(\"OK\")\n\tif di.Err != nil {\n\t\tstatusString = color.RedString(\"ERROR\")\n\t\tfmt.Fprint(writer.w, dnsColorFunc(\"Unable to resolve the address : %v\\n\", scrubber.ScrubLine(di.Err.Error())))\n\t}\n\tfmt.Fprintf(writer.w, \"* %v [%v]\\n\\n\", dnsColorFunc(\"DNS Lookup\"), statusString)\n}", "title": "" } ]
ae7177cdb7db1c80746ab74b0b951609
URI returns the URI records from a zonefile
[ { "docid": "bee112fafcf52b53be7c305e1a3eaf2e", "score": "0.699978", "text": "func (nz *NameZonefileMongo) URI() ([]*dns.URI, error) {\n\tout := make([]*dns.URI, 0)\n\tfor x := range dns.ParseZone(strings.NewReader(nz.Zonefile), \"\", \"\") {\n\t\tif x.Error != nil {\n\t\t\treturn out, x.Error\n\t\t}\n\t\turi, ok := x.RR.(*dns.URI)\n\t\tif ok {\n\t\t\tout = append(out, uri)\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" } ]
[ { "docid": "bae4be80b32d9a5bee7c003a03f8d250", "score": "0.6272439", "text": "func (f *IngestFile) URI() string {\n\turi := \"\"\n\trecs := f.StorageRecords\n\tif recs != nil && len(recs) > 0 && recs[0] != nil {\n\t\turi = recs[0].URL\n\t}\n\treturn uri\n}", "title": "" }, { "docid": "c830533d97364a2db8d6780f22271efe", "score": "0.5587442", "text": "func GetInstanceURI(project, zone, name string) string {\n\treturn fmt.Sprintf(\"projects/%v/zones/%v/instances/%v\", project, zone, name)\n}", "title": "" }, { "docid": "e8870dba55e4a8f947f374917fcd952c", "score": "0.5404882", "text": "func (a *Array) URI() (string, error) {\n\tvar curi *C.char\n\tC.tiledb_array_get_uri(a.context.tiledbContext, a.tiledbArray, &curi)\n\turi := C.GoString(curi)\n\tif uri == \"\" {\n\t\treturn uri, fmt.Errorf(\"Error getting URI for array: uri is empty\")\n\t}\n\treturn uri, nil\n}", "title": "" }, { "docid": "e80c93453c2a524b1b6c583c9ed5335c", "score": "0.52669734", "text": "func Zone(resource string) string {\n\treturn extractZone.FindStringSubmatch(resource)[1]\n}", "title": "" }, { "docid": "2948cecd9220595bc5ea6bb0d4f3df06", "score": "0.52439326", "text": "func (o *SupportCaseResponse) URI() string {\n\tif o != nil && o.bitmap_&8 != 0 {\n\t\treturn o.uri\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f1950bf93dd2f670c86c1648a07c8e84", "score": "0.52404004", "text": "func (d *StaticSiteDescriber) URI(envName string) (URI, error) {\n\twkldDescr, err := d.initWkldStackDescriber(envName)\n\tif err != nil {\n\t\treturn URI{}, err\n\t}\n\toutputs, err := wkldDescr.Outputs()\n\tif err != nil {\n\t\treturn URI{}, fmt.Errorf(\"get stack output for service %q: %w\", d.svc, err)\n\t}\n\turi := accessURI{\n\t\tHTTPS: true,\n\t\tDNSNames: []string{outputs[staticSiteOutputCFDomainName]},\n\t}\n\tif outputs[staticSiteOutputCFAltDomainName] != \"\" {\n\t\turi.DNSNames = append(uri.DNSNames, outputs[staticSiteOutputCFAltDomainName])\n\t}\n\treturn URI{\n\t\tURI: english.OxfordWordSeries(uri.strings(), \"or\"),\n\t\tAccessType: URIAccessTypeInternet,\n\t}, nil\n}", "title": "" }, { "docid": "ed53d994b571ba36792afe75324a36a6", "score": "0.5233597", "text": "func resourceURL(kasparovAddress string, pathElements ...string) (string, error) {\n\tkasparovURL, err := url.Parse(kasparovAddress)\n\tif err != nil {\n\t\treturn \"\", errors.WithStack(err)\n\t}\n\tpathElements = append([]string{kasparovURL.Path}, pathElements...)\n\tkasparovURL.Path = path.Join(pathElements...)\n\treturn kasparovURL.String(), nil\n}", "title": "" }, { "docid": "56f671e286efe6f60502bc058a57b780", "score": "0.51833415", "text": "func GetDiskURI(project, zone, name string) string {\n\treturn fmt.Sprintf(\"projects/%v/zones/%v/disks/%v\", project, zone, name)\n}", "title": "" }, { "docid": "6dcddbeec6c8c63f66f9033e67cde5ac", "score": "0.50928354", "text": "func ToURI(s string) uri.URI {\n\treturn uri.File(s)\n}", "title": "" }, { "docid": "9f87c3a91ca5be6476a2fd0992e76f6c", "score": "0.50504875", "text": "func getFilePath(baseStationID, hourBlock string, t time.Time) string {\n\tyear := t.Year()\n\tyearDay := t.YearDay()\n\n\tif hourBlock == \"\" {\n\t\thourBlock = \"0\"\n\t}\n\n\treturn fmt.Sprintf(\"/cors/rinex/%d/%03d/%s/%s%03d%s.%do.gz\", year, yearDay, baseStationID, baseStationID, yearDay, hourBlock, lastTwoDigits(year))\n}", "title": "" }, { "docid": "de004105ddcdec45190f96d42f6c47f9", "score": "0.5049118", "text": "func GetDeviceURI(project, zone, name string) string {\n\treturn fmt.Sprintf(\"projects/%v/zones/%v/devices/%v\", project, zone, name)\n}", "title": "" }, { "docid": "364e0e8fbe8e7c50d6bcf45d90d19558", "score": "0.504708", "text": "func (r *Registration) URI() string {\r\n\treturn fmt.Sprintf(\"%s.%s\", r.Type, r.ID)\r\n}", "title": "" }, { "docid": "69f8a45589a526299d35bae7f5000d2d", "score": "0.5042003", "text": "func (rrset ResourceRecordSets) Zone() dnsprovider.Zone {\n\treturn rrset.zone\n}", "title": "" }, { "docid": "655963242379349c9c4cc3a4b7994ee7", "score": "0.50393486", "text": "func (rrsets ResourceRecordSets) Zone() dnsprovider.Zone {\n\treturn rrsets.zone\n}", "title": "" }, { "docid": "655963242379349c9c4cc3a4b7994ee7", "score": "0.50393486", "text": "func (rrsets ResourceRecordSets) Zone() dnsprovider.Zone {\n\treturn rrsets.zone\n}", "title": "" }, { "docid": "d83b85a55fc08aafe8509269b06f2d2b", "score": "0.5006801", "text": "func (c *GandiApi) getZoneRecords(zoneid int64, origin string) ([]*models.RecordConfig, error) {\n\tgc := gandiclient.New(c.ApiKey, gandiclient.Production)\n\trecord := gandirecord.New(gc)\n\trecs, err := record.List(zoneid, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trcs := make([]*models.RecordConfig, 0, len(recs))\n\tfor _, r := range recs {\n\t\trcs = append(rcs, nativeToRecord(r, origin))\n\t}\n\treturn rcs, nil\n}", "title": "" }, { "docid": "e542a46f220b4b8a3c1807a4692adfa0", "score": "0.4993164", "text": "func (fs *filesystem) resourceURI(sandboxSpecific bool, sandboxID, containerID string, resource sandboxResource) (string, string, error) {\n\tif sandboxID == \"\" {\n\t\treturn \"\", \"\", errNeedSandboxID\n\t}\n\n\tvar filename string\n\n\tdirPath, err := resourceDir(sandboxSpecific, sandboxID, containerID, resource)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tswitch resource {\n\tcase configFileType:\n\t\tfilename = configFile\n\t\tbreak\n\tcase stateFileType:\n\t\tfilename = stateFile\n\tcase networkFileType:\n\t\tfilename = networkFile\n\tcase hypervisorFileType:\n\t\tfilename = hypervisorFile\n\tcase agentFileType:\n\t\tfilename = agentFile\n\tcase processFileType:\n\t\tfilename = processFile\n\tcase lockFileType:\n\t\tfilename = lockFileName\n\t\tbreak\n\tcase mountsFileType:\n\t\tfilename = mountsFile\n\t\tbreak\n\tcase devicesFileType:\n\t\tfilename = devicesFile\n\t\tbreak\n\tcase devicesIDFileType:\n\t\tfilename = devicesFile\n\t\tbreak\n\tdefault:\n\t\treturn \"\", \"\", errInvalidResource\n\t}\n\n\tfilePath := filepath.Join(dirPath, filename)\n\n\treturn filePath, dirPath, nil\n}", "title": "" }, { "docid": "08e57dd1fec7fc2f049ad340d05b1fed", "score": "0.49887046", "text": "func logFileURI(configRootDir string) string {\n\treturn filepath.ToSlash(filepath.Join(configRootDir, LogsFile))\n}", "title": "" }, { "docid": "6462e78fbf9a046eaaf8653944468fca", "score": "0.4963878", "text": "func (o LocationObjectStorageOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LocationObjectStorage) pulumi.StringOutput { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "dfb517a332b62c41ce4aa1bccf5852b2", "score": "0.49543542", "text": "func (r repo) getRawFileURL(filePath string) string {\n\tfilePath = strings.TrimPrefix(filePath, \"/\")\n\treturn fmt.Sprintf(\"https://gitlab.com/%s/%s/-/raw/%s/%s\", r.owner, r.name, r.branch, filePath)\n}", "title": "" }, { "docid": "f5c10946b602c7c84bdb9de06410eb56", "score": "0.4947879", "text": "func readURI(bytes *Bytes) (uri URI, err error) {\n\tvar ldapstring LDAPString\n\tldapstring, err = readLDAPString(bytes)\n\t// @TODO: check permitted chars in URI\n\tif err != nil {\n\t\terr = LdapError{fmt.Sprintf(\"readURI:\\n%s\", err.Error())}\n\t\treturn\n\t}\n\turi = URI(ldapstring)\n\treturn\n}", "title": "" }, { "docid": "7c1e4ff8432ec93fed48b763dbf761e6", "score": "0.49430907", "text": "func (dsn *FileDSN) URL(filename string) string {\n\tu, _ := url.Parse(filePublicURL)\n\tif dsn.PublicURL != nil {\n\t\tu, _ = url.Parse(dsn.PublicURL.String())\n\t}\n\n\tu.Path = path.Join(u.Path, filename)\n\treturn u.String()\n}", "title": "" }, { "docid": "d2ea4174e26501f0264ad92c2da9d130", "score": "0.49358505", "text": "func getRawFile(urlString string) string {\n\turl, err := url.Parse(urlString)\n\tif err != nil {\n\t\treturn urlString\n\t}\n\trawURL := vcsurl.GetRawFile(url)\n\tif rawURL != nil {\n\t\treturn rawURL.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1bdaca7ff0792a13f70d13afe7aae33f", "score": "0.4931058", "text": "func (o CloudRunRevisionInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CloudRunRevisionInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4bf100fd3f05d0f00ffe6dba070b7734", "score": "0.4894573", "text": "func (l *Location) URI() string {\n\treturn utils.GetLocationURI(l)\n}", "title": "" }, { "docid": "510cf77442507a68a12de73b4d48c0fb", "score": "0.48942247", "text": "func (r resolver) URI(endpoint string, values url.Values) (string, error) {\n\tu, err := url.Parse(endpoint)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to parse endpoint into URL\")\n\t}\n\tu.RawQuery = values.Encode()\n\treturn u.RequestURI(), nil\n}", "title": "" }, { "docid": "b7a37685ce76e807d2e0743073494aec", "score": "0.48643726", "text": "func (tc testImage) URI() string {\n\treturn tc.UR\n}", "title": "" }, { "docid": "729eb3cc99b13f16ba17eb7a6c50c92a", "score": "0.48620448", "text": "func (addr GeoAddress) URI() *url.URL {\n\turi, err := url.Parse(addr.String())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn uri\n}", "title": "" }, { "docid": "f190e0c6fab26701c17808a6697b3082", "score": "0.48596007", "text": "func (o DropInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DropInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f190e0c6fab26701c17808a6697b3082", "score": "0.48596007", "text": "func (o DropInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DropInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f5d58fe9bef070369d0934427101a91f", "score": "0.48552406", "text": "func LocalURIMapper(fileType FileType, uri []byte, base, objectKey string) []byte {\n\tdestDirPath := utils.GetTargetResourcesDirPath(filepath.Join(base, objectKey))\n\tdirName := filepath.Base(destDirPath)\n\tfileName := filepath.Base(string(uri))\n\tnewReferencePath := filepath.Join(dirName, fileName)\n\treturn []byte(newReferencePath)\n}", "title": "" }, { "docid": "208dc22bb19e5113b6dc6873c175d39a", "score": "0.4848137", "text": "func (o CloudSQLInstanceInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CloudSQLInstanceInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "208dc22bb19e5113b6dc6873c175d39a", "score": "0.4848137", "text": "func (o CloudSQLInstanceInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CloudSQLInstanceInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7acca0ed86bb04b3e4760b43914b9b4c", "score": "0.4845604", "text": "func (o CloudFunctionInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CloudFunctionInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ca5b893ea8866f4dde8e752b308a3f62", "score": "0.48383382", "text": "func (n *NetworkAaa) GetPath() string { return fmt.Sprintf(\"/api/objects/network/aaa/%s\", n.Reference) }", "title": "" }, { "docid": "ac968f8a3f85affc3006f6b62fdc9358", "score": "0.48354903", "text": "func (o LoadBalancerBackendResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LoadBalancerBackendResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ac968f8a3f85affc3006f6b62fdc9358", "score": "0.48354903", "text": "func (o LoadBalancerBackendResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LoadBalancerBackendResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7064ed225fac34fd35107ffdde12f2c6", "score": "0.4820821", "text": "func (c *axfrddnsProvider) GetZoneRecords(domain string, meta map[string]string) (models.Records, error) {\n\n\trawRecords, err := c.FetchZoneRecords(domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar foundDNSSecRecords *models.RecordConfig\n\tfoundRecords := models.Records{}\n\tfor _, rr := range rawRecords {\n\t\tswitch rr.Header().Rrtype {\n\t\tcase dns.TypeRRSIG,\n\t\t\tdns.TypeDNSKEY,\n\t\t\tdns.TypeCDNSKEY,\n\t\t\tdns.TypeCDS,\n\t\t\tdns.TypeNSEC,\n\t\t\tdns.TypeNSEC3,\n\t\t\tdns.TypeNSEC3PARAM,\n\t\t\t65534:\n\t\t\t// Ignoring DNSSec RRs, but replacing it with a single\n\t\t\t// \"TXT\" placeholder\n\t\t\t// Also ignoring spurious TYPE65534, see:\n\t\t\t// https://bind9-users.isc.narkive.com/zX29ay0j/rndc-signing-list-not-working#post2\n\t\t\tif foundDNSSecRecords == nil {\n\t\t\t\tfoundDNSSecRecords = new(models.RecordConfig)\n\t\t\t\tfoundDNSSecRecords.Type = \"TXT\"\n\t\t\t\tfoundDNSSecRecords.SetLabel(dnssecDummyLabel, domain)\n\t\t\t\terr = foundDNSSecRecords.SetTargetTXT(dnssecDummyTxt)\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\tcontinue\n\t\tdefault:\n\t\t\trec, err := models.RRtoRC(rr, domain)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfoundRecords = append(foundRecords, &rec)\n\t\t}\n\t}\n\n\tif len(foundRecords) >= 1 && foundRecords[len(foundRecords)-1].Type == \"SOA\" {\n\t\t// The SOA is sent two times: as the first and the last record\n\t\t// See section 2.2 of RFC5936. We remove the later one.\n\t\tfoundRecords = foundRecords[:len(foundRecords)-1]\n\t}\n\n\tif foundDNSSecRecords != nil {\n\t\tfoundRecords = append(foundRecords, foundDNSSecRecords)\n\t}\n\n\tc.hasDnssecRecords = false\n\tif len(foundRecords) >= 1 {\n\t\tlast := foundRecords[len(foundRecords)-1]\n\t\tif last.Type == \"TXT\" &&\n\t\t\tlast.Name == dnssecDummyLabel &&\n\t\t\tlen(last.TxtStrings) == 1 &&\n\t\t\tlast.TxtStrings[0] == dnssecDummyTxt {\n\t\t\tc.hasDnssecRecords = true\n\t\t\tfoundRecords = foundRecords[0:(len(foundRecords) - 1)]\n\t\t}\n\t}\n\n\treturn foundRecords, nil\n\n}", "title": "" }, { "docid": "110cd3cec182f00e1af1ac5bffa65aaa", "score": "0.48194042", "text": "func (a Atomizer) anchorURI(fileTicket string, span *cpb.Span) *kytheuri.URI {\n\turi, err := kytheuri.Parse(fileTicket)\n\tif err != nil {\n\t\tpanic(atomizerPanic{err})\n\t}\n\turi.Signature = fmt.Sprintf(\"a[%d,%d)\", span.GetStart().GetByteOffset(), span.GetEnd().GetByteOffset())\n\t// The language doesn't have to exactly match the schema; just use the file's\n\t// extension as an approximation.\n\turi.Language = strings.TrimPrefix(filepath.Ext(uri.Path), \".\")\n\treturn uri\n}", "title": "" }, { "docid": "2071e23eb7874792adb676aeeafd3f86", "score": "0.48122287", "text": "func (m *MachineConfig) URI() string {\n\turi := m.Image\n\tfor _, val := range []string{\"$ARCH\", \"$arch\"} {\n\t\turi = strings.Replace(uri, val, runtime.GOARCH, 1)\n\t}\n\tfor _, val := range []string{\"$OS\", \"$os\"} {\n\t\turi = strings.Replace(uri, val, runtime.GOOS, 1)\n\t}\n\treturn uri\n}", "title": "" }, { "docid": "d1d628336d734006cbf536bc94a98797", "score": "0.47997284", "text": "func (d *Directory) URL() string {\n\treturn d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{})\n}", "title": "" }, { "docid": "68034627f80124ab3ca21b1bf5510480", "score": "0.47985047", "text": "func (dc Component) URI() string {\n\treturn dc.Image\n}", "title": "" }, { "docid": "00c2c8f6d9bb4fc68c7745dc1c1fe439", "score": "0.47963157", "text": "func (o CloudFunctionEndpointOutput) Uri() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CloudFunctionEndpoint) *string { return v.Uri }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cd5ed0ea81d65220cae376e6b468b99e", "score": "0.47960725", "text": "func (o ForwardInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ForwardInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cd5ed0ea81d65220cae376e6b468b99e", "score": "0.47960725", "text": "func (o ForwardInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ForwardInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2245cec13d232e229ed17b58864ccbc5", "score": "0.47889367", "text": "func (a *ZonesApiService) AxfrRetrieveZone(ctx context.Context, serverId string, zoneId string) ( *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/servers/{server_id}/zones/{zone_id}/axfr-retrieve\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"server_id\"+\"}\", fmt.Sprintf(\"%v\", serverId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"zone_id\"+\"}\", fmt.Sprintf(\"%v\", zoneId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-API-Key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\treturn localVarHttpResponse, err\n}", "title": "" }, { "docid": "101ed38d7bc56e38b5d523c9b30083a1", "score": "0.47867998", "text": "func (o DeliverInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DeliverInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "101ed38d7bc56e38b5d523c9b30083a1", "score": "0.47867998", "text": "func (o DeliverInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DeliverInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "dc378d9fc39338989e3befdb612245a3", "score": "0.47739547", "text": "func (a *edgeDNSProvider) GetZoneRecords(domain string, meta map[string]string) (models.Records, error) {\n\trecords, err := getRecords(domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn records, nil\n}", "title": "" }, { "docid": "142609b59eed6c919c9f04b04c50dbc1", "score": "0.47715887", "text": "func (o RoutingVPCResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RoutingVPCResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8759dce05f991dbfd8287102e8146002", "score": "0.47673574", "text": "func (uc MinioUC) GetFileURL(objectName string) (res string, err error) {\n\tctx := \"MinioUC.GetFileURL\"\n\n\tdefaultBucket := uc.ContractUC.EnvConfig[\"MINIO_DEFAULT_BUCKET\"]\n\tminioModel := minio.NewMinioModel(uc.Minio)\n\tif objectName == \"\" {\n\t\tlogruslogger.Log(logruslogger.WarnLevel, \"\", ctx, \"empty_parameter\", uc.ReqID)\n\t\treturn res, err\n\t}\n\n\tres, err = minioModel.GetFileURL(defaultBucket, objectName)\n\tif err != nil {\n\t\tlogruslogger.Log(logruslogger.WarnLevel, err.Error(), ctx, \"get_file_url\", uc.ReqID)\n\t\treturn res, err\n\t}\n\n\tres = strings.Replace(res, \"http://\"+uc.ContractUC.EnvConfig[\"MINIO_ENDPOINT\"], uc.ContractUC.EnvConfig[\"MINIO_BASE_URL\"], 1)\n\n\treturn res, err\n}", "title": "" }, { "docid": "9dbe9190e8c58a747de7c93d83abea5d", "score": "0.476618", "text": "func (o CloudFunctionEndpointResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CloudFunctionEndpointResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3ca07e605b27f2c2ebfa5057c84aaafc", "score": "0.47534126", "text": "func extractingZoneId(conn *zk.Conn, ymb *datastructure.YMB) {\r\n\tpath := \"/ymb/zoneid\"\r\n\tif flag, _, err := conn.Exists(path); err == nil && flag {\r\n\t\tif data, _, err := conn.Get(path); err == nil {\r\n\t\t\tymb.ZoneId = string(data)\r\n\t\t\tlog.Println(ymb.ZoneId)\r\n\t\t} else {\r\n\t\t\tlog.Println(\"N2\", err)\r\n\t\t}\r\n\t} else if err != nil {\r\n\t\tlog.Println(\"N3\", err)\r\n\t}\r\n}", "title": "" }, { "docid": "1889b92dbb32876831cab205ba6df720", "score": "0.47506502", "text": "func (idx *index) uri() (string, error) {\n\ts := join(idx.HrefIndex, idx.Name)\n\tu, err := url.ParseRequestURI(s)\n\treturn u.String(), err\n}", "title": "" }, { "docid": "5481bd0898a19c568decd7def35689fb", "score": "0.47505122", "text": "func fetchFromFile(uri string) ([]byte, error) {\n\tfileContent, err := ioutil.ReadFile(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fileContent, nil\n\n}", "title": "" }, { "docid": "6d909a0956c99bd2b75b4969b0570b52", "score": "0.47499081", "text": "func (r *ProtocolIncus) GetNetworkZoneRecordNames(zone string) ([]string, error) {\n\tif !r.HasExtension(\"network_dns_records\") {\n\t\treturn nil, fmt.Errorf(`The server is missing the required \"network_dns_records\" API extension`)\n\t}\n\n\t// Fetch the raw URL values.\n\turls := []string{}\n\tbaseURL := fmt.Sprintf(\"/network-zones/%s/records\", url.PathEscape(zone))\n\t_, err := r.queryStruct(\"GET\", baseURL, nil, \"\", &urls)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse it.\n\treturn urlsToResourceNames(baseURL, urls...)\n}", "title": "" }, { "docid": "20eb1246ced647f5cd75ff2f666c656a", "score": "0.474196", "text": "func (z *ZoneUpdater) getResourceRecords(name string) (resourceRecords []string) {\n\tlopts := &route53.ListOpts{\n\t\tName: name,\n\t\tMaxItems: 1,\n\t}\n\tresp, err := z.AwsClient.ListResourceRecordSets(z.HostedZone, lopts)\n\tif err != nil {\n\t\tlog.Println(err)\n\t} else {\n\t\tif len(resp.Records) > 0 && resp.Records[0].Name == name+\".\" {\n\t\t\tresourceRecords = resp.Records[0].Records\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "25fb52841b964d8055a8d1b96e513728", "score": "0.47151887", "text": "func (m *Movie) uri() (string, error) {\n\tif m.Movie == nil {\n\t\treturn \"\", ErrMissingMovie\n\t}\n\n\tif m.ImdbID == \"\" {\n\t\treturn \"\", ErrMissingMovieID\n\t}\n\n\treturn fmt.Sprintf(\"movies/%s\", m.ImdbID), nil\n}", "title": "" }, { "docid": "4e4ce483f5d56ca6b5406495b2a59824", "score": "0.47070324", "text": "func (mdb *MongoDB) FetchZonefile(name string) (NameZonefile, error) {\n\tsession := mdb.Session.Clone()\n\tdefer session.Close()\n\tzf := &NameZonefileMongo{}\n\tfindFilter := bson.M{\"_id\": name}\n\terr := session.DB(mdb.Database).C(zonefilesCollection).Find(findFilter).One(zf)\n\tif err != nil {\n\t\treturn zf, err\n\t}\n\treturn zf, err\n}", "title": "" }, { "docid": "5ab783c9c9fad68453a5cfd250dc39ff", "score": "0.469748", "text": "func (adp *fileStorage) URL(ctx context.Context, filename string) string {\n\treturn adp.dsn.URL(filename)\n}", "title": "" }, { "docid": "2eae799966db33f8d849562477285c93", "score": "0.4685604", "text": "func (o RouteInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouteInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2eae799966db33f8d849562477285c93", "score": "0.4685604", "text": "func (o RouteInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouteInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9debb26dc271d383adc0cac70722fc50", "score": "0.46816298", "text": "func metadataURI(resource string) string {\n\treturn gceMDEndpoint + gceMDPrefix + resource\n}", "title": "" }, { "docid": "bd362f57e3676d28e5673ddebd5196fd", "score": "0.46645325", "text": "func (o VocabularyFilterOutput) VocabularyFilterFileUri() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VocabularyFilter) pulumi.StringPtrOutput { return v.VocabularyFilterFileUri }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "60edbb62945de5ab2e97d0c7b7aaa9bf", "score": "0.46609738", "text": "func (o NetworkInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "60edbb62945de5ab2e97d0c7b7aaa9bf", "score": "0.46609738", "text": "func (o NetworkInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "14900d52823cbb3089b4f006c1c9b1fa", "score": "0.46590078", "text": "func (c *axfrddnsProvider) FetchZoneRecords(domain string) ([]dns.RR, error) {\n\ttransfer, err := c.getAxfrConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttransfer.DialTimeout = dnsTimeout\n\ttransfer.ReadTimeout = dnsTimeout\n\n\trequest := new(dns.Msg)\n\trequest.SetAxfr(domain + \".\")\n\n\tif c.transferKey != nil {\n\t\ttransfer.TsigSecret =\n\t\t\tmap[string]string{c.transferKey.id: c.transferKey.secret}\n\t\trequest.SetTsig(c.transferKey.id, c.transferKey.algo, 300, time.Now().Unix())\n\t\tif c.transferKey.algo == dns.HmacMD5 {\n\t\t\ttransfer.TsigProvider = md5Provider(c.transferKey.secret)\n\t\t}\n\t}\n\n\tenvelope, err := transfer.In(request, c.master)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rawRecords []dns.RR\n\tfor msg := range envelope {\n\t\tif msg.Error != nil {\n\t\t\t// Fragile but more \"user-friendly\" error-handling\n\t\t\terr := msg.Error.Error()\n\t\t\tif err == \"dns: bad xfr rcode: 9\" {\n\t\t\t\terr = \"NOT AUTH (9)\"\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"[Error] AXFRDDNS: nameserver refused to transfer the zone %s: %s\", domain, err)\n\t\t}\n\t\trawRecords = append(rawRecords, msg.RR...)\n\t}\n\treturn rawRecords, nil\n\n}", "title": "" }, { "docid": "6d9696a036083881e5ef9431719a93ed", "score": "0.46586454", "text": "func writeHTMLAndReturnRequestURL() (URL string) {\n\toutput, err := os.Create(\"./files.txt\")\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer output.Close()\n\n\tresp, err := http.Get(\"http://bitly.com/nuvi-plz\")\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer resp.Body.Close()\n\n\t_, err = io.Copy(output, resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tbaseURL := resp.Request.URL\n\tfmt.Println(baseURL)\n\treturn baseURL.String()\n}", "title": "" }, { "docid": "f4cb4a838b496a8b1e11fa6510705105", "score": "0.46473068", "text": "func makeURI(city string) string {\r\n\tapiKey := \"bd5e378503939ddaee76f12ad7a97608\"\r\n\tbaseURL := \"http://api.openweathermap.org/data/2.5/weather\"\r\n\r\n\tu, _ := url.Parse(baseURL)\r\n\tq := url.Values{}\r\n\r\n\tq.Set(\"q\", city)\r\n\tq.Set(\"units\", \"imperial\")\r\n\tq.Set(\"appid\", apiKey)\r\n\r\n\tu.RawQuery = q.Encode()\r\n\treturn u.String()\r\n}", "title": "" }, { "docid": "5b8780e16a6117dd5ed37985fd5dc92c", "score": "0.46447164", "text": "func http_uri(t zgrab2.ScanTarget) string {\n\treturn \"http://\" + t.IP.String()\n}", "title": "" }, { "docid": "6b38bb62a1d7e92e6c8cabf3f5358088", "score": "0.46402803", "text": "func URI(v strfmt.URI) *strfmt.URI {\n\treturn &v\n}", "title": "" }, { "docid": "0acee58b554670abf9a67467722aa709", "score": "0.46355438", "text": "func (m *PrintServiceEndpoint) GetUri()(*string) {\n return m.uri\n}", "title": "" }, { "docid": "e240ada2fd3f58a8755dc2b5e65fca31", "score": "0.46312267", "text": "func (api *autoDNSProvider) GetZoneRecords(domain string, meta map[string]string) (models.Records, error) {\n\tzone, _ := api.getZone(domain)\n\texistingRecords := make([]*models.RecordConfig, len(zone.ResourceRecords))\n\tfor i, resourceRecord := range zone.ResourceRecords {\n\t\texistingRecords[i] = toRecordConfig(domain, resourceRecord)\n\n\t\t// If TTL is not set for an individual RR AutoDNS defaults to the zone TTL defined in SOA\n\t\tif existingRecords[i].TTL == 0 {\n\t\t\texistingRecords[i].TTL = zone.Soa.TTL\n\t\t}\n\t}\n\n\t// AutoDNS doesn't respond with APEX nameserver records as regular RR but rather as a zone property\n\tfor _, nameServer := range zone.NameServers {\n\t\tnameServerRecord := &models.RecordConfig{\n\t\t\tTTL: zone.Soa.TTL,\n\t\t}\n\n\t\tnameServerRecord.SetLabel(\"\", domain)\n\n\t\t// make sure the value for this NS record is suffixed with a dot at the end\n\t\t_ = nameServerRecord.PopulateFromString(\"NS\", strings.TrimSuffix(nameServer.Name, \".\")+\".\", domain)\n\n\t\texistingRecords = append(existingRecords, nameServerRecord)\n\t}\n\n\tif zone.MainRecord != nil && zone.MainRecord.Value != \"\" {\n\t\taddressRecord := &models.RecordConfig{\n\t\t\tTTL: uint32(zone.MainRecord.TTL),\n\t\t}\n\n\t\t// If TTL is not set for an individual RR AutoDNS defaults to the zone TTL defined in SOA\n\t\tif addressRecord.TTL == 0 {\n\t\t\taddressRecord.TTL = zone.Soa.TTL\n\t\t}\n\n\t\taddressRecord.SetLabel(\"\", domain)\n\n\t\t_ = addressRecord.PopulateFromString(\"A\", zone.MainRecord.Value, domain)\n\n\t\texistingRecords = append(existingRecords, addressRecord)\n\n\t\tif zone.IncludeWwwForMain {\n\t\t\tprefixedAddressRecord := &models.RecordConfig{\n\t\t\t\tTTL: uint32(zone.MainRecord.TTL),\n\t\t\t}\n\n\t\t\t// If TTL is not set for an individual RR AutoDNS defaults to the zone TTL defined in SOA\n\t\t\tif prefixedAddressRecord.TTL == 0 {\n\t\t\t\tprefixedAddressRecord.TTL = zone.Soa.TTL\n\t\t\t}\n\n\t\t\tprefixedAddressRecord.SetLabel(\"www\", domain)\n\n\t\t\t_ = prefixedAddressRecord.PopulateFromString(\"A\", zone.MainRecord.Value, domain)\n\n\t\t\texistingRecords = append(existingRecords, prefixedAddressRecord)\n\t\t}\n\t}\n\n\treturn existingRecords, nil\n}", "title": "" }, { "docid": "ce057d8e53ee3caf2e0c778b78cb6fad", "score": "0.46301046", "text": "func (f *LicenseFile) URIPath() string {\n\treturn LicenseURI()\n}", "title": "" }, { "docid": "e687e5af1eef589d54479cfd1642a317", "score": "0.462759", "text": "func NewZone(name, file string) *Zone {\n\tz := &Zone{origin: dns.Fqdn(name), file: path.Clean(file), Tree: &tree.Tree{}, Expired: new(bool)}\n\t*z.Expired = false\n\treturn z\n}", "title": "" }, { "docid": "425097bdec71e28b2d14a483158bbe20", "score": "0.46262425", "text": "func LoadLocationListFile(ci *geoattractorindex.CityIndex, filepath string, r io.Reader, ti *geoindex.TimeIndex) (recordsCount int, err error) {\n defer func() {\n if state := recover(); state != nil {\n err = log.Wrap(state.(error))\n }\n }()\n\n c := csv.NewReader(r)\n\n c.Comment = '#'\n c.FieldsPerRecord = 3\n\n for i := 0; ; i++ {\n record, err := c.Read()\n if err != nil {\n if err == io.EOF {\n break\n }\n\n log.Panic(err)\n }\n\n sourceName := record[0]\n id := record[1]\n timestampPhrase := record[2]\n\n timestamp, err := time.Parse(time.RFC3339, timestampPhrase)\n if err != nil {\n log.Panicf(\"Could not parse [%s]: %s\", timestampPhrase, err)\n }\n\n cr, err := ci.GetById(sourceName, id)\n if err != nil {\n if err == geoattractorindex.ErrNotFound {\n log.Panicf(\"Could not find record from source [%s] with ID [%s].\", sourceName, id)\n }\n\n log.Panic(err)\n }\n\n gr := geoindex.NewGeographicRecord(\n GeographicSourceListfile,\n filepath,\n timestamp,\n true,\n cr.Latitude,\n cr.Longitude,\n nil)\n\n err = ti.AddWithRecord(gr)\n log.PanicIf(err)\n\n recordsCount++\n }\n\n return recordsCount, nil\n}", "title": "" }, { "docid": "e557d843e1cdca2fa3c6ddc6037272b2", "score": "0.46259567", "text": "func (s MappedRange) URI() span.URI {\n\treturn s.m.URI\n}", "title": "" }, { "docid": "949c1c4a89aaf9b2287e8035e304ad4b", "score": "0.4623436", "text": "func (member *Membership) uri(baseUrl string) (string, error) {\n\tif len(member.Key) == 0 {\n\t\treturn \"\", fmt.Errorf(\"the membership does not have a key: cannot construct Membership resource URI\")\n\t}\n\treturn fmt.Sprintf(\"%s/membership/%s\", baseUrl, member.Key), nil\n}", "title": "" }, { "docid": "3968a57893953c3b9ebfd162976cc432", "score": "0.46055654", "text": "func readUriFromFile() {\n\tb, err := ioutil.ReadFile(\"conf/urls.conf\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\turls := string(b)\n\tvar urlArray = strings.Split(urls, \"\\n\")\n\tfmt.Println(len(urlArray))\n\twebs = make([]models.Web, len(urlArray))\n\tfor i, url := range urlArray {\n\t\tfmt.Println(url)\n\t\teArray := strings.Split(url, \"#\")\n\n\t\tweb := new(models.Web)\n\t\tadmin := new(models.Admin)\n\t\tadmin.Mail = eArray[1]\n\t\tweb.Url = eArray[0]\n\t\tweb.Admin = *admin\n\n\t\tsystemAdmin := new(models.SystemAdmin)\n\t\tsystemAdmin.SystemMail = adminMail\n\t\tsystemAdmin.SystemPwd = adminPwd\n\t\tsystemAdmin.SystemHost = adminMailHost\n\t\tweb.SystemAdmin = *systemAdmin\n\t\twebs[i] = *web\n\t}\n}", "title": "" }, { "docid": "989bd5e230fa9356d9b59a75a52fe0ca", "score": "0.46010545", "text": "func (o AbortInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AbortInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "989bd5e230fa9356d9b59a75a52fe0ca", "score": "0.46010545", "text": "func (o AbortInfoResponseOutput) ResourceUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AbortInfoResponse) string { return v.ResourceUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "60e0baf832d8c262c106419dbf6bf9b8", "score": "0.4598341", "text": "func NewURI(u string) fyne.URI {\n\tif len(u) > 5 && u[:5] == \"file:\" {\n\t\tpath := u[5:]\n\t\tif len(path) > 2 && path[:2] == \"//\" {\n\t\t\tpath = path[2:]\n\t\t}\n\t\treturn NewFileURI(path)\n\t}\n\n\treturn &uri{raw: u}\n}", "title": "" }, { "docid": "4da7f2d901e32b2f9927615f619f744d", "score": "0.4578836", "text": "func ZoneID(r53 route53iface.Route53API, zone string) (*string, error) {\n\tif !strings.HasSuffix(zone, \".\") {\n\t\tzone = zone + \".\"\n\t}\n\tin := new(route53.ListHostedZonesInput)\n\tmore := true\n\tfor more {\n\t\treq := r53.ListHostedZonesRequest(in)\n\t\tout, err := req.Send()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, z := range out.HostedZones {\n\t\t\tif aws.StringValue(z.Name) == zone {\n\t\t\t\treturn z.Id, nil\n\t\t\t}\n\t\t}\n\t\tmore = aws.BoolValue(out.IsTruncated)\n\t\tin.Marker = out.NextMarker\n\t}\n\treturn nil, fmt.Errorf(\"zone %s not found\", zone)\n}", "title": "" }, { "docid": "12f8be8b97a64503d7180b4a8d0579d4", "score": "0.4578679", "text": "func (r *Resource) FullURI() string {\n\treturn doFullURI(r, \"\")\n}", "title": "" }, { "docid": "baec886dda75ad28ba1a7b6506122d44", "score": "0.45759895", "text": "func (o CatalogDatabaseOutput) LocationUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *CatalogDatabase) pulumi.StringOutput { return v.LocationUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aa3526593dfa4bee104f66c7b3aeb06e", "score": "0.457052", "text": "func (o FirewallInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FirewallInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aa3526593dfa4bee104f66c7b3aeb06e", "score": "0.457052", "text": "func (o FirewallInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FirewallInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9f39ae455496db68bf7192495c58e0a4", "score": "0.45672545", "text": "func (o RoutingVPCOutput) Uri() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RoutingVPC) *string { return v.Uri }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c53309525cec514f2881a7c56b9acf48", "score": "0.45670992", "text": "func (r *ProtocolIncus) GetNetworkZoneRecords(zone string) ([]api.NetworkZoneRecord, error) {\n\tif !r.HasExtension(\"network_dns_records\") {\n\t\treturn nil, fmt.Errorf(`The server is missing the required \"network_dns_records\" API extension`)\n\t}\n\n\trecords := []api.NetworkZoneRecord{}\n\n\t// Fetch the raw value.\n\t_, err := r.queryStruct(\"GET\", fmt.Sprintf(\"/network-zones/%s/records?recursion=1\", url.PathEscape(zone)), nil, \"\", &records)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn records, nil\n}", "title": "" }, { "docid": "dd15cb82f8a5ed9265b65dbcb5f7a238", "score": "0.45647672", "text": "func TrustedFileURI(u URI) Path {\n\tpath, _ := ParseFileURI(u)\n\treturn path\n}", "title": "" }, { "docid": "f1118b8a5af842810a6bee2c9e6afd8d", "score": "0.45640785", "text": "func (o URIOutput) Uri() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v URI) *string { return v.Uri }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d9b6f793f7b2fdcfe8a38b65ac46b365", "score": "0.45614672", "text": "func findZoneByFQDN(fqdn string, nameservers []string) (string, error) {\n\tif !strings.HasSuffix(fqdn, \".\") {\n\t\tfqdn += \".\"\n\t}\n\tsoa, err := lookupSoaByFqdn(fqdn, nameservers)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn soa.zone, nil\n}", "title": "" }, { "docid": "508e908961c6ab95a39d66a91752752e", "score": "0.4559214", "text": "func (o MedicalVocabularyOutput) VocabularyFileUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *MedicalVocabulary) pulumi.StringOutput { return v.VocabularyFileUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2eb615ccc8a277aefea271e6f3bc64fd", "score": "0.45539668", "text": "func main() {\n\tfile := `mydomain.com.zone`\n\tfmt.Println(file)\n\t// Load zonefile\n\tdata, ioerr := ioutil.ReadFile(file)\n\tif ioerr != nil {\n\t\tfmt.Println(file, ioerr)\n\t\tos.Exit(2)\n\t}\n\tfmt.Println(len(data))\n\n\tzf, perr := zonefile.Load(data)\n\tif perr != nil {\n\t\tfmt.Println(file, perr.LineNo(), perr)\n\t\tos.Exit(3)\n\t}\n\tfmt.Println(zf)\n\tfmt.Println(len(zf.Entries()))\n\t// Find SOA entry\n\n\tfor i, e := range zf.Entries() {\n\t\tfmt.Println(i, e)\n\t\tfmt.Println(\"command:\", string(e.Command()))\n\t\tfmt.Println(\"domain:\", string(e.Domain()))\n\t\tfmt.Println(\"class:\", string(e.Class()))\n\t\tfmt.Println(\"type:\", string(e.Type()))\n\t\tvar sTTL string\n\t\tif e.TTL() == nil {\n\t\t\tsTTL = \"\"\n\t\t} else {\n\t\t\tsTTL = strconv.Itoa(*e.TTL())\n\t\t}\n\t\tfmt.Println(\"ttl:\", sTTL)\n\t\tvs := e.Values()\n\t\tfor j := range vs {\n\t\t\tfmt.Println(\"value: \", j, string(vs[j]))\n\t\t}\n\t\tfmt.Println(\"------\")\n\t}\n\t/*\n\t\tok := false\n\t\tfor _, e := range zf.Entries() {\n\t\t\tfmt.Println(e)\n\t\t\tif !bytes.Equal(e.Type(), []byte(\"SOA\")) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvs := e.Values()\n\t\t\tif len(vs) != 7 {\n\t\t\t\tfmt.Println(\"Wrong number of parameters to SOA line\")\n\t\t\t\tos.Exit(4)\n\t\t\t}\n\t\t\tserial, err := strconv.Atoi(string(vs[2]))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Could not parse serial:\", err)\n\t\t\t\tos.Exit(5)\n\t\t\t}\n\t\t\te.SetValue(2, []byte(strconv.Itoa(serial+1)))\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t\tif !ok {\n\t\t\tfmt.Println(\"Could not find SOA entry\")\n\t\t\tos.Exit(6)\n\t\t}\n\n\t\tfh, err := os.OpenFile(file, os.O_WRONLY, 0)\n\t\tif err != nil {\n\t\t\tfmt.Println(file, err)\n\t\t\tos.Exit(7)\n\t\t}\n\n\t\t_, err = fh.Write(zf.Save())\n\t\tif err != nil {\n\t\t\tfmt.Println(file, err)\n\t\t\tos.Exit(8)\n\t\t}\n\t*/\n}", "title": "" }, { "docid": "90daaff669a1fa134738fc46e6a99a04", "score": "0.45534468", "text": "func (a *ZonesApiService) AxfrExportZone(ctx context.Context, serverId string, zoneId string) (string, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload string\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/servers/{server_id}/zones/{zone_id}/export\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"server_id\"+\"}\", fmt.Sprintf(\"%v\", serverId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"zone_id\"+\"}\", fmt.Sprintf(\"%v\", zoneId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-API-Key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "ffa91c28c85a6178b37dc31a87c3f8a9", "score": "0.45469627", "text": "func (o InstanceInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InstanceInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ffa91c28c85a6178b37dc31a87c3f8a9", "score": "0.45469627", "text": "func (o InstanceInfoResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InstanceInfoResponse) string { return v.Uri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "14917f4029c61839948fa449ab7bd145", "score": "0.45385936", "text": "func fetchFromUrl(uri string) (string) {\n\tl, err := url.Parse(uri)\n checkErr(err)\n\tvar filename string\n\tif filenameFromPath(l.Path) == \"\" {\n\t\tfilename = \"outfile\"\n\t} else {\n\t\tfilename = filenameFromPath(l.Path)\n\t}\n\tbody := getContent(uri)\n\ti := writeFile(body, filename)\n\tfmt.Printf(\"%d bytes written to '%s'\\n\", i, filename)\n\treturn filename\n}", "title": "" }, { "docid": "a1122f39862cc2bda846f219b73235a8", "score": "0.4537461", "text": "func (*NetworkDnsHosts) GetPath() string { return \"/api/objects/network/dns_host/\" }", "title": "" }, { "docid": "1f6837bb7969f9e12b850eee90ec674c", "score": "0.45348597", "text": "func (pg *PostgreSQL) GetURI(projectName string, ip string, port string, dir string) (models.URI, error) {\n\turi, err := pg.getURI(projectName, ip, port, dir)\n\tif err != nil {\n\t\treturn models.URI{}, err\n\t}\n\n\treturn uri.ToModel(), err\n}", "title": "" } ]
3cf1cb363a84f77bb202520aa87f057c
TypeContainsFold applies the ContainsFold predicate on the "type" field.
[ { "docid": "8cee89772cdbc7c1fd6a3691cb8ff199", "score": "0.8256909", "text": "func TypeContainsFold(v string) predicate.PropertyType {\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldType), v))\n\t},\n\t)\n}", "title": "" } ]
[ { "docid": "9defd81ca3df679fca9b86e2f0e29393", "score": "0.82883626", "text": "func TypeContainsFold(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldType), v))\n\t})\n}", "title": "" }, { "docid": "6d9b07d1c30129e95d6416b55e72db3f", "score": "0.778437", "text": "func PTypeContainsFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPType), v))\n\t})\n}", "title": "" }, { "docid": "da74d9905e65410242a5224dd10f75b5", "score": "0.7693892", "text": "func MutationTypeContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldMutationType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "4525df3d4949dd3e3517638aff11a74a", "score": "0.7219193", "text": "func TypetreatmentContainsFold(v string) predicate.Typetreatment {\n\treturn predicate.Typetreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTypetreatment), v))\n\t})\n}", "title": "" }, { "docid": "cdc7dd1df861a29a9ec587d0a0dc7741", "score": "0.7207755", "text": "func FurnitureTypeContainsFold(v string) predicate.FurnitureType {\n\treturn predicate.FurnitureType(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldFurnitureType), v))\n\t})\n}", "title": "" }, { "docid": "814914e61e6f68de5e8eaa50f907809a", "score": "0.7133272", "text": "func OsTypeContainsFold(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOsType), v))\n\t})\n}", "title": "" }, { "docid": "3dd28e61354f2965c6f8832395175305", "score": "0.70371854", "text": "func BloodtypeContainsFold(v string) predicate.Patientrecord {\n\treturn predicate.Patientrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBloodtype), v))\n\t})\n}", "title": "" }, { "docid": "67633506d6abd47d1a470d7ab7ca2cf2", "score": "0.66164917", "text": "func ObjectTypeContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldObjectType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "ac7cabd4b3378b61d3663d8c4e3e8f28", "score": "0.6393174", "text": "func TypeEqualFold(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldType), v))\n\t})\n}", "title": "" }, { "docid": "3835b6d9d694d17c5cfa30df542acd0c", "score": "0.6233658", "text": "func TypeEqualFold(v string) predicate.PropertyType {\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "fb005e89d1a273ffe361d6b81f06e311", "score": "0.6173992", "text": "func ContentContainsFold(v string) predicate.Todo {\n\treturn predicate.Todo(sql.FieldContainsFold(FieldContent, v))\n}", "title": "" }, { "docid": "c380486f58eec9f34067a7a5ea032e89", "score": "0.61164343", "text": "func WordContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWord), v))\n\t})\n}", "title": "" }, { "docid": "53257cfcae5058bb330eb22dddbb378e", "score": "0.60767066", "text": "func AnalyseContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldAnalyse, v))\n}", "title": "" }, { "docid": "4c0a8fe52a6e9e0d0ef818ae99d844f1", "score": "0.6076226", "text": "func ExampleContainsFold(v string) predicate.Voca {\n\treturn predicate.Voca(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldExample), v))\n\t})\n}", "title": "" }, { "docid": "e082ea3bcfd3c7799967da9cf3190990", "score": "0.6041748", "text": "func PTypeEqualFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldPType), v))\n\t})\n}", "title": "" }, { "docid": "525072ebfa4a24a32492d78c9a747975", "score": "0.6034638", "text": "func ContentContainsFold(v string) predicate.Reply {\n\treturn predicate.Reply(sql.FieldContainsFold(FieldContent, v))\n}", "title": "" }, { "docid": "0fda52553eff627dcef5561fd60b191b", "score": "0.6002724", "text": "func ContentContainsFold(v string) predicate.UnsavedPost {\n\treturn predicate.UnsavedPost(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldContent), v))\n\t})\n}", "title": "" }, { "docid": "2a368c438f8f6daf7ee537d00bef940e", "score": "0.59994733", "text": "func TagContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldTag, v))\n}", "title": "" }, { "docid": "962ae9edb6b7e04aa98a3b9f8de0fa3e", "score": "0.59970504", "text": "func ContentsContainsFold(v string) predicate.Review {\n\treturn predicate.Review(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldContents), v))\n\t})\n}", "title": "" }, { "docid": "f453e24960f010c662c805f95e9cfdb4", "score": "0.58725786", "text": "func CategoryContainsFold(v string) predicate.PropertyType {\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCategory), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "3c5fc99a1a5d7ffa18e7411f13bef787", "score": "0.58498067", "text": "func FnContainsFold(v string) predicate.Timer {\n\treturn predicate.Timer(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldFn), v))\n\t})\n}", "title": "" }, { "docid": "cf829acb0363d010688d2e77cef09cfa", "score": "0.58391106", "text": "func DataContainsFold(v string) predicate.Configuration {\n\treturn predicate.Configuration(sql.FieldContainsFold(FieldData, v))\n}", "title": "" }, { "docid": "9f5bc24edd3ede600dd54bfc86897ff4", "score": "0.5793343", "text": "func TagContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTag), v))\n\t})\n}", "title": "" }, { "docid": "2446cb40c573f2a90aa5063b5e07335f", "score": "0.5729185", "text": "func SymbolContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "9ba8cf2767a789de7240f4db45e7d5f5", "score": "0.5718009", "text": "func TypeContains(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldType), v))\n\t})\n}", "title": "" }, { "docid": "f6fd5467731007bb058cac9ddf5480e2", "score": "0.5710849", "text": "func CategoryContainsFold(v string) predicate.Action {\n\treturn predicate.Action(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCategory), v))\n\t})\n}", "title": "" }, { "docid": "955ee5940941531db1137298c9bb712d", "score": "0.57040465", "text": "func CountryContainsFold(v string) predicate.UserLogin {\n\treturn predicate.UserLogin(sql.FieldContainsFold(FieldCountry, v))\n}", "title": "" }, { "docid": "1528a004fe5d841274e67d804a2b1d58", "score": "0.568673", "text": "func TranslationContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTranslation), v))\n\t})\n}", "title": "" }, { "docid": "2d405661beb2b4371c6fabb0a2087ec6", "score": "0.56773514", "text": "func V3ContainsFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldV3), v))\n\t})\n}", "title": "" }, { "docid": "a1d737bfb51a247a8189cb2a67f142a2", "score": "0.56659395", "text": "func PhoneticContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPhonetic), v))\n\t})\n}", "title": "" }, { "docid": "5ec4d12536ebddb5c3c955ac47a85bbc", "score": "0.5643792", "text": "func ActionContainsFold(v string) predicate.Action {\n\treturn predicate.Action(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAction), v))\n\t})\n}", "title": "" }, { "docid": "fe5f3bc995d8d4c1ffae21d141ef7768", "score": "0.563577", "text": "func AddressContainsFold(v string) predicate.Doctor {\n\treturn predicate.Doctor(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "42bc5cb523ff3d73d3e963ab6429f63c", "score": "0.5633455", "text": "func TaxIDContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTaxID), v))\n\t})\n}", "title": "" }, { "docid": "db6375f76f28c05dae30495900a95ef2", "score": "0.5626091", "text": "func DefinitionContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDefinition), v))\n\t})\n}", "title": "" }, { "docid": "834bcde582523a37eb9bd7614d5293bb", "score": "0.56215304", "text": "func ImeiContainsFold(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldImei), v))\n\t})\n}", "title": "" }, { "docid": "89c40f068f02bac5ded25c09bbb188af", "score": "0.560495", "text": "func TextContainsFold(v string) predicate.Post {\n\treturn predicate.Post(sql.FieldContainsFold(FieldText, v))\n}", "title": "" }, { "docid": "f78921ad9675b0af8ffc9b31e3f78b13", "score": "0.56030124", "text": "func AddressContainsFold(v string) predicate.OutboundShipping {\n\treturn predicate.OutboundShipping(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "f8db8bd3ad99e4054bde267d7a799e95", "score": "0.55934435", "text": "func AddressContainsFold(v string) predicate.User {\n\treturn predicate.User(sql.FieldContainsFold(FieldAddress, v))\n}", "title": "" }, { "docid": "d9a42c1069fb07b17c090934e65bd3b4", "score": "0.5563321", "text": "func PhoneContainsFold(v string) predicate.UserOpInfo {\n\treturn predicate.UserOpInfo(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "4a52498f064c65eb5a73f14afed8c9f1", "score": "0.55525243", "text": "func TypeContains(v string) predicate.PropertyType {\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "d7793048513f64dde5a1a0b9e0f6711f", "score": "0.5530348", "text": "func TypetreatmentEqualFold(v string) predicate.Typetreatment {\n\treturn predicate.Typetreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldTypetreatment), v))\n\t})\n}", "title": "" }, { "docid": "c13469d2ec12864e55a1931eba5419eb", "score": "0.5526385", "text": "func HowtoContainsFold(v string) predicate.Drug {\n\treturn predicate.Drug(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldHowto), v))\n\t})\n}", "title": "" }, { "docid": "897244e3b51879d662a38086a584dca4", "score": "0.54968894", "text": "func V2ContainsFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldV2), v))\n\t})\n}", "title": "" }, { "docid": "14d3041963397bb79e6465ea674b609a", "score": "0.54886335", "text": "func OsTypeEqualFold(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldOsType), v))\n\t})\n}", "title": "" }, { "docid": "ded32b0a4599fea41c6a3306725476b3", "score": "0.5467819", "text": "func ZipCodeContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldZipCode), v))\n\t})\n}", "title": "" }, { "docid": "364e00c1b344c7f058b56831721a9e34", "score": "0.54620296", "text": "func NameContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldName, v))\n}", "title": "" }, { "docid": "4e4f52e3d04ab12ce0726a356b68b5ac", "score": "0.545307", "text": "func TDateContainsFold(v string) predicate.Hot {\n\treturn predicate.Hot(sql.FieldContainsFold(FieldTDate, v))\n}", "title": "" }, { "docid": "295f17c0b3a69dd197070c3799437542", "score": "0.5435227", "text": "func ValueContainsFold(v string) predicate.Voca {\n\treturn predicate.Voca(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldValue), v))\n\t})\n}", "title": "" }, { "docid": "fcb9ef80042108452719141c5e3778c9", "score": "0.54351515", "text": "func DomainContainsFold(v string) predicate.Fact {\n\treturn predicate.Fact(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDomain), v))\n\t})\n}", "title": "" }, { "docid": "234407c4522d4590a30f547f3eef5a5f", "score": "0.54292905", "text": "func TextFormulaContainsFold(v string) predicate.Formula {\n\treturn predicate.Formula(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTextFormula), v))\n\t})\n}", "title": "" }, { "docid": "91f869c694d0acccc666df518b25543b", "score": "0.5418707", "text": "func IPContainsFold(v string) predicate.IP {\n\treturn predicate.IP(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIP), v))\n\t})\n}", "title": "" }, { "docid": "1579abcbc82b743b635a12f8cbfe46c7", "score": "0.541476", "text": "func StatusContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStatus), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "6c25f65ba5f89917d88b36969288870e", "score": "0.5413598", "text": "func CityContainsFold(v string) predicate.UserLogin {\n\treturn predicate.UserLogin(sql.FieldContainsFold(FieldCity, v))\n}", "title": "" }, { "docid": "1c01922b15059bc21b13aa4832e3c1a9", "score": "0.53936344", "text": "func NameContainsFold(v string) predicate.Label {\n\treturn predicate.Label(sql.FieldContainsFold(FieldName, v))\n}", "title": "" }, { "docid": "c4eff42ac80da25e266829920c5b20a1", "score": "0.5387233", "text": "func SwContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldSw), v))\n\t})\n}", "title": "" }, { "docid": "ae0e39ac71ded59b2083d1e324bf7f10", "score": "0.53864413", "text": "func StatusCodeContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStatusCode), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "1da1e9597bc7e92627feccbce4ad42e4", "score": "0.5384653", "text": "func PHONEContainsFold(v string) predicate.Bookcourse {\n\treturn predicate.Bookcourse(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPHONE), v))\n\t})\n}", "title": "" }, { "docid": "d29a3ded6d8afe067d2895543bfe45e0", "score": "0.53836113", "text": "func SymbolContainsFold(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldContainsFold(FieldSymbol, v))\n}", "title": "" }, { "docid": "ab8e30828fca499784938123dae45cb6", "score": "0.53745884", "text": "func PhoneContainsFold(v string) predicate.User {\n\treturn predicate.User(sql.FieldContainsFold(FieldPhone, v))\n}", "title": "" }, { "docid": "7ff913a2df8af6be365605453d0b6d18", "score": "0.53675574", "text": "func NameContainsFold(v string) predicate.PropertyType {\n\treturn predicate.PropertyType(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "4ba58a5f8a6316679208ac480b67fcb7", "score": "0.53658885", "text": "func PhoneContainsFold(v string) predicate.Doctor {\n\treturn predicate.Doctor(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "309479417aeb799ae218132635cf7111", "score": "0.53482825", "text": "func FurnitureTypeEqualFold(v string) predicate.FurnitureType {\n\treturn predicate.FurnitureType(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldFurnitureType), v))\n\t})\n}", "title": "" }, { "docid": "2365afd51079b8c758f142228e73539b", "score": "0.5330616", "text": "func BloodtypeEqualFold(v string) predicate.Patientrecord {\n\treturn predicate.Patientrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldBloodtype), v))\n\t})\n}", "title": "" }, { "docid": "57116be3cc145620a7e911ba2082f750", "score": "0.5328385", "text": "func MutationTypeEqualFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldMutationType), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "5537f9fd45be19cb6d26f58b4331fcc2", "score": "0.53277695", "text": "func IPAddressContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIPAddress), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "3e9f2d8bb780b500275095db25d6e6b9", "score": "0.5319217", "text": "func StreetContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStreet), v))\n\t})\n}", "title": "" }, { "docid": "f0893a01d88b4bd64e04b40a642a59c8", "score": "0.53190583", "text": "func KeyContainsFold(v string) predicate.Voca {\n\treturn predicate.Voca(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldKey), v))\n\t})\n}", "title": "" }, { "docid": "03997024a35195a23ca36d1e52ef7afe", "score": "0.5314029", "text": "func AccountContainsFold(v string) predicate.UserLogin {\n\treturn predicate.UserLogin(sql.FieldContainsFold(FieldAccount, v))\n}", "title": "" }, { "docid": "d986bad96cbe6b9be084e3d5c88ce23e", "score": "0.53133506", "text": "func DomainContainsFold(v string) predicate.Scope {\n\treturn predicate.Scope(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldDomain), v))\n\t})\n}", "title": "" }, { "docid": "8ce93b9671b9ea5a4557e500f88ef6f2", "score": "0.53132457", "text": "func NameContainsFold(v string) predicate.Configuration {\n\treturn predicate.Configuration(sql.FieldContainsFold(FieldName, v))\n}", "title": "" }, { "docid": "a483ca815a78037a49377a180c338f92", "score": "0.5302081", "text": "func TextContainsFold(v string) predicate.Comment {\n\treturn predicate.Comment(sql.FieldContainsFold(FieldText, v))\n}", "title": "" }, { "docid": "9b7883025d04223fcb9832e0f6b7b983", "score": "0.52839714", "text": "func BankContainsFold(v string) predicate.Paymentchannel {\n\treturn predicate.Paymentchannel(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldBank), v))\n\t})\n}", "title": "" }, { "docid": "6710e7e012d1e4426bed8137c695cdf0", "score": "0.5276211", "text": "func CarregistrationContainsFold(v string) predicate.Ambulance {\n\treturn predicate.Ambulance(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCarregistration), v))\n\t})\n}", "title": "" }, { "docid": "c5de43d5e73100f321feb24a0f49f86c", "score": "0.52745754", "text": "func ServiceContainsFold(v string) predicate.Permission {\n\treturn predicate.Permission(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldService), v))\n\t})\n}", "title": "" }, { "docid": "6ad34073f88a8a38bdc95355704ddcd0", "score": "0.52690256", "text": "func V1ContainsFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldV1), v))\n\t})\n}", "title": "" }, { "docid": "2b3afe63dbd490cda2fdb06b4bc712f6", "score": "0.5265682", "text": "func TitleContainsFold(v string) predicate.Todo {\n\treturn predicate.Todo(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "a147f45fc115edab4be1b8d190a78a3f", "score": "0.525343", "text": "func ModelContainsFold(v string) predicate.Device {\n\treturn predicate.Device(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldModel), v))\n\t})\n}", "title": "" }, { "docid": "e4fb621b3e93b7ec7296a3423e4cf51b", "score": "0.5248287", "text": "func NameContainsFold(v string) predicate.City {\n\treturn predicate.City(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "45a891cff5b65604cc4d75b590ff1ed5", "score": "0.5243332", "text": "func StatusContainsFold(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "30953d6d891bf413c03d2faabc1f64fa", "score": "0.52365714", "text": "func TitleContainsFold(v string) predicate.Review {\n\treturn predicate.Review(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "ad3f890c1c9261f02ad356a6652324d9", "score": "0.5234654", "text": "func FielnameContainsFold(v string) predicate.Photo {\n\treturn predicate.Photo(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.ContainsFold(s.C(FieldFielname), v))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "c43ca6ab6b8448099806dae2800f4ac9", "score": "0.5231283", "text": "func IPContainsFold(v string) predicate.UserLogin {\n\treturn predicate.UserLogin(sql.FieldContainsFold(FieldIP, v))\n}", "title": "" }, { "docid": "caf70e5f235438273855f1893b379af2", "score": "0.5226698", "text": "func CPContainsFold(v string) predicate.ContactParents {\n\treturn predicate.ContactParents(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldCP), v))\n\t})\n}", "title": "" }, { "docid": "847c1055d786eaaf08bb2a20fe7392b0", "score": "0.5226694", "text": "func OrganizationContainsFold(v string) predicate.AuditLog {\n\treturn predicate.AuditLog(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldOrganization), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "b8345a143ca8e2bdafe696bbfe353b96", "score": "0.5216653", "text": "func PTypeContains(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldPType), v))\n\t})\n}", "title": "" }, { "docid": "461e392881c47f0c5d3a52f917410752", "score": "0.521159", "text": "func AdviceContainsFold(v string) predicate.Bonedisease {\n\treturn predicate.Bonedisease(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAdvice), v))\n\t})\n}", "title": "" }, { "docid": "1dc8745a2d4e33380d35a97d504c062d", "score": "0.5203058", "text": "func ContainsFold(s, substr string) bool {\n\tif substr == \"\" {\n\t\treturn true\n\t}\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tfirstRune := rune(substr[0])\n\tif firstRune >= utf8.RuneSelf {\n\t\tfirstRune, _ = utf8.DecodeRuneInString(substr)\n\t}\n\tfirstLowerRune := unicode.SimpleFold(firstRune)\n\tfor i, rune := range s {\n\t\tif len(s)-i < len(substr) {\n\t\t\treturn false\n\t\t}\n\t\tif rune == firstLowerRune || unicode.SimpleFold(rune) == firstLowerRune {\n\t\t\tif HasPrefixFold(s[i:], substr) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f421fd2dbe5971a36493ad804005f8b0", "score": "0.51979655", "text": "func AddressToContainsFold(v string) predicate.Transaction {\n\treturn predicate.Transaction(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddressTo), v))\n\t})\n}", "title": "" }, { "docid": "b992c578e0e1e014002003e17918492d", "score": "0.51970494", "text": "func V4ContainsFold(v string) predicate.CasbinRule {\n\treturn predicate.CasbinRule(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldV4), v))\n\t})\n}", "title": "" }, { "docid": "da841d81399c92696b7726ae7ab04f0d", "score": "0.5196637", "text": "func ConsigneeContainsFold(v string) predicate.OutboundShipping {\n\treturn predicate.OutboundShipping(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldConsignee), v))\n\t})\n}", "title": "" }, { "docid": "5e6270a261a1ea652eb97542dedda5ec", "score": "0.51912653", "text": "func AddressDetailContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAddressDetail), v))\n\t})\n}", "title": "" }, { "docid": "322df7d133e6da9a8183311246b85a5e", "score": "0.51851887", "text": "func HitIDContainsFold(v string) predicate.StepRun {\n\treturn predicate.StepRun(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldHitID), v))\n\t})\n}", "title": "" }, { "docid": "4a058739c4f979486cb92c774286cf09", "score": "0.51800954", "text": "func AudioContainsFold(v string) predicate.Ecdict {\n\treturn predicate.Ecdict(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldAudio), v))\n\t})\n}", "title": "" }, { "docid": "fa25c94441a1a2974f19f82d380e041c", "score": "0.5176041", "text": "func IconContainsFold(v string) predicate.Menu {\n\treturn predicate.Menu(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIcon), v))\n\t})\n}", "title": "" }, { "docid": "ae242768aac3774b45946ed6db1811a2", "score": "0.51652586", "text": "func ProvinceNameTHContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldProvinceNameTH), v))\n\t})\n}", "title": "" }, { "docid": "ca9015ebf759f88e017d8e57b92a61f8", "score": "0.51629937", "text": "func NameContainsFold(v string) predicate.TourProduct {\n\treturn predicate.TourProduct(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "bf99e13f18ae64a6a5fd5212d12acce5", "score": "0.5162084", "text": "func PhonenumberContainsFold(v string) predicate.Patientrecord {\n\treturn predicate.Patientrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPhonenumber), v))\n\t})\n}", "title": "" }, { "docid": "cc18ebd75781846ac7a78eb9cca1129c", "score": "0.5158865", "text": "func WalletIDContainsFold(v string) predicate.Ranking {\n\treturn predicate.Ranking(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldWalletID), v))\n\t})\n}", "title": "" }, { "docid": "d2f7a48b75600bdc3238c1cd3570e825", "score": "0.51563066", "text": "func ThumbnailContainsFold(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldThumbnail), v))\n\t})\n}", "title": "" }, { "docid": "cadc89e8796b7728c6ed399ca00f478b", "score": "0.5156188", "text": "func NameContainsFold(v string) predicate.Stock {\n\treturn predicate.Stock(sql.FieldContainsFold(FieldName, v))\n}", "title": "" } ]
c9392a5330c015c645d932b1dfb9b86e
Handler for GatewayHello payloads
[ { "docid": "7af648023c31b3fc96f4ef6ada3b69db", "score": "0.7632071", "text": "func (sc *WebSocketClient) handlePayloadHello(payload RawGatewayPayload) {\n\thelloData := GatewayHelloData{}\n\tif err := json.Unmarshal(payload.Data, &helloData); err != nil {\n\t\tsc.logger.WithField(\"error\", err).Error(\"Failed unmarshaling GatewayHello\")\n\t}\n\n\theartbeatInterval := helloData.HeartbeatInterval * time.Millisecond\n\tsc.logger.WithField(\"HeartbeatInterval\", heartbeatInterval).Info(\"Got Gateway Hello\")\n\n\tsc.mu.Lock()\n\tsc.heartbeatInterval = heartbeatInterval\n\tsc.mu.Unlock()\n\n\tsc.sendIdentify()\n}", "title": "" } ]
[ { "docid": "6bccf9c713187c7daf50d5727658a87c", "score": "0.7060179", "text": "func HandlerHello(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\t// stdout and stderr are sent to AWS CloudWatch Logs\n\tlog.Printf(\"Processing Lambda request %s\\n\", request.RequestContext.RequestID)\n\n\tlog.Print(\"Hello from LambdaHandler?\")\n\n\tlog.Print(\"Request = \" + request.RequestContext.RequestID)\n\n\t// Read from DynamoDB\n\tinput := &dynamodb.ScanInput{\n\t\tTableName: tableName,\n\t}\n\n\tif result, err := dynamo.Scan(input); err != nil {\n\t\tlog.Printf(\"Failed to Scan: %s\\n\", err.Error())\n\t} else {\n\t\tfor _, i := range result.Items {\n\t\t\tlog.Printf(\"%+v\\n\", i)\n\t\t}\n\t}\n\n\t// If no name is provided in the HTTP request body, throw an error\n\tif len(request.Body) < 1 {\n\t\treturn events.APIGatewayProxyResponse{}, ErrNameNotProvided\n\t}\n\n\tresponse := events.APIGatewayProxyResponse{\n\t\tBody: \"Hello \" + request.Body,\n\t\tStatusCode: 200,\n\t}\n\n\tlog.Printf(\"%+v\\n\", response)\n\n\treturn response, nil\n\n}", "title": "" }, { "docid": "0c5f5405a793b8a87bc8345bd2b4fe65", "score": "0.6686476", "text": "func (h helloHandler) Handler(msg *message.Message) ([]*message.Message, error) {\n\tfmt.Printf(\n\t\t\"\\n> helloHandler received message: %s\\n> %s\\n> metadata: %v\\n\",\n\t\tmsg.UUID, string(msg.Payload), msg.Metadata,\n\t)\n\n\tmsg = message.NewMessage(watermill.NewUUID(), []byte(\"greet from helloHandler\"))\n\treturn message.Messages{msg}, nil\n}", "title": "" }, { "docid": "ec6b6b76b3eb7ea64cdc55226c5ea7e0", "score": "0.642075", "text": "func Handler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Hello From PushService\"))\n}", "title": "" }, { "docid": "9479ad4c1dbcd10b4d8090260cb2cce2", "score": "0.64190364", "text": "func handleHello(requestsCounter prometheus.Counter) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\trequestsCounter.Inc()\n\t\tfmt.Printf(\"handled hello request\\n\")\n\t\tio.WriteString(w, HELLO_RESPONSE)\n\t}\n}", "title": "" }, { "docid": "bc918c43b40cb3f25a5c23832aba6994", "score": "0.6414454", "text": "func (s *_echo_GreeterService) _handler_SayHello_0(ctx v4.Context) error {\n\tvar in SayHelloRequest\n\tif err := ctx.Bind(&in); err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\tmd := metadata.New(nil)\n\tfor k, v := range ctx.Request().Header {\n\t\tmd.Set(k, v...)\n\t}\n\tnewCtx := metadata.NewIncomingContext(ctx.Request().Context(), md)\n\tout, err := s.server.(GreeterServiceEchoServer).SayHello(newCtx, &in)\n\tif err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\n\treturn ctx.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "8a6d2017ca7b526a745eef972159b9a2", "score": "0.6357955", "text": "func Handler(ctx context.Context, request Request) (Response, error) {\n\tvar buf bytes.Buffer\n\n\ttagName := extractTagName(request)\n\tlog.Println(fmt.Sprintf(\"tagname is %s\", tagName))\n\n\tbodyString := request.Body\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": \"Go Serverless v1.0! Your function executed successfully!!\",\n\t\t\"tagname\": tagName,\n\t\t\"tagNameInBody\": bodyString,\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: 201,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"hello-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "e6c6f102fb53b3cfbb5b9f43b19dfa98", "score": "0.6315179", "text": "func (s *_echo_GreeterService) _handler_SayHello_1(ctx v4.Context) error {\n\tvar in SayHelloRequest\n\tif err := ctx.Bind(&in); err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\tmd := metadata.New(nil)\n\tfor k, v := range ctx.Request().Header {\n\t\tmd.Set(k, v...)\n\t}\n\tnewCtx := metadata.NewIncomingContext(ctx.Request().Context(), md)\n\tout, err := s.server.(GreeterServiceEchoServer).SayHello(newCtx, &in)\n\tif err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\n\treturn ctx.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "7f8b859109803c4d72876b29c49c65ee", "score": "0.63131285", "text": "func (sc *WebSocketClient) handlePayload(payload RawGatewayPayload) {\n\tsc.logger.WithFields(logrus.Fields{\n\t\t\"op\": payload.OpCode,\n\t\t\"op-name\": PayloadOpToName(payload.OpCode),\n\t}).Debug(\"Received payload\")\n\n\tswitch payload.OpCode {\n\tcase PAYLOAD_GATEWAY_HELLO:\n\t\tsc.handlePayloadHello(payload)\n\tcase PAYLOAD_GATEWAY_DISPATCH:\n\t\tsc.handlePayloadDispatch(payload)\n\t}\n}", "title": "" }, { "docid": "9615d4175e08b2100b0f33693e3f4ce3", "score": "0.62274754", "text": "func Handler(ctx context.Context, event events.APIGatewayWebsocketProxyRequest) (Response, error) {\n\tfmt.Printf(\"%#v\\n\\n\", ctx)\n\tfmt.Printf(\"%#v\\n\\n\", event)\n\n\thandleMessage(event)\n\n\treturn success(\"\"), nil\n}", "title": "" }, { "docid": "9b1feaa91e625e9c28c113ec5629a7cf", "score": "0.62225205", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\titem, err := dynamoDB.GetSessionData()\n\tif err != nil {\n\t\treturn events.APIGatewayProxyResponse{Body: err.Error(), StatusCode: 404}, err\n\t}\n\n\treturn events.APIGatewayProxyResponse{Body: \"Hello \" + fmt.Sprintf(\"%v\", item.Profile[\"name\"]), StatusCode: 200}, nil\n}", "title": "" }, { "docid": "219e587938e847b89395da562bcfc30c", "score": "0.6214169", "text": "func (handler *HelloHandler)Hello(ctx context.Context, req *desc.PigRequest)(*desc.PigResponse, error) {\n\t// todo impl handler method\n\treturn nil, nil\n}", "title": "" }, { "docid": "0198dcf666a1e162fc026563a9cab856", "score": "0.6206449", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tlog.Println(\"Lambda request\", request.RequestContext.RequestID)\n\n\tb, _ := json.Marshal(body{Message: \"Hello World!\"})\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: string(b),\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "3560f578b6dd73ec481a7d273e966aa5", "score": "0.6094673", "text": "func helloWorldhandler(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"message\": \"Scooby doo\",\n\t})\n}", "title": "" }, { "docid": "e9b4fab0ab621073658e8bc38d8cd356", "score": "0.607002", "text": "func (s *_echo_GreeterService) _handler_SayHi_0(ctx v4.Context) error {\n\tvar in SayHiRequest\n\tif err := ctx.Bind(&in); err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\tmd := metadata.New(nil)\n\tfor k, v := range ctx.Request().Header {\n\t\tmd.Set(k, v...)\n\t}\n\tnewCtx := metadata.NewIncomingContext(ctx.Request().Context(), md)\n\tout, err := s.server.(GreeterServiceEchoServer).SayHi(newCtx, &in)\n\tif err != nil {\n\t\tctx.Error(err)\n\t\treturn nil\n\t}\n\n\treturn ctx.JSON(http.StatusOK, out)\n}", "title": "" }, { "docid": "f2cf868fcaaaa5d8e14c84c58652dca6", "score": "0.6064076", "text": "func HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Heloo saya lagi belaja web golang\"))\n\n}", "title": "" }, { "docid": "cf85526992cfd6a08ca23a442951ba28", "score": "0.6055677", "text": "func HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Wagwan Gee!!\")\n}", "title": "" }, { "docid": "460f7e57b88cf90c262e6f113b29784f", "score": "0.60281754", "text": "func (ar *Router) HandleHello() http.HandlerFunc {\n\ttype helloResponse struct {\n\t\tAnswer string `json:\"answer,omitempty\"`\n\t\tDate time.Time `json:\"date,omitempty\"`\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tlocale := r.Header.Get(\"Accept-Language\")\n\n\t\tar.logger.Println(\"trace Hello handler\")\n\t\thello := helloResponse{\n\t\t\tAnswer: \"Hello, my name is Identifo\",\n\t\t\tDate: time.Now(),\n\t\t}\n\t\tar.ServeJSON(w, locale, http.StatusOK, hello)\n\t}\n}", "title": "" }, { "docid": "d75bf026338c0c3b476f9d83faa0cca3", "score": "0.6010621", "text": "func Handler(req events.APIGatewayProxyRequest) (Response, error) {\n\tvar buf bytes.Buffer\n\n\tif req.QueryStringParameters[\"request\"] == \"\" {\n\t\treturn Response{StatusCode: 404, Body: \"'request' parameter is necessary\"}, nil\n\t}\n\n\tvar mess string = fmt.Sprintf(\"Function successfully received! Thanks %s for your request: %s\", req.PathParameters[\"name\"], req.QueryStringParameters[\"request\"])\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": mess,\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"test-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "1267c2e94f60867d93589cf956247c34", "score": "0.59917337", "text": "func helloWorldHandler(w http.ResponseWriter, r *http.Request){\n\tresponse := helloWorldResponse{Message:\"hello - world\"}\n\tdata,err := json.Marshal(response)\n\tif err!=nil{\n\t\tpanic(\"OOOOOOps\")\n\t}\n\tfmt.Println(w,string(data))\n}", "title": "" }, { "docid": "54bcc0ed37a1dd18e2b8357100b3cd1e", "score": "0.59664637", "text": "func (ctx *Context) HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"hi!\"))\n}", "title": "" }, { "docid": "eabae3ea70d94db494bb70fdfdd753a2", "score": "0.59419215", "text": "func Handler(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif !initialized {\n\t\trouter := api.SetupRouter()\n\t\tginLambda = ginadapter.New(router)\n\t\tinitialized = true\n\t}\n\n\t// If no name is provided in the HTTP request body, throw an error\n\treturn ginLambda.Proxy(req)\n}", "title": "" }, { "docid": "982ac0cbfb8a037f0394324311b7ddf9", "score": "0.5892945", "text": "func Hello(w http.ResponseWriter, r *http.Request) {\n\thandler.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "5d9ec518fb36e1cc82184fb31118af9d", "score": "0.58832395", "text": "func HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Welcome to my docker container hosted on AWS!\\n\"))\n}", "title": "" }, { "docid": "48b573654b49661a9654c48f1e0a0fd6", "score": "0.5864759", "text": "func HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Hello, World!\"))\n}", "title": "" }, { "docid": "52e9f1790cffde7e5089167eb48e604b", "score": "0.5849145", "text": "func (c *Client) Hello(ctx context.Context, p *HelloPayload) (res string, err error) {\n\tvar ires interface{}\n\tires, err = c.HelloEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(string), nil\n}", "title": "" }, { "docid": "ae043b419ce918a1c603115f81527684", "score": "0.5839485", "text": "func HelloWorld(w http.ResponseWriter, r *http.Request) {\n\tevents, err := Ctx.Linebot.ParseRequest(r)\n\tif err == linebot.ErrInvalidSignature {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t} else if err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tfor _, event := range events {\n\t\tif event.Type == linebot.EventTypeMessage {\n\t\t\tswitch event.Message.(type) {\n\t\t\tcase *linebot.TextMessage:\n\t\t\t\tif err := HandleTextMessage(Ctx.Linebot, event, event.Message.(*linebot.TextMessage).Text); err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if event.Type == linebot.EventTypePostback {\n\t\t\tif err := HandleTextMessage(Ctx.Linebot, event, event.Postback.Data); err != nil {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4bebc1f24538a80b60a3e975195a78bf", "score": "0.5801625", "text": "func Handler(ctx context.Context) (Response, error) {\n\n\tsrv := getGoogleCalService(GetCurrentDir())\n\tList(srv)\n\n\tvar buf bytes.Buffer\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": \"Go Serverless v1.0! Your function executed successfully!\",\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"hello-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "899692e9dc5ffb800dd14053b9950293", "score": "0.580138", "text": "func HelloHandler(c echo.Context) error {\n\treturn c.String(200, \"HELLO\")\n\t// return c.String(http.StatusOK, \"HELLO\")\n}", "title": "" }, { "docid": "7b7e4847241aada24eb675c4231c53c4", "score": "0.5800321", "text": "func (h *Heartbeat) handler() {\n\tres := map[string]interface{}{\n\t\t\"Status\": 1,\n\t\t\"Message\": \"success\",\n\t}\n\n\th.Status = http.StatusOK\n\th.ResponseJSON(res)\n}", "title": "" }, { "docid": "de6786ae40a3eb3560c8c1007a527e3b", "score": "0.578106", "text": "func HandlePayload(payload interface{}, header webhooks.Header) {\n\n}", "title": "" }, { "docid": "f331c4f6c7b26bc0be149bf98a09cf98", "score": "0.57691944", "text": "func (e *Helloworld) Hello(ctx context.Context, req *helloworld.HelloRequest, rsp *helloworld.HelloResponse) error {\n\tlogger.Info(\"Received Helloworld.Call request\")\n\treturn nil\n}", "title": "" }, { "docid": "e77e76f4a50966335ae1dddb3273aed5", "score": "0.5758817", "text": "func HelloHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Hello World!\")\n}", "title": "" }, { "docid": "aad98943b0bcf2a1e2f7f5f76f547492", "score": "0.5754839", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tlog.Println(\"ENV\", os.Environ())\n\n\t// stdout and stderr are sent to AWS CloudWatch Logs\n\tlog.Printf(\"[v0.4] Processing Lambda request %s\\n\", request.RequestContext.RequestID)\n\n\tlog.Println(\"method:\", request.HTTPMethod, \"path:\", request.Path, \"res:\", request.Resource)\n\n\tif request.HTTPMethod == \"GET\" {\n\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tBody: fmt.Sprintf(\"version: %v\", Version),\n\t\t\tStatusCode: 200,\n\t\t}, nil\n\t}\n\t// If no name is provided in the HTTP request body, throw an error\n\tif len(request.Body) < 1 {\n\t\treturn events.APIGatewayProxyResponse{}, ErrNameNotProvided\n\t}\n\n\tlog.Printf(\"[v0.4] BODY: %s\\n\", request.Body)\n\n\t/*\n\t\tm, err := url.ParseQuery(request.Body)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tresp := m[\"response_url\"][0]\n\t\tcommand := m[\"command\"][0]\n\t\ttext := m[\"text\"][0]\n\t\tlog.Println(\"response_url\", resp, \"command:\", command, \"text:\", text)\n\t*/\n\n\tmsg := awsInsatncesMsg(\"\", true)\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: msg,\n\t\tStatusCode: 200,\n\t}, nil\n\n}", "title": "" }, { "docid": "e7dcbeb88218591aef1557a9ffd9998f", "score": "0.575483", "text": "func Handler(h http.Handler) GatewayHandler {\n\treturn func(ctx context.Context, content json.RawMessage) (interface{}, error) {\n\t\tRawMessage = content\n\t\tvar ok bool\n\t\tLambdaContext, ok = lambdacontext.FromContext(ctx)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"no valid lambda context found\")\n\t\t}\n\t\tagp := NewAPIGateParser(content)\n\t\treturn Process(agp, h), nil\n\t\t// return `{\"statusCode\":200,\"headers\":{},\"body\":\"{}\",\"isBase64Encoded\":false}`, nil\n\t}\n}", "title": "" }, { "docid": "564d56a5378be66bca78819f4f47e594", "score": "0.57457876", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif len(request.Body) < 1 {\n\t\treturn events.APIGatewayProxyResponse{}, ErrInvalidRequestError\n\t}\n\n\tbody := request.Body\n\tfmt.Println(\"Body\", body)\n\tvar input Input\n\terr := json.Unmarshal([]byte(body), &input)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error\", err)\n\t\treturn events.APIGatewayProxyResponse{}, ErrInvalidRequestBody\n\t}\n\n\tfmt.Printf(\"Name :%s Description: %s\", input.Name, input.Description)\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: input.toString(),\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "c939d2a0154ff301f6ca4d34ccc2ab0b", "score": "0.5738331", "text": "func sendPayloadHandler(c echo.Context) error {\n\tvar request SendPayloadRequest\n\tif err := c.Bind(&request); err != nil {\n\t\tlog.Info(err.Error())\n\t\treturn c.JSON(http.StatusBadRequest, SendPayloadResponse{Error: err.Error()})\n\t}\n\n\tparsedPayload, _, err := payload.FromBytes(request.Payload)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, SendPayloadResponse{Error: err.Error()})\n\t}\n\n\tmsg, err := messagelayer.Tangle().IssuePayload(parsedPayload)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, SendPayloadResponse{Error: err.Error()})\n\t}\n\n\treturn c.JSON(http.StatusOK, SendPayloadResponse{ID: msg.ID().String()})\n}", "title": "" }, { "docid": "e00689f1e41bffe77ab830ebe23981a9", "score": "0.57361144", "text": "func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// If no name is provided in the HTTP request body, throw an error\n\treturn ginLambda.ProxyWithContext(ctx, req)\n}", "title": "" }, { "docid": "2d953a7c194322f61b8b068c4fd9fd43", "score": "0.57008195", "text": "func HelloEndpoint(w http.ResponseWriter, req *http.Request) {\n\tfmt.Fprintln(w, \"Hello from APIAI Webhook Integration.\")\n}", "title": "" }, { "docid": "631b76139f777439c0ca065cf0bc1f25", "score": "0.56997484", "text": "func helloHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tfmt.Fprintf(w, \"Hello, %s!\\n\", ps.ByName(\"name\"))\n\tlog.Println(\"executing hello controller\")\n}", "title": "" }, { "docid": "bbe4196e50dd6d276553a9acd75adb8c", "score": "0.56984174", "text": "func Handler(payload []byte) ([]byte, error) {\n\t// Perform a host callback to log the incoming request\n\t_, err := wapc.HostCall(\"tarmac\", \"logger\", \"debug\", payload)\n\tif err != nil {\n\t\treturn []byte(fmt.Sprintf(`{\"status\":{\"code\":500,\"status\":\"Failed to call host callback - %s\"}}`, err)), nil\n\t}\n\n\t// Parse the JSON request\n\trq, err := fastjson.ParseBytes(payload)\n\tif err != nil {\n\t\treturn []byte(fmt.Sprintf(`{\"status\":{\"code\":500,\"status\":\"Failed to call parse json - %s\"}}`, err)), nil\n\t}\n\n\t// Return the payload via a ServerResponse JSON\n\treturn []byte(fmt.Sprintf(`{\"payload\":\"%s\",\"status\":{\"code\":200,\"status\":\"Success\"}}`, rq.GetStringBytes(\"payload\"))), nil\n}", "title": "" }, { "docid": "96a14b376a2a20394c5b2ee45d5ecb99", "score": "0.5695034", "text": "func (p *DataPasser) handleHello(w http.ResponseWriter, r *http.Request) {\n\tp.logs <- r.URL.String() // In this method we'll put into channel the page name\n\tio.WriteString(w, \"Hello world. Case 2\")\n}", "title": "" }, { "docid": "041cd2b4a85edd2cf9930dc6b8fdef13", "score": "0.56875944", "text": "func (i *Instance) Handler(w http.ResponseWriter, r *http.Request) {\n\tsocket, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Socket Upgrade Error:\", err)\n\t}\n\n\tc := &Client{\n\t\tsocket: socket,\n\t\tSend: make(chan *MessagePayload),\n\t\tUser: context.Get(r, \"User\").(*security.User),\n\t}\n\ti.Register <- c\n\n\tif c.User.Username != \"\" {\n\t\tlog.Println(\"New user just connected\", c.User.Username)\n\t} else {\n\t\tlog.Println(\"New guest just connected\")\n\t}\n\n\tgo c.read(i)\n\tgo c.write(i)\n}", "title": "" }, { "docid": "d8e28264632f3c387fd87a5f0a635684", "score": "0.5686027", "text": "func makeHelloHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.HelloEndpoint, decodeHelloRequest, encodeHelloResponse, options...)\n}", "title": "" }, { "docid": "ac02a2a0864de4d7ef92d67b54b06c0f", "score": "0.56792444", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\t// stdout and stderr go to Cloudwatch!\n\tlog.Printf(\"Processing Lambda request %s\\n\", request.RequestContext.RequestID)\n\n\t// TODO: check if type = url_verification\n\tif strings.Contains(request.Body, \"challenge\") {\n\t\treturn ChallengeHandler(request)\n\t}\n\n\tif len(request.Body) < 1 {\n\t\treturn events.APIGatewayProxyResponse{}, ErrNameNotProvided\n\t}\n\n\t// Use Slack events API to process response\n\tslackToken := os.Getenv(\"SLACK_API_KEY\")\n\tapi := slack.New(slackToken)\n\tparams := slack.PostMessageParameters{}\n\teventsAPIEvent, e := slackevents.ParseEvent(json.RawMessage(request.Body))\n\tif e != nil {\n\t\tlog.Printf(\"Error!, %s\", e)\n\t}\n\tinnerEvent := eventsAPIEvent.InnerEvent\n\tswitch ev := innerEvent.Data.(type) {\n\t// This is an EventsAPI specific event\n\tcase *slackevents.AppMentionEvent:\n\t\tapi.PostMessage(ev.Channel, \"hi\", params)\n\t\tbreak\n\t// There are Events API specific MessageEvents\n\t// https://api.slack.com/events/message.channels\n\tcase *slackevents.MessageEvent:\n\t\tif strings.Contains(ev.Text, \"pizza\") {\n\t\t\tapi.PostMessage(ev.Channel, \"I like pizza too.\", params)\n\t\t}\n\t\tbreak\n\t// This is an Event shared between RTM and the EventsAPI\n\tcase *slack.ChannelCreatedEvent:\n\t\tapi.PostMessage(ev.Channel.ID, \"Oh hey, a new channel!\", params)\n\t\tbreak\n\tdefault:\n\t\tfmt.Println(innerEvent.Type)\n\t\tfmt.Println(\"no event to match\")\n\t}\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: \"Event:\" + string(innerEvent.Type) + \", recieved!\",\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "9890d5c5cba8df86ef4df82fb2a7d846", "score": "0.567554", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\t// stdout and stderr are sent to AWS CloudWatch Logs\n\tlog.Printf(\"Processing Lambda request %s\\n\", request.RequestContext.RequestID)\n\n\tbizNum := request.QueryStringParameters[\"bizNum\"]\n\n\t// If no name is provided in the HTTP request body, throw an error\n\tif bizNum == \"\" {\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\tBody: aefire.ToJson(aefire.MapOf(\"message\", \"사업자등록번호가 지정되지 않았습니다\")),\n\t\t}, nil\n\t}\n\n\tif !ValidateBizNum(bizNum) {\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\tBody: aefire.ToJson(aefire.MapOf(\"message\", \"사업자등록번호 형식이 맞지 않습니다\")),\n\t\t}, nil\n\n\t}\n\n\tq := req.New()\n\n\tres, err := q.Post(\n\t\t\"https://teht.hometax.go.kr/wqAction.do?actionId=ATTABZAA001R08&screenId=UTEABAAA13&popupYn=false&realScreenId=\",\n\t\treq.BodyXML(fmt.Sprintf(`<map id='ATTABZAA001R08'><pubcUserNo/><mobYn>N</mobYn><inqrTrgtClCd>1</inqrTrgtClCd><txprDscmNo>%s</txprDscmNo><dongCode>__MIDDLE__</dongCode><psbSearch>Y</psbSearch><map id='userReqInfoVO'/></map>`, bizNum)))\n\n\tif err != nil {\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tBody: aefire.ToJson(aefire.MapOf(\"message\", \"홈택스 연결이 실패했습니다\")),\n\t\t}, nil\n\t}\n\n\tcloseDown := ParseHomeTaxCloseDown(res.String(), &homeTaxConfig)\n\tcloseDown.BizNum = bizNum\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: aefire.ToJson(closeDown),\n\t\tStatusCode: 200,\n\t}, nil\n\n}", "title": "" }, { "docid": "c1f33e28443b497d717345028e52e554", "score": "0.567268", "text": "func (h *Handler) Hello(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": \"hello world\",\n\t})\n}", "title": "" }, { "docid": "bf61e77019622061b639f896e5dc599a", "score": "0.565912", "text": "func (svc *HelloGRPCService) SayHellogw(ctx context.Context, in *pb.PingMessage) (*pb.PingMessage, error) {\n\tlog.Printf(\"Received msg in gw : %s in request \\n\", in.Greeting)\n\tres := pb.PingMessage{\n\t\tGreeting: \"Milgya greeting...bas rehn de.... gw\",\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "017432dbdf84e3b7343378d7388ee0d6", "score": "0.5658781", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\r\n\r\n\t// stdout and stderr are sent to AWS CloudWatch Logs\r\n\tlog.Printf(\"Processing Lambda request %s\\n\", request.RequestContext.RequestID)\r\n\r\n\tswitch request.HTTPMethod {\r\n\tcase \"GET\":\r\n\t\treturn events.APIGatewayProxyResponse{\r\n\t\t\tBody: \"Hello test 3, method: GET, TEST: \" + os.Getenv(\"TEST\") + \", GLOBAL: \" + os.Getenv(\"GLOBAL\"),\r\n\t\t\tStatusCode: 200,\r\n\t\t\tIsBase64Encoded: false,\r\n\t\t}, nil\r\n\r\n\tcase \"POST\":\r\n\t\treturn events.APIGatewayProxyResponse{\r\n\t\t\tBody: \"Hello test, method POST, \" + os.Getenv(\"TEST\") + \", GLOBAL: \" + os.Getenv(\"GLOBAL\") + \"\\nBody:\\n\\n\" + request.Body,\r\n\t\t\tStatusCode: 200,\r\n\t\t\tIsBase64Encoded: false,\r\n\t\t}, nil\r\n\r\n\t}\r\n\r\n\treturn events.APIGatewayProxyResponse{}, ErrUndefinedHTTPMethod\r\n\r\n}", "title": "" }, { "docid": "e5063202214c989fa45fb0695d4e5793", "score": "0.5655891", "text": "func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\treturn ginLambda.Proxy(req)\n}", "title": "" }, { "docid": "2444224ac1a0266e9c0430fe9a0900fe", "score": "0.56485814", "text": "func HelloHandler(w http.ResponseWriter, req *http.Request) {\n\tshared.Logger.Notice(\"GET /\")\n\tfmt.Fprintf(w, \"Hello World too\")\n}", "title": "" }, { "docid": "70f1e50ee3d81f8cd3b4c0fb3207a9fd", "score": "0.56477", "text": "func helloHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.Header().Set(\"done-by\", \"alejandro\")\n\n\tres := map[string]interface{}{\"Message\": \"Welcome\"}\n\n\t_ = json.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "cba16ee3d46ec884447ee28f276cb5d6", "score": "0.5642638", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif err := Do(); err != nil {\n\t\treturn events.APIGatewayProxyResponse{}, err\n\t}\n\n\treturn events.APIGatewayProxyResponse{\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "6218f3e9eefc86a89fb93039f41dd974", "score": "0.5639551", "text": "func (m *Messenger) Handler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\t\n\t\n\tdata := models.Message {\n\t\tMessage: \"Hello, World\",\n\t\tPort: m.port,\n\t}\n\t\n\terr := json.NewEncoder(w).Encode(data)\n\tif err != nil {\n\t\tm.l.Println(err.Error())\n\t}\n}", "title": "" }, { "docid": "8dd9b02f69adf358d61eb89246c75837", "score": "0.5634681", "text": "func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif ginLambda == nil {\n\t\t// stdout and stderr are sent to AWS CloudWatch Logs\n\t\tlog.Printf(\"Gin cold start\")\n\t\tr := gin.Default()\n\t\tr.GET(\"/pets\", getPets)\n\t\tr.GET(\"/pets/:id\", getPet)\n\t\tr.POST(\"/pets\", createPet)\n\n\t\tginLambda = ginadapter.New(r)\n\t}\n\n\treturn ginLambda.ProxyWithContext(ctx, req)\n}", "title": "" }, { "docid": "68acb702f8cb214f72286de56532c285", "score": "0.56310624", "text": "func Handler(ctx context.Context, request events.APIGatewayProxyRequest) (Response, error) {\n\n\toutput := \"Your function executed successfully!\"\n\tif len(request.QueryStringParameters[\"q\"]) > 0 {\n\t\t// Source of our hacky code...\n\t\toutput = runner.Run(request.QueryStringParameters[\"q\"])\n\t\tlog.Print(\"Request %v, q=%v, %v\", string(request.QueryStringParameters[\"q\"]), string(output))\n\t\tlog.Print(output)\n\t}\n\n\tresp := Response{\n\t\tStatusCode: 200,\n\t\tBody: output,\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/text\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "d3da3855edc2728d588cbba83959b488", "score": "0.5612606", "text": "func helloHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"Hello World!\")\n}", "title": "" }, { "docid": "f54e0276242282c6013b00d5a4e5e39e", "score": "0.55964625", "text": "func (h *Handlers) HelloWorld(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"Hello world\"))\n}", "title": "" }, { "docid": "a404b58aa8f10e8b542d1cd1bade4991", "score": "0.55946404", "text": "func (h *HelloProtocolHandler) sendHello(s net.Stream) error {\n\tmsg, err := h.getOurHelloMessage()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf := new(bytes.Buffer)\n\tif err := msg.MarshalCBOR(buf); err != nil {\n\t\treturn err\n\t}\n\n\tn, err := s.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != buf.Len() {\n\t\treturn fmt.Errorf(\"could not write all hello message bytes\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d3d23fd1f70a1f9cc0b9b8ddc9e7c672", "score": "0.5582528", "text": "func (app *application) aliveHandler(w http.ResponseWriter, _ *http.Request) {\n\tif _, err := fmt.Fprintf(w, \"I am aliveHandler\\n\"); err != nil {\n\t\tapp.errorLog.Printf(\"failed to send aliveHandler message: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "ed32529bba5aac6a5950430244f33c8c", "score": "0.5573511", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\t_, err := w.Write([]byte(\"{\\\"message\\\": \\\"HELLO WORLD!!\\\"}\"))\n\tif err != nil {\n\t\tlog.Println(\"cannot hello wold :(\")\n\t}\n}", "title": "" }, { "docid": "2e22f8cb0af054ed3bbd876cc2a02659", "score": "0.5571405", "text": "func (p *PushService) Handler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := p.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Print(\"Cannot upgrade:\", err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tconn.SetWriteDeadline(time.Now().Add(30 * time.Second))\n\tin := make(chan []byte)\n\tp.addCh <- in\n\tdefer func() { p.removeCh <- in }()\n\tfor {\n\t\tmsg := <-in\n\t\terr = conn.WriteMessage(websocket.TextMessage, msg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Cannot write to the WS:\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e4ff895a16fdf597ed8c15488c58ccd6", "score": "0.55219066", "text": "func Handler(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tmyLogger := api.StandardLambdaLogger(ctx, pkg.EnvLogLevel)\n\tparser := tracking.NewParser(myLogger)\n\tpageLoad := parser.GetPageLoadFromAPIGatewayEvent(event)\n\tdynamodb := util.GetDynamoClient(myLogger)\n\ttracker := tracking.New(dynamodb, os.Getenv(pkg.EnvTrackingTableName), myLogger)\n\tsuccess := tracker.AddPageLoad(pageLoad)\n\tif !success && !pkg.IsUserFacing() {\n\t\tvar buf bytes.Buffer\n\t\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\t\"message\": \"There was a problem while adding the user tracking information. Check the logs for more information.\",\n\t\t})\n\t\tif err != nil {\n\t\t\tmyLogger.Errorf(\"There was an error while trying to json.Marshal the response: %v\", err)\n\t\t\treturn events.APIGatewayProxyResponse{StatusCode: 404}, err\n\t\t}\n\t\tjson.HTMLEscape(&buf, body)\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tStatusCode: 400,\n\t\t\tIsBase64Encoded: false,\n\t\t\tBody: buf.String(),\n\t\t\tHeaders: map[string]string{\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t}, nil\n\t}\n\n\treturn events.APIGatewayProxyResponse{\n\t\tStatusCode: 204,\n\t\tIsBase64Encoded: false,\n\t\t//This needs to resolve to a JSON-decodable string\n\t\tBody: \"{}\",\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "3c9f7f7ffa1cf49dcfeeab143946658b", "score": "0.5515312", "text": "func (app *App) HandlerHealthz(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"version\": app.Version,\n\t})\n}", "title": "" }, { "docid": "35d03155f592e794f24fa484773d9510", "score": "0.5496161", "text": "func gateHandler(w http.ResponseWriter, r *http.Request) {\n\t// Extract message from HTTP request\n\tmsg, err := message.ExtractMessage(r)\n\tif err != nil {\n\t\tdecoyHandler(w, r)\n\t}\n\t// Init AesParams (request scoped)\n\tvar aesParams = new(cryptography.AesParams)\n\t// Decrypt message\n\tdecryptedMsg, err := cryptography.Decrypt(msg, aesParams)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tdecoyHandler(w, r)\n\t}\n\t// Process decrypted message\n\tresponse, err := message.ProcessMessage(decryptedMsg)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tdecoyHandler(w, r)\n\t\treturn\n\t}\n\t// Encrypt message\n\tencryptedMsg, err := cryptography.Encrypt(response, aesParams)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tdecoyHandler(w, r)\n\t\treturn\n\t}\n\t// Server response\n\tfmt.Fprintf(w, *encryptedMsg)\n}", "title": "" }, { "docid": "ea094431fdaaa8578683c4c1675d5cf1", "score": "0.5495702", "text": "func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {\n\tGreet(w, \"world\")\n}", "title": "" }, { "docid": "ea094431fdaaa8578683c4c1675d5cf1", "score": "0.5495702", "text": "func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {\n\tGreet(w, \"world\")\n}", "title": "" }, { "docid": "96fee1c5ba2ce4bdf0d76668fc3d8919", "score": "0.54892445", "text": "func (w *Wallet) homeHandler(rw http.ResponseWriter, r *http.Request) {\n\tvar res Response\n\t// log request\n\tlog.Printf(\"httpreq from %v %s\\n\", r.RemoteAddr, r.RequestURI)\n\t// just reply a welcome message\n\tres.Body = \"Hello, this is your multi-blockchain adaptor!\"\n\t// reply\n\trw.Header().Set(\"Content-Type\", \"application/json;charset=utf8\")\n\t_ = json.NewEncoder(rw).Encode(res)\n}", "title": "" }, { "docid": "6e8fd4af56e4edf48f4c9ba8d644fd55", "score": "0.5487995", "text": "func HomeHandler (w http.ResponseWriter, r *http.Request) {\n w.Write([]byte(\"Hello\"))\n}", "title": "" }, { "docid": "74d188e4df9465376209a9590ec4cef3", "score": "0.5471979", "text": "func handshakeHandler(packet *RawPacket, sender *Connection) {\n\tsender.ProtocolVersion = packet.ReadUnsignedVarint()\n\t// omit the following data, we don't need it\n\tpacket.ReadStringMax(255)\n\tpacket.ReadUnsignedShort()\n\t// end\n\tnextState := packet.ReadUnsignedVarint()\n\tswitch nextState {\n\t// Status (server list)\n\tcase HandshakeStatusNextState:\n\t\tresponse := NewResponse()\n\t\tversion := sender.GetServer().GetServerVersion()\n\t\tlist := ServerListPing{\n\t\t\tVer: Version{Name: version.Name, Protocol: version.ProtocolVersion},\n\t\t\tPl: Players{Max: sender.GetServer().GetMaxPlayers(),\n\t\t\t\tOnline: sender.GetServer().GetOnlinePlayersCount()},\n\t\t\tDesc: ChatComponent{Text: sender.GetServer().GetMotd()},\n\t\t\tFav: \"\",\n\t\t}\n\t\tif sender.GetServer().HasFavicon() {\n\t\t\tlist.Fav = sender.GetServer().GetFavicon()\n\t\t}\n\t\tresponse.WriteJSON(list)\n\t\tsender.Write(response.ToRawPacket(HandshakePacketId))\n\t\t// Login (wants to play)\n\tcase HandshakeLoginNextState:\n\t\tsender.ConnectionState = LoginState\n\t\tAssignHandler(sender)\n\t\t// Unknown\n\tdefault:\n\t\tlog.Error(\"Client handshake next state:\", nextState)\n\t}\n}", "title": "" }, { "docid": "0cd018997468f091e09895b5162815b4", "score": "0.5471429", "text": "func handlerPlaintext(r *ghttp.Request) {\n\tr.Response.Write(\"Hello, World!\")\n}", "title": "" }, { "docid": "0977eb56993a3d971de359bcf017a598", "score": "0.54709476", "text": "func (h *Handler) handle(c *Conn, config uint32) {\n\n // Set initial handshake packet.\n c.sendHandshake(HANDSHAKEv10)\n // fmt.Println(c.GetSequenceID())\n\n // Read handshake response packet from client.\n c.readPacket(true)\n // fmt.Println(c.GetSequenceID())\n\n // Send OK packet.\n c.sendOKPacket(\"Welcome!\")\n\n // Switch over to command phase to receive commands from the client.\n // receiveCommand is what 'handles' the commands, so nothing else\n // needs to be done out here.\n for {\n if !c.receiveCommand() { break }\n }\n fmt.Println(\"Closing connection.\")\n c.CloseConnection()\n}", "title": "" }, { "docid": "9177791b939213cab4a0d42090910fc7", "score": "0.5468834", "text": "func gatewayHandlerFactory(reqMethod, targetBaseURL, endpoint string, w http.ResponseWriter, r *http.Request, l *log.Logger) {\n\tvar responseBody *shared.ResponseTemplate\n\tclient := &http.Client{}\n\n\trequest, err := http.NewRequest(reqMethod, targetBaseURL+endpoint, r.Body)\n\tif err != nil {\n\t\tshared.EncodeError(w, err, 500, l)\n\t}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tshared.EncodeError(w, err, 500, l)\n\t}\n\n\terr = json.NewDecoder(response.Body).Decode(&responseBody)\n\tif responseBody.Message == \"fail\" {\n\t\tshared.EncodeError(w, errors.New(responseBody.Error), 400, l)\n\t} else {\n\t\tshared.EncodeJSON(w, responseBody, l)\n\t}\n}", "title": "" }, { "docid": "379b12c34e7878e211ab9079a5c1478d", "score": "0.54552054", "text": "func (s myApi) handleGreeting(code int) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// use code, which is a dependency specific to this handler\n\t\tw.WriteHeader(code)\n\t}\n}", "title": "" }, { "docid": "89a8c8526c6935915b024a6bcdce2fab", "score": "0.5452256", "text": "func hello(conn *golem.Connection, data *Hello) {\n\tfmt.Println(\"Hello from\", data.From, \"to\", data.To)\n\tconn.Emit(\"answer\", &Answer{\"Thanks, client!\"})\n}", "title": "" }, { "docid": "0d4ecd02b779a59d94c7797ac170aa62", "score": "0.5448842", "text": "func GatewayHandler(gw *pb.Action_Gateway) Handler {\n\tconst tag = \"[gateway]\"\n\treturn func(w ResultWriter, r *http.Request) error {\n\t\tvar (\n\t\t\tc = FromContext(r.Context())\n\t\t\ttemplateValueBuilder = NewTemplateValueBuilder()\n\t\t\terr error\n\t\t)\n\t\t// build url\n\t\tvar u string\n\t\tif u, err = func() (string, error) {\n\t\t\tpath, err := templateValueBuilder.Build(gw.GetPath(), pb.NewTemplateSource(r.URL, &r.Header, c.Body()))\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn path.GetS(), nil\n\t\t}(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// build headers and body\n\t\tvar (\n\t\t\theaders map[string]string\n\t\t\tbody map[string]interface{}\n\t\t)\n\t\tif headers, body, err = func() (headers map[string]string, body map[string]interface{}, err error) {\n\t\t\theaders = map[string]string{}\n\t\t\tbody = map[string]interface{}{}\n\t\t\tfromRaw := func() error {\n\t\t\t\tif err := json.Unmarshal(c.Body(), &body); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s unmarshal body %s\", tag, c.Body())\n\t\t\t\t}\n\t\t\t\tfor k, v := range r.Header {\n\t\t\t\t\tif len(v) > 0 {\n\t\t\t\t\t\theaders[k] = v[0]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\twriteTemplate := func() error {\n\t\t\t\tb := NewTemplatesBuilder()\n\t\t\t\tfor i, t := range gw.GetTemplates() {\n\t\t\t\t\tif err := b.Add(t, pb.NewTemplateSource(r.URL, &r.Header, c.Body())); err != nil {\n\t\t\t\t\t\tc.Log().Error(\"%s template %d %s %v\", tag, i, util.JSON(t), err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor k, v := range b.Headers() {\n\t\t\t\t\theaders[k] = v\n\t\t\t\t}\n\t\t\t\tfor k, v := range b.Body() {\n\t\t\t\t\tbody[k] = v\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tswitch gw.GetTemplateType() {\n\t\t\tcase pb.Action_APPEND:\n\t\t\t\tif err = fromRaw(); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif err = writeTemplate(); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\tcase pb.Action_SELECT:\n\t\t\t\tif len(gw.GetTemplates()) == 0 {\n\t\t\t\t\terr = fromRaw()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr = writeTemplate()\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = errors.Newf(errors.UnknownError, \"unknown template type %s\", gw.GetTemplateType())\n\t\t\treturn\n\t\t}(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar requestBody bytes.Buffer\n\t\t{\n\t\t\tb, err := json.Marshal(body)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s marshal body %v\", tag, body)\n\t\t\t}\n\t\t\tif _, err := requestBody.Write(b); err != nil {\n\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s marshal body %v\", tag, body)\n\t\t\t}\n\t\t}\n\t\t// set request timeout\n\t\tctx := r.Context()\n\t\tif gw.GetTimeout() != nil {\n\t\t\tx, err := templateValueBuilder.Build(gw.GetTimeout(), pb.NewTemplateSource(r.URL, &r.Header, c.Body()))\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s build timeout %s\", tag, util.JSON(gw.GetTimeout()))\n\t\t\t}\n\t\t\td, err := pb.NewValueCaster().Int(x)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s type cast timeout %s\", tag, util.JSON(x))\n\t\t\t}\n\t\t\tvar cancel context.CancelFunc\n\t\t\tctx, cancel = context.WithTimeout(r.Context(), time.Duration(d)*time.Millisecond)\n\t\t\tdefer cancel()\n\t\t}\n\t\t// build http request\n\t\tvar req *http.Request\n\t\tif req, err = http.NewRequestWithContext(ctx, gw.GetMethodType().String(), u, &requestBody); err != nil {\n\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s build request\", tag)\n\t\t}\n\t\tfor k, v := range headers {\n\t\t\treq.Header.Set(k, v)\n\t\t}\n\t\t// do http request\n\t\tc.Log().Info(\"%s request to %s\", tag, u)\n\t\tc.Log().Debug(`%s request with headers %s body \"%s\"`, tag, util.JSON(headers), requestBody)\n\t\tvar res *http.Response\n\t\tif res, err = http.DefaultClient.Do(req); err != nil {\n\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s do request\", tag)\n\t\t}\n\t\tdefer res.Body.Close()\n\t\t// build response\n\t\tw.Status().Set(res.StatusCode)\n\t\tresponseBody, err := io.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s read response body\", tag)\n\t\t}\n\t\tc.Log().Debug(`%s got response status %d headers %s body \"%s\"`, tag, res.StatusCode, util.JSON(res.Header), responseBody)\n\t\twriteTemplate := func() error {\n\t\t\tru, err := url.Parse(u)\n\t\t\tif err != nil {\n\t\t\t\terrors.Wrapf(err, errors.Handler, \"%s parse request url %s\", tag, u)\n\t\t\t}\n\t\t\tsrc := pb.NewTemplateSource(ru, &res.Header, responseBody)\n\t\t\tbuilder := NewTemplatesBuilder()\n\t\t\tfor i, t := range gw.GetResponseTemplates() {\n\t\t\t\tif err := builder.Add(t, src); err != nil {\n\t\t\t\t\tc.Log().Error(\"%s response template %d %s %v\", tag, i, util.JSON(t), err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor k, v := range builder.Headers() {\n\t\t\t\tw.Headers().Set(k, v)\n\t\t\t}\n\t\t\tfor k, v := range builder.Body() {\n\t\t\t\tw.Body().Set(k, v)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tswitch gw.GetResponseTemplateType() {\n\t\tcase pb.Action_APPEND:\n\t\t\tif err := WriteResultFromSource(w, pb.NewTemplateSource(nil, &res.Header, responseBody)); err != nil {\n\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s write result %s\", tag, responseBody)\n\t\t\t}\n\t\t\treturn writeTemplate()\n\t\tcase pb.Action_SELECT:\n\t\t\tif len(gw.GetResponseTemplates()) == 0 {\n\t\t\t\tif err := WriteResultFromSource(w, pb.NewTemplateSource(nil, &res.Header, responseBody)); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, errors.Handler, \"%s write result %s\", tag, responseBody)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn writeTemplate()\n\t\t}\n\t\treturn errors.Newf(errors.UnknownError, \"unknown response template type %s\", gw.GetResponseTemplateType())\n\t}\n}", "title": "" }, { "docid": "fd1a78a46af262d7db50c0497ed7b92b", "score": "0.5447562", "text": "func (r *RouterOut) Handler() {\n\t//var msg is (*) pointer of serviceModels.MessageOut struct\n\tfor msg := range r.Connection.OutChan {\n\t\tlog.Printf(\"Action of %s: -> %s\", msg.User.Username, msg.Action)\n\t\tif sliceTCPCon := r.getSliceOfTCP(msg); sliceTCPCon != nil {\n\t\t\ttcp.SendJSON(sliceTCPCon, msg)\n\t\t}\n\t\tif sliceWSCon := r.getSliceOfWS(msg); sliceWSCon != nil {\n\t\t\tws.SendJSON(sliceWSCon, msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92197b15e4d6bfda2dbd6ff090507c2a", "score": "0.542796", "text": "func (m HelloModule) HandleCall(_ context.Context, session *drpc.Session, method drpc.Method, body []byte) ([]byte, error) {\n\tif method != methodGreeting {\n\t\treturn nil, errors.New(\"attempt to call unregistered function\")\n\t}\n\n\thelloMsg := &Hello{}\n\tif err := proto.Unmarshal(body, helloMsg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgreeting := fmt.Sprintf(\"Hello %s\", helloMsg.Name)\n\n\tresponse := HelloResponse{\n\t\tGreeting: greeting,\n\t}\n\n\tresponseBytes, mErr := proto.Marshal(&response)\n\tif mErr != nil {\n\t\treturn nil, mErr\n\t}\n\treturn responseBytes, nil\n}", "title": "" }, { "docid": "59276ad5779f8ad89d81b9136cb17061", "score": "0.54032874", "text": "func (hw *HandlerWrapper) Invoke(ctx context.Context, payload interface{}) (response interface{}, err error) {\n\t// Get the lambda context\n\tlc, _ := lambdacontext.FromContext(ctx)\n\thw.lambdaContext = lc\n\n\t// Get the point tags\n\tinvokedFunctionArn := hw.lambdaContext.InvokedFunctionArn\n\tsplitArn := strings.Split(invokedFunctionArn, \":\")\n\n\t// Expected formats for Lambda ARN are:\n\t// https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"LambdaArn\"] = invokedFunctionArn\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"source\"] = lambdacontext.FunctionName\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"FunctionName\"] = lambdacontext.FunctionName\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"ExecutedVersion\"] = lambdacontext.FunctionVersion\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"Region\"] = splitArn[3]\n\thw.wavefrontAgent.WavefrontConfig.PointTags[\"accountId\"] = splitArn[4]\n\n\tif splitArn[5] == \"function\" {\n\t\thw.wavefrontAgent.WavefrontConfig.PointTags[\"Resource\"] = splitArn[6]\n\t\tif len(splitArn) == 8 {\n\t\t\thw.wavefrontAgent.WavefrontConfig.PointTags[\"Resource\"] += \":\" + splitArn[7]\n\t\t}\n\t} else if splitArn[5] == \"event-source-mappings\" {\n\t\thw.wavefrontAgent.WavefrontConfig.PointTags[\"EventSourceMappings\"] = splitArn[6]\n\t}\n\n\t// Defer a function to send error details to Wavefront in case an error occurs during invocation of the function.\n\tdefer func() {\n\t\tvar deferedErr interface{}\n\t\tif e := recover(); e != nil {\n\t\t\tdeferedErr = e\n\t\t\terrCounter.Increment(1)\n\t\t\thw.wavefrontAgent.sender.SendDeltaCounter(\"aws.lambda.wf.errors\", errCounter.val, lambdacontext.FunctionName, hw.wavefrontAgent.WavefrontConfig.PointTags)\n\t\t} else if err != nil {\n\t\t\terrCounter.Increment(1)\n\t\t\thw.wavefrontAgent.sender.SendDeltaCounter(\"aws.lambda.wf.errors\", errCounter.val, lambdacontext.FunctionName, hw.wavefrontAgent.WavefrontConfig.PointTags)\n\t\t}\n\n\t\thw.wavefrontAgent.sender.Flush()\n\t\thw.wavefrontAgent.sender.Close()\n\n\t\tif deferedErr != nil {\n\t\t\tpanic(deferedErr)\n\t\t}\n\t}()\n\n\t// Start timer\n\tstartTime := time.Now()\n\n\t// Call handler\n\tinvocationsCounter.Increment(1)\n\tresponse, err = hw.wrappedHandler(ctx, payload)\n\tif err != nil {\n\t\terrCounter.Increment(1)\n\t}\n\n\t// Stop timer and report\n\tif coldStart {\n\t\t// Set cold start counter.\n\t\tcsCounter.Increment(1)\n\t\tcoldStart = false\n\t}\n\tduration := time.Since(startTime)\n\n\treportTime := time.Now().Unix()\n\n\thw.wavefrontAgent.counters[\"aws.lambda.wf.coldstarts\"] = csCounter.val\n\thw.wavefrontAgent.counters[\"aws.lambda.wf.invocations\"] = invocationsCounter.val\n\thw.wavefrontAgent.metrics[\"aws.lambda.wf.duration\"] = duration.Seconds() * 1000\n\n\tmemstats := getMemoryStats()\n\thw.wavefrontAgent.metrics[\"aws.lambda.wf.mem.total\"] = memstats.Total\n\thw.wavefrontAgent.metrics[\"aws.lambda.wf.mem.used\"] = memstats.Used\n\thw.wavefrontAgent.metrics[\"aws.lambda.wf.mem.percentage\"] = memstats.UsedPercentage\n\n\t// Send all metrics to Wavefront\n\tfor metricName, metricValue := range hw.wavefrontAgent.metrics {\n\t\terr = hw.wavefrontAgent.sender.SendMetric(metricName, metricValue, reportTime, lambdacontext.FunctionName, hw.wavefrontAgent.WavefrontConfig.PointTags)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR :: %s\", err.Error())\n\t\t}\n\t}\n\n\t// Send all counters to Wavefront\n\tfor metricName, metricValue := range hw.wavefrontAgent.counters {\n\t\terr = hw.wavefrontAgent.sender.SendDeltaCounter(metricName, metricValue, lambdacontext.FunctionName, hw.wavefrontAgent.WavefrontConfig.PointTags)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR :: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn response, err\n}", "title": "" }, { "docid": "da6020e3fc44471865f194e800a94299", "score": "0.5388335", "text": "func (w *grpcWorker) Hello(ctx context.Context, in *Payload) (*Payload, error) {\n\tout := new(Payload)\n\tif string(in.Data) == \"hello\" {\n\t\tout.Data = []byte(\"Oh hello there!\")\n\t} else {\n\t\tout.Data = []byte(\"Hey stranger!\")\n\t}\n\n\treturn out, nil\n}", "title": "" }, { "docid": "3b7979002754b94ac2d4b1209efa86c0", "score": "0.53829265", "text": "func (edge *Server) OnGatewayMessage(conn rony.Conn, streamID int64, data []byte) {\n\tedge.onGatewayMessage(conn, streamID, data)\n}", "title": "" }, { "docid": "f186d549ddb8e0b80c82d18334503a48", "score": "0.537733", "text": "func Handler(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tclient, _ := account.Open(\"wallet.dat\")\n\taccount := client.GetAccount()\n\twallet := client.GetWallet()\n\tcpub := client.Getcpub()\n\taddr, _ := wallet.AddressBytes(*account)\n\ttx := transaction.Transfer{\n\t\tFrom: BytesToHexString(addr),\n\t\tTo: \"173E9CAdA8427ECd33ad728A91E6004Fa3eACf63\",\n\t\tAmount: int64(120000),\n\t}\n\ttx.Sign = BytesToHexString(transaction.Sign(&tx, account, wallet))\n\ttx.Public = BytesToHexString(cpub)\n\tmsg := PingMsg{\n\t\tT: \"TX\",\n\t\tData: BytesToHexString(transaction.Serialize(tx)),\n\t}\n\tdata, err := json.Marshal(msg)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t}\n\ttime.Sleep(1 * time.Second)\n\tlog.Printf(\"[%s]recv data:%v\", time.Now().String(), msg)\n\tlog.Printf(\"[%s]The AquaChain PRC server is running\", time.Now().String())\n\tws.WriteMessage(websocket.BinaryMessage, data)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5bc0f39591865d573a58e5f254727e08", "score": "0.5376699", "text": "func Handler(res http.ResponseWriter, req *http.Request) {\n\ttgbotLogger.Info(\"Receved new request\")\n\t// First, decode the JSON response body\n\tbody := &webhookReqBody{}\n\tif err := json.NewDecoder(req.Body).Decode(body); err != nil {\n\t\t// Log error\n\t\ttgbotLogger.Info(\"Could not decode request body: \",\n\t\t\t\"body\", req.Body,\n\t\t\t\"err\", err)\n\n\t\t// Return smth useful for testing\n\t\tfmt.Fprintf(res, \"%q\", \"Invalid request\")\n\t\treturn\n\t}\n\n\t// Create the request body struct\n\tresponse := sendMessageReqBody{\n\t\tChatID: body.Message.Chat.ID,\n\t\tText: \"Hello, \" + body.Message.Text,\n\t}\n\n\tif err := sayEcho(response); err != nil {\n\t\ttgbotLogger.Info(\"Failed to send reply in func sayEcho: \",\n\t\t\t\"err\", err)\n\n\t\t// Return smth useful for testing\n\t\tfmt.Fprintf(res, \"%q\", \"Failed to send reply\")\n\t\treturn\n\t}\n\n\t// Output the same response for testing\n\tfmt.Fprintf(res, \"Hello, %q\", body.Message.Text)\n\n\t// Log a confirmation message if the message was sent successfully\n\ttgbotLogger.Info(\"Reply sent...\")\n}", "title": "" }, { "docid": "29f36ac6e7ec2a3366a4a383fc0a2200", "score": "0.5373723", "text": "func HealthzHandler(w http.ResponseWriter, r *http.Request) {\n\tutils.JSONResponse(w, r, map[string]string{\"status\": \"OK\"})\n\treturn\n}", "title": "" }, { "docid": "733934561acf8cf6d0ed694a70a88f9c", "score": "0.5370695", "text": "func processHEL(server []UA_Server, connection []UA_Connection, msg []UA_ByteString, offset []uint) UA_StatusCode {\n\tvar helloMessage UA_TcpHelloMessage\n\tvar retval UA_StatusCode = UA_TcpHelloMessage_decodeBinary(msg, offset, (*[100000000]UA_TcpHelloMessage)(unsafe.Pointer(&helloMessage))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\treturn UA_StatusCode(retval)\n\t}\n\t// Parameterize the connection\n\t// zero -> unlimited\n\tconnection[0].remoteConf.maxChunkCount = UA_UInt32(helloMessage.maxChunkCount)\n\t// zero -> unlimited\n\tconnection[0].remoteConf.maxMessageSize = UA_UInt32(helloMessage.maxMessageSize)\n\tconnection[0].remoteConf.protocolVersion = UA_UInt32(helloMessage.protocolVersion)\n\tconnection[0].remoteConf.recvBufferSize = UA_UInt32(helloMessage.receiveBufferSize)\n\tif UA_UInt32(connection[0].localConf.sendBufferSize) > UA_UInt32(helloMessage.receiveBufferSize) {\n\t\tconnection[0].localConf.sendBufferSize = UA_UInt32(helloMessage.receiveBufferSize)\n\t}\n\tconnection[0].remoteConf.sendBufferSize = UA_UInt32(helloMessage.sendBufferSize)\n\tif UA_UInt32(connection[0].localConf.recvBufferSize) > UA_UInt32(helloMessage.sendBufferSize) {\n\t\tconnection[0].localConf.recvBufferSize = UA_UInt32(helloMessage.sendBufferSize)\n\t}\n\tUA_String_deleteMembers((*[100000000]UA_String)(unsafe.Pointer(&helloMessage.endpointUrl))[:])\n\tif UA_UInt32(connection[0].remoteConf.recvBufferSize) == UA_UInt32((uint32_t((uint32((0)))))) {\n\t\tUA_LOG_INFO(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_NETWORK, []byte(\"Connection %i | Remote end indicated a receive buffer size of 0. Not able to send any messages.\\x00\"), UA_Int32(connection[0].sockfd))\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2147614720)))))))\n\t}\n\tconnection[0].state = UA_CONNECTION_ESTABLISHED\n\tvar ackMessage UA_TcpAcknowledgeMessage\n\t// Build acknowledge response\n\tackMessage.protocolVersion = UA_UInt32(connection[0].localConf.protocolVersion)\n\tackMessage.receiveBufferSize = UA_UInt32(connection[0].localConf.recvBufferSize)\n\tackMessage.sendBufferSize = UA_UInt32(connection[0].localConf.sendBufferSize)\n\tackMessage.maxMessageSize = UA_UInt32(connection[0].localConf.maxMessageSize)\n\tackMessage.maxChunkCount = UA_UInt32(connection[0].localConf.maxChunkCount)\n\tvar ackHeader UA_TcpMessageHeader\n\tackHeader.messageTypeAndChunkType = UA_UInt32((uint32_t((uint32((uint32(UA_MESSAGETYPE_ACK + UA_CHUNKTYPE_FINAL)))))))\n\t// ackHeader + ackMessage\n\tackHeader.messageSize = UA_UInt32((uint32_t((uint32((uint32(8 + 20)))))))\n\tvar ack_msg UA_ByteString\n\t// Get the send buffer from the network layer\n\tUA_ByteString_init((*[100000000]UA_ByteString)(unsafe.Pointer(&ack_msg))[:])\n\tretval = connection.getSendBuffer(connection, uint(UA_UInt32(connection[0].localConf.sendBufferSize)), (*[100000000]UA_ByteString)(unsafe.Pointer(&ack_msg))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\treturn UA_StatusCode(retval)\n\t}\n\tvar bufPos []UA_Byte = ack_msg.data\n\tvar bufEnd []UA_Byte = (*[100000000]UA_Byte)(unsafe.Pointer(&ack_msg.data[uint(ack_msg.length)]))[:]\n\t// Encode and send the response\n\tretval = UA_TcpMessageHeader_encodeBinary((*[100000000]UA_TcpMessageHeader)(unsafe.Pointer(&ackHeader))[:], (*[100000000][]UA_Byte)(unsafe.Pointer(&bufPos))[:], (*[100000000][]UA_Byte)(unsafe.Pointer(&bufEnd))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\tconnection.releaseSendBuffer(connection, (*[100000000]UA_ByteString)(unsafe.Pointer(&ack_msg))[:])\n\t\treturn UA_StatusCode(retval)\n\t}\n\tretval = UA_TcpAcknowledgeMessage_encodeBinary((*[100000000]UA_TcpAcknowledgeMessage)(unsafe.Pointer(&ackMessage))[:], (*[100000000][]UA_Byte)(unsafe.Pointer(&bufPos))[:], (*[100000000][]UA_Byte)(unsafe.Pointer(&bufEnd))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\tconnection.releaseSendBuffer(connection, (*[100000000]UA_ByteString)(unsafe.Pointer(&ack_msg))[:])\n\t\treturn UA_StatusCode(retval)\n\t}\n\tack_msg.length = uint((uint32((uint32((uint32_t((UA_UInt32(ackHeader.messageSize)))))))))\n\treturn connection.send(connection, (*[100000000]UA_ByteString)(unsafe.Pointer(&ack_msg))[:])\n}", "title": "" }, { "docid": "462be92a1cdd7411d2d420b84620d7e0", "score": "0.53687", "text": "func \nExampleHandler(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\nfmt.Fprintf(w, \"Hello Packt\")\n\t return\n\n\tlog.Println(\"completed\")\n}", "title": "" }, { "docid": "a0da8700130506acc4776515711dc7e4", "score": "0.5365802", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n \n\t// Writes to the client\n fmt.Fprintf(w, \"Hello World\\n\")\n}", "title": "" }, { "docid": "1edf925b5c3283a1065bf8f55414a71a", "score": "0.5357712", "text": "func (s *Socket) Wshandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := wsupgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Fatalln(fmt.Errorf(\"Failed to set websocket upgrade:\\n%w\", err))\n\t\treturn\n\t}\n\n\tfor {\n\t\tt, msg, err := conn.ReadMessage()\n\t\tvar req request\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\terr = json.Unmarshal(msg, &req)\n\t\tif err != nil {\n\t\t\terrMsg, err := json.Marshal(client.Response{Data: \"Error parsing request\", Status: 500})\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tconn.WriteMessage(t, errMsg)\n\t\t}\n\t\ts.httpClient.Handle(s.buildURL(req), req.Method, req.Headers, req.Body).Then(func(res interface{}) (interface{}, error) {\n\t\t\tresMsg, err := json.Marshal(res.(client.Response))\n\t\t\tconn.WriteMessage(t, resMsg)\n\t\t\treturn resMsg, err\n\t\t}).Catch(func(err error) {\n\t\t\terrMsg, _ := json.Marshal(client.Response{Data: \"Error parsing request\", Status: 500})\n\t\t\tconn.WriteMessage(t, errMsg)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2dacf4b0c308403261cd3027b5738b94", "score": "0.53501236", "text": "func (h *getHello) Handle(params GetHelloParams) middleware.Responder {\n\tlog.Debug(\"Handling request for /hello\")\n\treturn NewGetHelloOK()\n}", "title": "" }, { "docid": "53d1d748c332d4668663d2b43ef97d94", "score": "0.5348392", "text": "func Handler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\tw.Write([]byte(\"Method not supported by libphonenumber-hook\"))\n\t\treturn\n\t}\n\n\thook, err := webhook.New()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tpayload, err := hook.Parse(r, webhook.PushEvent)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tHandleEvent(payload)\n\n\tw.Write([]byte(\"OK\"))\n}", "title": "" }, { "docid": "e23ab5b6388bd62b3c6854ecf6079d9e", "score": "0.5347786", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Hello Gamepedia!\")\n}", "title": "" }, { "docid": "d2896b78e08d222f7a5adc0a920bb2f5", "score": "0.53354746", "text": "func (e *HelloSvc) SayHello(ctx context.Context, req *hello.Request, rsp *hello.Response) error {\n\tlog.Log(\"Received HelloSvc.SayHello request\")\n\n\trsp.Msg = fmt.Sprintf(\"\\\"{\\\"res\\\":\\\"hello %s\\\"}\\\"\", req.Name)\n\n\treturn nil\n}", "title": "" }, { "docid": "a7371d229c21141b86cf2717fdcc0c81", "score": "0.5332248", "text": "func WelcomeHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tnewUUID := uuid.NewV1()\n\tresponse := structures.UUIDMessage{\n\t\tMessage: \"Welcome, where do you want to go today ?\",\n\t\tUUID: newUUID,\n\t}\n\n\tif err := json.NewEncoder(w).Encode(response); err != nil {\n\t\tpretty.Printf(\"fatal error: %s \\n\", err)\n\t\thelpers.ReturnMessage(w, \"\")\n\t\treturn\n\t}\n\n\tif err := datastructures.CreateEntry(newUUID); err != nil {\n\t\tpretty.Printf(\"fatal error: %s \\n\", err)\n\t}\n}", "title": "" }, { "docid": "f72bb79e6aa4edfb0f6233155b39d106", "score": "0.53278923", "text": "func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {\n Greet(w, \"world\")\n}", "title": "" }, { "docid": "d45ec57d39520a2dec6781a3d540cf01", "score": "0.53273237", "text": "func handler(w http.ResponseWriter, r *http.Request) {\n\t// For this case, we will always pipe \"Hello World\" into the response wirter\n\tfmt.Fprintf(w, \"Hellow World\")\n}", "title": "" }, { "docid": "b6fc47d48c3469dda1eb5af6f455085a", "score": "0.53241324", "text": "func handle(ctx context.Context, event events.CloudWatchEvent) (events.APIGatewayProxyResponse, error) {\n\tlog.Println(\"Event body: \", event)\n\tlog.Println(\"context \", ctx)\n\theaders := map[string]string{\"Access-Control-Allow-Origin\": \"*\", \"Access-Control-Allow-Headers\": \"Origin, X-Requested-With, Content-Type, Accept\"}\n\n\tloadEnv();\n\n\tvar body RequestBody\n\tjsonParseError := json.Unmarshal([]byte(event.Detail), &body)\n\tif jsonParseError != nil {\n\t\tlog.Println(jsonParseError)\n\t\treturn events.APIGatewayProxyResponse{500, headers, nil, \"Internal Server Error\", false}, nil\n\t}\n\n\t// TODO use AWS Lambda configuration params (esp. time)\n\tposts, err := getFbGroupPosts(body.GroupIds)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn events.APIGatewayProxyResponse{500, headers, nil, \"Internal Server Error\", false}, nil\n\t}\n\n\tcount, err := publishPostsToTopic(posts)\n\n\tvar (\n\t\tresponse string\n\t\tcode int\n\t)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tresponse = \"Internal Server Error\"\n\t\tcode = 500\n\t} else {\n\t\tresponse = fmt.Sprintf(\"Added %d posts to topic\", count);\n\t\tcode = 200\n\t}\n\n\treturn events.APIGatewayProxyResponse{code, headers, nil,response, false}, nil\n}", "title": "" }, { "docid": "0b04266b73a22b9926c05b7fb99bec7e", "score": "0.53235596", "text": "func (hwp *HelloWorldPlugin) routeHandler(request service.Request) (component.ContentResponse, error) {\n\tcontentResponse := component.NewContentResponse(component.TitleFromString(\"Hello World Title\"))\n\thelloWorld := component.NewText(\"Hello World just some text on the page\")\n\tcontentResponse.Add(helloWorld)\n\treturn *contentResponse, nil\n}", "title": "" }, { "docid": "65360720138b0567a94adc1d00d9dc5e", "score": "0.5317696", "text": "func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tif value, ok := request.QueryStringParameters[\"error\"]; ok {\n\t\tif value == \"notfound\" {\n\t\t\tlog.Println(\"Error: not found\")\n\t\t\treturn createApiGatewayResponse(\"Not found\\n\", http.StatusNotFound)\n\t\t}\n\t\tlog.Println(\"Error: internal server error\")\n\t\treturn createApiGatewayResponse(\"Error\\n\", http.StatusInternalServerError)\n\t}\n\n\tlog.Println(\"operation successful\")\n\treturn createApiGatewayResponse(\"Success\\n\", http.StatusOK)\n}", "title": "" }, { "docid": "645eb029d679010f269f6561a0679078", "score": "0.53163666", "text": "func handler(w http.ResponseWriter, req *http.Request) {\n\tauthReq := strings.Split(req.Header.Get(authorizationHeader), \" \")\n\tif len(authReq) != 2 || authReq[0] != negotiateHeader {\n\t\tw.Header().Set(wwwAuthenticateHeader, negotiateHeader)\n\t\thttp.Error(w, \"Invalid authorization header\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tks := new(kerby.KerbServer)\n\terr := ks.Init(\"\")\n\tif err != nil {\n\t\tlog.Printf(\"KerbServer Init Error: %s\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer ks.Clean()\n\n\terr = ks.Step(authReq[1])\n\tw.Header().Set(wwwAuthenticateHeader, negotiateHeader+\" \"+ks.Response())\n\n\tif err != nil {\n\t\tlog.Printf(\"KerbServer Step Error: %s\", err.Error())\n\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tuser := ks.UserName()\n\tfmt.Fprintf(w, \"Hello, %s\", user)\n}", "title": "" }, { "docid": "c6ae25ff550e34b76c6a770b12441ca3", "score": "0.53147423", "text": "func redirectHandler(ws *websocket.Conn) {\n\n\tdefer ws.Close()\n\n\tvar redirect protocol.Ack\n\n\tif register.NoLeader() {\n\t\tredirect.Status = protocol.StatusNotReady\n\t\tlog.Info(\"We have no established leader now!\")\n\t} else {\n\t\tredirect.Status = protocol.StatusRedirect\n\t\tredirect.Payload = []byte(register.Leader())\n\t}\n\n\tlog.Info(\"Redirect sending payload: %v\", register.Leader())\n\t// don't need to check if disconnect\n\twebsocket.JSON.Send(ws, redirect)\n}", "title": "" }, { "docid": "851b11ba4340d4f0cb714bd54dfd7878", "score": "0.5311088", "text": "func (ws *Sokk)handler(c *net.Conn) {\n\tok := ws.handshake((*c))\n\tif ok {\n\t\tfor {\n\t\t\tbuff := make([]byte, 512)\n\t\t\t_,err :=(*c).Read(buff)\n\t\t\tif(err != nil){\n\t\t\t\tws.Close_wErr(*c)\n\t\t\t\tws.OnError(\"Error reading from client. \",err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar opC = int(0x7F & buff[0])\n\t\t\tif opC == 8 {\n\t\t\t\tws.close_r(*c)\n\t\t\t\tbreak\n\t\t\t}else if opC == 9 {\n\t\t\t\tresponse := make([]byte,2)\n\t\t\t\tresponse[0] = byte(138)\n\t\t\t\t(*c).Write(response)\n\t\t\t}else{ // create wsframe\n\t\t\t\tgo ws.prep_msg(buff)\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}", "title": "" } ]
18574e2e7df85c67364b0a076b92cd8c
Hacked up copy of golang.org/x/tools/imports/sortimports.go. TODO: Replace with go/ast.SortImports or golang.org/x/tools/imports.SortImports whenever it's possible.
[ { "docid": "1fc8663acc4ae94d0d58ab84d7c71fe0", "score": "0.7170833", "text": "func sortImports2(fset *token.FileSet, f *ast.File) (fset2 *token.FileSet, f2 *ast.File) {\n\tsortImports(fset, f)\n\timps := astutil.Imports(fset, f)\n\n\tvar spacesBefore []string // import paths we need spaces before\n\tfor _, impSection := range imps {\n\t\t// Within each block of contiguous imports, see if any\n\t\t// import lines are in different group numbers. If so,\n\t\t// we'll need to put a space between them so it's\n\t\t// compatible with gofmt.\n\t\tlastGroup := -1\n\t\tfor _, importSpec := range impSection {\n\t\t\timportPath, _ := strconv.Unquote(importSpec.Path.Value)\n\t\t\tgroupNum := importGroup(importPath)\n\t\t\tif groupNum != lastGroup && lastGroup != -1 {\n\t\t\t\tspacesBefore = append(spacesBefore, importPath)\n\t\t\t}\n\t\t\tlastGroup = groupNum\n\t\t}\n\t}\n\n\t// So gross. Print out the entire AST, add a space by modifying the bytes, and reparse the whole thing.\n\t// Because I don't see an API that'd let me modify (insert a newline) the FileSet directly.\n\t// We really need a go/ast v2, which is as friendly to parsing/printing/formatting as current, but\n\t// also friendly towards direct AST modification... To avoid all these horrible hacks.\n\tout := []byte(gist5639599.SprintAst(fset, f))\n\tif len(spacesBefore) > 0 {\n\t\tout = addImportSpaces(bytes.NewReader(out), spacesBefore)\n\t}\n\n\tfset2 = token.NewFileSet()\n\tvar err error\n\tf2, err = parser.ParseFile(fset2, \"\", out, parser.ParseComments)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "68a301836053ae1d255f74e6b0fe70ac", "score": "0.81485075", "text": "func SortImports(file *ast.Node) {\n\timports := make([]importElem, 0)\n\tlocal := goodLocalOrNull(*file)\n\tif local != nil {\n\t\t*file = topLevelImport(local, &imports, *openFodder(local))\n\t}\n}", "title": "" }, { "docid": "fe67191707dacdf1434fc953e6f70761", "score": "0.74810725", "text": "func sortImports(fset *token.FileSet, f *ast.File) {\n\tfor i, d := range f.Decls {\n\t\td, ok := d.(*ast.GenDecl)\n\t\tif !ok || d.Tok != token.IMPORT {\n\t\t\t// Not an import declaration, so we're done.\n\t\t\t// Imports are always first.\n\t\t\tbreak\n\t\t}\n\n\t\tif len(d.Specs) == 0 {\n\t\t\t// Empty import block, remove it.\n\t\t\tf.Decls = append(f.Decls[:i], f.Decls[i+1:]...)\n\t\t}\n\n\t\tif !d.Lparen.IsValid() {\n\t\t\t// Not a block: sorted by default.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Identify and sort runs of specs on successive lines.\n\t\ti := 0\n\t\tspecs := d.Specs[:0]\n\t\tfor j, s := range d.Specs {\n\t\t\tif j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line {\n\t\t\t\t// j begins a new run. End this one.\n\t\t\t\tspecs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...)\n\t\t\t\ti = j\n\t\t\t}\n\t\t}\n\t\tspecs = append(specs, sortSpecs(fset, f, d.Specs[i:])...)\n\t\td.Specs = specs\n\n\t\t// Deduping can leave a blank line before the rparen; clean that up.\n\t\tif len(d.Specs) > 0 {\n\t\t\tlastSpec := d.Specs[len(d.Specs)-1]\n\t\t\tlastLine := fset.Position(lastSpec.Pos()).Line\n\t\t\tif rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 {\n\t\t\t\tfset.File(d.Rparen).MergeLine(rParenLine - 1)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ad9e98bec8a6e0b807c58d697c7c1de", "score": "0.72010875", "text": "func (pl PackageList) SortByImport() {\n\tsort.Slice(\n\t\tpl,\n\t\tfunc(i, j int) bool {\n\t\t\t// TODO try and sort major version suffixes?\n\t\t\treturn strings.Compare(pl[i].Path(), pl[j].Path()) < 0\n\t\t},\n\t)\n}", "title": "" }, { "docid": "12f49b5567f091ddea18d11d53a6e112", "score": "0.65388983", "text": "func ExtractImports(src string) string {\n\tvar buf strings.Builder\n\ttype imp struct {\n\t\talias string\n\t\tpath string\n\t}\n\ttoInsert := make(map[string]imp)\n\tfor {\n\t\tmatch := qualifierRE.FindStringSubmatchIndex(src)\n\t\tif match == nil {\n\t\t\tbreak\n\t\t}\n\t\tslice := func(n int) string {\n\t\t\ts := match[2*n]\n\t\t\tif s == -1 {\n\t\t\t\treturn \"\"\n\t\t\t}\n\t\t\treturn src[s:match[2*n+1]]\n\t\t}\n\t\tpath, lastSeg, alias := slice(2), slice(3), slice(4)\n\t\tif alias == \"\" {\n\t\t\talias = lastSeg\n\t\t}\n\t\ttoInsert[path] = imp{alias, path}\n\t\tbuf.WriteString(src[:match[2]])\n\t\tsrc = src[match[3]:]\n\t\tbuf.WriteString(alias)\n\t}\n\tbuf.WriteString(src)\n\n\tif len(toInsert) == 0 {\n\t\treturn buf.String()\n\t}\n\n\tvar list []imp\n\tfor _, v := range toInsert {\n\t\tlist = append(list, v)\n\t}\n\tsort.Slice(list, func(i, j int) bool {\n\t\tif si, sj := isStdPackage(list[i].path), isStdPackage(list[j].path); si != sj {\n\t\t\treturn si\n\t\t}\n\t\treturn list[i].path < list[j].path\n\t})\n\tsrc = buf.String()\n\n\tvar insertOffset int\n\tif loc := packageRE.FindStringIndex(src); loc != nil {\n\t\tinsertOffset = loc[1]\n\t}\n\n\tbuf.Reset()\n\tif insertOffset > 0 {\n\t\tbuf.WriteString(\"\\n\\n\")\n\t}\n\tbuf.WriteString(\"import (\\n\")\n\tvar lastStd bool\n\tfor _, imp := range list {\n\t\t// Separate standard packages from application packages.\n\t\tstd := isStdPackage(imp.path)\n\t\tif !std && lastStd {\n\t\t\tbuf.WriteByte('\\n')\n\t\t}\n\t\tlastStd = std\n\n\t\tbuf.WriteByte('\\t')\n\t\tif imp.path != imp.alias && !strings.HasSuffix(strings.TrimSuffix(imp.path, imp.alias), \"/\") {\n\t\t\tbuf.WriteString(imp.alias)\n\t\t\tbuf.WriteByte(' ')\n\t\t}\n\t\tfmt.Fprintf(&buf, \"\\\"%v\\\"\\n\", imp.path)\n\t}\n\tbuf.WriteString(\")\")\n\tif insertOffset == 0 {\n\t\tbuf.WriteString(\"\\n\\n\")\n\t}\n\timports := buf.String()\n\n\treturn src[:insertOffset] + imports + src[insertOffset:]\n}", "title": "" }, { "docid": "0c657445fa0b230f18dbe2a21273513d", "score": "0.6414381", "text": "func (*Code) Imports() []string { return nil }", "title": "" }, { "docid": "8b52b490cac367fefc9f78f7f76ea019", "score": "0.6268493", "text": "func genImports(src io.Writer, pspecs []PreSpec) {\n\timports := []string{\"tool\"}\n\taliases:=make(map[string]string)\n\taliases[\"tool\"] = \"github.com/josvazg/remotize/tool\"\n\tfor _, pspec:=range pspecs {\n\t\tif decl,ok:=pspec.(*decl); ok {\n\t\t\tfor alias,name:=range decl.detected.aliases {\n\t\t\t\taliases[alias]=name\n\t\t\t}\n\t\t\tfor packname, _ := range decl.imports {\n\t\t\t\timports = addImport(imports, packname)\n\t\t\t}\n\t\t} else if _,ok:=pspec.(*predefined); ok {\n\t\t\tpackname := strings.SplitN(pspec.name(), \".\", 2)[0]\n\t\t\timports = addImport(imports, packname)\n\t\t}\n\t}\n\twriteImports(src, imports, aliases, \"\")\n}", "title": "" }, { "docid": "e34576b0ca0d54456f22280e6d736e5c", "score": "0.6157169", "text": "func regroupImportGroups(group importGroup) importGroup {\n\tstandardImports := make(Imports, 0, len(group.lines))\n\n\tsortedKeys := make([]string, 0)\n\tgroupNames := make(map[string]Imports)\n\tfor _, importLine := range group.lines {\n\t\tmatches := externalImport.FindStringSubmatch(importLine.line)\n\n\t\tif matches != nil && strings.ContainsAny(importLine.line, \".\") {\n\t\t\tgroupName := strings.Join(matches[1:], \"\")\n\t\t\tif groupNames[groupName] == nil {\n\t\t\t\tgroupNames[groupName] = make(Imports, 0, 1)\n\t\t\t\tsortedKeys = append(sortedKeys, groupName)\n\t\t\t}\n\t\t\tgroupNames[groupName] = append(groupNames[groupName], importLine)\n\t\t} else {\n\t\t\tstandardImports = append(standardImports, importLine)\n\t\t}\n\t}\n\tsort.Sort(standardImports)\n\tsort.Strings(sortedKeys)\n\n\tgroup.lines = standardImports\n\tfor _, groupName := range sortedKeys {\n\t\timports := groupNames[groupName]\n\t\tsort.Sort(imports)\n\n\t\tgroup.lines = append(group.lines, importLine{})\n\t\tgroup.lines = append(group.lines, imports...)\n\t}\n\treturn group\n}", "title": "" }, { "docid": "6fc1edb5cf5cec12ce751ff5e9e75f5c", "score": "0.6087027", "text": "func (d *detected) parseImports(ispec *ast.ImportSpec) {\n\tpath := strings.Trim(ispec.Path.Value, \"\\\"\")\n\tname := path2pack(path)\n\tcurrent := path\n\tif ispec.Name != nil {\n\t\tcurrent = ispec.Name.Name\n\t}\n\tprevious, gotit := d.aliases[name]\n\tif gotit && previous != current {\n\t\tpanic(\"Keep import aliases consistent within the package! Expected import \" +\n\t\t\tname + \" \\\"\" + previous + \"\\\" but got import \" + name + \"\\\"\" + current + \"\\\"!\")\n\t} else if !gotit {\n\t\td.aliases[name] = current\n\t}\n}", "title": "" }, { "docid": "3695507c2aab2a0357ca899f9ccbc659", "score": "0.6040495", "text": "func ModSort(list []module.Version) {\n\tsort.Slice(list, func(i, j int) bool {\n\t\tmi := list[i]\n\t\tmj := list[j]\n\t\tif mi.Path != mj.Path {\n\t\t\treturn mi.Path < mj.Path\n\t\t}\n\t\t// To help go.sum formatting, allow version/file.\n\t\t// Compare semver prefix by semver rules,\n\t\t// file by string order.\n\t\tvi := mi.Version\n\t\tvj := mj.Version\n\t\tvar fi, fj string\n\t\tif k := strings.Index(vi, \"/\"); k >= 0 {\n\t\t\tvi, fi = vi[:k], vi[k:]\n\t\t}\n\t\tif k := strings.Index(vj, \"/\"); k >= 0 {\n\t\t\tvj, fj = vj[:k], vj[k:]\n\t\t}\n\t\tif vi != vj {\n\t\t\treturn ModCompare(mi.Path, vi, vj) < 0\n\t\t}\n\t\treturn fi < fj\n\t})\n}", "title": "" }, { "docid": "81524a6e7086e058188edf1e314a01fc", "score": "0.59735626", "text": "func sortgoPkgs2By(in goPkgs2By) goPkgs2By {\n\tout := goPkgs2By{}\n\thas := map[string]Void{}\n\ti := 0\n\tmax := len(in) * len(in)\n\tfor {\n\t\ti++\n\t\tif i > max {\n\t\t\tpanic(\"loop\")\n\t\t}\n\tOUTER:\n\t\tfor _, it := range in {\n\t\t\tif len(out) == len(in) {\n\t\t\t\treturn out\n\t\t\t}\n\t\t\tif _, ex := has[it.Pkg]; ex {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, dep := range it.Imports {\n\t\t\t\tif _, ex := has[dep.Pkg]; !ex {\n\t\t\t\t\tcontinue OUTER\n\t\t\t\t}\n\t\t\t}\n\t\t\tout = append(out, it)\n\t\t\thas[it.Pkg] = Void{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9a3702d0e5bb47f4f55bca68a21aff26", "score": "0.5971681", "text": "func writeImports(w io.Writer, imports []string, aliases map[string]string, skip string) {\n\tsort.Strings(imports)\n\tfmt.Fprintf(w, \"import (\\n\")\n\tfor _, s := range imports {\n\t\tv := aliases[s]\n\t\tif v == skip || v == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif s == v || strings.HasSuffix(v, \"/\"+s) {\n\t\t\tfmt.Fprintf(w, \"\\t\\\"%s\\\"\\n\", v)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"\\t%s \\\"%s\\\"\\n\", s, v)\n\t\t}\n\t}\n\tfmt.Fprintf(w, \")\\n\\n\")\n}", "title": "" }, { "docid": "26c277453b5f094c0101000d4fd6c49c", "score": "0.5921424", "text": "func TestIssue13898(t *testing.T) {\n\ttestenv.MustHaveGoBuild(t)\n\n\tconst src0 = `\npackage main\n\nimport \"go/types\"\n\nfunc main() {\n\tvar info types.Info\n\tfor _, obj := range info.Uses {\n\t\t_ = obj.Pkg()\n\t}\n}\n`\n\t// like src0, but also imports go/importer\n\tconst src1 = `\npackage main\n\nimport (\n\t\"go/types\"\n\t_ \"go/importer\"\n)\n\nfunc main() {\n\tvar info types.Info\n\tfor _, obj := range info.Uses {\n\t\t_ = obj.Pkg()\n\t}\n}\n`\n\t// like src1 but with different import order\n\t// (used to fail with this issue)\n\tconst src2 = `\npackage main\n\nimport (\n\t_ \"go/importer\"\n\t\"go/types\"\n)\n\nfunc main() {\n\tvar info types.Info\n\tfor _, obj := range info.Uses {\n\t\t_ = obj.Pkg()\n\t}\n}\n`\n\tf := func(test, src string) {\n\t\tf := mustParse(t, src)\n\t\tcfg := Config{Importer: importer.Default()}\n\t\tinfo := Info{Uses: make(map[*ast.Ident]Object)}\n\t\t_, err := cfg.Check(\"main\", fset, []*ast.File{f}, &info)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tvar pkg *Package\n\t\tcount := 0\n\t\tfor id, obj := range info.Uses {\n\t\t\tif id.Name == \"Pkg\" {\n\t\t\t\tpkg = obj.Pkg()\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t\tif count != 1 {\n\t\t\tt.Fatalf(\"%s: got %d entries named Pkg; want 1\", test, count)\n\t\t}\n\t\tif pkg.Name() != \"types\" {\n\t\t\tt.Fatalf(\"%s: got %v; want package types\", test, pkg)\n\t\t}\n\t}\n\n\tf(\"src0\", src0)\n\tf(\"src1\", src1)\n\tf(\"src2\", src2)\n}", "title": "" }, { "docid": "fd3e3b1a6dc20de56414e56f45234523", "score": "0.5909312", "text": "func (c *convertor) importSpec(is *ast.ImportSpec) {\n\tfor impOld, impNew := range c.imports {\n\t\tis.Path.Value = strings.Replace(is.Path.Value, impOld, impNew, 1)\n\t}\n}", "title": "" }, { "docid": "596f8f6f0cd8f1635aec89e637e7e7b9", "score": "0.5840536", "text": "func sortModules(modules []models.Module) []models.Module {\n\tfor i, m := range modules {\n\t\tif m.Root {\n\t\t\tmodules = append(modules[:i], modules[i+1:]...)\n\t\t\treturn append([]models.Module{m}, modules...)\n\t\t}\n\t}\n\n\treturn modules\n}", "title": "" }, { "docid": "7e0a7350d23ebbc46e8938fdde024f2c", "score": "0.5832211", "text": "func (td *TemplateData) Sort() {\n\tsort.Strings(td.Imports)\n\tsort.Sort(td.Consts)\n\tsort.Sort(td.Funcs)\n\tsort.Sort(td.Vars)\n\tsort.Sort(td.Types)\n}", "title": "" }, { "docid": "1fcde3e92cdfdd6ba3a403be8ab56780", "score": "0.58283186", "text": "func parseImports(fset *token.FileSet, path string) []string {\n // parse imports first\n f, err := parser.ParseFile(fset, path, nil, parser.ImportsOnly)\n if err != nil {\n panic(err)\n }\n\n imports := make([]string, 0)\n\n for _, decl := range f.Decls {\n gDecl, ok := decl.(*ast.GenDecl)\n if !ok {\n continue\n }\n\n if gDecl.Specs == nil {\n continue\n }\n\n // Loop through specs looking for import statements\n for _, spec := range gDecl.Specs {\n sDecl, ok := spec.(*ast.ImportSpec)\n if !ok {\n continue\n }\n\n if sDecl.Path == nil {\n continue\n }\n\n imports = append(imports, sDecl.Path.Value)\n }\n }\n\n return imports\n}", "title": "" }, { "docid": "b09dd15fc3188ff8d62fb3752b4c4959", "score": "0.57971483", "text": "func addImport(imports []string, packname string) []string {\n\tfor _, imp := range imports {\n\t\tif packname == imp {\n\t\t\treturn imports\n\t\t}\n\t}\n\treturn append(imports, packname)\n}", "title": "" }, { "docid": "42fb4b0de7bc769cc0109cc038089571", "score": "0.57952493", "text": "func (s *fileScope) insertImport(pkg *types.Package) {\n\ti := sort.Search(len(s.imports), func(i int) bool {\n\t\treturn s.imports[i].Path() >= pkg.Path()\n\t})\n\tif i < len(s.imports) && s.imports[i] == pkg {\n\t\treturn\n\t}\n\ts.imports = append(s.imports[:i], append([]*types.Package{pkg}, s.imports[i:]...)...)\n}", "title": "" }, { "docid": "c1efba5aaa838ed29223eb4fe30b2df8", "score": "0.5785034", "text": "func (b *builder) fileImportPaths(filename string) map[string]string {\n\timportPaths := b.importPaths[filename]\n\tif importPaths != nil {\n\t\treturn importPaths\n\t}\n\n\timportPaths = make(map[string]string)\n\tscores := make(map[string]int)\n\tb.importPaths[filename] = importPaths\n\n\tfile := b.ast.Files[filename]\n\tif file == nil {\n\t\t// The code can reference files outside the known set of files\n\t\t// when line comments are used (//line <file>:<line>).\n\t\treturn importPaths\n\t}\n\n\tfor _, i := range file.Imports {\n\t\timportPath, _ := strconv.Unquote(i.Path.Value)\n\t\tif importPath == \"C\" {\n\t\t\tcontinue\n\t\t}\n\t\tif i.Name != nil {\n\t\t\timportPaths[i.Name.Name] = importPath\n\t\t\tscores[i.Name.Name] = 4\n\t\t} else {\n\t\t\t// Use heuristics to find package name from the last segment of\n\t\t\t// the import path.\n\t\t\t_, name := path.Split(importPath)\n\n\t\t\tif scores[name] <= 1 {\n\t\t\t\tif strings.HasPrefix(name, \"go\") {\n\t\t\t\t\tn := name[len(\"go\"):]\n\t\t\t\t\timportPaths[n] = importPath\n\t\t\t\t\tscores[n] = 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif scores[name] <= 2 {\n\t\t\t\tswitch {\n\t\t\t\tcase strings.HasPrefix(name, \"go-\") || strings.HasPrefix(name, \"go.\"):\n\t\t\t\t\tn := name[len(\"go-\"):]\n\t\t\t\t\timportPaths[n] = importPath\n\t\t\t\t\tscores[n] = 2\n\t\t\t\tcase strings.HasSuffix(name, \".go\") || strings.HasSuffix(name, \"-go\"):\n\t\t\t\t\tn := name[:len(name)-len(\".go\")]\n\t\t\t\t\timportPaths[n] = importPath\n\t\t\t\t\tscores[n] = 2\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif scores[name] <= 3 {\n\t\t\t\timportPaths[name] = importPath\n\t\t\t\tscores[name] = 3\n\t\t\t}\n\t\t}\n\t}\n\treturn importPaths\n}", "title": "" }, { "docid": "bf0fcfda02149d15f3622da6cd32d55a", "score": "0.57497305", "text": "func GenerateImports(g *protogen.GeneratedFile, file *protogen.File) {\n\tg.P(\"import (\")\n\tg.P(strconv.Quote(path.Join(\"\", \"fmt\")))\n\tg.P(strconv.Quote(path.Join(\"\", contextPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", timePkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", netPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", netHTTPPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", osPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", osSignalPkgPath)))\n\tg.P(goKitPkg, \" \", strconv.Quote(path.Join(\"\", goKitPkgPath)))\n\tg.P(goKitGRPCPkg, \" \", strconv.Quote(path.Join(\"\", goKitGRPCPkgPath)))\n\tg.P(goKitLogPkg, \" \", strconv.Quote(path.Join(\"\", goKitLogPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", groupLogPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", grpcPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", promHTTPPkgPath)))\n\tg.P(strconv.Quote(path.Join(\"\", syscallPkgPath)))\n\tg.P(\")\")\n\tg.P()\n}", "title": "" }, { "docid": "a7c5bbf130ec9d77a6ffcc1fa3fb261e", "score": "0.5749438", "text": "func prependImport(astfile *ast.File, name string) {\n\tlitvalue := fmt.Sprintf(\"\\\"%s\\\"\", name)\n\t// XXX The newline here at the beginning of the comment is a bit of\n\t// a hack. We'd like to find a way to include this comment\n\t// above or to the right of the added import in the printed\n\t// code. However, the spacing doesn't come out correctly if\n\t// just inserted into the AST as you'd think. So in order for\n\t// the generated code to be idempotent under gofmt, we have to\n\t// insert a newline here at the beginning.\n\tcommentText := fmt.Sprintf(\"\\n// *** IMPORT ADDED BY %s ***\", args.progUpper)\n\tcomment := &ast.CommentGroup{\n\t\tList: []*ast.Comment{\n\t\t\t&ast.Comment{\n\t\t\t\tSlash: token.NoPos,\n\t\t\t\tText: commentText,\n\t\t\t},\n\t\t},\n\t}\n\n\tdecl := &ast.GenDecl{\n\t\tDoc: comment,\n\t\tTokPos: token.NoPos,\n\t\tTok: token.IMPORT,\n\t\tLparen: token.NoPos,\n\t\tSpecs: []ast.Spec{\n\t\t\t&ast.ImportSpec{\n\t\t\t\tDoc: nil,\n\t\t\t\tName: nil,\n\t\t\t\tPath: &ast.BasicLit{\n\t\t\t\t\tValuePos: token.NoPos,\n\t\t\t\t\tKind: token.STRING,\n\t\t\t\t\tValue: litvalue,\n\t\t\t\t},\n\t\t\t\tComment: nil,\n\t\t\t\tEndPos: token.NoPos,\n\t\t\t},\n\t\t},\n\t\tRparen: token.NoPos,\n\t}\n\n\tastfile.Decls = append([]ast.Decl{decl}, astfile.Decls...)\n}", "title": "" }, { "docid": "4c95a26df79083c99985a04808124039", "score": "0.57493603", "text": "func importUsages(pass *analysis.Pass, commentMap ast.CommentMap, f *ast.File, spec *ast.ImportSpec) map[string][]token.Pos {\n\timportRef := spec.Name.String()\n\tswitch importRef {\n\tcase \"<nil>\":\n\t\timportRef, _ = strconv.Unquote(spec.Path.Value)\n\t\t// If the package importRef is not explicitly specified,\n\t\t// make an educated guess. This is not guaranteed to be correct.\n\t\tlastSlash := strings.LastIndex(importRef, \"/\")\n\t\tif lastSlash != -1 {\n\t\t\timportRef = importRef[lastSlash+1:]\n\t\t}\n\tcase \"_\", \".\":\n\t\t// Not sure if this import is used - on the side of caution, report special \"unspecified\" usage.\n\t\treturn map[string][]token.Pos{unspecifiedUsage: nil}\n\t}\n\tusages := map[string][]token.Pos{}\n\n\tast.Inspect(f, func(n ast.Node) bool {\n\t\tsel, ok := n.(*ast.SelectorExpr)\n\t\tif !ok {\n\t\t\treturn true\n\t\t}\n\t\tif isTopName(sel.X, importRef) {\n\t\t\tif usageHasDirective(pass, commentMap, n, sel.Sel.NamePos, ignoreKey) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tusages[sel.Sel.Name] = append(usages[sel.Sel.Name], sel.Sel.NamePos)\n\t\t}\n\t\treturn true\n\t})\n\treturn usages\n}", "title": "" }, { "docid": "9410f8d6e238aaca36a34579a6df909a", "score": "0.574103", "text": "func (t *Template) evalImports(code *string) error {\n\tvar ok bool\n\tok, err := t.hasPackage(*code)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar c string\n\tif !ok {\n\t\tc = \"package main\\n\" + *code\n\t} else {\n\t\tc = *code\n\t}\n\tfset := token.NewFileSet()\n\tf, err := parser.ParseFile(fset, \"\", c, parser.ImportsOnly)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, decl := range f.Decls {\n\t\tgenDecl, ok := decl.(*ast.GenDecl)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif genDecl.Tok != token.IMPORT {\n\t\t\tcontinue\n\t\t}\n\n\t\tsyms := make(importSymbols, 0, len(genDecl.Specs))\n\t\tfor _, spec := range genDecl.Specs {\n\t\t\timportSpec, ok := spec.(*ast.ImportSpec)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsym := Import{\n\t\t\t\tName: \"\",\n\t\t\t\tPath: strings.TrimFunc(importSpec.Path.Value, func(r rune) bool {\n\t\t\t\t\treturn r == '`' || r == '\"'\n\t\t\t\t}),\n\t\t\t}\n\n\t\t\tif importSpec.Name != nil {\n\t\t\t\tsym.Name = importSpec.Name.Name\n\t\t\t}\n\n\t\t\tsyms = append(syms, sym)\n\t\t}\n\n\t\tif err := t.Import(syms...); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpos := int(genDecl.Pos()) - 1\n\t\tend := int(genDecl.End()) - 1\n\t\tc = c[:pos] + strings.Repeat(\" \", end-pos) + c[end:]\n\t}\n\n\t// remove package main\\n\n\t*code = c[f.Name.End():]\n\n\treturn nil\n}", "title": "" }, { "docid": "aa07d7dd6dfb35aef76abe341b2541d1", "score": "0.5714211", "text": "func (r *retag) GenerateImports(file *generator.FileDescriptor) {}", "title": "" }, { "docid": "01c829147b72a005a264acbf4cb06a44", "score": "0.56920373", "text": "func (p *Parser) imports() []ast.Node {\n\n\tnodes := []ast.Node{}\n\n\tfor {\n\t\tif p.cur.Kind != ast.IMPORT {\n\t\t\tbreak\n\t\t}\n\n\t\timp := &ast.Import{\n\t\t\tp.expect(ast.IMPORT),\n\t\t\t&ast.IdentExpr{p.expect(ast.IDENT), nil},\n\t\t\tp.expect(ast.SEMICOLON)}\n\t\tnodes = append(nodes, imp)\n\t}\n\n\treturn nodes\n}", "title": "" }, { "docid": "2390c0d8d3f0b3dcf171baed086715d3", "score": "0.5677749", "text": "func (s *fileScope) rebuildImports() {\n\ts.importNames = make(map[string]string)\n\ts.importsByName = make(map[string]*types.Package)\n\tfor _, pkg := range s.imports {\n\t\ts.maybeRenameImport(pkg)\n\t}\n}", "title": "" }, { "docid": "23dc10eb9ad891cf1d4bbf96837d39ef", "score": "0.56760746", "text": "func poorMansImporter(imports map[string]*ast.Object, path string) (*ast.Object, error) {\n\tpkg := imports[path]\n\tif pkg == nil {\n\t\t// note that strings.LastIndex returns -1 if there is no \"/\"\n\t\tpkg = ast.NewObj(ast.Pkg, path[strings.LastIndex(path, \"/\")+1:])\n\t\tpkg.Data = ast.NewScope(nil) // required by ast.NewPackage for dot-import\n\t\timports[path] = pkg\n\t}\n\treturn pkg, nil\n}", "title": "" }, { "docid": "911afb18dc93e7737cf3686f3c79a31b", "score": "0.56597364", "text": "func (pc *class) Imports() []string {\n\tfor _, field := range pc.Fields {\n\t\tfor _, imp := range field.imports {\n\t\t\t// do not import ourself\n\t\t\tif imp.Name == pc.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpc.addImport(imp.Module, imp.Name)\n\t\t}\n\t}\n\n\treturn commons.MapToSortedStrings(pc.imports)\n}", "title": "" }, { "docid": "303261bdc2bbc07f1dd6c62679f2f1ab", "score": "0.56541413", "text": "func findImports(astfile *ast.File) []string {\n\tr := make([]string, 0, len(astfile.Imports))\n\tfor _, is := range astfile.Imports {\n\t\tif is.Path.Value == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\t// Cut off leading and trailing double quote characters.\n\t\tv := is.Path.Value[1 : len(is.Path.Value)-1]\n\t\tr = append(r, v)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "478c030d716bdba2005a990a18151db1", "score": "0.56476325", "text": "func sortPackages( packages []InitialReturn ) []InitialReturn {\n var tempPackage InitialReturn\n sorted := false;\n\n for !sorted {\n sorted = true;\n for index := 0; index < len(packages) - 1; index++ {\n tCurrent, _ := time.Parse( layoutUS, packages[index].PackageDate )\n tNext, _ := time.Parse( layoutUS, packages[index + 1].PackageDate )\n\n if tCurrent.Before(tNext) {\n tempPackage = packages[index + 1]\n packages[index + 1] = packages[index]\n packages[index] = tempPackage\n sorted = false;\n }\n }\n }\n\n return packages\n}", "title": "" }, { "docid": "f3b3563378ef1f69016e48c6f007ede2", "score": "0.56457484", "text": "func (m Methods) Imports() []string {\n\tvar pkgImports []string\n\tfor _, method := range m {\n\t\tpkgImports = append(pkgImports, method.Imports...)\n\t}\n\tif len(pkgImports) > 0 {\n\t\tpkgImports = uniqueNonEmptyStrings(pkgImports)\n\t\tsort.Strings(pkgImports)\n\t}\n\treturn pkgImports\n}", "title": "" }, { "docid": "861848c5ff15692217ff156808a2dfef", "score": "0.56142616", "text": "func (p *parser) parseImport() {\n}", "title": "" }, { "docid": "b64227274b73c14c99ea7eeb8eb131ed", "score": "0.5605502", "text": "func importGraph(popularPath, importerModule string, importerCount int) []*internal.Module {\n\tm := sample.Module(popularPath, \"v1.2.3\", \"\")\n\tm.Packages()[0].Imports = nil\n\t// Try to improve the ts_rank of the 'foo' search term.\n\tm.Packages()[0].Documentation[0].Synopsis = \"foo\"\n\tm.Units[0].Readme.Contents = \"foo\"\n\tmods := []*internal.Module{m}\n\n\tif importerCount > 0 {\n\t\tm := sample.Module(importerModule, \"v1.2.3\")\n\t\tfor i := 0; i < importerCount; i++ {\n\t\t\tname := fmt.Sprintf(\"importer%d\", i)\n\t\t\tfullPath := importerModule + \"/\" + name\n\t\t\tu := &internal.Unit{\n\t\t\t\tUnitMeta: *sample.UnitMeta(fullPath, importerModule, m.Version, name, true),\n\t\t\t\tDocumentation: []*internal.Documentation{sample.Doc},\n\t\t\t\tImports: []string{popularPath},\n\t\t\t}\n\t\t\tsample.AddUnit(m, u)\n\t\t}\n\t\tmods = append(mods, m)\n\t}\n\treturn mods\n}", "title": "" }, { "docid": "dd718182ec718c9644929ec8f8308fd9", "score": "0.5601468", "text": "func importSpec(f *ast.File, path string, recursive bool) (imports []*ast.ImportSpec) {\n\tfor _, s := range f.Imports {\n\t\timpPath := importPath(s)\n\t\tif impPath == path {\n\t\t\timports = append(imports, s)\n\t\t} else if recursive && strings.HasPrefix(impPath, path+\"/\") {\n\t\t\t// match all subpaths as well, i.e:\n\t\t\t// impPath = golang.org/x/net/context\n\t\t\t// path = golang.org/x/net\n\t\t\t// We add the \"/\" so we don't match packages with dashes, such as\n\t\t\t// `golang.org/x/net-\n\t\t\timports = append(imports, s)\n\t\t}\n\t}\n\treturn imports\n}", "title": "" }, { "docid": "d65a6b4c86957286a6f1b79da6264743", "score": "0.55854774", "text": "func wrapImported(file *descriptor.FileDescriptorProto, g *Generator) (sl []*importDescriptor) {\n\tfor _, index := range file.PublicDependency {\n\t\tdf := g.fileByName(file.Dependency[index])\n\t\tfor _, d := range df.messages {\n\t\t\tif d.GetOptions().GetMapEntry() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsl = append(sl, &importDescriptor{common{file}, d})\n\t\t}\n\t\tfor _, e := range df.enums {\n\t\t\tsl = append(sl, &importDescriptor{common{file}, e})\n\t\t}\n\t\tfor _, ext := range df.extensions {\n\t\t\tsl = append(sl, &importDescriptor{common{file}, ext})\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "66dd7db567ec0981d1b523793d40af1f", "score": "0.5577056", "text": "func (g *generator) collectImports(\n\tprogram *hcl2.Program,\n\tstdImports,\n\tpulumiImports codegen.StringSet) (codegen.StringSet, codegen.StringSet) {\n\t// Accumulate import statements for the various providers\n\tfor _, n := range program.Nodes {\n\t\tif r, isResource := n.(*hcl2.Resource); isResource {\n\t\t\tpkg, mod, name, _ := r.DecomposeToken()\n\t\t\tif pkg == \"pulumi\" && mod == \"providers\" {\n\t\t\t\tpkg = name\n\t\t\t}\n\n\t\t\tvPath, err := g.getVersionPath(program, pkg)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tpulumiImports.Add(g.getPulumiImport(pkg, vPath, mod))\n\t\t}\n\n\t\tdiags := n.VisitExpressions(nil, func(n model.Expression) (model.Expression, hcl.Diagnostics) {\n\t\t\tif call, ok := n.(*model.FunctionCallExpression); ok {\n\t\t\t\tif call.Name == hcl2.Invoke {\n\t\t\t\t\ttokenArg := call.Args[0]\n\t\t\t\t\ttoken := tokenArg.(*model.TemplateExpression).Parts[0].(*model.LiteralValueExpression).Value.AsString()\n\t\t\t\t\ttokenRange := tokenArg.SyntaxNode().Range()\n\t\t\t\t\tpkg, mod, _, diagnostics := hcl2.DecomposeToken(token, tokenRange)\n\n\t\t\t\t\tcontract.Assert(len(diagnostics) == 0)\n\n\t\t\t\t\tvPath, err := g.getVersionPath(program, pkg)\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\tpulumiImports.Add(g.getPulumiImport(pkg, vPath, mod))\n\t\t\t\t} else if call.Name == hcl2.IntrinsicConvert {\n\t\t\t\t\tif schemaType, ok := hcl2.GetSchemaForType(call.Type()); ok {\n\t\t\t\t\t\tswitch schemaType := schemaType.(type) {\n\t\t\t\t\t\tcase *schema.ObjectType:\n\t\t\t\t\t\t\ttoken := schemaType.Token\n\t\t\t\t\t\t\tvar tokenRange hcl.Range\n\t\t\t\t\t\t\tpkg, mod, _, _ := hcl2.DecomposeToken(token, tokenRange)\n\t\t\t\t\t\t\tvPath, err := g.getVersionPath(program, pkg)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpulumiImports.Add(g.getPulumiImport(pkg, vPath, mod))\n\t\t\t\t\t\tcase *schema.ArrayType:\n\t\t\t\t\t\t\ttoken := schemaType.ElementType.(*schema.ObjectType).Token\n\t\t\t\t\t\t\tvar tokenRange hcl.Range\n\t\t\t\t\t\t\tpkg, mod, _, _ := hcl2.DecomposeToken(token, tokenRange)\n\t\t\t\t\t\t\tvPath, err := g.getVersionPath(program, pkg)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpulumiImports.Add(g.getPulumiImport(pkg, vPath, mod))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn n, nil\n\t\t})\n\t\tcontract.Assert(len(diags) == 0)\n\n\t\tdiags = n.VisitExpressions(nil, func(n model.Expression) (model.Expression, hcl.Diagnostics) {\n\t\t\tif call, ok := n.(*model.FunctionCallExpression); ok {\n\t\t\t\tfor _, fnPkg := range g.genFunctionPackages(call) {\n\t\t\t\t\tstdImports.Add(fnPkg)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif t, ok := n.(*model.TemplateExpression); ok {\n\t\t\t\tif len(t.Parts) > 1 {\n\t\t\t\t\tstdImports.Add(\"fmt\")\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn n, nil\n\t\t})\n\t\tcontract.Assert(len(diags) == 0)\n\t}\n\n\treturn stdImports, pulumiImports\n}", "title": "" }, { "docid": "035dc2c684ea7a54823c10f2108c312c", "score": "0.5550186", "text": "func (r *Resolver) imports(pkg string, testDeps, addTest bool) ([]string, error) {\n\n\tif r.Config.HasIgnore(pkg) {\n\t\tmsg.Debug(\"Ignoring %s\", pkg)\n\t\treturn []string{}, nil\n\t}\n\n\t// If this pkg is marked seen, we don't scan it again.\n\tif _, ok := r.seen[pkg]; ok {\n\t\tmsg.Debug(\"Already saw %s\", pkg)\n\t\treturn []string{}, nil\n\t}\n\n\t// FIXME: On error this should try to NotFound to the dependency, and then import\n\t// it again.\n\tvar imps []string\n\tp, err := r.BuildContext.ImportDir(pkg, 0)\n\tif err != nil && strings.HasPrefix(err.Error(), \"found packages \") {\n\t\t// If we got here it's because a package and multiple packages\n\t\t// declared. This is often because of an example with a package\n\t\t// or main but +build ignore as a build tag. In that case we\n\t\t// try to brute force the packages with a slower scan.\n\t\tif testDeps {\n\t\t\t_, imps, err = IterativeScan(r.Handler.PkgPath(pkg))\n\t\t} else {\n\t\t\timps, _, err = IterativeScan(r.Handler.PkgPath(pkg))\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\t} else if err != nil {\n\t\treturn []string{}, err\n\t} else {\n\t\tif testDeps {\n\t\t\timps = dedupeStrings(p.TestImports, p.XTestImports)\n\t\t} else {\n\t\t\timps = p.Imports\n\t\t}\n\t}\n\n\t// It is okay to scan a package more than once. In some cases, this is\n\t// desirable because the package can change between scans (e.g. as a result\n\t// of a failed scan resolving the situation).\n\tmsg.Debug(\"=> Scanning %s (%s)\", p.ImportPath, pkg)\n\tr.seen[pkg] = true\n\n\t// Optimization: If it's in GOROOT, it has no imports worth scanning.\n\tif p.Goroot {\n\t\treturn []string{}, nil\n\t}\n\n\t// We are only looking for dependencies in vendor. No root, cgo, etc.\n\tbuf := []string{}\n\tfor _, imp := range imps {\n\t\tif r.Config.HasIgnore(imp) {\n\t\t\tmsg.Debug(\"Ignoring %s\", imp)\n\t\t\tcontinue\n\t\t}\n\t\tinfo := r.FindPkg(imp)\n\t\tswitch info.Loc {\n\t\tcase LocUnknown:\n\t\t\t// Do we resolve here?\n\t\t\tfound, err := r.Handler.NotFound(imp, addTest)\n\t\t\tif err != nil {\n\t\t\t\tmsg.Err(\"Failed to fetch %s: %s\", imp, err)\n\t\t\t}\n\t\t\tif found {\n\t\t\t\tbuf = append(buf, filepath.Join(r.VendorDir, filepath.FromSlash(imp)))\n\t\t\t\tr.VersionHandler.SetVersion(imp, addTest)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr.seen[info.Path] = true\n\t\tcase LocVendor:\n\t\t\t//msg.Debug(\"Vendored: %s\", imp)\n\t\t\tbuf = append(buf, info.Path)\n\t\t\tif err := r.Handler.InVendor(imp, addTest); err == nil {\n\t\t\t\tr.VersionHandler.SetVersion(imp, addTest)\n\t\t\t} else {\n\t\t\t\tmsg.Warn(\"Error updating %s: %s\", imp, err)\n\t\t\t}\n\t\tcase LocGopath:\n\t\t\tfound, err := r.Handler.OnGopath(imp, addTest)\n\t\t\tif err != nil {\n\t\t\t\tmsg.Err(\"Failed to fetch %s: %s\", imp, err)\n\t\t\t}\n\t\t\t// If the Handler marks this as found, we drop it into the buffer\n\t\t\t// for subsequent processing. Otherwise, we assume that we're\n\t\t\t// in a less-than-perfect, but functional, situation.\n\t\t\tif found {\n\t\t\t\tbuf = append(buf, filepath.Join(r.VendorDir, filepath.FromSlash(imp)))\n\t\t\t\tr.VersionHandler.SetVersion(imp, addTest)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmsg.Warn(\"Package %s is on GOPATH, but not vendored. Ignoring.\", imp)\n\t\t\tr.seen[info.Path] = true\n\t\tdefault:\n\t\t\t// Local packages are an odd case. CGO cannot be scanned.\n\t\t\tmsg.Debug(\"===> Skipping %s\", imp)\n\t\t}\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "aa42de8fd154bd5d39dbc6b237526ae3", "score": "0.5542658", "text": "func DefaultPackageImports(env golang.Environ) ([]string, error) {\n\t// Find u-root directory.\n\turootDir, err := env.FindPackageDir(\"github.com/u-root/u-root\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Couldn't find u-root src directory: %v\", err)\n\t}\n\n\tmatches, err := filepath.Glob(filepath.Join(urootDir, \"cmds/*\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't find u-root cmds: %v\", err)\n\t}\n\tpkgs := make([]string, 0, len(matches))\n\tfor _, match := range matches {\n\t\timportPath, err := env.FindPackageByPath(match)\n\t\tif err == nil {\n\t\t\tpkgs = append(pkgs, importPath)\n\t\t}\n\t}\n\treturn pkgs, nil\n}", "title": "" }, { "docid": "c0310a49a5ffa5e0b5be02cceab4df92", "score": "0.55225736", "text": "func package_import_free(imp []package_import_t) []package_t {\n\tif len(imp) == 0 {\n\t\treturn nil\n\t}\n\tif (int64(uintptr(unsafe.Pointer(&imp[0].alias[0])))/int64(1) - int64(uintptr(unsafe.Pointer(&imp[0].filename[0])))/int64(1)) == 0 {\n\t\t_ = imp[0].alias\n\t} else {\n\t\t_ = imp[0].alias\n\t\t_ = imp[0].filename\n\t}\n\tvar pkg []package_t = imp[0].pkg\n\t_ = imp\n\treturn pkg\n}", "title": "" }, { "docid": "b24926d1ab8754e65b9bf55ca3d3d916", "score": "0.5496796", "text": "func (v *versionify) sort() {\n\tif v.reverse {\n\t\tsort.Sort(sort.Reverse(v.versions))\n\t} else {\n\t\tsort.Sort(v.versions)\n\t}\n}", "title": "" }, { "docid": "3d8b8666a21c8f20162b7ee192c4377f", "score": "0.54697585", "text": "func package_import_passthrough(parent []package_t, filename []byte, error_ [][]byte) []package_import_t {\n\tvar imp []package_import_t = package_import_add(filename, filename, parent, error_)\n\tif len(error_[0]) != 0 {\n\t\treturn nil\n\t}\n\tif len(imp) == 0 || len(imp[0].pkg) == 0 {\n\t\tasprintf(error_, []byte(\"Could not import '%s'\\x00\"), filename)\n\t\treturn nil\n\t}\n\t{\n\t\tvar val interface{}\n\t\t{\n\t\t\tvar k khiter_t = khiter_t((khint_t(0)))\n\t\t\tfor ; k < khiter_t(((imp[0].pkg[0].exports)[0].n_buckets)); k++ {\n\t\t\t\tif !noarch.Not((imp[0].pkg[0].exports)[0].flags[k>>uint64(4)] >> uint64(uint32((khint32_t((khint_t((k & khiter_t((khint_t((khint32_t((uint32(15))))))) << uint64(1)))))))) & khint32_t((3))) {\n\t\t\t\t\t// Warning (*ast.MemberExpr): /home/istvan/packages/downloaded/cbuild/package/import.c:80 :cannot determine type for LHS '[hash_t * hash_t *]', will use 'void *' for all fields. Is lvalue = true. n.Name = n_buckets\n\t\t\t\t\t// Warning (*ast.MemberExpr): /home/istvan/packages/downloaded/cbuild/package/import.c:80 :cannot determine type for LHS '[hash_t * hash_t *]', will use 'void *' for all fields. Is lvalue = true. n.Name = flags\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Warning (*ast.MemberExpr): /home/istvan/packages/downloaded/cbuild/package/import.c:80 :cannot determine type for LHS '[hash_t * hash_t *]', will use 'void *' for all fields. Is lvalue = true. n.Name = vals\n\t\t\t\tval = (imp[0].pkg[0].exports)[0].vals[k]\n\t\t\t\t{\n\t\t\t\t\tvar exp []package_export_t = val.([]package_export_t)\n\t\t\t\t\thash_set(parent[0].exports, exp[0].export_name, exp)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tpackage_export_export_headers(parent, imp[0].pkg)\n\treturn imp\n}", "title": "" }, { "docid": "8867c0bd9bb32b0f916fb83ba2663580", "score": "0.5461027", "text": "func (f *File) ImportedSymbols() ([]string, error)", "title": "" }, { "docid": "9012e60decb4153f0a55b1f4c4d02618", "score": "0.54544497", "text": "func main() {\n\tlog.SetFlags(0)\n\tfatal := log.Fatalln\n\n\tflag.Usage = Usage\n\tflag.Parse()\n\targs := flag.Args()\n\tif len(args) == 0 || len(args) > 2 {\n\t\tUsage()\n\t\tos.Exit(2)\n\t}\n\n\tre, err := regexp.Compile(args[0])\n\tif err != nil {\n\t\tfatal(err)\n\t}\n\tif *l {\n\t\tre.Longest()\n\t}\n\n\tvar m goutil.StringMatcher = re\n\tif *v {\n\t\tm = negmatcher{re}\n\t}\n\n\ttree := false\n\timp := \".\"\n\tif len(args) > 1 {\n\t\timp = args[1]\n\t\tif d, f := filepath.Split(imp); f == \"...\" {\n\t\t\ttree = true\n\t\t\timp = d\n\t\t}\n\t}\n\n\tvar pkgs goutil.Packages\n\tswitch {\n\tcase tree && *r:\n\t\tpkgs, err := goutil.ImportTree(nil, imp)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tvar ps goutil.Packages\n\t\tfor _, p := range pkgs {\n\t\t\tt, err := p.ImportDeps()\n\t\t\tif err != nil {\n\t\t\t\tfatal(err)\n\t\t\t}\n\t\t\tps = append(ps, t...)\n\t\t}\n\t\tpkgs = append(pkgs, ps...).Uniq()\n\tcase tree:\n\t\tpkgs, err = goutil.ImportTree(nil, imp)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\tcase *r:\n\t\tpkgs, err = goutil.ImportRec(nil, imp)\n\t\tif err != nil {\n\t\t\tfatal(err)\n\t\t}\n\tdefault:\n\t\tp, err := goutil.Import(nil, imp)\n\t\tif err != nil {\n\t\t\tfatal(err)\n\t\t}\n\t\tpkgs = goutil.Packages{p}\n\t}\n\n\tif *nostdlib {\n\t\tpkgs = pkgs.NoStdlib()\n\t}\n\n\terr = pkgs.Parse(false)\n\tif err != nil {\n\t\tfatal(err)\n\t}\n\n\tmultiples := len(pkgs) > 1\n\tfor _, pkg := range pkgs {\n\t\tfor _, d := range pkg.Decls().SplitSpecs().Named(m) {\n\t\t\tprint(multiples, pkg, d)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c779dbfaf56070d3f15827600113cdf", "score": "0.5453341", "text": "func (m Manifest) Sort() { sort.Sort(m) }", "title": "" }, { "docid": "53da6cc92f5788ffb02eb1fb66eab44d", "score": "0.54361475", "text": "func Import(c *gen.Gen, name string) string {\n\tptr := name[0] == '*'\n\tif ptr {\n\t\tname = name[1:]\n\t}\n\tidx := strings.LastIndexByte(name, '.')\n\tvar ns string\n\tif idx > -1 {\n\t\tns = name[:idx]\n\t}\n\tif ns != \"\" && c != nil {\n\t\tif path, ok := c.Pkgs[ns]; ok {\n\t\t\tns = path\n\t\t}\n\t\tif ns != c.Pkg {\n\t\t\tc.Imports.Add(ns)\n\t\t} else {\n\t\t\tname = name[idx+1:]\n\t\t}\n\t}\n\tif idx := strings.LastIndexByte(name, '/'); idx != -1 {\n\t\tname = name[idx+1:]\n\t}\n\tif ptr {\n\t\tname = \"*\" + name\n\t}\n\treturn name\n}", "title": "" }, { "docid": "3b37dfaf1b715aab0e6abfdf44d3967c", "score": "0.54226446", "text": "func (p *parser) parseImportKind() {\n}", "title": "" }, { "docid": "100342f2b178f71b49c8201076bd73d4", "score": "0.5417778", "text": "func parseImport(line string, fileContext *FileContext, buildContext *BuildContext) {\n\n\tvar dependentContext *FileContext\n\tvar matches []string\n\n\t// imports can happen in any number of wacky forms\n\t// go through from most-to-least specific and try to determine which form is being used,\n\t// and how to modify the contexts\n\tmatches = wildImportRegex.FindStringSubmatch(line)\n\tif len(matches) > 0 {\n\t\tfmt.Println(\"Wild import statement detected. Ignoring.\")\n\t\treturn\n\t}\n\n\tmatches = singleAliasedImportRegex.FindStringSubmatch(line)\n\tif len(matches) > 0 {\n\n\t\tdependentContext = parseAndImport(matches[1], fileContext, buildContext)\n\t\tif dependentContext == nil {\n\t\t\treturn\n\t\t}\n\n\t\tfileContext.AliasCall(dependentContext, matches[2], matches[3])\n\t\treturn\n\t}\n\n\tmatches = singleImportRegex.FindStringSubmatch(line)\n\tif len(matches) > 0 {\n\n\t\tdependentContext = parseAndImport(matches[1], fileContext, buildContext)\n\t\tif dependentContext == nil {\n\t\t\treturn\n\t\t}\n\n\t\tfileContext.UnaliasedCall(dependentContext, matches[2])\n\t\treturn\n\t}\n\n\tmatches = aliasedImportRegex.FindStringSubmatch(line)\n\tif len(matches) > 0 {\n\n\t\tdependentContext = parseAndImport(matches[1], fileContext, buildContext)\n\t\tif dependentContext == nil {\n\t\t\treturn\n\t\t}\n\n\t\tfileContext.AliasContext(dependentContext, matches[2])\n\t\treturn\n\t}\n\n\tmatches = standardImportRegex.FindStringSubmatch(line)\n\tif len(matches) > 0 {\n\n\t\tparseAndImport(matches[1], fileContext, buildContext)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a84537ad6fdefcd35c888222948b2239", "score": "0.5414215", "text": "func (file *FileDefinition) generateImports() map[PackageImport]struct{} {\n\tvar requiredImports = make(map[PackageImport]struct{}) // fake set type\n\n\tfor _, s := range file.definitions {\n\t\tfor _, requiredImport := range s.RequiredImports() {\n\t\t\t// no need to import the current package\n\t\t\tif !requiredImport.Equals(file.packageReference) {\n\t\t\t\tnewImport := NewPackageImport(requiredImport)\n\n\t\t\t\tif requiredImport.PackagePath() == MetaV1PackageReference.PackagePath() {\n\t\t\t\t\tnewImport = newImport.WithName(\"metav1\")\n\t\t\t\t}\n\n\t\t\t\trequiredImports[newImport] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: Do something about conflicting imports\n\n\t// Determine if there are any conflicting imports -- these are imports with the same \"name\"\n\t// but a different package path\n\tfor imp := range requiredImports {\n\t\tfor otherImp := range requiredImports {\n\t\t\tif !imp.Equals(otherImp) && imp.PackageName() == otherImp.PackageName() {\n\t\t\t\tklog.Warningf(\n\t\t\t\t\t\"File %v: import %v (named %v) and import %v (named %v) conflict\",\n\t\t\t\t\tfile.packageReference.PackagePath(),\n\t\t\t\t\timp.PackageReference.PackagePath(),\n\t\t\t\t\timp.PackageName(),\n\t\t\t\t\totherImp.PackageReference.PackagePath(),\n\t\t\t\t\totherImp.PackageName())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn requiredImports\n}", "title": "" }, { "docid": "486fc7eac49ab18707dffc753600f2b1", "score": "0.5397948", "text": "func imports(ctx *build.Context, ip string) (pkgs goutil.Packages, err error) {\n\tpkg, err := goutil.Import(ctx, ip)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append(pkgs, pkg), nil\n}", "title": "" }, { "docid": "ff211d11d1f142ff1d81bd2072a09c40", "score": "0.5396939", "text": "func removeUnusedImportsInFile(path string) {\n\timports := map[string]string{\n\t\t\"windows.\": `\"golang.org/x/sys/windows\"`,\n\t\t\"syscall.\": `\"syscall\"`,\n\t\t\"unsafe.\": `\"unsafe\"`,\n\t}\n\tchanged := false\n\tlines, err := readFileAsLines(path)\n\tmust(err)\n\tfor importUse, importPath := range imports {\n\t\tnBefore := len(lines)\n\t\tlines = removeUnusedImportsInLines(lines, importUse, importPath)\n\t\tchanged = changed || (nBefore != len(lines))\n\t}\n\tif !changed {\n\t\treturn\n\t}\n\td := strings.Join(lines, \"\\n\")\n\terr = ioutil.WriteFile(path, []byte(d), 0644)\n\tmust(err)\n}", "title": "" }, { "docid": "dfe62c108fa4222a0c558ce5d850963c", "score": "0.5396161", "text": "func (ib *ImportBag) ListAsImportSpec() []*ast.ImportSpec {\n\tretval := make([]*ast.ImportSpec, 0, len(ib.bySpec)+len(ib.localIdent)+len(ib.blankIdent))\n\n\tgetLit := func(pkgPath PackagePath) *ast.BasicLit {\n\t\treturn &ast.BasicLit{\n\t\t\tKind: token.STRING,\n\t\t\tValue: fmt.Sprintf(\"%q\", string(pkgPath)),\n\t\t}\n\t}\n\n\tfor k, v := range ib.bySpec {\n\t\tvar name *ast.Ident\n\n\t\tif path.Base(string(v)) != string(k) {\n\t\t\tname = ast.NewIdent(string(k))\n\t\t}\n\n\t\tretval = append(retval, &ast.ImportSpec{\n\t\t\tName: name,\n\t\t\tPath: getLit(v),\n\t\t})\n\t}\n\n\tfor s := range ib.localIdent {\n\t\tretval = append(retval, &ast.ImportSpec{\n\t\t\tName: ast.NewIdent(\".\"),\n\t\t\tPath: getLit(s),\n\t\t})\n\t}\n\n\tfor s := range ib.blankIdent {\n\t\tretval = append(retval, &ast.ImportSpec{\n\t\t\tName: ast.NewIdent(\"_\"),\n\t\t\tPath: getLit(s),\n\t\t})\n\t}\n\n\tsort.Slice(retval, func(i, j int) bool {\n\t\treturn strings.Compare(retval[i].Path.Value, retval[j].Path.Value) < 0\n\t})\n\n\treturn retval\n}", "title": "" }, { "docid": "b5f5f13213709a9faed67c255b98042f", "score": "0.53859615", "text": "func importPrefix(src []byte) (string, error) {\n\tfset := token.NewFileSet()\n\t// do as little parsing as possible\n\tf, err := parser.ParseFile(fset, \"\", src, parser.ImportsOnly|parser.ParseComments)\n\tif err != nil { // This can happen if 'package' is misspelled\n\t\treturn \"\", fmt.Errorf(\"importPrefix: failed to parse: %s\", err)\n\t}\n\ttok := fset.File(f.Pos())\n\tvar importEnd int\n\tfor _, d := range f.Decls {\n\t\tif x, ok := d.(*ast.GenDecl); ok && x.Tok == token.IMPORT {\n\t\t\tif e, err := safetoken.Offset(tok, d.End()); err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"importPrefix: %s\", err)\n\t\t\t} else if e > importEnd {\n\t\t\t\timportEnd = e\n\t\t\t}\n\t\t}\n\t}\n\n\tmaybeAdjustToLineEnd := func(pos token.Pos, isCommentNode bool) int {\n\t\toffset, err := safetoken.Offset(tok, pos)\n\t\tif err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\t// Don't go past the end of the file.\n\t\tif offset > len(src) {\n\t\t\toffset = len(src)\n\t\t}\n\t\t// The go/ast package does not account for different line endings, and\n\t\t// specifically, in the text of a comment, it will strip out \\r\\n line\n\t\t// endings in favor of \\n. To account for these differences, we try to\n\t\t// return a position on the next line whenever possible.\n\t\tswitch line := safetoken.Line(tok, tok.Pos(offset)); {\n\t\tcase line < tok.LineCount():\n\t\t\tnextLineOffset, err := safetoken.Offset(tok, tok.LineStart(line+1))\n\t\t\tif err != nil {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t\t// If we found a position that is at the end of a line, move the\n\t\t\t// offset to the start of the next line.\n\t\t\tif offset+1 == nextLineOffset {\n\t\t\t\toffset = nextLineOffset\n\t\t\t}\n\t\tcase isCommentNode, offset+1 == tok.Size():\n\t\t\t// If the last line of the file is a comment, or we are at the end\n\t\t\t// of the file, the prefix is the entire file.\n\t\t\toffset = len(src)\n\t\t}\n\t\treturn offset\n\t}\n\tif importEnd == 0 {\n\t\tpkgEnd := f.Name.End()\n\t\timportEnd = maybeAdjustToLineEnd(pkgEnd, false)\n\t}\n\tfor _, cgroup := range f.Comments {\n\t\tfor _, c := range cgroup.List {\n\t\t\tif end, err := safetoken.Offset(tok, c.End()); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t} else if end > importEnd {\n\t\t\t\tstartLine := safetoken.Position(tok, c.Pos()).Line\n\t\t\t\tendLine := safetoken.Position(tok, c.End()).Line\n\n\t\t\t\t// Work around golang/go#41197 by checking if the comment might\n\t\t\t\t// contain \"\\r\", and if so, find the actual end position of the\n\t\t\t\t// comment by scanning the content of the file.\n\t\t\t\tstartOffset, err := safetoken.Offset(tok, c.Pos())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tif startLine != endLine && bytes.Contains(src[startOffset:], []byte(\"\\r\")) {\n\t\t\t\t\tif commentEnd := scanForCommentEnd(src[startOffset:]); commentEnd > 0 {\n\t\t\t\t\t\tend = startOffset + commentEnd\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\timportEnd = maybeAdjustToLineEnd(tok.Pos(end), true)\n\t\t\t}\n\t\t}\n\t}\n\tif importEnd > len(src) {\n\t\timportEnd = len(src)\n\t}\n\treturn string(src[:importEnd]), nil\n}", "title": "" }, { "docid": "2ac462f85f26563a89c39b3837097f47", "score": "0.53800386", "text": "func addImports(name string) {\n\tcmd := exec.Command(\"goimports\", name)\n\tb, err := cmd.Output()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\terr = ioutil.WriteFile(name, b, 0644)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n}", "title": "" }, { "docid": "cc33459792284f5171983ba985ecb1b6", "score": "0.5376616", "text": "func (p *Package) Imports() []*Package {\n\tpkgs := make([]*Package, 0, len(p.Package.Imports))\n\tfor _, i := range p.Package.Imports {\n\t\tif p.shouldignore(i) {\n\t\t\tcontinue\n\t\t}\n\n\t\tpkg, ok := p.pkgs[i]\n\t\tif !ok {\n\t\t\tpanic(\"could not locate package: \" + i)\n\t\t}\n\t\tpkgs = append(pkgs, pkg)\n\t}\n\treturn pkgs\n}", "title": "" }, { "docid": "65cf157aaa046cffb8ffc6b4e8c72c8a", "score": "0.53707474", "text": "func (v *varNameLen) identsAndImports(pass *analysis.Pass) ([]*ast.Ident, []*ast.Ident, []*ast.Ident, []*ast.Ident, //nolint:gocognit,cyclop // this is complex stuff\n\t[]*ast.Ident, []importDeclaration, []*ast.TypeSwitchStmt) {\n\tinspector := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) //nolint:forcetypeassert // inspect.Analyzer always returns *inspector.Inspector\n\n\tfilter := []ast.Node{\n\t\t(*ast.ImportSpec)(nil),\n\t\t(*ast.FuncDecl)(nil),\n\t\t(*ast.FuncLit)(nil),\n\t\t(*ast.CompositeLit)(nil),\n\t\t(*ast.TypeSwitchStmt)(nil),\n\t\t(*ast.Ident)(nil),\n\t}\n\n\tassignIdents := []*ast.Ident{}\n\tvalueSpecIdents := []*ast.Ident{}\n\tparamIdents := []*ast.Ident{}\n\treturnIdents := []*ast.Ident{}\n\ttypeParamIdents := []*ast.Ident{}\n\timports := []importDeclaration{}\n\tswitches := []*ast.TypeSwitchStmt{}\n\n\tfuncs := []*ast.FuncDecl{}\n\tmethods := []*ast.FuncDecl{}\n\tfuncLits := []*ast.FuncLit{}\n\tcompositeLits := []*ast.CompositeLit{}\n\n\tinspector.Preorder(filter, func(node ast.Node) {\n\t\tswitch node2 := node.(type) {\n\t\tcase *ast.ImportSpec:\n\t\t\tdecl, ok := importSpecToDecl(node2, pass.Pkg.Imports())\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\timports = append(imports, decl)\n\n\t\tcase *ast.FuncDecl:\n\t\t\tfuncs = append(funcs, node2)\n\n\t\t\tif node2.Recv == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmethods = append(methods, node2)\n\n\t\tcase *ast.FuncLit:\n\t\t\tfuncLits = append(funcLits, node2)\n\n\t\tcase *ast.CompositeLit:\n\t\t\tcompositeLits = append(compositeLits, node2)\n\n\t\tcase *ast.TypeSwitchStmt:\n\t\t\tswitches = append(switches, node2)\n\n\t\tcase *ast.Ident:\n\t\t\tif node2.Obj == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif isCompositeLitKey(node2, compositeLits) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tswitch objDecl := node2.Obj.Decl.(type) {\n\t\t\tcase *ast.AssignStmt:\n\t\t\t\tassignIdents = append(assignIdents, node2)\n\n\t\t\tcase *ast.ValueSpec:\n\t\t\t\tvalueSpecIdents = append(valueSpecIdents, node2)\n\n\t\t\tcase *ast.Field:\n\t\t\t\tswitch {\n\t\t\t\tcase isReceiver(objDecl, methods):\n\t\t\t\t\tif !v.checkReceiver {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tparamIdents = append(paramIdents, node2)\n\n\t\t\t\tcase isReturn(objDecl, funcs, funcLits):\n\t\t\t\t\tif !v.checkReturn {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\treturnIdents = append(returnIdents, node2)\n\n\t\t\t\tcase isTypeParam(objDecl, funcs, funcLits):\n\t\t\t\t\tif !v.checkTypeParameters {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\ttypeParamIdents = append(typeParamIdents, node2)\n\n\t\t\t\tcase isParam(objDecl, funcs, funcLits, methods):\n\t\t\t\t\tparamIdents = append(paramIdents, node2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\timports = append(imports, importDeclaration{\n\t\tpath: pass.Pkg.Path(),\n\t\tself: true,\n\t})\n\n\tsort.Slice(imports, func(a, b int) bool {\n\t\t// reversed: longest path first\n\t\treturn len(imports[a].path) > len(imports[b].path)\n\t})\n\n\treturn assignIdents, valueSpecIdents, paramIdents, returnIdents, typeParamIdents, imports, switches\n}", "title": "" }, { "docid": "745900ce6ae5872b92099cd2c1b0890c", "score": "0.5362943", "text": "func (b *builder) addImportUsed(i string) string {\n\tr := strings.NewReplacer(\"github.com/gunk/opt\", \"\", \"/\", \"\")\n\tnamedImport := r.Replace(i)\n\tpkg := filepath.Base(i)\n\t// Determine if there is a package with the same name\n\t// as this one, if there is give this current one a\n\t// named import with \"/\" replaced, eg:\n\t// \"github.com/gunk/opt/file/java\" becomes \"filejava\"\n\tuseNamedImport := false\n\tfor imp := range b.importsUsed {\n\t\tif imp != i && pkg == filepath.Base(imp) {\n\t\t\tuseNamedImport = true\n\t\t\tbreak\n\t\t}\n\t}\n\t// If the import requires a named import, record it and\n\t// return the named import as the new package name.\n\tif useNamedImport {\n\t\tb.importsUsed[i] = namedImport\n\t\treturn namedImport\n\t}\n\t// If this is the first time that package name has been\n\t// seen then we can keep the import as is.\n\tb.importsUsed[i] = \"\"\n\treturn pkg\n}", "title": "" }, { "docid": "2725af7623bc4047e34efccf98400d89", "score": "0.53548026", "text": "func sortDecl(a []dst.Decl) func(i, j int) bool {\n\tDeclPriority := map[reflect.Type]int{\n\t\treflect.TypeOf(&dst.FuncDecl{}): 1,\n\t\treflect.TypeOf(&dst.GenDecl{}): 1,\n\t}\n\n\treturn func(i, j int) bool {\n\t\tthis := a[i]\n\t\tother := a[j]\n\n\t\tthisPrio, ok := DeclPriority[reflect.TypeOf(this)]\n\t\tif !ok {\n\t\t\tfmt.Printf(\"%T %t not implemented\\n\", this, this)\n\t\t\treturn true\n\t\t}\n\t\totherPrio, ok := DeclPriority[reflect.TypeOf(other)]\n\t\tif !ok {\n\t\t\tfmt.Printf(\"%T %t not implemented\\n\", other, other)\n\t\t\treturn true\n\t\t}\n\n\t\tif thisPrio != otherPrio {\n\t\t\treturn thisPrio < otherPrio\n\t\t}\n\n\t\tswitch thisV := this.(type) {\n\t\tcase *dst.FuncDecl:\n\t\t\tswitch otherV := other.(type) {\n\t\t\tcase *dst.FuncDecl:\n\t\t\t\treturn lessFuncFunc(thisV, otherV)\n\t\t\tcase *dst.GenDecl:\n\t\t\t\treturn lessFuncGen(thisV, otherV)\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"%T %t other not implemented\\n\", other, other)\n\t\t\t}\n\n\t\tcase *dst.GenDecl:\n\t\t\tswitch otherV := other.(type) {\n\t\t\tcase *dst.FuncDecl:\n\t\t\t\treturn !lessFuncGen(otherV, thisV)\n\t\t\tcase *dst.GenDecl:\n\t\t\t\treturn lessGen(thisV, otherV)\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"%T %t other not implemented\\n\", other, other)\n\t\t\t}\n\t\tdefault:\n\t\t\tfmt.Printf(\"%T %t this not implemented\\n\", other, other)\n\t\t}\n\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "018bf9ae01159eac9faedfb311966361", "score": "0.5351901", "text": "func sortEntries(entries []os.DirEntry) {\n\tsort.SliceStable(entries, func(i, j int) bool {\n\t\treturn packCopyPriority(entries[i].Name()) < packCopyPriority(entries[j].Name())\n\t})\n}", "title": "" }, { "docid": "40840167b7a353b2c3b2da313f288654", "score": "0.53516257", "text": "func canonicalizeImportPath(importPath string) importPathString {\n\tif !strings.Contains(importPath, \"/vendor/\") {\n\t\treturn importPathString(importPath)\n\t}\n\n\treturn importPathString(importPath[strings.Index(importPath, \"/vendor/\")+len(\"/vendor/\"):])\n}", "title": "" }, { "docid": "b5172d9a30576135b53a4c113e56ec6d", "score": "0.5323699", "text": "func (file *File) scanImport(tokens token.List, index token.Position) (*Import, token.Position, error) {\n\tvar baseName string\n\tposition := index\n\tfullImportPath := strings.Builder{}\n\tfullImportPath.WriteString(file.environment.StandardLibrary)\n\tfullImportPath.WriteByte('/')\n\timportPath := strings.Builder{}\n\tindex++\n\n\tfor ; index < len(tokens); index++ {\n\t\tt := tokens[index]\n\n\t\tswitch t.Kind {\n\t\tcase token.Identifier:\n\t\t\tbaseName = t.Text()\n\t\t\tfullImportPath.WriteString(baseName)\n\t\t\timportPath.WriteString(baseName)\n\n\t\tcase token.Operator:\n\t\t\tif t.Text() != \".\" {\n\t\t\t\treturn nil, index, NewError(errors.New(&errors.InvalidCharacter{Character: t.Text()}), file.path, tokens[:index+1], nil)\n\t\t\t}\n\n\t\t\tfullImportPath.WriteByte('/')\n\t\t\timportPath.WriteByte('.')\n\n\t\tcase token.NewLine:\n\t\t\timp := &Import{\n\t\t\t\tPath: importPath.String(),\n\t\t\t\tFullPath: fullImportPath.String(),\n\t\t\t\tBaseName: baseName,\n\t\t\t\tPosition: position,\n\t\t\t\tUsed: 0,\n\t\t\t}\n\n\t\t\totherImport, exists := file.imports[baseName]\n\n\t\t\tif exists {\n\t\t\t\treturn nil, index, NewError(errors.New(&errors.ImportNameAlreadyExists{ImportPath: otherImport.Path, Name: baseName}), file.path, tokens[:index], nil)\n\t\t\t}\n\n\t\t\tstat, err := os.Stat(imp.FullPath)\n\n\t\t\tif err != nil || !stat.IsDir() {\n\t\t\t\treturn nil, index, NewError(errors.New(&errors.PackageDoesntExist{ImportPath: imp.Path, FilePath: imp.FullPath}), file.path, tokens[:imp.Position+2], nil)\n\t\t\t}\n\n\t\t\tindex++\n\t\t\treturn imp, index, nil\n\t\t}\n\t}\n\n\treturn nil, index, errors.New(errors.InvalidExpression)\n}", "title": "" }, { "docid": "aa1b2c3e8c5dc030800831b7bd4770f4", "score": "0.5315866", "text": "func (g *Generator) Imports() error {\n\twd, err := os.Getwd()\n\tformatedOutput, err := imports.Process(wd, g.buf.Bytes(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.buf = bytes.NewBuffer(formatedOutput)\n\treturn nil\n}", "title": "" }, { "docid": "5dd14459b5892600bfb4609f1c90e0b7", "score": "0.531393", "text": "func prepareDependencies(imports []string, currentPkg string, srcDir string, fset *token.FileSet) (map[string]*types.Package, error) {\n\tdependencies := map[string]*types.Package{\n\t\t\"unsafe\": types.Unsafe,\n\t}\n\tpackages := map[string]*types.Package{}\n\n\tfor _, path := range imports {\n\t\tif path == \"unsafe\" || path == \"C\" || path == currentPkg {\n\t\t\tcontinue\n\t\t}\n\n\t\tif build.IsLocalImport(path) {\n\t\t\tlog.Printf(\"warning: local imports not supported: %s\", path)\n\t\t\tcontinue\n\t\t}\n\n\t\timpPkg, err := buildContext.Import(path, srcDir, build.AllowBinary)\n\t\tif err != nil {\n\t\t\t// This step can fail when a dependency package has been\n\t\t\t// moved or its host is down. Failures here will degrade\n\t\t\t// the analysis, but they should not be fatal, or else the\n\t\t\t// build success is very sensitive to external\n\t\t\t// dependencies.\n\n\t\t\t// try to download package\n\t\t\tcmd := exec.Command(\"go\", \"get\", \"-d\", \"-v\", path)\n\t\t\tcmd.Stdout = os.Stderr\n\t\t\tcmd.Stderr = os.Stderr\n\t\t\tcmd.Env = []string{\"PATH=\" + os.Getenv(\"PATH\"), \"GOROOT=\" + buildContext.GOROOT, \"GOPATH=\" + buildContext.GOPATH}\n\t\t\tif err := cmd.Run(); err != nil {\n\t\t\t\tlog.Printf(\"warning: fetching dependency (with %v) failed: %s\", cmd.Args, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\timpPkg, err = buildContext.Import(path, srcDir, build.AllowBinary)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"warning: importing dependency %q failed: %s\", path, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\ttypesPkg, ok := packages[impPkg.ImportPath]\n\t\tif !ok || !typesPkg.Complete() {\n\t\t\tif _, err := os.Stat(impPkg.PkgObj); os.IsNotExist(err) {\n\t\t\t\tif err := writePkgObj(impPkg); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata, err := ioutil.ReadFile(impPkg.PkgObj)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, typesPkg, err = gcimporter.BImportData(fset, packages, data, impPkg.ImportPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tdependencies[path] = typesPkg\n\t}\n\n\treturn dependencies, nil\n}", "title": "" }, { "docid": "295875e681c701c6c77fed7d493b693d", "score": "0.52961916", "text": "func TestTransitiveImports(t *testing.T) {\n\timports, err := TransitiveImports(\"testdata/importTree\")\n\tfmt.Println(imports)\n\trequire.NoError(t, err)\n\tassert.Equal(t, []string{\n\t\t\"main.jsonnet\",\n\t\t\"trees.jsonnet\",\n\t\t\"trees/apple.jsonnet\",\n\t\t\"trees/cherry.jsonnet\",\n\t\t\"trees/generic.libsonnet\",\n\t\t\"trees/peach.jsonnet\",\n\t}, imports)\n}", "title": "" }, { "docid": "5bb17ced2ee49f5ac22d8ab9498cff94", "score": "0.5283577", "text": "func importPathsNoDotExpansion(ctx Context, cwd string, args []string) []string {\n\tsrcdir, _ := filepath.Rel(ctx.Srcdirs()[0], cwd)\n\tif srcdir == \"..\" {\n\t\tsrcdir = \".\"\n\t}\n\tif len(args) == 0 {\n\t\targs = []string{\"...\"}\n\t}\n\tvar out []string\n\tfor _, a := range args {\n\t\t// Arguments are supposed to be import paths, but\n\t\t// as a courtesy to Windows developers, rewrite \\ to /\n\t\t// in command-line arguments. Handles .\\... and so on.\n\t\tif filepath.Separator == '\\\\' {\n\t\t\ta = strings.Replace(a, `\\`, `/`, -1)\n\t\t}\n\n\t\tif a == \"all\" || a == \"std\" {\n\t\t\tout = append(out, ctx.AllPackages(a)...)\n\t\t\tcontinue\n\t\t}\n\t\ta = path.Join(srcdir, path.Clean(a))\n\t\tout = append(out, a)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "f08e20ad6ccc591d2c9cd269ce45f5e5", "score": "0.5283094", "text": "func safeImport(unsafe string) string {\n\tsafe := unsafe\n\n\t// Remove dashes and dots\n\tsafe = strings.Replace(safe, \"-\", \"\", -1)\n\tsafe = strings.Replace(safe, \".\", \"\", -1)\n\n\treturn safe\n}", "title": "" }, { "docid": "3e129a139216c35fcd6a1268f0f18bf0", "score": "0.5282384", "text": "func prepareSortDir(e *LoadDataController, taskID int64, tidbCfg *tidb.Config) (string, error) {\n\tsortPathSuffix := \"import-\" + strconv.Itoa(int(tidbCfg.Port))\n\timportDir := filepath.Join(tidbCfg.TempDir, sortPathSuffix)\n\tsortDir := filepath.Join(importDir, strconv.FormatInt(taskID, 10))\n\n\tif info, err := os.Stat(importDir); err != nil || !info.IsDir() {\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\te.logger.Error(\"stat import dir failed\", zap.String(\"import_dir\", importDir), zap.Error(err))\n\t\t\treturn \"\", errors.Trace(err)\n\t\t}\n\t\tif info != nil && !info.IsDir() {\n\t\t\te.logger.Warn(\"import dir is not a dir, remove it\", zap.String(\"import_dir\", importDir))\n\t\t\tif err := os.RemoveAll(importDir); err != nil {\n\t\t\t\treturn \"\", errors.Trace(err)\n\t\t\t}\n\t\t}\n\t\te.logger.Info(\"import dir not exists, create it\", zap.String(\"import_dir\", importDir))\n\t\tif err := os.MkdirAll(importDir, 0o700); err != nil {\n\t\t\te.logger.Error(\"failed to make dir\", zap.String(\"import_dir\", importDir), zap.Error(err))\n\t\t\treturn \"\", errors.Trace(err)\n\t\t}\n\t}\n\n\t// todo: remove this after we support checkpoint\n\tif _, err := os.Stat(sortDir); err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\te.logger.Error(\"stat sort dir failed\", zap.String(\"sort_dir\", sortDir), zap.Error(err))\n\t\t\treturn \"\", errors.Trace(err)\n\t\t}\n\t} else {\n\t\te.logger.Warn(\"sort dir already exists, remove it\", zap.String(\"sort_dir\", sortDir))\n\t\tif err := os.RemoveAll(sortDir); err != nil {\n\t\t\treturn \"\", errors.Trace(err)\n\t\t}\n\t}\n\treturn sortDir, nil\n}", "title": "" }, { "docid": "fbfbb6378cfadb5d3ec8883b3baa75c4", "score": "0.5280674", "text": "func getImports(imp *ast.ImportSpec) (start, end int, name string) {\n\tif imp.Doc != nil {\n\t\t// doc poc need minus one to get the first index of comment\n\t\tstart = int(imp.Doc.Pos()) - 1\n\t} else {\n\t\tif imp.Name != nil {\n\t\t\t// name pos need minus one too\n\t\t\tstart = int(imp.Name.Pos()) - 1\n\t\t} else {\n\t\t\t// path pos start without quote, need minus one for it\n\t\t\tstart = int(imp.Path.Pos()) - 1\n\t\t}\n\t}\n\n\tif imp.Name != nil {\n\t\tname = imp.Name.Name\n\t}\n\n\tif imp.Comment != nil {\n\t\tend = int(imp.Comment.End())\n\t} else {\n\t\tend = int(imp.Path.End())\n\t}\n\treturn\n}", "title": "" }, { "docid": "db95f5c53050c388618481d670437f53", "score": "0.52784044", "text": "func parsePackageImport(source, srcDir string) (string, error) {\n\tcfg := &packages.Config{\n\t\tMode: packages.NeedName,\n\t\tTests: true,\n\t\tDir: srcDir,\n\t}\n\tpkgs, err := packages.Load(cfg, \"file=\"+source)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif packages.PrintErrors(pkgs) > 0 || len(pkgs) == 0 {\n\t\treturn \"\", errors.New(\"loading package failed\")\n\t}\n\n\tpackageImport := pkgs[0].PkgPath\n\n\t// It is illegal to import a _test package.\n\tpackageImport = strings.TrimSuffix(packageImport, \"_test\")\n\treturn packageImport, nil\n}", "title": "" }, { "docid": "f13ea2cf4775335fe19c7a96be7b621b", "score": "0.52454644", "text": "func specialCases(importpath string) string {\n\tfor _, known := range knownImports {\n\t\tif !strings.HasPrefix(importpath, known) {\n\t\t\tcontinue\n\t\t}\n\t\tl := len(known)\n\t\tif idx := strings.Index(importpath[l:], \"/\"); idx != -1 {\n\t\t\treturn importpath[:l+idx]\n\t\t}\n\t\treturn importpath\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c2e103ddc5749eda387c5865f32285fa", "score": "0.5239612", "text": "func SortObjectsInDependencyOrder(functions []Function, types []Type, tables []Relation, protocols []ExternalProtocol) []Sortable {\n\tobjects := make([]Sortable, 0)\n\tfor _, function := range functions {\n\t\tobjects = append(objects, function)\n\t}\n\tfor _, typ := range types {\n\t\tif typ.Type != \"e\" && typ.Type != \"p\" {\n\t\t\tobjects = append(objects, typ)\n\t\t}\n\t}\n\tfor _, table := range tables {\n\t\tobjects = append(objects, table)\n\t}\n\tfor _, protocol := range protocols {\n\t\tobjects = append(objects, protocol)\n\t}\n\tsorted := TopologicalSort(objects)\n\treturn sorted\n}", "title": "" }, { "docid": "7fd7cc07d6766b210e2adf90e0bf24df", "score": "0.52393705", "text": "func fakeImporter() ast.Importer {\n\treturn func(imports map[string]*ast.Object, path string) (pkg *ast.Object, err error) {\n\t\tif path == \"fmt\" || path == \"os\" {\n\t\t\treturn ast.NewObj(ast.Pkg, path), nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Unsupported input imports=%v path=%s\", imports, path)\n\t}\n}", "title": "" }, { "docid": "1005f3b59e8295ea4532b32fa575354a", "score": "0.5238854", "text": "func (f *File) ImportedLibraries() ([]string, error)", "title": "" }, { "docid": "317dc4a26a6f305b28a54e07cfd70c9c", "score": "0.52384883", "text": "func possibleImportPaths(pkgInfo PackageInfo, goType string) []string {\n\n\tif !strings.Contains(goType, \".\") {\n\t\treturn []string{pkgInfo.ImportPath}\n\t}\n\n\tchunks := strings.Split(goType, \".\")\n\n\talias := chunks[0]\n\n\timportPaths := make([]string, 0)\n\n\tfor importPath, aliases := range pkgInfo.Imports {\n\t\tfor _, alias_ := range aliases {\n\t\t\tif alias_ == alias {\n\t\t\t\t// I'm pretty sure that there should never be duplicate importPaths here.\n\t\t\t\t// Otherwise, check for duplicates.\n\t\t\t\timportPaths = append(importPaths, importPath)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn importPaths\n}", "title": "" }, { "docid": "cb94034ce034c1dd72fa798cde9b5095", "score": "0.52307236", "text": "func (g *Generator) parsePackageToImport(dir string) {\n\tpkg := loadPackage([]string{dir}, g.buildTag)\n\tfiles, err := filepath.Glob(filepath.Join(dir, g.globImport))\n\tif err != nil {\n\t\tlog.Fatalf(\"error: find glob %s under %s, got %v\", g.globImport, dir, err)\n\t}\n\tif len(files) > 0 {\n\t\tg.addPackage(dir, pkg)\n\t}\n}", "title": "" }, { "docid": "7161a96ddc407bad1d34b510eda184fb", "score": "0.5223292", "text": "func parseImport(script []Token) (int, string) {\n\tvar i int\n\tvar ret string\n\tnext := Keyword //import\n\tfor i < len(script) {\n\t\ttok := script[i]\n\t\tif tok.Type == WhiteSpace || tok.Type == Any || tok.Type == Comma {\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tif tok.Type != next {\n\t\t\treturn 0, \"\"\n\t\t}\n\n\t\tif tok.Type == NewLine {\n\t\t\tif ret == \"\" {\n\t\t\t\treturn 0, \"\"\n\t\t\t}\n\t\t\treturn i + 1, ret\n\t\t}\n\n\t\tif tok.Type == Keyword {\n\t\t\tif tok.Value == \"import\" {\n\t\t\t\tnext = OpenObject\n\t\t\t}\n\t\t\tif tok.Value == \"from\" {\n\t\t\t\tnext = Value\n\t\t\t}\n\t\t}\n\n\t\tif tok.Type == OpenObject {\n\t\t\tnext = CloseObject\n\t\t}\n\t\tif tok.Type == CloseObject {\n\t\t\tnext = Keyword\n\t\t}\n\n\t\tif tok.Type == Value {\n\t\t\tnext = NewLine\n\t\t\tret = tok.Value[1:len(tok.Value)-1] + \".ts\"\n\t\t}\n\t\ti++\n\t}\n\treturn 0, \"\"\n}", "title": "" }, { "docid": "9c3e7cc315eb73fa07a41648655d296a", "score": "0.5218018", "text": "func sortByDepends(reposList []lockjson.Repos, plugconfMap map[pathutil.ReposPath]*ParsedInfo) (parseErrAll MultiParseError) {\n\tvisitedStatusMap := make(map[pathutil.ReposPath]visitingStatus, len(reposList))\n\torder := make(map[pathutil.ReposPath]int, len(reposList))\n\tfor i := range reposList {\n\t\tif visitedStatusMap[reposList[i].Path] == notVisited {\n\t\t\terrors := visitRepos([]pathutil.ReposPath{reposList[i].Path}, reposList, plugconfMap, visitedStatusMap, order)\n\t\t\tparseErrAll = append(parseErrAll, errors...)\n\t\t}\n\t}\n\tif parseErrAll.HasErrs() {\n\t\treturn\n\t}\n\n\tsort.Slice(reposList, func(i, j int) bool {\n\t\treturn order[reposList[i].Path] < order[reposList[j].Path]\n\t})\n\treturn\n}", "title": "" }, { "docid": "2fcdfd5ed628d5465ccaf93b47a749f1", "score": "0.5215663", "text": "func getAllDeps(importPath string, cmds []string) []string {\n\tsubpackagePrefix := importPath + \"/\"\n\n\tvar depsSlice []string\n\tfor _, useAllFiles := range []bool{false, true} {\n\t\tprintLoadingError := func(path string, err error) {\n\t\t\tif err != nil && !useAllFiles {\n\t\t\t\t// Lots of errors because of UseAllFiles.\n\t\t\t\tlog.Printf(\"error loading package %s: %s\", path, err)\n\t\t\t}\n\t\t}\n\n\t\tdeps := map[string]struct{}{}\n\t\troots := map[string]struct{}{\n\t\t\timportPath: {},\n\t\t}\n\n\t\t// Add the command packages. Note that external command packages are\n\t\t// considered dependencies.\n\t\tfor _, pkg := range cmds {\n\t\t\troots[pkg] = struct{}{}\n\n\t\t\tif !strings.HasPrefix(pkg, subpackagePrefix) {\n\t\t\t\tdeps[pkg] = struct{}{}\n\t\t\t}\n\t\t}\n\n\t\tbuildContext := build.Default\n\t\tbuildContext.CgoEnabled = true\n\t\tbuildContext.UseAllFiles = useAllFiles\n\n\t\t// Add the subpackages.\n\t\tfor path := range buildutil.ExpandPatterns(&buildContext, []string{subpackagePrefix + \"...\"}) {\n\t\t\t_, err := tryImport(buildContext, path, \"\", 0)\n\t\t\tif _, ok := err.(*build.NoGoError); ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tprintLoadingError(path, err)\n\t\t\troots[path] = struct{}{}\n\t\t}\n\n\t\tvar addTransitiveClosure func(string)\n\t\taddTransitiveClosure = func(path string) {\n\t\t\tpkg, err := tryImport(buildContext, path, \"\", 0)\n\t\t\tprintLoadingError(path, err)\n\n\t\t\timportPaths := append([]string(nil), pkg.Imports...)\n\t\t\tif _, ok := roots[path]; ok {\n\t\t\t\timportPaths = append(importPaths, pkg.TestImports...)\n\t\t\t\timportPaths = append(importPaths, pkg.XTestImports...)\n\t\t\t}\n\n\t\t\tfor _, path := range importPaths {\n\t\t\t\tif path == \"C\" {\n\t\t\t\t\tcontinue // \"C\" is fake\n\t\t\t\t}\n\n\t\t\t\t// Resolve the import path relative to the importing package.\n\t\t\t\tif bp2, _ := tryImport(buildContext, path, pkg.Dir, build.FindOnly); bp2 != nil {\n\t\t\t\t\tpath = bp2.ImportPath\n\t\t\t\t}\n\n\t\t\t\t// Exclude our roots. Note that commands are special-cased above.\n\t\t\t\tif _, ok := roots[path]; ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tslash := strings.IndexByte(path, '/')\n\t\t\t\tstdLib := slash == -1 || strings.IndexByte(path[:slash], '.') == -1\n\t\t\t\t// Exclude the standard library.\n\t\t\t\tif stdLib {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif _, ok := deps[path]; !ok {\n\t\t\t\t\tdeps[path] = struct{}{}\n\t\t\t\t\taddTransitiveClosure(path)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor path := range roots {\n\t\t\taddTransitiveClosure(path)\n\t\t}\n\t\taddTransitiveClosure(importPath)\n\n\t\tdepsSlice = append(depsSlice, setToSlice(deps)...)\n\t}\n\n\treturn depsSlice\n}", "title": "" }, { "docid": "01473b2c91be391549e127ae5663df60", "score": "0.5214656", "text": "func Import(refs *importers.References) ([]*Named, error) {\n\tvar modules []string\n\tmodMap := make(map[string]struct{})\n\ttypeNames := make(map[string][]string)\n\ttypeSet := make(map[string]struct{})\n\tgenMods := make(map[string]struct{})\n\tfor _, emb := range refs.Embedders {\n\t\tgenMods[initialUpper(emb.Pkg)] = struct{}{}\n\t}\n\tfor _, ref := range refs.Refs {\n\t\tvar module, name string\n\t\tif idx := strings.Index(ref.Pkg, \"/\"); idx != -1 {\n\t\t\t// ref is a static method reference.\n\t\t\tmodule = ref.Pkg[:idx]\n\t\t\tname = ref.Pkg[idx+1:]\n\t\t} else {\n\t\t\t// ref is a type name.\n\t\t\tmodule = ref.Pkg\n\t\t\tname = ref.Name\n\t\t}\n\t\tif _, exists := typeSet[name]; !exists {\n\t\t\ttypeNames[module] = append(typeNames[module], name)\n\t\t\ttypeSet[name] = struct{}{}\n\t\t}\n\t\tif _, exists := modMap[module]; !exists {\n\t\t\t// Include the module only if it is generated.\n\t\t\tif _, exists := genMods[module]; !exists {\n\t\t\t\tmodMap[module] = struct{}{}\n\t\t\t\tmodules = append(modules, module)\n\t\t\t}\n\t\t}\n\t}\n\tsdkPathOut, err := exec.Command(\"xcrun\", \"--sdk\", \"iphonesimulator\", \"--show-sdk-path\").CombinedOutput()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsdkPath := strings.TrimSpace(string(sdkPathOut))\n\tvar allTypes []*Named\n\ttypeMap := make(map[string]*Named)\n\tfor _, module := range modules {\n\t\ttypes, err := importModule(string(sdkPath), module, typeNames[module], typeMap)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: %v\", module, err)\n\t\t}\n\t\tallTypes = append(allTypes, types...)\n\t}\n\t// Embedders refer to every exported Go struct that will have its class\n\t// generated. Allow Go code to reverse bind to those classes by synthesizing\n\t// their descriptors.\n\tfor _, emb := range refs.Embedders {\n\t\tmodule := initialUpper(emb.Pkg)\n\t\tnamed := &Named{\n\t\t\tName: module + emb.Name,\n\t\t\tGoName: emb.Name,\n\t\t\tModule: module,\n\t\t\tGenerated: true,\n\t\t}\n\t\tfor _, ref := range emb.Refs {\n\t\t\tt, exists := typeMap[ref.Name]\n\t\t\tif !exists {\n\t\t\t\treturn nil, fmt.Errorf(\"type not found: %q\", ref.Name)\n\t\t\t}\n\t\t\tnamed.Supers = append(named.Supers, Super{\n\t\t\t\tName: t.Name,\n\t\t\t\tProtocol: t.Protocol,\n\t\t\t})\n\t\t}\n\t\ttypeMap[emb.Name] = named\n\t\tallTypes = append(allTypes, named)\n\t}\n\tinitTypes(allTypes, refs, typeMap)\n\t// Include implicit types that are used in parameter or return values.\n\tnewTypes := allTypes\n\tfor len(newTypes) > 0 {\n\t\tvar impTypes []*Named\n\t\tfor _, t := range newTypes {\n\t\t\tfor _, funcs := range [][]*Func{t.Funcs, t.AllMethods} {\n\t\t\t\tfor _, f := range funcs {\n\t\t\t\t\ttypes := implicitFuncTypes(f)\n\t\t\t\t\tfor _, name := range types {\n\t\t\t\t\t\tif _, exists := typeSet[name]; exists {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttypeSet[name] = struct{}{}\n\t\t\t\t\t\tt, exists := typeMap[name]\n\t\t\t\t\t\tif !exists {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"implicit type %q not found\", name)\n\t\t\t\t\t\t}\n\t\t\t\t\t\timpTypes = append(impTypes, t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tinitTypes(impTypes, refs, typeMap)\n\t\tallTypes = append(allTypes, impTypes...)\n\t\tnewTypes = impTypes\n\t}\n\treturn allTypes, nil\n}", "title": "" }, { "docid": "57de697bcdd382496ea8c5d39b1cf7a7", "score": "0.52043605", "text": "func resolvedModuleNameCompareTo(a ResolvedModuleName, b ResolvedModuleName) int {\n\tif a == nil && b == nil {\n\t\treturn 0\n\t}\n\tif a == nil && b != nil {\n\t\treturn -1\n\t}\n\tif a != nil && b == nil {\n\t\treturn 1\n\t}\n\tif a.Remote() < b.Remote() {\n\t\treturn -1\n\t}\n\tif a.Remote() > b.Remote() {\n\t\treturn 1\n\t}\n\tif a.Owner() < b.Owner() {\n\t\treturn -1\n\t}\n\tif a.Owner() > b.Owner() {\n\t\treturn 1\n\t}\n\tif a.Repository() < b.Repository() {\n\t\treturn -1\n\t}\n\tif a.Repository() > b.Repository() {\n\t\treturn 1\n\t}\n\tif a.Track() < b.Track() {\n\t\treturn -1\n\t}\n\tif a.Track() > b.Track() {\n\t\treturn 1\n\t}\n\tif a.Digest() < b.Digest() {\n\t\treturn -1\n\t}\n\tif a.Digest() > b.Digest() {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "7b70b54a33019b1d4da4518a0c0fac34", "score": "0.5191323", "text": "func extractTypeScriptImportsProvidedByRule(pkg string, r *rule.Rule, srcsAttr string) []string {\n\tvar importPaths []string\n\tfor _, src := range r.AttrStrings(srcsAttr) {\n\t\tif !strings.HasSuffix(src, \".ts\") {\n\t\t\tlog.Printf(\"Rule %s of kind %s contains a non-TypeScript file in its %s attribute: %s\", label.New(\"\", pkg, r.Name()).String(), r.Kind(), srcsAttr, src)\n\t\t\tcontinue\n\t\t}\n\n\t\timportPaths = append(importPaths, path.Join(pkg, strings.TrimSuffix(src, path.Ext(src))))\n\n\t\t// An index.ts file may also be imported as its parent folder's \"main\" module:\n\t\t//\n\t\t// // The two following imports are equivalent.\n\t\t// import 'path/to/module/index';\n\t\t// import 'path/to/module';\n\t\t//\n\t\t// Reference:\n\t\t// https://www.typescriptlang.org/docs/handbook/module-resolution.html#how-typescript-resolves-modules.\n\t\tif src == \"index.ts\" {\n\t\t\timportPaths = append(importPaths, pkg)\n\t\t}\n\t}\n\treturn importPaths\n}", "title": "" }, { "docid": "db0341cf615686ac9a727aff3430fe77", "score": "0.5189249", "text": "func genImportPath(t reflect.Type) (s string) {\n\ts = t.PkgPath()\n\tif genCheckVendor {\n\t\t// HACK: always handle vendoring. It should be typically on in go 1.6, 1.7\n\t\ts = genStripVendor(s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "21e0421f83c8ef75024a9aa39d1f9697", "score": "0.5188502", "text": "func generateImports(ctx *context, w io.Writer) {\n\tfmt.Fprintf(w, \"import api \\\"%s\\\"\\n\", govppApiImportPath)\n\tfmt.Fprintf(w, \"import bytes \\\"%s\\\"\\n\", \"bytes\")\n\tfmt.Fprintf(w, \"import context \\\"%s\\\"\\n\", \"context\")\n\tfmt.Fprintf(w, \"import strconv \\\"%s\\\"\\n\", \"strconv\")\n\tfmt.Fprintf(w, \"import struc \\\"%s\\\"\\n\", \"github.com/lunixbochs/struc\")\n\tfmt.Fprintln(w)\n\n\tfmt.Fprintf(w, \"// Reference imports to suppress errors if they are not otherwise used.\\n\")\n\tfmt.Fprintf(w, \"var _ = api.RegisterMessage\\n\")\n\tfmt.Fprintf(w, \"var _ = bytes.NewBuffer\\n\")\n\tfmt.Fprintf(w, \"var _ = context.Background\\n\")\n\tfmt.Fprintf(w, \"var _ = strconv.Itoa\\n\")\n\tfmt.Fprintf(w, \"var _ = struc.Pack\\n\")\n\tfmt.Fprintln(w)\n\n\tfmt.Fprintln(w, \"// This is a compile-time assertion to ensure that this generated file\")\n\tfmt.Fprintln(w, \"// is compatible with the GoVPP api package it is being compiled against.\")\n\tfmt.Fprintln(w, \"// A compilation error at this line likely means your copy of the\")\n\tfmt.Fprintln(w, \"// GoVPP api package needs to be updated.\")\n\tfmt.Fprintf(w, \"const _ = api.GoVppAPIPackageIsVersion%d // please upgrade the GoVPP api package\\n\", generatedCodeVersion)\n\tfmt.Fprintln(w)\n}", "title": "" }, { "docid": "48711ff0bf7d8e4d618ce49433fd4df3", "score": "0.5185163", "text": "func ReplaceImports(modFile []byte, sourceFile []byte) ([]byte, error) {\n\tvar mod Modules\n\tif err := yaml.Unmarshal(modFile, &mod); err != nil {\n\t\treturn nil, err\n\t}\n\tfor pattern, resolve := range mod.Imports {\n\t\trepoFrom, _, verFrom := gop.ProcessRepo(pattern)\n\t\trepoTo, _, verTo := gop.ProcessRepo(resolve)\n\t\tsourceFile = []byte(ReplaceSpecificImport(string(sourceFile), repoFrom, verFrom, repoTo, verTo))\n\t}\n\treturn sourceFile, nil\n}", "title": "" }, { "docid": "25ef9ad2620c2f509cfd369e34b0f31c", "score": "0.5184223", "text": "func Import(pkg string) NodeMarshaler {\n\treturn nodef(func(s *Scope) ast.Node {\n\t\tpath := `\"` + pkg + `\"`\n\t\tx, _ := s.LookupStash(&fileKey)\n\t\tf := x.(*ast.File)\n\t\tfor _, spec := range f.Imports {\n\t\t\tif spec.Path.Value == path {\n\t\t\t\treturn ast.NewIdent(spec.Name.Name)\n\t\t\t}\n\t\t}\n\t\tcfg := &packages.Config{Mode: packages.NeedName}\n\t\tpkgs, err := packages.Load(cfg, pkg)\n\t\tname := \"\"\n\t\tif err == nil && len(pkgs) == 1 && pkgs[0].Name != \"\" {\n\t\t\tname = pkgs[0].Name\n\t\t} else {\n\t\t\tparts := strings.Split(pkg, \"/\")\n\t\t\tname = parts[len(parts)-1]\n\t\t}\n\t\tidx := 0\n\t\tuniq := name\n\t\tfor !isUniqueImport(f, uniq) {\n\t\t\tidx++\n\t\t\tuniq = name + strconv.Itoa(idx)\n\t\t}\n\n\t\tspec := &ast.ImportSpec{\n\t\t\tName: ast.NewIdent(uniq),\n\t\t\tPath: &ast.BasicLit{Kind: token.STRING, Value: path},\n\t\t}\n\t\tf.Imports = append(f.Imports, spec)\n\t\timports := f.Decls[0].(*ast.GenDecl)\n\t\tif uniq == name {\n\t\t\tspec = &ast.ImportSpec{Path: spec.Path}\n\t\t}\n\t\timports.Specs = append(imports.Specs, spec)\n\t\treturn ast.NewIdent(uniq)\n\t})\n}", "title": "" }, { "docid": "2bfc6604c531a05bb60da40927f19451", "score": "0.51797277", "text": "func (p *Parser) parse_importdecl() *ast.ImportDecl {\n\tvar path string\n\tvar alias *ast.Identifier\n\n\t// TODO check for duplicate defintions\n\tp.expect(token.IMPORT)\n\tpos := p.GetPos()\n\tif p.tok == token.STRINGLITERAL {\n\t\tpath = p.lit[1 : len(p.lit)-1]\n\t\tp.expect(token.STRINGLITERAL)\n\t}\n\n\tpath = p.ResolvePath(path)\n\tabsPath, err := filepath.Abs(path)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tf, err := os.Open(absPath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\n\th := sha256.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\thash := h.Sum(nil)\n\n\tf.Seek(0, 0)\n\tr := bufio.NewReader(f)\n\ts := scanner.New(r)\n\timported := New(s, path)\n\tprog := imported.Parse_prog()\n\n\tif p.tok == token.LBRACK {\n\t\tp.expect(token.LBRACK)\n\t\texpectedHash, err := hex.DecodeString(p.lit[2:])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif !reflect.DeepEqual(expectedHash, hash) {\n\t\t\tp.err(p.pos, fmt.Sprintf(\"Imported file hash mismatch: expected 0x%x but computed 0x%x\\n\", expectedHash, hash))\n\t\t}\n\t\tp.expect(token.HEXLITERAL)\n\t\tp.expect(token.RBRACK)\n\t}\n\t// TODO: Make alias optional\n\tp.expect(token.AS)\n\talias = ast.NewIdentifier(p.lit, p.GetPos())\n\tp.expect(token.IDENT)\n\n\tp.expect(token.SEMI)\n\n\tret := ast.NewImportDecl(path, hash, alias, prog)\n\tret.SetCoords(pos)\n\treturn ret\n}", "title": "" }, { "docid": "84d54c06012d3f0625551acc3dea31e3", "score": "0.5177905", "text": "func init() {\n\tPackages[\"go/importer\"] = Package{\n\tBinds: map[string]Value{\n\t\t\"Default\":\tValueOf(importer.Default),\n\t\t\"For\":\tValueOf(importer.For),\n\t}, Types: map[string]Type{\n\t\t\"Lookup\":\tTypeOf((*importer.Lookup)(nil)).Elem(),\n\t}, \n\t}\n}", "title": "" }, { "docid": "e2c67c9ce3fdc5e5cf90944304db90b6", "score": "0.5176512", "text": "func (targets BazelTargets) sort() {\n\tsort.Slice(targets, func(i, j int) bool {\n\t\tif targets[i].handcrafted != targets[j].handcrafted {\n\t\t\t// Handcrafted targets will be generated after the bp2build generated targets.\n\t\t\treturn targets[j].handcrafted\n\t\t}\n\t\t// This will cover all bp2build generated targets.\n\t\treturn targets[i].name < targets[j].name\n\t})\n}", "title": "" }, { "docid": "e0245ce483989978a4964828f0018b91", "score": "0.51673645", "text": "func sortLayer(layer []task.Task, idToDisplayName map[string]string) []task.Task {\n\tsortKeys := make([]string, 0, len(layer))\n\tsortKeyToTask := make(map[string]task.Task)\n\tfor _, t := range layer {\n\t\t// Construct a key to sort by, consisting of all dependency names, sorted alphabetically,\n\t\t// followed by the task name\n\t\tsortKeyWords := make([]string, 0, len(t.DependsOn)+1)\n\t\tfor _, dep := range t.DependsOn {\n\t\t\tdepName, ok := idToDisplayName[dep.TaskId]\n\t\t\t// Cross-variant dependencies will not be included in idToDisplayName\n\t\t\tif !ok {\n\t\t\t\tdepName = dep.TaskId\n\t\t\t}\n\t\t\tsortKeyWords = append(sortKeyWords, depName)\n\t\t}\n\t\tsort.Strings(sortKeyWords)\n\t\tsortKeyWords = append(sortKeyWords, t.DisplayName)\n\t\tsortKey := strings.Join(sortKeyWords, \" \")\n\t\tsortKeys = append(sortKeys, sortKey)\n\t\tsortKeyToTask[sortKey] = t\n\t}\n\tsort.Strings(sortKeys)\n\tsortedLayer := make([]task.Task, 0, len(layer))\n\tfor _, sortKey := range sortKeys {\n\t\tsortedLayer = append(sortedLayer, sortKeyToTask[sortKey])\n\t}\n\treturn sortedLayer\n}", "title": "" }, { "docid": "ddaa0ac6d98524dc30a624be9a58222a", "score": "0.5164915", "text": "func package_import_add(alias []byte, filename []byte, parent []package_t, error_ [][]byte) []package_import_t {\n\tvar imp []package_import_t = make([]package_import_t, 1)\n\thash_set(parent[0].deps, alias, imp)\n\timp[0].alias = alias\n\timp[0].filename = filename\n\timp[0].c_file = 0\n\timp[0].pkg = package_new(filename, error_, parent[0].force, parent[0].silent)\n\tif len(imp[0].pkg) == 0 {\n\t\treturn nil\n\t}\n\tpackage_export_write_headers(imp[0].pkg)\n\treturn imp\n}", "title": "" }, { "docid": "6fa736235a1f7cab4a80d84420c0a1b8", "score": "0.51533693", "text": "func extractModules(pkgs []*Package) []*Module {\n\tmodMap := map[string]*Module{}\n\n\t// Add \"stdlib\" module. Even if stdlib is not used, which\n\t// is unlikely, it won't appear in vulncheck.Modules nor\n\t// other results.\n\tmodMap[stdlibModule.Path] = stdlibModule\n\n\tseen := map[*Package]bool{}\n\tvar extract func(*Package, map[string]*Module)\n\textract = func(pkg *Package, modMap map[string]*Module) {\n\t\tif pkg == nil || seen[pkg] {\n\t\t\treturn\n\t\t}\n\t\tif pkg.Module != nil {\n\t\t\tif pkg.Module.Replace != nil {\n\t\t\t\tmodMap[modKey(pkg.Module.Replace)] = pkg.Module\n\t\t\t} else {\n\t\t\t\tmodMap[modKey(pkg.Module)] = pkg.Module\n\t\t\t}\n\t\t}\n\t\tseen[pkg] = true\n\t\tfor _, imp := range pkg.Imports {\n\t\t\textract(imp, modMap)\n\t\t}\n\t}\n\tfor _, pkg := range pkgs {\n\t\textract(pkg, modMap)\n\t}\n\n\tmodules := []*Module{}\n\tfor _, mod := range modMap {\n\t\tmodules = append(modules, mod)\n\t}\n\treturn modules\n}", "title": "" }, { "docid": "534e05deaed9eb3e5799847156d02965", "score": "0.5151021", "text": "func Imports(ims ...ImportItemDeclr) ImportDeclr {\n\treturn ImportDeclr{\n\t\tPackages: ims,\n\t}\n}", "title": "" }, { "docid": "175861f7942620da8ca4f4fc114b80c4", "score": "0.51408446", "text": "func replaceImport(line string, currentFile string) string {\n\tcurrentPath := path.Dir(currentFile)\n\tregex := regexp.MustCompile(`(import|export) *(\\{.*\\})?.*?.*['\"](.*)['\"]`)\n\tmatches := regex.FindStringSubmatch(line)\n\tif len(matches) > 0 && matches[3] != \"\" {\n\t\t//modules := matches[2]\n\t\timportSegment := matches[3]\n\t\t// remove .js\n\t\timportSegment = strings.Replace(importSegment, \".js\", \"\", 1)\n\t\toriginalImportSegment := matches[3]\n\n\t\t// leave relative paths as is, all other shows to node_modules\n\t\tif len(importSegment) > 1 && importSegment[0:1] != \".\" {\n\t\t\timportSegment = \"/node_modules/\" + importSegment\n\t\t\tcurrentPath = \"../client\" //set to \"root\"\n\t\t}\n\n\t\t// Simplest check: file existence\n\t\tcleanPath := filepath.Clean(currentPath + \"/\" + importSegment)\n\t\t_, err := os.Stat(cleanPath + \".js\")\n\t\tif err == nil {\n\t\t\t// file exists\n\t\t\timportSegment = importSegment + \".js\"\n\t\t\treturn strings.Replace(line, originalImportSegment, importSegment, 1)\n\t\t}\n\n\t\t// directory check\n\t\t// ./@furo/fbp ==> ./@furo/fbp/fbp.js\n\t\tinfo, err := os.Stat(cleanPath)\n\t\tif err == nil {\n\t\t\tif info.IsDir() {\n\t\t\t\t// try with directory name as filename\n\t\t\t\tdirs := strings.Split(importSegment, \"/\")\n\t\t\t\t_, err = os.Stat(cleanPath + \"/\" + dirs[len(dirs)-1] + \".js\")\n\t\t\t\tif err == nil {\n\t\t\t\t\t// file exists\n\t\t\t\t\timportSegment = importSegment + \"/\" + dirs[len(dirs)-1] + \".js\"\n\t\t\t\t\treturn strings.Replace(line, originalImportSegment, importSegment, 1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// go for main from package.json\n\t\tif matches[1] == \"import\" {\n\n\t\t\t// open package.json\n\t\t\tpackageJson := \"../client/\" + importSegment + \"/package.json\"\n\n\t\t\t// Open our jsonFile\n\t\t\tjsonFile, err := os.Open(packageJson)\n\t\t\tdefer jsonFile.Close()\n\t\t\t// if we os.Open returns an error then handle it\n\t\t\tif err == nil {\n\t\t\t\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\t\t\t\tvar result map[string]interface{}\n\t\t\t\tjson.Unmarshal([]byte(byteValue), &result)\n\t\t\t\timportSegment = importSegment + \"/\" + result[\"main\"].(string)\n\t\t\t\treturn strings.Replace(line, originalImportSegment, importSegment, 1)\n\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn line\n}", "title": "" }, { "docid": "2d31f6aa3feeca78510f4119557910d9", "score": "0.5139564", "text": "func CheckImports(ctx context.Context) error {\n\tmg.CtxDeps(ctx, Prototool, Static)\n\n\tpkgs, err := zmage.GoPackages(build.Default)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar failed bool\n\tfor _, pkg := range pkgs {\n\t\tfor _, imp := range pkg.Imports {\n\t\t\tif strings.HasPrefix(imp, \"github.com/zvelo/\") {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"package %q depends on disallowed import of %s\\n\", pkg.ImportPath, imp)\n\t\t\t\tfailed = true\n\t\t\t}\n\n\t\t\tif !strings.HasPrefix(imp, \"zvelo.io/\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif imp == \"zvelo.io/msg\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(imp, \"zvelo.io/msg/\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfmt.Fprintf(os.Stderr, \"package %q depends on disallowed import of %s\\n\", pkg.ImportPath, imp)\n\t\t\tfailed = true\n\t\t}\n\t}\n\n\tif failed {\n\t\treturn fmt.Errorf(\"import errors\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2292623eff8c588fe103e2d4e2f781e1", "score": "0.51366997", "text": "func main() {\n\tfmt.Println(\"Traditional way of import\")\n}", "title": "" }, { "docid": "19825eac46a93554a35a5eb77b3076dd", "score": "0.5128925", "text": "func (imp *Import) Compare(other *Import) int {\n\tif imp == nil {\n\t\tif other == nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn -1\n\t} else if other == nil {\n\t\treturn 1\n\t}\n\tif cmp := Compare(imp.Path, other.Path); cmp != 0 {\n\t\treturn cmp\n\t}\n\treturn Compare(imp.Alias, other.Alias)\n}", "title": "" }, { "docid": "681b60d913c05284ac1182dc48ce741e", "score": "0.5123651", "text": "func (ctx *Context) RewriteFiles(filePaths map[string]*File, rules []Rule) error {\n\tgoprint := &printer.Config{\n\t\tMode: printer.TabIndent | printer.UseSpaces,\n\t\tTabwidth: 8,\n\t}\n\tfor pathname, fileInfo := range filePaths {\n\t\tif fileHasPrefix(pathname, ctx.RootDir) == false {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Read the file into AST, modify the AST.\n\t\tfileset := token.NewFileSet()\n\t\tf, err := parser.ParseFile(fileset, pathname, nil, parser.ParseComments)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, impNode := range f.Imports {\n\t\t\timp, err := strconv.Unquote(impNode.Path.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, rule := range rules {\n\t\t\t\tif imp != rule.From {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\timpNode.Path.Value = strconv.Quote(rule.To)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Remove import comment.\n\t\tst := fileInfo.Package.Status\n\t\tif st == StatusInternal || st == StatusUnused {\n\t\t\tvar ic *ast.Comment\n\t\t\tif f.Name != nil {\n\t\t\t\tpos := f.Name.Pos()\n\t\t\tbig:\n\t\t\t\t// Find the next comment after the package name.\n\t\t\t\tfor _, cblock := range f.Comments {\n\t\t\t\t\tfor _, c := range cblock.List {\n\t\t\t\t\t\tif c.Pos() > pos {\n\t\t\t\t\t\t\tic = c\n\t\t\t\t\t\t\tbreak big\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\tif ic != nil {\n\t\t\t\t// If it starts with the import text, assume it is the import comment and remove.\n\t\t\t\tif index := strings.Index(ic.Text, \" import \"); index > 0 && index < 5 {\n\t\t\t\t\tic.Text = strings.Repeat(\" \", len(ic.Text))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Don't sort or modify the imports to minimize diffs.\n\n\t\t// Write the AST back to disk.\n\t\tfi, err := os.Stat(pathname)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tw, err := safefile.Create(pathname, fi.Mode())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = goprint.Fprint(w, fileset, f)\n\t\tif err != nil {\n\t\t\tw.Close()\n\t\t\treturn err\n\t\t}\n\t\terr = w.Commit()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e15a002ac46a18c4022f9d0ef7575789", "score": "0.51220995", "text": "func SortManifests(manifests []Manifest) {\n\torderMap := map[string]int{}\n\n\tfor k, kind := range KindOrder {\n\t\torderMap[kind] = k\n\t}\n\n\tsort.Slice(\n\t\tmanifests,\n\t\tfunc(i, j int) bool {\n\t\t\tmanifest1 := manifests[i]\n\t\t\tmanifest2 := manifests[j]\n\n\t\t\tvar kindOrder1, kindOrder2 int\n\t\t\tvar namespace1, namespace2 string\n\t\t\tvar name1, name2 string\n\n\t\t\tif manifest1.Head.Kind != \"\" {\n\t\t\t\tif order, ok := orderMap[manifest1.Head.Kind]; ok {\n\t\t\t\t\tkindOrder1 = order\n\t\t\t\t} else {\n\t\t\t\t\tkindOrder1 = len(orderMap)\n\t\t\t\t}\n\n\t\t\t\tif manifest1.Head.Metadata != nil {\n\t\t\t\t\tname1 = manifest1.Head.Metadata.Name\n\t\t\t\t\tnamespace1 = manifest1.Head.Metadata.Namespace\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkindOrder1 = len(orderMap)\n\t\t\t}\n\n\t\t\tif manifest2.Head.Kind != \"\" {\n\t\t\t\tif order, ok := orderMap[manifest2.Head.Kind]; ok {\n\t\t\t\t\tkindOrder2 = order\n\t\t\t\t} else {\n\t\t\t\t\tkindOrder2 = len(orderMap)\n\t\t\t\t}\n\n\t\t\t\tif manifest2.Head.Metadata != nil {\n\t\t\t\t\tname2 = manifest2.Head.Metadata.Name\n\t\t\t\t\tnamespace2 = manifest2.Head.Metadata.Namespace\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tkindOrder2 = len(orderMap)\n\t\t\t}\n\n\t\t\tif kindOrder1 < kindOrder2 {\n\t\t\t\treturn true\n\t\t\t} else if kindOrder1 == kindOrder2 && namespace1 < namespace2 {\n\t\t\t\treturn true\n\t\t\t} else if kindOrder1 == kindOrder2 && namespace1 == namespace2 && name1 < name2 {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\treturn false\n\t\t},\n\t)\n}", "title": "" }, { "docid": "42eca10ea38d254f8879c6f9f4630d8a", "score": "0.5104481", "text": "func orderBeginBlockers() []string {\n\treturn []string{\n\t\t// upgrades should be run first\n\t\tupgradetypes.ModuleName,\n\t\tcapabilitytypes.ModuleName,\n\t\tminttypes.ModuleName,\n\t\tdistrtypes.ModuleName,\n\t\tslashingtypes.ModuleName,\n\t\tevidencetypes.ModuleName,\n\t\tstakingtypes.ModuleName,\n\t\tauthtypes.ModuleName,\n\t\tbanktypes.ModuleName,\n\t\tgovtypes.ModuleName,\n\t\tcrisistypes.ModuleName,\n\t\tliquiditytypes.ModuleName,\n\t\tibctransfertypes.ModuleName,\n\t\tibchost.ModuleName,\n\t\ticatypes.ModuleName,\n\t\troutertypes.ModuleName,\n\t\tgenutiltypes.ModuleName,\n\t\tauthz.ModuleName,\n\t\tfeegrant.ModuleName,\n\t\tparamstypes.ModuleName,\n\t\tvestingtypes.ModuleName,\n\t\tglobalfee.ModuleName,\n\t\tprovidertypes.ModuleName,\n\t}\n}", "title": "" }, { "docid": "994017e5163f380c6fbb2135782e70d3", "score": "0.5100928", "text": "func sortTriggers(t []*internal.Trigger) {\n\tsort.Slice(t, func(i, j int) bool { return isTriggerOlder(t[i], t[j]) })\n}", "title": "" }, { "docid": "dac23f3c59e734dfd52eb14c42ab5dba", "score": "0.50996256", "text": "func bindOrderNodes(mergedDag map[plumbing.Hash][]*object.Commit) orderer {\n\treturn func(reverse, direction bool) []string {\n\t\tgraph := toposort.NewGraph()\n\t\tkeys := make([]plumbing.Hash, 0, len(mergedDag))\n\t\tfor key := range mergedDag {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t\tsort.Slice(keys, func(i, j int) bool { return keys[i].String() < keys[j].String() })\n\t\tfor _, key := range keys {\n\t\t\tgraph.AddNode(key.String())\n\t\t}\n\t\tfor _, key := range keys {\n\t\t\tchildren := mergedDag[key]\n\t\t\tsort.Slice(children, func(i, j int) bool {\n\t\t\t\treturn children[i].Hash.String() < children[j].Hash.String()\n\t\t\t})\n\t\t\tfor _, c := range children {\n\t\t\t\tif !direction {\n\t\t\t\t\tgraph.AddEdge(key.String(), c.Hash.String())\n\t\t\t\t} else {\n\t\t\t\t\tgraph.AddEdge(c.Hash.String(), key.String())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\torder, ok := graph.Toposort()\n\t\tif !ok {\n\t\t\t// should never happen\n\t\t\tpanic(\"Could not topologically sort the DAG of commits\")\n\t\t}\n\t\tif reverse != direction {\n\t\t\t// one day this must appear in the standard library...\n\t\t\tfor i, j := 0, len(order)-1; i < len(order)/2; i, j = i+1, j-1 {\n\t\t\t\torder[i], order[j] = order[j], order[i]\n\t\t\t}\n\t\t}\n\t\treturn order\n\t}\n}", "title": "" } ]
cf57e76adbb442a1bb60867ce25e02b8
CreateUpdateDomainToDomainGroupResponse creates a response to parse from UpdateDomainToDomainGroup response
[ { "docid": "250f5711839314a1a6d778ac805f1d43", "score": "0.84528494", "text": "func CreateUpdateDomainToDomainGroupResponse() (response *UpdateDomainToDomainGroupResponse) {\n\tresponse = &UpdateDomainToDomainGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "2f55a5cb56c9823f2bb08002938bece0", "score": "0.71909535", "text": "func CreateUpdateDomainToDomainGroupRequest() (request *UpdateDomainToDomainGroupRequest) {\n\trequest = &UpdateDomainToDomainGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Domain\", \"2018-01-29\", \"UpdateDomainToDomainGroup\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "be1ef4ce9c0ab0d7ea673e3b4c102534", "score": "0.6845153", "text": "func CreateUpdateAlertContactGroupResponse() (response *UpdateAlertContactGroupResponse) {\n\tresponse = &UpdateAlertContactGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "d10ac16f170773409fd4a68fdcf3db33", "score": "0.66288894", "text": "func (client *Client) UpdateDomainGroup(args *UpdateDomainGroupArgs) (response *UpdateDomainGroupResponse, err error) {\n\taction := \"UpdateDomainGroup\"\n\tresponse = &UpdateDomainGroupResponse{}\n\terr = client.Invoke(action, args, response)\n\tif err == nil {\n\t\treturn response, nil\n\t} else {\n\t\tlog.Printf(\"%s error, %v\", action, err)\n\t\treturn response, err\n\t}\n}", "title": "" }, { "docid": "ba1c90db3e2e273493721c4bf8b3dea6", "score": "0.63434976", "text": "func CreateModifyGroupResponse() (response *ModifyGroupResponse) {\n\tresponse = &ModifyGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "e4942b3681fc8f7d54a754cf02df8d90", "score": "0.6119814", "text": "func CreateCreateOrUpdateContactGroupResponse() (response *CreateOrUpdateContactGroupResponse) {\n\tresponse = &CreateOrUpdateContactGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "9f6eaccbe28267ffb06604c86f86cb35", "score": "0.6048726", "text": "func CreateUpdateResourceGroupAttributeResponse() (response *UpdateResourceGroupAttributeResponse) {\n\tresponse = &UpdateResourceGroupAttributeResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "0c73b2864bcd97b0d9b01fe4f4ee65f5", "score": "0.59982675", "text": "func (client *Client) UpdateDomainToDomainGroup(request *UpdateDomainToDomainGroupRequest) (response *UpdateDomainToDomainGroupResponse, err error) {\n\tresponse = CreateUpdateDomainToDomainGroupResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "6fd9c17d4f648d61e787bce6189a4751", "score": "0.5804116", "text": "func CreateUpdateFaceUserGroupAndDeviceGroupRelationResponse() (response *UpdateFaceUserGroupAndDeviceGroupRelationResponse) {\n\tresponse = &UpdateFaceUserGroupAndDeviceGroupRelationResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "13a1c2c77144d4d9017cd7bcb2d67cc2", "score": "0.5646376", "text": "func (client *Client) UpdateDomainToDomainGroupWithChan(request *UpdateDomainToDomainGroupRequest) (<-chan *UpdateDomainToDomainGroupResponse, <-chan error) {\n\tresponseChan := make(chan *UpdateDomainToDomainGroupResponse, 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.UpdateDomainToDomainGroup(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": "e4b8cecfe7f1dacb4b16d507904e2f15", "score": "0.5513065", "text": "func CreateCreateEndpointGroupResponse() (response *CreateEndpointGroupResponse) {\n\tresponse = &CreateEndpointGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad986967df7492c2408fc488ea7c8eff", "score": "0.551091", "text": "func (g *Group) Create(groupName string) GroupResponse {\n\tgroupResponse := GroupResponse{}\n\n\tg.makeRequest(http.MethodPost, groupName, &groupResponse)\n\n\treturn groupResponse\n}", "title": "" }, { "docid": "1cd58046747e720e003e3aa5b0e72d04", "score": "0.55076253", "text": "func (c *Client) UpdateDomain(ctx context.Context, domain string, msg *DomainInfo) (*DomainInfoResponse, error) {\n\tendpoint := c.BaseURL.JoinPath(\"domains\", domain, \"update\")\n\n\treq, err := newJSONRequest(ctx, http.MethodPost, endpoint, msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trespData := &DomainInfoResponse{}\n\terr = c.do(req, respData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn respData, nil\n}", "title": "" }, { "docid": "fff9c781dbf45d4d616f4f212b63f0f1", "score": "0.55036265", "text": "func (client *Client) UpdateDomainToDomainGroupWithCallback(request *UpdateDomainToDomainGroupRequest, callback func(response *UpdateDomainToDomainGroupResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *UpdateDomainToDomainGroupResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.UpdateDomainToDomainGroup(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": "82237ce7bf674ab811169fdfe7f1604d", "score": "0.5450187", "text": "func CreateUpdateAggregateCompliancePackResponse() (response *UpdateAggregateCompliancePackResponse) {\n\tresponse = &UpdateAggregateCompliancePackResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "61e5cfdcdde0faf45688b1318db87770", "score": "0.5408521", "text": "func CreateInsertDeployGroupResponse() (response *InsertDeployGroupResponse) {\n\tresponse = &InsertDeployGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "971194f3a658ae15980f8591cdaf3481", "score": "0.5407787", "text": "func NewIgroupCreateResponse() *IgroupCreateResponse { return &IgroupCreateResponse{} }", "title": "" }, { "docid": "9028f765f3eb0db031041ff92baf3adc", "score": "0.537911", "text": "func NewDomainUpdate() *DomainUpdate {\n\tthis := DomainUpdate{}\n\treturn &this\n}", "title": "" }, { "docid": "b99d5436f152fe86191cb84acf967a68", "score": "0.5377043", "text": "func (client *DomainsClient) updateHandleResponse(resp *http.Response) (DomainsClientUpdateResponse, error) {\n\tresult := DomainsClientUpdateResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.Domain); err != nil {\n\t\treturn DomainsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "065bb87d3ecee3aa0f8f205e24397387", "score": "0.5358072", "text": "func (s *RegistrarAPI) UpdateDomain(req *RegistrarAPIUpdateDomainRequest, opts ...scw.RequestOption) (*Domain, error) {\n\tvar err error\n\n\tif fmt.Sprint(req.Domain) == \"\" {\n\t\treturn nil, errors.New(\"field Domain cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"PATCH\",\n\t\tPath: \"/domain/v2beta1/domains/\" + fmt.Sprint(req.Domain) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Domain\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "e47b84127ebc69bb0752968d2d63bbc9", "score": "0.5318153", "text": "func (a *GroupingObjectsNsGroupsApiService) UpdateNSGroup(ctx context.Context, nsGroupId string, nSGroup model.NsGroup) (model.NsGroup, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue model.NsGroup\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ns-groups/{ns-group-id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ns-group-id\"+\"}\", fmt.Sprintf(\"%v\", nsGroupId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &nSGroup\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v model.NsGroup\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 403 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 412 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 503 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "e5fdf2db28b90cbb2adaa471cab817ad", "score": "0.53168344", "text": "func CreateUpdateAlertContactGroupRequest() (request *UpdateAlertContactGroupRequest) {\n\trequest = &UpdateAlertContactGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"UpdateAlertContactGroup\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "a7bcaafaa1ca4ab2fe7143986bd9b58a", "score": "0.5316029", "text": "func updateFunc(cmd *cobra.Command, args []string) {\n\tid := cmd.Flag(\"id\").Value.String()\n\tname := cmd.Flag(\"name\").Value.String()\n\n\tif id == \"\" || name == \"\" {\n\t\tpanic(\"GroupID and GroupName is mandatory for this action.\")\n\t}\n\n\tresp, err := app.Client.UpdateDomainGroup(\n\t\tid, name,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, _ := convert.StringToJSONWithIndent(string(resp))\n\tfmt.Println(data)\n}", "title": "" }, { "docid": "afbc1781c2e8893043add4926334198b", "score": "0.5299212", "text": "func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, domainName string, domain DomainPatchResource, options *DomainsClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif domainName == \"\" {\n\t\treturn nil, errors.New(\"parameter domainName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{domainName}\", url.PathEscape(domainName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, domain)\n}", "title": "" }, { "docid": "9c896d221c724ab08faca2cd4f74b41e", "score": "0.5282632", "text": "func CreateDescribeContactGroupListResponse() (response *DescribeContactGroupListResponse) {\n\tresponse = &DescribeContactGroupListResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "79e69e5f2fe877279e4012ca201075f6", "score": "0.52457404", "text": "func (t *ThingGroupHandler) HandleUpdateGroup(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", t.ContentType)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tctx := helpers.GetContext(r)\n\tgroup := models.ThingGroup{}\n\tif err := json.NewDecoder(r.Body).Decode(&group); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tbytes, err := json.Marshal(group)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\trsp, err := t.ThingGroupSvc.UpdateGroup(ctx, &pb.ThingGroup{Item: bytes})\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(rsp.GetItem())\n}", "title": "" }, { "docid": "7ed98fe132909cec427d9e9a3ed47f29", "score": "0.52217704", "text": "func CreateUpdateIpSetsResponse() (response *UpdateIpSetsResponse) {\n\tresponse = &UpdateIpSetsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "0acb7baafbb4a8498774f80476c7b751", "score": "0.5189315", "text": "func CreateDescribeJobGroupResponse() (response *DescribeJobGroupResponse) {\n\tresponse = &DescribeJobGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "8542df8855329bf6dd29c71f1e4921ee", "score": "0.51795495", "text": "func CreateModifyScalingRuleResponse() (response *ModifyScalingRuleResponse) {\n\tresponse = &ModifyScalingRuleResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "2db55fb7a3ed205e62446a5634d8d0af", "score": "0.5161356", "text": "func CreateModifyMonitorGroupInstancesResponse() (response *ModifyMonitorGroupInstancesResponse) {\n\tresponse = &ModifyMonitorGroupInstancesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "4d2618d1e2d08be82d78293793cf9bd3", "score": "0.5160462", "text": "func (s Service) UpdateGroup(c context.Context, in *proto.UpdateGroupRequest, out *proto.Group) (err error) {\n\treturn merrors.InternalServerError(s.id, \"not implemented\")\n}", "title": "" }, { "docid": "4d2618d1e2d08be82d78293793cf9bd3", "score": "0.5160462", "text": "func (s Service) UpdateGroup(c context.Context, in *proto.UpdateGroupRequest, out *proto.Group) (err error) {\n\treturn merrors.InternalServerError(s.id, \"not implemented\")\n}", "title": "" }, { "docid": "655c5940407fc340b58a0085164424cd", "score": "0.5145688", "text": "func (c *restClient) UpdateGroup(ctx context.Context, req *vmmigrationpb.UpdateGroupRequest, opts ...gax.CallOption) (*UpdateGroupOperation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetGroup()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v\", req.GetGroup().GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetRequestId() != \"\" {\n\t\tparams.Add(\"requestId\", fmt.Sprintf(\"%v\", req.GetRequestId()))\n\t}\n\tif req.GetUpdateMask() != nil {\n\t\tupdateMask, err := protojson.Marshal(req.GetUpdateMask())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams.Add(\"updateMask\", string(updateMask[1:len(updateMask)-1]))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"group.name\", url.QueryEscape(req.GetGroup().GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"PATCH\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &UpdateGroupOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "title": "" }, { "docid": "bf3a4f2fd7d620cc54a1a1f9021aad47", "score": "0.51450074", "text": "func CreateUpdateCompliancePackResponse() (response *UpdateCompliancePackResponse) {\n\tresponse = &UpdateCompliancePackResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "ff45c5c12a561d398b1ce3bfceae5d00", "score": "0.514282", "text": "func CreateCreateContainerGroupResponse() (response *CreateContainerGroupResponse) {\n\tresponse = &CreateContainerGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "7cc89ca454d93ef0bfdafeb38dff09d1", "score": "0.5142612", "text": "func (a *GroupingObjectsNsGroupsApiService) CreateNSGroup(ctx context.Context, nSGroup model.NsGroup) (model.NsGroup, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue model.NsGroup\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ns-groups\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &nSGroup\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 201 {\n\t\t\tvar v model.NsGroup\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 403 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 404 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 412 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 503 {\n\t\t\tvar v model.ApiError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "615d5c67dc7f431b41dbace0e9317038", "score": "0.5132457", "text": "func (c *restClient) CreateGroup(ctx context.Context, req *vmmigrationpb.CreateGroupRequest, opts ...gax.CallOption) (*CreateGroupOperation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetGroup()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/groups\", req.GetParent())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tparams.Add(\"groupId\", fmt.Sprintf(\"%v\", req.GetGroupId()))\n\tif req.GetRequestId() != \"\" {\n\t\tparams.Add(\"requestId\", fmt.Sprintf(\"%v\", req.GetRequestId()))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"parent\", url.QueryEscape(req.GetParent()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &CreateGroupOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "title": "" }, { "docid": "cda2d3c661ecf7668caf311bc0aaafe8", "score": "0.5130818", "text": "func (client DashboardGroupClient) UpdateDashboardGroup(ctx context.Context, request UpdateDashboardGroupRequest) (response UpdateDashboardGroupResponse, 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.updateDashboardGroup, 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 = UpdateDashboardGroupResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateDashboardGroupResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateDashboardGroupResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateDashboardGroupResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "2f31776b82a03d26f9d89983796ec209", "score": "0.512295", "text": "func (g Graph) PatchGroup(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tlogger.Info().Msg(\"calling patch group\")\n\tgroupID := chi.URLParam(r, \"groupID\")\n\tgroupID, err := url.PathUnescape(groupID)\n\tif err != nil {\n\t\tlogger.Debug().Str(\"id\", groupID).Msg(\"could not change group: unescaping group id failed\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"unescaping group id failed\")\n\t\treturn\n\t}\n\n\tif groupID == \"\" {\n\t\tlogger.Debug().Msg(\"could not change group: missing group id\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"missing group id\")\n\t\treturn\n\t}\n\tchanges := libregraph.NewGroup()\n\terr = StrictJSONUnmarshal(r.Body, changes)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"body\", r.Body).Msg(\"could not change group: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\n\tif reflect.ValueOf(*changes).IsZero() {\n\t\tlogger.Debug().Interface(\"body\", r.Body).Msg(\"ignoring empyt request body\")\n\t\trender.Status(r, http.StatusNoContent)\n\t\trender.NoContent(w, r)\n\t\treturn\n\t}\n\n\tif changes.HasDisplayName() {\n\t\tdisplayName := changes.GetDisplayName()\n\t\tif !isValidGroupName(displayName) {\n\t\t\tlogger.Info().Str(\"group\", displayName).Msg(\"could not update group: invalid displayName\")\n\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Invalid displayName\")\n\t\t\treturn\n\t\t}\n\t\tif err = g.identityBackend.UpdateGroupName(r.Context(), groupID, displayName); err != nil {\n\t\t\tlogger.Debug().Err(err).Msg(\"could not update group displayName\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif memberRefs, ok := changes.GetMembersodataBindOk(); ok {\n\t\t// The spec defines a limit of 20 members maxium per Request\n\t\tif len(memberRefs) > g.config.API.GroupMembersPatchLimit {\n\t\t\tlogger.Debug().\n\t\t\t\tInt(\"number\", len(memberRefs)).\n\t\t\t\tInt(\"limit\", g.config.API.GroupMembersPatchLimit).\n\t\t\t\tMsg(\"could not add group members, exceeded members limit\")\n\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest,\n\t\t\t\tfmt.Sprintf(\"Request is limited to %d members\", g.config.API.GroupMembersPatchLimit))\n\t\t\treturn\n\t\t}\n\t\tmemberIDs := make([]string, 0, len(memberRefs))\n\t\tfor _, memberRef := range memberRefs {\n\t\t\tmemberType, id, err := g.parseMemberRef(memberRef)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Debug().\n\t\t\t\t\tStr(\"memberref\", memberRef).\n\t\t\t\t\tMsg(\"could not change group: Error parsing member@odata.bind values\")\n\t\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Error parsing member@odata.bind values\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlogger.Debug().Str(\"membertype\", memberType).Str(\"memberid\", id).Msg(\"add group member\")\n\t\t\t// The MS Graph spec allows \"directoryObject\", \"user\", \"group\" and \"organizational Contact\"\n\t\t\t// we restrict this to users for now. Might add Groups as members later\n\t\t\tif memberType != memberTypeUsers {\n\t\t\t\tlogger.Debug().\n\t\t\t\t\tStr(\"type\", memberType).\n\t\t\t\t\tMsg(\"could not change group: could not add member, only user type is allowed\")\n\t\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Only user are allowed as group members\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmemberIDs = append(memberIDs, id)\n\t\t}\n\t\tif err = g.identityBackend.AddMembersToGroup(r.Context(), groupID, memberIDs); err != nil {\n\t\t\tlogger.Debug().Err(err).Msg(\"could not change group: backend could not add members\")\n\t\t\terrorcode.RenderError(w, r, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\trender.Status(r, http.StatusNoContent) // TODO StatusNoContent when prefer=minimal is used, otherwise OK and the resource in the body\n\trender.NoContent(w, r)\n}", "title": "" }, { "docid": "7fb57cf7a00064aa45765b73d42050c9", "score": "0.510188", "text": "func (client *ResourceGroupsClient) updateHandleResponse(resp *http.Response) (ResourceGroupsClientUpdateResponse, error) {\n\tresult := ResourceGroupsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil {\n\t\treturn ResourceGroupsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e48329f97724ccc0f44ecaa78d124671", "score": "0.50965196", "text": "func (client *ResourceGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ResourceGroupsClientCreateOrUpdateResponse, error) {\n\tresult := ResourceGroupsClientCreateOrUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil {\n\t\treturn ResourceGroupsClientCreateOrUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0655d0cb64a5aa93a655e31083b1f1cd", "score": "0.50888175", "text": "func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters UpdateDomainRequestParameters, options *DomainsClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif emailServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter emailServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{emailServiceName}\", url.PathEscape(emailServiceName))\n\tif domainName == \"\" {\n\t\treturn nil, errors.New(\"parameter domainName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{domainName}\", url.PathEscape(domainName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-31\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "992523c2a8e0073af0bf233f266105a5", "score": "0.50834423", "text": "func CreateUpdateEnvHttpTrafficControlResponse() (response *UpdateEnvHttpTrafficControlResponse) {\n\tresponse = &UpdateEnvHttpTrafficControlResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "0fa40580fa07a7b8c570400dde823bc1", "score": "0.50799775", "text": "func CreateAddUserToDesktopGroupResponse() (response *AddUserToDesktopGroupResponse) {\n\tresponse = &AddUserToDesktopGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "4900f8b45657fae62559a368a3061a64", "score": "0.5068405", "text": "func CreateDescribeDomainResponse() (response *DescribeDomainResponse) {\n\tresponse = &DescribeDomainResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "e8c2581df3df4cbb73df149ef375265f", "score": "0.5067045", "text": "func CreateDescribeDcdnIpaUserDomainsResponse() (response *DescribeDcdnIpaUserDomainsResponse) {\n\tresponse = &DescribeDcdnIpaUserDomainsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ca6cf495d6de983f72eea7dc88cd21a", "score": "0.5060474", "text": "func CreateDescribeUsersInGroupResponse() (response *DescribeUsersInGroupResponse) {\n\tresponse = &DescribeUsersInGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "ecb7c14018cc81e1d241b7d1b21473d4", "score": "0.50534075", "text": "func UpdateGroup(c *fiber.Ctx) {\n\tc.Accepts(\"json\", \"text\")\n\tc.Accepts(\"application/json\")\n\tif (c.Get(\"Content-Type\") != \"application/json\") && (c.Get(\"Content-Type\") != \"json\") {\n\t\tlog.Println(\"UpdateGroup: Content-Type header for json must be present\")\n\t\tc.Status(400).Send(\"Missing/incorrect Content-Type header\")\n\t\treturn\n\t}\n\n\t// get group name and validate\n\tname := c.Params(\"name\")\n\tmatched, err := regexp.MatchString(`^[A-Za-z0-9]+$`, name)\n\tif err != nil || !matched {\n\t\tlog.Printf(\"UpdateGroup: invalid group name: %s\", name)\n\t\tc.Status(400).Send(\"Invalid group name\")\n\t\treturn\n\t}\n\n\tdatabase := db.DBConn\n\n\t//valid group name, check if it already exists\n\tvar existing Group\n\tdatabase.Where(\"name = ?\", name).First(&existing)\n\tif existing.Name == \"\" {\n\t\tlog.Printf(\"UpdateGroup: Group does not exist: %s\", name)\n\t\tc.Status(404).Send(\"Group does not exist\" + name)\n\t\treturn\n\t}\n\n\t// validate userids and check users exist\n\tuserIDs := new(UserIDs)\n\tif err := c.BodyParser(userIDs); err != nil {\n\t\tlog.Printf(\"UpdateGroup: Group body invalid: %s\", name)\n\t\tc.Status(400).Send(err)\n\t\treturn\n\t}\n\n\tnewUseridMap := make(map[string]bool)\n\t// generate map for new userids and check users exist\n\tfor _, userid := range userIDs.UserID {\n\t\tnewUseridMap[userid] = true\n\t\tlog.Printf(\"adding %s userid to new userid map\", userid)\n\t\t//check if user exists, fail out if it does not\n\t\tif !CheckUserExists(userid) {\n\t\t\tlog.Printf(\"UpdateGroup: User does not exist: %s\", userid)\n\t\t\tc.Status(404).Send(\"Cannot update group, user does not exist \" + userid)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check existing ids with new map, create existing map\n\texistingUseridMap := make(map[string]bool)\n\texistingUserids := GetAssociationsByGroupName(name).UserID\n\tfor _, userid := range existingUserids {\n\t\texistingUseridMap[userid] = true\n\t\t// membership has changed, delete existing association\n\t\tif !newUseridMap[userid] {\n\t\t\tlog.Printf(\"deleting %s userid association, not in new map\", userid)\n\t\t\tDeleteAssociationByID(userid + name)\n\t\t}\n\t}\n\n\t// check new userids and if they are not on the existing map add them\n\tfor _, userid := range userIDs.UserID {\n\t\tif !existingUseridMap[userid] {\n\t\t\tlog.Printf(\"creating %s and %s association not in existing map\", userid, name)\n\t\t\tCreateAssociation(userid, name)\n\t\t}\n\t}\n\n\tc.JSON(userIDs)\n}", "title": "" }, { "docid": "9ddacc06b529102b7d2dda78a96eb3fd", "score": "0.503819", "text": "func (client *Client) AddDomainGroup(args *AddDomainGroupArgs) (response *AddDomainGroupResponse, err error) {\n\taction := \"AddDomainGroup\"\n\tresponse = &AddDomainGroupResponse{}\n\terr = client.Invoke(action, args, response)\n\tif err == nil {\n\t\treturn response, nil\n\t} else {\n\t\tlog.Printf(\"%s error, %v\", action, err)\n\t\treturn response, err\n\t}\n}", "title": "" }, { "docid": "56112a406e63c753a2178e2932d9cccf", "score": "0.50306386", "text": "func (client DashboardGroupClient) updateDashboardGroup(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/dashboardGroups/{dashboardGroupId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateDashboardGroupResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/dashboard/20210731/DashboardGroup/UpdateDashboardGroup\"\n\t\terr = common.PostProcessServiceError(err, \"DashboardGroup\", \"UpdateDashboardGroup\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "65f80061dec1f2bd074f642740b7f0c2", "score": "0.50189024", "text": "func NewIgroupAddResponse() *IgroupAddResponse { return &IgroupAddResponse{} }", "title": "" }, { "docid": "ee1d46ac283a4f519810a182bb8c716f", "score": "0.5017812", "text": "func NewSyncGroupResponse() SyncGroupResponse {\n\tvar v SyncGroupResponse\n\tv.Default()\n\treturn v\n}", "title": "" }, { "docid": "84b8bce3c8166a0d3c9ec0bd73805835", "score": "0.50077873", "text": "func (a *PlatformApiService) PlatformAgentGroupUpdate(ctx context.Context, body []float64, groupId int32) (InlineResponse204, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse204\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/platform/network/agent-groups/{group_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"group_id\"+\"}\", fmt.Sprintf(\"%v\", groupId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 204 {\n\t\t\tvar v InlineResponse204\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "30e63b5e53b43766f74c9eb86f804b58", "score": "0.49995914", "text": "func NewUpdateResponse() *organizationpb.UpdateResponse {\n\tmessage := &organizationpb.UpdateResponse{}\n\treturn message\n}", "title": "" }, { "docid": "eacaf147704bcbbc9c9f23e9a0de252c", "score": "0.4988996", "text": "func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (CapacityReservationGroupsClientCreateOrUpdateResponse, error) {\n\tresult := CapacityReservationGroupsClientCreateOrUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil {\n\t\treturn CapacityReservationGroupsClientCreateOrUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c6ab8b69eca48eb50a942fa472f86eef", "score": "0.4988876", "text": "func GroupUpdate(c *gin.Context) {\n\tvar group models.Group\n\tbuffer, err := ioutil.ReadAll(c.Request.Body)\n\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusNotAcceptable, err)\n\t}\n\n\terr2 := jsonapi.Unmarshal(buffer, &group)\n\n\tif err2 != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err).\n\t\t\tSetMeta(appError.JSONParseFailure)\n\t\treturn\n\t}\n\n\t// Little hack-ish\n\t// Remove all current relations\n\tdatabase.DBCon.Exec(\"DELETE FROM group_users WHERE group_id = ?\", group.ID)\n\t// Add all the given relations\n\tfor _, c := range group.UserIDs {\n\t\tdatabase.DBCon.\n\t\t\tExec(\"INSERT INTO group_users (group_id, user_id) VALUES (?, ?)\",\n\t\t\t\tgroup.ID, c)\n\t}\n\n\tdatabase.DBCon.First(&group, group.ID)\n\tdatabase.DBCon.Model(&group).Related(&group.Users, \"Users\")\n\n\tdata, err := jsonapi.Marshal(group)\n\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err).\n\t\t\tSetMeta(appError.JSONParseFailure)\n\t\treturn\n\t}\n\n\tc.Data(http.StatusOK, \"application/vnd.api+json\", data)\n}", "title": "" }, { "docid": "e3ec1767177e9131fdc7174d3b8fe333", "score": "0.4986849", "text": "func CreateUpdateChannelResponse() (response *UpdateChannelResponse) {\n\tresponse = &UpdateChannelResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "7f85d327d0647ebd235adc7b60218da3", "score": "0.49592182", "text": "func (g Graph) PostGroup(w http.ResponseWriter, r *http.Request) {\n\tlogger := g.logger.SubloggerWithRequestID(r.Context())\n\tlogger.Info().Msg(\"calling post group\")\n\tgrp := libregraph.NewGroup()\n\terr := StrictJSONUnmarshal(r.Body, grp)\n\tif err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"body\", r.Body).Msg(\"could not create group: invalid request body\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf(\"invalid request body: %s\", err.Error()))\n\t\treturn\n\t}\n\n\tif displayName, ok := grp.GetDisplayNameOk(); ok {\n\t\tif !isValidGroupName(*displayName) {\n\t\t\tlogger.Info().Str(\"group\", *displayName).Msg(\"could not create group: invalid displayName\")\n\t\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Invalid displayName\")\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tlogger.Debug().Err(err).Interface(\"group\", grp).Msg(\"could not create group: missing required attribute\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"Missing Required Attribute\")\n\t\treturn\n\t}\n\n\t// Disallow user-supplied IDs. It's supposed to be readonly. We're either\n\t// generating them in the backend ourselves or rely on the Backend's\n\t// storage (e.g. LDAP) to provide a unique ID.\n\tif _, ok := grp.GetIdOk(); ok {\n\t\tlogger.Debug().Msg(\"could not create group: id is a read-only attribute\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, \"group id is a read-only attribute\")\n\t\treturn\n\t}\n\n\tif grp, err = g.identityBackend.CreateGroup(r.Context(), *grp); err != nil {\n\t\tlogger.Debug().Err(err).Interface(\"group\", grp).Msg(\"could not create group: backend error\")\n\t\terrorcode.RenderError(w, r, err)\n\t\treturn\n\t}\n\n\tif grp != nil && grp.Id != nil {\n\t\te := events.GroupCreated{\n\t\t\tGroupID: grp.GetId(),\n\t\t}\n\t\tif currentUser, ok := revactx.ContextGetUser(r.Context()); ok {\n\t\t\te.Executant = currentUser.GetId()\n\t\t}\n\t\tg.publishEvent(r.Context(), e)\n\t}\n\trender.Status(r, http.StatusOK) // FIXME 201 should return 201 created\n\trender.JSON(w, r, grp)\n}", "title": "" }, { "docid": "502cd9fc655af4de953924136b05df71", "score": "0.49570405", "text": "func CreateUpdateTenantResponse() (response *UpdateTenantResponse) {\n\tresponse = &UpdateTenantResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "b004284acc75e6b094521b3648f54a7d", "score": "0.4935955", "text": "func (client *CapacityReservationGroupsClient) updateHandleResponse(resp *http.Response) (CapacityReservationGroupsClientUpdateResponse, error) {\n\tresult := CapacityReservationGroupsClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil {\n\t\treturn CapacityReservationGroupsClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ce6e890181fe45590926e508b306675f", "score": "0.49352828", "text": "func ParsePostGroupsResponse(rsp *http.Response) (*PostGroupsResponse, 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 := &PostGroupsResponse{\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 == 201:\n\t\tvar dest GroupInfoResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "2370d57521bbdb9bb12114bc7fe40424", "score": "0.49312985", "text": "func (c DomainClient) UpdateDomain(domain Domain) (Domain, error) {\n\tvar updated Domain\n\n\tpayload, err := json.Marshal(&domain)\n\tif err != nil {\n\t\treturn updated, errors.Wrap(err, \"failed to marshal request for UpdateDomain\")\n\t}\n\n\tdata, err := c.api.Put(fmt.Sprintf(\"domains/%d\", domain.ID), payload)\n\tif err != nil {\n\t\treturn updated, errors.Wrap(err, \"failed to make request for UpdateDomain\")\n\t}\n\n\tif err := json.Unmarshal(data, &updated); err != nil {\n\t\treturn updated, errors.Wrap(err, \"failed to decode UpdateDomain response\")\n\t}\n\n\treturn updated, nil\n\n}", "title": "" }, { "docid": "1543c04a623ef4eeaf84fb1654f17266", "score": "0.49245816", "text": "func ParsePatchGroupsIdResponse(rsp *http.Response) (*PatchGroupsIdResponse, 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 := &PatchGroupsIdResponse{\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 GroupInfoResponse\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": "e73ef1963dca2ebb522025c5b34ed74e", "score": "0.4924217", "text": "func (g *Group) Post(rw http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tb, err := readRequestBody(r)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"fail to read request body\")\n\t\twriteResponse(rw, badRequestResponse)\n\t}\n\n\tvar gr createGroupRequest\n\tif err = json.Unmarshal(b, &gr); err != nil {\n\t\tlog.WithError(err).Error(\"fail to unmarshal request body\")\n\t\twriteResponse(rw, badRequestResponse)\n\t\treturn\n\t}\n\n\tgroup, err := g.groupSvc.Create(ctx, config.Group{Name: gr.Name})\n\tif err != nil {\n\t\tif err == config.ErrRequiredField {\n\t\t\tlog.WithError(err).Error(\"no config group created\")\n\t\t\twriteResponse(rw, badRequestResponse)\n\t\t\treturn\n\t\t}\n\n\t\tlog.WithError(err).Error(\"fail to create config group\")\n\t\twriteResponse(rw, internalServerErrorResponse)\n\t\treturn\n\t}\n\n\twriteResponse(rw, makeGroupResponse([]config.Group{group}))\n\treturn\n}", "title": "" }, { "docid": "bd3df2e92a61c68a77f470e5a62f0339", "score": "0.49221063", "text": "func CreateUpdateLiveRecordVodConfigResponse() (response *UpdateLiveRecordVodConfigResponse) {\n\tresponse = &UpdateLiveRecordVodConfigResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "833fbde5e8546d1a28357262311b97ef", "score": "0.49196538", "text": "func (a *TestFlightApiService) ModifyBetaGroup(ctx _context.Context, id string, localVarOptionals *ModifyBetaGroupOpts) (BetaGroupResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue BetaGroupResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/betaGroups/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", id)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.BetaGroupUpdateRequest.IsSet() {\n\t\tlocalVarOptionalBetaGroupUpdateRequest, localVarOptionalBetaGroupUpdateRequestok := localVarOptionals.BetaGroupUpdateRequest.Value().(BetaGroupUpdateRequest)\n\t\tif !localVarOptionalBetaGroupUpdateRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"betaGroupUpdateRequest should be BetaGroupUpdateRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalBetaGroupUpdateRequest\n\t}\n\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn 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 BetaGroupResponse\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 CommonErrorResponse\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 CommonErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v CommonErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v CommonErrorResponse\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": "89f0135ee971873dfd14cd0dc64fbaa8", "score": "0.49141854", "text": "func (ws *webserver) handlePutGroup(w http.ResponseWriter, r *http.Request) error {\n\t(w).Header().Set(\"Access-Control-Allow-Origin\", CORS_URL)\n\n\t(w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t(w).Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t(w).Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t// get url params\n\tvars := mux.Vars(r)\n\tgroupsID := strconv.Quote(vars[\"groupID\"])\n\tif groupsID == \"\" {\n\t\treturn &invalidRequest{}\n\t}\n\tfmt.Println(groupsID, \"groupsID\")\n\tcheck, err := strconv.Unquote(groupsID)\n\tfmt.Println(check, err, \"Checkid\")\n\n\t// create var ready to hold decoded json from body\n\tvar request models.GroupUpdateRequest\n\tfmt.Println(request, \"request\")\n\t// decode body\n\tdec := json.NewDecoder(r.Body)\n\tif err := dec.Decode(&request); err != nil {\n\t\treturn &invalidRequest{}\n\t}\n\n\t// update contact\n\tupdate := models.MapUpdateGroupRequest(check, request)\n\tgroupUpdate, err := ws.db.Groups.Update(update)\n\tfmt.Println(groupUpdate, \"groupUpdate\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create response\n\tresponse := models.MapGroupResponse(groupUpdate, 0)\n\tfmt.Println(response, \"response\")\n\n\treturn Ok(w, response)\n}", "title": "" }, { "docid": "c61cb6c7dde67fe94cdaf6eec9e6ae66", "score": "0.49137342", "text": "func (c *Client) UpdateDomain(i *UpdateDomainInput) (*Domain, error) {\n\tif i.Service == \"\" {\n\t\treturn nil, ErrMissingService\n\t}\n\n\tif i.Version == 0 {\n\t\treturn nil, ErrMissingVersion\n\t}\n\n\tif i.Name == \"\" {\n\t\treturn nil, ErrMissingName\n\t}\n\n\tpath := fmt.Sprintf(\"/service/%s/version/%d/domain/%s\", i.Service, i.Version, url.PathEscape(i.Name))\n\tresp, err := c.PutForm(path, i, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar d *Domain\n\tif err := decodeBodyMap(resp.Body, &d); err != nil {\n\t\treturn nil, err\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "2f2543d4e465a259ecdbbf4bf6b5a9d7", "score": "0.49075267", "text": "func createVdcGroup(adminOrg *AdminOrg, vdcGroup *types.VdcGroup,\n\tadditionalHeader map[string]string) (*VdcGroup, error) {\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointVdcGroups\n\tapiVersion, err := adminOrg.client.checkOpenApiEndpointCompatibility(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turlRef, err := adminOrg.client.OpenApiBuildEndpoint(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttypeResponse := &VdcGroup{\n\t\tVdcGroup: &types.VdcGroup{},\n\t\tclient: adminOrg.client,\n\t\tHref: urlRef.String(),\n\t\tparent: adminOrg,\n\t}\n\n\terr = adminOrg.client.OpenApiPostItem(apiVersion, urlRef, nil,\n\t\tvdcGroup, typeResponse.VdcGroup, additionalHeader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn typeResponse, nil\n}", "title": "" }, { "docid": "5e5ede4392bceb50d46ae83dfbbdfcb1", "score": "0.48865566", "text": "func (a *Client) PatchDomainsDomain(params *PatchDomainsDomainParams, authInfo runtime.ClientAuthInfoWriter) (*PatchDomainsDomainOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchDomainsDomainParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PatchDomainsDomain\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/domains/{domain}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PatchDomainsDomainReader{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.(*PatchDomainsDomainOK), nil\n\n}", "title": "" }, { "docid": "250c73129b3308e15a5691d5dbc08020", "score": "0.48811433", "text": "func CreateListServerGroupServersResponse() (response *ListServerGroupServersResponse) {\n\tresponse = &ListServerGroupServersResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "f96e77fe346529acf657f0797b137c95", "score": "0.48744333", "text": "func (r *dpRepo) CreateDomain(domainName string) error {\n\tlogging.LogDebugf(\"repo/dp/CreateDomain('%s')\", domainName)\n\n\tswitch r.dataPowerAppliance.DpManagmentInterface() {\n\tcase config.DpInterfaceRest:\n\t\treturn errs.Errorf(\"Can't create domain using REST management interface.\")\n\tcase config.DpInterfaceSoma:\n\t\tsomaRequest := fmt.Sprintf(`<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n\txmlns:man=\"http://www.datapower.com/schemas/management\">\n\t<soapenv:Header/>\n\t<soapenv:Body>\n\t\t<man:request>\n\t\t\t<man:set-config>\n\t\t\t\t<Domain name=\"%s\">\n\t\t\t\t\t<NeighborDomain class=\"Domain\">default</NeighborDomain>\n\t\t\t\t</Domain>\n\t\t\t</man:set-config>\n\t\t</man:request>\n\t</soapenv:Body>\n</soapenv:Envelope>`, domainName)\n\t\tlogging.LogDebugf(\"repo/dp/CreateDomain(), somaRequest: '%s'\", somaRequest)\n\t\tsomaResponse, err := r.soma(somaRequest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogging.LogDebugf(\"repo/dp/CreateDomain(), somaResponse: '%s'\", somaResponse)\n\t\tresultMsg, err := parseSOMAFindOne(somaResponse, \"//*[local-name()='response']/*[local-name()='result']\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resultMsg != \"OK\" {\n\t\t\treturn errs.Errorf(\"Unexpected result of SOMA update: '%s'.\", resultMsg)\n\t\t}\n\n\t\treturn nil\n\tdefault:\n\t\tlogging.LogDebug(\"repo/dp/CreateDomain(), using neither REST neither SOMA.\")\n\t\treturn errs.Error(\"DataPower management interface not set.\")\n\t}\n}", "title": "" }, { "docid": "46dfaf8b7f1ff29af404743cbb6193cb", "score": "0.48723578", "text": "func handleCreateGroup(c *Context, w http.ResponseWriter, r *http.Request) {\n\tcreateGroupRequest, err := model.NewCreateGroupRequestFromReader(r.Body)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to decode request\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tgroup := model.Group{\n\t\tName: createGroupRequest.Name,\n\t\tDescription: createGroupRequest.Description,\n\t\tVersion: createGroupRequest.Version,\n\t}\n\n\terr = c.Store.CreateGroup(&group)\n\tif err != nil {\n\t\tc.Logger.WithError(err).Error(\"failed to create group\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc.Supervisor.Do()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\toutputJSON(c, w, group)\n}", "title": "" }, { "docid": "8ac9f5b6ebc9bf2acc48313abd8ac17e", "score": "0.4845665", "text": "func CreateUpdateRemediationResponse() (response *UpdateRemediationResponse) {\n\tresponse = &UpdateRemediationResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a35ea1c24c72572c499659d92dea5ff", "score": "0.48322764", "text": "func NewJoinGroupResponse() JoinGroupResponse {\n\tvar v JoinGroupResponse\n\tv.Default()\n\treturn v\n}", "title": "" }, { "docid": "1448eb18012a66983714ff943cef6665", "score": "0.48320636", "text": "func Update(client *golangsdk.ServiceClient, id string, opts CreateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToAPICreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = client.Put(groupURL(client, id), b, &r.Body, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\treturn\n}", "title": "" }, { "docid": "d05defe83347cc5ce71ed23b100f2fd3", "score": "0.48147494", "text": "func CreatePutDcdnKvResponse() (response *PutDcdnKvResponse) {\n\tresponse = &PutDcdnKvResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb4bfda2a7f99a7fb576b147ff0912b2", "score": "0.48044714", "text": "func (a *RemoteProcessGroupsApiService) UpdateRemoteProcessGroupOutputPortExecute(r RemoteProcessGroupsApiApiUpdateRemoteProcessGroupOutputPortRequest) (RemoteProcessGroupPortEntity, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue RemoteProcessGroupPortEntity\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RemoteProcessGroupsApiService.UpdateRemoteProcessGroupOutputPort\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/remote-process-groups/{id}/output-ports/{port-id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(r.id, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"port-id\"+\"}\", _neturl.PathEscape(parameterToString(r.portId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.body\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": "0a640dc1841499c2e7cc677acf1d73de", "score": "0.47943938", "text": "func CreateModifyGroupRequest() (request *ModifyGroupRequest) {\n\trequest = &ModifyGroupRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"vs\", \"2018-12-12\", \"ModifyGroup\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "220ea520b7cfc9e3b9370b48667d492b", "score": "0.47913808", "text": "func UpdateWebhookScaleUpResponse(nodeGroup string, desired int) {\n\twebhookScaleUpResponse.WithLabelValues(nodeGroup).Set(float64(desired))\n}", "title": "" }, { "docid": "861e0d2ca9def3c57112422deee45ef6", "score": "0.47821662", "text": "func (a *RemoteProcessGroupsApiService) UpdateRemoteProcessGroupExecute(r RemoteProcessGroupsApiApiUpdateRemoteProcessGroupRequest) (RemoteProcessGroupEntity, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue RemoteProcessGroupEntity\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"RemoteProcessGroupsApiService.UpdateRemoteProcessGroup\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/remote-process-groups/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(r.id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.body\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": "318584c710f3f939092751722e0b2a04", "score": "0.47792652", "text": "func (r *PlannerGroupRequest) Update(ctx context.Context, reqObj *PlannerGroup) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "50643c74e3268346d896fa0045d25c91", "score": "0.47769856", "text": "func (t *ThingGroupHandler) HandleCreateGroup(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", t.ContentType)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tctx := helpers.GetContext(r)\n\tgroup := new(models.ThingGroup)\n\tif err := json.NewDecoder(r.Body).Decode(group); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tbytes, err := json.Marshal(group)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\trsp, err := t.ThingGroupSvc.CreateGroup(ctx, &pb.ThingGroup{Item: bytes})\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Write(rsp.GetItem())\n}", "title": "" }, { "docid": "3f34adc4d79d49b5673a623aa826de64", "score": "0.47618252", "text": "func CreateDescribeRiskEventGroupResponse() (response *DescribeRiskEventGroupResponse) {\n\tresponse = &DescribeRiskEventGroupResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "e01322f31a372c237d111b184f5f35e5", "score": "0.47416103", "text": "func CreateDescribeDomainOverviewResponse() (response *DescribeDomainOverviewResponse) {\n\tresponse = &DescribeDomainOverviewResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "cbe8958e5e23ee3a71dea81478be73ee", "score": "0.4730832", "text": "func (uc *UsrGroupController) Update(w http.ResponseWriter, r *http.Request) {\n\n\t// get the parameter(s)\n\tvars := mux.Vars(r)\n\tid, err := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tif err != nil {\n\t\tlw.Warning(\"User Group Update:\", err)\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid usrgroup id\")\n\t\treturn\n\t}\n\n\tvar u models.UsrGroup\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&u); err != nil {\n\t\tlw.Warning(\"User Group Update:\", err)\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\t// fill the model\n\tusrgroup := models.UsrGroup{\n\t\tGroupName: u.GroupName,\n\t\tDescription: u.Description,\n\t}\n\n\t// build a base urlString for the JSON Body self-referencing Href tag\n\turlString := buildHrefStringFromCRUDReq(r, false)\n\n\tusrgroup.ID = id\n\n\t// call the update method on the model\n\terr = uc.us.Update(&usrgroup)\n\tif err != nil {\n\t\tlw.ErrorWithPrefixString(\"User Group Update:\", err)\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tusrgroup.Href = urlString\n\trespondWithJSON(w, http.StatusCreated, usrgroup)\n\n\t// disseminate the updated usrgroup info to self and group-members if any\n\tuc.disseminateUsrGroupChange(usrgroup.ID, true, usrgroup.GroupName, gmcom.COpUpdate)\n}", "title": "" }, { "docid": "855e9c840bb116a8b3fdae34b8b48b1a", "score": "0.47192857", "text": "func CreateDeleteStudioLayoutResponse() (response *DeleteStudioLayoutResponse) {\n\tresponse = &DeleteStudioLayoutResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "f9174fa57703b019fcf67c30068bdb22", "score": "0.47075596", "text": "func (o *VaultDomain) Update() (*restapi.GenericMapResponse, error) {\n\tif o.ID == \"\" {\n\t\treturn nil, errors.New(\"error: ID is empty\")\n\t}\n\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg, err := generateRequestMap(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tLogD.Printf(\"Generated Map for Update(): %+v\", queryArg)\n\treply, err := o.client.CallGenericMapAPI(o.apiUpdate, queryArg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !reply.Success {\n\t\treturn nil, errors.New(reply.Message)\n\t}\n\n\treturn reply, nil\n}", "title": "" }, { "docid": "e41cdf5ebe418e6ead0a968204b8aa54", "score": "0.4706339", "text": "func (vdcGroup *VdcGroup) Update(name, description string, participatingOrgVddIs []string) (*VdcGroup, error) {\n\n\tvdcGroup.VdcGroup.Name = name\n\tvdcGroup.VdcGroup.Description = description\n\n\tparticipatingOrgVdcs, err := composeParticipatingOrgVdcs(vdcGroup.parent.fullObject().(*AdminOrg), vdcGroup.VdcGroup.Id, participatingOrgVddIs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvdcGroup.VdcGroup.ParticipatingOrgVdcs = participatingOrgVdcs\n\n\treturn vdcGroup.GenericUpdate()\n}", "title": "" }, { "docid": "17737d08dda6baf990d6c31fa3fdc0ca", "score": "0.4696778", "text": "func CreateModifyNetworkAclAttributesResponse() (response *ModifyNetworkAclAttributesResponse) {\n\tresponse = &ModifyNetworkAclAttributesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "02ac8516c615413638e7a33745e0bd28", "score": "0.4694519", "text": "func (o *CreateGroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\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": "be8185a23ad9cc01cbbf68f16ce1c56d", "score": "0.46934435", "text": "func (a *Accessor) UpdateServiceGroup(resource, apikey, json string) error {\n\treq, err := http.NewRequest(http.MethodPut, a.genConfigUrl(ServiceGroupUrl), strings.NewReader(json))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := a.Crud(gohttp.AddQueries(req, map[string]string{\"resource\": resource, \"apikey\": apikey}))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !gohttp.IsSuccessful(res) {\n\t\treturn gohttp.ResponseToError(res, nil, nil)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1669c5e8708b8dd6c2c70a35d7a10f21", "score": "0.46932924", "text": "func CreateDeleteMonitorGroupNotifyPolicyResponse() (response *DeleteMonitorGroupNotifyPolicyResponse) {\n\tresponse = &DeleteMonitorGroupNotifyPolicyResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "9df39da576718c2f83b4b72e1d9c0399", "score": "0.46911013", "text": "func NewPtrSyncGroupResponse() *SyncGroupResponse {\n\tvar v SyncGroupResponse\n\tv.Default()\n\treturn &v\n}", "title": "" }, { "docid": "dbb0440506419c0be9c0951da15b8e9f", "score": "0.4688878", "text": "func CreateModifyDBInstanceEndpointAddressResponse() (response *ModifyDBInstanceEndpointAddressResponse) {\n\tresponse = &ModifyDBInstanceEndpointAddressResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "e3092f8ebcfe59d0ce9c47373d7ad32c", "score": "0.4687019", "text": "func HandleUpdateDomainSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/domains/uuid-for-karachi\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"PUT\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"X-Limes-Cluster-Id\", \"fakecluster\")\n\n\t\tw.WriteHeader(http.StatusAccepted)\n\t})\n}", "title": "" }, { "docid": "ff219d736c96cf070e417c2d39972a23", "score": "0.46779895", "text": "func CreateExportContainerGroupTemplateResponse() (response *ExportContainerGroupTemplateResponse) {\n\tresponse = &ExportContainerGroupTemplateResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "e86d98d88bf06263846ecb754e845368", "score": "0.46744546", "text": "func NewPtrLeaveGroupResponse() *LeaveGroupResponse {\n\tvar v LeaveGroupResponse\n\tv.Default()\n\treturn &v\n}", "title": "" }, { "docid": "c62c2fbf97d41985fdbebc7d95416408", "score": "0.4672681", "text": "func (a *DhcpApiService) DhcpGroupEditExecute(r ApiDhcpGroupEditRequest) (DhcpGroupEditSuccess, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue DhcpGroupEditSuccess\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DhcpApiService.DhcpGroupEdit\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/dhcp/group/edit\"\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.dhcpGroupEditInput\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[\"HttpHeaderLoginKey\"]; 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[\"X-IPM-Username\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"HttpHeaderPasswordKey\"]; 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[\"X-IPM-Password\"] = 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\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v DhcpGroupEditFailed\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, executionError\n}", "title": "" }, { "docid": "214c7019e991e1578e5f21dea1f80518", "score": "0.46704865", "text": "func (svc *SpaceDomainService) UpdateSpaceDomain(id string, obj *nimbleos.SpaceDomain) (*nimbleos.SpaceDomain, error) {\n\tif obj == nil {\n\t\treturn nil, fmt.Errorf(\"UpdateSpaceDomain: invalid parameter specified, %v\", obj)\n\t}\n\n\tspaceDomainResp, err := svc.objectSet.UpdateObject(id, obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn spaceDomainResp, nil\n}", "title": "" }, { "docid": "fc7fb42bfbb478ca3d41ddf74ceb6b00", "score": "0.46600607", "text": "func CreateUpdatePrivateAccessPolicyResponse() (response *UpdatePrivateAccessPolicyResponse) {\n\tresponse = &UpdatePrivateAccessPolicyResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" } ]
61c394865fb9f19245e013090ed048d3
Has determines whether or not a given object has a property with the given key
[ { "docid": "c6c4cfdb81805ae36fc18067274b5712", "score": "0.7249215", "text": "func (t *TypeConv) Has(in interface{}, key string) bool {\n\tav := reflect.ValueOf(in)\n\tkv := reflect.ValueOf(key)\n\n\tif av.Kind() == reflect.Map {\n\t\treturn av.MapIndex(kv).IsValid()\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "709a6b72d60cd653cbba21c4e00d3b33", "score": "0.71295214", "text": "func (s *Set) Has(key interface{}) bool {\n\t_, ok := s.Data[key]\n\treturn ok\n}", "title": "" }, { "docid": "f69e56e1ccc31b8f24822f5c05169f9f", "score": "0.71012324", "text": "func (d Data) Has(key string) bool {\n\t_, ok := d[key]\n\treturn ok\n}", "title": "" }, { "docid": "9b9efc38845d825ed5144548d2357e93", "score": "0.7093228", "text": "func (m Metadata) Has(key string) (exists bool) {\n\t_, exists = m[key]\n\treturn\n}", "title": "" }, { "docid": "d62ae237d72fa8264cc7e97791669cd4", "score": "0.69079787", "text": "func (d *Datastore) Has(ctx context.Context, key ds.Key) (exists bool, err error) {\n\treturn d.child.Has(ctx, d.ConvertKey(key))\n}", "title": "" }, { "docid": "6eed5fec059bfd5a9759c8116a78e175", "score": "0.69001174", "text": "func (this *Repository) Has(key string) bool {\n\treturn Support.Arr().Has(this.items, []string{key})\n}", "title": "" }, { "docid": "8b0739cc4d288190a1fecf3a5d631902", "score": "0.6877167", "text": "func (dh DictHelper) Has(dict baseIDict, key interface{}) bool {\n\t_, ok := dict.AsMap()[fmt.Sprint(key)]\n\treturn ok\n}", "title": "" }, { "docid": "66db08f90eaa4d931e2c4072d7aea5bb", "score": "0.6867291", "text": "func (obj Class) HasKey() interface{} { return GetHasKey(obj) }", "title": "" }, { "docid": "ecbc10ba1dc7fe359a111d9369b1f549", "score": "0.6800885", "text": "func Has(key string) bool {\n\treturn global.Has(key)\n}", "title": "" }, { "docid": "e089d55649c58b5280d8ff466c5e2d82", "score": "0.67968243", "text": "func Has(ctx context.Context, key string) bool {\n\tif md, ok := metadata.FromIncomingContext(ctx); ok {\n\t\tvals := md.Get(string(key))\n\t\tif len(vals) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1bfcc340b3bb2a3181af0ba10f5c31ce", "score": "0.6785428", "text": "func (m *bai_zhan_obj_map) Has(key int64) bool {\n\t// Get shard\n\tshard := m.getShard(key)\n\tshard.RLock()\n\t// See if element is within shard.\n\t_, ok := shard.items[key]\n\tshard.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "d0fb4f9a5e93a88769bd2043d83cd064", "score": "0.6761867", "text": "func (m fieldMap) Has(field string) bool {\n\t_, exists := m.get(field)\n\treturn exists\n}", "title": "" }, { "docid": "355723e113dfb8d40001258d3ff5cbba", "score": "0.67483586", "text": "func (m *WeakMap) Has(key interface{}) bool {\n\treturn m.v.Call(\"has\", key).Bool()\n}", "title": "" }, { "docid": "26b591df58e95c30ebee42f8fdf93187", "score": "0.66954553", "text": "func (a Attributes) Has(key string) bool {\n\t_, ok := a[key]\n\treturn ok\n}", "title": "" }, { "docid": "13add6262f0fa8b902f22d85fada865d", "score": "0.66524416", "text": "func (c Collector) Has(k string) bool {\n\t_, ok := c[k]\n\treturn ok\n}", "title": "" }, { "docid": "3280fb2a6e6b862b04bb7e2185eb77c6", "score": "0.6649231", "text": "func (m SMap) Has(key string) bool {\n\t_, ok := m[key]\n\treturn ok\n}", "title": "" }, { "docid": "25ec3493c93aa6fb5a996b543d6ee8ca", "score": "0.66143435", "text": "func (p Parameter) Has(k string) bool {\n\t_, ok := p[k]\n\treturn ok\n}", "title": "" }, { "docid": "dec53026aeca2205fcd295c1229f579e", "score": "0.66000885", "text": "func (s *ObjectSet) Has(_type string) bool {\n\t_, ok := s.data[_type]\n\treturn ok\n}", "title": "" }, { "docid": "a95c6111e348e70eee2931556c266877", "score": "0.6590178", "text": "func Has(ctx context.Context, key string) bool {\n\treturn getSession(ctx).data.Has(key)\n}", "title": "" }, { "docid": "2c894aae5c6e886a7f20cdc0f8e6474a", "score": "0.6578173", "text": "func (c DirCollector) Has(k string) bool {\n\t_, ok := c[k]\n\treturn ok\n}", "title": "" }, { "docid": "a826ad7f1a50747e89318a748864457d", "score": "0.6574578", "text": "func (m Map) Has(key string) bool {\n\tif key == \"\" {\n\t\treturn false\n\t}\n\treturn m.HasPath(strings.Split(key, \".\"))\n\n}", "title": "" }, { "docid": "a826ad7f1a50747e89318a748864457d", "score": "0.6574578", "text": "func (m Map) Has(key string) bool {\n\tif key == \"\" {\n\t\treturn false\n\t}\n\treturn m.HasPath(strings.Split(key, \".\"))\n\n}", "title": "" }, { "docid": "596766eabe52e1d8ee8f824069bd4eb8", "score": "0.6544644", "text": "func Has(obj runtime.Object, label string) bool {\n\t// meta.Accessor convert runtime.Object to metav1.Object.\n\t// metav1.Object have all kinds of method to get/set k8s object metadata,\n\t// such like: GetNamespace/SetNamespace, GetName/SetName, GetLabels/SetLabels, etc.\n\taccessor, err := meta.Accessor(obj)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tkey, val, err := parseLabel(label)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// the label only contains label key, only to check whether the labels of\n\t// the k8s object contains the label key.\n\tif len(val) == 0 {\n\t\tfor k := range accessor.GetLabels() {\n\t\t\tif k == key {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\t// the label contains label key and value, and check whether the labels of\n\t// the k8s object contains the label key and value.\n\tfor k, v := range accessor.GetLabels() {\n\t\tif k == key && v == val {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "67deed7337561a8d9fb770d5f204b2aa", "score": "0.65419286", "text": "func (db *Database) Has(key []byte) (bool, error) {\n\treturn false, nil\n}", "title": "" }, { "docid": "ada8bdc2acb9c94bd9e9fad5b3440ffa", "score": "0.6535859", "text": "func (db *Kvsdb) Has(key []byte) bool {\n\treturn true\n}", "title": "" }, { "docid": "365b47c52784771de24a33ef4316fcd8", "score": "0.6513996", "text": "func (o *DoubleProperty) HasKey() bool {\n\tif o != nil && o.Key != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2f843712c9e43c6fe1a0d059b92c190f", "score": "0.65037477", "text": "func (s Set[T]) Has(val T) bool {\n\t_, ok := s.m.Get(val)\n\treturn ok\n}", "title": "" }, { "docid": "b3b972e94a945b04a4e52cea200be3bb", "score": "0.65001327", "text": "func (m *Map) Has(key *big.Int) bool {\n\t_, ok := m.GetPair(key)\n\treturn ok\n}", "title": "" }, { "docid": "9db38ab98c632ec4437b027a95ba40f6", "score": "0.64986205", "text": "func (c AnyMap) Has(k string) bool {\n\t_, ok := c[k]\n\treturn ok\n}", "title": "" }, { "docid": "5862c33dfd8602b4879ae08fc89d8c62", "score": "0.6496262", "text": "func (s Set) Has(x string) bool {\n\t_, ok := s[x]\n\treturn ok\n}", "title": "" }, { "docid": "b02f899b87f3defe21c7c4cf04bd6323", "score": "0.6472121", "text": "func (c *Cache) Has(key interface{}) bool {\n\treturn c.container.Contains(key)\n}", "title": "" }, { "docid": "abdb04aabd162c5ca886a9eaa5a9ef47", "score": "0.64453894", "text": "func (db *Filestore) Has(repository string, key string) bool {\n\tfile := db.makeFileName(repository, key)\n\tif _, err := os.Stat(file); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8b7be2992653585751ee5eda533fa3a0", "score": "0.643894", "text": "func (db *fileDB) Has(key []byte) (bool, error) {\n\treturn false, fmt.Errorf(\"not implemented\")\n}", "title": "" }, { "docid": "7c7a8e193bd7ae114700c59e0505adb1", "score": "0.64299494", "text": "func (s Set) Has(in string) bool {\n\t_, ok := s.m[in]\n\treturn ok\n}", "title": "" }, { "docid": "4eb89f59291611330db71b7fa843c975", "score": "0.642904", "text": "func (kv Datastore) Has(key ds.Key) (exists bool, err error) {\n\t// TODO: include bot version from row in response, allowing migrations\n\tdatastore := kv.node.Datastore()\n\tkeyVal := datastore.Bots().Get(key.String())\n\tif keyVal == nil || keyVal.Value == nil {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "40720397af8496f2a0334e574dbe09cc", "score": "0.6421797", "text": "func (_e *MetaKv_Expecter) Has(key interface{}) *MetaKv_Has_Call {\n\treturn &MetaKv_Has_Call{Call: _e.mock.On(\"Has\", key)}\n}", "title": "" }, { "docid": "962d794b60635b09083c60bd10a7d4ef", "score": "0.6419104", "text": "func (k KVStore) has(ctx cosmos.Context, key string) bool {\n\tstore := ctx.KVStore(k.storeKey)\n\treturn store.Has([]byte(key))\n}", "title": "" }, { "docid": "fa16a8e2c1e0e3d090b53cf61b7b35bd", "score": "0.6406796", "text": "func (db *dbImpl) Has(key []byte) (bool, error) {\n\treturn db.db.Has(key, nil)\n}", "title": "" }, { "docid": "c1e002afb6c44e12cab0f0e05481a168", "score": "0.63946265", "text": "func (s *S) Has(e interface{}) bool {\n\treturn s.s[e]\n}", "title": "" }, { "docid": "c2f47fb5434df4a62b980d67cd7b4563", "score": "0.6382738", "text": "func (d *UnorderedStringMap) Has(key string) bool {\n\t_, ok := d.stringToInt[key]\n\treturn ok\n}", "title": "" }, { "docid": "37dc0e2d94f0535ee9053178245bb440", "score": "0.6381452", "text": "func (c FileCollector) Has(k string) bool {\n\t_, ok := c[k]\n\treturn ok\n}", "title": "" }, { "docid": "5303360e1a09921f7d2e50a0576e2b18", "score": "0.63778013", "text": "func Has(s, v interface{}) bool {\n\treturn IndexOf(s, v) != -1\n}", "title": "" }, { "docid": "95f74cd79f6fb0935ba2419f3ff5bf9a", "score": "0.63352776", "text": "func (s *SetValue) Has(item string) bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\t_, ok := s.m[item]\n\treturn ok\n}", "title": "" }, { "docid": "2377ec62f72d5af00944090a20c2038f", "score": "0.63322127", "text": "func (a Attribs) Has(key string) bool {\n\tfor _, attrib := range a {\n\t\tif attrib.GetKey() == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7e9e07edea320259dcd7e709d7562433", "score": "0.63278866", "text": "func (s *Server) Has(ctx context.Context, key *Key) (*Bool, error) {\n\tres, err := s.cache.Server.Range(ctx, &pb.RangeRequest{\n\t\tKey: StringToBytes(key.Key),\n\t\tKeysOnly: true,\n\t})\n\tif err == etcdserver.ErrKeyNotFound {\n\t\treturn &Bool{Value: false}, nil\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, kv := range res.Kvs {\n\t\tif key.Key == BytesToString(kv.Key) {\n\t\t\treturn &Bool{Value: true}, nil\n\t\t}\n\t}\n\treturn &Bool{Value: false}, nil\n}", "title": "" }, { "docid": "296162b2bcbf58266666e09fec63e75e", "score": "0.6321232", "text": "func (s *mapKeySet) Has(key string) bool {\n\tif s == nil {\n\t\treturn false\n\t}\n\t_, has := s.set[key]\n\treturn has\n}", "title": "" }, { "docid": "192dd1dfc2bd4b3c26a20efd742178c6", "score": "0.63191915", "text": "func (c *CommonCache) Has(key string) bool {\n\treturn c.data[key] != nil\n}", "title": "" }, { "docid": "6c325dab21f09d4d10922bab22ca045c", "score": "0.63159317", "text": "func (idx *MemIndex) Has(k bits.K) bool {\n\tif _, ok := idx.Keys[k]; ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "49091a3577bdc30983d7ac3464c02d9f", "score": "0.6315435", "text": "func (s Set) Has(val interface{}) bool {\n\treturn s.root.get(val) != nil\n}", "title": "" }, { "docid": "926bbe13b5aa4c7f57668b6593e77163", "score": "0.6312163", "text": "func (c *Criterion) HasKey(value interface{}) *Query {\n\treturn c.op(hk, value)\n}", "title": "" }, { "docid": "91311336dcd4c4798f81b9e82df936a0", "score": "0.6293084", "text": "func (o *SyntheticsAssertionTarget) HasProperty() bool {\n\tif o != nil && o.Property != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "24ca690e7ae3599b10a87a51af5a7c05", "score": "0.6288932", "text": "func (c DeferDirCollector) Has(k string) bool {\n\t_, ok := c[k]\n\treturn ok\n}", "title": "" }, { "docid": "7ccfd1fb8ac2b769f81ae1822b1c6cfa", "score": "0.627448", "text": "func (s set) Has(a string) bool { _, ok := s[a]; return ok }", "title": "" }, { "docid": "e432922e35794008200dcdc7e581a8c7", "score": "0.6266556", "text": "func (instance *Instance) Has(eventName string) bool {\n\t_, ok := instance.items.Get(eventName)\n\treturn ok\n}", "title": "" }, { "docid": "408274ec725213cb6e72956b5a26a2b3", "score": "0.62568814", "text": "func (w *Writer) Has(key string) (bool, error) {\n\tkeys := strings.Split(key, \".\")\n\tif len(keys) != 2 || keys[0] == \"\" || keys[1] == \"\" {\n\t\treturn false, errors.Wrapf(errcode.ErrWriterInvalidKey, \"with key %q\", key)\n\t}\n\n\tname := strings.Join(keys[1:], \"\")\n\n\tfor k, v := range w.Config {\n\t\tif k == writer.ModuleCategoryKey || k == variablesCategoryKey || k == w.opts.TerraformCategoryKey {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := v[\"resource\"].(map[string]map[string]interface{})[keys[0]][name]; ok {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "d1fd0e9022fcfcb6239b9fdaf76e8c35", "score": "0.62116843", "text": "func (s Rule) Has(item slb.Rule) bool {\n\t_, contained := s[keyForRule(item)]\n\treturn contained\n}", "title": "" }, { "docid": "b407e06c8a641f177c30b920893b7769", "score": "0.6207268", "text": "func (s *Sett) HasKey(key string) bool {\n\t_, err := s.Get(key)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7e95ac8d8c9192b3dd146d99b438543e", "score": "0.62052053", "text": "func (x *Keys) Has(k *Key) bool {\n\t// TODO: should replaced by sort.Search()\n\tfor _, item := range x.arr {\n\t\tif bytes.Equal(k.key, item.key) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ceea71f790ad50e309f6815753e8c78f", "score": "0.62008023", "text": "func (f Fields) HasField(key string) bool {\n\t_, ok := f[key]\n\treturn ok\n}", "title": "" }, { "docid": "95e594e911e41cbf43c1e08786e4eca9", "score": "0.61977863", "text": "func (this *Set) Has(member Item) bool {\n\tkey, mask := ibitlocation(member);\n\treturn (this.bits[key] & mask) != 0;\n}", "title": "" }, { "docid": "2e3d151c15f3334688f8d4dbb7d41482", "score": "0.6194041", "text": "func (this *SubjectHandlersMap) Has(key string) bool {\n\tthis.mutex.RLock()\n\tdefer this.mutex.RUnlock()\n\n\t// See if element is within shard.\n\t_, ok := this.items[key]\n\treturn ok\n}", "title": "" }, { "docid": "145f3d1ac13ce17537750d916ae65af5", "score": "0.61891824", "text": "func (c BaseCollection) Has(...string) bool {\n\tpanic(\"not implement\")\n}", "title": "" }, { "docid": "32cde7c241960b19c69ae726e408d002", "score": "0.6182024", "text": "func (t *OSMTags) Has(key string) bool {\n\t_, ok := t.index(key)\n\treturn ok\n}", "title": "" }, { "docid": "f1c43e6a0249f1b86b5a818de452113c", "score": "0.6178977", "text": "func (h Hash) has(q Query) bool {\n\t_, kmer := h.get(q)\n\treturn kmer != nil\n}", "title": "" }, { "docid": "c5917e2dab43d5ad55aac47c32990e54", "score": "0.6173091", "text": "func (db *ffldb) Has(key *database.Key) (bool, error) {\n\treturn db.levelDB.Has(key)\n}", "title": "" }, { "docid": "0042bcfba370d01432cc01e0ea1c4eea", "score": "0.61719644", "text": "func (thunk *Thunk) Has(x I) bool {\n\treturn thunk.Any(func(y I) bool {\n\t\treturn reflect.DeepEqual(x, y)\n\t})\n}", "title": "" }, { "docid": "72b848c75041947b3f5bf465e2b057d1", "score": "0.61556876", "text": "func (ds *Datastore) Has(key datastore.Key) (exists bool, err error) {\n\tds.mu.Lock()\n\tdefer ds.mu.Unlock()\n\tres, err := ds.client.SCard(key.String()).Result()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn false, err\n\t}\n\tif res == 0 {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "be2f20e81f4ff1618da0ae8eb97bf35a", "score": "0.61547107", "text": "func (m Map) Exists(key interface{}) bool {\n\tif m == nil {\n\t\treturn false\n\t}\n\tif _, ok := m[key]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6f2ed08a51fa589f6db61637da12395d", "score": "0.6149107", "text": "func (d *JSONObject) HasKey(key string) bool {\n\treturn (*d)[key] != nil\n}", "title": "" }, { "docid": "1be737a52bd82157fadbc8a8de8a1715", "score": "0.6145985", "text": "func HasKey(m map[string]interface{}, key string) bool {\n\t_, ok := m[key]\n\treturn ok\n}", "title": "" }, { "docid": "3717c8e12e428fcaef4866e576755a03", "score": "0.61433333", "text": "func (f *Filter) Has(key string) bool {\n\ta, b := hash(key)\n\tm := f.nbits - 1\n\tfor i := 0; i < f.hashes; i++ {\n\t\t// Any zero bits means the key has not been set yet.\n\t\tif !f.isSet((a + b*uint64(i)) & m) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0dd25003103848f610cebd1c85749b09", "score": "0.6142753", "text": "func (s *Storage) Has(key string) bool {\n\treturn s.Backend.Has(key)\n}", "title": "" }, { "docid": "37f1f5f6f8782130aab8d98d765ebd2b", "score": "0.6141482", "text": "func (s *UserIDSet) Has(p UserID) bool {\n\tif s == nil || s.m == nil {\n\t\treturn false\n\t}\n\t_, ok := s.m[p]\n\treturn ok\n}", "title": "" }, { "docid": "a3abb5da3ffff8c20e86890c6d5579e8", "score": "0.61390907", "text": "func hasKey(set map[string]string, key string) bool {\n\t_, ok := set[key]\n\treturn ok\n}", "title": "" }, { "docid": "eaa92de96b923f17a2d85f874d97c88d", "score": "0.6127314", "text": "func (s *sliceKeySet) Has(key string) bool {\n\tif s == nil {\n\t\treturn false\n\t}\n\t_, exists := s.getKeyIndex(key)\n\treturn exists\n}", "title": "" }, { "docid": "693981f1968d648dd9ecde837a278df2", "score": "0.6127209", "text": "func (d *Store) Has(project, name string) bool {\n\treturn d.c.Has(path.Join(project, name))\n}", "title": "" }, { "docid": "c4ec89a25c102252ee19ee3470f530c1", "score": "0.61237264", "text": "func (s *Set) Has(v int) bool {\r\n\t_, ok := s.list[v]\r\n\treturn ok\r\n}", "title": "" }, { "docid": "13fcc8a28abc465ed20546d75c9639dc", "score": "0.61213666", "text": "func Has(annotations Annotations, attr AnnotationName) bool {\n\treturn Get(annotations, attr) != \"\"\n}", "title": "" }, { "docid": "ec307e8e2e402a4e09342f621bc0e0a6", "score": "0.6111758", "text": "func (s SortedSet[T]) Has(val T) bool {\n\t_, ok := s.m.Get(val)\n\treturn ok\n}", "title": "" }, { "docid": "c707037f1796e917b748c3f06b57e472", "score": "0.6093746", "text": "func (lm *LMap) Has(key KT) (ok bool) {\n\tlm.l.RLock()\n\t_, ok = lm.m[key]\n\tlm.l.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "73bf6efbd8ea8486c453ca57f74a9c91", "score": "0.60897064", "text": "func (s Set[E]) Has(item E) bool {\n\t_, contained := s[item]\n\treturn contained\n}", "title": "" }, { "docid": "74a909bc736e1712f09acfdf65e7e995", "score": "0.60882944", "text": "func (x *fastReflection_EventPut) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.basket.v1.EventPut.owner\":\n\t\treturn x.Owner != \"\"\n\tcase \"regen.ecocredit.basket.v1.EventPut.basket_denom\":\n\t\treturn x.BasketDenom != \"\"\n\tcase \"regen.ecocredit.basket.v1.EventPut.credits\":\n\t\treturn len(x.Credits) != 0\n\tcase \"regen.ecocredit.basket.v1.EventPut.amount\":\n\t\treturn x.Amount != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.basket.v1.EventPut\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.basket.v1.EventPut does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9e91deb70b6a556db1801981be74073a", "score": "0.60765994", "text": "func (s *threadSafeSet) Has(item string) bool {\n\ts.Lock.RLock()\n\tdefer s.Lock.RUnlock()\n\t_, ok := s.m[item]\n\treturn ok\n}", "title": "" }, { "docid": "a27d8787296aa7e519704821144eaa02", "score": "0.60740507", "text": "func (s Set) Has(elem string) bool {\n\t_, ok := s.data[elem]\n\treturn ok\n}", "title": "" }, { "docid": "8a0a597f7184afccad4a23fe77e44868", "score": "0.60703564", "text": "func (snap *Snapshot) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) {\n\tsnap.mu.RLock()\n\tdefer snap.mu.RUnlock()\n\tif snap.released {\n\t\terr = ErrSnapshotReleased\n\t\treturn\n\t}\n\terr = snap.db.ok()\n\tif err != nil {\n\t\treturn\n\t}\n\treturn snap.db.has(nil, nil, key, snap.elem.seq, ro)\n}", "title": "" }, { "docid": "033aed2421fc85493ba39501f163366a", "score": "0.60650474", "text": "func (mk *MemKeystore) Has(name string) (bool, error) {\n\t_, ok := mk.keys[name]\n\treturn ok, nil\n}", "title": "" }, { "docid": "6e5204761b2a89db333a4047dabe42d4", "score": "0.6055468", "text": "func (h *HashMap) Has(owner, key string) (bool, error) {\n\tquery := fmt.Sprintf(\"SELECT attr -> '%s' FROM %s WHERE %s = '%s' AND attr ? '%s'\", escapeSingleQuotes(key), h.table, ownerCol, escapeSingleQuotes(owner), escapeSingleQuotes(key))\n\tif Verbose {\n\t\tfmt.Println(query)\n\t}\n\trows, err := h.host.db.Query(query)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif rows == nil {\n\t\treturn false, errors.New(\"HashMap Has returned no rows for owner \" + owner)\n\t}\n\tdefer rows.Close()\n\tvar value sql.NullString\n\t// Get the value. Should only loop once.\n\tcounter := 0\n\tfor rows.Next() {\n\t\terr = rows.Scan(&value)\n\t\tif err != nil {\n\t\t\t// No rows\n\t\t\treturn false, err\n\t\t}\n\t\tcounter++\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn false, err\n\t}\n\tif counter > 1 {\n\t\t// Should never happen\n\t\treturn false, errors.New(\"Duplicate keys in hash map for owner \" + owner + \"!\")\n\t}\n\treturn counter > 0, nil\n}", "title": "" }, { "docid": "e15b579ab66b5ee73ac562bc3d590fa3", "score": "0.60553825", "text": "func (s *singletonKeySet) Has(key string) bool {\n\tif s == nil {\n\t\treturn false\n\t}\n\tif s.set[0] == key {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c5b1390f67f9a9f5b0261edb016a0329", "score": "0.60507035", "text": "func (_GovernmentContract *GovernmentContractCaller) PropExists(opts *bind.CallOpts, _propID [32]byte) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _GovernmentContract.contract.Call(opts, out, \"propExists\", _propID)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e8ef99fcd9168b92c2333176456b2e49", "score": "0.6045937", "text": "func (iter *ObjectIter) HasKey(k string) bool {\n\tfor _, key := range iter.Keys() {\n\t\tif key == k {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0c6068747b2701e6493dcab831caa755", "score": "0.60412484", "text": "func (_e *MockPlcValue_Expecter) HasKey(key interface{}) *MockPlcValue_HasKey_Call {\n\treturn &MockPlcValue_HasKey_Call{Call: _e.mock.On(\"HasKey\", key)}\n}", "title": "" }, { "docid": "0f266e6ffdb12cd877e346f88c3515f8", "score": "0.6040725", "text": "func (e *ENGAmiiboMap) Has(ID string) (ok bool) {\n\t_, ok = e.Get(ID)\n\treturn\n}", "title": "" }, { "docid": "9aaa8b247a005e4a25649b6732839eb8", "score": "0.60336167", "text": "func (h Headers) Has(key string) bool {\n\tif h == nil {\n\t\treturn false\n\t}\n\n\t_, ok := h[http.CanonicalHeaderKey(key)]\n\treturn ok\n}", "title": "" }, { "docid": "3f3b6895b6f6dc950604c4158f8f1ee1", "score": "0.6026314", "text": "func (o *LabelResourceProperties) HasKey() bool {\n\tif o != nil && o.Key != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ae69dfe24c2d407bc768b8d92fd6fba7", "score": "0.60191196", "text": "func (t *tree) Has(key []byte) bool {\n\tn := find_leaf(t.root, key)\n\tif n == nil {\n\t\treturn false\n\t}\n\tfor i := 0; i < n.num_keys; i++ {\n\t\tif bytes.Equal(n.keys[i], key) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a523ef32e90f5d0241bb59f95f10a33f", "score": "0.6011729", "text": "func (s Set) Has(v string) bool {\n\treturn (*s.values)[v]\n}", "title": "" }, { "docid": "46b77631a40cc374dcd3f5eb27f2375e", "score": "0.6002777", "text": "func (p *PropertyResolver) Contains(key string) bool {\n\tsources := p.sources.List()\n\tfor _, s := range sources {\n\t\tif s.Contains(key) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "075b6c5a0ba699321646cdc0837a1f5d", "score": "0.5998747", "text": "func (c *Configurer) Has(key string) bool {\n\tif c.currentConfig == nil {\n\t\treturn false\n\t}\n\n\treturn c.currentConfig.Has(key)\n}", "title": "" }, { "docid": "24d5e7a574bbbc91f3fa72cec66fe9a3", "score": "0.59956366", "text": "func hasKeys(obj map[string]interface{}, keys []string) bool {\n\tif obj == nil {\n\t\treturn false\n\t}\n\tfor _, key := range keys {\n\t\tif _, ok := obj[key]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7825bbc3fd690f62ff24eab7e9466fa9", "score": "0.59827477", "text": "func (ls Set) Has(label string) bool {\n\t_, exists := ls[label]\n\treturn exists\n}", "title": "" }, { "docid": "b23f14dec4ca585a03c0c095ea87f108", "score": "0.5970243", "text": "func (s IDSet) Has(id ID) bool {\n\t_, ok := s[id]\n\treturn ok\n}", "title": "" } ]
ce28030a9c4abc2fabfce0e19fed5f2e
postResponseURLPayload posts a request to Slack from a response URL
[ { "docid": "863de310375a2cf40915f324ae67c560", "score": "0.7997859", "text": "func postResponseURLPayload(responseURL string, payload string, channelToken string) error {\n\tqueryURL, err := url.ParseRequestURI(responseURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn postRequest(*queryURL, payload, channelToken)\n}", "title": "" } ]
[ { "docid": "23cf128f8955f776dc2316bf4591b8d9", "score": "0.820334", "text": "func (s *Slack) PostResponseURLPayload(responseURL string, text string) error {\n\n\tpayload := UpdateBlockKit{\n\t\tReplaceOriginal: true,\n\t\tText: text,\n\t}\n\tpayloadMarshalled, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"err\": err}).Error(\"Error while marshalling json\")\n\t\treturn err\n\t}\n\tpayloadString := string(payloadMarshalled)\n\terr = postResponseURLPayload(responseURL, payloadString, s.BotToken)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"err\": err}).Error(\"Error while posting response url payload\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "326414fde93edb409d013b2dd306cc92", "score": "0.5927033", "text": "func postAPIPayload(host string, endpoint string, payload string, channelToken string) error {\n\tqueryURL := url.URL{Scheme: \"https\", Host: host, Path: fmt.Sprintf(\"api/%s\", endpoint)}\n\treturn postRequest(queryURL, payload, channelToken)\n}", "title": "" }, { "docid": "7b865c83048d21f61b00bffd626bfba9", "score": "0.5879306", "text": "func (s *Slack) Post() (err error) {\n\tb, err := json.Marshal(s.Payload)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar v = url.Values{}\n\tv.Set(\"payload\", string(b))\n\n\tres, err := http.PostForm(s.URL, v)\n\tdefer res.Body.Close()\n\treturn\n}", "title": "" }, { "docid": "1912ae48db06e44f6e0fa2964c7335b8", "score": "0.5608426", "text": "func (wr *WebhookRuntime) Post(data []byte, url string) (*http.Response, []byte, error) {\n\tbufferData := bytes.NewBuffer(data)\n\t// Create the POST request\n\treq, err := http.NewRequest(\n\t\t\"POST\",\n\t\turl,\n\t\tbufferData,\n\t)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"Content-type\", wr.ContentType)\n\n\t// Print out the request when debug mode is on\n\tif wr.Debug {\n\t\toutput, _ := httputil.DumpRequest(req, true)\n\t\tfmt.Println(string(output)) //todo switch to logger\n\t}\n\n\t// Send request and capture the response\n\tresp, err := wr.client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdefer func() {\n\t\tif closeErr := resp.Body.Close(); closeErr != nil {\n\t\t\tfmt.Println(fmt.Errorf(\"Failed to close connection: %w\", closeErr).Error())\n\t\t}\n\t}()\n\n\t// Print out the response when debug mode is on\n\tif wr.Debug {\n\t\toutput, _ := httputil.DumpResponse(resp, true)\n\t\tfmt.Println(string(output))\n\t}\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn resp, body, nil\n}", "title": "" }, { "docid": "346588a04f3209cfdd9a328ad8d74a84", "score": "0.5587814", "text": "func SendResponse(payload []byte) {\n\turl := GetEnv(\"LOGURL\", \"http://0.0.0.0:4000/node/log\")\n\tlogrus.Debugf(\"Sending response to URL:>\", url)\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(payload))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error in sending error log\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tlogrus.Debugf(\"response Status:\", resp.Status)\n}", "title": "" }, { "docid": "7800f4ac137c1091bba16955587ea4d2", "score": "0.5542551", "text": "func postToSlack(text, snip string) {\n\tdefer func() {\n\t\twg.Done()\n\t}()\n\tpayload := map[string]interface{}{\n\t\t\"text\": text,\n\t\t//Enable slack to parse mention @<someone>\n\t\t\"link_names\": 1,\n\t\t\"attachments\": []map[string]interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"text\": snip,\n\t\t\t\t\"color\": \"#e50606\",\n\t\t\t\t\"title\": \"Stack Trace\",\n\t\t\t\t\"mrkdwn_in\": []string{\"text\"},\n\t\t\t},\n\t\t},\n\t}\n\tif cfg.Channel != \"\" {\n\t\tpayload[\"channel\"] = cfg.Channel\n\t}\n\tb, err := json.Marshal(payload)\n\tif err != nil {\n\t\tarklog.INFO.Println(\"[panics] marshal err\", err, text, snip)\n\t\treturn\n\t}\n\n\tclient := http.Client{\n\t\tTimeout: 5 * time.Second,\n\t}\n\n\tresp, err := client.Post(cfg.WebHookURL, \"application/json\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\tarklog.INFO.Printf(\"[panics] error on capturing error : %s %s %s\\n\", err.Error(), text, snip)\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 300 {\n\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tarklog.INFO.Printf(\"[panics] error on capturing error : %s %s %s\\n\", err, text, snip)\n\t\t\treturn\n\t\t}\n\t\tarklog.INFO.Printf(\"[panics] error on capturing error : %s %s %s\\n\", string(b), text, snip)\n\t}\n}", "title": "" }, { "docid": "c04bacaa29cb1c48df8c51b413acb0f6", "score": "0.53806794", "text": "func CallURL(url string, content string) {\n\t//post on the url that was sent as a parameter\n\tres, err := http.Post(url, \"string\", bytes.NewReader([]byte(content)))\n\tif err != nil {\n\t\tfmt.Println(\"Error in HTTP request: \" + err.Error())\n\t\treturn\n\t}\n\tresponse, err1 := ioutil.ReadAll(res.Body)\n\tif err1 != nil {\n\t\tfmt.Println(\"Something is wrong with invocation response: \" + err.Error())\n\t\treturn\n\t}\n\n\tfmt.Println(\"Webhook invoked. Received status code \" + strconv.Itoa(res.StatusCode) +\n\t\t\" and body: \" + string(response))\n}", "title": "" }, { "docid": "32ddf2ed256998bdabeac6e51a8c6080", "score": "0.53625596", "text": "func (s *Session) Post(url string, payload, result, errMsg interface{}) (*Response, error) {\n\tr := Request{\n\t\tMethod: \"POST\",\n\t\tUrl: url,\n\t\tPayload: payload,\n\t\tResult: result,\n\t\tError: errMsg,\n\t}\n\treturn s.Send(&r)\n}", "title": "" }, { "docid": "019578ddd7d702cd0fec3b3c8d956f65", "score": "0.534578", "text": "func rest_webhooks_post(session events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\t// Received Webhook data is an array [].msys.xxx_event_key.event\n\tvar sparkPostWebhookEvents []map[string]map[string]map[string]interface{}\n\tif err := json.Unmarshal([]byte(session.Body), &sparkPostWebhookEvents); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar logglyOutputLines string\n\t// Walk the contents, building a Loggly-compatible output\n\tfor _, ev := range sparkPostWebhookEvents {\n\t\t// dereference msys.xxx_event_key, because \"type\" attribute is all we need to identify the event\n\t\tfor _, event := range ev[\"msys\"] {\n\t\t\tvar se logglyEvent\n\t\t\tse.Event = event\n\t\t\tjsonb, err := json.Marshal(se)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"JSON marshaling failed : %s\", err)\n\t\t\t}\n\t\t\tlogglyOutputLines += string(jsonb) + \"\\n\"\n\t\t}\n\t}\n\n\tvar buf = bytes.NewBufferString(logglyOutputLines)\n\tvar logglyUrl = strings.Trim(os.Getenv(\"LOGGLY_URL\"), \" \") // Trim leading and trailing spaces, if present\n\tclient := &http.Client{}\n\n\t// Selectively copy across request method and headers\n\treq, _ := http.NewRequest(session.HTTPMethod, logglyUrl, buf)\n\tfor hname, hval := range session.Headers {\n\t\tswitch hname {\n\t\tcase \"Accept-Encoding\", \"Accept\", \"Authorization\", \"Content-Type\":\n\t\t\treq.Header.Add(hname, hval)\n\t\tcase \"User-Agent\":\n\t\t\treq.Header.Add(hname, \"SparkPost-Loggly adapter\")\n\t\t}\n\t}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tresBuffer := new(bytes.Buffer)\n\tresBuffer.ReadFrom(res.Body)\n\tresStr := resBuffer.String()\n\tfmt.Printf(\"Outgoing: %s %s: Response %d %s\", req.Method, logglyUrl, res.StatusCode, resStr)\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: resStr,\n\t\tStatusCode: res.StatusCode,\n\t}, nil\n}", "title": "" }, { "docid": "5ec355ec585f3f5657042b417a85cd7f", "score": "0.5314877", "text": "func MakePostCallAndReturnResponse(url string, payload interface{}, headers map[string]string, queryParams map[string]string) (output []byte, err error) {\n\tlog.Debug(\"Starting MakePostCallAndReturnResponse\")\n\tlog.Trace(\"url : \", url)\n\n\trequestPayloadBytes, err := json.Marshal(payload)\n\tlog.Trace(\"requestPayloadBytes : \", string(requestPayloadBytes))\n\tif err != nil {\n\t\tlog.Error(\"Error in Marshalling the request Payload \" + err.Error())\n\t\treturn nil, errors.Wrap(err, \"Error in Marshalling the request Payload\")\n\t}\n\n\tclient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t},\n\t}\n\n\trequest, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(requestPayloadBytes))\n\tif err != nil {\n\t\tlog.Error(\"Error in creating Post request \" + err.Error())\n\t\treturn nil, errors.Wrap(err, \"Error in creating post request \")\n\t}\n\n\tlog.Trace(\"queryParams : \", queryParams)\n\tq := request.URL.Query()\n\tfor key, value := range queryParams {\n\t\tq.Add(key, value)\n\t}\n\trequest.URL.RawQuery = q.Encode()\n\n\t// log.Trace(\"headers : \", headers)\n\tfor key, value := range headers {\n\t\trequest.Header.Set(key, value)\n\t}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tlog.Error(\"Error in making http request : \" + err.Error())\n\t\treturn nil, errors.Wrap(err, \"Error in making http request \")\n\t}\n\tdefer response.Body.Close()\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tlog.Trace(\"response : \", string(body))\n\tif err != nil || len(body) <= 0 {\n\t\tlog.Error(\"Error in reading the response : \" + err.Error())\n\t\treturn nil, errors.Wrap(err, \"Error in reading the response\")\n\t} else if response.StatusCode == 500 {\n\t\terr = errors.New(\"StatusCode: \" + fmt.Sprintf(\"%d\", response.StatusCode))\n\t\terr = errors.Wrap(err, \"Status:\"+response.Status)\n\t\treturn nil, err\n\t} else if !(response.StatusCode >= 200 && response.StatusCode <= 299) {\n\t\t// log.Error(\"Status : \", response.Status)\n\t\treturn nil, errors.New(\"Status: \" + response.Status)\n\t}\n\n\toutput = body\n\tlog.Debug(\"Finished MakePostCallAndReturnResponse\")\n\treturn\n}", "title": "" }, { "docid": "e728356b073a09663219fc6c4478b5b5", "score": "0.52987343", "text": "func webhookReply(recipient Recipient, message Message, req *http.Request) {\n // Create a GAE Context and urlfetch client for this request\n ctx := appengine.NewContext(req)\n client := urlfetch.Client(ctx)\n url := \"https://graph.facebook.com/v2.6/me/messages?access_token=\" + SecretToken\n\n // Prepare payload, and encode\n // the payload correctly\n reply := Reply{recipient, message}\n payload, errMarshal := json.Marshal(reply); if errMarshal != nil {\n log.Errorf(ctx, \"Serializing JSON error: %s\", errMarshal)\n return\n }\n \n log.Debugf(ctx, \"payload = %v\", string(payload))\n\n // Create stream, set header and\n // create request object\n req, errPost := http.NewRequest(\"POST\", url, bytes.NewBuffer(payload)); if errPost != nil {\n log.Errorf(ctx, \"Unable to create post request: %s\", errPost)\n return\n }\n req.Header.Set(\"Content-Type\", \"application/json\")\n \n // Execute request\n _, errSend := client.Do(req); if errSend != nil {\n log.Errorf(ctx, \"Unable to reach the server: %s\", errSend)\n return\n }\n}", "title": "" }, { "docid": "540cb9934a486a0dec90fd671750f431", "score": "0.526988", "text": "func (ctx *DronaCtx) postResponse(req *DronaRequest, status error) {\n\t// status is already set up by action, we just have to set processed flag\n\treq.setProcessed()\n\treq.result <- req\n}", "title": "" }, { "docid": "7a36a41711846a39c32a4d882406c694", "score": "0.5166775", "text": "func handleURLVerificationEvent(body string, w http.ResponseWriter) {\n\tlog.Println(\"[Slack URL Verification challenge event]\")\n\tvar response *slackevents.ChallengeResponse\n\terr := json.Unmarshal([]byte(body), &response)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Fatalf(\"Unable to unmarshal slack URL verification challenge. Error %v\\n\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"text\")\n\tnumWrittenBytes, err := w.Write([]byte(response.Challenge))\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Fatalf(\"Unable to write response challenge with error %v\\n\", err)\n\t}\n\tlog.Printf(\"%v bytes of Slack challenge response written\\n\", numWrittenBytes)\n}", "title": "" }, { "docid": "893208c716a8dcd2be357503ada20a38", "score": "0.5165242", "text": "func sendResponse(slackClient *slack.RTM, message, slackChannel string) {\n\tcommand := strings.ToLower(message)\n\tprintln(\"[RECEIVED] sendResponse:\", command)\n\n\t// START SLACKBOT CUSTOM CODE\n\t// ===============================================================\n\t// TODO:\n\t// 1. Implement sendResponse for one or more of your custom Slackbot commands.\n\t// You could call an external API here, or create your own string response. Anything goes!\n\t// 2. STRETCH: Write a goroutine that calls an external API based on the data received in this function.\n\t// ===============================================================\n\t// END SLACKBOT CUSTOM CODE\n}", "title": "" }, { "docid": "8f3a826da39b6cb0c899295cfec20aaf", "score": "0.5131971", "text": "func postToSlack(t chaosmonkey.Termination, cfg *config.Monkey) interface{} {\n\twebhookUrl := cfg.GetWebHookUrl()\n\tfmt.Printf(\"Webhook URL:%s\\n\", webhookUrl)\n\tattachment1 := slack.Attachment{}\n\ttermination_time := t.Time.String()\n\tfmt.Printf(\"Termination time:%s\\n\", termination_time)\n\tleashed := strconv.FormatBool(t.Leashed)\n\tfmt.Printf(\"Leashed status:%s\\n\", leashed)\n\tinstance_data := t.Instance\n\tapp_name := instance_data.AppName()\n\tfmt.Printf(\"Application name:%s\\n\", app_name)\n\taccount_name := instance_data.AccountName()\n\tfmt.Printf(\"Account name:%s\\n\", account_name)\n\tregion_name := instance_data.RegionName()\n\tfmt.Printf(\"Region name:%s\\n\", region_name)\n\tstack_name := instance_data.StackName()\n\tfmt.Printf(\"Stack name:%s\\n\", stack_name)\n\tcluster_name := instance_data.ClusterName()\n\tfmt.Printf(\"Cluster name:%s\\n\", cluster_name)\n\tasg_name := instance_data.ASGName()\n\tfmt.Printf(\"ASG name:%s\\n\", asg_name)\n\tinstance_id := instance_data.ID()\n\tfmt.Printf(\"Instance ID:%s\\n\", instance_id)\n\tcloud_provider := instance_data.CloudProvider()\n\tfmt.Printf(\"Cloud Provider:%s\\n\", cloud_provider)\n\tmessage_format := `Termination time:%s\n\tLeashed status:%s\n\t----------- Instance details are given below: ------------\n\tApplication name: %s \n\tAccount name: %s\n\tRegion name: %s \n\tStack name: %s \n\tCluster name: %s \n\tAuto Scaling Group name: %s \n\tInstance-ID: %s\n\tCloud Provider:%s`\n\tmessage_text := fmt.Sprintf(message_format, termination_time, leashed, app_name, account_name, region_name, stack_name, cluster_name, asg_name, instance_id, cloud_provider)\n\tpayload := slack.Payload{\n\t\tText: message_text,\n\t\tAttachments: []slack.Attachment{attachment1},\n\t}\n\tslack.Send(webhookUrl, \"\", payload)\n\tfmt.Printf(\"Webhook got executed\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "3dccf6b3c8b6dbd6b9234d5d96212609", "score": "0.51193035", "text": "func (c *Client) Post(url string, hooks ...RequestHook) (*Response, error) {\n\treturn c.Send(MethodPost, url, hooks...)\n}", "title": "" }, { "docid": "4ca871e30b5543e75f2bee6955d69af6", "score": "0.510142", "text": "func postToSlack(title, cause, stackTrace string, contents map[string]string) error {\n\tlenContents := len(contents)\n\tattachments := make([]map[string]interface{}, lenContents+1)\n\tif lenContents > 0 {\n\t\tfor k, v := range contents {\n\t\t\tattachments = append(attachments,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"text\": toCodeSnippet(v),\n\t\t\t\t\t\"color\": \"#e50606\",\n\t\t\t\t\t\"title\": k,\n\t\t\t\t\t\"short\": true,\n\t\t\t\t\t\"mrkdwn_in\": []string{\"text\"},\n\t\t\t\t})\n\t\t}\n\t}\n\n\tattachments = append(attachments,\n\t\tmap[string]interface{}{\n\t\t\t\"text\": toCodeSnippet(stackTrace),\n\t\t\t\"color\": \"#e50606\",\n\t\t\t\"title\": \"Stack Trace\",\n\t\t\t\"short\": true,\n\t\t\t\"mrkdwn_in\": []string{\"text\"},\n\t\t\t//add fields for panic cause\n\t\t\t\"fields\": []map[string]interface{}{\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"title\": \"Panic Cause\",\n\t\t\t\t\t\"value\": cause,\n\t\t\t\t\t\"short\": true,\n\t\t\t\t},\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"title\": \"Host & Start Time\",\n\t\t\t\t\t\"value\": host + \"\\n\" + startedAt,\n\t\t\t\t\t\"short\": true,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\tpayload := map[string]interface{}{\n\t\t\"text\": title,\n\t\t//Enable slack to parse mention @<someone>\n\t\t\"link_names\": 1,\n\t\t\"attachments\": attachments,\n\t}\n\tif cfg.Channel != \"\" {\n\t\tpayload[\"channel\"] = cfg.Channel\n\t}\n\tb, err := json.Marshal(payload)\n\tif err != nil {\n\t\tlog.Println(\"[panix] marshal err\", err, title, cause, stackTrace)\n\t\treturn err\n\t}\n\n\tclient := http.Client{\n\t\tTimeout: 5 * time.Second,\n\t}\n\n\tresp, err := client.Post(cfg.WebHookURL, \"application/json\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 300 {\n\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[panix] error on capturing error : %s %s %s %s\\n\", err, title, cause, stackTrace)\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"[panix] error on capturing error : %s %s %s %s\\n\", string(b), title, cause, stackTrace)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "99fe4f2a510941151b77d6a5f54875f2", "score": "0.5101157", "text": "func (a *SlackAction) post(e *docker.APIEvents) {\n\n\tcontainer, _, _ := repository.Listener.(*listener.DockerListener).ResolveIPPort(e)\n\n\tvar message string\n\n\tswitch e.Status {\n\tcase \"start\":\n\t\tmessage = fmt.Sprintf(\"[CREATED]container http://%s.%s is created.\", container.Name[1:], a.BaseDomain)\n\tcase \"die\":\n\t\tmessage = fmt.Sprintf(\"[DIED]container http://%s.%s is down.\", container.Name[1:], a.BaseDomain)\n\t}\n\n\tparams, _ := json.Marshal(struct {\n\t\tText string `json:\"text\"`\n\t}{\n\t\tText: message,\n\t})\n\n\tresp, _ := http.PostForm(\n\t\ta.IncomingURL,\n\t\turl.Values{\"payload\": {string(params)}},\n\t)\n\n\tdefer resp.Body.Close()\n}", "title": "" }, { "docid": "46c8419d185c1426a1ac773df84f97d2", "score": "0.5041193", "text": "func PostToWebhook(url string, card Card) error {\n\treturn PostToWebhookWithClient(http.DefaultClient, url, card)\n}", "title": "" }, { "docid": "8270e92b814a3fa0b3d91396e26e01e1", "score": "0.50208753", "text": "func (c *client) call(payload []byte) (result []byte, err error) {\n\tvar req *http.Request\n\tvar resp *http.Response\n\trawurl := fmt.Sprintf(\"%s/%s/%s/%s\", c.apiDomain, c.apiWebhook, c.apiId, c.apiToken)\n\tif req, err = http.NewRequest(\"POST\", rawurl, bytes.NewReader(payload)); err != nil {\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif resp, err = c.do(req); err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tif result, err = ioutil.ReadAll(resp.Body); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "22592f4030b78e3768bfcf8aa6f192b6", "score": "0.5019409", "text": "func (b *Bot) PostRequest(\n\tctx context.Context,\n\tendpoint string,\n\tparams url.Values,\n) (code int, err error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tb.Logger.Log(fmt.Sprintf(\"HTTP POST for %s took %v\", endpoint, time.Since(start)))\n\t}()\n\n\tvar req *http.Request\n\treq, err = http.NewRequest(\n\t\thttp.MethodPost,\n\t\tb.getURL(endpoint),\n\t\tstrings.NewReader(params.Encode()),\n\t)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to construct http request: %w\", err)\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", postFormContentType)\n\tvar resp *http.Response\n\tresp, err = http.DefaultClient.Do(req.WithContext(ctx))\n\tif resp != nil && resp.Body != nil {\n\t\tdefer url2epub.DrainAndClose(resp.Body)\n\t}\n\tif err != nil {\n\t\terr = fmt.Errorf(\"%s err: %w\", endpoint, err)\n\t\treturn\n\t}\n\tcode = resp.StatusCode\n\tif resp.StatusCode != http.StatusOK {\n\t\tbuf, _ := ioutil.ReadAll(resp.Body)\n\t\terr = fmt.Errorf(\n\t\t\t\"%s failed: code = %d, body = %q\",\n\t\t\tendpoint,\n\t\t\tresp.StatusCode,\n\t\t\tbuf,\n\t\t)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e37a010d0ad488d854de84608b6a8ef5", "score": "0.50146896", "text": "func (slack Slack) Send(webHookURL string) (error) {\r\n\t_, err := http.PostForm(\r\n webHookURL,\r\n url.Values{\"payload\": {slack.json()}},\r\n\t)\r\n\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t}\r\n\t\r\n\treturn err\r\n}", "title": "" }, { "docid": "d75a8e6e906938588f92352498de93aa", "score": "0.50079405", "text": "func (kf *KeyFinder) PostSlackMessage(key types.AccessKeyMetadata) {\n\tmsg := slack.SetText(key, kf.SlackChannel)\n\n\treq, err := http.NewRequest(http.MethodPost, kf.URL, bytes.NewBuffer(msg))\n\tif err != nil {\n\t\tfmt.Println(\"[ERROR] Failed to create http request\")\n\t\tpanic(err.Error())\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\thttpClient := &http.Client{}\n\n\tresp, err := httpClient.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"[ERROR] Failed to get response from Slack\")\n\t\tpanic(err.Error())\n\t}\n\n\tbuf := new(bytes.Buffer)\n\n\tbuf.ReadFrom(resp.Body)\n\n\tif buf.String() != \"ok\" {\n\t\tpanic(err.Error())\n\t}\n\n}", "title": "" }, { "docid": "058bab2f5cdf40836af606d5be24031f", "score": "0.49966946", "text": "func (a *SlackAction) postToSlack() {\n\tfor {\n\t\te := <-a.out\n\t\ta.post(e)\n\t}\n}", "title": "" }, { "docid": "10ac2e498241f4fb1aec858aa2efa2d6", "score": "0.4986386", "text": "func postStdinToSlack(text string) {\n\n\t// Make the datastructure with the text already there\n\tslackJSON := SlackPostJSON{Text: formatString(text)}\n\n\t// Marshall the JSON\n\tp, err := json.Marshal(&slackJSON)\n\n\t// Check the error\n\tif err != nil {\n\t\tfmt.Println(\"Failed to marshal JSON while posting to slack\")\n\t}\n\n\t// Make the post request\n\tresp, err := http.Post(slackURL, \"application/json\", bytes.NewBuffer(p))\n\n\t// Make sure the URL is right!\n\tif resp.StatusCode != http.StatusOK {\n\t\tfmt.Println(\"Request returned a non-200 status code. Check your Slack URL...\")\n\t}\n\n\t// Check the error\n\tif err != nil {\n\t\tfmt.Printf(\"Error making post request to Slack: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "15233ba2236a96f2e686882342cff670", "score": "0.49544823", "text": "func PostToWebhooks(urls []string, podEnv *K8PodEnv) {\n\tobjJSON, jsonErr := json.Marshal(podEnv)\n\tif jsonErr != nil {\n\t\tlogrus.Errorf(\"failed to marshal event to JSON: %v: %+v\", jsonErr, podEnv)\n\t\treturn\n\t}\n\n\tpodSlug := podEnv.Pod.Namespace + \"/\" + podEnv.Pod.Name\n\tfor _, url := range urls {\n\t\tgo func(u string) {\n\t\t\tlogrus.Infof(\"posting pod '%s' to '%s'\", podSlug, u)\n\t\t\tif err := postToWebhook(u, objJSON); err != nil {\n\t\t\t\tlogrus.Errorf(\"failed to post pod '%s' to '%s': %s\", podSlug, u, err.Error())\n\t\t\t}\n\t\t}(url)\n\t}\n}", "title": "" }, { "docid": "efd4ffb3d6c4b283607c23c142db90d3", "score": "0.48986793", "text": "func WebHook(c echo.Context) error {\n\tmessage := models.Response{}\n\tb, err := ioutil.ReadAll(c.Request().Body)\n\tif err != nil {\n\t\tlog.Printf(\"fail: %s\", err)\n\t\treturn c.String(http.StatusBadRequest, \"errr\")\n\t}\n\n\terr = json.Unmarshal(b, &message)\n\tif err != nil {\n\t\tlog.Printf(\"fail: %s\", err)\n\t\treturn c.String(http.StatusBadRequest, \"errr\")\n\t}\n\n\tlog.Printf(\"value: %+v\", message)\n\tuserNameSender := message.Message.Sender.FirstName + \" \" + message.Message.Sender.LastName\n\ttextResponse := \"Bot này không có thời gian tán gẫu với bạn đâu nhé. \\n Hãy dùng command để nói chuyện /help\"\n\tswitch message.Message.Text {\n\tcase \"/start\":\n\t\ttextResponse = \"Chào mừng bạn \" + userNameSender + \" đã đến với Super Bot. Hãy sử dụng lệnh /help để tìm hiểu về tính năng của Bot\"\n\tcase \"/help\":\n\t\ttextResponse = \"Sử dụng: \\n /weather - Lấy thông tin về thời tiết. \\n /corona - Để lấy thông tin về Corona \\n /subscribe - Để nhận tin nhắn Bot mỗi ngày\"\n\tcase \"/weather\":\n\t\ttextResponse = getWeather()\n\t\t// textResponse = \"Tính năng thời tiết đang trong quá trinh hoàn thiện\"\n\tcase \"/donate\":\n\t\ttextResponse = \"Ủng hộ tác giả tại VP Bank :193528139 \\n Chân thành cảm ơn !!!\"\n\tcase \"/corona\":\n\t\ttextResponse = \"Tính năng cập nhật thông tin về corona đang trong quá trình hoàn thiện\"\n\n\t}\n\n\tSend(textResponse, message.Message.Sender.ID)\n\treturn c.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"statusCode\": 200,\n\t\t\"message\": message.Message,\n\t})\n}", "title": "" }, { "docid": "a16a465b596fdd7587849733f7def30b", "score": "0.4884171", "text": "func post(ctx context.Context, url string, request, response interface{}) error {\r\n\tvar transport = &http.Transport{\r\n\t\tDial: (&net.Dialer{\r\n\t\t\tTimeout: 5 * time.Second,\r\n\t\t}).Dial,\r\n\t\tTLSHandshakeTimeout: 5 * time.Second,\r\n\t}\r\n\r\n\tvar client = &http.Client{\r\n\t\tTimeout: time.Second * 10,\r\n\t\tTransport: transport,\r\n\t}\r\n\r\n\tb, err := json.Marshal(request)\r\n\tif err != nil {\r\n\t\treturn errors.Wrap(err, \"marshal request\")\r\n\t}\r\n\r\n\tlogger.Verbose(ctx, \"POST URL : %s\\nRequest : %s\", url, string(b))\r\n\r\n\thttpResponse, err := client.Post(url, \"application/json\", bytes.NewReader(b))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tif httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {\r\n\t\tswitch httpResponse.StatusCode {\r\n\t\tcase http.StatusNotFound:\r\n\t\t\treturn errors.Wrap(ErrNotFound, httpResponse.Status)\r\n\t\tcase http.StatusUnauthorized:\r\n\t\t\treturn errors.Wrap(ErrUnauthorized, httpResponse.Status)\r\n\t\t}\r\n\r\n\t\treturn fmt.Errorf(\"%d %s\", httpResponse.StatusCode, httpResponse.Status)\r\n\t}\r\n\r\n\tdefer httpResponse.Body.Close()\r\n\r\n\tif response != nil {\r\n\t\tb, err := ioutil.ReadAll(httpResponse.Body)\r\n\t\tif err != nil {\r\n\t\t\treturn errors.Wrap(err, \"read response\")\r\n\t\t}\r\n\t\tif err := json.Unmarshal(b, response); err != nil {\r\n\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"decode response : \\n%s\\n\", string(b)))\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "138cd822a2107029ac9cce05b60ea24f", "score": "0.4883899", "text": "func (h SlackWebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "881570edf65ad8b70f9e89141e3af320", "score": "0.48765132", "text": "func recordResponse(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\th.ServeHTTP(&responseProxy{ResponseWriter: w}, r)\n\t})\n}", "title": "" }, { "docid": "514718e377bcebba243fafbbce1ee7ab", "score": "0.48743275", "text": "func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\n\t//Get the path parameter that was sent\n\tname := request.PathParameters[\"name\"]\n\n\t//Get the query parameter that was sent\n\tmsg := request.QueryStringParameters[\"msg\"]\n\n\ttest := TestResponse{\n\t\tName: name,\n\t\tMsg: msg,\n\t}\n\tjsonRes, err := json.Marshal(test)\n\tif err != nil {\n\t\treturn events.APIGatewayProxyResponse{\n\t\t\tBody: err.Error(),\n\t\t\tStatusCode: 400,\n\t\t}, nil\n\t}\n\n\t//Generate message that want to be sent as body\n\t// message := fmt.Sprintf(\" { \\\"Message\\\" : \\\"Hello %s %s \\\" } \", name, msg)\n\n\t//Returning response with AWS Lambda Proxy Response\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: string(jsonRes),\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "b55a8c3e995da3b67bcab9902de9767e", "score": "0.4848679", "text": "func (client LROsClient) Post200WithPayloadResponder(resp *http.Response) (result Sku, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "0df1cacf4e05843a842cf4e434fcfb01", "score": "0.4829266", "text": "func (c client) SetWebHook(url string) (WebHookResponse, error) {\n\tresponse := WebHookResponse{}\n\n\tpayload := strings.NewReader(fmt.Sprintf(\"{\\\"webHookUrl\\\": \\\"%s\\\"}\", url))\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.monobank.ua/personal/webhook\", payload)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"[monoapi] webhook, NewRequest\")\n\t\treturn response, err\n\t}\n\n\treq.Header.Add(\"X-Token\", c.token)\n\treq.Header.Add(\"content-type\", \"application/json\")\n\n\treturn DoRequest(response, req)\n}", "title": "" }, { "docid": "2e52e0973095dfc1e928618698156be7", "score": "0.4808499", "text": "func (httpRecorder *recordServer) webhookHandler(w http.ResponseWriter, r *http.Request) {\n\twrappedReq, err := newHTTPRequest(r)\n\tif err != nil {\n\t\twriteErrorToHTTPResponse(w, httpRecorder.log, fmt.Errorf(\"unexpected error processing incoming webhook request: %w\", err), 500)\n\t\treturn\n\t}\n\n\tvar evt stripeEvent\n\terr = json.Unmarshal(wrappedReq.Body, &evt)\n\tif err != nil {\n\t\twriteErrorToHTTPResponse(w, httpRecorder.log, fmt.Errorf(\"unexpected error processing incoming webhook request: %w\", err), 500)\n\t\treturn\n\t}\n\n\t// --- Pass request to local webhook endpoint\n\thttpRecorder.log.Infof(\"[WEBHOOK] %v [%v] to %v --> FORWARDED to %v\", r.Method, evt.Type, r.RequestURI, httpRecorder.webhookURL)\n\n\tresp, err := forwardRequest(&wrappedReq, httpRecorder.webhookURL)\n\t// NOTE: this response is going back to Stripe, so for internal `playback` server errors - return a 500 response with an error msg in the body\n\t// The details of this response will be visible on the Developer Dashboard under \"Webhook CLI Responses\"\n\t// (^ this all assuming that playback is using `stripe listen` to receive webhooks)\n\tif err != nil {\n\t\twriteErrorToHTTPResponse(w, httpRecorder.log, fmt.Errorf(\"unexpected error forwarding [%v] webhook to client: %w\", evt.Type, err), 500)\n\t\treturn\n\t}\n\twrappedResp, err := newHTTPResponse(resp)\n\tif err != nil {\n\t\twriteErrorToHTTPResponse(w, httpRecorder.log, fmt.Errorf(\"unexpected error forwarding [%v] webhook to client: %w\", evt.Type, err), 500)\n\t\treturn\n\t}\n\n\t// --- Write response back to client\n\n\t// We defer writing anything to the response until their final values are known, since certain fields can\n\t// only be written once. (golang's implementation streams the response, and immediately writes data as it is set)\n\terr = httpRecorder.recorder.write(incomingInteraction, wrappedReq, wrappedResp)\n\tif err != nil {\n\t\twriteErrorToHTTPResponse(w, httpRecorder.log, fmt.Errorf(\"unexpected error writing [%v] webhook interaction to cassette: %w\", evt.Type, err), 500)\n\t\treturn\n\t}\n\n\t// Now we can write to the response:\n\t// The header *must* be written first, since writing the body with implicitly and irreversibly set\n\t// the status code to 200 if not already set.\n\tcopyHTTPHeader(w.Header(), wrappedResp.Headers) // header map must be written before calling w.WriteHeader\n\tw.WriteHeader(wrappedResp.StatusCode)\n\t_, err = io.Copy(w, bytes.NewBuffer(wrappedResp.Body))\n\n\t// Since at this point, we can't signal an error by writing the HTTP status code, and this is a significant failure - we log.Fatal\n\t// so that the failure is clear to the user.\n\tif err != nil {\n\t\thttpRecorder.log.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "3c3b451ca8f40999b95bd66e22168a09", "score": "0.480754", "text": "func (e *EventListener) eventURLVerification(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tp EventPayload,\n) {\n\tresp := URLVerificationResponse{\n\t\tChallenge: p.Challenge,\n\t}\n\n\tbuf, err := json.Marshal(resp)\n\tif err != nil {\n\t\te.log(r, \"error marshaling url_verification response: %s\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tn, err := w.Write(buf)\n\tif err != nil {\n\t\te.log(r, \"error writing url_verification response: %s\", err)\n\t\treturn\n\t}\n\tif n != len(buf) {\n\t\te.log(r, \"error writing url_verification response: short write\")\n\t\treturn\n\t}\n\n\te.log(r, \"Processed url_verification event\")\n}", "title": "" }, { "docid": "8278526f56310dbcef1abe060d084421", "score": "0.48034894", "text": "func PostToWebhookWithClient(client *http.Client, url string, card Card) error {\n\tcard.Type = \"@MessageCard\"\n\tcard.Context = \"http://schema.org/extensions\"\n\n\tmessageJSON, err := json.Marshal(card)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := client.Post(url, \"text/json\", strings.NewReader(string(messageJSON)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif string(data) != \"1\" {\n\t\treturn fmt.Errorf(\"teams: unexpected response '%s'\", data)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a89139b93931e0d63aa5f29a4f97471", "score": "0.4767075", "text": "func post(url string, request, response interface{}) (int, error) {\n\tm, err := json.Marshal(&request)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(m))\n\tif err != nil {\n\t\treturn http.StatusBadRequest, err\n\t}\n\n\treturn invoke(req, response)\n}", "title": "" }, { "docid": "ec032607d81f245a9d8775a7051d2f74", "score": "0.47561795", "text": "func (req *Request) Post(url, data string, queryParams []string) ([]byte, error) {\n\treturn mockResponse, nil\n}", "title": "" }, { "docid": "f29f098b843d01ab08e6469a627a5ce1", "score": "0.474252", "text": "func (c *Client) postRequest(requestURL string, data interface{}) (response StandardResponse, err error) {\r\n\r\n\t// Set POST defaults\r\n\tc.Resty.SetTimeout(time.Duration(c.Options.PostTimeout) * time.Second)\r\n\r\n\t// Set the user agent\r\n\treq := c.Resty.R().SetBody(data).SetHeader(\"User-Agent\", c.Options.UserAgent)\r\n\r\n\t// Enable tracing\r\n\tif c.Options.RequestTracing {\r\n\t\treq.EnableTrace()\r\n\t}\r\n\r\n\t// Fire the request\r\n\tvar resp *resty.Response\r\n\tif resp, err = req.Post(requestURL); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Tracing enabled?\r\n\tif c.Options.RequestTracing {\r\n\t\tresponse.Tracing = resp.Request.TraceInfo()\r\n\t}\r\n\r\n\t// Set the status code\r\n\tresponse.StatusCode = resp.StatusCode()\r\n\r\n\t// Set the body\r\n\tresponse.Body = resp.Body()\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "e16877951a3c722affe40adbe0066e70", "score": "0.47207963", "text": "func (r *Reporter) post(data []byte) error {\n\treq, err := http.NewRequest(\"POST\", r.endpoint, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := r.handlerFunc(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tio.Copy(r.output, resp.Body)\n\tio.WriteString(r.output, \"\\n\")\n\n\treturn nil\n}", "title": "" }, { "docid": "3aa2afc3b92af82338e1497284d0d73a", "score": "0.47168094", "text": "func run(payload string) {\n\n\tfmt.Println(White + \"[\" + Blue + \"~\" + White + \"] Searching for URL(s)\")\n\tfmt.Println(White + \"[\" + Green+ \"~\" + White + \"] Payload: \" + payload)\n\tfmt.Println(White + \"========================================================================================\\n\")\n\t\t\n\tfmt.Println(\"Status Code\\tBytes\\t\\tURL\")\n\tfmt.Println(\"-----------\\t-----\\t\\t---\\n\")\n\t// Create the output directory\n\t_,err := os.Stat(\"output\")\n\tif os.IsNotExist(err) {\n\t\terrDir := os.Mkdir(\"output\", 0755)\t\n\t\tif errDir != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// Create the response file\n\tf,err := os.Create(\"output/responses.txt\")\n if err != nil{\n \tlog.Fatal(err)\n }\n\n\t// Create the 'NewScanner' object and print each line in the file\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\n\n\t\t// Parse the URL\n\t\tu,err := url.Parse(scanner.Text())\n\t\tif err != nil{\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t// Fetch the URL Values\n\t\tqs := url.Values{}\n\t\t\n\n\t\t// Get the url paraemters and set the newvalue (payload)\n\t\tfor param,vv := range u.Query() {\n\t\t\tqs.Set(param, vv[0]+payload)\n\t\t}\n\n\t\t// Url encoding the url\n\t\t//u.RawQuery = qs.Encode()\n\t\t\n\t\t// Dump the response\n\t\tresp,err := http.Get(scanner.Text())\n\t\tif err != nil {\n log.Fatal(err)\n }\n\n\t\tdump,err := httputil.DumpResponse(resp, true)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tl,err := f.WriteString(string(dump))\n\t\tif err != nil {\n log.Fatal(err)\n }\n\n\t\tdefer resp.Body.Close()\n\n\t\t// Print the values\n\t\tfmt.Printf(\"%s\\t\", resp.StatusCode)\n\t\tfmt.Printf(\"%d Bytes\\t\", l)\n\t\tfmt.Println(White + \"[\" + Green + \"~\" + White + \"] \" + White + u.String()) \n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "91dd60bfc01607e5d82d8e239460dbaa", "score": "0.47071382", "text": "func (o *DuplicateRequestURITooLong) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(414)\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": "1176b29b211199da1f791c77bc07d6c6", "score": "0.47040462", "text": "func Post(target string, payload string) (int, string) {\n\t// Variables\n\tvar err error // Error catching\n\tvar res *http.Response // HTTP response\n\tvar req *http.Request // HTTP request\n\tvar body []byte // Body response\n\n\t// Build request\n\tl.Debug(bytes.NewBufferString(payload))\n\treq, _ = http.NewRequest(\"POST\", target, bytes.NewBufferString(payload))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Do request\n\tclient := &http.Client{}\n\tclient.Transport = &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: time.Duration(HTTPTimeout) * time.Second,\n\t\t\tKeepAlive: time.Duration(HTTPTimeout) * time.Second,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: time.Duration(HTTPTimeout) * time.Second,\n\t}\n\n\tres, err = client.Do(req)\n\n\tif err != nil {\n\t\tl.Error(\"Error : Curl POST : \" + err.Error())\n\t\tif res != nil {\n\t\t\treturn res.StatusCode, \"\"\n\t\t}\n\n\t\treturn 0, \"\"\n\t}\n\tdefer res.Body.Close()\n\n\t// Read body\n\tbody, err = ioutil.ReadAll(res.Body)\n\tres.Body.Close()\n\tif err != nil {\n\t\tl.Error(\"Error : Curl POST body read : \" + err.Error())\n\t}\n\n\treturn res.StatusCode, string(body)\n}", "title": "" }, { "docid": "77935512054b51397585423d42c08eda", "score": "0.46957204", "text": "func RespondingLater(url string, content interface{}) {\n\tobj, ok := content.(model.Publicer)\n\tif ok {\n\t\tcontent = obj.Public()\n\t}\n\tcont, err := model.Jsonify(content)\n\tif err != nil {\n\t\tnewError := exception.NewInternalError(err.Error())\n\t\tRespondingLater(url, newError)\n\t\treturn\n\t}\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(cont))\n\tif err != nil {\n\t\tpanic(exception.NewInternalError(\"Could not make post request: \" + err.Error()))\n\t}\n\treq.Header.Set(\"Content-type\", \"application/json\")\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(exception.NewInternalError(\"Could not get a response from post request: \" + err.Error()))\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tpanic(exception.NewInternalError(\"Slack did not like request: \" + err.Error()))\n\t}\n}", "title": "" }, { "docid": "04a8f0c4c8020403375b938e38586292", "score": "0.46953955", "text": "func PostBody(app *api.App, url string, payload string) (int, string) {\n\treturn sendBody(app, \"POST\", url, payload)\n}", "title": "" }, { "docid": "caaca34792c5a07989751771ba516755", "score": "0.46924984", "text": "func slackPrint(r response) (err error) {\n\tswitch {\n\tcase r.isEphemeral:\n\t\t_, err = postEphemeral(r.channel, r.user, r.message)\n\tdefault:\n\t\trtm.SendMessage(rtm.NewOutgoingMessage(r.message, r.channel, slack.RTMsgOptionTS(r.threadTS)))\n\t\terr = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c0150ff79e06db85b92fecbef9ed8e4", "score": "0.46913537", "text": "func PostCustom(hook string, d Data, post func(string, string, io.Reader) (*http.Response, error)) error {\n\tbuf, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot marshal json %#v: %v\", d, err)\n\t}\n\n\tresp, err := post(hook, \"application/json\", bytes.NewBuffer(buf))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to post to Slack: %v\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read response: %v\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"HTTP status code is not OK (%d): '%s'\", resp.StatusCode, body)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c3779b655e9b1518ffc51d2353f73eb", "score": "0.46747726", "text": "func PostJSON(app *api.App, url string, payload interface{}) (int, string) {\n\treturn sendJSON(app, \"POST\", url, payload)\n}", "title": "" }, { "docid": "23769c77a88548a54c6d9827e45edd18", "score": "0.46673998", "text": "func (fw *FinalizingWorker) postResults(result string) {\n\t// do we have a hook\n\tif 0 == len(fw.cfg.ResultsWebHook) {\n\t\treturn\n\t}\n\n\t// prep the result feed structure\n\tvar res struct {\n\t\tText string `json:\"text\"`\n\t}\n\tres.Text = result\n\n\t// prep JSON data feed from the structure\n\tdata, err := json.Marshal(res)\n\tif err != nil {\n\t\tfw.log.Errorf(\"can not create a JSON data feed; %s\", err.Error())\n\t\treturn\n\t}\n\n\t// create the HTTP request\n\treq, err := http.NewRequest(\"POST\", fw.cfg.ResultsWebHook, bytes.NewBuffer(data))\n\tif err != nil {\n\t\tfw.log.Errorf(\"can not create a POST request for the web hook; %s\", err.Error())\n\t\treturn\n\t}\n\n\t// set request details\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// make the client\n\tclient := &http.Client{}\n\n\t// perform the post request; we don't really care about the response\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\tfw.log.Errorf(\"can not create perform the web hook call; %s\", err.Error())\n\t\treturn\n\t}\n\n\t// close the response right away\n\tif err := response.Body.Close(); err != nil {\n\t\tfw.log.Errorf(\"error closing web hook call response body; %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "8c419fec03d6f195095baf48959b1e84", "score": "0.46518224", "text": "func (c *Client) Post(t TestingTB, urlStr string, body fmt.Stringer, expectedStatusCode int) *Response {\n\treturn c.Do(t, c.NewRequest(t, \"POST\", urlStr, body), expectedStatusCode)\n}", "title": "" }, { "docid": "a799cceac803e73f1bbb916f7f21fc05", "score": "0.46357703", "text": "func slackHandler(rw http.ResponseWriter, req *http.Request) {\n\tcmd, dest := extractParams(req)\n\n\t// if command is absent or \"help\", echo back usage.\n\tif cmd == \"\" || cmd == \"help\" {\n\t\tfmt.Fprintln(rw, slashUsage())\n\t\treturn\n\t}\n\n\t// otherwise, check against all possible rule triggers as commands\n\tfor _, r := range rules {\n\t\tif strings.Contains(cmd, r.trigger) {\n\t\t\t// post to destination\n\t\t\tpayload := r.formatForPostingTo(dest)\n\t\t\treq, err := http.NewRequest(\"POST\", webhookURL, bytes.NewBuffer(payload))\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.Fatal(err)\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\tif resp.StatusCode != 200 {\n\t\t\t\t// if something goes wrong in slack webhook, body has descriptive error\n\t\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\t\tfmt.Fprintf(rw, \"Something went wrong (%v): %v\", resp.Status, body)\n\t\t\t\tlog.Printf(\"WARNING: %v from Slack webhook: %v\\n\", resp.Status, body)\n\t\t\t}\n\n\t\t\t// echo success back if sent to user privately (so they know it worked)\n\t\t\t// only for private msgs since public messages are their own confirmation\n\t\t\tif strings.HasPrefix(dest, \"@\") {\n\t\t\t\tfmt.Fprintf(rw, `Okay, I sent \"%v\" to <%v>`, r.title, dest)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\t// we didnt recognize any of the commands, remind user of usage\n\tfmt.Fprintf(rw, \"Sorry I don't know about `%v`.\\n%v\", cmd, slashUsage())\n}", "title": "" }, { "docid": "b5583196e9fe56ab9032e919a34ef89e", "score": "0.4635216", "text": "func (app *appTest) AfterResponse(ctx context.Context) {\n}", "title": "" }, { "docid": "ee96d4ae81a9af8da096ec38d8db9db8", "score": "0.46308747", "text": "func HandleResponse(res *http.Response, err error, logBody bool) (resp SlackResponse, retErr error) {\n\tif err != nil {\n\t\tlog.Println(\"Error in HandleResponse:\")\n\t\tlog.Println(err)\n return SlackResponse{}, err\n\t} else {\n\t\tlog.Printf(\"Status: %s\", res.Status)\n body := CaptureResponseBody(res.Body)\n if logBody {\n\t\t log.Printf(body)\n }\n var resp SlackResponse\n err = json.Unmarshal([]byte(body), &resp)\n return resp, err\n\t}\n}", "title": "" }, { "docid": "34b9b6e2d19624594f52660594eab9a2", "score": "0.46233934", "text": "func PayloadSlack(text string) {\n\n\t// Add here your webhookurl\n\twebhookURL := \"https://hooks.slack.com/services/XXXX-XXXXX-XXXXX-XXXX\"\n\n\tpayload := slack.Payload{\n\t\tText: text,\n\t\tUsername: \"User\",\n\t\tChannel: \"#infra\",\n\t}\n\terr := slack.Send(webhookURL, \"\", payload)\n\tif len(err) > 0 {\n\t\tfmt.Printf(\"error : %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "8425fc82a3fb7bfe18b7f566a087be75", "score": "0.46107", "text": "func (cb *CallbackHandler) Post(w http.ResponseWriter, r *http.Request) {\n\n\t//Check type of event\n\treq := models.CallbackRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\tcb.logger.Errorf(\"error while decoding JSON: %v\", err)\n\t\treturn\n\t}\n\t//Check group id in callback request from api\n\tif req.GroupId.String() != cb.config.VK.Group {\n\t\tcb.logger.Error(errWrongGroupId)\n\t\treturn\n\t}\n\t//Check secret in callback request from api\n\tif req.Secret != cb.config.Callback.Secret {\n\t\tcb.logger.Error(errSecretMismatch)\n\t\treturn\n\t}\n\t// Switch action while type of event is\n\tswitch req.EventType {\n\tcase \"confirmation\":\n\t\tif err = cb.handleConfirmationEvent(w); err != nil {\n\t\t\tcb.logger.Errorf(\"error while handling confirmation event: %v\", err)\n\t\t}\n\t\treturn\n\tcase \"message_deny\":\n\t\tif err = cb.handleMessageDenyEvent(&req); err != nil {\n\t\t\tcb.logger.Errorf(\"error while handling message_deny event: %v\", err)\n\t\t}\n\tcase \"message_allow\":\n\t\tif err = cb.handleMessageAllowEvent(&req); err != nil {\n\t\t\tcb.logger.Errorf(\"error while handling message_allow event: %v\", err)\n\t\t}\n\tcase \"message_new\":\n\t\tif err = cb.handleMessageNewEvent(&req); err != nil {\n\t\t\tcb.logger.Errorf(\"error while handling message_new event: %v\", err)\n\t\t}\n\t}\n\tw.WriteHeader(http.StatusOK)\n\t_, err = w.Write([]byte(\"ok\"))\n\tif err != nil {\n\t\tcb.logger.Errorf(\"error while sending response to VK api: %v\", err)\n\t}\n}", "title": "" }, { "docid": "aa87d0bde5519a1fe701f44217c50213", "score": "0.46104252", "text": "func HandleCallback(w http.ResponseWriter, r *http.Request) {\n req := CaptureResponseBody(r.Body)\n var body SlackResponse\n json.Unmarshal([]byte(req), &body)\n if body.Type == \"url_verification\" {\n w.Write([]byte(body.Challenge))\n log.Println(\"Slack API Callback Url Verified\")\n return\n } else if body.Type == \"event_callback\" && body.Event.Type == \"message\" {\n w.Write([]byte(\"Message Received\"))\n name, err := GetUsername(body.Event.User)\n if name == BOT_NAME {\n return\n }\n log.Printf(\"Handle Message Callback for user: %s\\n\", body.Event.User)\n threadId := GetThreadId()\n if threadId == \"\" {\n MessageUser(body.Event.User, \"There is currently no open checkin session. Please try again later.\")\n return\n }\n\n if !UpdateUser(body.Event.User) {\n MessageUser(body.Event.User, \"Cannot change body once sent, please go to thread and post followup.\")\n return\n }\n\n if err != nil {\n log.Println(\"Error in HandleCallback:\")\n log.Println(err)\n }\n MessageUser(body.Event.User, fmt.Sprintf(\"Hey, thanks for your response! You should soon see it in <#%s> under the most recent thread. Hope the rest of your day goes well ;)\", MAIN_CHANNEL_ID))\n log.Printf(\"%s's Response: %s\", name, body.Event.Text)\n messageResp, err := SendMessage(fmt.Sprintf(\"%s's Response: %s\", name, body.Event.Text), MAIN_CHANNEL_ID, threadId)\n log.Println(messageResp.Error)\n } else if body.Type == \"event_callback\" && body.Event.Type == \"app_mention\" {\n MTX.Lock()\n if !IsCutoffOK() {\n log.Println(\"Cutoff too soon in app mention callback\")\n w.Write([]byte(\"Cutoff too soon in app mention callback\"))\n MTX.Unlock()\n return\n }\n LAST_MESSAGE = time.Now()\n\n if strings.Contains(body.Event.Text, OPEN_CHECKIN_STR) {\n OpenCheckin()\n log.Println(\"Checkin Opened by Event Callback\")\n w.Write([]byte(\"Checkin opened\"))\n } else if strings.Contains(body.Event.Text, CLOSE_CHECKIN_STR) {\n CloseCheckin()\n log.Println(\"Checkin Closed by Event Callback\")\n w.Write([]byte(\"Checkin closed\"))\n } else if strings.Contains(body.Event.Text, REMIND_CHECKIN_STR) { \n RemindCheckin()\n log.Println(\"Remind Awaiting by Event Callback\")\n w.Write([]byte(\"Checkin reminded\"))\n } else {\n log.Println(\"No action performed in app mention callback\")\n w.Write([]byte(\"No action performed in app mention callback\"))\n }\n MTX.Unlock()\n } else {\n log.Println(\"Unknown callback:\")\n log.Println(req)\n w.Write([]byte(\"HandleCallback but no valid condition found\"))\n }\n}", "title": "" }, { "docid": "0960fc762bb371cf42de108796568125", "score": "0.4609537", "text": "func (a *WebhooksApiService) TeamsUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload WebhookSubscription\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/teams/{username}/hooks\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "ec94bda61ca07e3cf97d682ff2b979d3", "score": "0.4608967", "text": "func (r *Request) Post(url string) (*Response, error) {\n\treturn r.Execute(POST, url)\n}", "title": "" }, { "docid": "eceaaf3838c2f064b6e50698e77843a5", "score": "0.4607357", "text": "func postMessage(conf Config, msg Message) error {\n\tb, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debugf(\"Request to Quill: %s\\n\", b)\n\n\turl := strings.TrimSpace(string(conf.WebhookURL))\n\tif url == \"\" {\n\t\turl = \"https://slack.com/api/chat.postMessage\"\n\t}\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewReader(b))\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tclient := &http.Client{}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to send the request: %s\", err)\n\t}\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); err == nil {\n\t\t\terr = cerr\n\t\t}\n\t}()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"server error: %s, failed to read response: %s\", resp.Status, err)\n\t\t}\n\t\treturn fmt.Errorf(\"server error: %s, response: %s\", resp.Status, body)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "da162784ede742a80a4408ce1602814e", "score": "0.46049127", "text": "func (o *PostTestReleaseNameOK) 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": "e8f5c18ad6e9f005a1d6ae80f612abbc", "score": "0.46020117", "text": "func post(channel string, text string) {\n\tvar msgOptionText = slack.MsgOptionText(text, true)\n\trespChannel, respTimestamp, err := client.PostMessage(channel, msgOptionText)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to post message to Slack with error %v\\n\", err)\n\t\treturn\n\t}\n\tlog.Printf(\"Message posted to channel %v at %v\\n\", respChannel, respTimestamp)\n}", "title": "" }, { "docid": "d6e69062273d8de01ac66a36f732119d", "score": "0.46002227", "text": "func verifyUrl(w http.ResponseWriter, bytes []byte) {\n\tvar r *slackevents.ChallengeResponse\n\terr := json.Unmarshal(bytes, &r)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\tw.Header().Set(\"Content-Type\", \"text\")\n\t_, _ = w.Write([]byte(r.Challenge))\n}", "title": "" }, { "docid": "9efa5cc5b98a873c87f947cd43bbebf1", "score": "0.45908716", "text": "func (p *Push) send(ctx context.Context, payload []byte) error {\n\tvar (\n\t\tresp *http.Response\n\t\terr error\n\t)\n\n\tpreq, err := p.parsePayload(payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpayload, err = proto.Marshal(preq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal payload to json: %w\", err)\n\t}\n\n\tpayload = snappy.Encode(nil, payload)\n\n\treq, err := http.NewRequest(\"POST\", p.lokiURL, bytes.NewReader(payload))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create push request: %w\", err)\n\t}\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"Content-Type\", p.contentType)\n\treq.Header.Set(\"User-Agent\", p.userAgent)\n\n\t// set org-id\n\tif p.tenantID != \"\" {\n\t\treq.Header.Set(\"X-Scope-OrgID\", p.tenantID)\n\t}\n\n\t// basic auth if provided\n\tif p.username != \"\" {\n\t\treq.SetBasicAuth(p.username, p.password)\n\t}\n\n\tbackoff := backoff.New(ctx, *p.backoff)\n\n\t// send log with retry\n\tfor {\n\t\tresp, err = p.httpClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to push payload: %w\", err)\n\t\t}\n\t\tstatus := resp.StatusCode\n\n\t\tif status/100 != 2 {\n\t\t\tscanner := bufio.NewScanner(io.LimitReader(resp.Body, defaultMaxReponseBufferLen))\n\t\t\tline := \"\"\n\t\t\tif scanner.Scan() {\n\t\t\t\tline = scanner.Text()\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"server returned HTTP status %s (%d): %s\", resp.Status, status, line)\n\n\t\t}\n\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\tlevel.Error(p.logger).Log(\"msg\", \"failed to close response body\", \"error\", err)\n\t\t}\n\n\t\tif status > 0 && status != 429 && status/100 != 5 {\n\t\t\tbreak\n\t\t}\n\n\t\tif !backoff.Ongoing() {\n\t\t\tbreak\n\t\t}\n\n\t\tlevel.Info(p.logger).Log(\"msg\", \"retrying as server returned non successful error\", \"status\", status, \"error\", err)\n\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "d5a72ea5f017b25b4e9282cec9f8ae4c", "score": "0.45824203", "text": "func Test_DockerRequestHandler_POST(t *testing.T) {\n\temail := setup()\n\tdefer teardown()\n\n\ttestBody := []byte(`{\"Payload\" : { \"TestBody\" : 1 } }`)\n\ttestPayload := map[string]interface{}{\"TestBody\": 1}\n\n\tjsonPayload, _ := json.Marshal(testPayload)\n\n\th := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Verify that the body is correctly transferred\n\t\tbody, _ := ioutil.ReadAll(r.Body)\n\t\tassert.Equal(t, string(jsonPayload), string(body))\n\n\t\tw.WriteHeader(200)\n\t\tw.Write([]byte(\"success\"))\n\t}\n\n\tdefer SetupServer(&h).Close()\n\n\tw := httptest.NewRecorder()\n\tr, _ := http.NewRequest(\"POST\", \"/\", bytes.NewBuffer(testBody))\n\tsession.SetValue(r, \"auth\", \"email\", email)\n\tinfo := handlers.HandlerInfo{\"\", \"localhost:8080\", &handlers.RequestBody{testPayload}, r, nil}\n\n\terr := DockerRequestHandler(w, info)\n\n\tassert.Nil(t, err, \"DockerRequestHandler should return nil error on valid request\")\n\n\tassert.Equal(t, 200, w.Code,\n\t\t\"DockerRequestHandler should output the forwarded request's response code.\")\n\n\tbody, _ := ioutil.ReadAll(w.Body)\n\n\tassert.Equal(t, \"success\", string(body),\n\t\t\"DockerRequestHandler should output the forwarded request's response body.\")\n}", "title": "" }, { "docid": "0145a9b45c7b1b0c17c32fb388b419fc", "score": "0.45785028", "text": "func (c *Client) Post(url string, body io.Reader, requestCallback func(r *http.Request)) (ResponseEntity, error) {\n\treturn c.Exchange(url, http.MethodPost, body, requestCallback)\n}", "title": "" }, { "docid": "2ed705e6f326978ae79a029c89268e47", "score": "0.4568044", "text": "func ResetPasswordLink(response http.ResponseWriter, request *http.Request) {\n\t// decode payload from request\n\tvar payload payloadmodels.ResetPasswordLink\n\tdecoderError := json.NewDecoder(request.Body).Decode(&payload)\n\tif decoderError != nil {\n\t\tutils.GetError(decoderError, response)\n\t\treturn\n\t}\n\t// validate payload\n\tvalidationError := validate.Struct(payload)\n\tif validationError != nil {\n\t\tfmt.Println(validationError.(validator.ValidationErrors)[0].Translate(trans))\n\t\tutils.GetError(errors.New(validationError.(validator.ValidationErrors)[0].Translate(trans)), response)\n\t\treturn\n\t}\n\t// send reset password link on email address and save token in db for validation\n\t_, sendEmailError := userservice.ResetPasswordLink(payload)\n\tif sendEmailError != nil {\n\t\tfmt.Println(\"Error occurred while send reset password email to user\")\n\t\tfmt.Println(sendEmailError)\n\t\tutils.GetError(sendEmailError, response)\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(map[string]string{\n\t\t\"Message\": \"Reset Password link has been sent on email address\",\n\t})\n}", "title": "" }, { "docid": "a1518053c7df4afb902fcceaab104467", "score": "0.45662907", "text": "func (x *ScheduledBranchReleaser) sendResponse(e transistor.Event, action transistor.Action, state transistor.State, stateMessage string, artifacts []transistor.Artifact) {\n\tevent := e.NewEvent(action, state, stateMessage)\n\tevent.Artifacts = artifacts\n\n\tx.events <- event\n}", "title": "" }, { "docid": "c79f2ee2969371f5b593400e135e13fe", "score": "0.4563369", "text": "func WithResponseSink(responseSink string) func(*corev1.Pod) {\n\treturn func(pod *corev1.Pod) {\n\t\tpod.Spec.Containers[0].Args = append(\n\t\t\tpod.Spec.Containers[0].Args,\n\t\t\t\"-response-sink\",\n\t\t\tresponseSink,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "8aa99c6b73a9073a911daf122099143d", "score": "0.45537063", "text": "func (m *MobileAppsHasPayloadLinksRequestBuilder) Post(ctx context.Context, body MobileAppsHasPayloadLinksPostRequestBodyable, requestConfiguration *MobileAppsHasPayloadLinksRequestBuilderPostRequestConfiguration)(MobileAppsHasPayloadLinksResponseable, error) {\n requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, CreateMobileAppsHasPayloadLinksResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(MobileAppsHasPayloadLinksResponseable), nil\n}", "title": "" }, { "docid": "4f606e310c8256885736a7063db9f101", "score": "0.45518953", "text": "func Events(params map[string]string, w http.ResponseWriter, r *http.Request) {\n // conf := config.GetAppConfiguration()\n //slackToken := conf.SlackToken :: todo: compare token to request token\n var event *slackApi.SlackEvent\n\n\n logging.Log.Info(\"Action at events controller\")\n\n if err := json.NewDecoder(r.Body).Decode(&event); err != nil {\n logging.Log.Errorf(\"Unable to decode Slack request header: %s\", err.Error())\n utils.SendError(w, utils.HttpError{\n Code: http.StatusBadRequest,\n Message: \"Could not read request body: \" + err.Error(),\n })\n return\n }\n\n if event.Type == \"url_verification\" {\n response := &slackApi.SlackChallenge{Challenge: event.Challenge}\n w.WriteHeader(http.StatusOK)\n w.Header().Add(\"Content-Type\", \"application/json\")\n json.NewEncoder(w).Encode(&response)\n } else if event.Type == \"event_callback\" {\n if dispatchError := slackDispatcher.Dispatch(event.Event[\"type\"].(string), *event,w,r); dispatchError != nil {\n logging.Log.Errorf(\"Error handling event type '%s': %s\", event.Type, dispatchError.Error())\n utils.SendError(w, utils.HttpError{\n Code: http.StatusBadRequest,\n Message: \"Error handling request: \" + dispatchError.Error(),\n })\n return\n }\n\n // We can safely just return here since the handlers call their own closers based on the content they want to send\n }\n\n}", "title": "" }, { "docid": "79b9bb4fa601a73827eadb3839992123", "score": "0.45490932", "text": "func (s *SlackSender) Send(repository Repository) error {\n var borderColor string;\n if (repository.Release.IsPrerelease) {\n borderColor = \"#FFC600\";\n } else {\n borderColor = \"#15e415\";\n }\n\n textContent := fmt.Sprintf(\n \"<%s|%s/%s>: <%s|%s> released\",\n repository.URL.String(),\n repository.Owner,\n repository.Name,\n repository.Release.URL.String(),\n repository.Release.Name,\n );\n\n payload := SlackPayload{\n Attachments: []SlackAttachment{{\n Fallback: textContent,\n Text: textContent,\n Pretext: fmt.Sprintf(\n \"*%s/%s* - _%s_\",\n repository.Owner,\n repository.Name,\n repository.Release.Name,\n ),\n Title: repository.Release.Name,\n TitleLink: repository.Release.URL.String(),\n Color: borderColor,\n Fields: []AttachmentField{\n {\n Title: \"Description\",\n Value: repository.Release.Description,\n Short: false,\n },\n },\n TS: repository.Release.PublishedAt.Unix(),\n Footer: \" \",\n FooterIcon: \"https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png\",\n MarkdownIn: []string{\"pretext\"},\n }},\n }\n\n\tpayloadData, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, s.Hook, bytes.NewReader(payloadData))\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\treq = req.WithContext(ctx)\n\tdefer cancel()\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\treturn fmt.Errorf(\"request didn't respond with 200 OK: %s, %s\", resp.Status, body)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "658ae98b7e1499f0b67fa0e331f3e902", "score": "0.45413414", "text": "func (request *SlackMessage) SendRequest(\n\turl string, token string,\n) error {\n\tpayload, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\n\t\t\"POST\",\n\t\turl,\n\t\tbytes.NewBuffer(payload),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Add(\n\t\t\"Content-Type\",\n\t\t\"application/json\",\n\t)\n\n\tif len(token) != 0 {\n\t\treq.Header.Add(\n\t\t\t\"Authorization\",\n\t\t\t\"Bearer \"+token,\n\t\t)\n\t}\n\n\tclient := &http.Client{}\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\n\t\t\t\"chat on %s returned %d status code\",\n\t\t\turl,\n\t\t\tresponse.StatusCode,\n\t\t)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "052d25dacdc2f85a4585db7c8bbfe778", "score": "0.45397195", "text": "func createLinkEndpoint(w http.ResponseWriter, r *http.Request) {\n\n\tparseErr := r.ParseForm()\n\tif parseErr != nil {\n\t\tresponse := response{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was a problem parsing your request.\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\n\tlink := r.PostFormValue(\"url\")\n\n\tif link == \"\" {\n\t\tresponse := response{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"No link provided.\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\n\t_, urlError := url.ParseRequestURI(link)\n\tif urlError != nil {\n\t\tresponse := response{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"Invalid URL provided.\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\n\tid, insertErr := db.InsertURL(link)\n\tif insertErr != nil {\n\t\tresponse := response{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was a problem creating this redirect.\",\n\t\t}\n\t\tjson.NewEncoder(w).Encode(response)\n\t\treturn\n\t}\n\n\tencodedString := EncodeID(id)\n\n\tresponse := response{\n\t\tStatus: \"success\",\n\t\tData: host + encodedString,\n\t}\n\n\tjson.NewEncoder(w).Encode(response)\n\treturn\n}", "title": "" }, { "docid": "6b418ce6a87604e0f41c32c94d33b98f", "score": "0.45209953", "text": "func (s *SlackMessenger) RespondToSlackRequest(text string, res http.ResponseWriter) {\n\tresponse := make(map[string]string)\n\tresponse[\"response_type\"] = \"in_channel\"\n\tresponse[\"text\"] = text\n\n\tres.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(res).Encode(response)\n}", "title": "" }, { "docid": "6f42c020a53cde38e497de1216ed7b07", "score": "0.4520931", "text": "func postSubscriptionsHandler(db storage.Store, w http.ResponseWriter, r *http.Request) {\n\tfeedURL := r.PostFormValue(\"url\")\n\tif len(feedURL) == 0 {\n\t\trender400(w, \"url parameter missing\")\n\t\treturn\n\t}\n\n\tsub := subscription.New()\n\terr := sub.Init(feedURL)\n\tif err != nil {\n\t\trender500(w, err.Error())\n\t\treturn\n\t}\n\tif err := db.WriteSubscription(sub); err != nil {\n\t\trender500(w, err.Error())\n\t\treturn\n\t}\n\tw.Write([]byte(strconv.Quote(\"ok\")))\n}", "title": "" }, { "docid": "592c0f7d8fec713f56a10ced7e95a91f", "score": "0.45192507", "text": "func Handler(ctx context.Context, r ProxyRequest) (Response, error) {\n\tlog.Printf(\"%s.Handler - submitted: %+v\", handler, r)\n\tform, err := url.Parse(\"?\" + r.Body)\n\tif err != nil {\n\t\tlog.Printf(\"%s.Handler - unmarhsal body error: %+v\", handler, err)\n\t}\n\tquery, _ := url.ParseQuery(form.RawQuery)\n\tpayload := query[\"payload\"][0]\n\trequest := Request{}\n\terr = json.Unmarshal([]byte(payload), &request)\n\tif err != nil {\n\t\tlog.Printf(\"%s.Handler - unmarhsal payload error: %+v\", handler, err)\n\t}\n\tif request.Token != os.Getenv(\"SLACK_VERIFICATION_TOKEN\") {\n\t\terr = errors.New(\"invalid verification token\")\n\t\treturn Response{\n\t\t\tStatusCode: 400,\n\t\t\tIsBase64Encoded: false,\n\t\t\tBody: fmt.Sprintf(\"%s submitting - error: %v\", handler, err),\n\t\t\tHeaders: map[string]string{\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t}, err\n\t}\n\n\terr = request.PutItem()\n\tlog.Printf(\"%s.Handler - submitted: %+v, error: %v\", handler, request, err)\n\n\tresp := Response{\n\t\tStatusCode: 200,\n\t\tIsBase64Encoded: false,\n\t\tBody: \"\",\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "38ce50f7af59b29f6914ecfb6299ee0d", "score": "0.45171627", "text": "func (s *Slack) PostMessage(m *PostMessageRequest, escape bool) (*PostMessageReply, error) {\n\t// Escape the special chars\n\ttext := \"\"\n\tif escape {\n\t\treplacer := strings.NewReplacer(\"&\", \"&amp;\", \"<\", \"&lt;\", \">\", \"&gt;\")\n\t\ttext = replacer.Replace(m.Text)\n\t} else {\n\t\ttext = m.Text\n\t}\n\tparams := url.Values{\n\t\t\"channel\": {m.Channel},\n\t\t\"text\": {text},\n\t}\n\tif m.Username != \"\" {\n\t\tparams.Set(\"username\", m.Username)\n\t}\n\tparams.Set(\"as_user\", strconv.FormatBool(m.AsUser))\n\tparams.Set(\"parse\", m.Parse)\n\tparams.Set(\"link_names\", strconv.Itoa(m.LinkNames))\n\tparams.Set(\"thread_ts\", m.ThreadID)\n\tif len(m.Attachments) > 0 {\n\t\tattachments, err := json.Marshal(m.Attachments)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams.Set(\"attachments\", string(attachments))\n\t}\n\tparams.Set(\"unfurl_links\", strconv.FormatBool(m.UnfurlLinks))\n\tparams.Set(\"unfurl_media\", strconv.FormatBool(m.UnfurlMedia))\n\tif m.IconURL != \"\" {\n\t\tparams.Set(\"icon_url\", m.IconURL)\n\t}\n\tif m.IconEmoji != \"\" {\n\t\tparams.Set(\"icon_emoji\", m.IconEmoji)\n\t}\n\tr := &PostMessageReply{}\n\terr := s.do(\"chat.postMessage\", params, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "7184f2dce5527c9565716f21ddb49f2f", "score": "0.4517034", "text": "func SendAdToSlack(ad Ad) (err error) {\n\ttext := fmt.Sprintf(\"%s: <%s|%s> %s\", ad.category, ad.url, ad.title, ad.price)\n\n\tpayload := map[string]string{\"text\": text}\n\tjsonPayload, jsonError := json.Marshal(payload)\n\tif jsonError != nil {\n\t\treturn jsonError\n\t}\n\n\tresp, err := http.PostForm(\n\t\tos.Getenv(\"SLACK_WEBHOOK_URL\"),\n\t\turl.Values{\"payload\": {string(jsonPayload)}})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Slack returned non-200 status code: %d\", resp.StatusCode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "89e985b3392ca49fa211da0d636a9722", "score": "0.4509495", "text": "func postFollowingOneRedirect(target string, contentType string, b bytes.Buffer) error {\n\tbackupReader := bytes.NewReader(b.Bytes())\n\tresp, err := http.Post(target, contentType, &b)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tstatusCode := resp.StatusCode\n\tdata, _ := ioutil.ReadAll(resp.Body)\n\treply := string(data)\n\n\tif strings.HasPrefix(reply, \"\\\"http\") {\n\t\turlStr := reply[1 : len(reply)-1]\n\n\t\tlog.Infoln(\"Post redirected to \", urlStr)\n\t\tresp2, err2 := http.Post(urlStr, contentType, backupReader)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tdefer resp2.Body.Close()\n\t\tdata, _ = ioutil.ReadAll(resp2.Body)\n\t\tstatusCode = resp2.StatusCode\n\t}\n\n\tlog.Infoln(\"Post returned status: \", statusCode, string(data))\n\tif statusCode != http.StatusOK {\n\t\treturn errors.New(string(data))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca63e51e94c66e6bcca6b4e8dabe5917", "score": "0.45083493", "text": "func handleResponse(w http.ResponseWriter, r *http.Request) {\n\tflow, err := strconv.Atoi(r.FormValue(\"flow\"))\n\tif err != nil {\n\t\tutils.ShowError(w, r, 400, \"OAuth 2.0 Flow Error\", \"Unrecognized flow\")\n\t\treturn\n\t}\n\n\tresponse := r.FormValue(\"response\")\n\tredirectURI, err := url.QueryUnescape(r.FormValue(\"redirectURI\"))\n\tif err != nil {\n\t\tutils.ShowError(w, r, http.StatusBadRequest, \"Bad Request\", \"Invalid redirect_uri\")\n\t\treturn\n\t}\n\n\tif response == \"ACCEPT\" {\n\t\tswitch flow {\n\t\tcase config.AuthCode:\n\t\t\tredirectURI += \"?code=\" + cache.NewAuthCodeGrant(redirectURI)\n\t\tcase config.Implicit:\n\t\t\ttoken, err := cache.NewImplicitToken()\n\t\t\tif err != nil {\n\t\t\t\tutils.ShowError(w, r, 500, \"Internal Server Error\", \"Token generation failed. Please try again.\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tredirectURI += fmt.Sprintf(\"#access_token=%s&token_type=bearer&expires_in=%d\", token.AccessToken, token.ExpiresIn)\n\t\t}\n\n\t} else if response == \"CANCEL\" {\n\t\tredirectURI += \"?error=access_denied\"\n\t}\n\n\thttp.Redirect(w, r, redirectURI, http.StatusSeeOther)\n}", "title": "" }, { "docid": "fb3ac6276bd1c91dff222796193043a5", "score": "0.4507121", "text": "func (s *Server) dispatch(endpoint string, payload []byte, h http.Header) error {\n\treq, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(payload))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header = h\n\tresp, err := s.do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\trb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\treturn fmt.Errorf(\"response has status %q and body %q\", resp.Status, string(rb))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f847a8611406b1fdd580850f6fc9defd", "score": "0.45063052", "text": "func POST(url string, buf *bytes.Buffer) (*http.Response, error) {\n\treq, err := http.NewRequest(\"POST\", url, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\treturn resp, err\n}", "title": "" }, { "docid": "63349707cea1774f37642ae8467ee263", "score": "0.44940057", "text": "func (a *TeamsApiService) TeamsUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload WebhookSubscription\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/teams/{username}/hooks\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "6d57917bd848c99df7c1c5174f84a6ee", "score": "0.44883943", "text": "func (handler *ProxyRequestHandler) forwardResponse(w http.ResponseWriter, response []byte) {\n\tlength, err := w.Write(response)\n\n\tif err != nil {\n\t\tOnError(w, handler.pipeline, http.StatusInternalServerError, proxy.DataSendFailed, err)\n\t\treturn\n\t}\n\n\thandler.pipeline.Log <- proxy.ForwardResponse + strconv.Itoa(length)\n}", "title": "" }, { "docid": "3b458b2fbbcaa814195b19758975af32", "score": "0.44826198", "text": "func HandleSlackEvent(api *slack.Client, botID string, management *manager.Management) func(*gin.Context) {\n\treturn func(c *gin.Context) {\n\n\t\tbuf := new(bytes.Buffer)\n\t\tbuf.ReadFrom(c.Request.Body)\n\t\tbody := buf.String()\n\t\teventsAPIEvent, err := slackevents.ParseEvent(json.RawMessage(body), slackevents.OptionVerifyToken(&slackevents.TokenComparator{VerificationToken: appruntime.Env.SlackVerificationToken}))\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tif eventsAPIEvent.Type == slackevents.URLVerification {\n\t\t\tvar r *slackevents.ChallengeResponse\n\t\t\terr := json.Unmarshal([]byte(body), &r)\n\t\t\tif err != nil {\n\t\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\t\t\tc.Abort()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.String(http.StatusOK, r.Challenge)\n\t\t}\n\n\t\tif eventsAPIEvent.Type == slackevents.CallbackEvent {\n\t\t\tinnerEvent := eventsAPIEvent.InnerEvent\n\t\t\tswitch ev := innerEvent.Data.(type) {\n\t\t\tcase *slackevents.MessageEvent:\n\t\t\t\ttag := fmt.Sprintf(\"<@%s>\", botID)\n\t\t\t\tif strings.HasPrefix(ev.Text, tag) {\n\t\t\t\t\tcmd := strings.TrimSpace(strings.ReplaceAll(ev.Text, tag, \"\"))\n\n\t\t\t\t\t// process cmd\n\t\t\t\t\tprojectName := c.Param(\"project\")\n\t\t\t\t\t_, messageManager := management.Get(kind.Message)\n\t\t\t\t\treplyStr, err := messageManager.Execute(projectName, cmd)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tappruntime.Logger.Error(fmt.Sprintf(\"[slack] process cmd [%s] error : %v\", cmd, err))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tappruntime.Logger.Debug(fmt.Sprintf(\"[slack] reply message:\\n%v\", replyStr))\n\t\t\t\t\tvar (\n\t\t\t\t\t\treply []*BlockMsg\n\t\t\t\t\t\tblocks []slack.Block\n\t\t\t\t\t)\n\t\t\t\t\tjson.Unmarshal([]byte(replyStr), &reply)\n\t\t\t\t\tfor _, block := range reply {\n\t\t\t\t\t\tblocks = append(blocks, block)\n\t\t\t\t\t}\n\t\t\t\t\tif _, _, err := api.PostMessage(ev.Channel, slack.MsgOptionBlocks(blocks...)); err != nil {\n\t\t\t\t\t\tappruntime.Logger.Error(err.Error())\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "36984370d5dd14bde235a319d4048030", "score": "0.44780266", "text": "func handleWebhook(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tw.Header().Set(\"Allow\", \"POST\")\n\t\thttp.Error(w, \"Only POST allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tctx := appengine.NewContext(r)\n\tid := r.Header.Get(\"X-GitHub-Delivery\")\n\tpayload, err := github.ValidatePayload(r, []byte(os.Getenv(\"CONTRIBUTEBOT_WEBHOOK_SECRET\")))\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"Validate %s: %v\", id, err)\n\t\thttp.Error(w, \"Payload signature did not match\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err := publishEvent(ctx, r.Header, payload); err != nil {\n\t\tlog.Errorf(ctx, \"Publish %s: %v\", id, err)\n\t\thttp.Error(w, \"PubSub publish failed\", http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "d05778fe72aefde85af6994c6d31a9ff", "score": "0.44740984", "text": "func SendPayload(i *ReqInfo) (*http.Response, error) {\n\t// Initialization\n\tvar (\n\t\tjson = jsoniter.ConfigCompatibleWithStandardLibrary\n\t\tresp *http.Response\n\t\tcert tls.Certificate\n\t\tcertlist []tls.Certificate\n\t\terr error\n\t\tencodepayload []byte\n\t\tclientCACert []byte\n\t\taddr string\n\t\tportinfo string\n\t\tebody *bytes.Reader\n\t)\n\tclient := &http.Client{\n\t\tJar: i.CookieJar,\n\t}\n\n\tif i.Rawreq != nil {\n\t\tresp, err := client.Do(i.Rawreq)\n\t\tif err != nil {\n\t\t\treturn resp, fmt.Errorf(\"Client do error pkg-klinreq %v\", err)\n\t\t}\n\t\treturn resp, nil\n\t}\n\n\tif i.Cert != \"\" && i.Key != \"\" {\n\t\tcert, err = tls.LoadX509KeyPair(i.Cert, i.Key)\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t}\n\n\tif len(i.CertBytes) != 0 && len(i.KeyBytes) != 0 {\n\t\tcert, err = tls.X509KeyPair(i.CertBytes, i.KeyBytes)\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t}\n\tcertlist = append(certlist, cert)\n\n\t// Load our CA certificate\n\tif i.Trust != \"\" {\n\t\tclientCACert, err = ioutil.ReadFile(i.Trust)\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t}\n\tif len(i.TrustBytes) != 0 {\n\t\tclientCACert = i.TrustBytes\n\t}\n\n\tclientCertPool := x509.NewCertPool()\n\tclientCertPool.AppendCertsFromPEM(clientCACert)\n\n\ttlsConfig := &tls.Config{\n\t\tInsecureSkipVerify: i.InsecureSkipVerify,\n\t\tCertificates: certlist,\n\t}\n\tif i.Trust != \"\" {\n\t\ttlsConfig.RootCAs = clientCertPool\n\t}\n\tif len(i.TrustBytes) != 0 {\n\t\ttlsConfig.RootCAs = clientCertPool\n\t}\n\tif i.HttpVersion == 0 {\n\t\ti.HttpVersion = 2\n\t}\n\tswitch i.HttpVersion {\n\tcase 1:\n\t\tclient.Transport = &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t}\n\tcase 2:\n\t\tclient.Transport = &http2.Transport{\n\t\t\tTLSClientConfig: tlsConfig,\n\t\t}\n\tdefault:\n\t\treturn resp, errors.New(\"Wrong https version please specify 1 or 2 you specified\" + strconv.Itoa(i.HttpVersion))\n\t}\n\tif i.TimeOut == 0 {\n\t\tclient.Timeout = time.Duration(20000) * time.Millisecond\n\t} else {\n\t\tclient.Timeout = time.Duration(i.TimeOut) * time.Millisecond\n\t}\n\tif i.Xml {\n\t\tencodepayload, err = xml.Marshal(i.Payload)\n\t} else {\n\t\tencodepayload, err = json.Marshal(i.Payload)\n\t}\n\tif len(i.Route) > 0 {\n\t\tif string(i.Route[0]) != \"/\" {\n\t\t\ti.Route = \"/\" + i.Route\n\t\t}\n\t}\n\tif i.Dport == \"\" {\n\t\tportinfo = \"\"\n\t} else {\n\t\tportinfo = \":\" + i.Dport\n\t}\n\tif i.Http {\n\t\taddr = \"http://\" + i.Dest + portinfo + i.Route\n\t} else {\n\t\taddr = \"https://\" + i.Dest + portinfo + i.Route\n\t}\n\tif len(i.BodyBytes) > 0 {\n\t\tebody = bytes.NewReader(i.BodyBytes)\n\t} else {\n\t\tebody = bytes.NewReader(encodepayload)\n\t}\n\treq, err := http.NewRequest(i.Method, addr, ebody)\n\tif err != nil {\n\t\treturn resp, fmt.Errorf(\"Error making new request pkg-klinreq%v\", err)\n\t}\n\tfor k, v := range i.Headers {\n\t\treq.Header.Set(k, v)\n\t}\n\tresp, err = client.Do(req)\n\tif err != nil {\n\t\treturn resp, fmt.Errorf(\"client do error pkg-klinreq%v\", err)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "84e0e3c62a7c71f4250aef19c3409eb5", "score": "0.44686323", "text": "func addToSlack(w http.ResponseWriter, r *http.Request) {\n\t// Just generate random state\n\tb := make([]byte, 10)\n\t_, err := rand.Read(b)\n\tif err != nil {\n\t\twriteError(w, 500, err.Error())\n\t}\n\tglobalState = state{auth: hex.EncodeToString(b), ts: time.Now()}\n\tconf := &oauth2.Config{\n\t\tClientID: *clientID,\n\t\tClientSecret: *clientSecret,\n\t\tScopes: []string{\"client\"},\n\t\tEndpoint: oauth2.Endpoint{\n\t\t\tAuthURL: \"https://slack.com/oauth/authorize\",\n\t\t\tTokenURL: \"https://slack.com/api/oauth.access\", // not actually used here\n\t\t},\n\t}\n\turl := conf.AuthCodeURL(globalState.auth)\n\thttp.Redirect(w, r, url, http.StatusFound)\n}", "title": "" }, { "docid": "665b3bca3c9645b830b2245586a33f62", "score": "0.44655153", "text": "func (o *PostNextStepsReplyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\t// return empty array\n\t\tpayload = models.StepsReply{}\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": "4e76e07faaf0b03d80f0b9aa3edf21fb", "score": "0.44647008", "text": "func (c *Client) Post(url string, navigateLinks Navigate, headers Headers, body io.Reader, response interface{}) (*http.Response, error) {\n\treturn c.Do(\"POST\", url, navigateLinks, headers, body, response)\n}", "title": "" }, { "docid": "e375699f94da3e61cecf809d57ab11a1", "score": "0.44641083", "text": "func (o *CheckSizeStatusRequestURITooLong) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(414)\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": "c939d81d0fc073bdf0a49be4e4809e69", "score": "0.44621485", "text": "func (m *GenerateDownloadUriRequestBuilder) Post(ctx context.Context, requestConfiguration *GenerateDownloadUriRequestBuilderPostRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessReviewHistoryInstanceable, error) {\n requestInfo, err := m.CreatePostRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateAccessReviewHistoryInstanceFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessReviewHistoryInstanceable), nil\n}", "title": "" }, { "docid": "e623ee05d36594d686941515cb097fb0", "score": "0.44455013", "text": "func (c *Client) PostRequest(url string, request RequestInterface) (*http.Response, error) {\n\tc.secureRequest(request)\n\tdata, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := http.Post(c.baseURL+url, \"application/json\", bytes.NewReader(data))\n\treturn resp, err\n}", "title": "" }, { "docid": "f403f39325a9c68ba1726f56025897a1", "score": "0.4445297", "text": "func Poster(maTrackingUrl string, rawJsonPayload string, compression string, buf bytes.Buffer) {\n\n\tvar err error\n\tvar req *http.Request\n\n\tif (compression == \"gzip\") {\n\t\t// if request is for gzip based compression payload\n\t\t// send out request\n\t\treq, err = http.NewRequest(\"POST\", maTrackingUrl, &buf)\n\t\treq.Header.Set(\"Content-Encoding\", \"gzip\")\n\n\t} else {\n\t\t// send out plain request\n\t\tvar jsonStr = []byte(string(rawJsonPayload))\n\t\treq, err = http.NewRequest(\"POST\", maTrackingUrl, bytes.NewBuffer(jsonStr))\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tresp, err := http.DefaultClient.Do(req) // thread safe client\n\n\tif err != nil {\n\t\t//fmt.Println(\"Status:= \",err)\n\t\tatomic.AddUint64(&Counter4xx, 1)\n\t\treturn\n\t}\n\n\tstatusCode := resp.StatusCode\n\n\tswitch {\n\tcase (statusCode == 200) :\n\t\tatomic.AddUint64(&Counter2xx, 1)\n\n\tcase (statusCode >= 400 && statusCode < 500) :\n\t\tatomic.AddUint64(&Counter4xx, 1)\n\n\tcase (statusCode >= 500) :\n\t\tatomic.AddUint64(&Counter5xx, 1)\n\n\tdefault:\n\t\tfmt.Println(\"# None of the statusCode found.\")\n\t}\n\n\tdefer resp.Body.Close()\n}", "title": "" }, { "docid": "77a4c333bbf6d44f2776dd5bccba1a69", "score": "0.44434914", "text": "func (u *URLHandler) Post(url string, h http.Handler) {\n\tu.Set(\"POST\", url, h)\n}", "title": "" }, { "docid": "bc01370020d6d4bab047417ed921dc6b", "score": "0.44415438", "text": "func (bot *telegramToken) PostRequest(\n\tctx context.Context, endpoint string, params url.Values,\n) (code int) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tslog.InfoContext(\n\t\t\tctx,\n\t\t\t\"PostRequest: HTTP POST done\",\n\t\t\t\"endpoint\", endpoint,\n\t\t\t\"took\", time.Since(start),\n\t\t)\n\t}()\n\n\treq, err := http.NewRequest(\n\t\thttp.MethodPost,\n\t\tbot.getURL(endpoint),\n\t\tstrings.NewReader(params.Encode()),\n\t)\n\tif err != nil {\n\t\tslog.ErrorContext(\n\t\t\tctx,\n\t\t\t\"Failed to construct http request\",\n\t\t\t\"err\", err,\n\t\t)\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", postFormContentType)\n\tresp, err := httpClient.Do(req.WithContext(ctx))\n\tif resp != nil && resp.Body != nil {\n\t\tdefer DrainAndClose(resp.Body)\n\t}\n\tif err != nil {\n\t\tslog.ErrorContext(\n\t\t\tctx,\n\t\t\t\"PostRequest failed\",\n\t\t\t\"err\", err,\n\t\t\t\"endpoint\", endpoint,\n\t\t)\n\t\treturn\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tbuf, _ := io.ReadAll(resp.Body)\n\t\tslog.ErrorContext(\n\t\t\tctx,\n\t\t\t\"PostRequest got non-200\",\n\t\t\t\"endpoint\", endpoint,\n\t\t\t\"code\", resp.StatusCode,\n\t\t\t\"body\", buf,\n\t\t)\n\t}\n\treturn resp.StatusCode\n}", "title": "" }, { "docid": "0f9d79558d196d01c64f8b142b7a7f2d", "score": "0.44382802", "text": "func Post(url string, headers map[string]string, body string,\n\ttimeOut time.Duration) (ret *APIResponse, err error) {\n\tvar resp *http.Response // response\n\tdefer recoverFromPanic(\"Post()\", resp, &err)\n\treq, err := getReqWithBody(\"POST\", url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn httpExecuter(req, resp, headers, timeOut)\n}", "title": "" }, { "docid": "3361a4480be26c994f48fb261ce248a7", "score": "0.44366053", "text": "func (Ls *LinkShortenerAPI) UrlCreate(w http.ResponseWriter, r *http.Request) {\n reqBodyStruct := new(UrlMapping)\n responseEncoder := json.NewEncoder(w)\n if err := json.NewDecoder(r.Body).Decode(&reqBodyStruct); err != nil {\n w.WriteHeader(http.StatusBadRequest)\n if err := responseEncoder.Encode(&APIResponse{StatusMessage: err.Error()}); err!= nil {\n fmt.Fprintf(w, \"Error %s occured while trying to add the url \\n\", err.Error())\n }\n return\n }\n err := Ls.myconnection.AddUrls(reqBodyStruct.LongUrl, reqBodyStruct.ShortUrl)\n if err != nil {\n w.WriteHeader(http.StatusConflict)\n if err := responseEncoder.Encode(&APIResponse{StatusMessage: err.Error()}); err != nil {\n fmt.Fprintf(w, \"Error %s occured while trying to add the url \\n\", err.Error())\n }\n return\n }\n responseEncoder.Encode(&APIResponse{StatusMessage: \"OK\"})\n}", "title": "" }, { "docid": "c0ebcf727852db5283171d14cb98ea54", "score": "0.44317368", "text": "func (tempSettings *TempSettings) AppendPostHandler(authToken string, combineHandlers ...MockRequestResponse) {\n\tfor _, handler := range combineHandlers {\n\t\tresponseBody := `{ \"data\": ` + handler.Response + `}`\n\t\tif handler.ErrorResponse != \"\" {\n\t\t\tresponseBody = fmt.Sprintf(\"{ \\\"data\\\": %s, \\\"errors\\\": %s}\", handler.Response, handler.ErrorResponse)\n\t\t}\n\n\t\tif authToken == \"\" {\n\t\t\ttempSettings.TestServer.AppendHandlers(\n\t\t\t\tghttp.CombineHandlers(\n\t\t\t\t\tghttp.VerifyRequest(\"POST\", \"/graphql-unstable\"),\n\t\t\t\t\tghttp.VerifyContentType(\"application/json; charset=utf-8\"),\n\t\t\t\t\t// From Gomegas ghttp.VerifyJson to avoid the\n\t\t\t\t\t// VerifyContentType(\"application/json\") check\n\t\t\t\t\t// that fails with \"application/json; charset=utf-8\"\n\t\t\t\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\t\t\t\tbody, err := io.ReadAll(req.Body)\n\t\t\t\t\t\tgomega.Expect(err).ShouldNot(gomega.HaveOccurred())\n\t\t\t\t\t\terr = req.Body.Close()\n\t\t\t\t\t\tgomega.Expect(err).ShouldNot(gomega.HaveOccurred())\n\t\t\t\t\t\tgomega.Expect(handler.Request).Should(gomega.MatchJSON(body), \"JSON Mismatch\")\n\t\t\t\t\t},\n\t\t\t\t\tghttp.RespondWith(handler.Status, responseBody),\n\t\t\t\t),\n\t\t\t)\n\t\t} else {\n\t\t\ttempSettings.TestServer.AppendHandlers(\n\t\t\t\tghttp.CombineHandlers(\n\t\t\t\t\tghttp.VerifyRequest(\"POST\", \"/graphql-unstable\"),\n\t\t\t\t\tghttp.VerifyHeader(http.Header{\n\t\t\t\t\t\t\"Authorization\": []string{authToken},\n\t\t\t\t\t}),\n\t\t\t\t\tghttp.VerifyContentType(\"application/json; charset=utf-8\"),\n\t\t\t\t\t// From Gomegas ghttp.VerifyJson to avoid the\n\t\t\t\t\t// VerifyContentType(\"application/json\") check\n\t\t\t\t\t// that fails with \"application/json; charset=utf-8\"\n\t\t\t\t\tfunc(w http.ResponseWriter, req *http.Request) {\n\t\t\t\t\t\tbody, err := io.ReadAll(req.Body)\n\t\t\t\t\t\tgomega.Expect(err).ShouldNot(gomega.HaveOccurred())\n\t\t\t\t\t\terr = req.Body.Close()\n\t\t\t\t\t\tgomega.Expect(err).ShouldNot(gomega.HaveOccurred())\n\t\t\t\t\t\tgomega.Expect(body).Should(gomega.MatchJSON(handler.Request), \"JSON Mismatch\")\n\t\t\t\t\t},\n\t\t\t\t\tghttp.RespondWith(handler.Status, responseBody),\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "66c857a986281682693138cc96de8842", "score": "0.44297272", "text": "func serve(w http.ResponseWriter, r *http.Request, admit admitFunc) {\n\tvar body []byte\n\tif r.Body != nil {\n\t\tif data, err := ioutil.ReadAll(r.Body); err == nil {\n\t\t\tbody = data\n\t\t}\n\t}\n\n\t// verify the content type is accurate\n\tcontentType := r.Header.Get(\"Content-Type\")\n\tif contentType != \"application/json\" {\n\t\tklog.Errorf(\"contentType=%s, expect application/json\", contentType)\n\t\treturn\n\t}\n\n\tklog.V(2).Info(fmt.Sprintf(\"handling request: %s\", body))\n\n\t// The AdmissionReview that was sent to the webhook\n\trequestedAdmissionReview := admissionv1.AdmissionReview{}\n\n\t// The AdmissionReview that will be returned\n\tresponseAdmissionReview := admissionv1.AdmissionReview{}\n\n\tdeserializer := codecs.UniversalDeserializer()\n\tif _, _, err := deserializer.Decode(body, nil, &requestedAdmissionReview); err != nil {\n\t\tklog.Error(err)\n\t\tresponseAdmissionReview.Response = toAdmissionResponse(err)\n\t} else {\n\t\t// pass to admitFunc\n\t\tresponseAdmissionReview.Response = admit(requestedAdmissionReview)\n\t}\n\n\t// Return the same UID\n\tresponseAdmissionReview.Response.UID = requestedAdmissionReview.Request.UID\n\n\tklog.V(2).Info(fmt.Sprintf(\"sending response: %v\", responseAdmissionReview.Response))\n\n\trespBytes, err := json.Marshal(responseAdmissionReview)\n\tif err != nil {\n\t\tklog.Error(err)\n\t}\n\tif _, err := w.Write(respBytes); err != nil {\n\t\tklog.Error(err)\n\t}\n}", "title": "" } ]
b3225c2d429b164c46af3f49048834dc
Get value of key
[ { "docid": "8ce661595c9504f61e56866f85d3a41c", "score": "0.0", "text": "func (h RequestHeader) Get(key string) (string, bool) {\n\tif result := h.Peek(key); result != nil {\n\t\treturn string(result), true\n\t}\n\treturn \"\", false\n}", "title": "" } ]
[ { "docid": "4236508b93e8f8a6b8111a0ad3e40f46", "score": "0.71481144", "text": "func Get(key string) interface{} {\n\treturn v.Get(key)\n}", "title": "" }, { "docid": "d11e6afc5df5273da17c0f9d898ee16b", "score": "0.71228147", "text": "func (m *Manager) Get(key interface{}) interface{} {\n\tm.updateTime()\n\tif v, ok := m.info.value[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7c9f2f7e9366380994ff6302c1aa225", "score": "0.7087238", "text": "func (dict *Dict) GetValue(key string) core.Value {\n \n \n return dict._data[key]\n}", "title": "" }, { "docid": "b20161e0e7c1fe67b00dbacd9151fad2", "score": "0.705546", "text": "func (d *Data) Get(key string) any {\n\treturn d.GetVal(key)\n}", "title": "" }, { "docid": "bd6ae2485ff27e350a2eb89bdbbbfc21", "score": "0.7049064", "text": "func (q *Query) Get(key string) string {\n\treturn q.v.Get(key)\n}", "title": "" }, { "docid": "76067bb1959c5c2e86757ba991fec9ac", "score": "0.69760394", "text": "func (md Metadata) Get(key string) string {\n\tidx := md.indexOf(key)\n\tif idx == -1 {\n\t\treturn \"\"\n\t}\n\treturn md[idx].Values[0]\n}", "title": "" }, { "docid": "f59b0ec5dcf25958c6fd8f5c16aa970c", "score": "0.6973341", "text": "func get(key string) []byte {\r\n v, _ := kvstore[key]\r\n return v\r\n}", "title": "" }, { "docid": "a8f0d3d8a40c281e0317ca306cba0e02", "score": "0.69318664", "text": "func (v Value) Get(key string) string {\n\treturn v[key]\n}", "title": "" }, { "docid": "4bb92c555d3415469a5c39d7e5fa138a", "score": "0.69218886", "text": "func (l *Parser) Get(key string) any {\n\treturn l.k.Get(key)\n}", "title": "" }, { "docid": "f865fd41e06502ffa07c60232218d914", "score": "0.69118965", "text": "func (kvs KVS) Get(key string) string {\n\tv, ok := kvs.Lookup(key)\n\tif ok {\n\t\treturn v\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9f8567c1c53c0260876f622c1887a228", "score": "0.6888668", "text": "func (db *DB) Get(key interface{}) interface{} {\n\n\tvalue := db.values[key]\n\n\treturn value\n}", "title": "" }, { "docid": "86a831b9124daacc1c3efd23da1cfd80", "score": "0.6843534", "text": "func (v Values) Get(key string) string{\n\tif vs := v[key]; len(vs) > 0{\n\t\treturn vs[0]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "862c6051e995fb3b2b611091dbef2983", "score": "0.6833104", "text": "func (sf QueryValues) Get(key string) string {\n\tif sf == nil {\n\t\treturn \"\"\n\t}\n\tvs := sf[key]\n\tif len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "da51fe6a47ac6e16ee92979c32a64479", "score": "0.68291354", "text": "func (s *Store) Get(key string) (string, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tvar value []byte\n\terr := s.data.View(func(txn *badger.Txn) error {\n\t\titem, err := txn.Get([]byte(key))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue, err = item.ValueCopy(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(value[:]), nil\n}", "title": "" }, { "docid": "fa8a9188b6933b15c3858214558aa378", "score": "0.6829058", "text": "func (m *Module) GetValue(key string) (string, error) {\n\tvar value string\n\terr := m.DB.View(func(txn *badger.Txn) error {\n\t\titem, err := txn.Get([]byte(key))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval, err := item.Value()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvalue = string(val)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn value, err\n}", "title": "" }, { "docid": "b520286f7aa40a0b8ee82f8d62804fb7", "score": "0.6828571", "text": "func (v Values) Get(key string) string {\n\tif v == nil {\n\t\treturn \"\"\n\t}\n\tvs := v[key]\n\tif len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "dd0be3364fc70f20c727fa7f9a38a13a", "score": "0.6822518", "text": "func (s *Secret) GetValue(key string) string {\n\tif s.exists {\n\t\treturn string(s.obj.Data[key])\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "59cf739c7f49dc2cd66fd6e66ca6e8ac", "score": "0.6799276", "text": "func (t *Collection) Get(key []byte) (val []byte, err error) {\n\ti, err := t.GetItem(key, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif i != nil {\n\t\treturn i.Val, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "e3f1a82b5db6aba60c2c0c79c17c9bc9", "score": "0.6798106", "text": "func (k Keys) Value(key string) interface{} {\n\treturn k[key]\n}", "title": "" }, { "docid": "d851542167c7f431196c04de2ad69903", "score": "0.67980576", "text": "func (v *Values) Get(key string) string {\n\tif v == nil || *v == nil {\n\t\treturn \"\"\n\t}\n\tvs, ok := (*v)[key]\n\tif !ok || len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "8ba3cdb151934a6c86301c75a97443ba", "score": "0.679451", "text": "func (r *Redis) GetValue(prefix PrefixEnum, key string) (string, error) {\n\tk := getKey(prefix, key)\n\treturn r.Client.Get(k).Result()\n}", "title": "" }, { "docid": "fb07cc6a86e2fce76b6d24baec25a571", "score": "0.6775619", "text": "func (d *DbStorage) Get(key string) (string, error) {\n\n\tvar keyValue string\n\tselectStmt := `SELECT key_value FROM kv_storage where key_name = $1;`\n\n\trow := d.db.QueryRow(selectStmt, key)\n\terr := row.Scan(&keyValue)\n\n\tfmt.Println(row, err, selectStmt, key, keyValue)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tkeyValue = fmt.Sprintf(\"There is no %s key in th db.\", key)\n\t\t\t// return value, err\n\t\t} else {\n\t\t\terrHandler(err)\n\t\t}\n\t}\n\n\treturn keyValue, nil\n}", "title": "" }, { "docid": "1aaa810e313fcf4920a936c68f896b99", "score": "0.6763661", "text": "func (l *Parser) Get(key string) interface{} {\n\treturn l.v.Get(key)\n}", "title": "" }, { "docid": "f47b1f667632ac84cba06165cd5e3634", "score": "0.6761526", "text": "func (epf *ElrondProxyFacade) GetValueForKey(address string, key string) (string, error) {\n\treturn epf.accountProc.GetValueForKey(address, key)\n}", "title": "" }, { "docid": "41a5ece3ddae67e85a2cb0b53b894868", "score": "0.675699", "text": "func Get(key string) (string, error) {\n\treturn rc.Get(key).Result()\n}", "title": "" }, { "docid": "19e85b9cb7de994e184e0bbdcee0d53c", "score": "0.67541486", "text": "func (d Data) Get(key string) interface{} {\n\treturn d[key]\n}", "title": "" }, { "docid": "19e85b9cb7de994e184e0bbdcee0d53c", "score": "0.67541486", "text": "func (d Data) Get(key string) interface{} {\n\treturn d[key]\n}", "title": "" }, { "docid": "19e85b9cb7de994e184e0bbdcee0d53c", "score": "0.67541486", "text": "func (d Data) Get(key string) interface{} {\n\treturn d[key]\n}", "title": "" }, { "docid": "e30e7efccb8c25a979bdc62d49b3f774", "score": "0.6735642", "text": "func (s *SessionStore) Get(key interface{}) interface{} {\n\tkeyString := key.(string)\n\tif value, ok := s.value[keyString]; ok {\n\t\treturn value\n\t} else {\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "807f9ac952c917c9dd0bfa3e1f8479eb", "score": "0.672484", "text": "func (kvps *KeyValuePairs) GetValue(key string) string {\n\tfor _, kvp := range kvps.GetKeyValuePair() {\n\t\tif kvp.GetKey() == key {\n\t\t\treturn kvp.GetValue()\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "920675436b8d992a86f6d0b37d9e203b", "score": "0.6714406", "text": "func (c *Context) Get(key interface{}) interface{} {\n\treturn c.values[key]\n}", "title": "" }, { "docid": "b7bf2de1ac7a014d8569749e60c67dfa", "score": "0.6706698", "text": "func (c *C) Get(key string) interface{} {\n\treturn c.data[key]\n}", "title": "" }, { "docid": "c135a77471b8c85647d66fc1f1c60b54", "score": "0.67020756", "text": "func (s *Kvs) Get(key string) (value string) {\n\t// Get a read lock\n\ts.RLock()\n\tdefer s.RUnlock()\n\ttmpTuple := s.values[key]\n\n\t// If the tuple is valid unlock the mutex and return the value\n\tif tmpTuple.valid() {\n\t\treturn tmpTuple.Value\n\t}\n\n\t// The Tuple is not valid, return empty string and delete Tuple (new go routine)\n\tgo s.Delete(key)\n\treturn \"\"\n}", "title": "" }, { "docid": "ed65b7fdae489eda68ff28466ecb4673", "score": "0.67017967", "text": "func (params *SQLParams) Get(key string) string {\n\treturn params.kv[key]\n}", "title": "" }, { "docid": "7366f26096eb10bb824016642aa50856", "score": "0.6696819", "text": "func (k *KeyValue) Value() string {\n return k.value\n}", "title": "" }, { "docid": "63dc3d33ec2514de07ef7abbf8be02a7", "score": "0.668887", "text": "func (c *SafeCache) GetValue(key string) string {\n\tc.mux.Lock()\n\t// Lock so only one goroutine at a time can access the map c.v.\n\tvalue := c.v[key]\n\tdefer c.mux.Unlock()\n\treturn value\n}", "title": "" }, { "docid": "714e7243e0977bb30ea9dc0e30a90c5d", "score": "0.66861254", "text": "func (ky *Key) Value() Value {\n\treturn ky.userKey\n}", "title": "" }, { "docid": "c67381ca5815b6250f65f82710452a6c", "score": "0.6678862", "text": "func Get(k string) string {\n\treturn c.Get(k)\n}", "title": "" }, { "docid": "9b7bc0122fa2db65f975cdecb1909768", "score": "0.66788197", "text": "func (e *Event) Get(key string) string {\n\n\t// attempt to find the string values of the event\n\tswitch strings.ToLower(key) {\n\tcase \"host\":\n\t\treturn e.Host\n\tcase \"service\":\n\t\treturn e.Service\n\tcase \"sub_service\":\n\t\treturn e.SubService\n\t}\n\n\t// if we make it to this point, assume we are looking for a tag\n\tif val, ok := e.Tags[key]; ok {\n\t\treturn val\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "9b7bc0122fa2db65f975cdecb1909768", "score": "0.66788197", "text": "func (e *Event) Get(key string) string {\n\n\t// attempt to find the string values of the event\n\tswitch strings.ToLower(key) {\n\tcase \"host\":\n\t\treturn e.Host\n\tcase \"service\":\n\t\treturn e.Service\n\tcase \"sub_service\":\n\t\treturn e.SubService\n\t}\n\n\t// if we make it to this point, assume we are looking for a tag\n\tif val, ok := e.Tags[key]; ok {\n\t\treturn val\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "fe3d68e25840bf4e09b106984e1898b5", "score": "0.66763926", "text": "func getValueByKey(mappingNode *yamlv3.Node, key string) (*yamlv3.Node, error) {\n\tfor i := 0; i < len(mappingNode.Content); i += 2 {\n\t\tk, v := mappingNode.Content[i], mappingNode.Content[i+1]\n\t\tif k.Value == key {\n\t\t\treturn v, nil\n\t\t}\n\t}\n\n\treturn nil, &KeyNotFoundInMapError{\n\t\tMissingKey: key,\n\t\tAvailableKeys: listKeys(mappingNode),\n\t}\n}", "title": "" }, { "docid": "f979e773aa636549762c9d318e5bc4b1", "score": "0.66575235", "text": "func GetValue(key string) (string, error) {\n\tclient, err := CheckConnection()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tval, err := client.Get(key).Result()\n\tif err == redis.Nil {\n\t\tlog.Println(key, \" does not exist\")\n\t\treturn \"\", err\n\t} else if err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tlog.Println(\"result key:\", key, \" val:\", val)\n\t\treturn val, nil\n\t}\n}", "title": "" }, { "docid": "a3f703e61782d422dfbd7a2cac72981e", "score": "0.6650551", "text": "func (self *Dictionary) get(key string) interface{} {\n\tval, has := self.items[key]\n\tif has {\n\t\treturn val\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "55a87a2147345b01e2b99c9b069ed667", "score": "0.6630267", "text": "func (db *DB) Get(key string) string {\n\tdb.mutex.RLock()\n\tdefer db.mutex.RUnlock()\n\treturn db.data[key]\n}", "title": "" }, { "docid": "77c403211735710c20a1909c7424afa4", "score": "0.6622435", "text": "func getVal(key interface{}) (bool, interface{}){\n value, ok := data[key]\n\n if !ok {\n return true, nil\n } else {\n return false, value\n }\n}", "title": "" }, { "docid": "13c30059e16510afef47fb804cc1b8c7", "score": "0.66212094", "text": "func (t *patricia[V]) Get(key string) (V, bool) {\n\treturn t._get(newBitString(key))\n}", "title": "" }, { "docid": "4455599a47921ae56ba6ff77c5928e8a", "score": "0.66184694", "text": "func (m Node) Get(key string) interface{} {\n\treturn m[key]\n}", "title": "" }, { "docid": "e51e1e4574618ad1332caad17ff1d0a0", "score": "0.66140336", "text": "func (keyDB *KeyDB) GetValue(key string) (string, error) {\n\tif key == \"\" {\n\t\treturn \"\", log.Error(\"keydb: key must be defined\")\n\t}\n\tvar value string\n\terr := keyDB.getValueQuery.QueryRow(key).Scan(&value)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\treturn \"\", nil\n\tcase err != nil:\n\t\treturn \"\", log.Error(err)\n\tdefault:\n\t\treturn value, nil\n\t}\n}", "title": "" }, { "docid": "c4a76bb58d47c829bb342417065a13e9", "score": "0.6612949", "text": "func (s *Table) get(key Key) *ValueItem {\n\titem := s.items.Get(key)\n\tif item != nil {\n\t\treturn item.(*ValueItem)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2103a3d3eacf3503152fbdd4434e78c5", "score": "0.6611259", "text": "func (c *Client) Get(key string) (Value, error) {\n\treturn c.doValue(\"get\", key)\n}", "title": "" }, { "docid": "e4af6d0afd70482f4b4055dbd6b7ca02", "score": "0.6597109", "text": "func Get(key string) (string, error) {\n\tval, error := rdb.Get(key).Result()\n\treturn val, error\n}", "title": "" }, { "docid": "03f0531184b74f14d08696eeb7f93a2f", "score": "0.65906125", "text": "func (db *DB) Get(key string) (string, error) {\n\tvar val string\n\terr := db.Read(func(tx *Tx) error {\n\t\tv, err := tx.Get(key)\n\t\tval = v\n\t\treturn err\n\t})\n\n\treturn val, err\n}", "title": "" }, { "docid": "a06b62974259a458eba50a1a7138bce0", "score": "0.65885866", "text": "func (d *Data) Get(key string) string {\n\tl.Debugf(\"Lookup key prefix=%q key=%q\", d.prefix, key)\n\tif d.store != nil {\n\t\tpre := d.prefix\n\t\tif !strings.HasSuffix(d.prefix, \"/\") {\n\t\t\tpre = concat(d.prefix, \"/\")\n\t\t}\n\t\tk := fmt.Sprintf(\"%s%s\", pre, strings.ToLower(strings.TrimLeft(key, \"/\")))\n\t\tl.Debugf(\"Lookup key full=%q\", k)\n\t\tif val, err := d.store.Get(k); err == nil {\n\t\t\tl.Debugf(\"Found key %q in backend: %q\", key, val)\n\t\t\treturn val\n\t\t}\n\t}\n\n\tl.Debugf(\"Did not find %q in backend, will look in ENV\", key)\n\tif v, ok := d.Env[strings.ToUpper(strings.Replace(key, \"/\", \"_\", -1))]; ok {\n\t\treturn v\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "19a3db3b34561480821aee944d802dd3", "score": "0.6588179", "text": "func (s *Store) GetValue(key string) (val interface{}, err error) {\n\tval, exists := s.values[key]\n\n\t// Check that the key exists and return an error if not\n\tif !exists {\n\t\terr = generateError(fmt.Sprintf(\"The key '%s' specified does not exist\", key))\n\t}\n\treturn\n}", "title": "" }, { "docid": "affbdb5bc7caf30b49ccb3b8bb149fa2", "score": "0.65866995", "text": "func (sm StoredKeyMeta) Get(key string) interface{} {\n\treturn sm[key]\n}", "title": "" }, { "docid": "c03436475a7fcdc8e030eb61fcb30115", "score": "0.65671486", "text": "func (h *Handler) GetValue(key string) (interface{}, error) {\n\tif h.vp.IsSet(key) {\n\t\treturn h.vp.Get(key), nil\n\t}\n\treturn nil, fmt.Errorf(\"Key doesn't exist\")\n}", "title": "" }, { "docid": "6f0283b5817360390c1cd4c894aa6c7f", "score": "0.6564441", "text": "func (d *Data) GetVal(key string) any {\n\tif d.lock {\n\t\td.RLock()\n\t\tdefer d.RUnlock()\n\t}\n\n\tval, _ := maputil.GetByPath(key, d.data)\n\treturn val\n}", "title": "" }, { "docid": "9726cf561f72121d8c2d6448c7b5c450", "score": "0.65606517", "text": "func (f *fsm) Get(key string) string {\n\tf.mu.RLock()\n\tdefer f.mu.RUnlock()\n\n\treturn f.data[key]\n}", "title": "" }, { "docid": "38290d44aea21040b6083ceca6172ad0", "score": "0.6554828", "text": "func (m *Map) Get(key string) interface{} {\n\ts := find(m.chain[m.getBucket(key)], key)\n\treturn s.value\n}", "title": "" }, { "docid": "b1252c55d3253f792b5a3ff28d8b853b", "score": "0.6547051", "text": "func (target *Target) Get(key string) string {\n\treturn (*target)[key]\n}", "title": "" }, { "docid": "1a88da5d3b00c59137f2d4e3c9373a5e", "score": "0.65230256", "text": "func (k *KVS) Get(key string, payload map[string]int) (val string, clock map[string]int) {\n\tlog.Println(\"Getting value associated with key \")\n\t// Grab a read lock\n\tk.mutex.RLock()\n\tdefer k.mutex.RUnlock()\n\n\t_, version := k.contains(key)\n\n\t// Call the non-locking contains() method, use the version from above with default value 0\n\tif version != 0 {\n\t\tlog.Println(\"Value found\")\n\n\t\t// Get the key and clock from the db\n\t\tval = k.db[key].GetValue()\n\t\tclock = k.db[key].GetClock()\n\n\t\t// Add this key's causal history to the client's payload\n\t\tclock = mergeClocks(payload, clock)\n\n\t\t// Return\n\t\treturn val, clock\n\t}\n\tlog.Println(\"Value not found\")\n\n\t// We don't have the value so just return the empty string with the payload they sent us\n\treturn \"\", payload\n}", "title": "" }, { "docid": "c0640d94d37311ddf067e165586c7cce", "score": "0.65195835", "text": "func (e *Entry) Get(key string) *ValueData {\n\tfor i := range e.Values {\n\t\tif e.Values[i].Key == key {\n\t\t\treturn &e.Values[i]\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c0552576fe8b8e5a51282037208f9c27", "score": "0.6508296", "text": "func (kv *TimedKv) get(key uint64) (int64, bool) {\n\n mapVal, isPresent := kv.kv[key]\n\n return mapVal, isPresent\n}", "title": "" }, { "docid": "c0552576fe8b8e5a51282037208f9c27", "score": "0.6508296", "text": "func (kv *TimedKv) get(key uint64) (int64, bool) {\n\n mapVal, isPresent := kv.kv[key]\n\n return mapVal, isPresent\n}", "title": "" }, { "docid": "076be76dcb28ff3709f3e04200ac375a", "score": "0.650097", "text": "func get_key(key string) (value string, err error) {\n\targ_array := os.Args\n\tre := regexp.MustCompile(\"\\\\=\")\n\tfor _, arg := range arg_array {\n\t\tkey_val := re.Split(arg, 2)\n\t\tif (len(key_val) == 2) {\n\t\t\t// found a valid key-value pair in the args\n\t\t\tif (key_val[0] == key) {\n\t\t\t\treturn key_val[1], nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"attempted to replace undefined key -> {{\" + key + \"}}\")\n}", "title": "" }, { "docid": "243c151c2f014981bada28de0890cb2f", "score": "0.64982396", "text": "func getKeyValue(source string) (key, value string) {\n\treg, _ := regexp.Compile(REGEX_KEY_VALUE)\n\n\tif ok := reg.MatchString(source); ok {\n\t\tkey = strings.TrimSpace(reg.FindStringSubmatch(source)[1])\n\t\tvalue = strings.TrimSpace(reg.FindStringSubmatch(source)[2])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8b3c058666fb0c0ccb2b1c1eebd0cab9", "score": "0.64947724", "text": "func (s *single) Get(key string) int64 {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.user[key]\n}", "title": "" }, { "docid": "43db550d26cafa751352429eb77ef460", "score": "0.6492188", "text": "func (p *Context) Value(key interface{}) interface{} {\n\tif k, ok := key.(string); ok {\n\t\tif val, exist := p.ParamOk(k); exist {\n\t\t\treturn val\n\t\t}\n\t}\n\n\treturn p.parent.Value(key)\n}", "title": "" }, { "docid": "f12c47043e2dabaca709f1054ff51c64", "score": "0.6491742", "text": "func (rc *redisCache) GetValue(key string) (string, error) {\n\tval, err := rc.client.ReadReplica().Do(\"GET\", rc.makeKey(key))\n\tif err == nil && val == nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn redis.String(val, err)\n}", "title": "" }, { "docid": "72537227ffc5334d8c2ac1e5a8b8c457", "score": "0.64903784", "text": "func (env *Env) Get(key string) (value string) {\n\tvalue, _ = env.Find(key)\n\treturn value\n}", "title": "" }, { "docid": "414a3e607a25453c1808b47aff72b0e2", "score": "0.64895356", "text": "func (c *StaticKeyConfig) Value(key string) interface{} {\n\tif key == c.Key {\n\t\treturn c.Val\n\t}\n\treturn c.Config.Value(key)\n}", "title": "" }, { "docid": "a0798c83dfaf929628dbaaa8d960d5f1", "score": "0.64858866", "text": "func (l *Locker) Get(key string) (string, error) {\n\terr := l.load()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvalue, ok := l.keyValues[key]\n\tif !ok {\n\t\treturn \"\", errors.New(\"secret: no value for that key\")\n\t}\n\treturn value, nil\n}", "title": "" }, { "docid": "759773f404083296de55f3c3c1e4dcf9", "score": "0.64739424", "text": "func (c CustomParameters) Get(key string) string {\n\tcs := c.Gets(key)\n\tif cs == nil {\n\t\treturn \"\"\n\t}\n\treturn cs[0]\n}", "title": "" }, { "docid": "764e32986bdf306f1a8588c7993ea998", "score": "0.6467902", "text": "func (c *BaseConfigurator) GetValue(key string) (value string) {\n\tvalue = c.kvs[key]\n\tif nsv := c.kvs[c.namespace+key]; nsv != \"\" {\n\t\tvalue = nsv\n\t}\n\treturn value\n}", "title": "" }, { "docid": "1c6165502bca6ccc775a0f3e6446d421", "score": "0.6463883", "text": "func (keyValueArr KeyValueArr) GetValue(key string) (res interface{}) {\n\tfor i := 0; i < len(keyValueArr); i++ {\n\t\tif keyValueArr[i].Key == key {\n\t\t\tres = keyValueArr[i].Value\n\t\t\tbreak\n\t\t}\n\t}\n\n\tDebug(DbgInfo, \"Got value '%v' for key '%s' from '%v'\\n\", res, key, keyValueArr)\n\n\treturn res\n}", "title": "" }, { "docid": "e1db9c4016892589e6fed1a277d3b0ae", "score": "0.64539677", "text": "func (r *etcdRepository) getValue(key string, resp *etcdcliv3.GetResponse) ([]byte, error) {\n\tif len(resp.Kvs) == 0 {\n\t\treturn nil, fmt.Errorf(\"key[%s] not exist\", key)\n\t}\n\n\tfirstkv := resp.Kvs[0]\n\tif len(firstkv.Value) == 0 {\n\t\treturn nil, fmt.Errorf(\"key[%s]'s value is empty\", key)\n\t}\n\treturn firstkv.Value, nil\n}", "title": "" }, { "docid": "7a214a2b4446f2d80d3448c238be8ad7", "score": "0.6448208", "text": "func (store *RedisWrapper) GetValue(key string) (interface{}, error) {\n\tc := store.pool.Get()\n\tdefer c.Close()\n\n\treturn c.Do(\"GET\", key)\n}", "title": "" }, { "docid": "2f54dd71325a1a8616b11c7566535d64", "score": "0.64321727", "text": "func (d *Data) Value(key string) (val any, ok bool) {\n\tif d.lock {\n\t\td.RLock()\n\t\tdefer d.RUnlock()\n\t}\n\n\tval, ok = maputil.GetByPath(key, d.data)\n\treturn\n}", "title": "" }, { "docid": "e87cdf0a5ac79f8ce8990118a5cc4607", "score": "0.6431292", "text": "func (s *State) Get(key string) ([]byte, error) {\n\ts.mtx.RLock()\n\tdefer s.mtx.RUnlock()\n\tv, ok := s.data[key]\n\tif !ok {\n\t\treturn nil, ErrKeyNotFound\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "037b7e950eca90b68d29438c90fcf46d", "score": "0.64236736", "text": "func Get(token uint64, key string) (string, bool) {\n\tvalue, exists := MyKVS[token][key]\n\treturn value, exists\n}", "title": "" }, { "docid": "3cedb24a28775135e135ae099060e2f4", "score": "0.6419958", "text": "func (d *Dict) Get(key *Object) *Object {\n\tnode := d.Search(key)\n\tif node != nil {\n\t\treturn node.value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4473398da2b9502e105d3bc0facb0ed", "score": "0.641811", "text": "func (b JobVariables) Get(key string) string {\n\treturn b.value(key, true)\n}", "title": "" }, { "docid": "f81b38865f4c5b562a6368fcb2b394d5", "score": "0.6416418", "text": "func (node *Node) getKey(key string) ([]byte, error) {\n\tnode.dsMtx.RLock()\n\tval, ok := node.datastore[key]\n\tnode.dsMtx.RUnlock()\n\tif !ok {\n\t\treturn nil, errors.New(\"key does not exist\")\n\t}\n\n\tnode.tsMtx.RLock()\n\t_, ok1 := node.tempstore[key]\n\tnode.tsMtx.RUnlock()\n\tif ok1 {\n\t\treturn nil, nil\n\t}\n\n\treturn val, nil\n}", "title": "" }, { "docid": "fe31188a4d6b6997baa9a33aedaf9559", "score": "0.6414157", "text": "func (s *Map) Get(key string) interface{} {\n\tif result, found := (*s)[key]; found {\n\t\treturn result\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ee7895dade32f5e376e6ad1b73c735c", "score": "0.64128476", "text": "func (p QueryParams) GetValue(key string) interface{} {\n\treturn p[key]\n}", "title": "" }, { "docid": "d54b675de7b0e55dcf8062440deb5a64", "score": "0.64081204", "text": "func (vs *Store) Get(key string) (interface{}, error) {\n\tvs.mu.RLock()\n\tdefer vs.mu.RUnlock()\n\tif v, ok := vs.values[key]; ok {\n\t\treturn v, nil\n\t}\n\treturn nil, &notFound{msg: fmt.Sprintf(\"%s not found\", key)}\n}", "title": "" }, { "docid": "31e7f8f445b1e302eb3ce96cc52c8287", "score": "0.64074665", "text": "func (c *FoundationContext) Value(key interface{}) interface{} {\n\treturn c.ctx.Value(key)\n}", "title": "" }, { "docid": "65351699a7ff96b555e44bbf655d510a", "score": "0.64065194", "text": "func Get(key string) (string, error) {\n\tc, err := NewFromDocker()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn c.Get(key)\n}", "title": "" }, { "docid": "e67a278127013966e1be8aa086f3ef66", "score": "0.6405734", "text": "func (v VideoTagValues) Get(key string) string {\n\tvs := v.Gets(key)\n\tif vs == nil {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "c5f0bec73587dfa2a68315b2d7825639", "score": "0.6398975", "text": "func (m *AggregateRow) Get(key string) interface{} {\n\treturn m.Payload()[key]\n}", "title": "" }, { "docid": "abe846797fecb6132e0542bff59e2ad0", "score": "0.63958967", "text": "func (c *Config) Get(key string) (string, error) {\n\tif value, found := c.data[key]; found {\n\t\treturn value, nil\n\t}\n\treturn \"\", ErrKey\n}", "title": "" }, { "docid": "f3a1ee2b140de8b51385f1bf04ebdebe", "score": "0.6395787", "text": "func (entity *Entity) Get(key string) interface{} {\n\tval := entity.find(key)\n\tif val == nil {\n\t\treturn nil\n\t}\n\treturn val\n}", "title": "" }, { "docid": "ad42161225ffa6742535e559fd548dfa", "score": "0.63912946", "text": "func (sm *SyncMap) Get(key interface{}) interface{} {\n\tsm.RLock()\n\tdefer sm.RUnlock()\n\n\treturn sm.data[key]\n}", "title": "" }, { "docid": "a3274e8565bde9d30ec85e55e0e20753", "score": "0.63830894", "text": "func (mpt *MerklePatriciaTrie) Get(key string) (string, error) {\n\t//fmt.Println(\"VALUE to be searched:\", key)\n\tpathLeft := string_to_hex_array(key)\n\tcurrentNode := mpt.db[mpt.Root]\n\tfinalValue, err := mpt.GetRecursive(currentNode, pathLeft)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t} else {\n\t\treturn finalValue, nil\n\t}\n}", "title": "" }, { "docid": "aea0c7b931703e13aec8f5cb719d69aa", "score": "0.6382439", "text": "func (c *Client) GetValue(key string) ([]byte, error) {\n\treturn redis.Bytes(c.conn.Do(\"GET\", key))\n}", "title": "" }, { "docid": "c0746a86413f15fe770db5153cdffcd5", "score": "0.63792616", "text": "func Get(key string) (string, error) {\n\tstore.RLock()\n\tvalue, ok := store.m[key]\n\tstore.RUnlock()\n\n\tif !ok {\n\t\treturn \"\", ErrorNoSuchKey\n\t}\n\n\treturn value, nil\n}", "title": "" }, { "docid": "8019f8bb8ae984d5ebdf71e2f7aebea3", "score": "0.6378012", "text": "func (h *HashTable) Get(key int) string {\n\tindex := hash(key)\n\n\tif h.array[index] != nil {\n\t\tcurr := h.array[index]\n\n\t\tfor curr != nil {\n\t\t\tif curr.key == key {\n\t\t\t\treturn curr.value\n\t\t\t}\n\t\t\tcurr = curr.next\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "9684aec803efd317679999c39385f59b", "score": "0.6377894", "text": "func (d *database) Get(key string) (string, error) {\n\td.M.RLock()\n\tval, ok := d.Data[key]\n\td.M.RUnlock()\n\tif !ok {\n\t\treturn \"\", errors.New(\"Key does not exist\")\n\t}\n\treturn val, nil\n}", "title": "" }, { "docid": "33d5fde579192e24cb1d15299cbebf65", "score": "0.6373078", "text": "func (ec *LocalEtcdClient) GetValue(key string) string {\n\tres, err := ec.Get(key)\n\tif err != nil {\n\t\tglog.Fatalln(\"Failed to get value for\", key, \"from etcd\", err)\n\t}\n\tif res == \"\" {\n\t\tglog.Fatalln(\"Key\", key, \"in etcd is unset\")\n\t}\n\treturn res.Node.Value, nil\n}", "title": "" }, { "docid": "0618c6ca179ccecfd6be2c580be1795e", "score": "0.6369899", "text": "func (pm *LuaParMap) Get(key string) (value string, ok bool) {\n\tif pm.ls == nil || pm.ref == lua.LUA_NOREF {\n\t\treturn \"\", false\n\t}\n\n\tpm.ls.RawGeti(lua.LUA_REGISTRYINDEX, pm.ref)\n\n\tif err := LuaCheckIs(pm.ls, -1, \"table\"); err != nil {\n\t\treturn \"\", false\n\t}\n\n\tpm.ls.PushString(key)\n\tpm.ls.RawGet(-2)\n\n\t//\tif err := LuaCheckIs(pm.ls, -1, \"string\"); err != nil {\n\t//\t\treturn \"\", false\n\t//\t}\n\n\tvalue = pm.ls.ToString(-1)\n\tif value == \"\" {\n\t\treturn value, false\n\t\t//return nil, errors.New(fmt.Sprintf(\"Key %s: Can't convert value %s to string\", key, pm.ls.LTypename(-1)))\n\t}\n\n\tpm.ls.Pop(1)\n\n\treturn value, true\n}", "title": "" }, { "docid": "b761a033ef7d519f624a6ad4b8f0fb0e", "score": "0.6365955", "text": "func Get(ctx context.Context, key string) string {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tkey = strings.ToLower(key)\n\n\tif kv, ok := md[key]; ok {\n\t\treturn kv[0]\n\t}\n\n\treturn \"\"\n}", "title": "" } ]
5f2919abfa93a651420c78333eb08c04
parseBinaryOp parses n as "lhs op rhs".
[ { "docid": "0980b6e0f399d70c2d8f45706ea6bb6d", "score": "0.8182571", "text": "func parseBinaryOp(n *a.Expr) (op t.ID, lhs *a.Expr, rhs *a.Expr) {\n\tif !n.Operator().IsBinaryOp() {\n\t\treturn 0, nil, nil\n\t}\n\top = n.Operator()\n\tif op == t.IDAs {\n\t\treturn 0, nil, nil\n\t}\n\treturn op, n.LHS().AsExpr(), n.RHS().AsExpr()\n}", "title": "" } ]
[ { "docid": "59468a497558f5ab0a421ce6de9a0870", "score": "0.68543607", "text": "func (p *parser) parseBinaryExpr(open token.Pos) *ast.BinaryExpr {\n\tpos := p.pos\n\top := p.tok\n\tp.next()\n\topen = p.expect(token.LPAREN)\n\n\tvar list []ast.Expr\n\tfor p.tok != token.RPAREN && p.tok != token.EOF {\n\t\tlist = append(list, p.parseGenExpr())\n\t}\n\tif len(list) < 2 {\n\t\tp.addError(\"binary expression must have at least two operands\")\n\t}\n\tend := p.expect(token.RPAREN)\n\treturn &ast.BinaryExpr{\n\t\tExpression: ast.Expression{\n\t\t\tOpening: open,\n\t\t\tClosing: end,\n\t\t},\n\t\tOp: op,\n\t\tOpPos: pos,\n\t\tList: list,\n\t}\n}", "title": "" }, { "docid": "53da45981ba8bcc753bc5180af1feb2c", "score": "0.64551014", "text": "func (p *parser) parseBinaryLitExpr(open token.Pos) *ast.BinaryExpr {\n\tpos := p.pos\n\top := p.tok\n\tp.next()\n\n\tvar list []ast.Expr\n\tfor p.tok != token.RPAREN && p.tok != token.EOF {\n\t\tlist = append(list, p.parseGenExpr())\n\t}\n\tif len(list) < 2 {\n\t\tp.addError(\"binary expression must have at least two operands\")\n\t}\n\tend := p.expect(token.RPAREN)\n\treturn &ast.BinaryExpr{\n\t\tExpression: ast.Expression{\n\t\t\tOpening: open,\n\t\t\tClosing: end,\n\t\t},\n\t\tOp: op,\n\t\tOpPos: pos,\n\t\tList: list,\n\t}\n}", "title": "" }, { "docid": "971b935fdabcf60449ebc7d86434d7a0", "score": "0.63445795", "text": "func (p *Parser) EvaluateBinaryOperation(left, right, op token.Value) (opToken token.Value, err error) {\n\tfmt.Println(\"EvaluateBinaryOperation\")\n\n\tswitch op.Type {\n\t// case \"add\":\n\t// \topToken, err = p.AddOperands(left, right)\n\t// \tif err != nil {\n\t// \t\terr = errors.New(\"Error adding operands\")\n\t// \t}\n\n\t// case \"sub\":\n\t// \topToken, err = p.SubOperands(left, right)\n\t// \tif err != nil {\n\t// \t\terr = errors.New(\"Error subtracting operands\")\n\t// \t}\n\n\t// case \"mult\":\n\t// \topToken, err = p.MultOperands(left, right)\n\t// \tif err != nil {\n\t// \t\terr = errors.New(\"Error multiplying operands\")\n\t// \t}\n\n\t// case \"div\":\n\t// \topToken, err = p.DivOperands(left, right)\n\t// \tif err != nil {\n\t// \t\terr = errors.New(\"Error dividing operands\")\n\t// \t}\n\n\tcase \"lthan\":\n\t\tfmt.Println(\"lthan\")\n\t\topToken, err = p.LessThanOperands(left, right)\n\t\tif err != nil {\n\t\t\terr = errors.New(\"Error evaluating boolean expression\")\n\t\t}\n\n\tdefault:\n\t\terr = errors.Errorf(\"Undefined operator; left: %+v right: %+v op: %+v\", left, right, op)\n\t\tfmt.Println(err.Error())\n\t}\n\n\t// opToken.Name = op.Type + \"Op\"\n\t// opToken.Type = \"OP\"\n\t// opToken.OpMap = opMap\n\t// opToken.True = opMap[\"eval\"].(token.Value)\n\t// opToken.String = left.String + op.String + right.String\n\n\topToken.Metadata = map[string]interface{}{\n\t\t\"eval\": opToken.True,\n\t\t\"type\": token.BoolType,\n\t\t\"left\": left,\n\t\t\"op\": op,\n\t\t\"right\": right,\n\t\t// \"string\": left.String + op.String + right.String,\n\t}\n\tif opToken.Type == token.IntType {\n\t\topToken.String = strconv.Itoa(opToken.True.(int))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d564d07ac32e403fd67b2c6458f0e6d3", "score": "0.6226642", "text": "func (o *BuiltinFunction) BinaryOp(op token.Token, rhs Object) (Object, error) {\n\treturn nil, ErrInvalidOperator\n}", "title": "" }, { "docid": "e111b5c1a8ad5875a1b61f7ed2fa2d0b", "score": "0.6210134", "text": "func (o *String) BinaryOp(op token.Token, rhs Object) (Object, error) {\n\tswitch op {\n\tcase token.Add:\n\t\tswitch rhs := rhs.(type) {\n\t\tcase *String:\n\t\t\treturn &String{Value: o.Value + rhs.Value}, nil\n\t\tdefault:\n\t\t\treturn &String{Value: o.Value + rhs.String()}, nil\n\t\t}\n\t}\n\n\treturn nil, ErrInvalidOperator\n}", "title": "" }, { "docid": "c0b35f79dbad188becf5c87385a5f9aa", "score": "0.6045156", "text": "func binary(typ int, od1 *expr, op string, od2 *expr) *expr {\n\treturn &expr{\n\t\tsexp: append(exprlist{atomic(typ, op)}, od1, od2),\n\t}\n}", "title": "" }, { "docid": "450e21c0253a90cd75427def64b55fda", "score": "0.5999494", "text": "func (o *Undefined) BinaryOp(op token.Token, rhs Object) (Object, error) {\n\treturn nil, ErrInvalidOperator\n}", "title": "" }, { "docid": "f6335fd98b169006fc60ac654c72fc6b", "score": "0.5982314", "text": "func binaryOperationNumber(op Operator, t Type, rLeft, rRight string, asm *ASM) {\n\n\tswitch op {\n\tcase OP_GE, OP_GREATER, OP_LESS, OP_LE, OP_EQ, OP_NE:\n\n\t\t// Works for anything that should be compared.\n\t\tlabelTrue := asm.nextLabelName()\n\t\tlabelOK := asm.nextLabelName()\n\t\tjump := getJumpType(op)\n\n\t\tasm.addLine(\"cmp\", fmt.Sprintf(\"%v, %v\", rLeft, rRight))\n\t\tasm.addLine(jump, labelTrue)\n\t\tasm.addLine(\"mov\", fmt.Sprintf(\"%v, 0\", rLeft))\n\t\tasm.addLine(\"jmp\", labelOK)\n\t\tasm.addLabel(labelTrue)\n\t\tasm.addLine(\"mov\", fmt.Sprintf(\"%v, -1\", rLeft))\n\t\tasm.addLabel(labelOK)\n\n\t// add, sub, mul, div, mod...\n\tdefault:\n\t\tcommand := getCommand(t, op)\n\t\tif op == OP_DIV || op == OP_MOD {\n\t\t\t// Clear rdx! Needed for at least div and mod.\n\t\t\tasm.addLine(\"xor\", \"rdx, rdx\")\n\t\t}\n\t\t// idiv calculates both the integer division, as well as the remainder.\n\t\t// The reminder will be written to rdx. So move back to rax.\n\t\tif op == OP_MOD {\n\t\t\tasm.addLine(command, fmt.Sprintf(\"%v, %v\", rLeft, rRight))\n\t\t\tasm.addLine(\"mov\", fmt.Sprintf(\"%v, rdx\", rLeft))\n\t\t} else {\n\t\t\tasm.addLine(command, fmt.Sprintf(\"%v, %v\", rLeft, rRight))\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "6a4c4e5465684b7f8c14047b0a135982", "score": "0.5956614", "text": "func ParseInstruction(n int) (Instruction, error) {\n\tswitch opcode(n % 100) {\n\tcase addOpcode:\n\t\treturn add{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t\tthirdParameterMode: parameterMode((n / 10000) % 10),\n\t\t}, nil\n\tcase multiplyOpcode:\n\t\treturn multiply{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t\tthirdParameterMode: parameterMode((n / 10000) % 10),\n\t\t}, nil\n\tcase inputOpcode:\n\t\treturn input{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t}, nil\n\tcase outputOpcode:\n\t\treturn output{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t}, nil\n\tcase jumpIfTrueOpcode:\n\t\treturn jumpIfTrue{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t}, nil\n\tcase jumpIfFalseOpcode:\n\t\treturn jumpIfFalse{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t}, nil\n\tcase lessThanOpcode:\n\t\treturn lessThan{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t\tthirdParameterMode: parameterMode((n / 10000) % 10),\n\t\t}, nil\n\tcase equalsOpcode:\n\t\treturn equals{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t\tsecondParameterMode: parameterMode((n / 1000) % 10),\n\t\t\tthirdParameterMode: parameterMode((n / 10000) % 10),\n\t\t}, nil\n\tcase adjustRelativeBaseOpcode:\n\t\treturn adjustRelativeBase{\n\t\t\tfirstParameterMode: parameterMode((n / 100) % 10),\n\t\t}, nil\n\tcase haltOpcode:\n\t\treturn halt{}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown opcode %d\", n)\n\t}\n}", "title": "" }, { "docid": "036f9db312f581506e4667918bb1fc05", "score": "0.5887286", "text": "func ProcessBinaryIntegerLiteral(pos int, buf []rune) (*Token, int, error) {\n\treachedEnd := false\n\tbinaryValue := \"\"\n\ti := pos\n\tif i == pos {\n\t\tif i+1 >= len(buf) {\n\t\t\treturn nil, pos, nil\n\t\t}\n\t\tif buf[i] != '0' || !(buf[i+1] == 'b' || buf[i+1] == 'B') {\n\t\t\treturn nil, pos, nil\n\t\t}\n\t}\n\ti += 2\n\t// Increment i by 2 to capture the actual binary digits.\n\tfor !reachedEnd && i < len(buf) {\n\t\tif buf[i] == '0' || buf[i] == '1' {\n\t\t\tbinaryValue += string(buf[i])\n\t\t} else {\n\t\t\treachedEnd = true\n\t\t}\n\t\ti++\n\t}\n\t// The end of the current token is always the last checked position\n\t// if we reached the end.\n\tif reachedEnd {\n\t\ti--\n\t}\n\tif binaryValue != \"\" {\n\t\treturn &Token{\n\t\t\tName: \"BinaryIntegerLiteral\",\n\t\t\tValue: binaryValue,\n\t\t\tPos: pos,\n\t\t}, i, nil\n\t}\n\treturn nil, pos, nil\n}", "title": "" }, { "docid": "60d5524a3969155615eab11bd7c99848", "score": "0.57655835", "text": "func (o *ReturnValue) BinaryOp(op token.Token, rhs Object) (Object, error) {\n\treturn nil, ErrInvalidOperator\n}", "title": "" }, { "docid": "56437ff4e49eaa7305d6d908e83a7a30", "score": "0.57378745", "text": "func (p *Parser) readOp() (string, error) {\n\t// skip preceding whitespace\n\tp.skipWhiteSpace()\n\n\tvar state int\n\tvar ch rune\n\tvar op []rune\n\tfor {\n\t\tch = p.current()\n\n\t\tswitch state {\n\t\tcase 0: // initial state, determine what op we're reading for\n\t\t\tif ch == Equal {\n\t\t\t\tstate = 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ch == Bang {\n\t\t\t\tstate = 2\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ch == 'i' {\n\t\t\t\tstate = 6\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ch == 'n' {\n\t\t\t\tstate = 7\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 1: // =\n\t\t\tif p.isWhitespace(ch) || p.isAlpha(ch) || ch == Comma {\n\t\t\t\treturn string(op), nil\n\t\t\t}\n\t\t\tif ch == Equal {\n\t\t\t\top = append(op, ch)\n\t\t\t\tp.advance()\n\t\t\t\treturn string(op), nil\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 2: // !\n\t\t\tif ch == Equal {\n\t\t\t\top = append(op, ch)\n\t\t\t\tp.advance()\n\t\t\t\treturn string(op), nil\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 6: // in\n\t\t\tif ch == 'n' {\n\t\t\t\top = append(op, ch)\n\t\t\t\tp.advance()\n\t\t\t\treturn string(op), nil\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 7: // o\n\t\t\tif ch == 'o' {\n\t\t\t\tstate = 8\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 8: // t\n\t\t\tif ch == 't' {\n\t\t\t\tstate = 9\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 9: // i\n\t\t\tif ch == 'i' {\n\t\t\t\tstate = 10\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\tcase 10: // n\n\t\t\tif ch == 'n' {\n\t\t\t\top = append(op, ch)\n\t\t\t\tp.advance()\n\t\t\t\treturn string(op), nil\n\t\t\t}\n\t\t\treturn \"\", ErrInvalidOperator\n\t\t}\n\n\t\top = append(op, ch)\n\t\tp.advance()\n\n\t\tif p.done() {\n\t\t\treturn string(op), nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1efc4c6fc5cb11aa7d30dfa60d3724ff", "score": "0.5672227", "text": "func (self *funcInfo) emitBinaryOp(op, a, b, c int) {\n\tif opcode, found := arithAndBitwiseBinops[op]; found {\n\t\tself.emitABC(opcode, a, b, c)\n\t} else {\n\t\tswitch op {\n\t\tcase TOKEN_OP_EQ:\n\t\t\tself.emitABC(OP_EQ, 1, b, c)\n\t\tcase TOKEN_OP_NE:\n\t\t\tself.emitABC(OP_EQ, 0, b, c)\n\t\tcase TOKEN_OP_LT:\n\t\t\tself.emitABC(OP_LT, 1, b, c)\n\t\tcase TOKEN_OP_GT:\n\t\t\tself.emitABC(OP_LT, 1, c, b)\n\t\tcase TOKEN_OP_LE:\n\t\t\tself.emitABC(OP_LE, 1, b, c)\n\t\tcase TOKEN_OP_GE:\n\t\t\tself.emitABC(OP_LE, 1, c, b)\n\t\t}\n\t\tself.emitJmp(0, 1)\n\t\tself.emitLoadBool(a, 0, 1)\n\t\tself.emitLoadBool(a, 1, 0)\n\t}\n}", "title": "" }, { "docid": "7c77add1295ca07fe623642d38b9bfb4", "score": "0.5638145", "text": "func TestParser_Expr(t *testing.T) {\n\texpr := \"10 + (5 - (4 + -(6 - 1)))\"\n\texpected := &ast.BinOp{\n\t\tLeft: &ast.Num{\n\t\t\tToken: token.Token{\n\t\t\t\tType: token.Int,\n\t\t\t\tLexeme: \"10\",\n\t\t\t},\n\t\t\tLexeme: \"10\",\n\t\t},\n\t\tOperator: token.Token{\n\t\t\tType: token.Add,\n\t\t\tLexeme: \"+\",\n\t\t},\n\t\tRight: &ast.BinOp{\n\t\t\tLeft: &ast.Num{\n\t\t\t\tToken: token.Token{\n\t\t\t\t\tType: token.Int,\n\t\t\t\t\tLexeme: \"5\",\n\t\t\t\t},\n\t\t\t\tLexeme: \"5\",\n\t\t\t},\n\t\t\tOperator: token.Token{\n\t\t\t\tType: token.Sub,\n\t\t\t\tLexeme: \"-\",\n\t\t\t},\n\t\t\tRight: &ast.BinOp{\n\t\t\t\tLeft: &ast.Num{\n\t\t\t\t\tToken: token.Token{\n\t\t\t\t\t\tType: token.Int,\n\t\t\t\t\t\tLexeme: \"4\",\n\t\t\t\t\t},\n\t\t\t\t\tLexeme: \"4\",\n\t\t\t\t},\n\t\t\t\tOperator: token.Token{\n\t\t\t\t\tType: token.Add,\n\t\t\t\t\tLexeme: \"+\",\n\t\t\t\t},\n\t\t\t\tRight: &ast.UnaryOp{\n\t\t\t\t\tOperator: token.Token{\n\t\t\t\t\t\tType: token.Sub,\n\t\t\t\t\t\tLexeme: \"-\",\n\t\t\t\t\t},\n\t\t\t\t\tExpression: &ast.BinOp{\n\t\t\t\t\t\tLeft: &ast.Num{\n\t\t\t\t\t\t\tToken: token.Token{\n\t\t\t\t\t\t\t\tType: token.Int,\n\t\t\t\t\t\t\t\tLexeme: \"6\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLexeme: \"6\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tOperator: token.Token{\n\t\t\t\t\t\t\tType: token.Sub,\n\t\t\t\t\t\t\tLexeme: \"-\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRight: &ast.Num{\n\t\t\t\t\t\t\tToken: token.Token{\n\t\t\t\t\t\t\t\tType: token.Int,\n\t\t\t\t\t\t\t\tLexeme: \"1\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLexeme: \"1\",\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\tlexer, err := scanner.New(expr)\n\tassert.Nil(t, err)\n\n\tparser := parser2.New(lexer)\n\texpre, err := parser.Expr()\n\tassert.Nil(t, err)\n\n\texpression, ok := expre.(*ast.BinOp)\n\tassert.True(t, ok)\n\n\tassert.Equal(t, expression, expected)\n}", "title": "" }, { "docid": "534a73ebaafbef7e3c97d9b5d72a3781", "score": "0.5624279", "text": "func ParseOperator(operator string) Operator {\n\tswitch operator {\n\tcase \"add\":\n\t\treturn ADD\n\tcase \"subtract\":\n\t\treturn SUBTRACT\n\tcase \"multiply\":\n\t\treturn MULTIPLY\n\tcase \"divide\":\n\t\treturn DIVIDE\n\tdefault:\n\t\treturn UNKNOWN\n\t}\n}", "title": "" }, { "docid": "b7c30c18b16529ee42ff173aad5f4e59", "score": "0.5606949", "text": "func parseOperator(s string) string {\n\tswitch s[0] {\n\tcase 60: // \"<\"\n\t\tswitch s[1] {\n\t\tcase 61: // \"=\"\n\t\t\treturn \"<=\"\n\t\tdefault:\n\t\t\treturn \"<\"\n\t\t}\n\tcase 62: // \">\"\n\t\tswitch s[1] {\n\t\tcase 61: // \"=\"\n\t\t\treturn \">=\"\n\t\tdefault:\n\t\t\treturn \">\"\n\t\t}\n\tdefault:\n\t\t// no operator found, default to \"=\"\n\t\treturn \"=\"\n\t}\n}", "title": "" }, { "docid": "58af43e704b44d5844473b32b8dfc371", "score": "0.5558157", "text": "func (p *Parser) parseBinaryArgument() rt.Expr {\n\tprimary := p.parsePrimary()\n\treturn p.parseUnaryMessages(primary)\n}", "title": "" }, { "docid": "f01efc91defe97a0da9e3b72e6a4fac2", "score": "0.5554786", "text": "func binary(x Expr, pos Position, op string, y Expr) Expr {\n\t_, xend := x.Span()\n\tystart, _ := y.Span()\n\n\tswitch op {\n\tcase \"=\", \"+=\", \"-=\", \"*=\", \"/=\", \"//=\", \"%=\", \"|=\":\n\t\treturn &AssignExpr{\n\t\t\tLHS: x,\n\t\t\tOpPos: pos,\n\t\t\tOp: op,\n\t\t\tLineBreak: xend.Line < ystart.Line,\n\t\t\tRHS: y,\n\t\t}\n\t}\n\n\treturn &BinaryExpr{\n\t\tX: x,\n\t\tOpStart: pos,\n\t\tOp: op,\n\t\tLineBreak: xend.Line < ystart.Line,\n\t\tY: y,\n\t}\n}", "title": "" }, { "docid": "ca32cd401931884a7bb25c27c1d5f7e4", "score": "0.5503827", "text": "func (c *Context) EvalBinary(left value.Value, op string, right value.Value) value.Value {\n\t// Special handling for the equal and non-equal operators, which must avoid\n\t// type conversions involving Char.\n\tif op == \"==\" || op == \"!=\" {\n\t\tv, ok := value.EvalCharEqual(left, op == \"==\", right)\n\t\tif ok {\n\t\t\treturn v\n\t\t}\n\t}\n\tif strings.Contains(op, \".\") {\n\t\treturn value.Product(c, left, op, right)\n\t}\n\tfn := c.Binary(op)\n\tif fn == nil {\n\t\tvalue.Errorf(\"binary %q not implemented\", op)\n\t}\n\treturn fn.EvalBinary(c, left, right)\n}", "title": "" }, { "docid": "bd5a60bc3cf96733c37b1217ed1465a0", "score": "0.5447439", "text": "func (p *parser) parseExpr(pos token.Pos) ast.Expr {\n\tvar expr ast.Expr\n\tswitch p.tok {\n\tcase token.ADD, token.SUB, token.MUL, token.DIV, token.REM:\n\t\texpr = p.parseBinaryExpr(pos)\n\tcase token.ADDLIT, token.SUBLIT, token.MULLIT, token.DIVLIT, token.REMLIT:\n\t\texpr = p.parseBinaryLitExpr(pos)\n\tdefault:\n\t\tp.addError(\"Expected binary operator but got '\" + p.lit + \"'\")\n\t}\n\treturn expr\n}", "title": "" }, { "docid": "83b41392e0ee397dd1b67a286095c61e", "score": "0.5417182", "text": "func (p *Parser) parseBinaryMessage(recv rt.Expr) rt.Expr {\n\tname := p.expect(scan.BINARY)\n\tbm := &ast.BinaryMessage{recv, name, p.parseBinaryArgument()}\n\n\treturn bm\n}", "title": "" }, { "docid": "72f870556c667c36dc20bc56fef5220a", "score": "0.5397742", "text": "func (sr *simpleRewriter) constructBinaryOpFunction(l Expression, r Expression, op string) (Expression, error) {\n\tlLen, rLen := GetRowLen(l), GetRowLen(r)\n\tif lLen == 1 && rLen == 1 {\n\t\treturn NewFunction(sr.ctx, op, types.NewFieldType(mysql.TypeTiny), l, r)\n\t} else if rLen != lLen {\n\t\treturn nil, ErrOperandColumns.GenWithStackByArgs(lLen)\n\t}\n\tswitch op {\n\tcase ast.EQ, ast.NE, ast.NullEQ:\n\t\tfuncs := make([]Expression, lLen)\n\t\tfor i := 0; i < lLen; i++ {\n\t\t\tvar err error\n\t\t\tfuncs[i], err = sr.constructBinaryOpFunction(GetFuncArg(l, i), GetFuncArg(r, i), op)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif op == ast.NE {\n\t\t\treturn ComposeDNFCondition(sr.ctx, funcs...), nil\n\t\t}\n\t\treturn ComposeCNFCondition(sr.ctx, funcs...), nil\n\tdefault:\n\t\tlarg0, rarg0 := GetFuncArg(l, 0), GetFuncArg(r, 0)\n\t\tvar expr1, expr2, expr3 Expression\n\t\tif op == ast.LE || op == ast.GE {\n\t\t\texpr1 = NewFunctionInternal(sr.ctx, op, types.NewFieldType(mysql.TypeTiny), larg0, rarg0)\n\t\t\texpr1 = NewFunctionInternal(sr.ctx, ast.EQ, types.NewFieldType(mysql.TypeTiny), expr1, Zero)\n\t\t\texpr2 = Zero\n\t\t} else if op == ast.LT || op == ast.GT {\n\t\t\texpr1 = NewFunctionInternal(sr.ctx, ast.NE, types.NewFieldType(mysql.TypeTiny), larg0, rarg0)\n\t\t\texpr2 = NewFunctionInternal(sr.ctx, op, types.NewFieldType(mysql.TypeTiny), larg0, rarg0)\n\t\t}\n\t\tvar err error\n\t\tl, err = PopRowFirstArg(sr.ctx, l)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr, err = PopRowFirstArg(sr.ctx, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpr3, err = sr.constructBinaryOpFunction(l, r, op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewFunction(sr.ctx, ast.If, types.NewFieldType(mysql.TypeTiny), expr1, expr2, expr3)\n\t}\n}", "title": "" }, { "docid": "2adb73f4e8abfc7b970a97627df44b77", "score": "0.5387855", "text": "func NewBinaryExpr(left Expr, operator Token, right Expr) *BinaryExpr {\n\tbinaryExpr := BinaryExpr{}\n\tbinaryExpr.left = left\n\tbinaryExpr.right = right\n\tbinaryExpr.operator = operator\n\treturn &binaryExpr\n}", "title": "" }, { "docid": "8f02a023576de601bce77af6e811d799", "score": "0.53844064", "text": "func (er *expressionRewriter) constructBinaryOpFunction(l expression.Expression, r expression.Expression, op string) (expression.Expression, error) {\n\tlLen, rLen := expression.GetRowLen(l), expression.GetRowLen(r)\n\tif lLen == 1 && rLen == 1 {\n\t\treturn er.newFunction(op, types.NewFieldType(mysql.TypeTiny), l, r)\n\t} else if rLen != lLen {\n\t\treturn nil, expression.ErrOperandColumns.GenWithStackByArgs(lLen)\n\t}\n\tswitch op {\n\tcase ast.EQ, ast.NE, ast.NullEQ:\n\t\tfuncs := make([]expression.Expression, lLen)\n\t\tfor i := 0; i < lLen; i++ {\n\t\t\tvar err error\n\t\t\tfuncs[i], err = er.constructBinaryOpFunction(expression.GetFuncArg(l, i), expression.GetFuncArg(r, i), op)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tif op == ast.NE {\n\t\t\treturn expression.ComposeDNFCondition(er.sctx, funcs...), nil\n\t\t}\n\t\treturn expression.ComposeCNFCondition(er.sctx, funcs...), nil\n\tdefault:\n\t\tlarg0, rarg0 := expression.GetFuncArg(l, 0), expression.GetFuncArg(r, 0)\n\t\tvar expr1, expr2, expr3, expr4, expr5 expression.Expression\n\t\texpr1 = expression.NewFunctionInternal(er.sctx, ast.NE, types.NewFieldType(mysql.TypeTiny), larg0, rarg0)\n\t\texpr2 = expression.NewFunctionInternal(er.sctx, op, types.NewFieldType(mysql.TypeTiny), larg0, rarg0)\n\t\texpr3 = expression.NewFunctionInternal(er.sctx, ast.IsNull, types.NewFieldType(mysql.TypeTiny), expr1)\n\t\tvar err error\n\t\tl, err = expression.PopRowFirstArg(er.sctx, l)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr, err = expression.PopRowFirstArg(er.sctx, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpr4, err = er.constructBinaryOpFunction(l, r, op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpr5, err = er.newFunction(ast.If, types.NewFieldType(mysql.TypeTiny), expr3, expression.NewNull(), expr4)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn er.newFunction(ast.If, types.NewFieldType(mysql.TypeTiny), expr1, expr2, expr5)\n\t}\n}", "title": "" }, { "docid": "a52a3406bfe523234ae3e7e65c1b29d9", "score": "0.5365405", "text": "func evalRPN(tokens []string) int {\n\toperators := map[string]bool{\n\t\t\"+\": true,\n\t\t\"-\": true,\n\t\t\"*\": true,\n\t\t\"/\": true,\n\t}\n\n\tstack := make([]string, 0)\n\tfor _, token := range tokens {\n\t\tif !operators[token] {\n\t\t\tstack = append(stack, token)\n\t\t} else {\n\t\t\top1Str, op2Str := stack[len(stack)-2], stack[len(stack)-1]\n\t\t\top1, _ := strconv.Atoi(op1Str)\n\t\t\top2, _ := strconv.Atoi(op2Str)\n\t\t\tstack = stack[:len(stack)-2]\n\t\t\tvar res string\n\t\t\tswitch token {\n\t\t\tcase \"+\":\n\t\t\t\tres = strconv.Itoa(op1 + op2)\n\t\t\tcase \"-\":\n\t\t\t\tres = strconv.Itoa(op1 - op2)\n\t\t\tcase \"*\":\n\t\t\t\tres = strconv.Itoa(op1 * op2)\n\t\t\tcase \"/\":\n\t\t\t\tres = strconv.Itoa(op1 / op2)\n\t\t\t}\n\t\t\tstack = append(stack, res)\n\t\t}\n\t}\n\tresult, _ := strconv.Atoi(stack[len(stack)-1])\n\treturn result\n}", "title": "" }, { "docid": "204c62462a7883973567abc7087f7d5b", "score": "0.531934", "text": "func (c *Config) binaryExprNumeric(exprOp token.Token, xType, yType *opr, xDataType, yDataType gotypes.DataType) (gotypes.DataType, error) {\n\tma := NewMultiArith()\n\n\t// Types of operands:\n\t// - untyped constants\n\t// - typed constants\n\t// - untyped variables (until assigned to a variable), e.g. var > var, it is true, can be asigned to any type defined as bool\n\t// - typed varible a.k.a identifiers\n\t//\n\t// Examples:\n\t// - a := 2 // int variable\n\t// - 2.0 << a // untyped int variable since the a is int variable\n\t// The <<, resp. >> are the only operands that can produce untyped variables.\n\t// At the same time, the untyped variables are produced only if the LHS is untyped int constant.\n\t// Otherwise, the product of the <<, resp. >> is a typed variable\n\n\t//////////////////////////////////////\n\t// UIV +|-|*|/|%|&|||&^|^ UIV = UIV\n\t// UIV <<\\>> UIV = UIV\n\t// UIV ==|!=|<=|<|>=|> UIV = bool\n\n\t// called over constants only, only constants has literals to operate with\n\n\tklog.V(2).Infof(\"Performing %v operation\", exprOp)\n\tswitch exprOp {\n\tcase token.REM, token.AND, token.OR, token.AND_NOT, token.XOR:\n\t\tif exprOp == token.REM {\n\t\t\t// just in case the first operand is typed int and the second operant is int compatible\n\t\t\tif !c.isIntegral(xType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v %v %v\", xType.getOriginalType(), exprOp, yType.getOriginalType())\n\t\t\t}\n\t\t\tif !c.isCompatibleWithInt(yType, yDataType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v %v %v\", xType.getOriginalType(), exprOp, yType.getOriginalType())\n\t\t\t}\n\t\t} else {\n\t\t\t// purely integral ops\n\t\t\tif !c.areIntegral(xType, yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"%v (%v) %v %v (%v) not supported\", xType.literal, xType.getOriginalType(), exprOp, yType.literal, yType.getOriginalType())\n\t\t\t}\n\t\t}\n\t\t// Constants\n\t\tif c.isConstant(xDataType) && c.isConstant(yDataType) {\n\t\t\tvar targetType *opr\n\t\t\tuntyped := false\n\t\t\tif xType.untyped && yType.untyped {\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{\n\t\t\t\t\t\tPackage: xType.oPkg,\n\t\t\t\t\t\tDef: xType.oId,\n\t\t\t\t\t\tLiteral: \"*\",\n\t\t\t\t\t\tUntyped: true,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t\tuntyped = true\n\t\t\t\ttargetType = xType\n\t\t\t} else if xType.untyped {\n\t\t\t\tif c.isValueLess(yDataType) {\n\t\t\t\t\t// x is untyped int constant\n\t\t\t\t\treturn yDataType, nil\n\t\t\t\t}\n\t\t\t\ttargetType = yType\n\t\t\t} else if yType.untyped {\n\t\t\t\tif c.isValueLess(xDataType) {\n\t\t\t\t\t// x is untyped int constant\n\t\t\t\t\treturn xDataType, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t} else {\n\t\t\t\tif !xType.equals(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%v can not be converted to %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{\n\t\t\t\t\t\tPackage: xType.oPkg,\n\t\t\t\t\t\tDef: xType.oId,\n\t\t\t\t\t\tLiteral: \"*\",\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t}\n\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\tma.AddYFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\tif err := ma.Perform(exprOp).Error(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlit, err := ma.ZToLiteral(targetType.id, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &gotypes.Constant{Package: targetType.oPkg, Def: targetType.oId, Literal: lit, Untyped: untyped}, nil\n\t\t}\n\t\t// Y is constant\n\t\tif c.isConstant(yDataType) {\n\t\t\tif c.isUntypedVar(xDataType) {\n\t\t\t\tb := xDataType.(*gotypes.Builtin)\n\t\t\t\t// Product of << or >> operation.\n\t\t\t\t// So the Y constant must be integral since the <<, resp. >> does not accept non-integral LHS.\n\t\t\t\t// See https://golang.org/ref/spec#Operators and the \"shift expression\" paragraph with examples.\n\t\t\t\tif !c.isIntegral(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Op %v expects the LHS to be int, got %#v instead\", b.Literal, yType.getOriginalType())\n\t\t\t\t}\n\t\t\t\t// Y is untyped int constant\n\t\t\t\tif yType.untyped {\n\t\t\t\t\tb.Literal = \"\"\n\t\t\t\t\treturn b, nil\n\t\t\t\t}\n\t\t\t\t// Y is typed int constant\n\t\t\t\treturn &gotypes.Identifier{\n\t\t\t\t\tPackage: \"builtin\",\n\t\t\t\t\tDef: yDataType.(*gotypes.Constant).Def,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t\t// Y is typed variable\n\t\t\t// is the Y constant compatible with the typed variable X?\n\t\t\tif yType.untyped {\n\t\t\t\t// Y is untyped constant\n\t\t\t\t// TODO(jchaloup): add error check for all Add?FromString calls to avoid panics\n\t\t\t\tma.AddXFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\t\tif _, err := ma.XToLiteral(xType.id); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\treturn xDataType, nil\n\t\t\t}\n\t\t\t// both X,Y are typed\n\t\t\tif !xType.equals(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t}\n\t\t\treturn xDataType, nil\n\t\t}\n\t\t// X is constant\n\t\tif c.isConstant(xDataType) {\n\t\t\t// Y is untyped variable\n\t\t\tif c.isUntypedVar(yDataType) {\n\t\t\t\tb := yDataType.(*gotypes.Builtin)\n\t\t\t\tif !c.isIntegral(xType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Op %v expects the LHS to be int, got %#v instead\", b.Literal, xType.getOriginalType())\n\t\t\t\t}\n\t\t\t\t// Y is untyped int constant\n\t\t\t\tif xType.untyped {\n\t\t\t\t\tb.Literal = \"\"\n\t\t\t\t\treturn b, nil\n\t\t\t\t}\n\t\t\t\t// Y is typed int constant\n\t\t\t\treturn &gotypes.Identifier{\n\t\t\t\t\tPackage: \"builtin\",\n\t\t\t\t\tDef: xDataType.(*gotypes.Constant).Def,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t\t// X is typed variable\n\t\t\t// is the Y constant compatible with the typed variable X?\n\t\t\tif xType.untyped {\n\t\t\t\t// Y is untyped constant\n\t\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\t\tif _, err := ma.XToLiteral(yType.id); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\treturn yDataType, nil\n\t\t\t}\n\t\t\t// both X,Y are typed\n\t\t\tif !xType.equals(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t}\n\t\t\treturn yDataType, nil\n\t\t}\n\t\t// Both X,Y are variable\n\t\tif c.isUntypedVar(xDataType) && c.isUntypedVar(yDataType) {\n\t\t\treturn &gotypes.Builtin{Def: \"int\", Untyped: true}, nil\n\t\t}\n\t\t// X is untyped var\n\t\tif c.isUntypedVar(xDataType) {\n\t\t\t// is Y compatible with X?\n\t\t\tif !c.isIntegral(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The second operand %v of %v is not int\", yDataType, exprOp)\n\t\t\t}\n\t\t\treturn yDataType, nil\n\t\t}\n\t\t// Y is untyped var\n\t\tif c.isUntypedVar(yDataType) {\n\t\t\t// is X compatible with Y?\n\t\t\tif !c.isIntegral(xType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The first operand %v of %v is not int\", xDataType, exprOp)\n\t\t\t}\n\t\t\treturn xDataType, nil\n\t\t}\n\t\t// both X,Y are typed\n\t\tif !xType.equals(yType) {\n\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t}\n\t\treturn xDataType, nil\n\tcase token.SHL, token.SHR:\n\t\t// operating with floats that has no floating part\n\t\tif !c.isCompatibleWithInt(xType, xDataType) {\n\t\t\treturn nil, fmt.Errorf(\"The first operand %v of %v is not int\", xDataType, exprOp)\n\t\t}\n\t\tif !c.isCompatibleWithUint(yType, yDataType) && !c.isCompatibleWithInt(yType, yDataType) {\n\t\t\treturn nil, fmt.Errorf(\"The second operand %v of %v is not uint nor with int (runtime panic if negative)\", yDataType, exprOp)\n\t\t}\n\t\tif xDataType.GetType() == gotypes.ConstantType && yDataType.GetType() == gotypes.ConstantType {\n\t\t\tvar targetType *opr\n\t\t\tuntyped := false\n\t\t\tif xType.untyped && yType.untyped {\n\t\t\t\tuntyped = true\n\t\t\t\ttargetType = &opr{\n\t\t\t\t\tpkg: \"builtin\",\n\t\t\t\t\tid: \"int\",\n\t\t\t\t\toPkg: \"builtin\",\n\t\t\t\t\toId: \"int\",\n\t\t\t\t\tuntyped: true,\n\t\t\t\t}\n\t\t\t} else if xType.untyped {\n\t\t\t\tif c.isValueLess(yDataType) {\n\t\t\t\t\tconstant := xDataType.(*gotypes.Constant)\n\t\t\t\t\tconstant.Literal = \"*\"\n\t\t\t\t\treturn constant, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t\tuntyped = true\n\t\t\t} else if yType.untyped {\n\t\t\t\tif c.isValueLess(xDataType) {\n\t\t\t\t\t// Y must be untyped int constant\n\t\t\t\t\treturn xDataType, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t} else {\n\t\t\t\tif !xType.equals(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%v can not be converted to %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{\n\t\t\t\t\t\tPackage: xType.oPkg,\n\t\t\t\t\t\tDef: xType.oId,\n\t\t\t\t\t\tLiteral: \"*\",\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t}\n\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\tma.AddYFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\tif err := ma.Perform(exprOp).Error(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlit, err := ma.ZToLiteral(targetType.id, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &gotypes.Constant{Package: targetType.oPkg, Def: targetType.oId, Literal: lit, Untyped: untyped}, nil\n\t\t}\n\t\tif c.isConstant(xDataType) {\n\t\t\t// is Y is a variable, X must be integral\n\t\t\tif !c.isIntegral(xType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The first operand %v of %v is not int\", xDataType, exprOp)\n\t\t\t}\n\t\t\tif xType.untyped {\n\t\t\t\treturn &gotypes.Builtin{Def: xType.oId, Untyped: true, Literal: fmt.Sprintf(\"%v\", exprOp)}, nil\n\t\t\t}\n\t\t\treturn &gotypes.Identifier{Package: xType.oPkg, Def: xType.oId}, nil\n\t\t}\n\t\t// Y is uint (either constant or variable). So the product is a variable.\n\t\t// Either untyped variable or typed varible, which is determined by the xDataType only\n\t\tif c.isUntypedVar(xDataType) {\n\t\t\tb := xDataType.(*gotypes.Builtin)\n\t\t\tb.Literal = fmt.Sprintf(\"%v\", exprOp)\n\t\t\treturn b, nil\n\t\t}\n\t\treturn xDataType, nil\n\tcase token.MUL, token.QUO, token.ADD, token.SUB:\n\t\t// ints, float and complex numbers allowed\n\t\t// Both X,Y are constants\n\t\tif xDataType.GetType() == gotypes.ConstantType && yDataType.GetType() == gotypes.ConstantType {\n\t\t\tvar targetType *opr\n\t\t\tuntyped := false\n\t\t\tif xType.untyped && yType.untyped {\n\t\t\t\tuntyped = true\n\t\t\t\tif c.areComplex(xType, yType) {\n\t\t\t\t\ttargetType = &opr{\n\t\t\t\t\t\tpkg: \"builtin\",\n\t\t\t\t\t\tid: \"complex128\",\n\t\t\t\t\t\toPkg: \"builtin\",\n\t\t\t\t\t\toId: \"complex128\",\n\t\t\t\t\t}\n\t\t\t\t} else if c.areFloating(xType, yType) {\n\t\t\t\t\ttargetType = &opr{\n\t\t\t\t\t\tpkg: \"builtin\",\n\t\t\t\t\t\tid: \"float64\",\n\t\t\t\t\t\toPkg: \"builtin\",\n\t\t\t\t\t\toId: \"float64\",\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttargetType = xType\n\t\t\t\t}\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{\n\t\t\t\t\t\tPackage: targetType.oPkg,\n\t\t\t\t\t\tDef: targetType.oId,\n\t\t\t\t\t\tLiteral: \"*\",\n\t\t\t\t\t\tUntyped: true,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t} else if xType.untyped {\n\t\t\t\t// it's either untyped int, untyped float or untyped complex\n\t\t\t\t// Y is int => X must be convertible to int\n\t\t\t\tif c.isIntegral(yType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(yDataType) {\n\t\t\t\t\t\t// x must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn yDataType, nil\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(yType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(yDataType) {\n\t\t\t\t\t\t// Y must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn yDataType, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttargetType = yType\n\t\t\t} else if yType.untyped {\n\t\t\t\tif c.isIntegral(xType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(xDataType) {\n\t\t\t\t\t\t// Y must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn xDataType, nil\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(xType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(xDataType) {\n\t\t\t\t\t\t// Y must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn xDataType, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t} else {\n\t\t\t\tif !xType.equals(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%v can not be converted to %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{\n\t\t\t\t\t\tPackage: xType.oPkg,\n\t\t\t\t\t\tDef: xType.oId,\n\t\t\t\t\t\tLiteral: \"*\",\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t\ttargetType = xType\n\t\t\t}\n\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\tma.AddYFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\tif err := ma.Perform(exprOp).Error(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif exprOp == token.QUO && c.areIntegral(xType, yType) {\n\t\t\t\tma.ZFloor()\n\t\t\t}\n\t\t\tlit, err := ma.ZToLiteral(targetType.id, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &gotypes.Constant{Package: targetType.oPkg, Def: targetType.oId, Literal: lit, Untyped: untyped}, nil\n\t\t}\n\t\tif c.isConstant(yDataType) {\n\t\t\tif c.isUntypedVar(xDataType) {\n\t\t\t\tb := xDataType.(*gotypes.Builtin)\n\t\t\t\t// Product of << or >> operation.\n\t\t\t\t// So the Y constant must be integral since the <<, resp. >> does not accept non-integral LHS.\n\t\t\t\t// See https://golang.org/ref/spec#Operators and the \"shift expression\" paragraph with examples.\n\t\t\t\tif (b.Literal == \"<<\" || b.Literal == \">>\") && !c.isIntegral(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Op %v expects the LHS to be int, got %#v instead\", b.Literal, yType.getOriginalType())\n\t\t\t\t}\n\t\t\t\t// Y is untyped int constant\n\t\t\t\tif yType.untyped {\n\t\t\t\t\treturn xDataType, nil\n\t\t\t\t}\n\t\t\t\t// Y is typed int constant\n\t\t\t\treturn &gotypes.Identifier{\n\t\t\t\t\tPackage: \"builtin\",\n\t\t\t\t\tDef: yDataType.(*gotypes.Constant).Def,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t\t// Y is typed variable\n\t\t\t// is the Y constant compatible with the typed variable X?\n\t\t\tif yType.untyped {\n\t\t\t\t// Y is untyped constant\n\t\t\t\tma.AddXFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\t\tvar targetType string\n\t\t\t\tif xType.pkg == \"C\" {\n\t\t\t\t\tgoIdent, err := c.symbolsAccessor.CToGoUnderlyingType(&gotypes.Identifier{Package: \"C\", Def: xType.id})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\ttargetType = goIdent.Def\n\t\t\t\t} else {\n\t\t\t\t\ttargetType = xType.id\n\t\t\t\t}\n\t\t\t\tif _, err := ma.XToLiteral(targetType); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\treturn xDataType, nil\n\t\t\t}\n\t\t\t// both X,Y are typed\n\t\t\tif !xType.equals(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t}\n\t\t\treturn xDataType, nil\n\t\t}\n\t\tif c.isConstant(xDataType) {\n\t\t\tif c.isUntypedVar(yDataType) {\n\t\t\t\tb := yDataType.(*gotypes.Builtin)\n\t\t\t\t// Product of << or >> operation.\n\t\t\t\t// So the Y constant must be integral since the <<, resp. >> does not accept non-integral LHS.\n\t\t\t\t// See https://golang.org/ref/spec#Operators and the \"shift expression\" paragraph with examples.\n\t\t\t\tif !c.isIntegral(xType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Op %v expects the RHS to be int, got %#v instead\", b.Literal, xType.getOriginalType())\n\t\t\t\t}\n\t\t\t\t// Y is untyped int constant\n\t\t\t\tif xType.untyped {\n\t\t\t\t\treturn yDataType, nil\n\t\t\t\t}\n\t\t\t\t// Y is typed int constant\n\t\t\t\treturn &gotypes.Identifier{\n\t\t\t\t\tPackage: \"builtin\",\n\t\t\t\t\tDef: xDataType.(*gotypes.Constant).Def,\n\t\t\t\t}, nil\n\t\t\t}\n\t\t\t// X is typed variable\n\t\t\t// is the Y constant compatible with the typed variable X?\n\t\t\tif xType.untyped {\n\t\t\t\t// Y is untyped constant\n\t\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\t\tvar targetType string\n\t\t\t\tif yType.pkg == \"C\" {\n\t\t\t\t\tgoIdent, err := c.symbolsAccessor.CToGoUnderlyingType(&gotypes.Identifier{Package: \"C\", Def: yType.id})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\ttargetType = goIdent.Def\n\t\t\t\t} else {\n\t\t\t\t\ttargetType = yType.id\n\t\t\t\t}\n\t\t\t\tif _, err := ma.XToLiteral(targetType); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\treturn yDataType, nil\n\t\t\t}\n\t\t\t// both X,Y are typed\n\t\t\tif !xType.equals(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t}\n\t\t\treturn yDataType, nil\n\t\t}\n\t\t// Both X,Y are variable\n\t\tif c.isUntypedVar(xDataType) && c.isUntypedVar(yDataType) {\n\t\t\treturn &gotypes.Builtin{Def: \"int\", Untyped: true}, nil\n\t\t}\n\t\t// X is untyped var\n\t\tif c.isUntypedVar(xDataType) {\n\t\t\t// is Y compatible with X?\n\t\t\tif !c.isIntegral(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The second operand %v of %v is not int\", yDataType, exprOp)\n\t\t\t}\n\t\t\treturn yDataType, nil\n\t\t}\n\t\t// Y is untyped var\n\t\tif c.isUntypedVar(yDataType) {\n\t\t\t// is X compatible with Y?\n\t\t\tif !c.isIntegral(xType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The first operand %v of %v is not int\", xDataType, exprOp)\n\t\t\t}\n\t\t\treturn xDataType, nil\n\t\t}\n\t\t// both X,Y are typed\n\t\tif !xType.equals(yType) {\n\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t}\n\t\treturn xDataType, nil\n\tcase token.EQL, token.NEQ, token.LEQ, token.LSS, token.GEQ, token.GTR:\n\t\t// Both X,Y are constants\n\t\tif xDataType.GetType() == gotypes.ConstantType && yDataType.GetType() == gotypes.ConstantType {\n\t\t\tif xType.untyped && yType.untyped {\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: \"*\", Untyped: true}, nil\n\t\t\t\t}\n\n\t\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\t\tma.AddYFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\t\tif err := ma.Perform(exprOp).Error(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tvar lit string\n\t\t\t\tif ma.ZBool() {\n\t\t\t\t\tlit = \"true\"\n\t\t\t\t} else {\n\t\t\t\t\tlit = \"false\"\n\t\t\t\t}\n\t\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: lit, Untyped: true}, nil\n\t\t\t} else if xType.untyped {\n\t\t\t\t// it's either untyped int, untyped float or untyped complex\n\t\t\t\t// Y is int => X must be convertible to int\n\t\t\t\tif c.isIntegral(yType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(yDataType) {\n\t\t\t\t\t\t// x must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: \"*\", Untyped: true}, nil\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(yType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if yType.untyped {\n\t\t\t\tif c.isIntegral(xType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t\tif c.isValueLess(xDataType) {\n\t\t\t\t\t\t// Y must be untyped int constant and it is (or at least convertible to it)\n\t\t\t\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: \"*\", Untyped: true}, nil\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(xType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif !xType.equals(yType) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%v can not be converted to %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t}\n\t\t\t\tif c.isValueLess(xDataType) || c.isValueLess(yDataType) {\n\t\t\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: \"*\", Untyped: true}, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\tma.AddXFromString(xDataType.(*gotypes.Constant).Literal)\n\t\t\tma.AddYFromString(yDataType.(*gotypes.Constant).Literal)\n\t\t\tif err := ma.Perform(exprOp).Error(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tvar lit string\n\t\t\tif ma.ZBool() {\n\t\t\t\tlit = \"true\"\n\t\t\t} else {\n\t\t\t\tlit = \"false\"\n\t\t\t}\n\t\t\treturn &gotypes.Constant{Package: \"builtin\", Def: \"bool\", Literal: lit, Untyped: true}, nil\n\t\t}\n\t\tif c.isConstant(yDataType) {\n\t\t\tif yType.untyped {\n\t\t\t\tif c.isIntegral(xType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(xType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(yType, yDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\t\t}\n\t\tif c.isConstant(xDataType) {\n\t\t\tif xType.untyped {\n\t\t\t\tif c.isIntegral(yType) {\n\t\t\t\t\tif !c.isCompatibleWithInt(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t} else if c.isFloating(yType) {\n\t\t\t\t\tif !c.isCompatibleWithFloat(xType, xDataType) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"mismatched types %v and %v for %v op\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\t\t}\n\t\t// both constants\n\t\tif c.isUntypedVar(xDataType) && c.isUntypedVar(yDataType) {\n\t\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\t\t}\n\t\t// X is untyped var\n\t\tif c.isUntypedVar(xDataType) {\n\t\t\t// is Y compatible with X?\n\t\t\tif !c.isIntegral(yType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The second operand %v of %v is not int\", yDataType, exprOp)\n\t\t\t}\n\t\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\t\t}\n\t\tif c.isUntypedVar(yDataType) {\n\t\t\t// is X compatible with Y?\n\t\t\tif !c.isIntegral(xType) {\n\t\t\t\treturn nil, fmt.Errorf(\"The first operand %v of %v is not int\", xDataType, exprOp)\n\t\t\t}\n\t\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\t\t}\n\t\tif !xType.equals(yType) {\n\t\t\treturn nil, fmt.Errorf(\"%v can not be converted to %v for %v operation\", xType.getOriginalType(), yType.getOriginalType(), exprOp)\n\t\t}\n\t\treturn &gotypes.Builtin{Def: \"bool\", Untyped: true}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"binaryExprNumeric: Unsupported operation %v over %v.%v and %v.%v\", exprOp, xType.oPkg, xType.oId, yType.oPkg, yType.oId)\n\t}\n}", "title": "" }, { "docid": "6671579028a5ded67cc81894493687a9", "score": "0.53070277", "text": "func operatorFromTokenType(typ tokenTyp, binary bool) ast.OperatorType {\n\tswitch typ {\n\tcase tokenEqual:\n\t\treturn ast.OperatorEqual\n\tcase tokenNotEqual:\n\t\treturn ast.OperatorNotEqual\n\tcase tokenNot:\n\t\treturn ast.OperatorNot\n\tcase tokenAmpersand:\n\t\tif binary {\n\t\t\treturn ast.OperatorBitAnd\n\t\t}\n\t\treturn ast.OperatorAddress\n\tcase tokenVerticalBar:\n\t\treturn ast.OperatorBitOr\n\tcase tokenLess:\n\t\treturn ast.OperatorLess\n\tcase tokenLessOrEqual:\n\t\treturn ast.OperatorLessEqual\n\tcase tokenGreater:\n\t\treturn ast.OperatorGreater\n\tcase tokenGreaterOrEqual:\n\t\treturn ast.OperatorGreaterEqual\n\tcase tokenAnd:\n\t\treturn ast.OperatorAnd\n\tcase tokenOr:\n\t\treturn ast.OperatorOr\n\tcase tokenExtendedAnd:\n\t\treturn ast.OperatorExtendedAnd\n\tcase tokenExtendedOr:\n\t\treturn ast.OperatorExtendedOr\n\tcase tokenExtendedNot:\n\t\treturn ast.OperatorExtendedNot\n\tcase tokenContains:\n\t\treturn ast.OperatorContains\n\tcase tokenAddition:\n\t\treturn ast.OperatorAddition\n\tcase tokenSubtraction:\n\t\treturn ast.OperatorSubtraction\n\tcase tokenMultiplication:\n\t\tif binary {\n\t\t\treturn ast.OperatorMultiplication\n\t\t}\n\t\treturn ast.OperatorPointer\n\tcase tokenDivision:\n\t\treturn ast.OperatorDivision\n\tcase tokenModulo:\n\t\treturn ast.OperatorModulo\n\tcase tokenArrow:\n\t\treturn ast.OperatorReceive\n\tcase tokenXor:\n\t\treturn ast.OperatorXor\n\tcase tokenAndNot:\n\t\treturn ast.OperatorAndNot\n\tcase tokenLeftShift:\n\t\treturn ast.OperatorLeftShift\n\tcase tokenRightShift:\n\t\treturn ast.OperatorRightShift\n\tdefault:\n\t\tpanic(\"invalid token type\")\n\t}\n}", "title": "" }, { "docid": "8b2e145b6a331e8afc1f69e974792d22", "score": "0.52896416", "text": "func parseOpValue(token ScannedToken) (*FuncLiteral, error) {\n\t// note (bs): this should probably exist as a discrete value\n\topMap := map[string]func(*EvalContext, ...Value) (Value, error){\n\t\t\"+\": addFn,\n\t\t\"-\": subFn,\n\t\t\"*\": multFn,\n\t\t\"/\": divFn,\n\t\t\"==\": eqNumFn,\n\t\t\"<\": ltNumFn,\n\t\t\">\": gtNumFn,\n\t\t\"<=\": lteNumFn,\n\t\t\">=\": gteNumFn,\n\t}\n\tif fn, ok := opMap[token.Value]; ok {\n\t\treturn &FuncLiteral{\n\t\t\tName: token.Value,\n\t\t\tFn: fn,\n\t\t\tPos: token.Pos,\n\t\t}, nil\n\t}\n\treturn nil, NewParseError(\"unrecognized operator\", token)\n}", "title": "" }, { "docid": "5a2221814bb6710633cd0c950583858a", "score": "0.52220696", "text": "func (v *ASTBuilder) VisitLogicalBinary(ctx *antlrgen.LogicalBinaryContext) interface{} {\n\tlocation := v.getLocation(ctx)\n\tif v.SQL2AqlCtx.exprCheck {\n\t\tv.Logger.Debugf(\"VisitLogicalBinary check: %s\", ctx.GetText())\n\t\tif ctx.GetOperator() == nil {\n\t\t\tpanic(fmt.Errorf(\"missing logicalBinary operator, (line:%d, col:%d)\",\n\t\t\t\tlocation.Line, location.CharPosition))\n\t\t}\n\n\t\tv.Visit(ctx.GetLeft())\n\t\tv.Visit(ctx.GetRight())\n\t\treturn tree.NewExpression(v.getLocation(ctx))\n\t}\n\n\tv.Logger.Debugf(\"VisitLogicalBinary: %s\", ctx.GetText())\n\toperator := v.getLogicalBinaryOperator(ctx.GetOperator().GetTokenType())\n\tif operator == tree.OR {\n\t\tif v.SQL2AqlCtx.exprOrigin == ExprOriginWhere {\n\t\t\tv.SQL2AqlCtx.MapRowFilters[v.SQL2AqlCtx.mapKey] =\n\t\t\t\tappend(v.SQL2AqlCtx.MapRowFilters[v.SQL2AqlCtx.mapKey], v.getText(ctx.BaseParserRuleContext))\n\t\t} else if v.SQL2AqlCtx.exprOrigin == ExprOriginJoinOn {\n\t\t\tlast := len(v.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey]) - 1\n\t\t\tv.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey][last].Conditions =\n\t\t\t\tappend(v.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey][last].Conditions, v.getText(ctx.BaseParserRuleContext))\n\t\t}\n\n\t\texpr := tree.NewExpression(v.getLocation(ctx))\n\t\texpr.SetValue(fmt.Sprintf(\"LogicalBinaryExpression: (%s)\", v.getText(ctx.BaseParserRuleContext)))\n\t\treturn expr\n\t}\n\n\tleft, _ := v.Visit(ctx.GetLeft()).(tree.IExpression)\n\tright, _ := v.Visit(ctx.GetRight()).(tree.IExpression)\n\tlogicalBinaryExpr := tree.NewLogicalBinaryExpression(\n\t\tv.getLocation(ctx),\n\t\toperator,\n\t\tleft,\n\t\tright)\n\tlogicalBinaryExpr.SetValue(fmt.Sprintf(\"LogicalBinaryExpression: (%s)\", v.getText(ctx.BaseParserRuleContext)))\n\treturn logicalBinaryExpr\n}", "title": "" }, { "docid": "bc7b9dfd49f882d558da3b1065dd9500", "score": "0.51863515", "text": "func (in *Interpreter) VisitBinaryExpr(b *BinaryExpr) {\n\t// evaluate left and right operand expressions, passing errors up the call stack as needed\n\tleft, lerr := in.evaluate(b.left)\n\tif lerr != nil {\n\t\tin.resultVal = lerr\n\t\treturn\n\t}\n\tright, rerr := in.evaluate(b.right)\n\tif rerr != nil {\n\t\tin.resultVal = rerr\n\t\treturn\n\t}\n\tswitch b.op.toktype {\n\tcase Greater:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd > rightd\n\tcase GreaterEqual:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd >= rightd\n\tcase Less:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd < rightd\n\tcase LessEqual:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd <= rightd\n\tcase Minus:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd - rightd\n\tcase Slash:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd / rightd\n\tcase Star:\n\t\tin.checkNumberOperands(b.op, left, right)\n\t\tif _, ok := in.resultVal.(error); ok {\n\t\t\treturn\n\t\t}\n\t\tleftd := left.(float64)\n\t\trightd := right.(float64)\n\t\tin.resultVal = leftd * rightd\n\tcase Plus:\n\t\t// plus can be applied to both numbers (doubles) and strings\n\t\t// this solution only looks at the type of the expression's left operand\n\t\tleftd, lOk := left.(float64)\n\t\trightd, rOk := right.(float64)\n\t\tleftstr, lStrOk := left.(string)\n\t\trightstr, rStrOk := right.(string)\n\t\tswitch {\n\t\tcase lOk && rOk:\n\t\t\tin.resultVal = leftd + rightd\n\t\tcase lStrOk && rStrOk:\n\t\t\tin.resultVal = leftstr + rightstr\n\t\tdefault:\n\t\t\tin.resultVal = RuntimeError{\n\t\t\t\ttkn: b.op,\n\t\t\t\tmsg: \"Addition operands must both be numbers or strings\",\n\t\t\t}\n\t\t}\n\t}\n\t// TODO: implement more binary operations\n}", "title": "" }, { "docid": "4bf1ab69a2fd0e4fab1ce31112b391c5", "score": "0.5182812", "text": "func TestRuleBinaryAssumption(t *testing.T) {\n\tfn := func(op opt.Operator) {\n\t\tfor _, overload := range tree.BinOps[opt.BinaryOpReverseMap[op]] {\n\t\t\tbinOp := overload.(*tree.BinOp)\n\t\t\tif !memo.BinaryOverloadExists(op, binOp.RightType, binOp.LeftType) {\n\t\t\t\tt.Errorf(\"could not find inverse for overload: %+v\", op)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Only include commutative binary operators.\n\tfn(opt.PlusOp)\n\tfn(opt.MultOp)\n\tfn(opt.BitandOp)\n\tfn(opt.BitorOp)\n\tfn(opt.BitxorOp)\n}", "title": "" }, { "docid": "4a433ab29e7b3fd0f9864c789af20aa8", "score": "0.5167491", "text": "func NewPlusOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"+\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: defaultBinaryAnalyzer,\n\t\tt: defaultBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn a + b\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4b116d2020099cec697c970de5a876dd", "score": "0.5162973", "text": "func walkBinary(ctx expr.EvalContext, node *expr.BinaryNode) (value.Value, bool) {\n\tar, aok := Eval(ctx, node.Args[0])\n\tbr, bok := Eval(ctx, node.Args[1])\n\n\t//u.Debugf(\"walkBinary: aok?%v ar:%v %T node=%s %T\", aok, ar, ar, node.Args[0], node.Args[0])\n\t//u.Debugf(\"walkBinary: bok?%v br:%v %T node=%s %T\", bok, br, br, node.Args[1], node.Args[1])\n\t//u.Debugf(\"walkBinary: l:%v r:%v %T %T node=%s\", ar, br, ar, br, node)\n\t// If we could not evaluate either we can shortcut\n\tif !aok && !bok {\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenLogicOr, lex.TokenOr:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t// We don't alllow nil == nil here bc we have a NilValue type\n\t\t\t// that we would use for that\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenNE:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenGT, lex.TokenGE, lex.TokenLT, lex.TokenLE, lex.TokenLike:\n\t\t\treturn value.NewBoolValue(false), true\n\t\t}\n\t\t//u.Debugf(\"walkBinary not ok: op=%s %v l:%v r:%v %T %T\", node.Operator, node, ar, br, ar, br)\n\t\treturn nil, false\n\t}\n\n\t// Else if we can only evaluate one, we can short circuit as well\n\tif !aok || !bok {\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenAnd, lex.TokenLogicAnd:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenNE:\n\t\t\t// they are technically not equal?\n\t\t\treturn value.NewBoolValue(true), true\n\t\tcase lex.TokenGT, lex.TokenGE, lex.TokenLT, lex.TokenLE, lex.TokenLike:\n\t\t\treturn value.NewBoolValue(false), true\n\t\t}\n\t\t//u.Debugf(\"walkBinary not ok: op=%s %v l:%v r:%v %T %T\", node.Operator, node, ar, br, ar, br)\n\t\t// need to fall through to below\n\t}\n\n\tswitch at := ar.(type) {\n\tcase value.IntValue:\n\t\tswitch bt := br.(type) {\n\t\tcase value.IntValue:\n\t\t\t//u.Debugf(\"doing operate ints %v %v %v\", at, node.Operator.V, bt)\n\t\t\tn := operateInts(node.Operator, at, bt)\n\t\t\treturn n, true\n\t\tcase value.StringValue:\n\t\t\t//u.Debugf(\"doing operatation int+string %v %v %v\", at, node.Operator.V, bt)\n\t\t\t// Try int first\n\t\t\tbi, err := strconv.ParseInt(bt.Val(), 10, 64)\n\t\t\tif err == nil {\n\t\t\t\tn, err := operateIntVals(node.Operator, at.Val(), bi)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, false\n\t\t\t\t}\n\t\t\t\treturn n, true\n\t\t\t}\n\t\t\t// Fallback to float\n\t\t\tbf, err := strconv.ParseFloat(bt.Val(), 64)\n\t\t\tif err == nil {\n\t\t\t\tn := operateNumbers(node.Operator, at.NumberValue(), value.NewNumberValue(bf))\n\t\t\t\treturn n, true\n\t\t\t}\n\t\tcase value.NumberValue:\n\t\t\t//u.Debugf(\"doing operate ints/numbers %v %v %v\", at, node.Operator.V, bt)\n\t\t\tn := operateNumbers(node.Operator, at.NumberValue(), bt)\n\t\t\treturn n, true\n\t\tcase value.SliceValue:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenIN:\n\t\t\t\tfor _, val := range bt.Val() {\n\t\t\t\t\tswitch valt := val.(type) {\n\t\t\t\t\tcase value.StringValue:\n\t\t\t\t\t\tif at.Val() == valt.IntValue().Val() {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\tcase value.IntValue:\n\t\t\t\t\t\tif at.Val() == valt.Val() {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\tcase value.NumberValue:\n\t\t\t\t\t\tif at.Val() == valt.Int() {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tu.Debugf(\"Could not coerce to number: T:%T v:%v\", val, val)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tdefault:\n\t\t\t\tu.Debugf(\"unsupported op for SliceValue op:%v rhT:%T\", node.Operator, br)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tcase nil, value.NilValue:\n\t\t\treturn nil, false\n\t\tdefault:\n\t\t\tu.Errorf(\"unknown type: %T %v\", bt, bt)\n\t\t}\n\tcase value.NumberValue:\n\t\tswitch bt := br.(type) {\n\t\tcase value.IntValue:\n\t\t\tn := operateNumbers(node.Operator, at, bt.NumberValue())\n\t\t\treturn n, true\n\t\tcase value.NumberValue:\n\t\t\tn := operateNumbers(node.Operator, at, bt)\n\t\t\treturn n, true\n\t\tcase value.SliceValue:\n\t\t\tfor _, val := range bt.Val() {\n\t\t\t\tswitch valt := val.(type) {\n\t\t\t\tcase value.StringValue:\n\t\t\t\t\tif at.Val() == valt.NumberValue().Val() {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\tcase value.IntValue:\n\t\t\t\t\tif at.Val() == valt.NumberValue().Val() {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\tcase value.NumberValue:\n\t\t\t\t\tif at.Val() == valt.Val() {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tu.Debugf(\"Could not coerce to number: T:%T v:%v\", val, val)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase value.StringValue:\n\t\t\t//u.Debugf(\"doing operatation num+string %v %v %v\", at, node.Operator.V, bt)\n\t\t\t// Try int first\n\t\t\tif bf, err := strconv.ParseInt(bt.Val(), 10, 64); err == nil {\n\t\t\t\tn := operateNumbers(node.Operator, at, value.NewNumberValue(float64(bf)))\n\t\t\t\treturn n, true\n\t\t\t}\n\t\t\t// Fallback to float\n\t\t\tif bf, err := strconv.ParseFloat(bt.Val(), 64); err == nil {\n\t\t\t\tn := operateNumbers(node.Operator, at, value.NewNumberValue(bf))\n\t\t\t\treturn n, true\n\t\t\t}\n\t\tcase nil, value.NilValue:\n\t\t\treturn nil, false\n\t\tdefault:\n\t\t\tu.Errorf(\"unknown type: %T %v\", bt, bt)\n\t\t}\n\tcase value.BoolValue:\n\t\tswitch bt := br.(type) {\n\t\tcase value.BoolValue:\n\t\t\tatv, btv := at.Value().(bool), bt.Value().(bool)\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenLogicAnd, lex.TokenAnd:\n\t\t\t\treturn value.NewBoolValue(atv && btv), true\n\t\t\tcase lex.TokenLogicOr, lex.TokenOr:\n\t\t\t\treturn value.NewBoolValue(atv || btv), true\n\t\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t\treturn value.NewBoolValue(atv == btv), true\n\t\t\tcase lex.TokenNE:\n\t\t\t\treturn value.NewBoolValue(atv != btv), true\n\t\t\tdefault:\n\t\t\t\tu.Warnf(\"bool binary?: %#v %v %v\", node, at, bt)\n\t\t\t}\n\t\tcase nil, value.NilValue:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenLogicAnd:\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tcase lex.TokenLogicOr, lex.TokenOr:\n\t\t\t\treturn at, true\n\t\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tcase lex.TokenNE:\n\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\t// case lex.TokenGE, lex.TokenGT, lex.TokenLE, lex.TokenLT:\n\t\t\t// \treturn value.NewBoolValue(false), true\n\t\t\tdefault:\n\t\t\t\tu.Warnf(\"right side nil binary: %q\", node)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tdefault:\n\t\t\t//u.Warnf(\"br: %#v\", br)\n\t\t\t//u.Errorf(\"at?%T %v coerce?%v bt? %T %v\", at, at.Value(), at.CanCoerce(stringRv), bt, bt.Value())\n\t\t\treturn nil, false\n\t\t}\n\tcase value.StringValue:\n\t\tswitch bt := br.(type) {\n\t\tcase value.StringValue:\n\t\t\t// Nice, both strings\n\t\t\treturn operateStrings(node.Operator, at, bt), true\n\t\tcase nil, value.NilValue:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t\tif at.Nil() {\n\t\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tcase lex.TokenNE:\n\t\t\t\tif at.Nil() {\n\t\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\tdefault:\n\t\t\t\tu.Debugf(\"unsupported op: %v\", node.Operator)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tcase value.SliceValue:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenIN:\n\t\t\t\tfor _, val := range bt.Val() {\n\t\t\t\t\tif at.Val() == val.ToString() {\n\t\t\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tdefault:\n\t\t\t\tu.Debugf(\"unsupported op for SliceValue op:%v rhT:%T\", node.Operator, br)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tcase value.StringsValue:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenIN:\n\t\t\t\tfor _, val := range bt.Val() {\n\t\t\t\t\tif at.Val() == val {\n\t\t\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tdefault:\n\t\t\t\tu.Debugf(\"unsupported op for Strings op:%v rhT:%T\", node.Operator, br)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tcase value.BoolValue:\n\t\t\tif value.IsBool(at.Val()) {\n\t\t\t\t//u.Warnf(\"bool eval: %v %v %v :: %v\", value.BoolStringVal(at.Val()), node.Operator.T.String(), bt.Val(), value.NewBoolValue(value.BoolStringVal(at.Val()) == bt.Val()))\n\t\t\t\tswitch node.Operator.T {\n\t\t\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t\t\treturn value.NewBoolValue(value.BoolStringVal(at.Val()) == bt.Val()), true\n\t\t\t\tcase lex.TokenNE:\n\t\t\t\t\treturn value.NewBoolValue(value.BoolStringVal(at.Val()) != bt.Val()), true\n\t\t\t\tdefault:\n\t\t\t\t\tu.Debugf(\"unsupported op: %v\", node.Operator)\n\t\t\t\t\treturn nil, false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Should we evaluate strings that are non-nil to be = true?\n\t\t\t\tu.Debugf(\"not handled: boolean %v %T=%v expr: %s\", node.Operator, at.Value(), at.Val(), node.String())\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tcase value.Map:\n\t\t\tswitch node.Operator.T {\n\t\t\tcase lex.TokenIN:\n\t\t\t\t_, hasKey := bt.Get(at.Val())\n\t\t\t\tif hasKey {\n\t\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\t\t}\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\tdefault:\n\t\t\t\tu.Debugf(\"unsupported op for Map op:%v rhT:%T\", node.Operator, br)\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\tdefault:\n\t\t\t// TODO: this doesn't make sense, we should be able to operate on other types\n\t\t\tif at.CanCoerce(int64Rv) {\n\t\t\t\tswitch bt := br.(type) {\n\t\t\t\tcase value.StringValue:\n\t\t\t\t\tn := operateNumbers(node.Operator, at.NumberValue(), bt.NumberValue())\n\t\t\t\t\treturn n, true\n\t\t\t\tcase value.IntValue:\n\t\t\t\t\tn := operateNumbers(node.Operator, at.NumberValue(), bt.NumberValue())\n\t\t\t\t\treturn n, true\n\t\t\t\tcase value.NumberValue:\n\t\t\t\t\tn := operateNumbers(node.Operator, at.NumberValue(), bt)\n\t\t\t\t\treturn n, true\n\t\t\t\tdefault:\n\t\t\t\t\tu.Errorf(\"at?%T %v coerce?%v bt? %T %v\", at, at.Value(), at.CanCoerce(stringRv), bt, bt.Value())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tu.Errorf(\"at?%T %v coerce?%v bt? %T %v\", at, at.Value(), at.CanCoerce(stringRv), br, br)\n\t\t\t}\n\t\t}\n\tcase value.SliceValue:\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenContains:\n\t\t\tswitch bval := br.(type) {\n\t\t\tcase nil, value.NilValue:\n\t\t\t\treturn nil, false\n\t\t\tcase value.StringValue:\n\t\t\t\t// [x,y,z] contains str\n\t\t\t\tfor _, val := range at.Val() {\n\t\t\t\t\tif strings.Contains(val.ToString(), bval.Val()) {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\tcase value.IntValue:\n\t\t\t\t// [] contains int\n\t\t\t\tfor _, val := range at.Val() {\n\t\t\t\t\t//u.Infof(\"int contains? %v %v\", val.Value(), br.Value())\n\t\t\t\t\tif eq, _ := value.Equal(val, br); eq {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\t}\n\t\tcase lex.TokenLike:\n\t\t\tswitch bv := br.(type) {\n\t\t\tcase value.StringValue:\n\t\t\t\t// [x,y,z] LIKE str\n\t\t\t\tfor _, val := range at.Val() {\n\t\t\t\t\tif boolVal, ok := LikeCompare(val.ToString(), bv.Val()); ok && boolVal.Val() == true {\n\t\t\t\t\t\treturn boolVal, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\tdefault:\n\t\t\t\t//u.Warnf(\"un handled right side to Like T:%T %v\", br, br)\n\t\t\t}\n\t\tcase lex.TokenIntersects:\n\t\t\tswitch bt := br.(type) {\n\t\t\tcase nil, value.NilValue:\n\t\t\t\treturn nil, false\n\t\t\tcase value.SliceValue:\n\t\t\t\tfor _, aval := range at.Val() {\n\t\t\t\t\tfor _, bval := range bt.Val() {\n\t\t\t\t\t\tif eq, _ := value.Equal(aval, bval); eq {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\tcase value.StringsValue:\n\t\t\t\tfor _, aval := range at.Val() {\n\t\t\t\t\tfor _, bstr := range bt.Val() {\n\t\t\t\t\t\tif aval.ToString() == bstr {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\t}\n\t\t}\n\t\treturn nil, false\n\tcase value.StringsValue:\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenContains:\n\t\t\tswitch bv := br.(type) {\n\t\t\tcase value.StringValue:\n\t\t\t\t// [x,y,z] contains str\n\t\t\t\tfor _, val := range at.Val() {\n\t\t\t\t\t//u.Infof(\"str contains? %v %v\", val, bv.Val())\n\t\t\t\t\tif strings.Contains(val, bv.Val()) {\n\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\t}\n\t\tcase lex.TokenLike:\n\n\t\t\tswitch bv := br.(type) {\n\t\t\tcase value.StringValue:\n\t\t\t\t// [x,y,z] LIKE str\n\t\t\t\tfor _, val := range at.Val() {\n\t\t\t\t\tboolVal, ok := LikeCompare(val, bv.Val())\n\t\t\t\t\t//u.Debugf(\"%s like %s ?? ok?%v result=%v\", val, bv.Val(), ok, boolVal)\n\t\t\t\t\tif ok && boolVal.Val() == true {\n\t\t\t\t\t\treturn boolVal, true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\t}\n\t\tcase lex.TokenIntersects:\n\t\t\tswitch bt := br.(type) {\n\t\t\tcase nil, value.NilValue:\n\t\t\t\treturn nil, false\n\t\t\tcase value.SliceValue:\n\t\t\t\tfor _, astr := range at.Val() {\n\t\t\t\t\tfor _, bval := range bt.Val() {\n\t\t\t\t\t\tif astr == bval.ToString() {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\tcase value.StringsValue:\n\t\t\t\tfor _, astr := range at.Val() {\n\t\t\t\t\tfor _, bstr := range bt.Val() {\n\t\t\t\t\t\tif astr == bstr {\n\t\t\t\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn value.BoolValueFalse, true\n\t\t\t}\n\t\t}\n\t\treturn nil, false\n\tcase value.TimeValue:\n\t\trht := time.Time{}\n\t\tlht := at.Val()\n\t\tvar err error\n\t\tswitch bv := br.(type) {\n\t\tcase value.TimeValue:\n\t\t\trht = bv.Val()\n\t\tcase value.StringValue:\n\t\t\tte := bv.Val()\n\t\t\tif len(te) > 3 && strings.ToLower(te[:3]) == \"now\" {\n\t\t\t\t// Is date math\n\t\t\t\trht, err = datemath.Eval(te[3:])\n\t\t\t} else {\n\t\t\t\trht, err = dateparse.ParseAny(te)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tu.Warnf(\"error? %s err=%v\", te, err)\n\t\t\t\treturn value.BoolValueFalse, false\n\t\t\t}\n\t\tcase value.IntValue:\n\t\t\t// really? we are going to try ints?\n\t\t\trht, err = dateparse.ParseAny(bv.ToString())\n\t\t\tif err != nil {\n\t\t\t\treturn value.BoolValueFalse, false\n\t\t\t}\n\t\t\tif rht.Year() < 1800 || rht.Year() > 2300 {\n\t\t\t\treturn value.BoolValueFalse, false\n\t\t\t}\n\t\tdefault:\n\t\t\t//u.Warnf(\"un-handled? %#v\", bv)\n\t\t}\n\t\t// if rht.IsZero() {\n\t\t// \treturn nil, false\n\t\t// }\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenEqual, lex.TokenEqualEqual:\n\t\t\tif lht.Unix() == rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase lex.TokenNE:\n\t\t\tif lht.Unix() != rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase lex.TokenGT:\n\t\t\t// lhexpr > rhexpr\n\t\t\tif lht.Unix() > rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase lex.TokenGE:\n\t\t\t// lhexpr >= rhexpr\n\t\t\tif lht.Unix() >= rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase lex.TokenLT:\n\t\t\t// lhexpr < rhexpr\n\t\t\tif lht.Unix() < rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tcase lex.TokenLE:\n\t\t\t// lhexpr <= rhexpr\n\t\t\tif lht.Unix() <= rht.Unix() {\n\t\t\t\treturn value.BoolValueTrue, true\n\t\t\t}\n\t\t\treturn value.BoolValueFalse, true\n\t\tdefault:\n\t\t\tu.Warnf(\"unhandled date op %v\", node.Operator)\n\t\t}\n\t\treturn nil, false\n\tcase nil, value.NilValue:\n\t\tswitch node.Operator.T {\n\t\tcase lex.TokenLogicAnd:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenLogicOr, lex.TokenOr:\n\t\t\tswitch bt := br.(type) {\n\t\t\tcase value.BoolValue:\n\t\t\t\treturn bt, true\n\t\t\tdefault:\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\t}\n\t\tcase lex.TokenEqualEqual, lex.TokenEqual:\n\t\t\t// does nil==nil = true ??\n\t\t\tswitch br.(type) {\n\t\t\tcase nil, value.NilValue:\n\t\t\t\treturn value.NewBoolValue(true), true\n\t\t\tdefault:\n\t\t\t\treturn value.NewBoolValue(false), true\n\t\t\t}\n\t\tcase lex.TokenNE:\n\t\t\treturn value.NewBoolValue(true), true\n\t\t// case lex.TokenGE, lex.TokenGT, lex.TokenLE, lex.TokenLT:\n\t\t// \treturn value.NewBoolValue(false), true\n\t\tcase lex.TokenContains, lex.TokenLike, lex.TokenIN:\n\t\t\treturn value.NewBoolValue(false), true\n\t\tdefault:\n\t\t\t//u.Debugf(\"left side nil binary: %q\", node)\n\t\t\treturn nil, false\n\t\t}\n\tdefault:\n\t\tu.Debugf(\"Unknown op? %T %T %v\", ar, at, ar)\n\t\treturn value.NewErrorValue(fmt.Sprintf(\"unsupported left side value: %T in %s\", at, node)), false\n\t}\n\n\treturn value.NewErrorValue(fmt.Sprintf(\"unsupported binary expression: %s\", node)), false\n}", "title": "" }, { "docid": "1652715b001faa3a930b475576106004", "score": "0.5148106", "text": "func (t *tree) parseExpr(prec int) ast.Node {\n\tn := t.parseExprFirstTerm()\n\tvar tok item\n\tfor {\n\t\ttok = t.next()\n\t\tq := precedence[tok.typ]\n\t\tif !isBinaryOp(tok.typ) || q < prec {\n\t\t\tbreak\n\t\t}\n\t\tq++\n\t\tn = newBinaryOpNode(tok, n, t.parseExpr(q))\n\t}\n\tif prec == 0 && tok.typ == itemTernIf {\n\t\treturn t.parseTernary(n)\n\t}\n\tt.backup()\n\treturn n\n}", "title": "" }, { "docid": "a9210863b6af0f29d52fe6552fcc514d", "score": "0.51210797", "text": "func (p *printer) binaryExpr(x *ast.BinaryExpr, prec1 int, multiLine *bool) {\n\tprec := x.Op.Precedence();\n\tif prec < prec1 {\n\t\t// parenthesis needed\n\t\t// Note: The parser inserts an ast.ParenExpr node; thus this case\n\t\t// can only occur if the AST is created in a different way.\n\t\tp.print(token.LPAREN);\n\t\tp.expr(x, multiLine);\n\t\tp.print(token.RPAREN);\n\t\treturn;\n\t}\n\n\t// Traverse left, collect all operations at same precedence\n\t// and determine if blanks should be printed around operators.\n\t//\n\t// This algorithm assumes that the right-hand side of a binary\n\t// operation has a different (higher) precedence then the current\n\t// node, which is how the parser creates the AST.\n\tvar list vector.Vector;\n\tline := x.Y.Pos().Line;\n\tprintBlanks := prec <= token.EQL.Precedence() || needsBlanks(x.Y);\n\tfor {\n\t\tlist.Push(x);\n\t\tif t, ok := x.X.(*ast.BinaryExpr); ok && t.Op.Precedence() == prec {\n\t\t\tx = t;\n\t\t\tprev := line;\n\t\t\tline = x.Y.Pos().Line;\n\t\t\tif needsBlanks(x.Y) || prev != line {\n\t\t\t\tprintBlanks = true;\n\t\t\t}\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tprev := line;\n\tline = x.X.Pos().Line;\n\tif needsBlanks(x.X) || prev != line {\n\t\tprintBlanks = true;\n\t}\n\n\t// Print collected operations left-to-right, with blanks if necessary.\n\tws := indent;\n\tp.expr1(x.X, prec, multiLine);\n\tfor list.Len() > 0 {\n\t\tx = list.Pop().(*ast.BinaryExpr);\n\t\tprev := line;\n\t\tline = x.Y.Pos().Line;\n\t\tif printBlanks {\n\t\t\tif prev != line {\n\t\t\t\tp.print(blank, x.OpPos, x.Op);\n\t\t\t\t// at least one line break, but respect an extra empty line\n\t\t\t\t// in the source\n\t\t\t\tif p.linebreak(line, 1, 2, ws, true) {\n\t\t\t\t\tws = ignore;\n\t\t\t\t\t*multiLine = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tp.print(blank, x.OpPos, x.Op, blank);\n\t\t\t}\n\t\t} else {\n\t\t\tif prev != line {\n\t\t\t\tpanic(\"internal error\");\n\t\t\t}\n\t\t\tp.print(x.OpPos, x.Op);\n\t\t}\n\t\tp.expr1(x.Y, prec, multiLine);\n\t}\n\tif ws == ignore {\n\t\tp.print(unindent);\n\t}\n}", "title": "" }, { "docid": "d1f16cdfa1e465ebfd82689ab14afb76", "score": "0.5118013", "text": "func GetOpForBin(binName string) *Operation {\n\treturn &Operation{OpType: READ, BinName: binName, BinValue: NewNullValue()}\n}", "title": "" }, { "docid": "775a30d65c4d56048fa8e06a6fc8d8f4", "score": "0.51084524", "text": "func newBinExprIfValidOverload(op BinaryOperator, left TypedExpr, right TypedExpr) *BinaryExpr {\n\tleftRet, rightRet := left.ResolvedType(), right.ResolvedType()\n\tfn, ok := BinOps[op].lookupImpl(leftRet, rightRet)\n\tif ok {\n\t\texpr := &BinaryExpr{\n\t\t\tOperator: op,\n\t\t\tLeft: left,\n\t\t\tRight: right,\n\t\t\tFn: fn,\n\t\t}\n\t\texpr.typ = returnTypeToFixedType(fn.returnType())\n\t\treturn expr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7a9c4e3aa6e3aa66874ffaecf654d40", "score": "0.5107577", "text": "func baseVisitBinary(base ExpressionVisitor, expr BinaryExpression) Expression {\n\t// Walk children in evaluation order: left, conversion, right\n\n\tleft := base.Visit(expr.GetLeft())\n\tright := base.Visit(expr.GetRight())\n\tafter := expr.Update(left.(TerminalExpression), right.(TerminalExpression))\n\treturn validateBinary(expr, after)\n\n}", "title": "" }, { "docid": "4ea781994d180a727c2f70dc78cb1e2a", "score": "0.5087878", "text": "func (node *BinaryExpr) ResolvedBinOp() *BinOp {\n\treturn node.Fn\n}", "title": "" }, { "docid": "c00d7f10176a7a8da327fc87d4b52d39", "score": "0.50822276", "text": "func parse(n string) (int, error) {\n\tacc := 0\n\tb := []byte(n)\n\tif b[0] != '+' && b[0] != '-' {\n\t\treturn acc, BadInputError(n)\n\t}\n\n\tif len(b) < 2 {\n\t\treturn acc, BadInputError(n)\n\t}\n\n\tmul := 1\n\tif b[0] == '-' {\n\t\tmul = -1\n\t}\n\n\tfor _, x := range b[1:] {\n\t\tif x < 0x30 || x > 0x39 {\n\t\t\treturn acc, BadInputError(n)\n\t\t}\n\t\tacc = acc * 10\n\t\tacc = acc + int(x) - 0x30\n\t}\n\n\treturn acc * mul, nil\n}", "title": "" }, { "docid": "e7ede03374df5b6f9a4dd66c94503741", "score": "0.5078363", "text": "func convertOp(op string) (string, error) {\n\n\tswitch op {\n\tcase \"NE\":\n\t\top = \"!=\"\n\tcase \"EQ\":\n\t\top = \"=\"\n\tcase \"LIKE\":\n\t\top = \"LIKE\"\n\tcase \"LT\":\n\t\top = \"<\"\n\tcase \"LE\":\n\t\top = \"<=\"\n\tcase \"GT\":\n\t\top = \">\"\n\tcase \"GE\":\n\t\top = \">=\"\n\tdefault:\n\t\t// unknown operand - error\n\t\treturn \"\", fmt.Errorf(\"error: %s is an unknown selection operand\", op)\n\t}\n\treturn op, nil\n}", "title": "" }, { "docid": "ef26829ed7e7e21e3b0bfa4bc2c7e397", "score": "0.50778747", "text": "func (v *ASTBuilder) getLogicalBinaryOperator(token int) tree.LogicalBinaryExpType {\n\tswitch token {\n\tcase antlrgen.SqlBaseLexerAND:\n\t\treturn tree.AND\n\tcase antlrgen.SqlBaseLexerOR:\n\t\treturn tree.OR\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Unsupported operator: %v\", token))\n\t}\n}", "title": "" }, { "docid": "4d086d6a807ecb9c55774ae6625f22a9", "score": "0.5049398", "text": "func binop(op token.Token, t types.Type, x, y value) value {\n\tswitch op {\n\tcase token.ADD:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) + y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) + y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) + y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) + y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) + y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) + y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) + y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) + y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) + y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) + y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) + y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) + y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) + y.(float64)\n\t\tcase complex64:\n\t\t\treturn x.(complex64) + y.(complex64)\n\t\tcase complex128:\n\t\t\treturn x.(complex128) + y.(complex128)\n\t\tcase string:\n\t\t\treturn x.(string) + y.(string)\n\t\t}\n\n\tcase token.SUB:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) - y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) - y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) - y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) - y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) - y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) - y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) - y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) - y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) - y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) - y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) - y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) - y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) - y.(float64)\n\t\tcase complex64:\n\t\t\treturn x.(complex64) - y.(complex64)\n\t\tcase complex128:\n\t\t\treturn x.(complex128) - y.(complex128)\n\t\t}\n\n\tcase token.MUL:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) * y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) * y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) * y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) * y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) * y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) * y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) * y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) * y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) * y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) * y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) * y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) * y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) * y.(float64)\n\t\tcase complex64:\n\t\t\treturn x.(complex64) * y.(complex64)\n\t\tcase complex128:\n\t\t\treturn x.(complex128) * y.(complex128)\n\t\t}\n\n\tcase token.QUO:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) / y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) / y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) / y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) / y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) / y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) / y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) / y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) / y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) / y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) / y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) / y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) / y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) / y.(float64)\n\t\tcase complex64:\n\t\t\treturn x.(complex64) / y.(complex64)\n\t\tcase complex128:\n\t\t\treturn x.(complex128) / y.(complex128)\n\t\t}\n\n\tcase token.REM:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) % y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) % y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) % y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) % y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) % y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) % y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) % y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) % y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) % y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) % y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) % y.(uintptr)\n\t\t}\n\n\tcase token.AND:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) & y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) & y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) & y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) & y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) & y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) & y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) & y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) & y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) & y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) & y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) & y.(uintptr)\n\t\t}\n\n\tcase token.OR:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) | y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) | y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) | y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) | y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) | y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) | y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) | y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) | y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) | y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) | y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) | y.(uintptr)\n\t\t}\n\n\tcase token.XOR:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) ^ y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) ^ y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) ^ y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) ^ y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) ^ y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) ^ y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) ^ y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) ^ y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) ^ y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) ^ y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) ^ y.(uintptr)\n\t\t}\n\n\tcase token.AND_NOT:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) &^ y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) &^ y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) &^ y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) &^ y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) &^ y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) &^ y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) &^ y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) &^ y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) &^ y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) &^ y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) &^ y.(uintptr)\n\t\t}\n\n\tcase token.SHL:\n\t\tu, ok := asUnsigned(y)\n\t\tif !ok {\n\t\t\tpanic(\"negative shift amount\")\n\t\t}\n\t\ty := asUint64(u)\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) << y\n\t\tcase int8:\n\t\t\treturn x.(int8) << y\n\t\tcase int16:\n\t\t\treturn x.(int16) << y\n\t\tcase int32:\n\t\t\treturn x.(int32) << y\n\t\tcase int64:\n\t\t\treturn x.(int64) << y\n\t\tcase uint:\n\t\t\treturn x.(uint) << y\n\t\tcase uint8:\n\t\t\treturn x.(uint8) << y\n\t\tcase uint16:\n\t\t\treturn x.(uint16) << y\n\t\tcase uint32:\n\t\t\treturn x.(uint32) << y\n\t\tcase uint64:\n\t\t\treturn x.(uint64) << y\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) << y\n\t\t}\n\n\tcase token.SHR:\n\t\tu, ok := asUnsigned(y)\n\t\tif !ok {\n\t\t\tpanic(\"negative shift amount\")\n\t\t}\n\t\ty := asUint64(u)\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) >> y\n\t\tcase int8:\n\t\t\treturn x.(int8) >> y\n\t\tcase int16:\n\t\t\treturn x.(int16) >> y\n\t\tcase int32:\n\t\t\treturn x.(int32) >> y\n\t\tcase int64:\n\t\t\treturn x.(int64) >> y\n\t\tcase uint:\n\t\t\treturn x.(uint) >> y\n\t\tcase uint8:\n\t\t\treturn x.(uint8) >> y\n\t\tcase uint16:\n\t\t\treturn x.(uint16) >> y\n\t\tcase uint32:\n\t\t\treturn x.(uint32) >> y\n\t\tcase uint64:\n\t\t\treturn x.(uint64) >> y\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) >> y\n\t\t}\n\n\tcase token.LSS:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) < y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) < y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) < y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) < y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) < y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) < y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) < y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) < y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) < y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) < y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) < y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) < y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) < y.(float64)\n\t\tcase string:\n\t\t\treturn x.(string) < y.(string)\n\t\t}\n\n\tcase token.LEQ:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) <= y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) <= y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) <= y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) <= y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) <= y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) <= y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) <= y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) <= y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) <= y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) <= y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) <= y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) <= y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) <= y.(float64)\n\t\tcase string:\n\t\t\treturn x.(string) <= y.(string)\n\t\t}\n\n\tcase token.EQL:\n\t\treturn eqnil(t, x, y)\n\n\tcase token.NEQ:\n\t\treturn !eqnil(t, x, y)\n\n\tcase token.GTR:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) > y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) > y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) > y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) > y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) > y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) > y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) > y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) > y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) > y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) > y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) > y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) > y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) > y.(float64)\n\t\tcase string:\n\t\t\treturn x.(string) > y.(string)\n\t\t}\n\n\tcase token.GEQ:\n\t\tswitch x.(type) {\n\t\tcase int:\n\t\t\treturn x.(int) >= y.(int)\n\t\tcase int8:\n\t\t\treturn x.(int8) >= y.(int8)\n\t\tcase int16:\n\t\t\treturn x.(int16) >= y.(int16)\n\t\tcase int32:\n\t\t\treturn x.(int32) >= y.(int32)\n\t\tcase int64:\n\t\t\treturn x.(int64) >= y.(int64)\n\t\tcase uint:\n\t\t\treturn x.(uint) >= y.(uint)\n\t\tcase uint8:\n\t\t\treturn x.(uint8) >= y.(uint8)\n\t\tcase uint16:\n\t\t\treturn x.(uint16) >= y.(uint16)\n\t\tcase uint32:\n\t\t\treturn x.(uint32) >= y.(uint32)\n\t\tcase uint64:\n\t\t\treturn x.(uint64) >= y.(uint64)\n\t\tcase uintptr:\n\t\t\treturn x.(uintptr) >= y.(uintptr)\n\t\tcase float32:\n\t\t\treturn x.(float32) >= y.(float32)\n\t\tcase float64:\n\t\t\treturn x.(float64) >= y.(float64)\n\t\tcase string:\n\t\t\treturn x.(string) >= y.(string)\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\"invalid binary op: %T %s %T\", x, op, y))\n}", "title": "" }, { "docid": "099b7b510241311859960a6c60fc3f1d", "score": "0.5032734", "text": "func NewBitwiseOrOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"|\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: integerBinaryAnalyzer,\n\t\tt: integerBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn float64(int64(a) | int64(b))\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1f6f39a81a086f1e9f10fbdc23bd0643", "score": "0.50281066", "text": "func operation(n1 float32, n2 float32, op string) float32 {\n var result float32\n if op == \"+\" {\n result = n1 + n2\n } else if op == \"-\" {\n result = n1 - n2\n } else if op == \"*\" {\n result = n1 * n2\n } else if op == \"/\" {\n result = n1 / n2\n }\n return result\n}", "title": "" }, { "docid": "85a9746e6974691f31b4bfffce1feab2", "score": "0.50207555", "text": "func (pm *PickleMachine) opcode_BININT2() error {\n\tvar v uint16\n\terr := pm.readBinaryInto(&v, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpm.push(int64(v))\n\treturn nil\n\n}", "title": "" }, { "docid": "f35c51c5bc7227e56cfcaadffb77867c", "score": "0.4989649", "text": "func ConvertOp(irOp string) (asmOp string) {\n\tswitch irOp {\n\tcase tac.OR:\n\t\tasmOp = \"or\"\n\tcase tac.AND:\n\t\tasmOp = \"and\"\n\tcase tac.NOR:\n\t\tasmOp = \"nor\"\n\tcase tac.XOR:\n\t\tasmOp = \"xor\"\n\tcase tac.MUL:\n\t\tasmOp = \"mul\"\n\tcase tac.DIV:\n\t\tasmOp = \"div\"\n\tcase tac.SUB:\n\t\tasmOp = \"sub\"\n\tcase tac.REM:\n\t\tasmOp = \"rem\"\n\tcase tac.RST:\n\t\tasmOp = \"srl\"\n\tcase tac.LST:\n\t\tasmOp = \"sll\"\n\tcase tac.BEQ:\n\t\tasmOp = \"beq\"\n\tcase tac.BNE:\n\t\tasmOp = \"bne\"\n\tcase tac.BGT:\n\t\tasmOp = \"bgt\"\n\tcase tac.BGE:\n\t\tasmOp = \"bge\"\n\tcase tac.BLT:\n\t\tasmOp = \"blt\"\n\tcase tac.BLE:\n\t\tasmOp = \"ble\"\n\t}\n\treturn asmOp\n}", "title": "" }, { "docid": "b7c2893abcd522c79cada45ba8522de3", "score": "0.49836698", "text": "func NewMinusOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"-\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: defaultBinaryAnalyzer,\n\t\tt: defaultBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn a - b\n\t\t},\n\t}\n}", "title": "" }, { "docid": "f10390ae8628cc277b001ccc87e3d1d6", "score": "0.4976963", "text": "func (df *DataFrame) Binary(op syntax.Token, y starlark.Value, side starlark.Side) (starlark.Value, error) {\n\t// Currently only handle addition, where this DataFrame is the left-hand-side\n\tif op != syntax.PLUS {\n\t\treturn nil, nil\n\t}\n\tif side {\n\t\treturn nil, fmt.Errorf(\"TODO(dustmop): implement DataFrame as rhs of binary +\")\n\t}\n\n\t// The right-hand-side is either a DataFrame, or can be used to construct one\n\tother, ok := y.(*DataFrame)\n\tif !ok {\n\t\tvar err error\n\t\tother, err = NewDataFrame(y, nil, nil, df.outconf)\n\t\tif err != nil {\n\t\t\treturn starlark.None, err\n\t\t}\n\t}\n\n\treturn addTwoDataframes(df, other, df.columns)\n}", "title": "" }, { "docid": "b34082fd673542ca90623e9a25c16038", "score": "0.49563935", "text": "func lexOperator(n byte, l *lexer) (lexemeType, statefn, error) {\n\tswitch n {\n\tcase ')':\n\t\tif !l.denest() {\n\t\t\treturn 0, nil, errors.New(\"unexpected closing parenthesis: no corresponding opening parenthesis\")\n\t\t}\n\t\treturn ltCloseParen, lexOperator, nil\n\tcase andSym, orSym, xorSym, condSym, bicondSym:\n\t\tl.allowEOF = false\n\t\treturn ltOperator, lexStatement, nil\n\t}\n\treturn 0, nil, fmt.Errorf(\"unexpected char '%c'; expected ')', '%c', '%c', '%c', '%c', or '%c'\",\n\t\tn, andSym, orSym, xorSym, condSym, bicondSym)\n}", "title": "" }, { "docid": "9c326ac968686ddc49c373179526e214", "score": "0.49367863", "text": "func (p *Parse) op8() AST {\n\tvar left = p.op7()\n\tfor p.token[p.pos].Type == TokenOr {\n\t\tleft = ASTBinaryOp{\n\t\t\tleft: left,\n\t\t\top: p.mustEat(TokenOr),\n\t\t\tright: p.op7(),\n\t\t}\n\t}\n\treturn left\n}", "title": "" }, { "docid": "9e52244566db2b6c10e046beb923b46d", "score": "0.4902089", "text": "func (p *Parser) AddOp() {\n\tnext := p.NextToken()\n\n\tswitch next {\n\tcase PlusOp:\n\t\tp.currState = strings.Replace(p.currState, \"<add op>\", \"PlusOp\", 1)\n\t\tfmt.Println(p.currState)\n\n\t\tp.Match(PlusOp)\n\t\tbreak\n\n\tcase MinusOp:\n\t\tp.currState = strings.Replace(p.currState, \"<add op>\", \"MinusOp\", 1)\n\t\tfmt.Println(p.currState)\n\n\t\tp.Match(MinusOp)\n\t\tbreak\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Syntax error when reading %v\\n\", next))\n\t\tbreak\n\t}\n}", "title": "" }, { "docid": "36c221408123882de06102a700d3da23", "score": "0.48932573", "text": "func TestParser_ParseExpr(t *testing.T) {\n\tvar tests = []struct {\n\t\ts string\n\t\texpr Expr\n\t\terr string\n\t}{\n\t\t// Primitives\n\t\t{s: `100.0`, expr: &NumberLiteral{Val: 100}},\n\t\t{s: `100`, expr: &IntegerLiteral{Val: 100}},\n\t\t{s: `9223372036854775808`, expr: &UnsignedLiteral{Val: 9223372036854775808}},\n\t\t{s: `-9223372036854775808`, expr: &IntegerLiteral{Val: -9223372036854775808}},\n\t\t{s: `-9223372036854775809`, err: `constant -9223372036854775809 underflows int64`},\n\t\t{s: `-100.0`, expr: &NumberLiteral{Val: -100}},\n\t\t{s: `-100`, expr: &IntegerLiteral{Val: -100}},\n\t\t{s: `100.`, expr: &NumberLiteral{Val: 100}},\n\t\t{s: `-100.`, expr: &NumberLiteral{Val: -100}},\n\t\t{s: `.23`, expr: &NumberLiteral{Val: 0.23}},\n\t\t{s: `-.23`, expr: &NumberLiteral{Val: -0.23}},\n\t\t{s: `-+1`, err: `found +, expected identifier, number, duration, ( at line 1, char 2`},\n\t\t{s: `'foo bar'`, expr: &StringLiteral{Val: \"foo bar\"}},\n\t\t{s: `true`, expr: &BooleanLiteral{Val: true}},\n\t\t{s: `false`, expr: &BooleanLiteral{Val: false}},\n\t\t{s: `my_ident`, expr: &VarRef{Val: \"my_ident\"}},\n\t\t{s: `'2000-01-01 00:00:00'`, expr: &StringLiteral{Val: \"2000-01-01 00:00:00\"}},\n\t\t{s: `'2000-01-01'`, expr: &StringLiteral{Val: \"2000-01-01\"}},\n\n\t\t// Simple binary expression\n\t\t{\n\t\t\ts: `1 + 2`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with LHS precedence\n\t\t{\n\t\t\ts: `1 * 2 + 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: MUL,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with RHS precedence\n\t\t{\n\t\t\ts: `1 + 2 * 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\tRHS: &BinaryExpr{\n\t\t\t\t\tOp: MUL,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with LHS precedence\n\t\t{\n\t\t\ts: `1 / 2 + 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: DIV,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with RHS precedence\n\t\t{\n\t\t\ts: `1 + 2 / 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\tRHS: &BinaryExpr{\n\t\t\t\t\tOp: DIV,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with LHS precedence\n\t\t{\n\t\t\ts: `1 % 2 + 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: MOD,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with RHS precedence\n\t\t{\n\t\t\ts: `1 + 2 % 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: ADD,\n\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\tRHS: &BinaryExpr{\n\t\t\t\t\tOp: MOD,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with LHS paren group.\n\t\t{\n\t\t\ts: `(1 + 2) * 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &ParenExpr{\n\t\t\t\t\tExpr: &BinaryExpr{\n\t\t\t\t\t\tOp: ADD,\n\t\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with no precedence, tests left associativity.\n\t\t{\n\t\t\ts: `1 * 2 * 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: MUL,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Addition and subtraction without whitespace.\n\t\t{\n\t\t\ts: `1+2-3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: SUB,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: ADD,\n\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Simple unary expression.\n\t\t{\n\t\t\ts: `-value`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &IntegerLiteral{Val: -1},\n\t\t\t\tRHS: &VarRef{Val: \"value\"},\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\ts: `-mean(value)`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &IntegerLiteral{Val: -1},\n\t\t\t\tRHS: &Call{\n\t\t\t\t\tCmd: \"mean\",\n\t\t\t\t\tArgs: []Expr{\n\t\t\t\t\t\t&VarRef{Val: \"value\"}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Unary expressions with parenthesis.\n\t\t{\n\t\t\ts: `-(-4)`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &IntegerLiteral{Val: -1},\n\t\t\t\tRHS: &ParenExpr{\n\t\t\t\t\tExpr: &IntegerLiteral{Val: -4},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t// Multiplication with leading subtraction.\n\t\t{\n\t\t\ts: `-2 * 3`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: MUL,\n\t\t\t\tLHS: &IntegerLiteral{Val: -2},\n\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with regex.\n\t\t{\n\t\t\ts: `region =~ /us.*/`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: EQREGEX,\n\t\t\t\tLHS: &VarRef{Val: \"region\"},\n\t\t\t\tRHS: &RegexLiteral{Val: regexp.MustCompile(`us.*`)},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with quoted '/' regex.\n\t\t{\n\t\t\ts: `url =~ /http\\:\\/\\/www\\.example\\.com/`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: EQREGEX,\n\t\t\t\tLHS: &VarRef{Val: \"url\"},\n\t\t\t\tRHS: &RegexLiteral{Val: regexp.MustCompile(`http\\://www\\.example\\.com`)},\n\t\t\t},\n\t\t},\n\n\t\t// Binary expression with quoted '/' regex, no space around operator\n\t\t{\n\t\t\ts: `url=~/http\\:\\/\\/www\\.example\\.com/`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: EQREGEX,\n\t\t\t\tLHS: &VarRef{Val: \"url\"},\n\t\t\t\tRHS: &RegexLiteral{Val: regexp.MustCompile(`http\\://www\\.example\\.com`)},\n\t\t\t},\n\t\t},\n\n\t\t// Complex binary expression.\n\t\t{\n\t\t\ts: `value + 3 < 30 AND 1 + 2 OR true`,\n\t\t\texpr: &BinaryExpr{\n\t\t\t\tOp: OR,\n\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\tOp: AND,\n\t\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\t\tOp: LT,\n\t\t\t\t\t\tLHS: &BinaryExpr{\n\t\t\t\t\t\t\tOp: ADD,\n\t\t\t\t\t\t\tLHS: &VarRef{Val: \"value\"},\n\t\t\t\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRHS: &IntegerLiteral{Val: 30},\n\t\t\t\t\t},\n\t\t\t\t\tRHS: &BinaryExpr{\n\t\t\t\t\t\tOp: ADD,\n\t\t\t\t\t\tLHS: &IntegerLiteral{Val: 1},\n\t\t\t\t\t\tRHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tRHS: &BooleanLiteral{Val: true},\n\t\t\t},\n\t\t},\n\n\t\t// Function call (empty)\n\t\t{\n\t\t\ts: `my_func()`,\n\t\t\texpr: &Call{\n\t\t\t\tCmd: \"my_func\",\n\t\t\t},\n\t\t},\n\n\t\t// Function call (multi-arg)\n\t\t{\n\t\t\ts: `my_func(1, 2 + 3)`,\n\t\t\texpr: &Call{\n\t\t\t\tCmd: \"my_func\",\n\t\t\t\tArgs: []Expr{\n\t\t\t\t\t&IntegerLiteral{Val: 1},\n\t\t\t\t\t&BinaryExpr{\n\t\t\t\t\t\tOp: ADD,\n\t\t\t\t\t\tLHS: &IntegerLiteral{Val: 2},\n\t\t\t\t\t\tRHS: &IntegerLiteral{Val: 3},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tfor i, tt := range tests {\n\t\texpr, err := NewParser(strings.NewReader(tt.s)).ParseExpr()\n\t\tif !reflect.DeepEqual(tt.err, errstring(err)) {\n\t\t\tt.Errorf(\"%d. %q: error mismatch:\\n exp=%s\\n got=%s\\n\\n\",\n\t\t\t\ti, tt.s, tt.err, err)\n\t\t} else if tt.err == \"\" && !reflect.DeepEqual(tt.expr, expr) {\n\t\t\tt.Errorf(\"%d. %q\\n\\nexpr mismatch:\\n\\nexp=%#v\\n\\ngot=%#v\\n\\n\",\n\t\t\t\ti, tt.s, tt.expr, expr)\n\t\t} else if err == nil {\n\t\t\t// Attempt to reparse the expr as a string and confirm it parses\n\t\t\t// the same.\n\t\t\texpr2, err := ParseExpr(expr.String())\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"%d. %q: unable to parse expr string: %s\",\n\t\t\t\t\ti, expr.String(), err)\n\t\t\t} else if !reflect.DeepEqual(tt.expr, expr2) {\n\t\t\t\tt.Logf(\"\\n# %s\\nexp=%s\\ngot=%s\\n\",\n\t\t\t\t\ttt.s, mustMarshalJSON(tt.expr), mustMarshalJSON(expr2))\n\t\t\t\tt.Logf(\"\\nSQL exp=%s\\nSQL got=%s\\n\",\n\t\t\t\t\ttt.expr.String(), expr2.String())\n\t\t\t\tt.Errorf(\"%d. %q\\n\\nexpr reparse mismatch:\\n\\nexp=%#v\\n\\ngot=%#v\\n\\n\",\n\t\t\t\t\ti, tt.s, tt.expr, expr2)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "77141b885107661ae73914b923ce21ff", "score": "0.48794758", "text": "func (v *ASTBuilder) VisitBinaryLiteral(ctx *antlrgen.BinaryLiteralContext) interface{} {\n\treturn v.VisitChildren(ctx)\n}", "title": "" }, { "docid": "796294c2a636c08b628e22cbe38314ea", "score": "0.4822384", "text": "func (p *Parse) op2() AST {\n\tvar left = p.op1()\n\tfor p.token[p.pos].Type == TokenAs {\n\t\tleft = ASTBinaryOp{\n\t\t\tleft: left,\n\t\t\top: p.mustEat(TokenAs),\n\t\t\tright: p.op1(),\n\t\t}\n\t}\n\treturn left\n}", "title": "" }, { "docid": "18649ab907222e347022f0d1169e6fda", "score": "0.47922432", "text": "func (p *PSParser) parseOperand() (*PSOperand, error) {\n\tvar bytes []byte\n\tfor {\n\t\tbb, err := p.reader.Peek(1)\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 nil, err\n\t\t}\n\t\tif pdfcore.IsDelimiter(bb[0]) {\n\t\t\tbreak\n\t\t}\n\t\tif pdfcore.IsWhiteSpace(bb[0]) {\n\t\t\tbreak\n\t\t}\n\n\t\tb, _ := p.reader.ReadByte()\n\t\tbytes = append(bytes, b)\n\t}\n\n\tif len(bytes) == 0 {\n\t\treturn nil, errors.New(\"invalid operand (empty)\")\n\t}\n\n\treturn MakeOperand(string(bytes)), nil\n}", "title": "" }, { "docid": "4b608caf9b3d68c23a885d2af34d7de1", "score": "0.47864482", "text": "func (x *yyLex) readOperator() int {\n\t// Look for length 3, 2, 1 operators\n\tfor i := 3; i >= 1; i-- {\n\t\tif len(x.line) >= i {\n\t\t\top := x.line[:i]\n\t\t\tif tok, ok := operators[op]; ok {\n\t\t\t\tx.cut(i)\n\t\t\t\treturn tok\n\t\t\t}\n\t\t}\n\t}\n\treturn eof\n}", "title": "" }, { "docid": "7ab6f15150502ad1a5cb371febd5f81d", "score": "0.47791314", "text": "func NewModOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"%\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: integerBinaryAnalyzer,\n\t\tt: integerBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn float64(int64(a) % int64(b))\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ad493eac8368f621ff21388efe6dfe8e", "score": "0.47776788", "text": "func parseExpressionInfix(ts *tokenStream) AstNode {\n\toutStack := []AstNode{}\n\topStack := []token{}\n\n\toutpop := func() AstNode {\n\t\tr := outStack[len(outStack)-1]\n\t\toutStack = outStack[:len(outStack)-1]\n\t\treturn r\n\t}\n\n\toppop := func() {\n\t\top := opStack[len(opStack)-1]\n\t\topStack = opStack[:len(opStack)-1]\n\t\tright := outpop()\n\t\tleft := outpop()\n\t\toutStack = append(outStack, NewBinOpNode(op, left, right))\n\t}\n\n\tfor {\n\t\toutStack = append(outStack, parseExpressionNoinfix(ts))\n\n\t\ttokop := ts.get()\n\t\tif tokop.ttype == EOFTOK || tokop.ttype == PARCLTOK || tokop.ttype == SCOLTOK || tokop.ttype == COMMATOK {\n\t\t\tts.rewind(tokop)\n\t\t\tbreak\n\t\t}\n\n\t\tif tokop.ttype.Priority < 0 {\n\t\t\tunexpectedToken(tokop, \"expecting operator\")\n\t\t}\n\n\t\tfor {\n\t\t\tif len(opStack) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tprevop := opStack[len(opStack)-1]\n\t\t\tif tokop.ttype.Priority > prevop.ttype.Priority {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// if tokop is right associative break when tokop.ttype.Priority >= prevop.ttype.Priority\n\t\t\toppop()\n\t\t}\n\n\t\topStack = append(opStack, tokop)\n\t}\n\n\tfor len(opStack) > 0 {\n\t\toppop()\n\t}\n\n\tif len(outStack) != 1 {\n\t\tpanic(fmt.Errorf(\"could not parse\"))\n\t}\n\n\treturn outStack[0]\n}", "title": "" }, { "docid": "40df2f1f9e42903055b5d8574ae1fbb3", "score": "0.47702438", "text": "func (pm *PickleMachine) opcode_BINSTRING() error {\n\tvar strlen int32\n\terr := pm.readBinaryInto(&strlen, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif strlen < 0 {\n\t\treturn fmt.Errorf(\"BINSTRING specified negative string length of %d\", strlen)\n\t}\n\n\tstr, err := pm.readFixedLengthString(int64(strlen))\n\tif err != nil {\n\t\treturn err\n\t}\n\tpm.push(str)\n\treturn nil\n}", "title": "" }, { "docid": "2a931e234908064f07b24c5f7098f4d0", "score": "0.47391585", "text": "func NewPowOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"^\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: defaultBinaryAnalyzer,\n\t\tt: defaultBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn math.Pow(a, b)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2fa40874fc7044a87e388a2116b8c801", "score": "0.47218257", "text": "func (p *parser) parseArithExpr() expr {\n\n\tn := p.readNumberLiteral()\n\tp.skipWhitespaces()\n\tch := p.peekCh()\n\tswitch ch {\n\tcase '+', '-', '*', '/':\n\t\tp.idx++\n\t\tn2 := p.readNumberLiteral()\n\t\treturn &binaryExpr{\n\t\t\top: string(ch),\n\t\t\tleft: n,\n\t\t\tright: n2,\n\t\t}\n\tdefault:\n\t\t// number literal\n\t\treturn n\n\t}\n}", "title": "" }, { "docid": "4c7af92f2968f7280f7cc7819fe2a062", "score": "0.47162473", "text": "func Binary(s string) (*big.Int, bool) {\n\treturn new(big.Int).SetString(stripliteral(s), 2)\n}", "title": "" }, { "docid": "ea7f8d3a1ea5f15f824ade005f41610e", "score": "0.47132325", "text": "func ParseInstruction(raw []byte) (ins *Instruction, err error) {\n\tvar (\n\t\tcursor int\n\t\telements []string\n\t)\n\n\tbytes := len(raw)\n\tfor cursor < bytes {\n\t\t// 1. parse digit\n\t\tlengthEnd := -1\n\t\tfor i := cursor; i < bytes; i++ {\n\t\t\tif raw[i]^'.' == 0 {\n\t\t\t\tlengthEnd = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif lengthEnd == -1 { // cannot find '.'\n\t\t\treturn nil, ErrInstructionMissDot\n\t\t}\n\t\tlength, err := strconv.Atoi(string(raw[cursor:lengthEnd]))\n\t\tif err != nil {\n\t\t\treturn nil, ErrInstructionBadDigit\n\t\t}\n\n\t\t// 2. parse rune\n\t\tcursor = lengthEnd + 1\n\t\telement := new(strings.Builder)\n\t\tfor i := 1; i <= length; i++ {\n\t\t\tr, n := utf8.DecodeRune(raw[cursor:])\n\t\t\tif r == utf8.RuneError {\n\t\t\t\treturn nil, ErrInstructionBadRune\n\t\t\t}\n\t\t\tcursor += n\n\t\t\telement.WriteRune(r)\n\t\t}\n\t\telements = append(elements, element.String())\n\n\t\t// 3. done\n\t\tif cursor == bytes-1 {\n\t\t\tbreak\n\t\t}\n\n\t\t// 4. parse next\n\t\tif raw[cursor]^',' != 0 {\n\t\t\treturn nil, ErrInstructionMissComma\n\t\t}\n\n\t\tcursor++\n\t}\n\n\t//noinspection ALL\n\treturn NewInstruction(elements[0], elements[1:]...), nil\n}", "title": "" }, { "docid": "28ba37a7b105e7ed2fb4b5d20a522944", "score": "0.47046095", "text": "func (p *parser) parseOctal(b []byte) int64{\n\t// trim left pad and tail pad of space and null value\n\tb = bytes.Trim(b,\" \\x00\")\n\tif len(b) == 0{\n\t\treturn 0\n\t}\n\tu ,uErr := strconv.ParseUint(p.parseString(b),8,64)\n\tif uErr != nil {\n\t\tp.err = ErrHeader\n\t}\n\treturn int64(u)\n}", "title": "" }, { "docid": "eeb56ec26468b97f00fbb955976f4280", "score": "0.46950883", "text": "func (v *ASTBuilder) VisitArithmeticBinary(ctx *antlrgen.ArithmeticBinaryContext) interface{} {\n\treturn v.VisitChildren(ctx)\n}", "title": "" }, { "docid": "08f8a68c280c86e4fe552058cc25337d", "score": "0.46932477", "text": "func (vm *VM) executeBinaryIntegerOperation(\n\top code.Opcode,\n\tleft, right object.Object,\n) error {\n\tleftValue := left.(*object.Integer).Value\n\trightValue := right.(*object.Integer).Value\n\n\tvar result int64\n\n\tswitch op {\n\tcase code.OpAdd:\n\t\tresult = leftValue + rightValue\n\tcase code.OpSub:\n\t\tresult = leftValue - rightValue\n\tcase code.OpMul:\n\t\tresult = leftValue * rightValue\n\tcase code.OpDiv:\n\t\tresult = leftValue / rightValue\n\t}\n\n\treturn vm.push(&object.Integer{Value: result})\n}", "title": "" }, { "docid": "87fa00013f9a96d816f8e81e86d7b998", "score": "0.46812", "text": "func (p *parser) parseNumeric(b []byte) int64{\n\t// Check for base-256 (binary) format first.\n\t// If the first bit is set, then all following bits constitute a two's\n\t// complement encoded number in big-endian byte order.\n\tif len(b) > 0 && b[0]&0x80 != 0 {\n\t\tp.parseBase256(b)\n\t}\n\treturn p.parseOctal(b)\n}", "title": "" }, { "docid": "9ec29aa0647cb7656ffad458a1b81bb1", "score": "0.46713132", "text": "func (j *Jit) BinaryExpr(e *Expr, op token.Token, xe *Expr, ye *Expr) *Expr {\n\treturn e\n}", "title": "" }, { "docid": "2d4a24ac41ceec391da0e3ce25c6411a", "score": "0.4653036", "text": "func (p *Parse) op3() AST {\n\tvar left = p.op2()\n\tfor p.token[p.pos].Type == TokenMul || p.token[p.pos].Type == TokenDiv {\n\t\tleft = ASTBinaryOp{\n\t\t\tleft: left,\n\t\t\top: p.mustEat(p.token[p.pos].Type),\n\t\t\tright: p.op2(),\n\t\t}\n\t}\n\treturn left\n}", "title": "" }, { "docid": "4e25dadf56002d0b7d528ed3b4a1dfd4", "score": "0.46475115", "text": "func AddOp(bin *Bin) *Operation {\n\treturn &Operation{OpType: ADD, BinName: bin.Name, BinValue: bin.Value}\n}", "title": "" }, { "docid": "d5c02bd3fa334f8ada2adca0af8ddc4c", "score": "0.46304253", "text": "func EvaluateRPNExpression(exp string) (int, error) {\n\ttokens := strings.Split(exp, \",\")\n\tstack := new(stack)\n\n\t// either two values,\n\t// two operators,\n\t// one value, one operator,\n\t// which is an invalid expression.\n\tif len(tokens) < 2 {\n\t\treturn 0, ErrInvalidExpression\n\t}\n\n\tfor i := 0; i < 2; i++ {\n\t\tval, err := strconv.Atoi(tokens[i])\n\t\tif err != nil {\n\t\t\treturn 0, ErrExpectedInteger\n\t\t}\n\t\tstack.Push(val)\n\t}\n\ttokens = tokens[2:]\n\n\tfor i, token := range tokens {\n\t\tif callback, ok := operatorCallbacks[token]; ok {\n\t\t\tif stack.Size() < 2 {\n\t\t\t\treturn 0, ErrInvalidExpression\n\t\t\t}\n\t\t\tleft := stack.Pop().(int)\n\t\t\tright := stack.Pop().(int)\n\t\t\tstack.Push(callback(left, right))\n\t\t} else {\n\t\t\tval, err := strconv.Atoi(tokens[i])\n\t\t\tif err != nil {\n\t\t\t\treturn 0, ErrExpectedInteger\n\t\t\t}\n\t\t\tstack.Push(val)\n\t\t}\n\t}\n\tif stack.Size() != 1 {\n\t\treturn 0, ErrInvalidExpression\n\t}\n\tresult := stack.Pop().(int)\n\n\treturn result, nil\n}", "title": "" }, { "docid": "030e9757acd0928f2d9b9ec96578affe", "score": "0.45925507", "text": "func TrimOp(pack string) string {\n\tvar (\n\t\tname []int\n\t\tversion []int\n\t)\n\tvar prefix = true\n\tfor _, c := range pack {\n\t\tswitch c {\n\t\tcase '<', '>', '=', '[', ']', '*', '.':\n\t\t\tversion = append(version, c)\n\t\t\tprefix = false\n\t\tcase '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\t\tif prefix {\n\t\t\t\tname = append(name, c)\n\t\t\t} else {\n\t\t\t\tversion = append(version, c)\n\t\t\t}\n\t\tdefault:\n\t\t\tname = append(name, c)\n\t\t}\n\t}\n\treturn string(name)\n}", "title": "" }, { "docid": "09d302eefc68883558fc0e4d82474d56", "score": "0.45896143", "text": "func parseCompoundCommand(s *State, t *tokenizer) {\n\n}", "title": "" }, { "docid": "540b767ac14d254e7897f9bc6ff59bff", "score": "0.4583825", "text": "func (p *Parser) Parse(tokenList []*lexer.Token) (ast.Node, error) {\n\texpect := operandToken\n\toutput := make([]ast.Node, 0)\n\topStack := make([]*lexer.Token, 0)\n\tvar err error\n\n\tif tokenList, err = normalizeTokenList(tokenList); err != nil {\n\t\treturn nil, err\n\t}\n\ntokenLoop:\n\tfor i := 0; i < len(tokenList); i++ {\n\t\tcurToken := tokenList[i]\n\n\t\tswitch curToken.Type() {\n\t\tcase lexer.Number:\n\t\t\texpect, output, err = p.handleNumber(expect, curToken, output)\n\n\t\tcase lexer.Identifier:\n\t\t\texpect, opStack, output, err = p.handleIdentifier(expect, curToken, tokenList[i+1], opStack, output)\n\n\t\tcase lexer.UnaryAddition, lexer.UnarySubstraction, lexer.Addition, lexer.Substraction:\n\t\t\t// If the received token is Addition or Substraction and we expect operand, it is probably unary operator\n\t\t\tif expect == operandToken {\n\t\t\t\topStack, err = p.handleUnary(curToken, opStack)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// If operator is expected, fallthrough to handle operator\n\t\t\tfallthrough\n\t\tcase lexer.Exponent, lexer.Multiplication, lexer.Division, lexer.FloorDiv, lexer.Modulus:\n\t\t\texpect, opStack, output, err = p.handleOperator(expect, curToken, opStack, output)\n\n\t\tcase lexer.LPar:\n\t\t\texpect, opStack, err = p.handleLPar(expect, curToken, opStack)\n\n\t\tcase lexer.RPar:\n\t\t\texpect, opStack, output, err = p.handleRPar(expect, curToken, opStack, output)\n\n\t\tcase lexer.EOL:\n\t\t\tif expect == operandToken {\n\t\t\t\treturn nil, parser.ParseError(curToken, ErrUnexpectedEOL)\n\t\t\t}\n\t\t\tbreak tokenLoop\n\t\tdefault:\n\t\t\treturn nil, parser.ParseError(curToken, ErrUnsupportedToken)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn p.clearOpStack(opStack, output)\n}", "title": "" }, { "docid": "f059febfdb635dfa91ad2d20441472bc", "score": "0.4555661", "text": "func ParseOctal(o string) (d int64, e error) {\n\tl := float64(len(o) - 1)\n\teight := float64(8)\n\tfor _, i := range o {\n\t\tif !isOctal(i) {\n\t\t\treturn 0, errors.New(\"The string is not valid octal\")\n\t\t}\n\t\td += int64(i-'0') * int64(math.Pow(eight, l))\n\t\tl--\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "3c54414dd69239797b826694b5acfd24", "score": "0.4551081", "text": "func CreateUntypedExprFromBinaryExpr(ctx *Context, n *ast.BinaryExpr) ast.Expr {\n\tcreateFuncOp := func(opName string, x ast.Expr, y ast.Expr) *ast.CallExpr {\n\t\treturn &ast.CallExpr{\n\t\t\tFun: &ast.SelectorExpr{X: ctx.TranslatedassertImport, Sel: &ast.Ident{Name: \"Op\"}},\n\t\t\tArgs: []ast.Expr{CreateRawStringLit(opName), x, y},\n\t\t}\n\t}\n\tcreateFuncOpShift := func(opName string, x ast.Expr, y ast.Expr) *ast.CallExpr {\n\t\treturn &ast.CallExpr{\n\t\t\tFun: &ast.SelectorExpr{X: ctx.TranslatedassertImport, Sel: &ast.Ident{Name: \"OpShift\"}},\n\t\t\tArgs: []ast.Expr{CreateRawStringLit(opName), x, y},\n\t\t}\n\t}\n\n\t// http://golang.org/ref/spec#Operators_and_Delimiters\n\t// + sum integers, floats, complex values, strings\n\t// - difference integers, floats, complex values\n\t// * product integers, floats, complex values\n\t// / quotient integers, floats, complex values\n\t// % remainder integers\n\n\t// & bitwise AND integers\n\t// | bitwise OR integers\n\t// ^ bitwise XOR integers\n\t// &^ bit clear (AND NOT) integers\n\n\t// << left shift integer << unsigned integer\n\t// >> right shift integer >> unsigned integer\n\n\t// http://golang.org/ref/spec#Logical_operators\n\t// Logical operators apply to boolean values and yield a result of the same type as the operands. The right operand is evaluated conditionally.\n\n\t// && conditional AND p && q is \"if p then q else false\"\n\t// || conditional OR p || q is \"if p then true else q\"\n\tswitch n.Op {\n\tcase token.ADD: // +\n\t\treturn createFuncOp(\"ADD\", n.X, n.Y)\n\tcase token.SUB: // -\n\t\treturn createFuncOp(\"SUB\", n.X, n.Y)\n\tcase token.MUL: // *\n\t\treturn createFuncOp(\"MUL\", n.X, n.Y)\n\tcase token.QUO: // /\n\t\treturn createFuncOp(\"QUO\", n.X, n.Y)\n\tcase token.REM: // %\n\t\treturn createFuncOp(\"REM\", n.X, n.Y)\n\tcase token.AND: // &\n\t\treturn createFuncOp(\"AND\", n.X, n.Y)\n\tcase token.OR: // |\n\t\treturn createFuncOp(\"OR\", n.X, n.Y)\n\tcase token.XOR: // ^\n\t\treturn createFuncOp(\"XOR\", n.X, n.Y)\n\tcase token.AND_NOT: // &^\n\t\treturn createFuncOp(\"ANDNOT\", n.X, n.Y)\n\tcase token.SHL: // <<\n\t\treturn createFuncOpShift(\"SHL\", n.X, n.Y)\n\tcase token.SHR: // >>\n\t\treturn createFuncOpShift(\"SHR\", n.X, n.Y)\n\tcase token.LAND: // &&\n\t\treturn createFuncOp(\"LAND\", n.X, n.Y)\n\tcase token.LOR: // ||\n\t\treturn createFuncOp(\"LOR\", n.X, n.Y)\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "80c09e4dd292caf89b9251a99cb99b72", "score": "0.45381352", "text": "func NewBinaryExpression(left Expression, op TokenType, right Expression) *BinaryExpression {\n\treturn &BinaryExpression{\n\t\tleft: left,\n\t\top: op,\n\t\tright: right,\n\t}\n}", "title": "" }, { "docid": "bf61998e8fdf3cb1761a0e95cbaf7eb7", "score": "0.4537332", "text": "func (a *Assertion) IntegerBinary(value string, msgArgs ...interface{}) bool {\n\tif _, err := strconv.ParseInt(value, 2, 64); err == nil {\n\t\treturn true\n\t}\n\n\ta.addErrorMsg(fmt.Sprintf(errMsgNotValid, value, \"base-2 integer\"), msgArgs...)\n\treturn false\n}", "title": "" }, { "docid": "0216ffe3903d4a24a6f25040b579f2e7", "score": "0.4528415", "text": "func (s *BaseCQLParserListener) EnterBinaryComparisonPredicate(ctx *BinaryComparisonPredicateContext) {\n}", "title": "" }, { "docid": "1c0b62ff3c25830cc2847421797c94bc", "score": "0.45260116", "text": "func BinVal(s []byte) operators.Alternatives {\n\treturn operators.Concat(\n\t\t\"bin-val\",\n\t\toperators.String(\"b\", \"b\"),\n\t\toperators.Repeat1Inf(\"1*BIT\", core.BIT()),\n\t\toperators.Optional(\"[ 1*(\\\".\\\" 1*BIT) / (\\\"-\\\" 1*BIT) ]\", operators.Alts(\n\t\t\t\"1*(\\\".\\\" 1*BIT) / (\\\"-\\\" 1*BIT)\",\n\t\t\toperators.Repeat1Inf(\"1*(\\\".\\\" 1*BIT)\", operators.Concat(\n\t\t\t\t\"\\\".\\\" 1*BIT\",\n\t\t\t\toperators.String(\".\", \".\"),\n\t\t\t\toperators.Repeat1Inf(\"1*BIT\", core.BIT()),\n\t\t\t)),\n\t\t\toperators.Concat(\n\t\t\t\t\"\\\"-\\\" 1*BIT\",\n\t\t\t\toperators.String(\"-\", \"-\"),\n\t\t\t\toperators.Repeat1Inf(\"1*BIT\", core.BIT()),\n\t\t\t),\n\t\t)),\n\t)(s)\n}", "title": "" }, { "docid": "3a60bfdfaeb1f31e6fb2ee97c2c6f313", "score": "0.45244426", "text": "func checkOperatorValid() token.Token {\n\toperator := \"\"\n\tvar tokens token.Token\n\n\tif isBound() && strings.Contains(operatorChar, peekChar()) {\n\t\toperator += eatChar()\n\t}\n\n\tif len(operator) > 0 {\n\t\ttokens = token.Token{ token.OPERATOR, operator }\n\t\treturn tokens\n\t}\n\n\treturn token.Token{ token.UNKNOWN, operator }\n}", "title": "" }, { "docid": "06b2526c9560731f5de27f86d115bf80", "score": "0.45134982", "text": "func (p *Parser) handleOperator(\n\texpect expectState,\n\tcurToken *lexer.Token,\n\topStack []*lexer.Token,\n\toutput []ast.Node,\n) (expectState, []*lexer.Token, []ast.Node, error) {\n\tif expect == operandToken {\n\t\treturn expect, nil, nil, parser.ParseError(curToken, ErrExpectedOperand)\n\t}\n\tfor len(opStack) > 0 {\n\t\ttopStackEl := opStack[len(opStack)-1]\n\t\t// Continue only, if the operator at the top of the operator stack is not a left parenthesis\n\t\tif topStackEl.Type() == lexer.LPar {\n\t\t\tbreak\n\t\t}\n\t\t// If the operator at the top of the operator stack has greater precedence\n\t\t// OR\n\t\t// The operator at the top of the operator stack has equal precedence and the token is left associative\n\t\tif p.priorities.GetPrecedence(topStackEl.Type()) > p.priorities.GetPrecedence(curToken.Type()) ||\n\t\t\t(p.priorities.GetPrecedence(topStackEl.Type()) == p.priorities.GetPrecedence(curToken.Type()) &&\n\t\t\t\tp.priorities.GetAssociativity(curToken.Type()) == parser.LeftAssociativity) {\n\t\t\tvar err error\n\t\t\toutput, err = p.addToOutput(output, topStackEl)\n\t\t\tif err != nil {\n\t\t\t\treturn expect, nil, nil, err\n\t\t\t}\n\t\t\topStack = opStack[:len(opStack)-1]\n\t\t\tcontinue\n\t\t}\n\t\t// If no operation was done, exit loop\n\t\tbreak\n\t}\n\topStack = append(opStack, curToken)\n\texpect = operandToken\n\n\treturn expect, opStack, output, nil\n}", "title": "" }, { "docid": "c7455a29913853219a810f170348753d", "score": "0.45113227", "text": "func assertBinop(t *testing.T, s string) *BinopTree {\n\ttree := assertParses(t, s)\n\tbt, ok := tree.(*BinopTree)\n\tassert.True(t, ok)\n\treturn bt\n}", "title": "" }, { "docid": "c50481e124d9b538c6e91b1aae61b624", "score": "0.4492228", "text": "func lexOperator(l *lexer.L) lexer.StateFunc {\n\tl.Next()\n\n\tfor {\n\t\tcurrent := l.Current()\n\t\tpossibleOp := current + string(l.Peek())\n\n\t\tif _, ok := operators[possibleOp]; !ok {\n\t\t\t// 2.10.1 - Rule 1\n\t\t\tl.Emit(operators[current])\n\n\t\t\treturn l.StateRecord.Pop()\n\t\t}\n\n\t\tl.Next()\n\t}\n}", "title": "" }, { "docid": "66aeff650e59860c892dcdba8cf5af52", "score": "0.44899598", "text": "func parseShortForm(script string) ([]byte, error) {\n\t// Only create the short form opcode map once.\n\tif shortFormOps == nil {\n\t\tops := make(map[string]byte)\n\t\tfor opcodeName, opcodeValue := range OpcodeByName {\n\t\t\tif strings.Contains(opcodeName, \"OP_UNKNOWN\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tops[opcodeName] = opcodeValue\n\n\t\t\t// The opcodes named OP_# can't have the OP_ prefix\n\t\t\t// stripped or they would conflict with the plain\n\t\t\t// numbers. Also, since OP_FALSE and OP_TRUE are\n\t\t\t// aliases for the OP_0, and OP_1, respectively, they\n\t\t\t// have the same value, so detect those by name and\n\t\t\t// allow them.\n\t\t\tif (opcodeName == \"OP_FALSE\" || opcodeName == \"OP_TRUE\") ||\n\t\t\t\t(opcodeValue != OP_0 && (opcodeValue < OP_1 ||\n\t\t\t\t\topcodeValue > OP_16)) {\n\n\t\t\t\tops[strings.TrimPrefix(opcodeName, \"OP_\")] = opcodeValue\n\t\t\t}\n\t\t}\n\t\tshortFormOps = ops\n\t}\n\n\t// Split only does one separator so convert all \\n and tab into space.\n\tscript = strings.Replace(script, \"\\n\", \" \", -1)\n\tscript = strings.Replace(script, \"\\t\", \" \", -1)\n\ttokens := strings.Split(script, \" \")\n\tbuilder := NewScriptBuilder()\n\n\tfor _, tok := range tokens {\n\t\tif len(tok) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t// if parses as a plain number\n\t\tif num, err := strconv.ParseInt(tok, 10, 64); err == nil {\n\t\t\tbuilder.AddInt64(num)\n\t\t\tcontinue\n\t\t} else if bts, err := parseHex(tok); err == nil {\n\t\t\tbuilder.TstConcatRawScript(bts)\n\t\t} else if len(tok) >= 2 &&\n\t\t\ttok[0] == '\\'' && tok[len(tok)-1] == '\\'' {\n\t\t\tbuilder.AddFullData([]byte(tok[1 : len(tok)-1]))\n\t\t} else if opcode, ok := shortFormOps[tok]; ok {\n\t\t\tbuilder.AddOp(opcode)\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"bad token \\\"%s\\\"\", tok)\n\t\t}\n\n\t}\n\treturn builder.Script()\n}", "title": "" }, { "docid": "e7b4e0d5d46aebbc69e01f0a0d5436ca", "score": "0.44819546", "text": "func getOpCodeParams(input int) ([]int, int) {\nvar opCodeString = strconv.Itoa(input)\nvar opCodeInt int\nvar err error\n\nif input == 3 || input == 4 || input == 99 {\n\topCodeInt = input\n} else {\n\tfor len(opCodeString) < 5 {\n\t\topCodeString = \"0\" + opCodeString\n\t}\n\topCodeInt, err = strconv.Atoi(opCodeString[len(opCodeString)-2:])\n\t\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}\n\noperation := []int{}\n\nswitch opCodeInt {\ncase 1, 2, 5, 6, 7, 8: //ToDo: I think 5 6 7 8 actually go here\nfor i := 0; i < len(opCodeString)-2; i++ {\nnewInt, err := strconv.Atoi(opCodeString[i : i+1])\nif err == nil {\n\toperation = append(operation, newInt)\n}\n}\ncase 3:\nfmt.Println(\"Case 3 GetOpCodeParams!\")\ncase 4:\nfmt.Println(\"Case 4 GetOpCodeParams!\")\ndefault:\nfmt.Print(opCodeInt)\nfmt.Println(\" Default Case GetOpCodeParams!\")\n}\n\nreturn operation, opCodeInt\n}", "title": "" }, { "docid": "5592e01159a04d3a7aac8cbc5a28f264", "score": "0.44803473", "text": "func getOpcode(comparison *sqlparser.ComparisonExpr) (Opcode, error) {\n\tvar opcode Opcode\n\tswitch comparison.Operator {\n\tcase sqlparser.EqualOp:\n\t\topcode = Equal\n\tcase sqlparser.LessThanOp:\n\t\topcode = LessThan\n\tcase sqlparser.LessEqualOp:\n\t\topcode = LessThanEqual\n\tcase sqlparser.GreaterThanOp:\n\t\topcode = GreaterThan\n\tcase sqlparser.GreaterEqualOp:\n\t\topcode = GreaterThanEqual\n\tcase sqlparser.NotEqualOp:\n\t\topcode = NotEqual\n\tdefault:\n\t\treturn -1, fmt.Errorf(\"comparison operator %s not supported\", comparison.Operator.ToString())\n\t}\n\treturn opcode, nil\n}", "title": "" }, { "docid": "2637cb1961ad57e98c46b9efc1544f2c", "score": "0.44754764", "text": "func (o Operators) RunOp2(oper string, a1, a2 float64) (ret float64) {\n\tswitch oper {\n\tcase o[\"PLUS\"].Name:\n\t\tret = a1 + a2\n\tcase o[\"MINUS\"].Name:\n\t\tret = a1 - a2\n\tcase o[\"TIMES\"].Name:\n\t\tret = a1 * a2\n\tcase o[\"DIV\"].Name:\n\t\tret = a1 / a2\n\tcase o[\"MOD\"].Name:\n\t\tret = math.Mod(a1, a2)\n\t\t// These seem to give somewhat dubious results\n\tcase o[\"RSFT\"].Name:\n\t\tret = float64(uint(a1) >> uint(a2))\n\tcase o[\"LSFT\"].Name:\n\t\tret = float64(uint(a1) << uint(a2))\n\tdefault:\n\t\tret = -0xffffffff // A bad pseudo-error\n\t}\n\treturn\n}", "title": "" }, { "docid": "3250988c154f7b475cdbba76b9fa77a7", "score": "0.44695908", "text": "func NewBitwiseXorOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"#\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: integerBinaryAnalyzer,\n\t\tt: integerBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn float64(int64(a) ^ int64(b))\n\t\t},\n\t}\n}", "title": "" }, { "docid": "74e64d239ad6f12d08aa1909ffb6c066", "score": "0.4454263", "text": "func isOperator(r rune) bool {\r\n\treturn r == '+' || r == '-' || r == '*' || r == '/' || r == '=' || r == '>' || r == '<' || r == '~' || r == '|' || r == '^' || r == '&' || r == '%' || r == '!'\r\n}", "title": "" }, { "docid": "c0ff6db6ab68b4663c930830d2ae4c5d", "score": "0.44537377", "text": "func simplify(tm *t.Map, n *a.Expr) (*a.Expr, error) {\n\t// TODO: be rigorous about this, not ad hoc.\n\top, lhs, rhs := parseBinaryOp(n)\n\tif lhs != nil && rhs != nil {\n\t\tif lcv, rcv := lhs.ConstValue(), rhs.ConstValue(); lcv != nil && rcv != nil {\n\t\t\tncv, err := evalConstValueBinaryOp(tm, n, lcv, rcv)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn makeConstValueExpr(tm, ncv)\n\t\t}\n\t}\n\n\tswitch op {\n\tcase t.IDXBinaryPlus:\n\t\t// TODO: more constant folding, so ((x + 1) + 1) becomes (x + 2).\n\n\tcase t.IDXBinaryMinus:\n\t\tif lhs.Eq(rhs) {\n\t\t\treturn zeroExpr, nil\n\t\t}\n\t\tif lOp, lLHS, lRHS := parseBinaryOp(lhs); lOp == t.IDXBinaryPlus {\n\t\t\tif lLHS.Eq(rhs) {\n\t\t\t\treturn lRHS, nil\n\t\t\t}\n\t\t\tif lRHS.Eq(rhs) {\n\t\t\t\treturn lLHS, nil\n\t\t\t}\n\t\t}\n\n\tcase t.IDXBinaryNotEq, t.IDXBinaryLessThan, t.IDXBinaryLessEq,\n\t\tt.IDXBinaryEqEq, t.IDXBinaryGreaterEq, t.IDXBinaryGreaterThan:\n\n\t\tl, err := simplify(tm, lhs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr, err := simplify(tm, rhs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif l != lhs || r != rhs {\n\t\t\to := a.NewExpr(0, op, 0, l.AsNode(), nil, r.AsNode(), nil)\n\t\t\to.SetConstValue(n.ConstValue())\n\t\t\to.SetMType(n.MType())\n\t\t\treturn o, nil\n\t\t}\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "312e4639b06ceb895d1689b1524633da", "score": "0.445046", "text": "func logic_operator(tok Token) (bool, string) {\n\tvar err bool\n\tvar inc string\n\tswitch tok.Token {\n\tcase token.LSS, token.GTR:\n\t\terr = false\n\t\tinc = \"0\"\n\tcase token.LEQ, token.GEQ:\n\t\terr = false\n\t\tinc = \"1\"\n\tdefault:\n\t\terr = true\n\t}\n\treturn err, inc\n}", "title": "" }, { "docid": "6dd3638cdd739f540161411dcdd3c80a", "score": "0.4447339", "text": "func opToString(op syntax.Op) string {\n\tswitch op {\n\tcase syntax.OpNoMatch:\n\t\treturn \"OpNoMatch\"\n\tcase syntax.OpEmptyMatch:\n\t\treturn \"OpEmptyMatch\"\n\tcase syntax.OpLiteral:\n\t\treturn \"OpLiteral\"\n\tcase syntax.OpCharClass:\n\t\treturn \"OpCharClass\"\n\tcase syntax.OpAnyCharNotNL:\n\t\treturn \"OpAnyCharNotNL\"\n\tcase syntax.OpAnyChar:\n\t\treturn \"OpAnyChar\"\n\tcase syntax.OpBeginLine:\n\t\treturn \"OpBeginLine\"\n\tcase syntax.OpEndLine:\n\t\treturn \"OpEndLine\"\n\tcase syntax.OpBeginText:\n\t\treturn \"OpBeginText\"\n\tcase syntax.OpEndText:\n\t\treturn \"OpEndText\"\n\tcase syntax.OpWordBoundary:\n\t\treturn \"OpWordBoundary\"\n\tcase syntax.OpNoWordBoundary:\n\t\treturn \"OpNoWordBoundary\"\n\tcase syntax.OpCapture:\n\t\treturn \"OpCapture\"\n\tcase syntax.OpStar:\n\t\treturn \"OpStar\"\n\tcase syntax.OpPlus:\n\t\treturn \"OpPlus\"\n\tcase syntax.OpQuest:\n\t\treturn \"OpQuest\"\n\tcase syntax.OpRepeat:\n\t\treturn \"OpRepeat\"\n\tcase syntax.OpConcat:\n\t\treturn \"OpConcat\"\n\tcase syntax.OpAlternate:\n\t\treturn \"OpAlternate\"\n\t}\n\n\tpanic(fmt.Sprintf(\"invalid op: %d\", op))\n}", "title": "" }, { "docid": "a3c157eb3e7371ddb556e43f9646f54c", "score": "0.4445741", "text": "func Parse(in []byte, address int) (Instruction, error) {\n\tfirstByte := in[0]\n\tvar signed bool\n\n\t// Check if this is a signed operation\n\tinstructions := unsignedInstructions\n\tif firstByte == 0xFE {\n\t\tsigned = true\n\t\tfirstByte = in[1]\n\t\tinstructions = signedInstructions\n\t}\n\n\tif instruction, ok := instructions[firstByte]; ok {\n\t\t// We have it!\n\t\tinstruction.Op = firstByte\n\t\tinstruction.Signed = signed\n\t\tinstruction.Address = address\n\n\t\t// Check for Indexed Addressing Mode Instruction Type\n\t\tif instruction.AddressingMode == \"indexed\" && instruction.VariableLength == true {\n\t\t\tif in[1]&1 == 1 {\n\t\t\t\tinstruction.ByteLength++\n\t\t\t\tinstruction.AddressingMode = \"long-indexed\"\n\t\t\t} else {\n\t\t\t\tinstruction.AddressingMode = \"short-indexed\"\n\t\t\t}\n\t\t}\n\n\t\t// Check for Indirect Addressing Mode Instruction Type\n\t\tif instruction.AddressingMode == \"indirect\" {\n\t\t\tif in[1]&1 == 1 {\n\t\t\t\tinstruction.AddressingMode = \"indirect+\"\n\t\t\t\tinstruction.AutoIncrement = true\n\t\t\t}\n\t\t}\n\n\t\t// Adjust for signed instructions\n\t\tif signed {\n\t\t\tinstruction.ByteLength++\n\t\t\tinstruction.Signed = signed\n\t\t\tinstruction.Mnemonic = \"SGN \" + instruction.Mnemonic\n\t\t\tinstruction.RawOps = in[2:instruction.ByteLength]\n\t\t} else {\n\t\t\tinstruction.RawOps = in[1:instruction.ByteLength]\n\t\t}\n\n\t\tinstruction.Raw = in[0:instruction.ByteLength]\n\n\t\t// Build our Vars object from the VarStrings object\n\t\tif instruction.VarCount > 0 {\n\n\t\t\tif (firstByte & 0xf8) == 0x20 {\n\t\t\t\tinstruction.doSJMP()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf8) == 0x28 {\n\t\t\t\tinstruction.doSCALL()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf8) == 0x30 {\n\t\t\t\tinstruction.doJBC()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf8) == 0x38 {\n\t\t\t\tinstruction.doJBS()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf0) == 0xd0 {\n\t\t\t\tinstruction.doCONDJMP()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf0) == 0xf0 {\n\t\t\t\tinstruction.doF0()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf0) == 0xe0 {\n\t\t\t\tinstruction.doE0()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xf0) == 0xc0 {\n\t\t\t\tinstruction.doC0()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else if (firstByte & 0xe0) == 0 {\n\t\t\t\tinstruction.do00()\n\t\t\t\tinstruction.doPseudo()\n\n\t\t\t} else {\n\t\t\t\tinstruction.doMIDDLE()\n\t\t\t\tinstruction.doPseudo()\n\t\t\t}\n\n\t\t} else {\n\t\t\tinstruction.Checked = true\n\t\t}\n\n\t\treturn instruction, nil\n\n\t} else {\n\t\treturn Instruction{ByteLength: 1}, errors.New(\"Unable to find instruction!\")\n\t}\n\n}", "title": "" }, { "docid": "e15acc92272b78de53fcd909f52c8918", "score": "0.4435232", "text": "func (c *CPU) bplOp(instruction uint16) {\n\tif !c.GetFlag(\"N\") {\n\t\tc.Registers[7] = c.branch(instruction)\n\t}\n}", "title": "" }, { "docid": "76db38194110b7b8c6ddf218a72ef9bb", "score": "0.44330898", "text": "func NewDivOp(lhs Node, rhs Node) Node {\n\treturn &binaryExp{\n\t\tname: \"/\",\n\t\tlhs: lhs,\n\t\trhs: rhs,\n\t\ta: defaultBinaryAnalyzer,\n\t\tt: floatBinaryTyper,\n\t\tfn: func(a float64, b float64) float64 {\n\t\t\treturn a / b\n\t\t},\n\t}\n}", "title": "" }, { "docid": "43fa6b8eb3ecf87790b9ee455fdc9ae4", "score": "0.44315332", "text": "func (pm *PickleMachine) opcode_BININT() error {\n\tvar v int32\n\terr := pm.readBinaryInto(&v, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpm.push(int64(v))\n\treturn nil\n}", "title": "" }, { "docid": "704cce8c22d5d8ecda844d8abd1cc2ba", "score": "0.44263592", "text": "func (p *Parse) expr() AST {\n\treturn p.op8()\n}", "title": "" }, { "docid": "6f1eb1b700b86f241469ecc25cc103cc", "score": "0.44244245", "text": "func IsBinaryExpr(node ast.Node) bool {\n\t_, ok := node.(*ast.BinaryExpr)\n\treturn ok\n}", "title": "" } ]
68b3667abc045b303e3c7e735d9cbd87
IDIn applies the In predicate on the ID field.
[ { "docid": "04390c3ffbafd180f2d6162deb71c8a2", "score": "0.7723852", "text": "func IDIn(ids ...uuid.UUID) predicate.Share {\n\treturn predicate.Share(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" } ]
[ { "docid": "9b39008970ebc2cf9cade5d95a5ef445", "score": "0.8097519", "text": "func IDIn(ids ...int) predicate.PingDetectorResult {\n\treturn predicate.PingDetectorResult(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "60f9c8df46dd9e12d8141c4c65be95fa", "score": "0.80409753", "text": "func IDIn(ids ...int) predicate.Systemmember {\n\treturn predicate.Systemmember(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "c58840f1021680a5878cb4244703ee77", "score": "0.8014605", "text": "func IDIn(ids ...int64) predicate.AccessControl {\n\treturn predicate.AccessControl(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d199b9143646e1375fa96eb09143ae69", "score": "0.7998223", "text": "func IDIn(ids ...uuid.UUID) predicate.File {\n\treturn predicate.File(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "8874a2eef5d5622d327819c82754e1fd", "score": "0.79915714", "text": "func IDIn(ids ...int) predicate.Pendingloanbinding {\n\treturn predicate.Pendingloanbinding(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "41feb1bab8150935d90098ec32d546c6", "score": "0.7977541", "text": "func IDIn(ids ...int) predicate.SchemeType {\n\treturn predicate.SchemeType(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "3406069192d4ae325cf58ed49601bb79", "score": "0.79689074", "text": "func IDIn(ids ...int) predicate.Operationroom {\n\treturn predicate.Operationroom(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "e73ff6f46abe3f20c617d7c5c4e9e471", "score": "0.7962334", "text": "func IDIn(ids ...int) predicate.BaselineMeasurement {\n\treturn predicate.BaselineMeasurement(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "e07b17ea55f3473bc5cbe01780058dd4", "score": "0.7961439", "text": "func IDIn(ids ...int) predicate.BinaryItem {\n\treturn predicate.BinaryItem(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d6525370b8e71cb63a865cca8c2762e7", "score": "0.7956968", "text": "func IDIn(ids ...int) predicate.Recordinsurance {\n\treturn predicate.Recordinsurance(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "233c811cece2fe1a3b9434f95bf79092", "score": "0.79534096", "text": "func IDIn(ids ...int) predicate.StatusOpinion {\n\treturn predicate.StatusOpinion(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "3e2b76e1b34c63f957aa5bb87bcd1ddf", "score": "0.7949985", "text": "func IDIn(ids ...string) predicate.File {\n\treturn predicate.File(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i], _ = strconv.Atoi(ids[i])\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "d9376a84f10f1f18aa5a2ef486d0157c", "score": "0.79434496", "text": "func IDIn(ids ...int) predicate.StudyEligibility {\n\treturn predicate.StudyEligibility(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "10d7bf77a914c1f94b7e29a6649d5c5d", "score": "0.7930827", "text": "func IDIn(ids ...int64) predicate.Card {\n\treturn predicate.Card(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "3c597373dafa12093348c0f2136fecba", "score": "0.7910943", "text": "func IDIn(ids ...int) predicate.Role {\n\treturn predicate.Role(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "b17164e743dddd852cd4313a343d0ea8", "score": "0.7909179", "text": "func IDIn(ids ...int64) predicate.Item {\n\treturn predicate.Item(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "a5e475c203cf83b09944ed8713738700", "score": "0.78964186", "text": "func IDIn(ids ...int) predicate.Expert {\n\treturn predicate.Expert(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "350c2e3f4d70e66c0a7188d6a73ecee4", "score": "0.7893401", "text": "func IDIn(ids ...int) predicate.Specializeddiag {\n\treturn predicate.Specializeddiag(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "8275647cf18f574e51845c9ada258d44", "score": "0.78892165", "text": "func IDIn(ids ...int) predicate.Dentalappointment {\n\treturn predicate.Dentalappointment(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "b2765a68f811941cc7bb388d984d4633", "score": "0.7886373", "text": "func IDIn(ids ...int) predicate.Training {\n\treturn predicate.Training(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "4e27eb5f394012aa5c9669ced1f8fc75", "score": "0.7886205", "text": "func IDIn(ids ...int) predicate.PostAttachment {\n\treturn predicate.PostAttachment(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "451fe94d38218b9cc6ebd32633fc546e", "score": "0.78827924", "text": "func IDIn(ids ...int) predicate.Annotation {\n\treturn predicate.Annotation(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "cb892ab27b7fa084a3b65dd88c1e72ac", "score": "0.7878036", "text": "func IDIn(ids ...string) predicate.SysUser {\n\treturn predicate.SysUser(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "86daed878bec8dee1887075540311c74", "score": "0.7871502", "text": "func IDIn(ids ...int) predicate.Patientroom {\n\treturn predicate.Patientroom(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "ab2689fd24c543710cbdfed616583008", "score": "0.78612626", "text": "func IDIn(ids ...uint) predicate.Container {\n\treturn predicate.Container(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "1a1955b6f57ea2ccda84e75e17c7f36a", "score": "0.7860609", "text": "func IDIn(ids ...int) predicate.Harbor {\n\treturn predicate.Harbor(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d9f9358cf377548ae7c29646caf7559f", "score": "0.785707", "text": "func IDIn(ids ...int) predicate.Remedy {\n\treturn predicate.Remedy(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "cf4399075a19335b02b1f145ca8f108a", "score": "0.7856366", "text": "func IDIn(ids ...int) predicate.Url {\n\treturn predicate.Url(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "6d4754354480ac0d89e1b26a0b72b75a", "score": "0.7855694", "text": "func IDIn(ids ...int) predicate.QccEnterpriseData {\n\treturn predicate.QccEnterpriseData(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "b1ac798bf0bd2337f9fc64e0b1a0d3ab", "score": "0.7853319", "text": "func IDIn(ids ...uint64) predicate.User {\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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "7acef7c8afc1a75e9d463df9fd637cf5", "score": "0.78491306", "text": "func IDIn(ids ...int) predicate.Patient {\n\treturn predicate.Patient(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "042e2425736c6cbf584dc14d9041f99a", "score": "0.7841164", "text": "func IDIn(ids ...int) predicate.CarInspection {\n\treturn predicate.CarInspection(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d71ed956365f778c28b4baa9950b734b", "score": "0.78397036", "text": "func IDIn(ids ...int64) predicate.User {\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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "0fd7bc1c676c6a2b39a927379b6a969d", "score": "0.78321207", "text": "func IDIn(ids ...int) predicate.Book {\n\treturn predicate.Book(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "0fd7bc1c676c6a2b39a927379b6a969d", "score": "0.78321207", "text": "func IDIn(ids ...int) predicate.Book {\n\treturn predicate.Book(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d08efe184993ea59ec9aea44c46ec370", "score": "0.7830748", "text": "func IDIn(ids ...int) predicate.User {\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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d08efe184993ea59ec9aea44c46ec370", "score": "0.7830748", "text": "func IDIn(ids ...int) predicate.User {\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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d08efe184993ea59ec9aea44c46ec370", "score": "0.7830748", "text": "func IDIn(ids ...int) predicate.User {\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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "69cb98e4820a40de877afb3a8f90ab62", "score": "0.7826076", "text": "func IDIn(ids ...int) predicate.Section {\n\treturn predicate.Section(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "d19b74b403989a564a78ffed2ba2734f", "score": "0.781656", "text": "func IDIn(ids ...int) predicate.User {\n\treturn predicate.User(\n\t\tfunc(s *sql.Selector) {\n\t\t\t// if not arguments were provided, append the FALSE constants,\n\t\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\t\tif len(ids) == 0 {\n\t\t\t\ts.Where(sql.False())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tv := make([]interface{}, len(ids))\n\t\t\tfor i := range v {\n\t\t\t\tv[i] = ids[i]\n\t\t\t}\n\t\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "10ea2a639a869893aa24b3f006db3ac2", "score": "0.7803768", "text": "func IDIn(ids ...int) predicate.Physicaltherapyroom {\n\treturn predicate.Physicaltherapyroom(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "89a4b98cd4c18fc6f35acb60355a719b", "score": "0.7802361", "text": "func IDIn(ids ...int) predicate.BankingData {\n\treturn predicate.BankingData(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "7e4f9863ef61e4602ec438d339c7569c", "score": "0.77717936", "text": "func IDIn(ids ...int) predicate.Club {\n\treturn predicate.Club(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "36589180e4ab700b01664d0312298cd7", "score": "0.776685", "text": "func IDIn(ids ...uuid.UUID) predicate.Account {\n\treturn predicate.Account(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "36589180e4ab700b01664d0312298cd7", "score": "0.776685", "text": "func IDIn(ids ...uuid.UUID) predicate.Account {\n\treturn predicate.Account(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "ac78cb876903acdc9dd1fd761f246cd0", "score": "0.77658135", "text": "func IDIn(ids ...int) predicate.StockManager {\n\treturn predicate.StockManager(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "1a7f6744d94b7cf7eba118ae742cc279", "score": "0.77651244", "text": "func IDIn(ids ...int) predicate.Comment {\n\treturn predicate.Comment(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "ef1c1c5c6f39670061f6d08a9664d148", "score": "0.7764832", "text": "func IDIn(ids ...int) predicate.Nurse {\n\treturn predicate.Nurse(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "05aa3c0cc1de0bb44436b4a3d8815a81", "score": "0.7753852", "text": "func IDIn(ids ...int) predicate.FlowGroup {\n\treturn predicate.FlowGroup(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "39a3d08eabdb7acde1bdd5b41dbecec4", "score": "0.7745384", "text": "func IDIn(ids ...int) predicate.Areahistory {\n\treturn predicate.Areahistory(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "87fe5b1962a24cbebee1abb2345a25dd", "score": "0.7729221", "text": "func (qs ProfitQuerySet) IDIn(ID uint, IDRest ...uint) ProfitQuerySet {\n\tiArgs := []interface{}{ID}\n\tfor _, arg := range IDRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"id IN (?)\", iArgs))\n}", "title": "" }, { "docid": "6398b283ee21a1df03b357106cd81a60", "score": "0.77278256", "text": "func IDIn(ids ...int) predicate.Country {\n\treturn predicate.Country(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "94a7bfac425a533b304b6e9c9f9d1eaa", "score": "0.77246684", "text": "func IDIn(ids ...int) predicate.CardSchedule {\n\treturn predicate.CardSchedule(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "272dde9409a5e0f3726af1e1e1de66c6", "score": "0.77212334", "text": "func IDIn(ids ...int) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "d27725ae834c58ca1a263b1759bdb588", "score": "0.7718383", "text": "func IDIn(ids ...int) predicate.Event {\n\treturn predicate.Event(func(s *sql.Selector) {\n\t\tv := make([]any, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "3efac38bd01619e98fc0c94efb8db993", "score": "0.771643", "text": "func IDIn(ids ...string) predicate.DChessdbCache {\n\treturn predicate.DChessdbCache(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "33eedd571f6a20a2afaecc0fc15b065f", "score": "0.7688078", "text": "func IDIn(ids ...int) predicate.Product {\n\treturn predicate.Product(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "33eedd571f6a20a2afaecc0fc15b065f", "score": "0.7688078", "text": "func IDIn(ids ...int) predicate.Product {\n\treturn predicate.Product(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "8b1df4af96d4fd84dee35abb255dfb06", "score": "0.7680947", "text": "func IDIn(ids ...int) predicate.People {\n\treturn predicate.People(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "4b56a61bccda889eec1598892dcbec83", "score": "0.76702315", "text": "func IDIn(ids ...string) predicate.Comment {\n\treturn predicate.Comment(func(t *dsl.Traversal) {\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\tt.HasID(p.Within(v...))\n\t})\n}", "title": "" }, { "docid": "75cebd87607d935fb92ed340caba2b8e", "score": "0.76559705", "text": "func IDIn(ids ...int) predicate.BloodType {\n\treturn predicate.BloodType(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "98810df84b27d8b53a870eb49f09811a", "score": "0.7648171", "text": "func IdnumIn(vs ...string) predicate.People {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.People(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(FieldIdnum), v...))\n\t})\n}", "title": "" }, { "docid": "6ec0af6ad009e48bd6f459df5e2fa880", "score": "0.7637113", "text": "func IDIn(ids ...uuid.UUID) predicate.Question {\n\treturn predicate.Question(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "47213e79e5dad5604e6486a4a609a155", "score": "0.76327544", "text": "func IDIn(ids ...int) predicate.Sprint {\n\treturn predicate.Sprint(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t},\n\t)\n}", "title": "" }, { "docid": "164bd93949b6d5f1cb8dface49eeeac7", "score": "0.7626745", "text": "func IDIn(ids ...int64) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "8043363d3b13ad514ff3045f817296e3", "score": "0.76201206", "text": "func IDIn(ids ...string) predicate.Task {\n\treturn predicate.Task(func(t *dsl.Traversal) {\n\t\tv := make([]any, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\tt.HasID(p.Within(v...))\n\t})\n}", "title": "" }, { "docid": "1df77aaf1b30d6f1272aedf26afe937c", "score": "0.7600603", "text": "func IDIn(ids ...int) predicate.Friendship {\n\treturn predicate.Friendship(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "68e7339362ad1535cb3d828dd54f22b6", "score": "0.7590903", "text": "func IDIn(ids ...int) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "94abda6b6caea9b133dfdb83be484e49", "score": "0.7586962", "text": "func IDIn(ids ...uuid.UUID) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "2591789d38919c9ed708c3fc50ad4cb8", "score": "0.7570744", "text": "func IDIn(ids ...int) predicate.TradeCondition {\n\treturn predicate.TradeCondition(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "ff2607b2e61c0ee36e2fe7dcd06fe4b0", "score": "0.7555038", "text": "func IDIn(ids ...uuid.UUID) predicate.Revision {\n\treturn predicate.Revision(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "103e94277b64ac59d3953c0475123648", "score": "0.75400275", "text": "func IDIn(ids ...int) predicate.UserTweet {\n\treturn predicate.UserTweet(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "db0a2ebd09570011bac8b79902a47324", "score": "0.7533418", "text": "func IDIn(ids ...int) predicate.GithubRepository {\n\treturn predicate.GithubRepository(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "9a71e54cd7a87fac9e3ad1f1e1306442", "score": "0.74744606", "text": "func IDIn(ids ...int) predicate.Gender {\n\treturn predicate.Gender(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(ids) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\tv := make([]interface{}, len(ids))\n\t\tfor i := range v {\n\t\t\tv[i] = ids[i]\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldID), v...))\n\t})\n}", "title": "" }, { "docid": "9fe36e70aad592e8fd4d196ebfa662c0", "score": "0.7455659", "text": "func (qs GroupQuerySet) IDIn(ID uint, IDRest ...uint) GroupQuerySet {\n\tiArgs := []interface{}{ID}\n\tfor _, arg := range IDRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"id IN (?)\", iArgs))\n}", "title": "" }, { "docid": "7977b7e15698400f34c7eb0073544e29", "score": "0.745386", "text": "func (qs AccountQuerySet) IdIn(id ...int32) AccountQuerySet {\n\tif len(id) == 0 {\n\t\tqs.db.AddError(errors.New(\"must at least pass one id in IdIn\"))\n\t\treturn qs.w(qs.db)\n\t}\n\treturn qs.w(qs.db.Where(\"id IN (?)\", id))\n}", "title": "" }, { "docid": "9d8a4bb225a77d7ef97daa35d4410007", "score": "0.7401977", "text": "func (qs SpriteStyleQuerySet) IDIn(ID uint, IDRest ...uint) SpriteStyleQuerySet {\n\tiArgs := []interface{}{ID}\n\tfor _, arg := range IDRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"id IN (?)\", iArgs))\n}", "title": "" }, { "docid": "862098e625ddf4076773b7c7de6999d3", "score": "0.7396758", "text": "func (o *DcimDevicesListParams) SetIDIn(iDIn *string) {\n\to.IDIn = iDIn\n}", "title": "" }, { "docid": "27206462775d596e426b42b569acd5f0", "score": "0.7241871", "text": "func FileimportIDIn(vs ...int) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(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(FieldFileimportID), v...))\n\t})\n}", "title": "" }, { "docid": "c2cf8e42cbf0388241b8afef75ba8684", "score": "0.723959", "text": "func AuthIDIn(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(FieldAuthID), v...))\n\t})\n}", "title": "" }, { "docid": "7af80fa8f265c9d20279e94f3fe11a6a", "score": "0.7229357", "text": "func ServiceIDIn(vs ...int64) predicate.AccessControl {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.AccessControl(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(FieldServiceID), v...))\n\t})\n}", "title": "" }, { "docid": "77021993f830e33d978a28a11117336a", "score": "0.7229034", "text": "func (o *TenancyTenantsReadParams) SetIDIn(iDIn *float64) {\n\to.IDIn = iDIn\n}", "title": "" }, { "docid": "73a9ed73db82db69216fb05a16fb2156", "score": "0.72261673", "text": "func ItemIDIn(vs ...uuid.UUID) predicate.Share {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Share(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(FieldItemID), v...))\n\t})\n}", "title": "" }, { "docid": "8b10e3ad7b162daf22c60ce27bdce91b", "score": "0.71670943", "text": "func IDIn(ids ...uuid.UUID) predicate.GroupBudget {\n\treturn predicate.GroupBudget(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "55ddca237ae8ff5de8fd5e3ea1b6fe01", "score": "0.7151158", "text": "func IDIn(ids ...int) predicate.UserGroup {\n\treturn predicate.UserGroup(sql.FieldIn(FieldID, ids...))\n}", "title": "" }, { "docid": "3ce31d5ee1e2d5ad024d69fd2ab080bf", "score": "0.71393496", "text": "func (o *TargetsListParams) SetIDIn(iDIn *float64) {\n\to.IDIn = iDIn\n}", "title": "" }, { "docid": "9bec86a31a8e574fab19db16fdf60f78", "score": "0.7065942", "text": "func FriendIDIn(vs ...int) predicate.Friendship {\n\treturn predicate.Friendship(sql.FieldIn(FieldFriendID, vs...))\n}", "title": "" }, { "docid": "7ef3781ae56b159e81a71d414dfd1610", "score": "0.70551956", "text": "func StudentIDIn(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(FieldStudentID), v...))\n\t})\n}", "title": "" }, { "docid": "d7e012fe809559e7e33e06bbdbf21823", "score": "0.6987037", "text": "func PersonalIDIn(vs ...string) predicate.Patient {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Patient(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(FieldPersonalID), v...))\n\t})\n}", "title": "" }, { "docid": "94a3fce670a6c5c9457ad53bf8275ea2", "score": "0.69862735", "text": "func IntervalIDIn(vs ...int) predicate.BarTimeRange {\n\treturn predicate.BarTimeRange(sql.FieldIn(FieldIntervalID, vs...))\n}", "title": "" }, { "docid": "295595a48055aeeea89c2d5952483529", "score": "0.69809294", "text": "func (qs ProfitQuerySet) ObjectIDIn(objectID uint, objectIDRest ...uint) ProfitQuerySet {\n\tiArgs := []interface{}{objectID}\n\tfor _, arg := range objectIDRest {\n\t\tiArgs = append(iArgs, arg)\n\t}\n\treturn qs.w(qs.db.Where(\"object_id IN (?)\", iArgs))\n}", "title": "" }, { "docid": "5e2907823bb2a22f2ed445b356333494", "score": "0.6925033", "text": "func WalletIDIn(vs ...string) predicate.Pendingloanbinding {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Pendingloanbinding(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(FieldWalletID), v...))\n\t})\n}", "title": "" }, { "docid": "113144a2b1ff8ec5d63c160936ec1679", "score": "0.69215786", "text": "func GistIDIn(vs ...string) predicate.GithubGist {\n\treturn predicate.GithubGist(sql.FieldIn(FieldGistID, vs...))\n}", "title": "" }, { "docid": "a439e434f53f2eeace3b4517041e7477", "score": "0.6903793", "text": "func WalletIDIn(vs ...string) predicate.Areahistory {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Areahistory(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(FieldWalletID), v...))\n\t})\n}", "title": "" }, { "docid": "fcb28ebfb77b1c55b6183af36eef72f2", "score": "0.6817436", "text": "func WalletIDIn(vs ...uuid.UUID) predicate.Account {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.In(s.C(FieldWalletID), v...))\n\t})\n}", "title": "" }, { "docid": "e2ec68fa5fa95d1d8458a64d5d3d614c", "score": "0.6801327", "text": "func RepoIDIn(vs ...int64) predicate.GithubRepository {\n\treturn predicate.GithubRepository(sql.FieldIn(FieldRepoID, vs...))\n}", "title": "" }, { "docid": "2c585c3f54cc3e35ec330259fd719d96", "score": "0.678484", "text": "func UserIDIn(vs ...uuid.UUID) predicate.Share {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Share(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(FieldUserID), v...))\n\t})\n}", "title": "" }, { "docid": "d939b08548435cf6c047c1847080b3c1", "score": "0.6733276", "text": "func ContainerIdIn(vs ...string) predicate.Container {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Container(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(FieldContainerId), v...))\n\t})\n}", "title": "" }, { "docid": "7f3bb66eed43226a6cb1800eecafd014", "score": "0.67105055", "text": "func NodeIdIn(vs ...uint) predicate.Container {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Container(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(FieldNodeId), v...))\n\t})\n}", "title": "" }, { "docid": "53f57f75a16512735fa001b6addc1d95", "score": "0.66459435", "text": "func TweetIDIn(vs ...int) predicate.UserTweet {\n\treturn predicate.UserTweet(sql.FieldIn(FieldTweetID, vs...))\n}", "title": "" } ]
3423730b3c1ecb5ba42b8dac8c08f176
ForwardRemoteRequestToLocal indicates an expected call of ForwardRemoteRequestToLocal
[ { "docid": "1d1aa8c09c8d23fae0ec5f11de00dec9", "score": "0.71535814", "text": "func (mr *MockCliInterfaceMockRecorder) ForwardRemoteRequestToLocal(localPort, remoteHost, remotePort, privateKeyPath, remoteSSHPort interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ForwardRemoteRequestToLocal\", reflect.TypeOf((*MockCliInterface)(nil).ForwardRemoteRequestToLocal), localPort, remoteHost, remotePort, privateKeyPath, remoteSSHPort)\n}", "title": "" } ]
[ { "docid": "37b7fa4b812ffdb089c423db4f005db3", "score": "0.65689105", "text": "func (m *MockCliInterface) ForwardRemoteRequestToLocal(localPort, remoteHost, remotePort, privateKeyPath string, remoteSSHPort int) *exec.Cmd {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ForwardRemoteRequestToLocal\", localPort, remoteHost, remotePort, privateKeyPath, remoteSSHPort)\n\tret0, _ := ret[0].(*exec.Cmd)\n\treturn ret0\n}", "title": "" }, { "docid": "b8765f03ec196eedf945159e7a093489", "score": "0.6192516", "text": "func (mr *MockCliInterfaceMockRecorder) DynamicForwardLocalRequestToRemote(remoteHost, privateKeyPath, remoteSSHPort, proxyPort interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DynamicForwardLocalRequestToRemote\", reflect.TypeOf((*MockCliInterface)(nil).DynamicForwardLocalRequestToRemote), remoteHost, privateKeyPath, remoteSSHPort, proxyPort)\n}", "title": "" }, { "docid": "addbd4fd3a0fe5c09ef02284c7b2dcc6", "score": "0.5971424", "text": "func TestNextForwardingRequest_NoHosts(t *testing.T) {\n\tdefer func() { recover() }()\n\tr := ParseRequest(\"user\")\n\tr.NextForwardingRequest()\n\tt.Fail()\n}", "title": "" }, { "docid": "53bcf8fb222670d2da917f480160b199", "score": "0.59126437", "text": "func (s *Server) IsLocalRequest(forwardedHost string) bool {\n\t// TODO: Check if the forwarded host is the current host.\n\t// The logic is depending on etcd service mode -- if the TSO service\n\t// uses the embedded etcd, check against ClientUrls; otherwise check\n\t// against the cluster membership.\n\treturn forwardedHost == \"\"\n}", "title": "" }, { "docid": "a7708b2b31a49cf3efc10488b40be18a", "score": "0.56999403", "text": "func (c *Connect) ExposeToLocal() (err error) {\n\tif c.Expose == \"\" {\n\t\treturn\n\t}\n\tfmt.Printf(\"SSH Remote port-forward starting\\n\")\n\tcmd := util.SSHRemotePortForward(c.Expose, \"127.0.0.1\", c.Expose, c.Port)\n\treturn BackgroundRun(cmd, \"ssh remote port-forward\", c.Debug)\n}", "title": "" }, { "docid": "7f2991aae189fd251aada5f3b802c55d", "score": "0.5560471", "text": "func ForwardRequest(ctx context.Context, sender RequestForwarder, req *ssh.Request) (bool, error) {\n\treply, err := sender.SendRequest(ctx, req.Type, req.WantReply, req.Payload)\n\tif err != nil || !req.WantReply {\n\t\treturn reply, trace.Wrap(err)\n\t}\n\treturn reply, trace.Wrap(req.Reply(reply, nil))\n}", "title": "" }, { "docid": "8a99e3cf5516c1aeee6a18da81ff5ab8", "score": "0.5559393", "text": "func (m *MockCliInterface) DynamicForwardLocalRequestToRemote(remoteHost, privateKeyPath string, remoteSSHPort, proxyPort int) *exec.Cmd {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DynamicForwardLocalRequestToRemote\", remoteHost, privateKeyPath, remoteSSHPort, proxyPort)\n\tret0, _ := ret[0].(*exec.Cmd)\n\treturn ret0\n}", "title": "" }, { "docid": "82f3650ef85934aacb3fdeacf3dd31e9", "score": "0.5405634", "text": "func LocalForward(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, req *http.Request, resp protoreflect.ProtoMessage, opts ...func(context.Context, http.ResponseWriter, protoreflect.ProtoMessage) error) {\n\tif md, ok := runtime.ServerMetadataFromContext(ctx); ok {\n\t\tvals := md.HeaderMD.Get(\"x-request-id\")\n\t\tif len(vals) > 0 {\n\t\t\tw.Header().Set(\"X-Request-Id\", vals[0])\n\t\t}\n\t\tvals = md.HeaderMD.Get(\"x-service-id\")\n\t\tif len(vals) > 0 {\n\t\t\tw.Header().Set(\"X-Service-Id\", vals[0])\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t// w.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t// w.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t// w.Header().Set(\"Access-Control-Allow-Methods\", \"OPTIONS, POST, GET, PUT, DELETE, PATCH\")\n\n\tvar buf []byte\n\tvar err error\n\n\tif rb, ok := resp.(responseBody); ok {\n\t\tbuf, err = marshaler.Marshal(rb.XXX_ResponseBody())\n\t} else {\n\t\tbuf, err = marshaler.Marshal(resp)\n\t}\n\n\tif err != nil {\n\t\tgrpclog.Infof(\"Marshal error: %v\", err)\n\t\truntime.HTTPError(ctx, mux, marshaler, w, req, err)\n\t\treturn\n\t}\n\tvar resMap map[string]interface{}\n\n\terr = json.Unmarshal(buf, &resMap)\n\tif err != nil {\n\t\truntime.HTTPError(ctx, mux, marshaler, w, req, err)\n\t\treturn\n\t}\n\n\tres := &successResponse{\n\t\tSuccess: true,\n\t\tErr: \"no error\",\n\t\tCode: \"0\",\n\t\tData: resMap,\n\t}\n\n\tresByte, errResByte := json.Marshal(res)\n\n\tif errResByte != nil {\n\t\truntime.HTTPError(ctx, mux, marshaler, w, req, errResByte)\n\t\treturn\n\t}\n\tif _, err = w.Write(resByte); err != nil {\n\t\tgrpclog.Infof(\"Failed to write response: %v\", err)\n\t}\n}", "title": "" }, { "docid": "01efe0d6bb66de2045b6eee68b4c5e3d", "score": "0.53568757", "text": "func remoteAddress(r *http.Request) (string, bool) {\n\thdr := r.Header\n\n\t// Try to obtain the ip from the X-Forwarded-For header\n\tip := hdr.Get(\"X-Forwarded-For\")\n\tif ip != \"\" {\n\t\t// X-Forwarded-For is potentially a list of addresses separated with \",\"\n\t\tparts := strings.Split(ip, \",\")\n\t\tif len(parts) > 0 {\n\t\t\tip = strings.TrimSpace(parts[0])\n\n\t\t\tif ip != \"\" {\n\t\t\t\treturn ip, false\n\t\t\t}\n\t\t}\n\t}\n\n\t// Try to obtain the ip from the X-Real-Ip header\n\tip = strings.TrimSpace(hdr.Get(\"X-Real-Ip\"))\n\tif ip != \"\" {\n\t\treturn ip, false\n\t}\n\n\t// Fallback to the request remote address\n\treturn removePortFromRemoteAddr(r.RemoteAddr), true\n}", "title": "" }, { "docid": "727d278de77a74684b1aea182b1310ab", "score": "0.5207255", "text": "func IsLocalhost(req *http.Request) bool {\n\tuid := os.Getuid()\n\tfrom, err := netutil.HostPortToIP(req.RemoteAddr, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\tto, err := netutil.HostPortToIP(req.Host, from)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// If our OS doesn't support uid.\n\t// TODO(bradfitz): netutil on OS X uses \"lsof\" to figure out\n\t// ownership of tcp connections, but when fuse is mounted and a\n\t// request is outstanding (for instance, a fuse request that's\n\t// making a request to camlistored and landing in this code\n\t// path), lsof then blocks forever waiting on a lock held by the\n\t// VFS, leading to a deadlock. Instead, on darwin, just trust\n\t// any localhost connection here, which is kinda lame, but\n\t// whatever. Macs aren't very multi-user anyway.\n\tif uid == -1 || runtime.GOOS == \"darwin\" {\n\t\treturn from.IP.IsLoopback() && to.IP.IsLoopback()\n\t}\n\tif uid == 0 {\n\t\tlog.Printf(\"camlistored running as root. Don't do that.\")\n\t\treturn false\n\t}\n\tif uid > 0 {\n\t\tconnUid, err := netutil.AddrPairUserid(from, to)\n\t\tif err == nil {\n\t\t\tif uid == connUid || connUid == 0 {\n\t\t\t\t// If it's the same user who's running the server, allow it.\n\t\t\t\t// Also allow root, so users can \"sudo camput\" files.\n\t\t\t\t// Allowing root isn't a security problem because if root wants\n\t\t\t\t// to mess with the local user, they already can. This whole mechanism\n\t\t\t\t// is about protecting regular users from other regular users\n\t\t\t\t// on shared computers.\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tlog.Printf(\"auth: local connection uid %d doesn't match server uid %d\", connUid, uid)\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "49785288b8461219f9c9268dffcf5280", "score": "0.52068263", "text": "func (m *Mock) RemoteAddr() net.Addr { return nil }", "title": "" }, { "docid": "713904749b035f5c6cf91e6acd353151", "score": "0.51615506", "text": "func (mr *MockCliInterfaceMockRecorder) ForwardPodPortToLocal(options, podName, remotePort, localPort interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ForwardPodPortToLocal\", reflect.TypeOf((*MockCliInterface)(nil).ForwardPodPortToLocal), options, podName, remotePort, localPort)\n}", "title": "" }, { "docid": "b821b45859567a461b16f86948b2d9f3", "score": "0.51453453", "text": "func (self *Coordinator) ConnectToLocal(other *Coordinator) {\n // We communicate over this channel instead of a netchan\n newSendChannel := make(chan interface{})\n newRecvChannel := make(chan interface{})\n \n // Add a proxy for new peer\n self.peers = append(self.peers, NewCoordProxy(other.conf.Identifier, self.conf.Identifier, newSendChannel, newRecvChannel))\n \n // Tell peer to listen for RPC requests from me\n other.AddRPCChannel(newRecvChannel, newSendChannel)\n}", "title": "" }, { "docid": "d893275f14d086544a971db404bec35b", "score": "0.5127277", "text": "func (m *Mock) LocalAddr() net.Addr { return nil }", "title": "" }, { "docid": "113c7c880bb48d77a2714f7d24e66f1d", "score": "0.5050733", "text": "func RealRemoteAddr(r *http.Request) string {\n\tif real := r.Header.Get(\"X-Real-IP\"); real != \"\" {\n\t\treturn real\n\t}\n\treturn r.RemoteAddr\n}", "title": "" }, { "docid": "f74ceba95cfa37ae17adae6b4a69a16b", "score": "0.50455874", "text": "func requestGetRemoteAddress(r *http.Request) string {\n\thdr := r.Header\n\thdrRealIP := hdr.Get(\"X-Real-Ip\")\n\thdrForwardedFor := hdr.Get(\"X-Forwarded-For\")\n\tif hdrRealIP == \"\" && hdrForwardedFor == \"\" {\n\t\treturn ipAddrFromRemoteAddr(r.RemoteAddr)\n\t}\n\tif hdrForwardedFor != \"\" {\n\t\t// X-Forwarded-For is potentially a list of addresses separated with \",\"\n\t\tparts := strings.Split(hdrForwardedFor, \",\")\n\t\tfor i, p := range parts {\n\t\t\tparts[i] = strings.TrimSpace(p)\n\t\t}\n\t\treturn parts[0]\n\t}\n\treturn hdrRealIP\n}", "title": "" }, { "docid": "67d8a12954b08e42d5961b3d4c1fe288", "score": "0.5038632", "text": "func redirLocal(addr, server string, shadow func(net.Conn) net.Conn) error {\n\tlogf(\"TCP redirect %s <-> %s\", addr, server)\n\treturn tcpLocal(addr, server, shadow, func(c net.Conn) (socks.Addr, error) { return getOrigDst(c, false) })\n}", "title": "" }, { "docid": "ca45903701db03dbe931ab005983239e", "score": "0.5008286", "text": "func (m *ConnMock) MinimockLocalAddrInspect() {\n\tfor _, e := range m.LocalAddrMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\tm.t.Error(\"Expected call to ConnMock.LocalAddr\")\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.LocalAddrMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterLocalAddrCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ConnMock.LocalAddr\")\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcLocalAddr != nil && mm_atomic.LoadUint64(&m.afterLocalAddrCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ConnMock.LocalAddr\")\n\t}\n}", "title": "" }, { "docid": "4628d4838e4e38ee9e4403fd9e4c17b1", "score": "0.49829915", "text": "func (m *MockQuicSession) LocalAddr() net.Addr {\n\tret := m.ctrl.Call(m, \"LocalAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}", "title": "" }, { "docid": "0ad7ed7d8528eef5e28a2715b2d7b52a", "score": "0.49651074", "text": "func (self *Server) local(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == http.MethodConnect {\n\t\tif err := self.Direct.Connect(w, r); err != nil {\n\t\t\t// add error visit log\n\t\t\terrorEvent(r.URL.Hostname(), err)\n\t\t}\n\t} else if r.URL.IsAbs() {\n\t\tr.RequestURI = \"\"\n\t\tRemoveHopHeaders(r.Header)\n\t\tif err := self.Direct.ServeHTTP(w, r); err != nil {\n\t\t\t// add error visit log\n\t\t\terrorEvent(r.URL.Hostname(), err)\n\t\t}\n\t} else {\n\t\tglog.Infof(\"%s is not a full URL path\", r.RequestURI)\n\t}\n}", "title": "" }, { "docid": "03f51d6950fdf3d9a064b220e275ec84", "score": "0.4963776", "text": "func IsLocal() bool {\n\treturn !IsRemote()\n}", "title": "" }, { "docid": "d2cb9b420710c707176ab0a5f380e81f", "score": "0.4919533", "text": "func startForwardProxy(ctx context.Context, clientConn, serverConn net.Conn, host string) {\n\tlog.Debugf(\"Started forwarding request for %q.\", host)\n\tdefer log.Debugf(\"Stopped forwarding request for %q.\", host)\n\n\tif err := utils.ProxyConn(ctx, clientConn, serverConn); err != nil {\n\t\tlog.WithError(err).Errorf(\"Failed to proxy between %q and %q.\", clientConn.LocalAddr(), serverConn.LocalAddr())\n\t}\n}", "title": "" }, { "docid": "29ad44c24066fa7137b0e132a8ed9f38", "score": "0.4918028", "text": "func (c *mockEvConn) LocalAddr() net.Addr {\n\treturn nil\n}", "title": "" }, { "docid": "a35a07a7660ec9d4384f8ee0518d1205", "score": "0.49161127", "text": "func isRemoteAddress(ip net.IP) bool {\n\treturn !(util.IsLocal(ip) || ip.IsUnspecified() || ip.IsLoopback())\n}", "title": "" }, { "docid": "fde32e86d8ee33b3a54dd9f20f9b13ed", "score": "0.48858908", "text": "func (s *Server) forwardNewRouteInfoToKnownServers(info *Info) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tb, _ := json.Marshal(info)\n\tinfoJSON := []byte(fmt.Sprintf(InfoProto, b))\n\n\tfor _, r := range s.routes {\n\t\tr.mu.Lock()\n\t\tif r.route.remoteID != info.ID {\n\t\t\tr.sendInfo(infoJSON)\n\t\t}\n\t\tr.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "8b4dd445ef4fbc86fe93eb4546ca1c02", "score": "0.4874386", "text": "func requestSourceIsDifferent(r *http.Request, a *AuthRequest) bool {\n\t// check that the same client tries to complete the authentication\n\tsourceIP := net.ParseIP(extractAddress(r.RemoteAddr))\n\tif sourceIP == nil {\n\t\tgoto fail\n\t}\n\tif !a.SameSource(sourceIP) {\n\t\tgoto fail\n\t}\n\n\treturn false\n\nfail:\n\treturn true\n}", "title": "" }, { "docid": "d4ee785a0cd061d6d72c3ea375b75dca", "score": "0.48706493", "text": "func (s *Service) checkLocal(ctx *core.Context, loc string) error {\n\treturn nil\n}", "title": "" }, { "docid": "fc3775ee16f6e9ed49b894e58efc7569", "score": "0.4860858", "text": "func TestProxyHeaders(t *testing.T) {\n\trr := httptest.NewRecorder()\n\tr := newRequest(http.MethodGet, \"/\")\n\n\tr.Header.Set(xForwardedFor, \"8.8.8.8\")\n\tr.Header.Set(xForwardedProto, \"https\")\n\tr.Header.Set(xForwardedHost, \"google.com\")\n\tvar (\n\t\taddr string\n\t\tproto string\n\t\thost string\n\t)\n\tProxyHeaders(http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\taddr = r.RemoteAddr\n\t\t\tproto = r.URL.Scheme\n\t\t\thost = r.Host\n\t\t})).ServeHTTP(rr, r)\n\n\tif rr.Code != http.StatusOK {\n\t\tt.Fatalf(\"bad status: got %d want %d\", rr.Code, http.StatusOK)\n\t}\n\n\tif addr != r.Header.Get(xForwardedFor) {\n\t\tt.Fatalf(\"wrong address: got %s want %s\", addr,\n\t\t\tr.Header.Get(xForwardedFor))\n\t}\n\n\tif proto != r.Header.Get(xForwardedProto) {\n\t\tt.Fatalf(\"wrong address: got %s want %s\", proto,\n\t\t\tr.Header.Get(xForwardedProto))\n\t}\n\tif host != r.Header.Get(xForwardedHost) {\n\t\tt.Fatalf(\"wrong address: got %s want %s\", host,\n\t\t\tr.Header.Get(xForwardedHost))\n\t}\n}", "title": "" }, { "docid": "3104c9b15a24a48a6767bbb606617588", "score": "0.48478794", "text": "func isLocalProxyCertReq(req *authpb.UserCertsRequest) bool {\n\treturn (req.Usage == authpb.UserCertsRequest_Database &&\n\t\treq.RequesterName == authpb.UserCertsRequest_TSH_DB_LOCAL_PROXY_TUNNEL) ||\n\t\t(req.Usage == authpb.UserCertsRequest_Kubernetes &&\n\t\t\treq.RequesterName == authpb.UserCertsRequest_TSH_KUBE_LOCAL_PROXY)\n}", "title": "" }, { "docid": "2fcf43188703fb21d3a899e5a47fa591", "score": "0.48461294", "text": "func socksLocal(addr, server string, shadow func(net.Conn) net.Conn,\n\tctx context.Context, cancel context.CancelFunc) {\n\tlogf(\"Shadowsocks local SOCKS proxy %s <-> %s\", addr, server)\n\ttcpLocal(addr, server, shadow,\n\t\tfunc(c net.Conn) (socks.Addr, error) { return socks.Handshake(c) },\n\t\tctx, cancel)\n}", "title": "" }, { "docid": "4748b0ec7b41c36f11e918f600ed01b0", "score": "0.48259467", "text": "func (c *ErrorTestingConnection) LocalAddr() net.Addr {\n\treturn nil\n}", "title": "" }, { "docid": "f8cff51103698f7e9db2c2dcf93ff69e", "score": "0.4791592", "text": "func (m *MockCliInterface) ForwardPodPortToLocal(options *options.DaemonOptions, podName string, remotePort, localPort int) (chan struct{}, context.Context, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ForwardPodPortToLocal\", options, podName, remotePort, localPort)\n\tret0, _ := ret[0].(chan struct{})\n\tret1, _ := ret[1].(context.Context)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "title": "" }, { "docid": "313728db279e3ea3396150912bd6570f", "score": "0.4791008", "text": "func (w *Worker) AdjustHeaders(in *http.Request, out *http.Request) {\n\tlog.Printf(fmt.Sprintf(\"remote: %s scheme: %s host: %s port: %s\",\n\t\tin.RemoteAddr,\n\t\tin.URL.Scheme,\n\t\tin.Host,\n\t\tin.URL.Port()))\n\n\tif in.RemoteAddr != \"\" {\n\t\tout.Header.Set(\"X-Forwarded-For\", in.RemoteAddr)\n\t}\n\n\tif in.URL.Scheme != \"\" {\n\t\tout.Header.Set(\"X-Forwarded-Scheme\", in.URL.Scheme)\n\t}\n\n\tif in.Host != \"\" {\n\t\tout.Header.Set(\"X-Forwarded-Host\", in.Host)\n\t}\n\n\tif in.URL.Port() != \"\" {\n\t\tout.Header.Set(\"X-Forwarded-Port\", in.URL.Port())\n\t}\n\n\tout.Header.Set(\"Connection\", \"close\")\n}", "title": "" }, { "docid": "af2b948027cce9cc07cb139ddf2e59df", "score": "0.4776042", "text": "func LocalProxy(proxy, local interface{}) error {\n\tdstValue := reflect.ValueOf(proxy)\n\tsrcValue := reflect.ValueOf(local)\n\tif dstValue.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"proxy must be a pointer\")\n\t}\n\tdstValue = dstValue.Elem()\n\tt := dstValue.Type()\n\tet := t\n\tif et.Kind() == reflect.Ptr {\n\t\tet = et.Elem()\n\t}\n\tif et.Kind() != reflect.Struct {\n\t\treturn errors.New(\"proxy must be a struct pointer or pointer to a struct pointer\")\n\t}\n\tptr := reflect.New(et)\n\tobj := ptr.Elem()\n\tcount := obj.NumField()\n\tfor i := 0; i < count; i++ {\n\t\tf := obj.Field(i)\n\t\tft := f.Type()\n\t\tsf := et.Field(i)\n\t\tif f.CanSet() && ft.Kind() == reflect.Func {\n\t\t\tf.Set(srcValue.MethodByName(sf.Name))\n\t\t}\n\t}\n\tif t.Kind() == reflect.Ptr {\n\t\tdstValue.Set(ptr)\n\t} else {\n\t\tdstValue.Set(obj)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66c1def90674e6f047dc8536225670b9", "score": "0.47745386", "text": "func (m *ConnMock) MinimockLocalAddrDone() bool {\n\tfor _, e := range m.LocalAddrMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.LocalAddrMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterLocalAddrCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcLocalAddr != nil && mm_atomic.LoadUint64(&m.afterLocalAddrCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "2dd5583f8f842e7e307eb160a29a64d8", "score": "0.4760054", "text": "func (o LookupAclTokenResultOutput) Local() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupAclTokenResult) bool { return v.Local }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "221fe774b19ca0ad50508ef293e81d6e", "score": "0.47537395", "text": "func (f *Forwarder) isLocalKubeCluster(sess *clusterSession) bool {\n\tswitch f.cfg.KubeServiceType {\n\tcase KubeService:\n\t\t// Kubernetes service is always local.\n\t\treturn true\n\tcase LegacyProxyService:\n\t\t// remote clusters are always forwarded to the final destination.\n\t\tif sess.authContext.teleportCluster.isRemote {\n\t\t\treturn false\n\t\t}\n\t\t// Legacy proxy service is local only if the kube cluster name matches\n\t\t// with clusters served by this agent.\n\t\t_, err := f.findKubeDetailsByClusterName(sess.authContext.kubeClusterName)\n\t\treturn err == nil\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "90edf9c0f344a9ec734c9f84b09527cc", "score": "0.47512075", "text": "func (m *MockPlayerConn) LocalAddr() net.Addr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}", "title": "" }, { "docid": "1bbe06e968796e158da287762f464f3c", "score": "0.4721767", "text": "func forwardRequest(res http.ResponseWriter, req *http.Request) {\n\t// parse the url\n\turl, _ := url.Parse(\"http://localhost:\"+SERVICE_PORT)\n\n\t// create the reverse proxy\n\tproxy := httputil.NewSingleHostReverseProxy(url)\n\n\t// Update the headers to allow for SSL redirection\n\treq.URL.Host = url.Host\n\treq.URL.Scheme = url.Scheme\n\treq.Header.Set(\"X-Forwarded-Host\", req.Header.Get(\"Host\"))\n\treq.Host = url.Host\n\n\t// Note that ServeHttp is non blocking and uses a go routine under the hood\n\tproxy.ServeHTTP(res, req)\n}", "title": "" }, { "docid": "2e10fc6a3c14c6f6860e1b9a63d27040", "score": "0.4707629", "text": "func (f *Forwarder) portForward(authCtx *authContext, w http.ResponseWriter, req *http.Request, p httprouter.Params) (any, error) {\n\tctx, span := f.cfg.tracer.Start(\n\t\treq.Context(),\n\t\t\"kube.Forwarder/portForward\",\n\t\toteltrace.WithSpanKind(oteltrace.SpanKindServer),\n\t\toteltrace.WithAttributes(\n\t\t\tsemconv.RPCServiceKey.String(f.cfg.KubeServiceType),\n\t\t\tsemconv.RPCMethodKey.String(\"portForward\"),\n\t\t\tsemconv.RPCSystemKey.String(\"kube\"),\n\t\t),\n\t)\n\tdefer span.End()\n\n\tf.log.Debugf(\"Port forward: %v. req headers: %v.\", req.URL.String(), req.Header)\n\tsess, err := f.newClusterSession(ctx, *authCtx)\n\tif err != nil {\n\t\t// This error goes to kubernetes client and is not visible in the logs\n\t\t// of the teleport server if not logged here.\n\t\tf.log.Errorf(\"Failed to create cluster session: %v.\", err)\n\t\treturn nil, trace.Wrap(err)\n\t}\n\t// sess.Close cancels the connection monitor context to release it sooner.\n\t// When the server is under heavy load it can take a while to identify that\n\t// the underlying connection is gone. This change prevents that and releases\n\t// the resources as soon as we know the session is no longer active.\n\tdefer sess.close()\n\n\tsess.forwarder, err = f.makeSessionForwarder(sess)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tif err := f.setupForwardingHeaders(sess, req, true /* withImpersonationHeaders */); err != nil {\n\t\tf.log.Debugf(\"DENIED Port forward: %v.\", req.URL.String())\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tdialer, err := f.getDialer(*authCtx, sess, req)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tonPortForward := func(addr string, success bool) {\n\t\tif sess.noAuditEvents {\n\t\t\treturn\n\t\t}\n\t\tportForward := &apievents.PortForward{\n\t\t\tMetadata: apievents.Metadata{\n\t\t\t\tType: events.PortForwardEvent,\n\t\t\t\tCode: events.PortForwardCode,\n\t\t\t},\n\t\t\tUserMetadata: authCtx.eventUserMeta(),\n\t\t\tConnectionMetadata: apievents.ConnectionMetadata{\n\t\t\t\tLocalAddr: sess.kubeAddress,\n\t\t\t\tRemoteAddr: req.RemoteAddr,\n\t\t\t\tProtocol: events.EventProtocolKube,\n\t\t\t},\n\t\t\tAddr: addr,\n\t\t\tStatus: apievents.Status{\n\t\t\t\tSuccess: success,\n\t\t\t},\n\t\t}\n\t\tif !success {\n\t\t\tportForward.Code = events.PortForwardFailureCode\n\t\t}\n\t\tif err := f.cfg.StreamEmitter.EmitAuditEvent(f.ctx, portForward); err != nil {\n\t\t\tf.log.WithError(err).Warn(\"Failed to emit event.\")\n\t\t}\n\t}\n\n\tq := req.URL.Query()\n\trequest := portForwardRequest{\n\t\tpodNamespace: p.ByName(\"podNamespace\"),\n\t\tpodName: p.ByName(\"podName\"),\n\t\tports: q[\"ports\"],\n\t\tcontext: ctx,\n\t\thttpRequest: req,\n\t\thttpResponseWriter: w,\n\t\tonPortForward: onPortForward,\n\t\ttargetDialer: dialer,\n\t\tpingPeriod: f.cfg.ConnPingPeriod,\n\t}\n\tf.log.Debugf(\"Starting %v.\", request)\n\terr = runPortForwarding(request)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tf.log.Debugf(\"Done %v.\", request)\n\treturn nil, nil\n}", "title": "" }, { "docid": "8b86d262315649789b7304ddbd1f1c72", "score": "0.46908346", "text": "func (dp DevPlumbing) Forward(url string) string {\n\ttranslated, hasURL := dp.URLMap[url]\n\tif !hasURL {\n\t\tpanic(fmt.Sprintf(\"DevPlumbing: %q has no forward mapping\", url))\n\t}\n\treturn translated\n}", "title": "" }, { "docid": "c7c1f947c39b16b5e003131cc6856b23", "score": "0.46838704", "text": "func TestRsyncRemoteSourceLocalDest(t *testing.T) {\n\tcfg := &config.Config{\n\t\tName: \"fake\",\n\t\tSourceHost: \"srchost\",\n\t\tSourceDir: \"/tmp/a\",\n\t\tDestDir: \"/tmp/b\",\n\t\tTransport: \"rsync\",\n\t\tLogfile: \"/dev/null\",\n\t}\n\trsyncTest(t, cfg, rsyncTestCmd+\" srchost:/tmp/a /tmp/b\", false, false)\n}", "title": "" }, { "docid": "3bd302df82903bb77531dca4d7895976", "score": "0.4677167", "text": "func (m *Message) IsForwarded() bool {\r\n\treturn m.ForwardFrom != nil\r\n}", "title": "" }, { "docid": "823698b648ead16566f8ccefca126c10", "score": "0.46619883", "text": "func (m *MockConnection) LocalAddr() net.Addr {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}", "title": "" }, { "docid": "6e7208c29a2afb6df81e610f8bfa0caa", "score": "0.4659296", "text": "func (m *ConnMock) MinimockRemoteAddrInspect() {\n\tfor _, e := range m.RemoteAddrMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\tm.t.Error(\"Expected call to ConnMock.RemoteAddr\")\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.RemoteAddrMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterRemoteAddrCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ConnMock.RemoteAddr\")\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcRemoteAddr != nil && mm_atomic.LoadUint64(&m.afterRemoteAddrCounter) < 1 {\n\t\tm.t.Error(\"Expected call to ConnMock.RemoteAddr\")\n\t}\n}", "title": "" }, { "docid": "59336b8ccb2ff817ed6e3ebc84774bb8", "score": "0.4650651", "text": "func (c *mockEvConn) RemoteAddr() net.Addr {\n\treturn nil\n}", "title": "" }, { "docid": "ad7d47b0d37f503425d402da31169a81", "score": "0.4650354", "text": "func (a *NetAddr) IsLocal() bool {\n\thost, _, err := net.SplitHostPort(a.Addr)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn IsLocalhost(host)\n}", "title": "" }, { "docid": "2a54f22219373e3e2440cc409f8967f7", "score": "0.46409363", "text": "func RemoteHost(r *http.Request) string {\n\thost, _, _ := net.SplitHostPort(r.RemoteAddr)\n\treturn host\n}", "title": "" }, { "docid": "54e995d989e3f0a8e0919dbf345a35a3", "score": "0.46399662", "text": "func (e *Expectation) AndPassthroughToLocalCommand(path string) *Expectation {\n\te.Lock()\n\tdefer e.Unlock()\n\te.passthroughPath = path\n\treturn e\n}", "title": "" }, { "docid": "32fd39f14fe7ca0fe01ba61f41ef10d8", "score": "0.46397358", "text": "func (c *Client) PullToLocal(src, dst, profile, id string) bool {\n\tcmd := exec.Command(\"livepeer\", \"-pull\", src, \"-recordingDir\", dst, \"-transcodingOptions\", profile, \"-orchAddr\", settings.LivepeerSetting.Broadcaster, \"-streamName\", id, \"-v\", \"99\")\n\tvar stdBuffer bytes.Buffer\n\tmw := io.MultiWriter(os.Stdout, &stdBuffer)\n\tcmd.Stdout = mw\n\tcmd.Stderr = mw\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlogging.Info(fmt.Sprintf(\"cmd.Start() failed with '%s'\\n\", err))\n\t\treturn false\n\t}\n\n\terr = cmd.Wait()\n\tif err != nil {\n\t\tlogging.Info(fmt.Sprintf(\"cmd.Run() failed with %s\\n\", err))\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "fbd8b3811552bbcdb27e68713f0ff592", "score": "0.46393117", "text": "func (client *ClientTask) teamServerForward(msgID uint16, packetNo uint32, bMsgBody []byte) error {\n\tssMsg := &SSMessageBody{\n\t\tMessageID: msgID,\n\t\tPacketNo: packetNo,\n\t\tSrcAccountID: client.AccountID,\n\t\tDstAccountID: client.AccountID,\n\t\tGSID: client.GSID,\n\t\tBody: bMsgBody,\n\t}\n\treturn SendMessageToRouter(EntityType_TeamSvr, client.TSID, ssMsg)\n}", "title": "" }, { "docid": "48670af0d521f9aefbcc301bf3316177", "score": "0.46361125", "text": "func isLocalAddress(ip string) bool {\n\t_, ok := hostIPs[ip]\n\treturn ok\n}", "title": "" }, { "docid": "d74b5cac9bc4618c36fa8068eb9b64aa", "score": "0.462474", "text": "func (mr *MockFullNodeMockRecorder) ClientHasLocal(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ClientHasLocal\", reflect.TypeOf((*MockFullNode)(nil).ClientHasLocal), arg0, arg1)\n}", "title": "" }, { "docid": "400328327b083d2f42c7e0eb4e6f5e32", "score": "0.46183053", "text": "func TestRsyncLocalSourceRemoteDest(t *testing.T) {\n\tcfg := &config.Config{\n\t\tName: \"fake\",\n\t\tSourceDir: \"/tmp/a\",\n\t\tDestDir: \"/tmp/b\",\n\t\tDestHost: \"desthost\",\n\t\tTransport: \"rsync\",\n\t\tLogfile: \"/dev/null\",\n\t}\n\trsyncTest(t, cfg, rsyncTestCmd+\" /tmp/a desthost:/tmp/b\", false, false)\n}", "title": "" }, { "docid": "165e958f7d061d538d2f10ddf8ee8528", "score": "0.45892933", "text": "func (mr *MockQuicSessionMockRecorder) LocalAddr() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"LocalAddr\", reflect.TypeOf((*MockQuicSession)(nil).LocalAddr))\n}", "title": "" }, { "docid": "d2dced7ee02d139c2878386b9a046c79", "score": "0.4583787", "text": "func runPortForwarding(req portForwardRequest) error {\n\tif wsstream.IsWebSocketRequest(req.httpRequest) {\n\t\treturn trace.Wrap(runPortForwardingWebSocket(req))\n\t}\n\treturn trace.Wrap(runPortForwardingHTTPStreams(req))\n}", "title": "" }, { "docid": "82bd597085ca8c315575ed715992616d", "score": "0.45829225", "text": "func checkOrigin(r *http.Request) bool {\n\t/*\torigin := r.Header.Get(\"Origin\")\n\t\tconf := configure.ReadAllConfig()\n\t\tsrv := conf[\"tracer-server\"].(string)\n\t\tsrvs := strings.Split(srv, \":\")\n\t\tif len(srvs) != 2 {\n\t\t\treturn false\n\t\t}\n\t\turl, err := url.Parse(origin)\n\t\tif err != nil {\n\t\t\tlog.Error.Print(err)\n\t\t\treturn false\n\t\t}\n\n\t\t// Resolve the hostname from the origin.\n\t\torigina, err := net.LookupHost(url.Hostname())\n\t\tlog.Error.Printf(\"%+v\\n\", url.Hostname())\n\t\tvar origin4 string\n\t\tif len(origina) == 2 {\n\t\t\torigin4 = origina[1]\n\t\t} else {\n\t\t\torigin4 = origina[0]\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Error.Print(err)\n\t\t\treturn false\n\t\t}\n\t\t// Resolve the hostname from the configuration file.\n\t\tconfa, err := net.LookupHost(srvs[0])\n\t\tif err != nil {\n\t\t\tlog.Error.Print(err)\n\t\t\treturn false\n\t\t}\n\t\tvar conf4 string\n\t\tif len(confa) == 2 {\n\t\t\tconf4 = confa[1]\n\t\t} else {\n\t\t\tconf4 = confa[0]\n\t\t}\n\n\t\t// if there is a match between the configured host and the origin host and they share the same port, it's fine\n\t\t// if there is a match between the debug server, it's fine.\n\t\tif origin4 == conf4 && string(srv[1]) == url.Port() ||\n\t\t\torigin4 == \"127.0.0.1\" && url.Port() == \"3000\" {\n\t\t\treturn true\n\t\t}*/\n\n\treturn true\n}", "title": "" }, { "docid": "ebdf1eab6879501be48772aec34e9264", "score": "0.4579917", "text": "func (f FreeSpace) IsRemoteRule() bool { return false }", "title": "" }, { "docid": "6ca1d33c6240ee23918cee883486cf95", "score": "0.4571111", "text": "func resolveToLocalContractAddr(ctx contract.StaticContext, foreignContractAddr loom.Address) (loom.Address, error) {\n\tvar mapping ContractAddressMapping\n\tif err := ctx.Get(contractAddrMappingKey(foreignContractAddr), &mapping); err != nil {\n\t\treturn loom.Address{}, err\n\t}\n\treturn loom.UnmarshalAddressPB(mapping.To), nil\n}", "title": "" }, { "docid": "6d333b80efed927da306f02cb8663ed9", "score": "0.45693955", "text": "func (m *MockQuicSession) RemoteAddr() net.Addr {\n\tret := m.ctrl.Call(m, \"RemoteAddr\")\n\tret0, _ := ret[0].(net.Addr)\n\treturn ret0\n}", "title": "" }, { "docid": "080ec8beec1855ccf730714fe3312da5", "score": "0.45680663", "text": "func RemoteAddr(r *http.Request, f []zap.Field) []zap.Field {\n\treturn append(f, zap.String(DefaultRemoteAddrKey, r.RemoteAddr))\n}", "title": "" }, { "docid": "f7f7c06b570c28d5f30ad485427644ad", "score": "0.45547414", "text": "func (m *Manager) Forward(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) {\n\tif x.IsJSONRequest(r) {\n\t\tm.d.Writer().WriteError(w, r, err)\n\t\treturn\n\t}\n\n\tto, errCreate := m.Create(ctx, w, r, err)\n\tif errCreate != nil {\n\t\t// Everything failed. Resort to standard error output.\n\t\tm.d.Logger().WithError(errCreate).WithRequest(r).Error(\"Failed to create error container.\")\n\t\tm.d.Writer().WriteError(w, r, err)\n\t\treturn\n\t}\n\n\tif x.AcceptsJSON(r) {\n\t\tm.d.Writer().WriteError(w, r, err)\n\t\treturn\n\t}\n\n\thttp.Redirect(w, r, to, http.StatusSeeOther)\n}", "title": "" }, { "docid": "d1ca1b9d6eaf29db369a8135ac0b393b", "score": "0.454982", "text": "func priv_add_local_candidate_pruned(agent *NiceAgent, stream_id uint, component *NiceComponent, candidate *NiceCandidate) bool {\n\tfor i := 0; i < len(component.local_candidates); i++ {\n\t\tc := component.local_candidates[i]\n\t\tif nice_address_equal(c.base_addr, candidate.base_addr) && nice_address_equal(c.addr, candidate.addr) && c.transport == candidate.transport {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tcomponent.local_candidates = append(component.local_candidates, candidate)\n\tconn_check_add_for_local_candidate(agent, stream_id, component, candidate)\n\treturn true\n}", "title": "" }, { "docid": "c7b055cf0ea872c3b7dc572519dfd622", "score": "0.45484108", "text": "func TestGetLocalIp(t *testing.T) {\n\taddr := GetLocalIp()\n\tif addr == \"\" {\n\t\tt.Errorf(\"GetLocalIp failed.\")\n\t\treturn\n\t}\n\tt.Log(addr)\n}", "title": "" }, { "docid": "377b8493a8a7045c1120bb1d97a60a56", "score": "0.4545863", "text": "func (t *UAdminTests) TestIsLocal() {\n\texamples := []struct {\n\t\tip string\n\t\tlocal bool\n\t}{\n\t\t{\"127.0.0.1\", true},\n\t\t{\"127.1.1.1\", true},\n\t\t{\"128.0.0.1\", false},\n\t\t{\"192.168.0.1\", true},\n\t\t{\"192.168.1.1\", true},\n\t\t{\"192.168.1.255\", true},\n\t\t{\"192.168.100.1\", true},\n\t\t{\"192.168.200.1\", true},\n\t\t{\"10.0.0.1\", true},\n\t\t{\"10.0.1.1\", true},\n\t\t{\"10.1.1.1\", true},\n\t\t{\"10.100.0.1\", true},\n\t\t{\"10.100.100.1\", true},\n\t\t{\"10.100.100.100\", true},\n\t\t{\"11.0.0.1\", false},\n\t\t{\"8.8.8.8\", false},\n\t\t{\"8.8.4.4\", false},\n\t\t{\"1.1.1.1\", false},\n\t\t{\"1.1.1.100\", false},\n\t\t{\"172.16.0.1\", true},\n\t\t{\"172.17.0.1\", true},\n\t\t{\"172.18.0.1\", true},\n\t\t{\"172.19.0.1\", true},\n\t\t{\"172.20.0.1\", true},\n\t\t{\"172.21.0.1\", true},\n\t\t{\"172.22.0.1\", true},\n\t\t{\"172.23.0.1\", true},\n\t\t{\"172.24.0.1\", true},\n\t\t{\"172.25.0.1\", true},\n\t\t{\"172.26.0.1\", true},\n\t\t{\"172.27.0.1\", true},\n\t\t{\"172.28.0.1\", true},\n\t\t{\"172.29.0.1\", true},\n\t\t{\"172.30.0.1\", true},\n\t\t{\"172.31.0.1\", true},\n\t\t{\"172.15.0.1\", false},\n\t\t{\"172.32.0.1\", false},\n\t\t{\"[::1]\", true},\n\t\t{\"[::2]\", true},\n\t\t{\"[::f]\", true},\n\t\t{\"[::ffff]\", true},\n\t\t{\"[fc::1]\", true},\n\t\t{\"[fd::1]\", true},\n\t\t{\"[2400::1]\", false},\n\t\t{\"[2401::1]\", false},\n\t\t{\"[2401::100]\", false},\n\t\t{\"[2401::ffff]\", false},\n\t\t{\"[2401:1::ffff]\", false},\n\t\t{\"[2401:ffff:1::ffff]\", false},\n\t\t{\"a.32.0.1\", false},\n\t\t{\"172.a.0.1\", false},\n\t\t{\"172.32.a.1\", false},\n\t\t{\"172.32.0.a\", false},\n\t}\n\tpassedTests := 0\n\tfor _, e := range examples {\n\t\tif isLocal(e.ip) != e.local {\n\t\t\tt.Errorf(\"isLocal(%s) = %v != %v\", e.ip, isLocal(e.ip), e.local)\n\t\t} else {\n\t\t\tpassedTests++\n\t\t}\n\t}\n\tTrail(OK, \"Passed %d tests in TestIsLocal\", passedTests)\n\tif passedTests < len(examples) {\n\t\tTrail(WARNING, \"Failed %d tests in TestIsLocal\", len(examples)-passedTests)\n\t}\n}", "title": "" }, { "docid": "fd5391a2301bdfa87859dce9878296e8", "score": "0.454528", "text": "func (s *server) forwardMetadata(ctx context.Context) context.Context {\n\tconst key = \"build.bazel.remote.execution.v2.requestmetadata-bin\" // as defined by the proto\n\tif md, ok := metadata.FromIncomingContext(ctx); ok {\n\t\tif v := md.Get(key); len(v) != 0 {\n\t\t\treturn metadata.AppendToOutgoingContext(ctx, key, v[0])\n\t\t}\n\t}\n\treturn ctx\n}", "title": "" }, { "docid": "b62b15e1c7e0203981ecff38f4d232cd", "score": "0.4542359", "text": "func (_Subscribe *SubscribeCallerSession) CanForward(_sender common.Address, arg1 []byte) (bool, error) {\n\treturn _Subscribe.Contract.CanForward(&_Subscribe.CallOpts, _sender, arg1)\n}", "title": "" }, { "docid": "cce47a58ce21539920f9e0c14325b644", "score": "0.45407224", "text": "func (p *proxy) forwardCP(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg, s string, origBody ...[]byte) (forf bool) {\n\tvar (\n\t\tbody []byte\n\t\tsmap = p.owner.smap.get()\n\t)\n\tif !smap.isValid() {\n\t\terrmsg := fmt.Sprintf(\"%s must be starting up: cannot execute\", p.si)\n\t\tif msg != nil {\n\t\t\tp.writeErrStatusf(w, r, http.StatusServiceUnavailable, \"%s %s: %s\", errmsg, msg.Action, s)\n\t\t} else {\n\t\t\tp.writeErrStatusf(w, r, http.StatusServiceUnavailable, \"%s %q\", errmsg, s)\n\t\t}\n\t\treturn true\n\t}\n\tif p.settingNewPrimary.Load() {\n\t\tp.writeErrStatusf(w, r, http.StatusServiceUnavailable,\n\t\t\t\"%s is in transition, cannot process the request\", p.si)\n\t\treturn true\n\t}\n\tif smap.isPrimary(p.si) {\n\t\treturn\n\t}\n\t// We must **not** send any request body when doing HEAD request.\n\t// Otherwise, the request can be rejected and terminated.\n\tif r.Method != http.MethodHead {\n\t\tif len(origBody) > 0 && len(origBody[0]) > 0 {\n\t\t\tbody = origBody[0]\n\t\t} else if msg != nil {\n\t\t\tbody = cos.MustMarshal(msg)\n\t\t}\n\t}\n\tprimary := &p.rproxy.primary\n\tprimary.Lock()\n\tif primary.url != smap.Primary.PubNet.URL {\n\t\tprimary.url = smap.Primary.PubNet.URL\n\t\tuparsed, err := url.Parse(smap.Primary.PubNet.URL)\n\t\tcos.AssertNoErr(err)\n\t\tconfig := cmn.GCO.Get()\n\t\tprimary.rp = httputil.NewSingleHostReverseProxy(uparsed)\n\t\tprimary.rp.Transport = cmn.NewTransport(cmn.TransportArgs{\n\t\t\tUseHTTPS: config.Net.HTTP.UseHTTPS,\n\t\t\tSkipVerify: config.Net.HTTP.SkipVerify,\n\t\t})\n\t\tprimary.rp.ErrorHandler = p.rpErrHandler\n\t}\n\tprimary.Unlock()\n\tif len(body) > 0 {\n\t\tdebug.AssertFunc(func() bool {\n\t\t\tl, _ := io.Copy(io.Discard, r.Body)\n\t\t\treturn l == 0\n\t\t})\n\n\t\tr.Body = io.NopCloser(bytes.NewBuffer(body))\n\t\tr.ContentLength = int64(len(body)) // Directly setting `Content-Length` header.\n\t}\n\tif cmn.FastV(5, cos.SmoduleAIS) {\n\t\tpname := smap.Primary.StringEx()\n\t\tif msg != nil {\n\t\t\tnlog.Infof(\"%s: forwarding \\\"%s:%s\\\" to the primary %s\", p, msg.Action, s, pname)\n\t\t} else {\n\t\t\tnlog.Infof(\"%s: forwarding %q to the primary %s\", p, s, pname)\n\t\t}\n\t}\n\tprimary.rp.ServeHTTP(w, r)\n\treturn true\n}", "title": "" }, { "docid": "1e121a6e8c5847563b10d8c283ffb3db", "score": "0.45388833", "text": "func HTTPLocal(httpAddr string, remoteAddr string, shadow func(net.Conn) net.Conn) {\n\t// proxy server 地址\n\tproxyServerAddr, err := net.ResolveTCPAddr(\"tcp\", remoteAddr)\n\tif err != nil {\n\t\tutils.Logger.Error(err)\n\t}\n\tutils.Logger.Debug(\"连接远程服务器: \", remoteAddr+\"....\")\n\n\t// 监听本地\n\tlistenAddr, err := net.ResolveTCPAddr(\"tcp\", httpAddr)\n\tif err != nil {\n\t\tutils.Logger.Error(err)\n\t}\n\tutils.Logger.Debug(\"监听本地端口: \", httpAddr)\n\n\tlistener, err := net.ListenTCP(\"tcp\", listenAddr)\n\tif err != nil {\n\t\tutils.Logger.Error(err)\n\t}\n\n\tfor {\n\t\tclient, err := listener.AcceptTCP()\n\t\tif err != nil {\n\t\t\tutils.Logger.Error(err)\n\t\t}\n\n\t\tgo handleProxyRequest(client, proxyServerAddr, shadow)\n\t}\n}", "title": "" }, { "docid": "624ea6e0f26c71af9df1ba7a0e2d2e1a", "score": "0.4538384", "text": "func ForwardedByGrpcGateway(ctx context.Context) bool {\n\tmeta, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn false\n\t}\n\n\treturn forwardedByGrpcGateway(meta)\n}", "title": "" }, { "docid": "ba9fe5c09fd1d59b788aff1647c0ebd0", "score": "0.4538027", "text": "func (r *Router) fwdLocalIFID(rp *rpkt.RtrPkt, ifid common.IFIDType) {\n\t// Create ScnPkt from RtrPkt\n\tspkt, err := rp.ToScnPkt(true)\n\tif err != nil {\n\t\tlog.Error(\"Error generating ScnPkt from RtrPkt\", \"err\", err)\n\t\treturn\n\t}\n\tctx := rctx.Get()\n\tintf := ctx.Conf.Net.IFs[ifid]\n\t// Set remote BR as Dst\n\tspkt.DstIA = intf.RemoteIA\n\tspkt.DstHost = addr.HostFromIP(intf.RemoteAddr.IP)\n\tif spkt.Path != nil && len(spkt.Path.Raw) > 0 {\n\t\tlog.Error(\"Error forwarding IFID packet: Path is present on ScnPkt.\")\n\t\treturn\n\t}\n\tsrcPort := intf.IFAddr.PublicAddrInfo(intf.IFAddr.Overlay).L4Port\n\tspkt.L4 = &l4.UDP{SrcPort: uint16(srcPort), DstPort: uint16(intf.RemoteAddr.L4Port)}\n\t// Convert back to RtrPkt\n\tfwdrp, err := rpkt.RtrPktFromScnPkt(spkt, rcmn.DirExternal, ctx)\n\tif err != nil {\n\t\tlog.Error(\"Error generating RtrPkt from ScnPkt\", \"err\", err)\n\t\treturn\n\t}\n\t// Forward to remote BR directly\n\tfwdrp.Egress = append(fwdrp.Egress, rpkt.EgressPair{S: ctx.ExtSockOut[ifid]})\n\tfwdrp.Route()\n}", "title": "" }, { "docid": "7d609b094241658650462d64d032bb39", "score": "0.4537704", "text": "func (p *proxyrunner) forwardCP(w http.ResponseWriter, r *http.Request, msg *cmn.ActionMsg, s string, body []byte) (forf bool) {\n\tsmap := p.smapowner.get()\n\tif smap == nil || !smap.isValid() {\n\t\ts := fmt.Sprintf(\"%s must be starting up: cannot execute %s:%s\", p.si, msg.Action, s)\n\t\tp.invalmsghdlr(w, r, s)\n\t\treturn true\n\t}\n\tif smap.isPrimary(p.si) {\n\t\treturn\n\t}\n\tif body == nil {\n\t\tvar err error\n\t\tbody, err = jsoniter.Marshal(msg)\n\t\tcmn.AssertNoErr(err)\n\t}\n\tp.rproxy.Lock()\n\tif p.rproxy.u != smap.ProxySI.PublicNet.DirectURL {\n\t\tp.rproxy.u = smap.ProxySI.PublicNet.DirectURL\n\t\tuparsed, err := url.Parse(smap.ProxySI.PublicNet.DirectURL)\n\t\tcmn.AssertNoErr(err)\n\t\tp.rproxy.p = httputil.NewSingleHostReverseProxy(uparsed)\n\t\tp.rproxy.p.Transport = cmn.NewTransport(cmn.ClientArgs{\n\t\t\tUseHTTPS: cmn.GCO.Get().Net.HTTP.UseHTTPS,\n\t\t})\n\t}\n\tp.rproxy.Unlock()\n\tif len(body) > 0 {\n\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n\t\tr.ContentLength = int64(len(body)) // directly setting content-length\n\t}\n\tglog.Infof(\"%s: forwarding '%s:%s' to the primary %s\", pname(p.si), msg.Action, s, smap.ProxySI)\n\tp.rproxy.p.ServeHTTP(w, r)\n\treturn true\n}", "title": "" }, { "docid": "289f671266d8b115a33cbe4170135c16", "score": "0.45337152", "text": "func (pb *PBServer) ForwardGet(sargs *GetSyncArgs, sreply *GetSyncReply) error {\n\n\tpb.rwm.Lock()\n\tdefer pb.rwm.Unlock()\n\n\tif sargs.Primary != pb.currview.Primary {\n\t\t// the backup first need to check if the primary is still the current primary\n\t\t// e.g. split-brain: {s1, s3} -> s1 dies -> {s3, s2} -> s1 revokes\n\t\t// -> s1 still receives some requests from client -> so s1 forward to its cache backup, s3\n\t\t// -> s3 will tell s1 that \"you are no longer the current primary now\"\n\t\t// -> so finally s1 will reject the client's request\n\t\tsreply.Err = \"ForwardTest: SENDER IS NOT CURRENT PRIMARY\"\n\t\treturn errors.New(\"ForwardTest: SENDER IS NOT CURRENT PRIMARY\")\n\t} else {\n\t\t// if it is the primary, then we do Get normally\n\t\tsreply.Value = pb.database[sargs.Key]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f681987edccedae2dcdf84afd70f440", "score": "0.4533296", "text": "func (r *testNeighborResolver) fakeRequest(addr tcpip.Address) {\n\tif entry, ok := r.entries.entryByAddr(addr); ok {\n\t\tr.neigh.handleConfirmation(addr, entry.LinkAddr, ReachabilityConfirmationFlags{\n\t\t\tSolicited: true,\n\t\t\tOverride: false,\n\t\t\tIsRouter: false,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "e690e30515825a789462d15932befe5f", "score": "0.45284674", "text": "func (self *Coordinator) ConnectToRemote(address []byte) {\n \n}", "title": "" }, { "docid": "616baf6d529aa7e75ebb7561ee8fe2a9", "score": "0.4525832", "text": "func (m *Message) IsForwarded() bool {\n\treturn m.OriginalSender != nil || m.OriginalChat != nil\n}", "title": "" }, { "docid": "930e547d7d63c3a5e4494c57de86f6f8", "score": "0.45250952", "text": "func (g *Gossiper) SendLocalResults(origin string, results []*SearchResult) error {\n\treply := SearchReply{\n\t\tOrigin: g.Name,\n\t\tDestination: origin,\n\t\tHopLimit: g.HopLimit,\n\t\tResults: results,\n\t}\n\tgp := GossipPacket{SearchReply: &reply}\n\taddr := g.FindPath(origin)\n\tif addr == \"\" {\n\t\tlog.Error(\"Could not find path to the node\")\n\t\treturn errors.New(\"Unknown destination\")\n\t}\n\n\terr := g.SendTo(addr, gp)\n\tif err != nil {\n\t\tlog.Error(\"Could not send search reply : \", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc4effbb591b1a83724528f206e01c32", "score": "0.45224974", "text": "func (tc *Conn) LocalAddr() net.Addr { return nil }", "title": "" }, { "docid": "3d4f6bbbb7a12bd42ecdb5ca475e10cf", "score": "0.45213804", "text": "func (k *KubectlForwarder) Forward(parentCtx context.Context, pfe *portForwardEntry) error {\n\terrChan := make(chan error, 1)\n\tgo k.forward(parentCtx, pfe, errChan)\n\tl := log.Entry(parentCtx)\n\tresourceName := \"\"\n\tif pfe != nil {\n\t\tresourceName = pfe.resource.Name\n\t}\n\tl.Tracef(\"KubectlForwarder.Forward(%s): waiting on errChan\", resourceName)\n\tselect {\n\tcase <-parentCtx.Done():\n\t\tl.Tracef(\"KubectlForwarder.Forward(%s): parentCtx canceled, returning nil error\", resourceName)\n\t\treturn nil\n\tcase err := <-errChan:\n\t\tl.Tracef(\"KubectlForwarder.Forward(%s): got error on errChan, returning: %+v\", resourceName, err)\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "501dad43f7776e6102202f61ef450c2b", "score": "0.4518994", "text": "func (process *TeleportProcess) newLocalCacheForRemoteProxy(clt auth.ClientI, cacheName []string) (auth.RemoteProxyAccessPoint, error) {\n\t// if caching is disabled, return access point\n\tif !process.Config.CachePolicy.Enabled {\n\t\treturn clt, nil\n\t}\n\n\tcache, err := process.NewLocalCache(clt, cache.ForRemoteProxy, cacheName)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn auth.NewRemoteProxyWrapper(clt, cache), nil\n}", "title": "" }, { "docid": "06cdc29f9f0faa477509c467f007cc9b", "score": "0.4518708", "text": "func (tx *Transaction) ResolveRemoteHost() {\n tx.Mux.Lock()\n defer tx.Mux.Unlock()\n addr, err := net.LookupAddr(\"198.252.206.16\")\n if err != nil{\n return\n }\n //TODO: ADD CACHE\n tx.Collections[\"remote_host\"].AddToKey(\"\", addr[0])\n}", "title": "" }, { "docid": "0aa5dd8db1f3645f989faf667bb959a3", "score": "0.45154813", "text": "func (p *Pkcs11Security) RemoteSignRequest(ctx context.Context, str []byte) (signed []byte, err error) {\n\treturn nil, fmt.Errorf(\"pkcs11 security provider does not support remote signing requests\")\n}", "title": "" }, { "docid": "113be03bf73cf0a23b52140c904da771", "score": "0.45134953", "text": "func (mr *MockConnMockRecorder) LocalPeer() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"LocalPeer\", reflect.TypeOf((*MockConn)(nil).LocalPeer))\n}", "title": "" }, { "docid": "678e5b2fda37fec9b9466b46ea1ff795", "score": "0.45119265", "text": "func (mmLocalAddr *mConnMockLocalAddr) Inspect(f func()) *mConnMockLocalAddr {\n\tif mmLocalAddr.mock.inspectFuncLocalAddr != nil {\n\t\tmmLocalAddr.mock.t.Fatalf(\"Inspect function is already set for ConnMock.LocalAddr\")\n\t}\n\n\tmmLocalAddr.mock.inspectFuncLocalAddr = f\n\n\treturn mmLocalAddr\n}", "title": "" }, { "docid": "386546d1d3ee967f5064304c29eaafc1", "score": "0.45065168", "text": "func (resp *Response) LocalAddr() net.Addr {\n\treturn resp.laddr\n}", "title": "" }, { "docid": "9a8787ada06fb7cb9531209931c0512e", "score": "0.45043582", "text": "func establishReverseRPC(user UserInfo) {\n\tgo listen(user.LocalIP)\n\n\treply := false\n\terr := connToServer.Call(\"ServerRPC.EstablishReverseRPC\", user, &reply)\n\tif err != nil {\n\t\tfmt.Printf(\"dfslib: Unable to establish reverse RPC connection, err [%s]\\n\", err.Error())\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "8e99d37ec967294aae6c4b3fee0eee40", "score": "0.4504091", "text": "func (f *Forwarder) remoteExec(ctx *authContext, w http.ResponseWriter, req *http.Request, p httprouter.Params, sess *clusterSession, request remoteCommandRequest, proxy *remoteCommandProxy) (resp any, err error) {\n\tdefer proxy.Close()\n\n\texecutor, err := f.getExecutor(*ctx, sess, req)\n\tif err != nil {\n\t\tf.log.WithError(err).Warning(\"Failed creating executor.\")\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tstreamOptions := proxy.options()\n\terr = executor.StreamWithContext(req.Context(), streamOptions)\n\t// send the status back to the client when forwarding mode is enabled\n\t// sendStatus sends a payload even if the error is nil to make sure the client\n\t// receives the status and can close the connection.\n\tif sendErr := proxy.sendStatus(err); sendErr != nil {\n\t\tf.log.WithError(sendErr).Warning(\"Failed to send status. Exec command was aborted by client.\")\n\t}\n\tif err != nil {\n\t\tf.log.WithError(err).Warning(\"Executor failed while streaming.\")\n\t\t// do not return the error otherwise the fwd.withAuth interceptor will try to write it into a hijacked connection\n\t\treturn nil, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "083b29514fb912e1982a908fd9f156b3", "score": "0.45039028", "text": "func GetRemoteAddressFromRequest(r *http.Request) (addr string, err error) {\n\tvar (\n\t\tremoteAddr string\n\t)\n\n\tremoteAddr, _, err = net.SplitHostPort(r.RemoteAddr)\n\n\tif err != nil {\n\t\t// Something's very wrong with the request\n\t\treturn \"\", err\n\t}\n\n\taddr = r.Header.Get(\"X-Real-IP\")\n\n\tif len(addr) == 0 {\n\t\taddr = r.Header.Get(\"X-Forwarded-For\")\n\t}\n\n\t// Could not get IP from headers\n\tif len(addr) == 0 {\n\t\taddr = remoteAddr\n\t} else if !IsLocalNetworkString(remoteAddr) { // IP is from headers, check whether we can trust it\n\t\t// Nope, use remote address instead\n\t\taddr = remoteAddr\n\t}\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "33298ceb9b5b0de42a9d308df10f9a0b", "score": "0.44995132", "text": "func (o VpcPeeringConnectionAccepterAccepterOutput) AllowRemoteVpcDnsResolution() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v VpcPeeringConnectionAccepterAccepter) *bool { return v.AllowRemoteVpcDnsResolution }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "d4e7a751bb3cc355d80060f4de32efc7", "score": "0.44986752", "text": "func sameLocalAddrs(addr1, addr2 string) (bool, error) {\n\n\t// Extract host & port from given parameters\n\thost1, port1, err := extractHostPort(addr1)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\thost2, port2, err := extractHostPort(addr2)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar addr1Local, addr2Local bool\n\n\tif host1 == \"\" {\n\t\t// If empty host means it is localhost\n\t\taddr1Local = true\n\t} else {\n\t\t// Host not empty, check if it is local\n\t\tif addr1Local, err = isLocalHost(host1); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\tif host2 == \"\" {\n\t\t// If empty host means it is localhost\n\t\taddr2Local = true\n\t} else {\n\t\t// Host not empty, check if it is local\n\t\tif addr2Local, err = isLocalHost(host2); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t// If both of addresses point to the same machine, check if\n\t// have the same port\n\tif addr1Local && addr2Local {\n\t\tif port1 == port2 {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "833a289137381f79b2b5e3856dd495dd", "score": "0.44962886", "text": "func (c *ErrorTestingConnection) RemoteAddr() net.Addr {\n\treturn nil\n}", "title": "" }, { "docid": "348ce137f869ead9354ea1ccb34ef0a1", "score": "0.44928378", "text": "func testSendTo(ctx context.Context, dut *tb.DUT, conn *tb.UDPIPv4, remoteFD int32, wantErrno syscall.Errno) error {\n\tif wantErrno != syscall.Errno(0) {\n\t\tctx, cancel := context.WithTimeout(ctx, time.Second)\n\t\tdefer cancel()\n\t\tret, err := dut.SendToWithErrno(ctx, remoteFD, nil, 0, conn.LocalAddr())\n\n\t\tif ret != -1 {\n\t\t\treturn fmt.Errorf(\"sendto after ICMP error succeeded unexpectedly, expected (%[1]d) %[1]v\", wantErrno)\n\t\t}\n\t\tif err != wantErrno {\n\t\t\treturn fmt.Errorf(\"sendto after ICMP error resulted in error (%[1]d) %[1]v, expected (%[2]d) %[2]v\", err, wantErrno)\n\t\t}\n\t}\n\n\tdut.SendTo(remoteFD, nil, 0, conn.LocalAddr())\n\tif _, err := conn.Expect(tb.UDP{}, time.Second); err != nil {\n\t\treturn fmt.Errorf(\"did not receive UDP packet as expected: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67f3d2a29dde267fce7f2f501fee166f", "score": "0.44797426", "text": "func (m *MockConnection) LocalAddressRestored() bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"LocalAddressRestored\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "3aacfd147b145628b482c6d3b5d2109b", "score": "0.44690442", "text": "func (o VpcPeeringConnectionAccepterRequesterOutput) AllowRemoteVpcDnsResolution() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v VpcPeeringConnectionAccepterRequester) *bool { return v.AllowRemoteVpcDnsResolution }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "129006c2f8fc5cbe23b83d3cc8f48aef", "score": "0.4465869", "text": "func (t *HTTPTransport) LocalAddr() raft.ServerAddress {\n\treturn t.addr\n}", "title": "" }, { "docid": "4095611cb98e8444f3d29887176e02ab", "score": "0.4464208", "text": "func (pb *PBServer) Forward(sargs *PutAppendSyncArgs, sreply *PutAppendSyncReply) error {\n\n\tpb.rwm.Lock()\n\tdefer pb.rwm.Unlock()\n\n\tif sargs.Primary != pb.currview.Primary {\n\t\tsreply.Err = \"ForwardTest: SENDER IS NOT CURRENT PRIMARY\"\n\t\treturn errors.New(\"ForwardTest: SENDER IS NOT CURRENT PRIMARY\")\n\t} else {\n\t\tpb.Update(sargs.Key, sargs.Value, sargs.Op, sargs.HashVal)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1461dda4599365878199bb132c6cddf", "score": "0.44633114", "text": "func (mr *MockQuicSessionMockRecorder) RemoteAddr() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RemoteAddr\", reflect.TypeOf((*MockQuicSession)(nil).RemoteAddr))\n}", "title": "" }, { "docid": "31a56ab35f3542ad1e8b9c0bf1599433", "score": "0.4457918", "text": "func (o VpcPeeringConnectionRequesterOutput) AllowRemoteVpcDnsResolution() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v VpcPeeringConnectionRequester) *bool { return v.AllowRemoteVpcDnsResolution }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "f5229056c5ea36196e5176064b45e384", "score": "0.44541138", "text": "func (m *ConnMock) MinimockRemoteAddrDone() bool {\n\tfor _, e := range m.RemoteAddrMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.RemoteAddrMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterRemoteAddrCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcRemoteAddr != nil && mm_atomic.LoadUint64(&m.afterRemoteAddrCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "49b9ad8b58d234b2dba95f85bcfa32e2", "score": "0.44533637", "text": "func (f *Forwarder) Forward(ctx context.Context, network, address string) (net.Conn, error) {\n\tif f.Timeout != 0 {\n\t\tvar cancel func()\n\t\tctx, cancel = context.WithTimeout(ctx, f.Timeout)\n\t\tdefer cancel()\n\t}\n\n\tlocalAddr, err := f.resolveAddr(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f.Bridge.Dial(ctx, localAddr, f.RemoteAddr)\n}", "title": "" } ]
d03f3159ede3af2e493c0d4de5bfd623
SetPlacementCutoverNanosFn indicates an expected call of SetPlacementCutoverNanosFn.
[ { "docid": "3234032a189800d4498617f99302939a", "score": "0.8017551", "text": "func (mr *MockOptionsMockRecorder) SetPlacementCutoverNanosFn(fn interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetPlacementCutoverNanosFn\", reflect.TypeOf((*MockOptions)(nil).SetPlacementCutoverNanosFn), fn)\n}", "title": "" } ]
[ { "docid": "9c167890d925f862bf83a3f452f844b1", "score": "0.7619864", "text": "func (mr *MockOptionsMockRecorder) PlacementCutoverNanosFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PlacementCutoverNanosFn\", reflect.TypeOf((*MockOptions)(nil).PlacementCutoverNanosFn))\n}", "title": "" }, { "docid": "bad5cdaf9afd05edfc7d8573f6cbc2c9", "score": "0.75015366", "text": "func (m *MockOptions) PlacementCutoverNanosFn() TimeNanosFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PlacementCutoverNanosFn\")\n\tret0, _ := ret[0].(TimeNanosFn)\n\treturn ret0\n}", "title": "" }, { "docid": "6f71ab9e16925b3d40b6d24d25d3c326", "score": "0.73606807", "text": "func (mr *MockPlacementMockRecorder) SetCutoverNanos(cutoverNanos interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetCutoverNanos\", reflect.TypeOf((*MockPlacement)(nil).SetCutoverNanos), cutoverNanos)\n}", "title": "" }, { "docid": "7473a825f11e07aafb08cd3bfc77f09b", "score": "0.7305671", "text": "func (m *MockOptions) SetPlacementCutoverNanosFn(fn TimeNanosFn) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetPlacementCutoverNanosFn\", fn)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "f22f243d8f6830566bf73d913f8655d3", "score": "0.72862774", "text": "func (mr *MockOptionsMockRecorder) SetShardCutoverNanosFn(fn interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetShardCutoverNanosFn\", reflect.TypeOf((*MockOptions)(nil).SetShardCutoverNanosFn), fn)\n}", "title": "" }, { "docid": "84cc1a6e96ebfb74eda34343509337a9", "score": "0.686885", "text": "func (mr *MockPlacementMockRecorder) CutoverNanos() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CutoverNanos\", reflect.TypeOf((*MockPlacement)(nil).CutoverNanos))\n}", "title": "" }, { "docid": "f2f13cc1a74f0ab4743d0633eb6578de", "score": "0.68620205", "text": "func (mr *MockOptionsMockRecorder) ShardCutoverNanosFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ShardCutoverNanosFn\", reflect.TypeOf((*MockOptions)(nil).ShardCutoverNanosFn))\n}", "title": "" }, { "docid": "3bbad7d4211fd2baaf133aba835a07fd", "score": "0.6818766", "text": "func (m *MockPlacement) SetCutoverNanos(cutoverNanos int64) Placement {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetCutoverNanos\", cutoverNanos)\n\tret0, _ := ret[0].(Placement)\n\treturn ret0\n}", "title": "" }, { "docid": "9dfa3f7cde26074565b4d0cdd6b10ec2", "score": "0.6664", "text": "func (m *MockOptions) ShardCutoverNanosFn() TimeNanosFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ShardCutoverNanosFn\")\n\tret0, _ := ret[0].(TimeNanosFn)\n\treturn ret0\n}", "title": "" }, { "docid": "1482395a71150bccdd623a4d4a93549a", "score": "0.6480262", "text": "func (m *MockOptions) SetShardCutoverNanosFn(fn TimeNanosFn) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetShardCutoverNanosFn\", fn)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "7e08b16dcf3199b171d20e88af00da37", "score": "0.64453954", "text": "func (m *MockPlacement) CutoverNanos() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CutoverNanos\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "title": "" }, { "docid": "d3404134f8ce1705ffaacbac9f541583", "score": "0.6320952", "text": "func (mr *MockOptionsMockRecorder) SetShardCutoffNanosFn(fn interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetShardCutoffNanosFn\", reflect.TypeOf((*MockOptions)(nil).SetShardCutoffNanosFn), fn)\n}", "title": "" }, { "docid": "080d0e11adb49ff301c751be8f5071ce", "score": "0.6076785", "text": "func (mr *MockOptionsMockRecorder) ShardCutoffNanosFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ShardCutoffNanosFn\", reflect.TypeOf((*MockOptions)(nil).ShardCutoffNanosFn))\n}", "title": "" }, { "docid": "6cb4de2d7cb3c6273083c3cbaff5b53f", "score": "0.58787125", "text": "func (m *MockOptions) ShardCutoffNanosFn() TimeNanosFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ShardCutoffNanosFn\")\n\tret0, _ := ret[0].(TimeNanosFn)\n\treturn ret0\n}", "title": "" }, { "docid": "c9b2f599e8611196bddaaf721d08b298", "score": "0.55821115", "text": "func (m *MockOptions) SetShardCutoffNanosFn(fn TimeNanosFn) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetShardCutoffNanosFn\", fn)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "1a0ab6a5afaff4e4ebf844d2497ab089", "score": "0.53820693", "text": "func (mr *MockOptionsMockRecorder) SetIsShardCutoverFn(fn interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetIsShardCutoverFn\", reflect.TypeOf((*MockOptions)(nil).SetIsShardCutoverFn), fn)\n}", "title": "" }, { "docid": "4400cf62c06dca6640655dfde842275a", "score": "0.52291715", "text": "func (mr *MockOptionsMockRecorder) IsShardCutoverFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IsShardCutoverFn\", reflect.TypeOf((*MockOptions)(nil).IsShardCutoverFn))\n}", "title": "" }, { "docid": "09d4d816ad51b1cb5e2ae9b707608dbf", "score": "0.5033482", "text": "func TestMovementOfUndeliveredOffset(t *testing.T) {\n\tcommon.Log(\"test\", \"\\n\\nTestMovementOfUndeliveredOffset\")\n\tnumberOfRecords := 4\n\tbucketID := uint64(rand.Int63())\n\trecords := make([]*common.Record, numberOfRecords)\n\tfor i := 0; i < numberOfRecords; i++ {\n\t\trecords[i] = &common.Record{}\n\t\trecords[i].Bucket = bucketID\n\t\tif i < numberOfRecords/2 {\n\t\t\trecords[i].Delivered = common.TimestampUint64()\n\t\t}\n\t}\n\thelper.BootstrapExhaust(t)\n\thelper.DumpRecords(records)\n\n\thelper.ExtraLongWait()\n\n\tif common.State.UndeliveredOffset != common.State.WriteOffset/2 {\n\t\tt.Fatalf(\"min offset does not move %d vs %d\", common.State.UndeliveredOffset, common.State.WriteOffset/2)\n\t}\n}", "title": "" }, { "docid": "44484fb39056918d42eb05a950fb47a3", "score": "0.49392933", "text": "func (m *MockWatcherOptions) SetOnPlacementChangedFn(value OnPlacementChangedFn) WatcherOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetOnPlacementChangedFn\", value)\n\tret0, _ := ret[0].(WatcherOptions)\n\treturn ret0\n}", "title": "" }, { "docid": "128980437554e65d58891582203acbcd", "score": "0.49241903", "text": "func (m *MockWatcherOptions) OnPlacementChangedFn() OnPlacementChangedFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OnPlacementChangedFn\")\n\tret0, _ := ret[0].(OnPlacementChangedFn)\n\treturn ret0\n}", "title": "" }, { "docid": "50d0ec57b99d029eabdea8954e0e9465", "score": "0.48775193", "text": "func (mr *MockWatcherOptionsMockRecorder) SetOnPlacementChangedFn(value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetOnPlacementChangedFn\", reflect.TypeOf((*MockWatcherOptions)(nil).SetOnPlacementChangedFn), value)\n}", "title": "" }, { "docid": "6a21f45ab883c45ae680ab58ec0973cd", "score": "0.48058733", "text": "func (m *MockOptions) IsShardCutoverFn() ShardValidateFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IsShardCutoverFn\")\n\tret0, _ := ret[0].(ShardValidateFn)\n\treturn ret0\n}", "title": "" }, { "docid": "23edd2788fa0a916aba35ebb90feb5b1", "score": "0.47973585", "text": "func (mr *MockWatcherOptionsMockRecorder) OnPlacementChangedFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnPlacementChangedFn\", reflect.TypeOf((*MockWatcherOptions)(nil).OnPlacementChangedFn))\n}", "title": "" }, { "docid": "9bf97d6e7e663600159190eeca3d32c3", "score": "0.4790117", "text": "func (m *MockOptions) SetIsShardCutoverFn(fn ShardValidateFn) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetIsShardCutoverFn\", fn)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "0bb0dfd7d2a75623a0651e0dd21dcfef", "score": "0.46512347", "text": "func (mr *MockOptionsMockRecorder) SetIsShardCutoffFn(fn interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetIsShardCutoffFn\", reflect.TypeOf((*MockOptions)(nil).SetIsShardCutoffFn), fn)\n}", "title": "" }, { "docid": "7d530e62e80cd0dc0bae917e61e6c391", "score": "0.45882386", "text": "func (mr *MockOptionsMockRecorder) IsShardCutoffFn() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IsShardCutoffFn\", reflect.TypeOf((*MockOptions)(nil).IsShardCutoffFn))\n}", "title": "" }, { "docid": "b3ab6bde49eee8f80297db2ef73bb8f2", "score": "0.45672414", "text": "func TestWatchOverlapContextCancel(t *testing.T) {\n\tf := func(clus *integration2.Cluster) {}\n\ttestWatchOverlapContextCancel(t, f)\n}", "title": "" }, { "docid": "142e12a98299e3c69f6944c406d189e7", "score": "0.4562865", "text": "func (m *MockTask) SetVisibilityTimestamp(timestamp time.Time) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetVisibilityTimestamp\", timestamp)\n}", "title": "" }, { "docid": "9e469b08671919c5764a767fc7336205", "score": "0.45400566", "text": "func (mr *MockIPlacementRepositoryMockRecorder) CreatePlacement(placement interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreatePlacement\", reflect.TypeOf((*MockIPlacementRepository)(nil).CreatePlacement), placement)\n}", "title": "" }, { "docid": "59186d75925ad256085f84db218d852e", "score": "0.45124516", "text": "func TestViewChangeWatermarksMovement(t *testing.T) {\n\tinstance := newPbftCore(0, loadConfig(), &omniProto{\n\t\tviewChangeImpl: func(v uint64) {},\n\t\tskipToImpl: func(s uint64, id []byte, replicas []uint64) {\n\t\t\tt.Fatalf(\"Should not have attempted to initiate state transfer\")\n\t\t},\n\t\tbroadcastImpl: func(b []byte) {},\n\t}, &inertTimerFactory{})\n\tinstance.activeView = false\n\tinstance.view = 1\n\tinstance.lastExec = 10\n\n\tvset := make([]*ViewChange, 3)\n\n\t// Replica 0 sent checkpoints for 10\n\tvset[0] = &ViewChange{\n\t\tH: 5,\n\t\tCset: []*ViewChange_C{\n\t\t\t{\n\t\t\t\tSequenceNumber: 10,\n\t\t\t\tId: \"ten\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// Replica 1 sent checkpoints for 10\n\tvset[1] = &ViewChange{\n\t\tH: 5,\n\t\tCset: []*ViewChange_C{\n\t\t\t{\n\t\t\t\tSequenceNumber: 10,\n\t\t\t\tId: \"ten\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// Replica 2 sent checkpoints for 10\n\tvset[2] = &ViewChange{\n\t\tH: 5,\n\t\tCset: []*ViewChange_C{\n\t\t\t{\n\t\t\t\tSequenceNumber: 10,\n\t\t\t\tId: \"ten\",\n\t\t\t},\n\t\t},\n\t}\n\n\txset := make(map[uint64]string)\n\txset[11] = \"\"\n\n\tinstance.newViewStore[1] = &NewView{\n\t\tView: 1,\n\t\tVset: vset,\n\t\tXset: xset,\n\t\tReplicaId: 1,\n\t}\n\n\tif _, ok := instance.processNewView().(viewChangedEvent); !ok {\n\t\tt.Fatalf(\"Failed to successfully process new view\")\n\t}\n\n\texpected := uint64(10)\n\tif instance.h != expected {\n\t\tt.Fatalf(\"Expected to move high watermark to %d, but picked %d\", expected, instance.h)\n\t}\n}", "title": "" }, { "docid": "0dd6ff3a051d267a0a4147faa7199b91", "score": "0.4430445", "text": "func (mr *MockIPlacementRepositoryMockRecorder) UpdatePlacement(placement interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdatePlacement\", reflect.TypeOf((*MockIPlacementRepository)(nil).UpdatePlacement), placement)\n}", "title": "" }, { "docid": "3b561e6e4c5fc72b780393fc038cc8a9", "score": "0.44111758", "text": "func (mr *MockServiceMockRecorder) Placement() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Placement\", reflect.TypeOf((*MockService)(nil).Placement))\n}", "title": "" }, { "docid": "817adf4ec5bc0edf2088587b4a98c8b1", "score": "0.43917122", "text": "func (mr *MockWatcherOptionsMockRecorder) SetStagedPlacementKey(value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetStagedPlacementKey\", reflect.TypeOf((*MockWatcherOptions)(nil).SetStagedPlacementKey), value)\n}", "title": "" }, { "docid": "9c513ee88d562692b8b6710814631086", "score": "0.4362897", "text": "func (mr *MockOperatorMockRecorder) Placement() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Placement\", reflect.TypeOf((*MockOperator)(nil).Placement))\n}", "title": "" }, { "docid": "afb09eb3e29a37b76c4c2863224bb4f3", "score": "0.4309206", "text": "func (m *MockConsumerGroupSession) MarkOffset(arg0 string, arg1 int32, arg2 int64, arg3 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"MarkOffset\", arg0, arg1, arg2, arg3)\n}", "title": "" }, { "docid": "8204ae03209d2d54cb48a4f5d5840cb2", "score": "0.42913446", "text": "func (mr *MockTaskMockRecorder) SetVisibilityTimestamp(timestamp interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetVisibilityTimestamp\", reflect.TypeOf((*MockTask)(nil).SetVisibilityTimestamp), timestamp)\n}", "title": "" }, { "docid": "971bb8b0f8a7b8e1794449d050d316a7", "score": "0.4279384", "text": "func TestPlacePieceFuncUpdatesAvailableMovePositionsForPiece(t *testing.T) {\n\tcb := CreateChessBoard()\n\tp := CreatePiece(20, \"pawn\") // Create a piece\n\tcb.PlacePiece(20, p)\n\n\tif _, ok := p.AvailPos[21]; !ok {\n\t\tt.Fatal(\"Failed to test if a placePiece() func adds/updates available move positions for a piece\")\n\t}\n}", "title": "" }, { "docid": "23a6306c0c4a6ce5070042780583ad1f", "score": "0.42632315", "text": "func TestProviderTargetDurationSetting(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tskip.WithIssue(t, closedts.IssueTrackingRemovalOfOldClosedTimestampsCode)\n\n\tst := cluster.MakeTestingClusterSettings()\n\tclosedts.TargetDuration.Override(&st.SV, time.Millisecond)\n\tclosedts.CloseFraction.Override(&st.SV, 1.0)\n\n\tstopper := stop.NewStopper()\n\tstorage := &providertestutils.TestStorage{}\n\tdefer stopper.Stop(context.Background())\n\n\tvar ts int64 // atomic\n\tvar called int\n\tcalledCh := make(chan struct{})\n\tcfg := &provider.Config{\n\t\tNodeID: 1,\n\t\tSettings: st,\n\t\tStopper: stopper,\n\t\tStorage: storage,\n\t\tClock: func(roachpb.NodeID) (hlc.Timestamp, ctpb.Epoch, error) {\n\t\t\treturn hlc.Timestamp{}, 1, nil\n\t\t},\n\t\tClose: func(next hlc.Timestamp, expCurEpoch ctpb.Epoch) (hlc.Timestamp, map[roachpb.RangeID]ctpb.LAI, bool) {\n\t\t\tif called++; called == 1 {\n\t\t\t\tclosedts.TargetDuration.Override(&st.SV, 0)\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase calledCh <- struct{}{}:\n\t\t\tcase <-stopper.ShouldQuiesce():\n\t\t\t}\n\t\t\treturn hlc.Timestamp{\n\t\t\t\t\tWallTime: atomic.AddInt64(&ts, 1),\n\t\t\t\t}, map[roachpb.RangeID]ctpb.LAI{\n\t\t\t\t\t1: ctpb.LAI(atomic.LoadInt64(&ts)),\n\t\t\t\t}, true\n\t\t},\n\t}\n\n\tp := provider.NewProvider(cfg)\n\tp.Start()\n\n\t// Get called once. While it's being called, we set the target duration to 0,\n\t// disabling the updates. We wait someTime and ensure we don't get called\n\t// again. Then we re-enable the setting and ensure we do get called.\n\t<-calledCh\n\tconst someTime = 10 * time.Millisecond\n\tselect {\n\tcase <-calledCh:\n\t\tt.Fatal(\"expected no updates to be sent\")\n\tcase <-time.After(someTime):\n\t}\n\tclosedts.TargetDuration.Override(&st.SV, time.Millisecond)\n\t<-calledCh\n}", "title": "" }, { "docid": "7a0c53559b9452568319e9d08ccc1452", "score": "0.4239505", "text": "func (v *WorkflowExecutionInfo) IsSetDecisionScheduledTimestampNanos() bool {\n\treturn v != nil && v.DecisionScheduledTimestampNanos != nil\n}", "title": "" }, { "docid": "f1e819011089ae3009a5e4f9fcdc0fb6", "score": "0.42389026", "text": "func (mr *MockStorageMockRecorder) Placement() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Placement\", reflect.TypeOf((*MockStorage)(nil).Placement))\n}", "title": "" }, { "docid": "213d63feecaea72e566dd45cb8bd50f7", "score": "0.42376655", "text": "func (mr *MockConsumerGroupClaimMockRecorder) HighWaterMarkOffset() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"HighWaterMarkOffset\", reflect.TypeOf((*MockConsumerGroupClaim)(nil).HighWaterMarkOffset))\n}", "title": "" }, { "docid": "fded1c8b6d59a791e93282f3d632888a", "score": "0.42341578", "text": "func (v *TransferTaskInfo) IsSetVisibilityTimestampNanos() bool {\n\treturn v != nil && v.VisibilityTimestampNanos != nil\n}", "title": "" }, { "docid": "31842699101c6c87a3cad5d79c03e45f", "score": "0.42024496", "text": "func (m *MockWatcherOptions) SetStagedPlacementKey(value string) WatcherOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetStagedPlacementKey\", value)\n\tret0, _ := ret[0].(WatcherOptions)\n\treturn ret0\n}", "title": "" }, { "docid": "7357139624c4a6576f95f103f37b56a1", "score": "0.41938537", "text": "func (m *MockOptions) IsShardCutoffFn() ShardValidateFn {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IsShardCutoffFn\")\n\tret0, _ := ret[0].(ShardValidateFn)\n\treturn ret0\n}", "title": "" }, { "docid": "a001091e564e12663805f5020b8f142a", "score": "0.4187181", "text": "func (mr *MockIPlacementRepositoryMockRecorder) DeletePlacement(placement interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeletePlacement\", reflect.TypeOf((*MockIPlacementRepository)(nil).DeletePlacement), placement)\n}", "title": "" }, { "docid": "01dcf8fc022012b4effd2ba0b508d112", "score": "0.41826028", "text": "func (mr *MockConsumerGroupSessionMockRecorder) MarkOffset(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MarkOffset\", reflect.TypeOf((*MockConsumerGroupSession)(nil).MarkOffset), arg0, arg1, arg2, arg3)\n}", "title": "" }, { "docid": "83a0a4198806b8b86af40d33a8f5d79b", "score": "0.41800675", "text": "func (mr *MockPlacementMockRecorder) Clone() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Clone\", reflect.TypeOf((*MockPlacement)(nil).Clone))\n}", "title": "" }, { "docid": "47edf5d30e7d5c9fae4d7f4602c3ac34", "score": "0.41632277", "text": "func (mr *MockBastionScopeMockRecorder) SetLongRunningOperationState(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetLongRunningOperationState\", reflect.TypeOf((*MockBastionScope)(nil).SetLongRunningOperationState), arg0)\n}", "title": "" }, { "docid": "7d9439a627dd04039f63b6c89125e1e6", "score": "0.41542208", "text": "func (mr *MockWatcherOptionsMockRecorder) StagedPlacementKey() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StagedPlacementKey\", reflect.TypeOf((*MockWatcherOptions)(nil).StagedPlacementKey))\n}", "title": "" }, { "docid": "cd3fcc6208e0c7dc8aa4d832dab45c57", "score": "0.41503057", "text": "func (m *MockAlgorithm) MarkShardsAvailable(p Placement, instanceID string, shardIDs ...uint32) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{p, instanceID}\n\tfor _, a := range shardIDs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"MarkShardsAvailable\", varargs...)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e4789ce7186583f533e323b5435734ca", "score": "0.41382274", "text": "func TestRetentionMillis(t *testing.T) {\n\n\t// Test Logger\n\tlogger := logtesting.TestLogger(t).Desugar()\n\n\t// Test Data\n\tconfiguration := &commonconfig.EventingKafkaConfig{Kafka: commonconfig.EKKafkaConfig{Topic: commonconfig.EKKafkaTopicConfig{DefaultRetentionMillis: defaultRetentionMillis}}}\n\n\t// Test The Default Failover Use Case\n\tchannel := &kafkav1beta1.KafkaChannel{}\n\tactualRetentionMillis := RetentionMillis(channel, configuration, logger)\n\tassert.Equal(t, defaultRetentionMillis, actualRetentionMillis)\n\n\t// TODO - No RetentionMillis In eventing-contrib KafkaChannel\n\t//// Test The Valid RetentionMillis Use Case\n\t//channel = &kafkav1beta1.KafkaChannel{Spec: kafkav1beta1.KafkaChannelSpec{RetentionMillis: retentionMillis}}\n\t//actualRetentionMillis = RetentionMillis(channel, environment, logger)\n\t//assert.Equal(t, retentionMillis, actualRetentionMillis)\n}", "title": "" }, { "docid": "f923c96d421cf9d24da2899419868c0e", "score": "0.4125473", "text": "func (m *MockClient) SetTokenLifespans(arg0 map[fosite.TokenType]time.Duration) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetTokenLifespans\", arg0)\n}", "title": "" }, { "docid": "9d5e75e1cc767acfffe87e0680704cb4", "score": "0.4120046", "text": "func TestGenDisplaceFn(t *testing.T) {\n\tvar testCases = []struct {\n\t\tacceleration float64\n\t\tinitialVelocity float64\n\t\tinitialDisplacement float64\n\t\ttime float64\n\t\texpectedDisplacement float64\n\t}{\n\t\t{0, 0, 0, 0, 0},\n\t\t{1, 1, 1, 1, 2.5},\n\t\t// {0.235, 1.345, 98.07, 5.62, 109.340067}, // %f returns 109.340067; actual value is 109.34006699999999\n\t\t{1.435, 6.456245, 18.07, 25.459832, 647.5305981742907}, // 465.0856851234507 + 164.37491305084 + 18.07\n\t}\n\n\tfor _, testCase := range testCases {\n\t\tcomputeDisplacement := GenDisplaceFn(testCase.acceleration, testCase.initialVelocity, testCase.initialDisplacement)\n\t\tif actualDisplacement := computeDisplacement(testCase.time); actualDisplacement != testCase.expectedDisplacement {\n\t\t\tt.Errorf(\n\t\t\t\t\"Test failed. For %f acceleration, %f initialVelocity, %f initialDisplacement, %f time, %f was expected but got %f.\",\n\t\t\t\ttestCase.acceleration, testCase.initialVelocity, testCase.initialDisplacement, testCase.time, testCase.expectedDisplacement, actualDisplacement,\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "01dc9e1a176f157d8c2c854c0027015b", "score": "0.41174534", "text": "func (m *MockOptions) SetIsShardCutoffFn(fn ShardValidateFn) Options {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetIsShardCutoffFn\", fn)\n\tret0, _ := ret[0].(Options)\n\treturn ret0\n}", "title": "" }, { "docid": "e1c7cf31860d79bfe5643e124a55ad14", "score": "0.41114682", "text": "func (m *MockOperator) MarkShardsAvailable(instanceID string, shardIDs ...uint32) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{instanceID}\n\tfor _, a := range shardIDs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"MarkShardsAvailable\", varargs...)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d7deecb55eb78c924ad9d2d8eec96acd", "score": "0.4096368", "text": "func (mr *MockBastionScopeMockRecorder) ControlPlaneSubnet() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ControlPlaneSubnet\", reflect.TypeOf((*MockBastionScope)(nil).ControlPlaneSubnet))\n}", "title": "" }, { "docid": "39d644fd8554688ef3e2282146f15a82", "score": "0.40867597", "text": "func (mr *MockClientMockRecorder) SetTokenLifespans(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetTokenLifespans\", reflect.TypeOf((*MockClient)(nil).SetTokenLifespans), arg0)\n}", "title": "" }, { "docid": "ed6267ec29dc15ae30a67ba8b6b4e54b", "score": "0.4077572", "text": "func (m *MockService) MarkShardsAvailable(instanceID string, shardIDs ...uint32) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{instanceID}\n\tfor _, a := range shardIDs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"MarkShardsAvailable\", varargs...)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f1b735294585cbdf531745783ddbd982", "score": "0.40729892", "text": "func (ts *TestServer) ExpectMapExpvarDeltaWithDeadline(name, key string, want int64) func() {\n\tts.tb.Helper()\n\treturn testutil.ExpectMapExpvarDeltaWithDeadline(ts.tb, name, key, want)\n}", "title": "" }, { "docid": "f18f0177c9f2edee54856aa2519007ba", "score": "0.4043075", "text": "func (m *Mockoperations) MarkShardsAvailable(instanceID string, shardIDs ...uint32) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{instanceID}\n\tfor _, a := range shardIDs {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"MarkShardsAvailable\", varargs...)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b5d4760b2d13589b143e9bff9bc99b2d", "score": "0.4040236", "text": "func (v *ShardInfo) IsSetUpdatedAtNanos() bool {\n\treturn v != nil && v.UpdatedAtNanos != nil\n}", "title": "" }, { "docid": "1138ef6175c61a59289b2a9c34a7af3f", "score": "0.4017258", "text": "func testOverlap() {\n\tplaceClaim(1, 1, 3, 4, 4)\n\tplaceClaim(2, 3, 1, 4, 4)\n\tplaceClaim(3, 5, 5, 2, 2)\n\tprintFabric()\n\n\t// [0 0 0 0 0 0 0 0 0 0]\n\t// [0 0 0 2 2 2 2 0 0 0]\n\t// [0 0 0 2 2 2 2 0 0 0]\n\t// [0 1 1 -1 -1 2 2 0 0 0]\n\t// [0 1 1 -1 -1 2 2 0 0 0]\n\t// [0 1 1 1 1 3 3 0 0 0]\n\t// [0 1 1 1 1 3 3 0 0 0]\n\t// [0 0 0 0 0 0 0 0 0 0]\n\t// [0 0 0 0 0 0 0 0 0 0]\n\t// [0 0 0 0 0 0 0 0 0 0]\n}", "title": "" }, { "docid": "a6ffe02747862f6d35a27e31640c24f0", "score": "0.400735", "text": "func (env *DisconnectEnv) PodLossTest() {\n\tExpect(len(env.allMayastorNodes)).To(BeNumerically(\">=\", 2)) // must support >= 2 replicas\n\n\t// disable mayastor on the spare nodes so that moac cannot assign\n\t// them to the volume to replace the faulted one. We want to keep\n\t// the volume degraded before restoring the suppressed node.\n\tfor _, node := range env.unusedNodes {\n\t\tlogf.Log.Info(\"suppressing mayastor on unused node\", \"node\", node)\n\t\tSuppressMayastorPodOn(node)\n\t}\n\tlogf.Log.Info(\"removing mayastor replica\", \"node\", env.replicaToRemove)\n\tSuppressMayastorPodOn(env.replicaToRemove)\n\n\tlogf.Log.Info(\"waiting for pod removal to affect the nexus\", \"timeout\", disconnectionTimeoutSecs)\n\tEventually(func() string {\n\t\tlogf.Log.Info(\"running fio against the volume\")\n\t\t_, err := common.RunFio(env.fioPodName, 5, common.FioFsFilename)\n\t\tExpect(err).ToNot(HaveOccurred())\n\t\treturn common.GetMsvState(env.uuid)\n\t},\n\t\tdisconnectionTimeoutSecs, // timeout\n\t\t\"1s\", // polling interval\n\t).Should(Equal(\"degraded\"))\n\n\tlogf.Log.Info(\"volume condition\", \"state\", common.GetMsvState(env.uuid))\n\n\tlogf.Log.Info(\"running fio against the degraded volume\")\n\t_, err := common.RunFio(env.fioPodName, 20, common.FioFsFilename)\n\tExpect(err).ToNot(HaveOccurred())\n\n\tlogf.Log.Info(\"enabling mayastor pod\", \"node\", env.replicaToRemove)\n\tenv.UnsuppressMayastorPod()\n\n\tlogf.Log.Info(\"waiting for the volume to be repaired\", \"timeout\", repairTimeoutSecs)\n\tEventually(func() string {\n\t\tlogf.Log.Info(\"running fio while volume is being repaired\")\n\t\t_, err := common.RunFio(env.fioPodName, 5, common.FioFsFilename)\n\t\tExpect(err).ToNot(HaveOccurred())\n\t\treturn common.GetMsvState(env.uuid)\n\t},\n\t\trepairTimeoutSecs, // timeout\n\t\t\"1s\", // polling interval\n\t).Should(Equal(\"healthy\"))\n\n\tlogf.Log.Info(\"volume condition\", \"state\", common.GetMsvState(env.uuid))\n\n\tlogf.Log.Info(\"running fio against the repaired volume\")\n\t_, err = common.RunFio(env.fioPodName, 20, common.FioFsFilename)\n\tExpect(err).ToNot(HaveOccurred())\n}", "title": "" }, { "docid": "f77bac5b60f5225833f6e29fd0ca7990", "score": "0.40036666", "text": "func (mr *MockCloudWatchLogsAPIMockRecorder) PutRetentionPolicy(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutRetentionPolicy\", reflect.TypeOf((*MockCloudWatchLogsAPI)(nil).PutRetentionPolicy), arg0)\n}", "title": "" }, { "docid": "ed60b59e7dab19ca3afbba75c623d299", "score": "0.4002284", "text": "func TestShouldIgnoreTimeout(t *testing.T) {\n\tposter := Poster{} // cannot use InitPoster() directly because the test may not have k8s environment\n\n\t// create an obsolete time by subtracting the eventDurationMinutes\n\texpiredTime := util.GetExpiredTimeIn(\n\t\tutil.DefaultPacketDropExpirationMinutes)\n\ttimedOutPacketDrop := drop.PacketDrop{LogTime: expiredTime}\n\n\tresult := poster.shouldIgnore(timedOutPacketDrop)\n\tif result != true {\n\t\tt.Fatalf(\"Expected %v, but got result %v\", true, result)\n\t}\n}", "title": "" }, { "docid": "1961b60e0beed4041669dd5a4bd1a451", "score": "0.39925185", "text": "func (mr *MockIPlacementRepositoryMockRecorder) SearchPlacement(criteria interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SearchPlacement\", reflect.TypeOf((*MockIPlacementRepository)(nil).SearchPlacement), criteria)\n}", "title": "" }, { "docid": "af14997bbf2fbf6b1570a28648cab946", "score": "0.398334", "text": "func (m *MockConsumerGroupClaim) HighWaterMarkOffset() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HighWaterMarkOffset\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "title": "" }, { "docid": "a59471837b8d63e7d86f774a9e034f4a", "score": "0.39816403", "text": "func (s *OffsetTrackerSuite) TestOnAckedRanges(c *C) {\n\tot := New(s.ns, offsetmgr.Offset{Val: 300}, -1)\n\tfor i, tc := range []struct {\n\t\toffset int64\n\t\tcommitted int64\n\t\tranges string\n\t}{\n\t\t/* 0 */ {offset: 299, committed: 300, ranges: \"\"},\n\t\t/* 1 */ {offset: 300, committed: 301, ranges: \"\"},\n\t\t/* 2 */ {offset: 302, committed: 301, ranges: \"1-2\"},\n\t\t/* 3 */ {offset: 310, committed: 301, ranges: \"1-2,9-10\"},\n\t\t/* 4 */ {offset: 311, committed: 301, ranges: \"1-2,9-11\"},\n\t\t/* 5 */ {offset: 307, committed: 301, ranges: \"1-2,6-7,9-11\"},\n\t\t/* 6 */ {offset: 305, committed: 301, ranges: \"1-2,4-5,6-7,9-11\"},\n\t\t/* 7 */ {offset: 304, committed: 301, ranges: \"1-2,3-5,6-7,9-11\"},\n\t\t// Acking the an acked offset makes no difference\n\t\t/* 8 */ {offset: 305, committed: 301, ranges: \"1-2,3-5,6-7,9-11\"},\n\t\t/* 9 */ {offset: 308, committed: 301, ranges: \"1-2,3-5,6-8,9-11\"},\n\t\t/* 10 */ {offset: 303, committed: 301, ranges: \"1-5,6-8,9-11\"},\n\t\t/* 11 */ {offset: 309, committed: 301, ranges: \"1-5,6-11\"},\n\t\t/* 12 */ {offset: 306, committed: 301, ranges: \"1-11\"},\n\t\t/* 13 */ {offset: 301, committed: 312, ranges: \"\"},\n\t\t/* 14 */ {offset: 398, committed: 312, ranges: \"86-87\"},\n\t\t/* 15 */ {offset: 399, committed: 312, ranges: \"86-88\"},\n\t\t/* 16 */ {offset: 4496, committed: 312, ranges: \"86-88,4184-4185\"},\n\t\t/* 17 */ {offset: 0x7FFFFFFFFFFFFFFE, committed: 312, ranges: \"86-88,4184-4185,9223372036854775494-9223372036854775495\"},\n\t} {\n\t\t// When\n\t\toffset, _ := ot.OnAcked(tc.offset)\n\t\tot2 := New(s.ns, offset, -1)\n\n\t\t// Then\n\t\tc.Assert(offset.Val, Equals, tc.committed, Commentf(\"case: %d\", i))\n\t\tc.Assert(SparseAcks2Str(offset), Equals, tc.ranges, Commentf(\"case: %d\", i))\n\t\t// Both nil and empty slice ack ranges become nil when going through\n\t\t// the encode/decode circle.\n\t\tif ot.ackedRanges == nil || len(ot.ackedRanges) == 0 {\n\t\t\tc.Assert(ot2.ackedRanges, IsNil, Commentf(\"case: %d\", i))\n\t\t} else {\n\t\t\tc.Assert(ot2.ackedRanges, DeepEquals, ot.ackedRanges, Commentf(\"case: %d\", i))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f606a36c5cc96d8c36cab80b1ddf709", "score": "0.39803132", "text": "func (s *BaseSQLParserListener) ExitDatetime_overlaps(ctx *Datetime_overlapsContext) {}", "title": "" }, { "docid": "7acce90f0f7feff44269e6abf2b903d8", "score": "0.396574", "text": "func (mr *MockStoreMockRecorder) SetLayerScanned(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetLayerScanned\", reflect.TypeOf((*MockStore)(nil).SetLayerScanned), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "96779c3b999d2a2fb49dcdbdb461797a", "score": "0.395634", "text": "func (mr *MockStreamIMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetWriteDeadline\", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), arg0)\n}", "title": "" }, { "docid": "deb02a28b5eefd99887292a909bec41b", "score": "0.39475933", "text": "func TestShouldIgnoreSameEvent(t *testing.T) {\n\tposter := Poster{}\n\tposter.eventSubmitTimeMap = make(map[string]time.Time)\n\tcurTime := time.Now()\n\tpacketDrop := drop.PacketDrop{LogTime: curTime, SrcIP: \"1.1.1\", DstIP: \"2.2.2\"}\n\t// insert a mocked time when same event was submitted recently (within the interval threshold)\n\tposter.eventSubmitTimeMap[packetDrop.SrcIP+packetDrop.DstIP] =\n\t\tcurTime.Add(-util.DefaultRepeatedEventIntervalMinutes*time.Minute + time.Minute)\n\n\tresult := poster.shouldIgnore(packetDrop)\n\tif result != true {\n\t\tt.Fatalf(\"Expected %v, but got result %v\", true, result)\n\t}\n}", "title": "" }, { "docid": "a501ebf36bda12e25c590799b4636e43", "score": "0.39475334", "text": "func (s *BaseSQLParserListener) EnterDatetime_overlaps(ctx *Datetime_overlapsContext) {}", "title": "" }, { "docid": "cfb819c5984369e81b4a2e14d017f95a", "score": "0.3941864", "text": "func (suite *PlacementTestSuite) TestTaskPlacementNoError() {\n\ttestTask, testRuntimeDiff := createTestTask(0) // taskinfo\n\trs := createResources(float64(1))\n\thostOffer := createHostOffer(0, rs)\n\tp := createPlacements(testTask, hostOffer)\n\n\ttaskID := &peloton.TaskID{\n\t\tValue: testTask.JobId.Value + \"-\" + fmt.Sprint(testTask.InstanceId),\n\t}\n\n\tvar tasks []*mesos.TaskID\n\tfor _, t := range p.GetTaskIDs() {\n\t\ttasks = append(tasks, t.GetMesosTaskID())\n\t}\n\n\tgomock.InOrder(\n\t\tsuite.taskLauncher.EXPECT().\n\t\t\tGetLaunchableTasks(\n\t\t\t\tgomock.Any(),\n\t\t\t\ttasks,\n\t\t\t\tp.Hostname,\n\t\t\t\tp.AgentId,\n\t\t\t\tp.Ports,\n\t\t\t).Return(\n\t\t\tmap[string]*launcher.LaunchableTask{\n\t\t\t\ttaskID.Value: {\n\t\t\t\t\tRuntimeDiff: testRuntimeDiff,\n\t\t\t\t\tConfig: testTask.Config,\n\t\t\t\t},\n\t\t\t},\n\t\t\tnil,\n\t\t\tnil),\n\t\tsuite.jobFactory.EXPECT().\n\t\t\tAddJob(testTask.JobId).Return(suite.cachedJob),\n\t\tsuite.cachedJob.EXPECT().\n\t\t\tAddTask(gomock.Any(), uint32(0)).\n\t\t\tReturn(suite.cachedTask, nil),\n\t\tsuite.cachedTask.EXPECT().\n\t\t\tGetRuntime(gomock.Any()).Return(testTask.Runtime, nil),\n\t\tsuite.cachedJob.EXPECT().\n\t\t\tPatchTasks(gomock.Any(), gomock.Any(), false).\n\t\t\tReturn(nil, nil, nil),\n\t\tsuite.cachedTask.EXPECT().\n\t\t\tGetRuntime(gomock.Any()).Return(testTask.Runtime, nil),\n\t\tsuite.taskLauncher.EXPECT().\n\t\t\tLaunch(gomock.Any(), gomock.Any(), gomock.Any()).\n\t\t\tReturn(\n\t\t\t\tmap[string]*launcher.LaunchableTaskInfo{},\n\t\t\t\tnil,\n\t\t\t),\n\t\tsuite.goalStateDriver.EXPECT().\n\t\t\tEnqueueTask(testTask.JobId, testTask.InstanceId, gomock.Any()).Return(),\n\t\tsuite.jobFactory.EXPECT().\n\t\t\tAddJob(testTask.JobId).Return(suite.cachedJob),\n\t\tsuite.cachedJob.EXPECT().GetJobType().Return(job.JobType_BATCH),\n\t\tsuite.goalStateDriver.EXPECT().\n\t\t\tJobRuntimeDuration(job.JobType_BATCH).\n\t\t\tReturn(1*time.Second),\n\t\tsuite.goalStateDriver.EXPECT().\n\t\t\tEnqueueJob(testTask.JobId, gomock.Any()).Return(),\n\t)\n\n\tsuite.pp.processPlacement(context.Background(), p)\n}", "title": "" }, { "docid": "28dc78ed5159d0fdb78b88ed7515ad8d", "score": "0.39417177", "text": "func (v *WorkflowExecutionInfo) IsSetDecisionOriginalScheduledTimestampNanos() bool {\n\treturn v != nil && v.DecisionOriginalScheduledTimestampNanos != nil\n}", "title": "" }, { "docid": "7776039e1fb8ba5eceb7ce5442cda157", "score": "0.39401078", "text": "func (m *MockOperator) MarkInstanceAvailable(instanceID string) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MarkInstanceAvailable\", instanceID)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "183e0394476a12f49f6a05425fc3331c", "score": "0.39355958", "text": "func (mr *MockInnerConsumerMockRecorder) PersistConsumerOffset() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PersistConsumerOffset\", reflect.TypeOf((*MockInnerConsumer)(nil).PersistConsumerOffset))\n}", "title": "" }, { "docid": "25d07d76752561f9efa758d2ced239ba", "score": "0.39173222", "text": "func (v *ActivityInfo) IsSetScheduledTimeNanos() bool {\n\treturn v != nil && v.ScheduledTimeNanos != nil\n}", "title": "" }, { "docid": "fe11f9eb0fc9730a379c8850787359e4", "score": "0.39146358", "text": "func TestCutPanic(t *testing.T) {\n\ttest := func(start, end int) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r == nil {\n\t\t\t\t\tt.Error(\"panic, expected panic got nil\")\n\t\t\t\t}\n\t\t\t}()\n\t\t\t// len for rng is 10\n\t\t\trng := [][2]float64{{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8}, {0, 9}}\n\t\t\tcut(&rng, start, end)\n\t\t}\n\t}\n\n\tt.Run(\"bad start\", test(-1, 9))\n\tt.Run(\"bad end\", test(5, -1))\n\tt.Run(\"bad start bigger then ring\", test(11, 7))\n\tt.Run(\"bad end bigger then ring\", test(1, 11))\n\n}", "title": "" }, { "docid": "da9bb7be6c8f7d966dec64334020268b", "score": "0.39133072", "text": "func (mtr *Ptptptdintgrp2Metrics) SetPktNoEopErrSeen(val metrics.Counter) error {\n\tmtr.metrics.SetCounter(val, mtr.getOffset(\"PktNoEopErrSeen\"))\n\treturn nil\n}", "title": "" }, { "docid": "bd3ae1347506d056b572188eb524144c", "score": "0.3906321", "text": "func (mr *MockPipelineRunMockRecorder) HasDeletionTimestamp() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"HasDeletionTimestamp\", reflect.TypeOf((*MockPipelineRun)(nil).HasDeletionTimestamp))\n}", "title": "" }, { "docid": "02c6b4b831ae9f1bb61f86733859b7c4", "score": "0.38958126", "text": "func (m *MockWatcherOptions) StagedPlacementKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"StagedPlacementKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "1defba6394ef30a64cedf823a073ee49", "score": "0.3893611", "text": "func (mr *MockNatGatewayScopeMockRecorder) ControlPlaneSubnet() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ControlPlaneSubnet\", reflect.TypeOf((*MockNatGatewayScope)(nil).ControlPlaneSubnet))\n}", "title": "" }, { "docid": "b227e40f052b44c56d07fc62b9641c76", "score": "0.389032", "text": "func (m *Mockoperations) MarkInstanceAvailable(instanceID string) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MarkInstanceAvailable\", instanceID)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "02a86f66201e71cbee59766d47d1b4a6", "score": "0.38843104", "text": "func (mr *MockZoneServiceIfaceMockRecorder) EnableOutOfBandManagementForZone(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EnableOutOfBandManagementForZone\", reflect.TypeOf((*MockZoneServiceIface)(nil).EnableOutOfBandManagementForZone), p)\n}", "title": "" }, { "docid": "6aa5f937d9ae83d3c025c49570a7fc4d", "score": "0.38830364", "text": "func (m *MockOperator) Placement() Placement {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Placement\")\n\tret0, _ := ret[0].(Placement)\n\treturn ret0\n}", "title": "" }, { "docid": "308227b1cf222650b943ce0980952d49", "score": "0.38789928", "text": "func (m *MockPlacement) SetIsSharded(v bool) Placement {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetIsSharded\", v)\n\tret0, _ := ret[0].(Placement)\n\treturn ret0\n}", "title": "" }, { "docid": "3861234897760105383120a0be8d261f", "score": "0.38762552", "text": "func (mr *MockClusterClientMockRecorder) MoveManagement(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"MoveManagement\", reflect.TypeOf((*MockClusterClient)(nil).MoveManagement), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "84ca4d0c678c0946a93767f566b2b59a", "score": "0.38762233", "text": "func (_mr *MockOptionsMockRecorder) SetTruncateRequestTimeout(arg0 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"SetTruncateRequestTimeout\", reflect.TypeOf((*MockOptions)(nil).SetTruncateRequestTimeout), arg0)\n}", "title": "" }, { "docid": "72a24737e2a8d0186b44fe53ed50f0df", "score": "0.38740242", "text": "func (mr *MockOptionsMockRecorder) SetValidZone(z interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetValidZone\", reflect.TypeOf((*MockOptions)(nil).SetValidZone), z)\n}", "title": "" }, { "docid": "dc17d371439473ccea2448c41efab384", "score": "0.3873453", "text": "func (m *MockBastionScope) SetLongRunningOperationState(arg0 *v1beta1.Future) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetLongRunningOperationState\", arg0)\n}", "title": "" }, { "docid": "3b397201deb9aaf971b43610a9e1adea", "score": "0.3866534", "text": "func (mr *MockZoneServiceIfaceMockRecorder) DisableOutOfBandManagementForZone(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DisableOutOfBandManagementForZone\", reflect.TypeOf((*MockZoneServiceIface)(nil).DisableOutOfBandManagementForZone), p)\n}", "title": "" }, { "docid": "e02f5bf1d64cfb1e810f43f9e477fb09", "score": "0.38650355", "text": "func (m *MockService) MarkInstanceAvailable(instanceID string) (Placement, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MarkInstanceAvailable\", instanceID)\n\tret0, _ := ret[0].(Placement)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2da738cb4291d7fb3c55e516e026369b", "score": "0.3859684", "text": "func (mr *MockStoreMockRecorder) CleanupSegmentReservation(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CleanupSegmentReservation\", reflect.TypeOf((*MockStore)(nil).CleanupSegmentReservation), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "dbbf6b65cd5bf71a2d234666429351c8", "score": "0.3851282", "text": "func (_mr *MockAdminOptionsMockRecorder) SetTruncateRequestTimeout(arg0 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"SetTruncateRequestTimeout\", reflect.TypeOf((*MockAdminOptions)(nil).SetTruncateRequestTimeout), arg0)\n}", "title": "" }, { "docid": "e463d58ed067731fc2237cb72c573263", "score": "0.38456625", "text": "func (mr *MockStreamIMockRecorder) SetDeadline(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetDeadline\", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), arg0)\n}", "title": "" }, { "docid": "d5569de7cf24250c318eb4064253c0b1", "score": "0.38395035", "text": "func (m *MockSendAlgorithm) OnPacketLost(arg0 protocol.PacketNumber, arg1, arg2 protocol.ByteCount) {\n\tm.ctrl.Call(m, \"OnPacketLost\", arg0, arg1, arg2)\n}", "title": "" }, { "docid": "7c8ea48d7434ad50091bfa5111cbd82e", "score": "0.38394046", "text": "func TestSyncJobPastDeadline(t *testing.T) {\n\t_, ctx := ktesting.NewTestContext(t)\n\ttestCases := map[string]struct {\n\t\t// job setup\n\t\tparallelism int32\n\t\tcompletions int32\n\t\tactiveDeadlineSeconds int64\n\t\tstartTime int64\n\t\tbackoffLimit int32\n\t\tsuspend bool\n\n\t\t// pod setup\n\t\tactivePods int\n\t\tsucceededPods int\n\t\tfailedPods int\n\n\t\t// expectations\n\t\texpectedDeletions int32\n\t\texpectedActive int32\n\t\texpectedSucceeded int32\n\t\texpectedFailed int32\n\t\texpectedCondition batch.JobConditionType\n\t\texpectedConditionReason string\n\t}{\n\t\t\"activeDeadlineSeconds less than single pod execution\": {\n\t\t\tparallelism: 1,\n\t\t\tcompletions: 1,\n\t\t\tactiveDeadlineSeconds: 10,\n\t\t\tstartTime: 15,\n\t\t\tbackoffLimit: 6,\n\t\t\tactivePods: 1,\n\t\t\texpectedDeletions: 1,\n\t\t\texpectedFailed: 1,\n\t\t\texpectedCondition: batch.JobFailed,\n\t\t\texpectedConditionReason: \"DeadlineExceeded\",\n\t\t},\n\t\t\"activeDeadlineSeconds bigger than single pod execution\": {\n\t\t\tparallelism: 1,\n\t\t\tcompletions: 2,\n\t\t\tactiveDeadlineSeconds: 10,\n\t\t\tstartTime: 15,\n\t\t\tbackoffLimit: 6,\n\t\t\tactivePods: 1,\n\t\t\tsucceededPods: 1,\n\t\t\texpectedDeletions: 1,\n\t\t\texpectedSucceeded: 1,\n\t\t\texpectedFailed: 1,\n\t\t\texpectedCondition: batch.JobFailed,\n\t\t\texpectedConditionReason: \"DeadlineExceeded\",\n\t\t},\n\t\t\"activeDeadlineSeconds times-out before any pod starts\": {\n\t\t\tparallelism: 1,\n\t\t\tcompletions: 1,\n\t\t\tactiveDeadlineSeconds: 10,\n\t\t\tstartTime: 10,\n\t\t\tbackoffLimit: 6,\n\t\t\texpectedCondition: batch.JobFailed,\n\t\t\texpectedConditionReason: \"DeadlineExceeded\",\n\t\t},\n\t\t\"activeDeadlineSeconds with backofflimit reach\": {\n\t\t\tparallelism: 1,\n\t\t\tcompletions: 1,\n\t\t\tactiveDeadlineSeconds: 1,\n\t\t\tstartTime: 10,\n\t\t\tfailedPods: 1,\n\t\t\texpectedFailed: 1,\n\t\t\texpectedCondition: batch.JobFailed,\n\t\t\texpectedConditionReason: \"BackoffLimitExceeded\",\n\t\t},\n\t\t\"activeDeadlineSeconds is not triggered when Job is suspended\": {\n\t\t\tsuspend: true,\n\t\t\tparallelism: 1,\n\t\t\tcompletions: 2,\n\t\t\tactiveDeadlineSeconds: 10,\n\t\t\tstartTime: 15,\n\t\t\tbackoffLimit: 6,\n\t\t\texpectedCondition: batch.JobSuspended,\n\t\t\texpectedConditionReason: \"JobSuspended\",\n\t\t},\n\t}\n\n\tfor name, tc := range testCases {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// job manager setup\n\t\t\tclientSet := clientset.NewForConfigOrDie(&restclient.Config{Host: \"\", ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: \"\", Version: \"v1\"}}})\n\t\t\tmanager, sharedInformerFactory := newControllerFromClient(ctx, clientSet, controller.NoResyncPeriodFunc)\n\t\t\tfakePodControl := controller.FakePodControl{}\n\t\t\tmanager.podControl = &fakePodControl\n\t\t\tmanager.podStoreSynced = alwaysReady\n\t\t\tmanager.jobStoreSynced = alwaysReady\n\t\t\tvar actual *batch.Job\n\t\t\tmanager.updateStatusHandler = func(ctx context.Context, job *batch.Job) (*batch.Job, error) {\n\t\t\t\tactual = job\n\t\t\t\treturn job, nil\n\t\t\t}\n\n\t\t\t// job & pods setup\n\t\t\tjob := newJob(tc.parallelism, tc.completions, tc.backoffLimit, batch.NonIndexedCompletion)\n\t\t\tjob.Spec.ActiveDeadlineSeconds = &tc.activeDeadlineSeconds\n\t\t\tjob.Spec.Suspend = pointer.Bool(tc.suspend)\n\t\t\tstart := metav1.Unix(metav1.Now().Time.Unix()-tc.startTime, 0)\n\t\t\tjob.Status.StartTime = &start\n\t\t\tsharedInformerFactory.Batch().V1().Jobs().Informer().GetIndexer().Add(job)\n\t\t\tpodIndexer := sharedInformerFactory.Core().V1().Pods().Informer().GetIndexer()\n\t\t\tsetPodsStatuses(podIndexer, job, 0, tc.activePods, tc.succeededPods, tc.failedPods, 0, 0)\n\n\t\t\t// run\n\t\t\terr := manager.syncJob(context.TODO(), testutil.GetKey(job, t))\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Unexpected error when syncing jobs %v\", err)\n\t\t\t}\n\t\t\t// validate created/deleted pods\n\t\t\tif int32(len(fakePodControl.Templates)) != 0 {\n\t\t\t\tt.Errorf(\"Unexpected number of creates. Expected 0, saw %d\\n\", len(fakePodControl.Templates))\n\t\t\t}\n\t\t\tif int32(len(fakePodControl.DeletePodName)) != tc.expectedDeletions {\n\t\t\t\tt.Errorf(\"Unexpected number of deletes. Expected %d, saw %d\\n\", tc.expectedDeletions, len(fakePodControl.DeletePodName))\n\t\t\t}\n\t\t\t// validate status\n\t\t\tif actual.Status.Active != tc.expectedActive {\n\t\t\t\tt.Errorf(\"Unexpected number of active pods. Expected %d, saw %d\\n\", tc.expectedActive, actual.Status.Active)\n\t\t\t}\n\t\t\tif actual.Status.Succeeded != tc.expectedSucceeded {\n\t\t\t\tt.Errorf(\"Unexpected number of succeeded pods. Expected %d, saw %d\\n\", tc.expectedSucceeded, actual.Status.Succeeded)\n\t\t\t}\n\t\t\tif actual.Status.Failed != tc.expectedFailed {\n\t\t\t\tt.Errorf(\"Unexpected number of failed pods. Expected %d, saw %d\\n\", tc.expectedFailed, actual.Status.Failed)\n\t\t\t}\n\t\t\tif actual.Status.StartTime == nil {\n\t\t\t\tt.Error(\"Missing .status.startTime\")\n\t\t\t}\n\t\t\t// validate conditions\n\t\t\tif !getCondition(actual, tc.expectedCondition, v1.ConditionTrue, tc.expectedConditionReason) {\n\t\t\t\tt.Errorf(\"Expected fail condition. Got %#v\", actual.Status.Conditions)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4a6a7b7a9a1cefa38a08b6dac8ab1078", "score": "0.38385263", "text": "func (mr *MockStorageAPIMockRecorder) SetChunkReadonly(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetChunkReadonly\", reflect.TypeOf((*MockStorageAPI)(nil).SetChunkReadonly), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "d613e860337331cf579b6fe52a0d5f57", "score": "0.3835548", "text": "func (mr *MockMutableStateMockRecorder) SetStickyTaskQueue(name, scheduleToStartTimeout interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetStickyTaskQueue\", reflect.TypeOf((*MockMutableState)(nil).SetStickyTaskQueue), name, scheduleToStartTimeout)\n}", "title": "" } ]
1a4e7b26e6258fe664755743e1e504fd
GetPort create PortSettings strcut from pin number and hw type
[ { "docid": "b8df1aa7cf1df8efaa458d0fb79d3261", "score": "0.7450218", "text": "func (ss *SystemSettings) GetPort(name string, port uint, ptype PinType) PortSettings {\n\tps := PortSettings{\n\t\tType: ptype,\n\t\tPort: port,\n\t\tName: name,\n\t\tss: ss,\n\t}\n\n\tps.ConfigPl = &HassPayload{\n\t\tName: name,\n\t\tState_topic: ps.StateTopic(),\n\t\t//Device_class: \"power\", // TODO move to args https://www.home-assistant.io/integrations/binary_sensor/#device-class\n\t}\n\n\tswitch ptype {\n\tcase PinBinarySensor:\n\t\t//ps.Pin = gpio.NewInput(port)\n\t\tbreak\n\tcase PinSwitch:\n\t\tps.Pin = gpio.NewOutput(port, false)\n\t\tps.ConfigPl.Command_topic = ps.CommandTopic()\n\t\tbreak\n\tdefault:\n\t\tlog.Fatalf(\"wrong pin type %d\", ptype)\n\t\tbreak\n\t}\n\n\treturn ps\n}", "title": "" } ]
[ { "docid": "2eae4dc9c5af24343aa4551309f41b17", "score": "0.63826144", "text": "func getPinCfg(p uint8) sam.RegValue8 {\n\tswitch p {\n\tcase 0:\n\t\treturn sam.PORT.PINCFG0_0\n\tcase 1:\n\t\treturn sam.PORT.PINCFG0_1\n\tcase 2:\n\t\treturn sam.PORT.PINCFG0_2\n\tcase 3:\n\t\treturn sam.PORT.PINCFG0_3\n\tcase 4:\n\t\treturn sam.PORT.PINCFG0_4\n\tcase 5:\n\t\treturn sam.PORT.PINCFG0_5\n\tcase 6:\n\t\treturn sam.PORT.PINCFG0_6\n\tcase 7:\n\t\treturn sam.PORT.PINCFG0_7\n\tcase 8:\n\t\treturn sam.PORT.PINCFG0_8\n\tcase 9:\n\t\treturn sam.PORT.PINCFG0_9\n\tcase 10:\n\t\treturn sam.PORT.PINCFG0_10\n\tcase 11:\n\t\treturn sam.PORT.PINCFG0_11\n\tcase 12:\n\t\treturn sam.PORT.PINCFG0_12\n\tcase 13:\n\t\treturn sam.PORT.PINCFG0_13\n\tcase 14:\n\t\treturn sam.PORT.PINCFG0_14\n\tcase 15:\n\t\treturn sam.PORT.PINCFG0_15\n\tcase 16:\n\t\treturn sam.PORT.PINCFG0_16\n\tcase 17:\n\t\treturn sam.PORT.PINCFG0_17\n\tcase 18:\n\t\treturn sam.PORT.PINCFG0_18\n\tcase 19:\n\t\treturn sam.PORT.PINCFG0_19\n\tcase 20:\n\t\treturn sam.PORT.PINCFG0_20\n\tcase 21:\n\t\treturn sam.PORT.PINCFG0_21\n\tcase 22:\n\t\treturn sam.PORT.PINCFG0_22\n\tcase 23:\n\t\treturn sam.PORT.PINCFG0_23\n\tcase 24:\n\t\treturn sam.PORT.PINCFG0_24\n\tcase 25:\n\t\treturn sam.PORT.PINCFG0_25\n\tcase 26:\n\t\treturn sam.PORT.PINCFG0_26\n\tcase 27:\n\t\treturn sam.PORT.PINCFG0_27\n\tcase 28:\n\t\treturn sam.PORT.PINCFG0_28\n\tcase 29:\n\t\treturn sam.PORT.PINCFG0_29\n\tcase 30:\n\t\treturn sam.PORT.PINCFG0_30\n\tcase 31:\n\t\treturn sam.PORT.PINCFG0_31\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "ae22db4fced34d2511fe97772cfef06f", "score": "0.6305912", "text": "func (p Pin) getPortPin() (*nrf.GPIO_Type, uint32) {\n\treturn nrf.P0, uint32(p)\n}", "title": "" }, { "docid": "9aa9a9b362eb27b9140507f5fd7d93e0", "score": "0.6245191", "text": "func (m *MCP23017Driver) getPort(portStr string) (selectedPort port) {\n\tportStr = strings.ToUpper(portStr)\n\tswitch {\n\tcase portStr == \"A\":\n\t\treturn mcp23017GetBank(m.mcpConf.bank).portA\n\tcase portStr == \"B\":\n\t\treturn mcp23017GetBank(m.mcpConf.bank).portB\n\tdefault:\n\t\treturn mcp23017GetBank(m.mcpConf.bank).portA\n\t}\n}", "title": "" }, { "docid": "0ab0447c4f0321c616729e766f1375e7", "score": "0.6212929", "text": "func (p Pin) getPortPin() (*nrf.GPIO_Type, uint32) {\n\treturn nrf.GPIO, uint32(p)\n}", "title": "" }, { "docid": "f9a6f0ac67b58ab2ebbe20b874b6d836", "score": "0.60028374", "text": "func (p Pin) getPinCfg() uint8 {\n\tswitch p {\n\tcase 0:\n\t\treturn sam.PORT.PINCFG0_0.Get()\n\tcase 1:\n\t\treturn sam.PORT.PINCFG0_1.Get()\n\tcase 2:\n\t\treturn sam.PORT.PINCFG0_2.Get()\n\tcase 3:\n\t\treturn sam.PORT.PINCFG0_3.Get()\n\tcase 4:\n\t\treturn sam.PORT.PINCFG0_4.Get()\n\tcase 5:\n\t\treturn sam.PORT.PINCFG0_5.Get()\n\tcase 6:\n\t\treturn sam.PORT.PINCFG0_6.Get()\n\tcase 7:\n\t\treturn sam.PORT.PINCFG0_7.Get()\n\tcase 8:\n\t\treturn sam.PORT.PINCFG0_8.Get()\n\tcase 9:\n\t\treturn sam.PORT.PINCFG0_9.Get()\n\tcase 10:\n\t\treturn sam.PORT.PINCFG0_10.Get()\n\tcase 11:\n\t\treturn sam.PORT.PINCFG0_11.Get()\n\tcase 12:\n\t\treturn sam.PORT.PINCFG0_12.Get()\n\tcase 13:\n\t\treturn sam.PORT.PINCFG0_13.Get()\n\tcase 14:\n\t\treturn sam.PORT.PINCFG0_14.Get()\n\tcase 15:\n\t\treturn sam.PORT.PINCFG0_15.Get()\n\tcase 16:\n\t\treturn sam.PORT.PINCFG0_16.Get()\n\tcase 17:\n\t\treturn sam.PORT.PINCFG0_17.Get()\n\tcase 18:\n\t\treturn sam.PORT.PINCFG0_18.Get()\n\tcase 19:\n\t\treturn sam.PORT.PINCFG0_19.Get()\n\tcase 20:\n\t\treturn sam.PORT.PINCFG0_20.Get()\n\tcase 21:\n\t\treturn sam.PORT.PINCFG0_21.Get()\n\tcase 22:\n\t\treturn sam.PORT.PINCFG0_22.Get()\n\tcase 23:\n\t\treturn sam.PORT.PINCFG0_23.Get()\n\tcase 24:\n\t\treturn sam.PORT.PINCFG0_24.Get()\n\tcase 25:\n\t\treturn sam.PORT.PINCFG0_25.Get()\n\tcase 26:\n\t\treturn sam.PORT.PINCFG0_26.Get()\n\tcase 27:\n\t\treturn sam.PORT.PINCFG0_27.Get()\n\tcase 28:\n\t\treturn sam.PORT.PINCFG0_28.Get()\n\tcase 29:\n\t\treturn sam.PORT.PINCFG0_29.Get()\n\tcase 30:\n\t\treturn sam.PORT.PINCFG0_30.Get()\n\tcase 31:\n\t\treturn sam.PORT.PINCFG0_31.Get()\n\tcase 32: // PB00\n\t\treturn uint8(sam.PORT.PINCFG1_0.Get()>>0) & 0xff\n\tcase 33: // PB01\n\t\treturn uint8(sam.PORT.PINCFG1_0.Get()>>8) & 0xff\n\tcase 34: // PB02\n\t\treturn uint8(sam.PORT.PINCFG1_0.Get()>>16) & 0xff\n\tcase 35: // PB03\n\t\treturn uint8(sam.PORT.PINCFG1_0.Get()>>24) & 0xff\n\tcase 37: // PB04\n\t\treturn uint8(sam.PORT.PINCFG1_4.Get()>>0) & 0xff\n\tcase 38: // PB05\n\t\treturn uint8(sam.PORT.PINCFG1_4.Get()>>8) & 0xff\n\tcase 39: // PB06\n\t\treturn uint8(sam.PORT.PINCFG1_4.Get()>>16) & 0xff\n\tcase 40: // PB07\n\t\treturn uint8(sam.PORT.PINCFG1_4.Get()>>24) & 0xff\n\tcase 41: // PB08\n\t\treturn uint8(sam.PORT.PINCFG1_8.Get()>>0) & 0xff\n\tcase 42: // PB09\n\t\treturn uint8(sam.PORT.PINCFG1_8.Get()>>8) & 0xff\n\tcase 43: // PB10\n\t\treturn uint8(sam.PORT.PINCFG1_8.Get()>>16) & 0xff\n\tcase 44: // PB11\n\t\treturn uint8(sam.PORT.PINCFG1_8.Get()>>24) & 0xff\n\tcase 45: // PB12\n\t\treturn uint8(sam.PORT.PINCFG1_12.Get()>>0) & 0xff\n\tcase 46: // PB13\n\t\treturn uint8(sam.PORT.PINCFG1_12.Get()>>8) & 0xff\n\tcase 47: // PB14\n\t\treturn uint8(sam.PORT.PINCFG1_12.Get()>>16) & 0xff\n\tcase 48: // PB15\n\t\treturn uint8(sam.PORT.PINCFG1_12.Get()>>24) & 0xff\n\tcase 49: // PB16\n\t\treturn uint8(sam.PORT.PINCFG1_16.Get()>>0) & 0xff\n\tcase 50: // PB17\n\t\treturn uint8(sam.PORT.PINCFG1_16.Get()>>8) & 0xff\n\tcase 51: // PB18\n\t\treturn uint8(sam.PORT.PINCFG1_16.Get()>>16) & 0xff\n\tcase 52: // PB19\n\t\treturn uint8(sam.PORT.PINCFG1_16.Get()>>24) & 0xff\n\tcase 53: // PB20\n\t\treturn uint8(sam.PORT.PINCFG1_20.Get()>>0) & 0xff\n\tcase 54: // PB21\n\t\treturn uint8(sam.PORT.PINCFG1_20.Get()>>8) & 0xff\n\tcase 55: // PB22\n\t\treturn uint8(sam.PORT.PINCFG1_20.Get()>>16) & 0xff\n\tcase 56: // PB23\n\t\treturn uint8(sam.PORT.PINCFG1_20.Get()>>24) & 0xff\n\tcase 57: // PB24\n\t\treturn uint8(sam.PORT.PINCFG1_24.Get()>>0) & 0xff\n\tcase 58: // PB25\n\t\treturn uint8(sam.PORT.PINCFG1_24.Get()>>8) & 0xff\n\tcase 59: // PB26\n\t\treturn uint8(sam.PORT.PINCFG1_24.Get()>>16) & 0xff\n\tcase 60: // PB27\n\t\treturn uint8(sam.PORT.PINCFG1_24.Get()>>24) & 0xff\n\tcase 61: // PB28\n\t\treturn uint8(sam.PORT.PINCFG1_28.Get()>>0) & 0xff\n\tcase 62: // PB29\n\t\treturn uint8(sam.PORT.PINCFG1_28.Get()>>8) & 0xff\n\tcase 63: // PB30\n\t\treturn uint8(sam.PORT.PINCFG1_28.Get()>>16) & 0xff\n\tcase 64: // PB31\n\t\treturn uint8(sam.PORT.PINCFG1_28.Get()>>24) & 0xff\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "a64edf60be122b5414d4b72cc00dc5c0", "score": "0.59131265", "text": "func setPinCfg(p uint8, val sam.RegValue8) {\n\tswitch p {\n\tcase 0:\n\t\tsam.PORT.PINCFG0_0 = val\n\tcase 1:\n\t\tsam.PORT.PINCFG0_1 = val\n\tcase 2:\n\t\tsam.PORT.PINCFG0_2 = val\n\tcase 3:\n\t\tsam.PORT.PINCFG0_3 = val\n\tcase 4:\n\t\tsam.PORT.PINCFG0_4 = val\n\tcase 5:\n\t\tsam.PORT.PINCFG0_5 = val\n\tcase 6:\n\t\tsam.PORT.PINCFG0_6 = val\n\tcase 7:\n\t\tsam.PORT.PINCFG0_7 = val\n\tcase 8:\n\t\tsam.PORT.PINCFG0_8 = val\n\tcase 9:\n\t\tsam.PORT.PINCFG0_9 = val\n\tcase 10:\n\t\tsam.PORT.PINCFG0_10 = val\n\tcase 11:\n\t\tsam.PORT.PINCFG0_11 = val\n\tcase 12:\n\t\tsam.PORT.PINCFG0_12 = val\n\tcase 13:\n\t\tsam.PORT.PINCFG0_13 = val\n\tcase 14:\n\t\tsam.PORT.PINCFG0_14 = val\n\tcase 15:\n\t\tsam.PORT.PINCFG0_15 = val\n\tcase 16:\n\t\tsam.PORT.PINCFG0_16 = val\n\tcase 17:\n\t\tsam.PORT.PINCFG0_17 = val\n\tcase 18:\n\t\tsam.PORT.PINCFG0_18 = val\n\tcase 19:\n\t\tsam.PORT.PINCFG0_19 = val\n\tcase 20:\n\t\tsam.PORT.PINCFG0_20 = val\n\tcase 21:\n\t\tsam.PORT.PINCFG0_21 = val\n\tcase 22:\n\t\tsam.PORT.PINCFG0_22 = val\n\tcase 23:\n\t\tsam.PORT.PINCFG0_23 = val\n\tcase 24:\n\t\tsam.PORT.PINCFG0_24 = val\n\tcase 25:\n\t\tsam.PORT.PINCFG0_25 = val\n\tcase 26:\n\t\tsam.PORT.PINCFG0_26 = val\n\tcase 27:\n\t\tsam.PORT.PINCFG0_27 = val\n\tcase 28:\n\t\tsam.PORT.PINCFG0_28 = val\n\tcase 29:\n\t\tsam.PORT.PINCFG0_29 = val\n\tcase 30:\n\t\tsam.PORT.PINCFG0_30 = val\n\tcase 31:\n\t\tsam.PORT.PINCFG0_31 = val\n\t}\n}", "title": "" }, { "docid": "7587a231bde6f0b6f3812aabf17d0ced", "score": "0.57512164", "text": "func (b *MPU9250Driver) Port() string { return b.portName }", "title": "" }, { "docid": "cbbdd5e8306091d3d2a1e51052d6db7f", "score": "0.571984", "text": "func GetPort(portNo int32) n.ApplicationGatewayFrontendPort {\n\treturn n.ApplicationGatewayFrontendPort{\n\t\tEtag: to.StringPtr(\"*\"),\n\t\tName: to.StringPtr(fmt.Sprintf(\"fp-%d\", portNo)),\n\t\tID: to.StringPtr(fmt.Sprintf(\"/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/frontendPorts/fp-%d\", portNo)),\n\t\tApplicationGatewayFrontendPortPropertiesFormat: &n.ApplicationGatewayFrontendPortPropertiesFormat{\n\t\t\tPort: to.Int32Ptr(portNo),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2274563628afec89e3b700e94084e813", "score": "0.5666551", "text": "func getPort() string {\n\tport := cfg.Config.Port\n\tif !strings.Contains(port, \":\") {\n\t\tport = \"127.0.0.1:\" + port\n\t}\n\treturn port\n}", "title": "" }, { "docid": "a73499bd46642228df278b7128403957", "score": "0.558354", "text": "func (c *Config) Port() int {\n\tswitch c.Type {\n\tcase \"ssh\":\n\t\treturn c.SSHPort\n\tcase \"winrm\":\n\t\treturn c.WinRMPort\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "4dcecadffc2e823d829502790c528099", "score": "0.5559599", "text": "func (p Pin) setPinCfg(val uint8) {\n\tswitch p {\n\tcase 0:\n\t\tsam.PORT.PINCFG0_0.Set(val)\n\tcase 1:\n\t\tsam.PORT.PINCFG0_1.Set(val)\n\tcase 2:\n\t\tsam.PORT.PINCFG0_2.Set(val)\n\tcase 3:\n\t\tsam.PORT.PINCFG0_3.Set(val)\n\tcase 4:\n\t\tsam.PORT.PINCFG0_4.Set(val)\n\tcase 5:\n\t\tsam.PORT.PINCFG0_5.Set(val)\n\tcase 6:\n\t\tsam.PORT.PINCFG0_6.Set(val)\n\tcase 7:\n\t\tsam.PORT.PINCFG0_7.Set(val)\n\tcase 8:\n\t\tsam.PORT.PINCFG0_8.Set(val)\n\tcase 9:\n\t\tsam.PORT.PINCFG0_9.Set(val)\n\tcase 10:\n\t\tsam.PORT.PINCFG0_10.Set(val)\n\tcase 11:\n\t\tsam.PORT.PINCFG0_11.Set(val)\n\tcase 12:\n\t\tsam.PORT.PINCFG0_12.Set(val)\n\tcase 13:\n\t\tsam.PORT.PINCFG0_13.Set(val)\n\tcase 14:\n\t\tsam.PORT.PINCFG0_14.Set(val)\n\tcase 15:\n\t\tsam.PORT.PINCFG0_15.Set(val)\n\tcase 16:\n\t\tsam.PORT.PINCFG0_16.Set(val)\n\tcase 17:\n\t\tsam.PORT.PINCFG0_17.Set(val)\n\tcase 18:\n\t\tsam.PORT.PINCFG0_18.Set(val)\n\tcase 19:\n\t\tsam.PORT.PINCFG0_19.Set(val)\n\tcase 20:\n\t\tsam.PORT.PINCFG0_20.Set(val)\n\tcase 21:\n\t\tsam.PORT.PINCFG0_21.Set(val)\n\tcase 22:\n\t\tsam.PORT.PINCFG0_22.Set(val)\n\tcase 23:\n\t\tsam.PORT.PINCFG0_23.Set(val)\n\tcase 24:\n\t\tsam.PORT.PINCFG0_24.Set(val)\n\tcase 25:\n\t\tsam.PORT.PINCFG0_25.Set(val)\n\tcase 26:\n\t\tsam.PORT.PINCFG0_26.Set(val)\n\tcase 27:\n\t\tsam.PORT.PINCFG0_27.Set(val)\n\tcase 28:\n\t\tsam.PORT.PINCFG0_28.Set(val)\n\tcase 29:\n\t\tsam.PORT.PINCFG0_29.Set(val)\n\tcase 30:\n\t\tsam.PORT.PINCFG0_30.Set(val)\n\tcase 31:\n\t\tsam.PORT.PINCFG0_31.Set(val)\n\tcase 32: // PB00\n\t\tsam.PORT.PINCFG1_0.Set(sam.PORT.PINCFG1_0.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 33: // PB01\n\t\tsam.PORT.PINCFG1_0.Set(sam.PORT.PINCFG1_0.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 34: // PB02\n\t\tsam.PORT.PINCFG1_0.Set(sam.PORT.PINCFG1_0.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 35: // PB03\n\t\tsam.PORT.PINCFG1_0.Set(sam.PORT.PINCFG1_0.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 36: // PB04\n\t\tsam.PORT.PINCFG1_4.Set(sam.PORT.PINCFG1_4.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 37: // PB05\n\t\tsam.PORT.PINCFG1_4.Set(sam.PORT.PINCFG1_4.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 38: // PB06\n\t\tsam.PORT.PINCFG1_4.Set(sam.PORT.PINCFG1_4.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 39: // PB07\n\t\tsam.PORT.PINCFG1_4.Set(sam.PORT.PINCFG1_4.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 40: // PB08\n\t\tsam.PORT.PINCFG1_8.Set(sam.PORT.PINCFG1_8.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 41: // PB09\n\t\tsam.PORT.PINCFG1_8.Set(sam.PORT.PINCFG1_8.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 42: // PB10\n\t\tsam.PORT.PINCFG1_8.Set(sam.PORT.PINCFG1_8.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 43: // PB11\n\t\tsam.PORT.PINCFG1_8.Set(sam.PORT.PINCFG1_8.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 44: // PB12\n\t\tsam.PORT.PINCFG1_12.Set(sam.PORT.PINCFG1_12.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 45: // PB13\n\t\tsam.PORT.PINCFG1_12.Set(sam.PORT.PINCFG1_12.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 46: // PB14\n\t\tsam.PORT.PINCFG1_12.Set(sam.PORT.PINCFG1_12.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 47: // PB15\n\t\tsam.PORT.PINCFG1_12.Set(sam.PORT.PINCFG1_12.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 48: // PB16\n\t\tsam.PORT.PINCFG1_16.Set(sam.PORT.PINCFG1_16.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 49: // PB17\n\t\tsam.PORT.PINCFG1_16.Set(sam.PORT.PINCFG1_16.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 50: // PB18\n\t\tsam.PORT.PINCFG1_16.Set(sam.PORT.PINCFG1_16.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 51: // PB19\n\t\tsam.PORT.PINCFG1_16.Set(sam.PORT.PINCFG1_16.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 52: // PB20\n\t\tsam.PORT.PINCFG1_20.Set(sam.PORT.PINCFG1_20.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 53: // PB21\n\t\tsam.PORT.PINCFG1_20.Set(sam.PORT.PINCFG1_20.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 54: // PB22\n\t\tsam.PORT.PINCFG1_20.Set(sam.PORT.PINCFG1_20.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 55: // PB23\n\t\tsam.PORT.PINCFG1_20.Set(sam.PORT.PINCFG1_20.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 56: // PB24\n\t\tsam.PORT.PINCFG1_24.Set(sam.PORT.PINCFG1_24.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 57: // PB25\n\t\tsam.PORT.PINCFG1_24.Set(sam.PORT.PINCFG1_24.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 58: // PB26\n\t\tsam.PORT.PINCFG1_24.Set(sam.PORT.PINCFG1_24.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 59: // PB27\n\t\tsam.PORT.PINCFG1_24.Set(sam.PORT.PINCFG1_24.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 60: // PB28\n\t\tsam.PORT.PINCFG1_28.Set(sam.PORT.PINCFG1_28.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 61: // PB29\n\t\tsam.PORT.PINCFG1_28.Set(sam.PORT.PINCFG1_28.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 62: // PB30\n\t\tsam.PORT.PINCFG1_28.Set(sam.PORT.PINCFG1_28.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 63: // PB31\n\t\tsam.PORT.PINCFG1_28.Set(sam.PORT.PINCFG1_28.Get()&^(0xff<<24) | (uint32(val) << 24))\n\t}\n}", "title": "" }, { "docid": "1cb1f1246de3341f295131cc75d9764d", "score": "0.5543195", "text": "func (c *Config) Port() uint16 {\n\treturn c.port\n}", "title": "" }, { "docid": "8309357d222ac045353d6db87f25ce56", "score": "0.55340564", "text": "func (o AddVCenterRequestPropertiesOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AddVCenterRequestProperties) *string { return v.Port }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a58c034482964481c5dbd40609292059", "score": "0.54986054", "text": "func (d *Driver) createPort(port *network.Port) error {\n\tvar portAny *any.Any\n\tvar err error\n\tvar portDriver string\n\n\tif port.Virtual {\n\t\tif port.DPDK {\n\t\t\tportDriver = PMDPORT\n\t\t\tvdevArg := &bess_pb.PMDPortArg_Vdev{\n\t\t\t\tVdev: fmt.Sprintf(\"%s,iface=%s\", port.IfaceName, port.SocketPath),\n\t\t\t}\n\t\t\tpmdPortArg := &bess_pb.PMDPortArg{Port: vdevArg}\n\t\t\tportAny, err = ptypes.MarshalAny(pmdPortArg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failure to serialize PMD port args: %v\", pmdPortArg)\n\t\t\t\treturn errors.New(\"failed to serialize port args\")\n\t\t\t}\n\t\t} else {\n\t\t\tvar vportArgs *bess_pb.VPortArg\n\t\t\tportDriver = VPORT\n\t\t\tif port.NamesSpace == \"\" {\n\t\t\t\t// If no namespace, this must belong to default namespace so just provide IF Name and IP\n\t\t\t\tvportArgs = &bess_pb.VPortArg{\n\t\t\t\t\tIfname: port.IfaceName,\n\t\t\t\t\tIpAddrs: []string{port.IPAddr},\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// prepend /host dir as this is what is mounted to container\n\t\t\t\trealNsPath := path.Join(\"/host\", port.NamesSpace)\n\t\t\t\tvportArg := &bess_pb.VPortArg_Netns{\n\t\t\t\t\tNetns: realNsPath,\n\t\t\t\t}\n\t\t\t\tvportArgs = &bess_pb.VPortArg{\n\t\t\t\t\tIfname: port.IfaceName,\n\t\t\t\t\tCpid: vportArg,\n\t\t\t\t\tIpAddrs: []string{port.IPAddr},\n\t\t\t\t}\n\t\t\t}\n\t\t\tportAny, err = ptypes.MarshalAny(vportArgs)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failure to serialize vport args: %v\", vportArgs)\n\t\t\t\treturn errors.New(\"failed to serialize port args\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif port.DPDK {\n\t\t\tportDriver = PMDPORT\n\t\t\tpciArg := &bess_pb.PMDPortArg_Pci{Pci: port.IfaceName}\n\t\t\tportArg := &bess_pb.PMDPortArg{Port: pciArg}\n\t\t\tportAny, err = ptypes.MarshalAny(portArg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failure to serialize PMD Port port args: %v\", portArg)\n\t\t\t\treturn errors.New(\"failed to serialize port args\")\n\t\t\t}\n\n\t\t} else if port.UnixSocket {\n\t\t\tportDriver = UNIXPORT\n\t\t\tportArg := &bess_pb.UnixSocketPortArg{Path: port.SocketPath}\n\t\t\tportAny, err = ptypes.MarshalAny(portArg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failure to serialize Unix Socket port args: %v\", portArg)\n\t\t\t\treturn errors.New(\"failed to serialize port args\")\n\t\t\t}\n\t\t} else {\n\t\t\t// Must be a kernel iface, use PCAP type port\n\t\t\tportDriver = PCAPPORT\n\t\t\tportArg := &bess_pb.PCAPPortArg{Dev: port.IfaceName}\n\t\t\tportAny, err = ptypes.MarshalAny(portArg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failure to serialize pcap port args: %v\", portArg)\n\t\t\t\treturn errors.New(\"failed to serialize port args\")\n\t\t\t}\n\t\t}\n\t}\n\n\tportRequest := &bess_pb.CreatePortRequest{\n\t\tName: port.PortName,\n\t\tDriver: portDriver,\n\t\tArg: portAny,\n\t}\n\tlog.Debugf(\"Requesting a port create for: %v, %v, %+v\", port.PortName, portDriver, portAny)\n\tportRes, err := d.bessClient.CreatePort(d.Context, portRequest)\n\n\tif err != nil || portRes.Error.Errmsg != \"\" {\n\t\tlog.Errorf(\"Failure to create port with Bess: %v, %v\", portRes, err)\n\t\treturn err\n\t}\n\t// Update mac address for port\n\tport.MacAddr = portRes.GetMacAddr()\n\treturn nil\n}", "title": "" }, { "docid": "0b2a703bdd71bfd978747fd7bf9e7c68", "score": "0.54838204", "text": "func portToWire(portStr string) ([]byte, error) {\n\tport, err := strconv.ParseUint(portStr, 10, 16)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn uint16ToWire(uint16(port)), nil\n}", "title": "" }, { "docid": "5dc335358f27bc5ec1697190c394aeb4", "score": "0.54560155", "text": "func makePort(port int) string {\n\treturn fmt.Sprintf(\":%d\", port)\n}", "title": "" }, { "docid": "c40ddd9b8fe06ee23a964fe74647bd13", "score": "0.54343617", "text": "func (f *SerialAdaptor) Port() string { return f.portName }", "title": "" }, { "docid": "03166cf4adc513635a26d90c8a6111df", "score": "0.5408322", "text": "func (e *Env) Port(key string, optionSetters ...OptionSetter) (port uint16, err error) {\n\ts, err := e.Get(key, optionSetters...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn ParsePort(s)\n}", "title": "" }, { "docid": "31952c2cbbe1759758294699c8056bde", "score": "0.538939", "text": "func get_port_address()(error, string){\n\tvar port_address []byte\n\tusb := false\n\tports, err := s.ListPorts()\n\tif err == nil {\n\t\tfor _, info := range ports {\n\t\t\tport_name := []byte(info.Name())\n\t\t\tfor x := 0; x < len(port_name); x++{\n\t\t\t\tif (port_name[x] == 'u' || port_name[x] == 'U') && (port_name[x+1] == 's' || port_name[x+1] == 'S') && (port_name[x+2] == 'b' || port_name[x+2] == 'B'){\n\t\t\t\t\tusb = true\n\t\t\t\t}\n\t\t\t\tif x == len(port_name)-1 && usb==false{\n\t\t\t\t\tport_address=nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif port_name[x] == 'c' && port_name[x+1] == 'u' {\n\t\t\t\t\tport_address = append(port_address,'t')\n\t\t\t\t\tport_address = append(port_address,'t')\n\t\t\t\t\tport_address = append(port_address,'y')\n\t\t\t\t\tx++\n\t\t\t\t}else{\n\t\t\t\t\tport_address = append(port_address,port_name[x])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn err, string(port_address)\n\t}else{\n\t\treturn err, \"error\"\n\t}\n}", "title": "" }, { "docid": "fa033cf1ba7acf4463b59d31d9105217", "score": "0.5371779", "text": "func makePort(addr string) (uint16, error) {\n\t_, portString, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tport64, err := strconv.ParseUint(portString, 10, 16)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint16(port64), nil\n}", "title": "" }, { "docid": "c09f9715f9f214373d4eefd729f63d79", "score": "0.5354102", "text": "func (o AddVCenterRequestPropertiesPtrOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AddVCenterRequestProperties) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e45c321a7dff878ae1199b79e45ae466", "score": "0.53498507", "text": "func (opts PortCreateOptsExt) ToPortCreateMap() (map[string]interface{}, error) {\n\tbase, err := opts.CreateOptsBuilder.ToPortCreateMap()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tport := base[\"port\"].(map[string]interface{})\n\n\tif opts.PortSecurityEnabled != nil {\n\t\tport[\"port_security_enabled\"] = &opts.PortSecurityEnabled\n\t}\n\n\treturn base, nil\n}", "title": "" }, { "docid": "955f0141be11ab9a8c9189a29c237352", "score": "0.53390366", "text": "func (sw *GossipSwitch) initPort() {\n\tlog.Info(\"Init switch's ports\")\n\tsw.inPorts[port.LocalInPortId] = port.NewInPort(port.LocalInPortId)\n\tsw.inPorts[port.RemoteInPortId] = port.NewInPort(port.RemoteInPortId)\n\tsw.outPorts[port.LocalOutPortId] = port.NewOutPort(port.LocalOutPortId)\n\tsw.outPorts[port.RemoteOutPortId] = port.NewOutPort(port.RemoteOutPortId)\n}", "title": "" }, { "docid": "52318a66d48a43a63827bf11e080aaee", "score": "0.5322726", "text": "func GetPort(config *config.Config) string {\n\tif strings.TrimSpace(config.Port) == \"\" {\n\t\treturn defaultPort\n\t}\n\treturn config.Port\n}", "title": "" }, { "docid": "05390e7c71c02d63fe3ec12b62b05ec5", "score": "0.53159356", "text": "func (cfig *Information) GetPort() string {\n\tport := cfig.LisPort\n\treturn port\n}", "title": "" }, { "docid": "7f4e31680f5cb8d78096181eca4a134a", "score": "0.53031844", "text": "func (o SyntheticsTestRequestDefinitionOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v SyntheticsTestRequestDefinition) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c197012f192e09c93519ed27ee113fbf", "score": "0.52886724", "text": "func (c *Config) Port() int {\n\t// support only numeric\n\treg, err := regexp.Compile(\"[^0-9]+\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tsafe := reg.ReplaceAllString(c.Addr, \"\")\n\ti, err := strconv.Atoi(safe)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn i\n}", "title": "" }, { "docid": "0737d61f171128424fd4f55155bf9ec7", "score": "0.5263323", "text": "func GetPorts(taskInfo *mesos.TaskInfo) *list.Element {\n\tvar ports list.List\n\tresources := taskInfo.GetResources()\n\tfor _, resource := range resources {\n\t\tif resource.GetName() == types.PORTS {\n\t\t\tranges := resource.GetRanges()\n\t\t\tfor _, r := range ranges.GetRange() {\n\t\t\t\tbegin := r.GetBegin()\n\t\t\t\tend := r.GetEnd()\n\t\t\t\tlog.Debug(\"Port Range : begin: \", begin)\n\t\t\t\tlog.Debug(\"Port range : end: \", end)\n\t\t\t\tfor i := begin; i < end+1; i++ {\n\t\t\t\t\tports.PushBack(i)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn ports.Front()\n}", "title": "" }, { "docid": "9d6dc5fd4319f61541b633b50821d63e", "score": "0.52514374", "text": "func (ec *Envcfg) Port() int {\n\treturn ec.GetInt(ec.portKey)\n}", "title": "" }, { "docid": "49eb3392715ba864149fa86dea376e74", "score": "0.52353024", "text": "func getPortMapEntryByPortNumber(portmap *pm.PortMap, portNumber uint32) *pm.Entry {\n\tif dp == nil {\n\t\tlog.Error(\"data plane does not exist\")\n\t\treturn nil\n\t}\n\tfor _, entry := range portmap.GetEntries() {\n\t\tif entry.GetPortNumber() == portNumber {\n\t\t\treturn entry\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c57dbddf345c4ec7d5138701f7a39a4f", "score": "0.52312076", "text": "func (o SyntheticsTestRequestDefinitionPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *SyntheticsTestRequestDefinition) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "306c23e68aca69c7acde65a3ac1f7cf7", "score": "0.5220739", "text": "func (o SyntheticsTestApiStepRequestDefinitionOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v SyntheticsTestApiStepRequestDefinition) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "5dd3b72bfcf527b5c38875a5a2d6b4a7", "score": "0.520861", "text": "func PortFromString(pt string) (*Port, error) {\n\tvar port Port\n\n\tpt = \"name=\" + pt\n\tptQuery, err := common.MakeQueryString(pt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv, err := url.ParseQuery(ptQuery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor key, val := range v {\n\t\tif len(val) > 1 {\n\t\t\treturn nil, fmt.Errorf(\"label %s with multiple values %q\", key, val)\n\t\t}\n\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\tacn, err := NewACName(val[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tport.Name = *acn\n\t\tcase \"protocol\":\n\t\t\tport.Protocol = val[0]\n\t\tcase \"port\":\n\t\t\tp, err := strconv.ParseUint(val[0], 10, 16)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tport.Port = uint(p)\n\t\tcase \"count\":\n\t\t\tcnt, err := strconv.ParseUint(val[0], 10, 16)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tport.Count = uint(cnt)\n\t\tcase \"socketActivated\":\n\t\t\tsa, err := strconv.ParseBool(val[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tport.SocketActivated = sa\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown port parameter %q\", key)\n\t\t}\n\t}\n\terr = port.assertValid()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &port, nil\n}", "title": "" }, { "docid": "5970bb94967f5541f806eed8c1166b44", "score": "0.5176934", "text": "func (o SyntheticsTestApiStepRequestDefinitionPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *SyntheticsTestApiStepRequestDefinition) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "09dafe0cbf68e0a56715446fd53f05a8", "score": "0.5175843", "text": "func GetFixedPort(protocol string) string {\n\treturn defaultProtocolPort[protocol]\n\n}", "title": "" }, { "docid": "7593c38aaaf130ab62e35309adfb88d0", "score": "0.51688063", "text": "func (a *EthAdaptor) GetPort() int {\n\treturn a.config.Port\n}", "title": "" }, { "docid": "2f15037b957798249b9a05f820be1d90", "score": "0.51631165", "text": "func (a *AssetManagerService) GetPort(uid string) model.Portfolio {\n\tfmt.Println(\"get port value from binance\")\n\treturn model.Portfolio{}\n}", "title": "" }, { "docid": "15ab9a56ffc2536212698034e0fa657f", "score": "0.5151244", "text": "func (dh *DeviceHandler) modifyPhyPort(port *voltha.Port, enablePort bool) error {\n\tctx := context.Background()\n\tlogger.Infow(\"modifyPhyPort\", log.Fields{\"port\": port, \"Enable\": enablePort, \"device-id\": dh.device.Id})\n\tif port.GetType() == voltha.Port_ETHERNET_NNI {\n\t\t// Bug is opened for VOL-2505 to support NNI disable feature.\n\t\tlogger.Infow(\"voltha-supports-single-nni-hence-disable-of-nni-not-allowed\",\n\t\t\tlog.Fields{\"device\": dh.device, \"port\": port})\n\t\treturn olterrors.NewErrAdapter(\"illegal-port-request\", log.Fields{\n\t\t\t\"port-type\": port.GetType,\n\t\t\t\"enable-state\": enablePort}, nil)\n\t}\n\t// fetch interfaceid from PortNo\n\tponID := PortNoToIntfID(port.GetPortNo(), voltha.Port_PON_OLT)\n\tponIntf := &oop.Interface{IntfId: ponID}\n\tvar operStatus voltha.OperStatus_Types\n\tif enablePort {\n\t\toperStatus = voltha.OperStatus_ACTIVE\n\t\tout, err := dh.Client.EnablePonIf(ctx, ponIntf)\n\n\t\tif err != nil {\n\t\t\treturn olterrors.NewErrAdapter(\"pon-port-enable-failed\", log.Fields{\n\t\t\t\t\"device-id\": dh.device.Id,\n\t\t\t\t\"port\": port}, err)\n\t\t}\n\t\t// updating interface local cache for collecting stats\n\t\tdh.activePorts.Store(ponID, true)\n\t\tlogger.Infow(\"enabled-pon-port\", log.Fields{\"out\": out, \"device-id\": dh.device, \"Port\": port})\n\t} else {\n\t\toperStatus = voltha.OperStatus_UNKNOWN\n\t\tout, err := dh.Client.DisablePonIf(ctx, ponIntf)\n\t\tif err != nil {\n\t\t\treturn olterrors.NewErrAdapter(\"pon-port-disable-failed\", log.Fields{\n\t\t\t\t\"device-id\": dh.device.Id,\n\t\t\t\t\"port\": port}, err)\n\t\t}\n\t\t// updating interface local cache for collecting stats\n\t\tdh.activePorts.Store(ponID, false)\n\t\tlogger.Infow(\"disabled-pon-port\", log.Fields{\"out\": out, \"device-id\": dh.device, \"Port\": port})\n\t}\n\tif err := dh.coreProxy.PortStateUpdate(ctx, dh.device.Id, voltha.Port_PON_OLT, port.PortNo, operStatus); err != nil {\n\t\treturn olterrors.NewErrAdapter(\"port-state-update-failed\", log.Fields{\n\t\t\t\"device-id\": dh.device.Id,\n\t\t\t\"port\": port.PortNo}, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20eb2dc7959a8401adf279052c878b15", "score": "0.5150807", "text": "func myHtons(port int) uint16{\n\t//method1 14.799us\n\tvar port_t uint16\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf,binary.LittleEndian,uint16(port))\n\tbinary.Read(buf,binary.BigEndian,&port_t)\n\treturn port_t\n}", "title": "" }, { "docid": "c79632ce55f0b004e1a749c8a86a4425", "score": "0.51254326", "text": "func GetPort(addr string) (string, error) {\n\ttks := strings.Split(addr, \":\")\n\tif len(tks) != 2 {\n\t\treturn \"\", errors.New(\"getport: invalid address\")\n\t}\n\n\tif port, err := strconv.Atoi(tks[1]); err != nil || port < minport ||\n\t\tport > maxport {\n\t\treturn \"\", errors.New(\"getport: invalid port\")\n\t}\n\treturn tks[1], nil\n}", "title": "" }, { "docid": "faa438f0b9fa330642c9590ee6387f09", "score": "0.5113539", "text": "func (p Pin) getPMux() uint8 {\n\tswitch uint8(p) >> 1 {\n\tcase 0:\n\t\treturn sam.PORT.PMUX0_0.Get()\n\tcase 1:\n\t\treturn sam.PORT.PMUX0_1.Get()\n\tcase 2:\n\t\treturn sam.PORT.PMUX0_2.Get()\n\tcase 3:\n\t\treturn sam.PORT.PMUX0_3.Get()\n\tcase 4:\n\t\treturn sam.PORT.PMUX0_4.Get()\n\tcase 5:\n\t\treturn sam.PORT.PMUX0_5.Get()\n\tcase 6:\n\t\treturn sam.PORT.PMUX0_6.Get()\n\tcase 7:\n\t\treturn sam.PORT.PMUX0_7.Get()\n\tcase 8:\n\t\treturn sam.PORT.PMUX0_8.Get()\n\tcase 9:\n\t\treturn sam.PORT.PMUX0_9.Get()\n\tcase 10:\n\t\treturn sam.PORT.PMUX0_10.Get()\n\tcase 11:\n\t\treturn sam.PORT.PMUX0_11.Get()\n\tcase 12:\n\t\treturn sam.PORT.PMUX0_12.Get()\n\tcase 13:\n\t\treturn sam.PORT.PMUX0_13.Get()\n\tcase 14:\n\t\treturn sam.PORT.PMUX0_14.Get()\n\tcase 15:\n\t\treturn sam.PORT.PMUX0_15.Get()\n\tcase 16:\n\t\treturn uint8(sam.PORT.PMUX1_0.Get()>>0) & 0xff\n\tcase 17:\n\t\treturn uint8(sam.PORT.PMUX1_0.Get()>>8) & 0xff\n\tcase 18:\n\t\treturn uint8(sam.PORT.PMUX1_0.Get()>>16) & 0xff\n\tcase 19:\n\t\treturn uint8(sam.PORT.PMUX1_0.Get()>>24) & 0xff\n\tcase 20:\n\t\treturn uint8(sam.PORT.PMUX1_4.Get()>>0) & 0xff\n\tcase 21:\n\t\treturn uint8(sam.PORT.PMUX1_4.Get()>>8) & 0xff\n\tcase 22:\n\t\treturn uint8(sam.PORT.PMUX1_4.Get()>>16) & 0xff\n\tcase 23:\n\t\treturn uint8(sam.PORT.PMUX1_4.Get()>>24) & 0xff\n\tcase 24:\n\t\treturn uint8(sam.PORT.PMUX1_8.Get()>>0) & 0xff\n\tcase 25:\n\t\treturn uint8(sam.PORT.PMUX1_8.Get()>>8) & 0xff\n\tcase 26:\n\t\treturn uint8(sam.PORT.PMUX1_8.Get()>>16) & 0xff\n\tcase 27:\n\t\treturn uint8(sam.PORT.PMUX1_8.Get()>>24) & 0xff\n\tcase 28:\n\t\treturn uint8(sam.PORT.PMUX1_12.Get()>>0) & 0xff\n\tcase 29:\n\t\treturn uint8(sam.PORT.PMUX1_12.Get()>>8) & 0xff\n\tcase 30:\n\t\treturn uint8(sam.PORT.PMUX1_12.Get()>>16) & 0xff\n\tcase 31:\n\t\treturn uint8(sam.PORT.PMUX1_12.Get()>>24) & 0xff\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "6e29569fc7922c333107bd17d40d8cd6", "score": "0.5111061", "text": "func (c *GponClient) CreatePortMapping(name string, protocol string, outerPort int, innerIP string, innerPort int) {\n\tvar ret RetVal\n\tc.mustPostFormGetJSON(&ret, c.settingURL(\"pmSetSingle\"), map[string]interface{}{\n\t\t\"op\": \"add\",\n\t\t\"srvname\": name,\n\t\t\"client\": innerIP,\n\t\t\"protocol\": protocol,\n\t\t\"exPort\": outerPort,\n\t\t\"inPort\": innerPort,\n\t})\n\tif ret.RetVal != 0 {\n\t\tlog.Fatalf(\"cannot create port mapping: %v\\n\", ret.RetVal)\n\t}\n}", "title": "" }, { "docid": "b3e03306f4fa085a7f24f40aa8b41bcb", "score": "0.51102716", "text": "func GetHostsPortsProtocol(filename string){\ndata := PrepWork(filename)\n\tfor i := 0; i < len(data.Hosts); i++{\n\t\tfor j := 0; j < len(data.Hosts[i].Addresses); j++{\n\t\t\tif (strings.ToLower(data.Hosts[i].Addresses[j].AddrType)) == \"ipv4\"{\n\t\t\t\tfor k := 0; k < len(data.Hosts[i].Ports); k++{\n\t\t\t\t\tif strings.ToLower(data.Hosts[i].Ports[k].State.State) == \"open\"{\n\t\t\t\t\t\tport_str := strconv.Itoa(data.Hosts[i].Ports[k].PortId)\n\t\t\t\t\t\tprotocol := data.Hosts[i].Ports[k].Protocol\n\t\t\t\t\t\tfmt.Println(data.Hosts[i].Addresses[j].Addr + \":\" + port_str + \" \" + protocol)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (strings.ToLower(data.Hosts[i].Addresses[j].AddrType)) == \"ipv6\"{\n\t\t\t\tfor k := 0; k < len(data.Hosts[i].Ports); k++{\n\t\t\t\t\tif strings.ToLower(data.Hosts[i].Ports[k].State.State) == \"open\"{\n\t\t\t\t\t\t// Print the IP and move on!\n\t\t\t\t\t\tport_str := strconv.Itoa(data.Hosts[i].Ports[k].PortId)\n\t\t\t\t\t\tprotocol := data.Hosts[i].Ports[k].Protocol\n\t\t\t\t\t\tfmt.Println(data.Hosts[i].Addresses[j].Addr + \":\" + port_str + \" \" + protocol)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a005b71c492c88acdb924e189b874dc", "score": "0.50995183", "text": "func getPortForStreamId(streamId common.StreamId) string {\n\n\tvar port string\n\n\tswitch streamId {\n\tcase common.MAINT_STREAM:\n\t\tport = COORD_MAINT_STREAM_PORT\n\tcase common.INIT_STREAM:\n\t\tport = COORD_INIT_STREAM_PORT\n\t}\n\n\treturn port\n}", "title": "" }, { "docid": "2d7e3653218a6b15ffd795b3a3cc892c", "score": "0.509942", "text": "func convertPort(port *types2.Port) *v1.Port {\n\tif port == nil {\n\t\tklog.Warningf(\"Could not convert a Port due to a nil value\")\n\t\treturn &v1.Port{\n\t\t\tName: constant.DubboPortName,\n\t\t\tProtocol: \"dubbo\",\n\t\t\tNumber: 0,\n\t\t}\n\t}\n\n\treturn &v1.Port{\n\t\t// Name: port.Port,\n\t\tName: constant.DubboPortName,\n\t\tProtocol: port.Protocol,\n\t\tNumber: utils.ToUint32(port.Port),\n\t}\n}", "title": "" }, { "docid": "82ef3f5692f9ebf851611d7c56598d79", "score": "0.5095578", "text": "func (dh *DeviceHandler) GetOfpPortInfo(device *voltha.Device, portNo int64) (*ic.PortCapability, error) {\n\tcapacity := uint32(of.OfpPortFeatures_OFPPF_1GB_FD | of.OfpPortFeatures_OFPPF_FIBER)\n\treturn &ic.PortCapability{\n\t\tPort: &voltha.LogicalPort{\n\t\t\tOfpPort: &of.OfpPort{\n\t\t\t\tHwAddr: macAddressToUint32Array(dh.device.MacAddress),\n\t\t\t\tConfig: 0,\n\t\t\t\tState: uint32(of.OfpPortState_OFPPS_LIVE),\n\t\t\t\tCurr: capacity,\n\t\t\t\tAdvertised: capacity,\n\t\t\t\tPeer: capacity,\n\t\t\t\tCurrSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),\n\t\t\t\tMaxSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),\n\t\t\t},\n\t\t\tDeviceId: dh.device.Id,\n\t\t\tDevicePortNo: uint32(portNo),\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "24c138cdf9fee3c04a18fd69882041fc", "score": "0.5070762", "text": "func (c Config) Port(port uint32) Config {\n\tc.port = port\n\treturn c\n}", "title": "" }, { "docid": "0aaf59de57fe4776fdc35865f3f27f8c", "score": "0.50671893", "text": "func (o VCenterPropertiesResponseOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VCenterPropertiesResponse) *string { return v.Port }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "534c59a5e4ba9e1a4c0e1c90a29da429", "score": "0.5054482", "text": "func (p *Project) Port(ctx context.Context, index int, protocol, serviceName, privatePort string) (string, error) {\n\tservice, err := p.CreateService(serviceName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcontainers, err := service.Containers(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif index < 1 || index > len(containers) {\n\t\treturn \"\", fmt.Errorf(\"Invalid index %d\", index)\n\t}\n\n\treturn containers[index-1].Port(ctx, fmt.Sprintf(\"%s/%s\", privatePort, protocol))\n}", "title": "" }, { "docid": "f86110092433d6ba512ec655fe0ba2ff", "score": "0.5051449", "text": "func (ns Networks) Port(label string) AllocatedPortMapping {\n\tfor _, n := range ns {\n\t\tfor _, p := range n.ReservedPorts {\n\t\t\tif p.Label == label {\n\t\t\t\treturn AllocatedPortMapping{\n\t\t\t\t\tLabel: label,\n\t\t\t\t\tValue: p.Value,\n\t\t\t\t\tTo: p.To,\n\t\t\t\t\tHostIP: n.IP,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, p := range n.DynamicPorts {\n\t\t\tif p.Label == label {\n\t\t\t\treturn AllocatedPortMapping{\n\t\t\t\t\tLabel: label,\n\t\t\t\t\tValue: p.Value,\n\t\t\t\t\tTo: p.To,\n\t\t\t\t\tHostIP: n.IP,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn AllocatedPortMapping{}\n}", "title": "" }, { "docid": "bd9216137c43562498279c061e0a5786", "score": "0.5051438", "text": "func getWalletPort(testnet bool) string {\n\tif testnet {\n\t\treturn \"18888\"\n\t}\n\treturn \"8888\"\n}", "title": "" }, { "docid": "59bfa412fc0e0ed9b37e7c361e00afb0", "score": "0.5043152", "text": "func (cc ClusterConfig) Port(name string) uint32 {\n\tif name == cc.ID {\n\t\treturn uint32(cc.GatewayPort)\n\t}\n\tfor _, peer := range cc.WatchedPeers {\n\t\tif name == peer.ID {\n\t\t\treturn uint32(peer.GatewayPort)\n\t\t}\n\t}\n\treturn 8080 // dummy value for unknown clusters\n}", "title": "" }, { "docid": "77ac8e394e32e2a80267865eaf9fbb60", "score": "0.5034405", "text": "func createPortDefinitions(db *pg.DB) error {\n\tports := []Port{\n\t\t{Number: 21, Name: \"FTP\", Description: \"File Transfer Protocol\"},\n\t\t{Number: 22, Name: \"SSH\", Description: \"Secure Shell\"},\n\t\t{Number: 23, Name: \"Telnet\", Description: \"Telnet\"},\n\t\t{Number: 25, Name: \"SMTP\", Description: \"Simple Mail Transfer Protocol\"},\n\t\t{Number: 53, Name: \"DNS\", Description: \"Domain name System\"},\n\t\t{Number: 80, Name: \"HTTP\", Description: \"Hyper Text Transfer Protocol\"},\n\t\t{Number: 102, Name: \"S7\", Description: \"Siemens S7\"},\n\t\t{Number: 110, Name: \"POP3\", Description: \"Post Office Protocol v3\"},\n\t\t{Number: 123, Name: \"NTP\", Description: \"Network Time Protocol\"},\n\t\t{Number: 143, Name: \"IMAP\", Description: \"Internet Message Access Protocol\"},\n\t\t{Number: 443, Name: \"HTTPS\", Description: \"Hyper Text Transfer Protocol Secure\"},\n\t\t{Number: 445, Name: \"SMB\", Description: \"SAMBA\"},\n\t\t{Number: 465, Name: \"SMTP\", Description: \"Simple Mail Transfer Protocol (encrypted)\"},\n\t\t{Number: 502, Name: \"Modbus\", Description: \"Modicon Industrial Protocol\"},\n\t\t{Number: 587, Name: \"SMTP\", Description: \"Simple Mail Transfer Protocol (encrypted)\"},\n\t\t{Number: 623, Name: \"IPMI\", Description: \"Intelligent Platform Managment Interface\"},\n\t\t{Number: 631, Name: \"IPP\", Description: \"Common UNIX Printing System\"},\n\t\t{Number: 993, Name: \"IMAP\", Description: \"Internet Message Access Protocol (encrypted)\"},\n\t\t{Number: 995, Name: \"POP3\", Description: \"Post Office Protocol v3 (encrypted)\"},\n\t\t{Number: 1433, Name: \"MSSQL\", Description: \"Microsoft SQL Server\"},\n\t\t{Number: 1521, Name: \"Oracle\", Description: \"Oracle Server\"},\n\t\t{Number: 1883, Name: \"MQTT\", Description: \"Message Queueing Telemetry Transport\"},\n\t\t{Number: 1900, Name: \"UPnP\", Description: \"Universal Plug and Play\"},\n\t\t{Number: 1911, Name: \"Fox\", Description: \"Fox Protocol\"},\n\t\t{Number: 3306, Name: \"MySQL\", Description: \"MySQL Server & MariaDB Server\"},\n\t\t{Number: 5432, Name: \"Postgres\", Description: \"PostgreSQL Server\"},\n\t\t{Number: 5632, Name: \"pcAnywhere\", Description: \"Symantec pcAnywhere software\"},\n\t\t{Number: 5672, Name: \"AMQP\", Description: \"Advanced Message Queueing Protocol\"},\n\t\t{Number: 5800, Name: \"VNC\", Description: \"Virtual Network Computing (Java)\"},\n\t\t{Number: 5900, Name: \"VNC\", Description: \"Virtual Network Computing\"},\n\t\t{Number: 5901, Name: \"VNC\", Description: \"Virtual Network Computing\"},\n\t\t{Number: 5902, Name: \"VNC\", Description: \"Virtual Network Computing\"},\n\t\t{Number: 5903, Name: \"VNC\", Description: \"Virtual Network Computing\"},\n\t\t{Number: 6443, Name: \"Kubernetes\", Description: \"Open source Container Orchestration System\"},\n\t\t{Number: 7547, Name: \"CWMP\", Description: \"CPE WAN Management Protocol\"},\n\t\t{Number: 8080, Name: \"HTTP\", Description: \"Hyper Text Transfer Protocol (deployment)\"},\n\t\t{Number: 8443, Name: \"HTTPS\", Description: \"Hyper Text Transfer Protocol Secure (deployment)\"},\n\t\t{Number: 8883, Name: \"MQTT\", Description: \"Message Queueing Telemetry Transport\"},\n\t\t{Number: 9090, Name: \"Prometheus\", Description: \"Prometheus Monitoring System\"},\n\t\t{Number: 9200, Name: \"ElasticSearch\", Description: \"ElasticSearch service\"},\n\t\t{Number: 27017, Name: \"MongoDB\", Description: \"MongoDB NOSQL Database\"},\n\t\t{Number: 27018, Name: \"MongoDB\", Description: \"MongoDB NOSQL Database\"},\n\t\t{Number: 47808, Name: \"BACnet\", Description: \"ASHRAE building automation and control networking protocol\"},\n\t}\n\t_, err := db.Model(&ports).OnConflict(\"DO NOTHING\").Insert()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e4882ac0cff48068e70fc04f877c8cd", "score": "0.50334567", "text": "func getPorts(uli [4]byte) (uint16, uint16) {\n\tdport := binary.BigEndian.Uint16(uli[:2])\n\tsport := binary.BigEndian.Uint16(uli[2:])\n\treturn sport, dport\n}", "title": "" }, { "docid": "e703c951c7ffa964c88a26e2bd721757", "score": "0.5032988", "text": "func getPMux(p uint8) sam.RegValue8 {\n\tpin := p >> 1\n\tswitch pin {\n\tcase 0:\n\t\treturn sam.PORT.PMUX0_0\n\tcase 1:\n\t\treturn sam.PORT.PMUX0_1\n\tcase 2:\n\t\treturn sam.PORT.PMUX0_2\n\tcase 3:\n\t\treturn sam.PORT.PMUX0_3\n\tcase 4:\n\t\treturn sam.PORT.PMUX0_4\n\tcase 5:\n\t\treturn sam.PORT.PMUX0_5\n\tcase 6:\n\t\treturn sam.PORT.PMUX0_6\n\tcase 7:\n\t\treturn sam.PORT.PMUX0_7\n\tcase 8:\n\t\treturn sam.PORT.PMUX0_8\n\tcase 9:\n\t\treturn sam.PORT.PMUX0_9\n\tcase 10:\n\t\treturn sam.PORT.PMUX0_10\n\tcase 11:\n\t\treturn sam.PORT.PMUX0_11\n\tcase 12:\n\t\treturn sam.PORT.PMUX0_12\n\tcase 13:\n\t\treturn sam.PORT.PMUX0_13\n\tcase 14:\n\t\treturn sam.PORT.PMUX0_14\n\tcase 15:\n\t\treturn sam.PORT.PMUX0_15\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "014a52b07e7a605eb2226fb8e7669c5d", "score": "0.50183576", "text": "func applySwarmPortConfigOption(rep repo.Repo, ports string) error {\n\tvar parts []string\n\tif ports != \"\" {\n\t\tparts = strings.Split(ports, \",\")\n\t}\n\tvar tcp, ws string\n\n\tswitch len(parts) {\n\tcase 1:\n\t\ttcp = parts[0]\n\tcase 2:\n\t\ttcp = parts[0]\n\t\tws = parts[1]\n\tdefault:\n\t\ttcp = GetRandomPort()\n\t\tws = GetRandomPort()\n\t}\n\n\tlist := []string{\n\t\tfmt.Sprintf(\"/ip4/0.0.0.0/tcp/%s\", tcp),\n\t\tfmt.Sprintf(\"/ip6/::/tcp/%s\", tcp),\n\t}\n\tif ws != \"\" {\n\t\tlist = append(list, fmt.Sprintf(\"/ip4/0.0.0.0/tcp/%s/ws\", ws))\n\t\tlist = append(list, fmt.Sprintf(\"/ip6/::/tcp/%s/ws\", ws))\n\t}\n\n\treturn rep.SetConfigKey(\"Addresses.Swarm\", list)\n}", "title": "" }, { "docid": "65f0e4fb77b71104a301c38a68444403", "score": "0.501528", "text": "func Port() int {\n\treturn viper.GetInt(\"port\")\n}", "title": "" }, { "docid": "2cf3bd206fe76da9d1d91d92f813d29a", "score": "0.49934536", "text": "func (c *Config) newTopoRunner(n *TopologyEntry) (*topoRunner, error) {\n\texp := make(map[pickett_io.Port][]pickett_io.PortBinding)\n\n\t//convert zero or any negative value to 1\n\tif n.Instances < 1 {\n\t\tn.Instances = 1\n\t}\n\n\t//convert to the pickett_io format\n\tfor k, v := range n.Expose {\n\t\tkey := pickett_io.Port(k)\n\t\tcurr, ok := exp[key]\n\t\tif !ok {\n\t\t\tcurr = []pickett_io.PortBinding{}\n\t\t}\n\t\tvar b pickett_io.PortBinding\n\t\tb.HostIp = \"0.0.0.0\"\n\t\tb.HostPort = fmt.Sprintf(\"%d\", v)\n\t\texp[key] = append(curr, b)\n\t}\n\n\tresult := &topoRunner{\n\t\tn: n.Name,\n\t\texpose: exp,\n\t\tdevs: n.Devices,\n\t\tpriv: n.Privileged,\n\t\twait: n.WaitFor,\n\t}\n\tpol := defaultPolicy()\n\tswitch strings.ToUpper(n.Policy) {\n\tcase \"BY_HAND\":\n\t\tpol.startIfNonExistant = false\n\t\tpol.stop = NEVER\n\t\tpol.rebuildIfOOD = false\n\tcase \"KEEP_UP\":\n\t\tpol.stop = NEVER\n\tcase \"CONTINUE\":\n\t\tpol.stop = NEVER\n\t\tpol.start = CONTINUE\n\tcase \"FRESH\", \"\": //we allow an empty string to mean FRESH\n\t\t//nothing to do, its all defaults\n\tcase \"ALWAYS\":\n\t\tpol.stop = ALWAYS\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown policy %s chosen for %s\", n.Policy, n.Name)\n\t}\n\tresult.policy = pol\n\n\t//copy entry point if provided\n\tresult.entry = n.EntryPoint\n\treturn result, nil\n}", "title": "" }, { "docid": "914b663acbafb065176130dddc68f313", "score": "0.49878868", "text": "func (o ProviderOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.Port }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c07a15c5f2bd6e312479bde8c4c86240", "score": "0.49813527", "text": "func (rt *Router) Port(prt string) *RouterEntry {\n\tif rt == nil {\n\t\treturn nil\n\t}\n\ttmp := &RouterEntry{}\n\trt.ports[prt] = tmp\n\treturn tmp\n}", "title": "" }, { "docid": "d8d852a12120fe515ef431bbb4e1a8c9", "score": "0.49759322", "text": "func (o *NiatelemetryAaaLdapProviderDetailsAllOf) GetPort() string {\n\tif o == nil || o.Port == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Port\n}", "title": "" }, { "docid": "1a2cbe1bddd57ca18955b430d976071c", "score": "0.497578", "text": "func (o GetDataLimitsLimitOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetDataLimitsLimit) int { return v.Port }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "56c5bd375d6adf512f078388bb1a5414", "score": "0.49739474", "text": "func (o VirtualRouterSpecListenerPortMappingOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v VirtualRouterSpecListenerPortMapping) int { return v.Port }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "3c58e03e9459cdc0cfac70d81e57c6f7", "score": "0.4972981", "text": "func getTargetPort(service *corev1.Service, port Port) namedPort {\n\t// Use the specified port as the target port by default\n\ttargetPort := intstr.FromInt(int(port))\n\n\tif service == nil {\n\t\treturn targetPort\n\t}\n\n\t// If a port spec exists with a port matching the specified port use that\n\t// port spec's name as the target port\n\tfor _, portSpec := range service.Spec.Ports {\n\t\tif portSpec.Port == int32(port) {\n\t\t\treturn intstr.FromString(portSpec.Name)\n\t\t}\n\t}\n\n\treturn targetPort\n}", "title": "" }, { "docid": "fff3eed64a986c2d8c8bbfd1c083bbf9", "score": "0.49597546", "text": "func Port(port uint16) Configurer {\n\treturn func(c *Config) error {\n\t\tc.port = port\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "983da986e42cfcc0e0a86a97ab26647d", "score": "0.49587977", "text": "func (o VirtualGatewaySpecListenerPortMappingOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v VirtualGatewaySpecListenerPortMapping) int { return v.Port }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "024c467a031c3a5db4548b7b3a58d1b8", "score": "0.4957878", "text": "func GetportLabel(portNum uint32, portType voltha.Port_PortType) (string, error) {\n\n\tswitch portType {\n\tcase voltha.Port_ETHERNET_NNI:\n\t\treturn fmt.Sprintf(\"nni-%d\", portNum), nil\n\tcase voltha.Port_PON_OLT:\n\t\treturn fmt.Sprintf(\"pon-%d\", portNum), nil\n\t}\n\n\treturn \"\", olterrors.NewErrInvalidValue(log.Fields{\"port-type\": portType}, nil)\n}", "title": "" }, { "docid": "4dc1d66e9dd7cfd0ceb485abf6fb4d6c", "score": "0.4957218", "text": "func (p *Port) Port() string {\n\treturn strconv.Itoa(int(*p))\n}", "title": "" }, { "docid": "6cefeb19077e1e9053906484c2072ad7", "score": "0.49565423", "text": "func (o NetworkPolicyPortOutput) Port() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v NetworkPolicyPort) interface{} { return v.Port }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "71a124ee4defa0a70970f1786bcc35c7", "score": "0.49562657", "text": "func GetConfigHandlerPort(paramsDir string) (bool, string) {\n\tvar globals []ConfdGlobals\n\tvar port string\n\n\tglobalsFile := paramsDir + \"/globals.json\"\n\tbytes, err := ioutil.ReadFile(globalsFile)\n\tif err != nil {\n\t\tgConfigMgr.logger.Err(fmt.Sprintln(\"Error in reading globals file\", globalsFile))\n\t\treturn false, port\n\t}\n\n\terr = json.Unmarshal(bytes, &globals)\n\tif err != nil {\n\t\tgConfigMgr.logger.Err(\"Failed to Unmarshall Json\")\n\t\treturn false, port\n\t}\n\tfor _, global := range globals {\n\t\tif global.Name == \"httpport\" {\n\t\t\tport = global.Value\n\t\t\treturn true, port\n\t\t}\n\t}\n\treturn false, port\n}", "title": "" }, { "docid": "7c9aa9c4a1d297baa236568dd4265431", "score": "0.49516785", "text": "func (c *providerClient) CreateNetworkPort(network, port, macAddress string) (string, bool, error) {\n\tvar result map[string]map[string]interface{}\n\n\t// TODO: check provider error output\n\t_, err := c.client.R().\n\t\tSetResult(&result).\n\t\tSetBody(\n\t\t\tmap[string]map[string]interface{}{\n\t\t\t\t\"port\": map[string]interface{}{\n\t\t\t\t\t\"network_id\": network,\n\t\t\t\t\t\"name\": port,\n\t\t\t\t\t\"mac_address\": macAddress,\n\t\t\t\t\t\"admin_state_up\": true,\n\t\t\t\t},\n\t\t\t},\n\t\t).\n\t\tPost(\"v2.0/ports\")\n\n\tportID := result[\"port\"][\"id\"].(string)\n\thasFixedIPs := len(result[\"port\"][\"fixed_ips\"].([]interface{})) != 0\n\n\treturn portID, hasFixedIPs, err\n}", "title": "" }, { "docid": "50dcaebf3725f577b06a037a6c90305a", "score": "0.4951523", "text": "func (o GetCustomRoutingPortMappingsCustomRoutingPortMappingDestinationSocketAddressOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetCustomRoutingPortMappingsCustomRoutingPortMappingDestinationSocketAddress) int {\n\t\treturn v.Port\n\t}).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "256cf1b112c434fb3d6d4c3a82187977", "score": "0.49398544", "text": "func (c mockNetworkConfig) PortBits() uint {\n\treturn uint(8)\n}", "title": "" }, { "docid": "52952eb4eb86ddb82001724b5e5d78be", "score": "0.4939428", "text": "func createEndpointPortSpec(endpointPort int, endpointPortName string) []corev1.EndpointPort {\n\treturn []corev1.EndpointPort{{\n\t\tProtocol: corev1.ProtocolTCP,\n\t\tPort: int32(endpointPort),\n\t\tName: endpointPortName,\n\t}}\n}", "title": "" }, { "docid": "52952eb4eb86ddb82001724b5e5d78be", "score": "0.4939428", "text": "func createEndpointPortSpec(endpointPort int, endpointPortName string) []corev1.EndpointPort {\n\treturn []corev1.EndpointPort{{\n\t\tProtocol: corev1.ProtocolTCP,\n\t\tPort: int32(endpointPort),\n\t\tName: endpointPortName,\n\t}}\n}", "title": "" }, { "docid": "2d9870a6503fca318a562c627a05d48b", "score": "0.4933468", "text": "func (o RouteSpecTcpRouteActionWeightedTargetOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RouteSpecTcpRouteActionWeightedTarget) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "238d8a2732e43f0a3fd2f70c3b60fb06", "score": "0.4931102", "text": "func (s *Setting) GetDBPort() string { return s.Database.Port }", "title": "" }, { "docid": "00ed3ae3cf12b5d536b454fc06d5a3da", "score": "0.4926096", "text": "func getProtocol(svcPorts string, port int) (string, string) {\n\tvar protoName string\n\tsub := strings.Split(svcPorts, \"|\")\n\tn := len(sub)\n\tif n < 2 {\n\t\treturn \"\", \"\"\n\t}\n\tsvcName := sub[n-1]\n\n\tpstr := strconv.Itoa(port)\n\tif pstr == \"\" {\n\t\treturn \"\", \"\"\n\t}\n\tfor _, s := range sub {\n\t\tif strings.Contains(s, pstr) {\n\t\t\tprotoName = strings.Split(s, \",\")[0]\n\t\t\tbreak\n\t\t}\n\t}\n\treturn protoName, svcName\n}", "title": "" }, { "docid": "fba3022f5a52d54d8bc4643d0b79dcbb", "score": "0.49224946", "text": "func (pwm PWM) getPinCfg() sam.RegValue8 {\n\treturn getPinCfg(pwm.Pin)\n}", "title": "" }, { "docid": "16d1f304c57157cf7e00dab240ebccd0", "score": "0.49135742", "text": "func (p *Proxy) allocatePort(port, min, max uint16) (uint16, error) {\n\t// Get a snapshot of the TCP and UDP ports already open locally.\n\topenLocalPorts := readOpenLocalPorts(append(procNetTCPFiles, procNetUDPFiles...))\n\n\tif p.isPortAvailable(openLocalPorts, port, false) {\n\t\treturn port, nil\n\t}\n\n\t// TODO: Maybe not create a large permutation each time?\n\tportRange := portRandomizer.Perm(int(max - min + 1))\n\n\t// Allow reuse of previously used ports only if no ports are otherwise availeble.\n\t// This allows the same port to be used again by a listener being reconfigured\n\t// after deletion.\n\tfor _, reuse := range []bool{false, true} {\n\t\tfor _, r := range portRange {\n\t\t\tresPort := uint16(r) + min\n\n\t\t\tif p.isPortAvailable(openLocalPorts, resPort, reuse) {\n\t\t\t\treturn resPort, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0, fmt.Errorf(\"no available proxy ports\")\n}", "title": "" }, { "docid": "b29676716efe209735abc12c5a3c7402", "score": "0.48931777", "text": "func (pr *PortRegulator) GetPort() int {\n\tpr.Value = pr.Value + 1\n\treturn pr.Value\n}", "title": "" }, { "docid": "01633c032e829ac3e7bf5f28be9d66ef", "score": "0.48817912", "text": "func (a *Client) PortGet(params *PortGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PortGetOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPortGetParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"port_get\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/storage/ports/{node.uuid}/{name}\",\n\t\tProducesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/hal+json\", \"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PortGetReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PortGetOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PortGetDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "20faef8846dd1484b7db4bd8e7ebc62c", "score": "0.48805088", "text": "func (c AppConfig) PortToStr() string {\n\treturn strconv.Itoa(c.Port)\n}", "title": "" }, { "docid": "5d9581492279a61cb3e843106a062082", "score": "0.4876239", "text": "func createConfiguration() *configuration {\n\tportsBase := flag.Int(\"port_base\", 21380, \"Base port number\")\n\tportsRangeSize := flag.Int(\"port_range\", 10, \"Size of the ports range\")\n\ttolerance := flag.Int(\"tolerance\", 20, \"Percent of tolerance for port bind failures\")\n\tflag.Parse()\n\tc := configuration{\n\t\tportsBase : *portsBase,\n\t\tportsRangeSize : *portsRangeSize,\n\t\ttolerance : *tolerance,\n\t\tlastSessionID : sessionID(0),\n\t\tmapSessions : make(map[sessionID]sessionState), \n\t\tmapTuples : make(map[keyID]sessionID),\n\t}\n\tresult := &c\n\tresult.initCombinationsGenerator()\n\t\n\treturn result\n}", "title": "" }, { "docid": "94391f0e31549eb80c9313c0778440ba", "score": "0.4869294", "text": "func (t *Translator) getServicePort(id utils.ServicePortID, params *getServicePortParams, namer namer_util.BackendNamer) (*utils.ServicePort, error, bool) {\n\tsvc, err := t.getCachedService(id)\n\tif err != nil {\n\t\treturn nil, err, false\n\t}\n\n\tport := ServicePort(*svc, id.Port)\n\tif port == nil {\n\t\t// This is a fatal error.\n\t\treturn nil, errors.ErrSvcPortNotFound{ServicePortID: id}, false\n\t}\n\n\t// We periodically add information to the ServicePort to ensure that we\n\t// always return as much as possible, rather than nil, if there was a non-fatal error.\n\tsvcPort := &utils.ServicePort{\n\t\tID: id,\n\t\tNodePort: int64(port.NodePort),\n\t\tPort: port.Port,\n\t\tPortName: port.Name,\n\t\tTargetPort: port.TargetPort,\n\t\tL7ILBEnabled: params.isL7ILB,\n\t\tBackendNamer: namer,\n\t}\n\n\tif err := maybeEnableNEG(svcPort, svc); err != nil {\n\t\treturn nil, err, false\n\t}\n\n\tif err := setAppProtocol(svcPort, svc, port); err != nil {\n\t\treturn svcPort, err, false\n\t}\n\n\tif flags.F.EnableTrafficScaling {\n\t\tif err := setTrafficScaling(svcPort, svc); err != nil {\n\t\t\treturn nil, err, false\n\t\t}\n\t}\n\n\tif err := t.maybeEnableBackendConfig(svcPort, svc, port); err != nil {\n\t\treturn svcPort, err, false\n\t}\n\n\tflagWarning := t.setThcOptInOnSvc(svcPort, svc)\n\n\treturn svcPort, nil, flagWarning\n}", "title": "" }, { "docid": "c64f2ac3e5246c5efcf5d6876cc90af1", "score": "0.4866731", "text": "func (o VirtualNodeSpecListenerPortMappingOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v VirtualNodeSpecListenerPortMapping) int { return v.Port }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "66b57347db88cc9120b2f53191849369", "score": "0.4853974", "text": "func getPort() string {\n\tif port := os.Getenv(\"PORT\"); port != \"\" {\n\t\treturn \":\" + port\n\t}\n\treturn \":8000\"\n}", "title": "" }, { "docid": "5dc5e14876e74911b4ebc57f4297b783", "score": "0.48506224", "text": "func GetPortNumber() int {\n\treturn <-intSource\n}", "title": "" }, { "docid": "29cd7afb48bc71667559a865c7e771c4", "score": "0.48443776", "text": "func (p Pin) setPMux(val uint8) {\n\tswitch uint8(p) >> 1 {\n\tcase 0:\n\t\tsam.PORT.PMUX0_0.Set(val)\n\tcase 1:\n\t\tsam.PORT.PMUX0_1.Set(val)\n\tcase 2:\n\t\tsam.PORT.PMUX0_2.Set(val)\n\tcase 3:\n\t\tsam.PORT.PMUX0_3.Set(val)\n\tcase 4:\n\t\tsam.PORT.PMUX0_4.Set(val)\n\tcase 5:\n\t\tsam.PORT.PMUX0_5.Set(val)\n\tcase 6:\n\t\tsam.PORT.PMUX0_6.Set(val)\n\tcase 7:\n\t\tsam.PORT.PMUX0_7.Set(val)\n\tcase 8:\n\t\tsam.PORT.PMUX0_8.Set(val)\n\tcase 9:\n\t\tsam.PORT.PMUX0_9.Set(val)\n\tcase 10:\n\t\tsam.PORT.PMUX0_10.Set(val)\n\tcase 11:\n\t\tsam.PORT.PMUX0_11.Set(val)\n\tcase 12:\n\t\tsam.PORT.PMUX0_12.Set(val)\n\tcase 13:\n\t\tsam.PORT.PMUX0_13.Set(val)\n\tcase 14:\n\t\tsam.PORT.PMUX0_14.Set(val)\n\tcase 15:\n\t\tsam.PORT.PMUX0_15.Set(val)\n\tcase 16:\n\t\tsam.PORT.PMUX1_0.Set(sam.PORT.PMUX1_0.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 17:\n\t\tsam.PORT.PMUX1_0.Set(sam.PORT.PMUX1_0.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 18:\n\t\tsam.PORT.PMUX1_0.Set(sam.PORT.PMUX1_0.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 19:\n\t\tsam.PORT.PMUX1_0.Set(sam.PORT.PMUX1_0.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 20:\n\t\tsam.PORT.PMUX1_4.Set(sam.PORT.PMUX1_4.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 21:\n\t\tsam.PORT.PMUX1_4.Set(sam.PORT.PMUX1_4.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 22:\n\t\tsam.PORT.PMUX1_4.Set(sam.PORT.PMUX1_4.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 23:\n\t\tsam.PORT.PMUX1_4.Set(sam.PORT.PMUX1_4.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 24:\n\t\tsam.PORT.PMUX1_8.Set(sam.PORT.PMUX1_8.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 25:\n\t\tsam.PORT.PMUX1_8.Set(sam.PORT.PMUX1_8.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 26:\n\t\tsam.PORT.PMUX1_8.Set(sam.PORT.PMUX1_8.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 27:\n\t\tsam.PORT.PMUX1_8.Set(sam.PORT.PMUX1_8.Get()&^(0xff<<24) | (uint32(val) << 24))\n\tcase 28:\n\t\tsam.PORT.PMUX1_12.Set(sam.PORT.PMUX1_12.Get()&^(0xff<<0) | (uint32(val) << 0))\n\tcase 29:\n\t\tsam.PORT.PMUX1_12.Set(sam.PORT.PMUX1_12.Get()&^(0xff<<8) | (uint32(val) << 8))\n\tcase 30:\n\t\tsam.PORT.PMUX1_12.Set(sam.PORT.PMUX1_12.Get()&^(0xff<<16) | (uint32(val) << 16))\n\tcase 31:\n\t\tsam.PORT.PMUX1_12.Set(sam.PORT.PMUX1_12.Get()&^(0xff<<24) | (uint32(val) << 24))\n\t}\n}", "title": "" }, { "docid": "4caadb361cafdb844d6872de677d44f5", "score": "0.48361158", "text": "func (application *Application) Port() uint64 {\n partedString := strings.Split(application.Service().Server().Options().Address, \":\")\n servicePortAsString := partedString[len(partedString) - 1]\n\n if servicePortAsString == \"\" {\n servicePortAsString = \"0\"\n }\n port, err := strconv.ParseUint(servicePortAsString, 10, 64)\n if err != nil {\n panic(err)\n }\n return port\n}", "title": "" }, { "docid": "f86628f8ee30c6f96c01791ce0b5ff3d", "score": "0.48351172", "text": "func uint32FieldToPort(be uint32) uint16 {\n\treturn binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&be))[:])\n}", "title": "" }, { "docid": "aeca8fd3ce602c5ba60edddc35e5041d", "score": "0.48331508", "text": "func (o VCenterPropertiesResponsePtrOutput) Port() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VCenterPropertiesResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bb4a2b23b92d3c1b99e7c694b9774d76", "score": "0.48278907", "text": "func (info *endpointsInfo) Port() (int, error) {\n\treturn int(info.port), nil\n}", "title": "" }, { "docid": "a6fbc81ac3d41f63c661c654ada58e4b", "score": "0.48237535", "text": "func GetHostPorts(filename string){\n\tdata := PrepWork(filename)\n\ts := make([]int, 0)\n\tfor i := 0; i < len(data.Hosts); i++{\n\t\tfor j := 0; j < len(data.Hosts[i].Addresses); j++{\n\t\t\tif (strings.ToLower(data.Hosts[i].Addresses[j].AddrType)) == \"ipv4\"{\n\t\t\t\tfor k := 0; k < len(data.Hosts[i].Ports); k++{\n\t\t\t\t\tif strings.ToLower(data.Hosts[i].Ports[k].State.State) == \"open\"{\n\t\t\t\t\t\tport_str := strconv.Itoa(data.Hosts[i].Ports[k].PortId)\n\t\t\t\t\t\tfmt.Println(data.Hosts[i].Addresses[j].Addr + \":\" + port_str)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (strings.ToLower(data.Hosts[i].Addresses[j].AddrType)) == \"ipv6\"{\n\t\t\t\tfor k := 0; k < len(data.Hosts[i].Ports); k++{\n\t\t\t\t\tif strings.ToLower(data.Hosts[i].Ports[k].State.State) == \"open\"{\n\t\t\t\t\t\tport_str := strconv.Itoa(data.Hosts[i].Ports[k].PortId)\n\t\t\t\t\t\tfmt.Println(data.Hosts[i].Addresses[j].Addr + \":\" + port_str)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tMultiLineInt(s)\n}", "title": "" }, { "docid": "febc37aad9f67cbbf60e49fff9b3cfff", "score": "0.4821874", "text": "func (o CustomRoutingEndpointTrafficPolicyPortRangeOutput) FromPort() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v CustomRoutingEndpointTrafficPolicyPortRange) *int { return v.FromPort }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "06e8ea616c21ab77348417083369c9c0", "score": "0.48202413", "text": "func (l *LimitSwitchDriver) Pin() string { return l.pin }", "title": "" }, { "docid": "ad84640260b40fc0c5f6f6bd1809b5ee", "score": "0.48191407", "text": "func PortWrite(env runtime.Env, args runtime.Sequence) (runtime.Value, error) {\n\tvar port, value runtime.Value\n\tif err := runtime.ReadArgs(args, &port, &value); err != nil {\n\t\treturn nil, err\n\t}\n\tp, ok := port.(runtime.Port)\n\tif ok == false {\n\t\treturn nil, runtime.BadType(runtime.PortType, port.Type())\n\t}\n\n\terr := p.Write(value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "a4159ddd581f69db2823fd7358490ea2", "score": "0.48182553", "text": "func (o RouteSpecGrpcRouteActionWeightedTargetOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RouteSpecGrpcRouteActionWeightedTarget) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "0029c5e733e163083f53fd2bac84c46f", "score": "0.4817824", "text": "func generateRGWPortToUse() string {\n\tmaxPort := 8100\n\tfor i := 8000; i <= maxPort; i++ {\n\t\tportNumStr := fmt.Sprint(i)\n\t\tstatus := checkPortInUsed(portNumStr)\n\t\tif status {\n\t\t\treturn portNumStr\n\t\t}\n\t}\n\treturn \"notfound\"\n}", "title": "" }, { "docid": "bedbc9c7aefaae0b6c1a365cfbea2035", "score": "0.48106548", "text": "func getServicePort(svc *corev1.Service) string {\n\tif svc.Spec.Ports[0].TargetPort.StrVal != \"\" {\n\t\treturn svc.Spec.Ports[0].TargetPort.String()\n\t}\n\treturn strconv.Itoa(int(svc.Spec.Ports[0].Port))\n}", "title": "" } ]
48d441ec1f81f726f8365c7b67b65fb7
WsHandler handle all coming request from WebSocket
[ { "docid": "4b014200b03bb5b758fcb83803b685af", "score": "0.6749629", "text": "func WsHandler(ctx context.Context, c *gin.Context) {\n\tlog.Printf(\"%s connected to %s \\n\", c.Request.RemoteAddr, c.Request.RequestURI)\n\tws, err := upGrader.Upgrade(c.Writer, c.Request, nil)\n\tif err != nil {\n\t\tlog.Print(\"upgrade error:\", err)\n\t\treturn\n\t}\n\tstx, cancel := context.WithCancel(ctx)\n\tws.SetCloseHandler(func(code int, txt string) error {\n\t\treturn WsCloseHandler(cancel, code, txt)\n\t})\n\t//ws.SetWriteDeadline(time.Now().Add(5 * time.Second))\n\tdefer ws.Close()\n\n\tlinuxCommand := c.Query(\"linuxCommand\") == \"true\"\n\tdryRun := c.Query(\"dryRun\") == \"true\"\n\tparallel := c.Query(\"parallel\") == \"true\"\n\tfor {\n\t\tmt, message, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(\"read error:\", err)\n\t\t\tbreak\n\t\t}\n\t\tlog.Printf(\"recv: %s\\n\", message)\n\n\t\twb := WsBox{out: ws}\n\t\tif linuxCommand {\n\t\t\tep := &engine.ExecutionPlan{}\n\t\t\terr = ep.LinuxCommandExecutor(stx, message, nil, wb.out)\n\t\t} else {\n\t\t\terr = wb.Processor(stx, mt, message, dryRun, parallel)\n\t\t}\n\t\tif err != nil {\n\t\t\tengine.SR(wb.out, []byte(\"d-error=\"+err.Error()))\n\t\t}\n\t\t// Signal client all done & Could close connection if need to\n\t\tengine.SR(wb.out, []byte(\"d-done\"))\n\t}\n}", "title": "" } ]
[ { "docid": "8dc6fe0150874889a0f7693f1a301e15", "score": "0.7674834", "text": "func wsHandler(w http.ResponseWriter, r *http.Request) {\n\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\n\t// Upgrade the http connection to a WebSocket connection\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\tgo readSocket(conn)\n}", "title": "" }, { "docid": "5535ccc1c98d725fa30b06958e2ebcac", "score": "0.76691306", "text": "func (w *Worker) wsHandler(wr http.ResponseWriter, r *http.Request) {\n\tconn, err := websocket.Upgrade(wr, r, wr.Header(), 1024, 1024)\n\tif err != nil {\n\t\thttp.Error(wr, \"Could not open websocket connection\", http.StatusBadRequest)\n\t}\n\n\t_clientID, _ := r.URL.Query()[\"userID\"]\n\tif len(_clientID) == 0 {\n\t\thttp.Error(wr, \"Missing clientID in URL parameter\", http.StatusBadRequest)\n\t}\n\n\t_sessionID, _ := r.URL.Query()[\"sessionID\"]\n\tif len(_sessionID) == 0 {\n\t\thttp.Error(wr, \"Missing sessionID in URL parameter\", http.StatusBadRequest)\n\t}\n\n\tclientID := _clientID[0]\n\tsessionID := _sessionID[0]\n\n\tw.logger.Println(\"New socket connection from: \", clientID, sessionID)\n\n\tw.clients[clientID] = conn\n\tw.clientSessions[sessionID] = append(w.clientSessions[sessionID], clientID)\n\n\tgo w.onElement(conn, clientID)\n}", "title": "" }, { "docid": "36853088e7bda9f0fa246016d57bbd59", "score": "0.7438578", "text": "func websocketHandler(log *zerolog.Logger, upgrader websocket.Upgrader) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// This addresses the issue of r.Host includes port but origin header doesn't\n\t\thost, _, err := net.SplitHostPort(r.Host)\n\t\tif err == nil {\n\t\t\tr.Host = host\n\t\t}\n\n\t\tconn, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.Err(err).Msg(\"failed to upgrade to websocket connection\")\n\t\t\treturn\n\t\t}\n\t\tdefer conn.Close()\n\t\tfor {\n\t\t\tmt, message, err := conn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Err(err).Msg(\"websocket read message error\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err := conn.WriteMessage(mt, message); err != nil {\n\t\t\t\tlog.Err(err).Msg(\"websocket write message error\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5f5682f0e612e026d5e1588359aa61a3", "score": "0.73245025", "text": "func (s *WebServer) websocketHandler(w http.ResponseWriter, r *http.Request) {\n\tclient, err := s.socket.UpgradeConnection(w, r)\n\tif err != nil {\n\t\tlog.Printf(\"Upgrade to websocket protocol failed: %s\", err)\n\t\treturn\n\t}\n\n\ts.socket.RegisterClient(client)\n}", "title": "" }, { "docid": "9752d5e6f20cf52dab51b728a8f52c41", "score": "0.7321316", "text": "func (server *Server) serveWs(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\n\tsocket, err := server.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tc := &connection{\n\t\tsend: make(chan []byte, sendBufferSize),\n\t\tws: socket,\n\t\tserver: server,\n\t}\n\tserver.register <- c\n\n\t// pump messages from this connection to the hub\n\tgo c.readPump()\n\n\t// pump messages from the hub to this connection\n\tgo c.writePump()\n\n}", "title": "" }, { "docid": "30aaef92abba4650b28c9b266906404f", "score": "0.72141546", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\n\t// application id\n\tappID := r.URL.Query().Get(\"app_id\")\n\tapp, err := verifyApp(appID)\n\tif err != nil {\n\t\tlog.Println(\"verifyApp\", err)\n\t\treturn\n\t}\n\n\t// user id\n\tuserID := r.URL.Query().Get(\"user_id\")\n\n\t// user message token\n\tmessageToken := r.URL.Query().Get(\"message_token\")\n\n\tuser, err := authUser(app, userID, messageToken)\n\tif err != nil {\n\t\tlog.Println(\"authUser\", err)\n\t\treturn\n\t}\n\n\t// get user all channel ids\n\n\t// websocket\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// client\n\tclient := &Client{\n\t\tapp: app,\n\t\tuser: user,\n\t\thub: hub,\n\t\tconn: conn,\n\t\tsend: make(chan []byte, 256),\n\t\tchannelIds: make(map[string]bool),\n\t}\n\tclient.hub.register <- client\n\tclient.channelIds = user.GetChannelIds()\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "0898cdc19a1593a7d10a12ddce552e99", "score": "0.7196413", "text": "func (s *Server) WSHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\tWriteError(w, r, 400, \"Method not allowed\")\n\t\treturn\n\t}\n\n\tvar user = User{\n\t\tUUID: r.Header.Get(\"UUID\"),\n\t\tUUIDKey: r.Header.Get(\"UUID-key\"),\n\t}\n\tUUIDHash := Hash(user.UUID)\n\n\tif !user.IsValid(s.db) {\n\t\tWriteError(w, r, 401, \"Invalid credentials!\")\n\t\treturn\n\t}\n\n\t// validate inputs\n\tif !IsValidVersion(r.Header.Get(\"Version\")) {\n\t\tWriteError(w, r, 400, \"Invalid Version\")\n\t\treturn\n\t}\n\n\t// connect to socket\n\twsconn, err := upgrader.Upgrade(w, r, nil)\n\tHandle(err)\n\tf := Funnel{}\n\tf.conn = wsconn\n\n\t// add web socket connection to list of clients\n\tWSConns.AddConn(UUIDHash, &f)\n\n\t// mark user as connected in db\n\tgo user.IsConnected(s.db, true)\n\n\t// write pending messages\n\tPendingMessages.RLock()\n\tmessages, ok := PendingMessages.messages[UUIDHash]\n\tPendingMessages.RUnlock()\n\tif ok {\n\t\t// send pending messages to user\n\t\tfor _, message := range messages {\n\t\t\tgo f.Write(message)\n\t\t}\n\t}\n\n\t// delete pending socket messages\n\tPendingMessages.Lock()\n\tdelete(PendingMessages.messages, UUIDHash)\n\tPendingMessages.Unlock()\n\n\t// incoming socket messages\n\tfor {\n\t\t_, message, err := wsconn.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tvar mess IncomingSocketMessage\n\t\tHandle(json.Unmarshal(message, &mess))\n\t\tif mess.Type == \"keep-alive\" {\n\t\t\tgo KeepAliveTransfer(s.db, user, mess.Content)\n\t\t} else if mess.Type == \"stats\" {\n\t\t\tuser.SetStats(s.db)\n\t\t\tWSConns.Write(SocketMessage{\n\t\t\t\tUser: &user,\n\t\t\t}, user.UUID, true)\n\t\t}\n\t\tbreak\n\t}\n\n\t// mark user as disconnected\n\tgo user.IsConnected(s.db, false)\n\n\t// remove client from clients\n\tWSConns.RemConn(UUIDHash)\n}", "title": "" }, { "docid": "9585d1b3454a906d64684c1d7b701b56", "score": "0.7176793", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tsUserID, ok := vars[\"user_id\"]\n\tif !ok {\n\t\thttp.Error(w, \"Invalid url\", 405)\n\t\treturn\n\t}\n\n\tuserID, err := strconv.Atoi(sUserID)\n\tif err != nil {\n\t\thttp.Error(w, \"Invalid url\", 405)\n\t\treturn\n\t}\n\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Error(\"%v\", err)\n\t\treturn\n\t}\n\tlog.Info(\"creating connection for %d\", userID)\n\t// Create Connection\n\tc := &Connection{ws: ws, id: userID, receive: make(chan Message, 256)}\n\tctrlmsg := &CtrlMessage{op: OpConnect, conn: c}\n\tMyHub.ctrl <- ctrlmsg\n\t// Spawn goroutine for the receiver\n\tgo c.Receiver()\n\n\t// sender\n\tc.Sender()\n}", "title": "" }, { "docid": "cb9c17997eada1f8c962e9649454d99a", "score": "0.7148379", "text": "func serveWs(pool *websocket.Pool, w http.ResponseWriter, r *http.Request) {\r\n\tfmt.Println(\"Websocket Endpoint Hit\")\r\n\r\n\t// upgrade this connection to a WebSocket connection\r\n\tconn, err := websocket.Upgrade(w, r)\r\n\tif err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\r\n\tclient := &websocket.Client{\r\n\t\tConn: conn,\r\n\t\tPool: pool,\r\n\t}\r\n\r\n\tpool.Register <- client\r\n\tclient.Read()\r\n}", "title": "" }, { "docid": "dadc0f891cd615f0bc302cbd5aaa88df", "score": "0.7066677", "text": "func WebsocketHandler() http.HandlerFunc {\n\treturn func(response http.ResponseWriter, request *http.Request) {\n\t\tglog.Infof(\"Handling Websocket....\")\n\t\tvar mutex = &sync.Mutex{}\n\t\tresponseHeaders := http.Header{\"Sec-WebSocket-Protocol\": {\"graphql-ws\"}}\n\t\tconn, err := upgrader.Upgrade(response, request, responseHeaders)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tfor {\n\t\t\t// Read Message from the connection\n\t\t\t//\n\t\t\tmt, message, err := conn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tglog.Infof(\"RECV message: [%s] with type ID [%d]\\n\", message, mt)\n\n\t\t\tvar payloadResponse []byte\n\n\t\t\t// Convert the message to a struct\n\t\t\tvar websocketMessage Message\n\t\t\t_ = json.Unmarshal(message, &websocketMessage)\n\t\t\tglog.Infof(\"received message from: [%s] - type [%s], payload [%s] with type ID [%d]\\n\", conn.RemoteAddr(), websocketMessage.Type, websocketMessage.Payload, mt)\n\n\t\t\tvar subID subscription.SubscriptionId\n\t\t\tif websocketMessage.Type == \"connection_init\" {\n\t\t\t\tglog.Info(\"Received Connection Init - generating an ack\")\n\t\t\t\t// Send Ack\n\t\t\t\tresponse := Message{\n\t\t\t\t\tType: \"connection_ack\",\n\t\t\t\t}\n\t\t\t\tpayloadResponse, _ = json.Marshal(response)\n\t\t\t\tif payloadResponse != nil {\n\t\t\t\t\tglog.Infof(\"writing: %s\\n\", payloadResponse)\n\t\t\t\t\tmutex.Lock()\n\t\t\t\t\terr = conn.WriteMessage(mt, payloadResponse)\n\t\t\t\t\tmutex.Unlock()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else if websocketMessage.Type == \"start\" {\n\t\t\t\tglog.Warningf(\"Received Start - generating a subscription message for id [%s] with payload [%s]\\n\",\n\t\t\t\t\twebsocketMessage.ID, websocketMessage.Payload)\n\t\t\t\t//query, _ := json.Marshal(websocketMessage.Payload)\n\n\t\t\t\tsubID, err = subscriptionManager.Subscribe(subscription.SubscriptionConfig{\n\t\t\t\t\tQuery: websocketMessage.Payload.Query,\n\t\t\t\t\tVariableValues: websocketMessage.Payload.Variables,\n\t\t\t\t\tOperationName: websocketMessage.Payload.OperationName,\n\t\t\t\t\tCallback: func(result *graphql.Result) error {\n\n\t\t\t\t\t\tfmt.Printf(\"Procesing Callback with Result: %v\\n\", result)\n\t\t\t\t\t\tif result.Errors != nil {\n\t\t\t\t\t\t\tlog.Println(\"Error trying to find message: \", result.Errors)\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpayload, _ := json.Marshal(result)\n\t\t\t\t\t\t// We would need to write this back to the channel\n\t\t\t\t\t\tfmt.Printf(\"Writing payload [%s] to websocket [%s]\\n\", payload, conn.RemoteAddr().String())\n\n\t\t\t\t\t\twebsocketResponseMessage := WebsocketMessage{\n\t\t\t\t\t\t\tType: \"data\",\n\t\t\t\t\t\t\tID: websocketMessage.ID,\n\t\t\t\t\t\t\tPayload: result,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//conn.WriteMessage(1, websocketMessage)\n\t\t\t\t\t\tmutex.Lock()\n\t\t\t\t\t\tconn.WriteJSON(websocketResponseMessage)\n\t\t\t\t\t\tmutex.Unlock()\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\t// At this point we need to define a mapping from the subscription id (provided in the request) to the\n\t\t\t\t// subId generated by the SubManager.\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"Error creating subscription %s\\n\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Printf(\"\\t\\t\\t\\tCreating Subscription for %d\\n\", subID)\n\n\t\t\t\t// Not completely thread safe, and assumes there will only ever be one\n\t\t\t\t// subscription per websocket.\n\t\t\t\t//\n\t\t\t\tidMap := SubscriptionIDMap{\n\t\t\t\t\tGraphqlRequestID: websocketMessage.ID,\n\t\t\t\t\tSubscriptionID: subID,\n\t\t\t\t}\n\t\t\t\tClients[conn] = idMap\n\n\t\t\t} else if websocketMessage.Type == \"stop\" {\n\t\t\t\tidMap := Clients[conn]\n\t\t\t\tfmt.Printf(\"STOP Unsubscribe number %d......\\n\", idMap.SubscriptionID)\n\t\t\t\tsubscriptionManager.Unsubscribe(idMap.SubscriptionID)\n\t\t\t} else {\n\t\t\t\tglog.Errorf(\"Received unkown message type [%s] with payload [%s]\\n\", websocketMessage.Type, websocketMessage.Payload)\n\t\t\t}\n\n\t\t}\n\n\t\tfmt.Printf(\"GOODBYE SOCKET......\\n\")\n\t\tidMap := Clients[conn]\n\t\tsubscriptionManager.Unsubscribe(idMap.SubscriptionID)\n\t\tconn.Close()\n\t}\n}", "title": "" }, { "docid": "87f32fbf529ef2ca7a11d41b6abb560b", "score": "0.70438075", "text": "func serveWs(rw http.ResponseWriter, req *http.Request) {\n\tlog.Infof(\"Upgrade to websocket\")\n\tlog.Infof(\"rawquery: %+v\", req.URL)\n\tws, err := upgrader.Upgrade(rw, req, nil)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\n\twriter(ws)\n}", "title": "" }, { "docid": "7981b3183f6ccb1af205c5e42b47ed34", "score": "0.703217", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tspid := r.URL.Query().Get(\"pid\")\n\tipid := 0\n\tvar err error\n\tif spid != \"\" {\n\t\tipid, err = strconv.Atoi(spid)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif !qs.IsQueryExist(ipid) {\n\t\t\treturn\n\t\t}\n\t}\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &WebSocketClient{hub: hub, conn: conn}\n\tclient.hub.register <- client\n}", "title": "" }, { "docid": "2301ae02281a3a1f0ab4497b10926d6a", "score": "0.70171005", "text": "func wsHandler(ws *websocket.Conn) {\n\treader, writer := io.Reader(ws), io.Writer(ws)\n\tfor {\n\t\tbuff := make([]byte, 1024)\n\t\t_, err := reader.Read(buff)\n\t\tif err != nil {\n\t\t\tlog.Println(\"- error in reading line from websocket\")\n\t\t}\n\t\tlog.Println(buff)\n\t\tout := \"this is working\"\n\t\tb := []byte(out)\n\t\twriter.Write(b)\n\t}\n}", "title": "" }, { "docid": "ce5fb4c85a73a2478f69f54fa2518249", "score": "0.699079", "text": "func (h WebsocketHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) {\n conn, err := upgrader.Upgrade(res, req, nil)\n if err != nil {\n log.Println(err)\n return\n }\n\n ws := &WebsocketConnection{Conn: conn, Handler: h}\n connections = append(connections, ws)\n Stats.Websocket.Add(\"connections\", 1)\n\n conn.SetCloseHandler(func(code int, text string) error {\n for i, ws := range connections {\n if ws.Conn == conn {\n before := connections[0:i]\n after := connections[i+1:]\n connections = append(before, after...)\n Stats.Websocket.Add(\"connections\", -1)\n }\n }\n return nil\n })\n\n // Start reading messages from socket\n go ws.ReadRequest()\n}", "title": "" }, { "docid": "c618474ec3d90ce6dbc06d3c220ab51c", "score": "0.69790554", "text": "func wsServe(c *websocket.Conn) {\n\tdefer c.Close()\n\tid := NewUid()\n\tsecret := []byte(NewUid())\n\tsetSession(id, Session{c, secret})\n\tdefer deleteSession(id)\n\t// send private webhook endpoint to client\n\tdata := SocketResponse{\n\t\tUrl: fmt.Sprintf(\"%s://%s:%d/%s/%s\", scheme, config.Host, config.Port, webhooksPath, id),\n\t\tSecret: string(secret),\n\t}\n\tlog.Printf(\"Incoming websocket from %s, sending: %+v\\n\", c.Request().RemoteAddr, data)\n\twebsocket.JSON.Send(c, data)\n\t// read forever on websocket to keep it open\n\tvar msg []byte\n\tfor _, err := c.Read(msg); err == nil; time.Sleep(1 * time.Second) {\n\t}\n}", "title": "" }, { "docid": "6557789f87d6cbd9133d32d15190434b", "score": "0.6967631", "text": "func serveWs(ws *websocket.Conn) {\n\t// see also how it is implemented here: http://eli.thegreenplace.net/2016/go-websocket-server-sample/ (20170703)\n\tvar err error // to avoid constant redeclarations in tight loop below\n\n\tif ws == nil {\n\t\tLog.Panic(\"Received nil WebSocket — I have no idea why or how this happened!\")\n\t}\n\n\t/*\n\tlog.Printf(\"Client connected from %s\", ws.RemoteAddr())\n\tlog.Println(\"entering serveWs with connection config:\", ws.Config())\n\t*/\n\n\twebSocketActive.Store(true)\n\tdefer webSocketActive.Store(false)\n\n\tgo func() {\n\t//\tlog.Println(\"entering send loop\")\n\n\t\tfor {\n\t\t\tsendMessage := <-wsSendMessage\n\n\t\t\tif err = websocket.JSON.Send(ws, sendMessage); err != nil {\n\t\t\t\tLog.Error(\"Can't send; error:\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\t//log.Println(\"entering receive loop\")\n\tvar receiveMessage WsMessageType\n\n\tfor {\n\t\tif err = websocket.JSON.Receive(ws, &receiveMessage); err != nil {\n\t\t\tLog.Error(\"Can't receive; error:\", err)\n\t\t\tbreak\n\t\t}\n\t\t// Log.Debugf(\"Received back from client: type '%s' subtype '%s' text '%s' id '%s'\\n\", *receiveMessage.Type.Ptr(), *receiveMessage.SubType.Ptr(), *receiveMessage.Text.Ptr(), *receiveMessage.Id.Ptr())\n\t\twsReceiveMessage <- receiveMessage\n\t}\n}", "title": "" }, { "docid": "1a5d37a01d90c4858e95eb75d2d08c08", "score": "0.696207", "text": "func wsHandler(w http.ResponseWriter, r *http.Request) {\n\tpaths := strings.Split(r.URL.Path, \"/\")\n\tid := paths[len(paths)-1]\n\tlog.Println(\"HEllo\", id)\n\t// check to see if ws endpoint for doc exists, if not creats one\n\tif hubMap[id] == nil {\n\t\thubMap[id] = newHub(id)\n\t\tgo hubMap[id].run()\n\t}\n\n\tserveWS(hubMap[id], w, r)\n}", "title": "" }, { "docid": "bfbe8463aad90cd4edff7a3902686c1e", "score": "0.6957516", "text": "func wsHandler(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\">>>Error in Upgrader<<<\", err)\n\t}\n\n\t// The client has connected, send an ack\n\terr = ws.WriteMessage(1, []byte(\"Hello client, I am the server.\"))\n\tif err != nil {\n\t\tlog.Println(\">>>Error in sending message to client<<<\", err)\n\t}\n\n\treader(ws)\n}", "title": "" }, { "docid": "5219e1f005d0f15b1429d113b44d80b2", "score": "0.6952123", "text": "func serveWs(w http.ResponseWriter, r *http.Request, a *Agent) {\r\n\tvar err error\r\n\r\n\t//kerr.PrintDebugMsg(false, \"ws\", \" serveWs HERE!\")\r\n\r\n\tif a.conn != nil { //Why? I seemingly have said that the connection would be overrided by a next \"/ws\"\r\n\t\t//kerr.SysErrPrintf(\"serveWs : session already has WS; user_id=%v\", c.User_ID)\r\n\t\tw.WriteHeader(400)\r\n\t\tw.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\r\n\t\tw.Write([]byte(fmt.Sprintf(\"serveWs : For agent (%v) it is permitted only one ws connection.\", a.Tag)))\r\n\t\treturn\r\n\t}\r\n\r\n\ta.conn, err = upgrader.Upgrade(w, r, nil)\r\n\tif err != nil {\r\n\t\tkerr.SysErrPrintf(\"serveWs : upgrader.Upgrade error=%v\", err.Error())\r\n\t\t//w.WriteHeader(500)\r\n\t\t//w.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\r\n\t\t//w.Write([]byte(fmt.Sprintf(\"serveWs : upgrader.Upgrade error=%v\", err.Error())))\r\n\t\treturn\r\n\t}\r\n\r\n\tgo a.writePump()\r\n\tgo a.readPump()\r\n}", "title": "" }, { "docid": "062216cdc3a1a7596d4e9f06ec718d5b", "score": "0.69423544", "text": "func serveWs(c buffalo.Context) {\n\tw := c.Response()\n\tr := c.Request()\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tclient := NewClient()\n\tclient.ws = conn\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.Subscribe()\n\tgo client.Publish()\n\tgo client.writePump()\n\tgo client.readPump()\n\n\t//go client.broadcastThreads()\n\n}", "title": "" }, { "docid": "5c1b3da710159aef76d352357be43f27", "score": "0.6901036", "text": "func (b *Board) WsHandler(w http.ResponseWriter, r *http.Request) {\n\tWsHandler(w, r, b.SendToWebSocket)\n}", "title": "" }, { "docid": "a2a8b979356d94d6f9907421ee765660", "score": "0.68800473", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\tgo client.writePump()\n\tclient.readPump()\n}", "title": "" }, { "docid": "18b8f62eaba5a9b5602c12f0838569e0", "score": "0.6860249", "text": "func wsConnectionHandler(conn *websocket.Conn, nodeMeta j) {\n\tcw := addNode(conn, nodeMeta)\n\tdefer closeConn(cw)\n\n\tlog.Infof(\"NODES: connection Meta: %s \", nodeMeta)\n\n\tcw.PushCB(\"__default\", defaultWSMessageHandler)\n\n\tfor {\n\t\t_, in, err := cw.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not read ws message: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Decode the message, so handlers receive only meta and data\n\t\terr, meta, data := lib.DecodeMessage(&in)\n\t\tif err != nil {\n\t\t\tcw.Send(j{\n\t\t\t\t\"msgID\": meta[\"msgID\"],\n\t\t\t\t\"message\": err.Error(),\n\t\t\t\t\"code\": glob.RES_BAD_REQ,\n\t\t\t\t\"type\": \"res\",\n\t\t\t}, nil)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check message for required meta keys\n\t\tif _, exists := meta[\"msgID\"]; !exists {\n\t\t\tcw.Send(j{\n\t\t\t\t\"message\": \"'msgID' is required!\",\n\t\t\t\t\"code\": glob.RES_BAD_REQ,\n\t\t\t\t\"type\": \"res\",\n\t\t\t}, nil)\n\t\t\tcontinue\n\t\t}\n\t\tif _, exists := meta[\"type\"]; !exists {\n\t\t\tcw.Send(j{\n\t\t\t\t\"msgID\": meta[\"msgID\"],\n\t\t\t\t\"message\": \"'type' is required!\",\n\t\t\t\t\"code\": glob.RES_BAD_REQ,\n\t\t\t\t\"type\": \"res\",\n\t\t\t}, nil)\n\t\t\tfmt.Printf(\"Decoded message: %q\", string(in))\n\t\t\tcontinue\n\t\t}\n\n\t\t// traverse the callbacks\n\t\tgo cw.TraverseCB(meta, data)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not read ws message: %s\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb597871b9f5f220c722cf1a0515241b", "score": "0.68550307", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tdoProcessConnection(conn)\n}", "title": "" }, { "docid": "9ca05f3b1b3f58a796f6af4761d4eee2", "score": "0.6849954", "text": "func WebsocketHandler(subprotocols []string, headersExtractor server.HeadersExtractor, config *Config, sessionHandler sessionHandler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := log.WithField(\"context\", \"ws\")\n\n\t\tupgrader := websocket.Upgrader{\n\t\t\tCheckOrigin: CheckOrigin(config.AllowedOrigins),\n\t\t\tSubprotocols: subprotocols,\n\t\t\tReadBufferSize: config.ReadBufferSize,\n\t\t\tWriteBufferSize: config.WriteBufferSize,\n\t\t\tEnableCompression: config.EnableCompression,\n\t\t}\n\n\t\trheader := map[string][]string{\"X-AnyCable-Version\": {version.Version()}}\n\t\twsc, err := upgrader.Upgrade(w, r, rheader)\n\t\tif err != nil {\n\t\t\tctx.Debugf(\"Websocket connection upgrade error: %#v\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tinfo, err := server.NewRequestInfo(r, headersExtractor)\n\t\tif err != nil {\n\t\t\tCloseWithReason(wsc, websocket.CloseAbnormalClosure, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\twsc.SetReadLimit(config.MaxMessageSize)\n\n\t\tif config.EnableCompression {\n\t\t\twsc.EnableWriteCompression(true)\n\t\t}\n\n\t\tsessionCtx := log.WithField(\"sid\", info.UID)\n\n\t\tclientSubprotocol := r.Header.Get(\"Sec-Websocket-Protocol\")\n\n\t\tif wsc.Subprotocol() == \"\" && clientSubprotocol != \"\" {\n\t\t\tsessionCtx.Debugf(\"No subprotocol negotiated: client wants %v, server supports %v\", clientSubprotocol, subprotocols)\n\t\t}\n\n\t\t// Separate goroutine for better GC of caller's data.\n\t\tgo func() {\n\t\t\tsessionCtx.Debugf(\"WebSocket session established\")\n\t\t\tserr := sessionHandler(wsc, info, func() {\n\t\t\t\tsessionCtx.Debugf(\"WebSocket session completed\")\n\t\t\t})\n\n\t\t\tif serr != nil {\n\t\t\t\tsessionCtx.Errorf(\"WebSocket session failed: %v\", serr)\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t})\n}", "title": "" }, { "docid": "085ef875e2154583878b7edefcd89846", "score": "0.6849872", "text": "func (c *wsLink) inHandler() {\nout:\n\tfor {\n\t\t// Break out of the loop once the quit channel has been closed.\n\t\t// Use a non-blocking select here so we fall through otherwise.\n\t\tselect {\n\t\tcase <-c.quit:\n\t\t\tbreak out\n\t\tdefault:\n\t\t}\n\t\t// Block until a message is received or an error occurs.\n\t\t_, msgBytes, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\t// Log the error if it's not due to disconnecting.\n\t\t\tif !errors.Is(err, io.EOF) {\n\t\t\t\tlog.Errorf(\"Websocket receive error from %s: %v\", c.ip, err)\n\t\t\t}\n\t\t\tbreak out\n\t\t}\n\t\t// Attempt to unmarshal the request. Only requests that successfully decode\n\t\t// will be accepted by the server, though failure to decode does not force\n\t\t// a disconnect.\n\t\tmsg := new(msgjson.Message)\n\t\terr = json.Unmarshal(msgBytes, msg)\n\t\tif err != nil {\n\t\t\tc.sendError(1, msgjson.NewError(msgjson.RPCParseError,\n\t\t\t\t\"Failed to parse message: \"+err.Error()))\n\t\t\tcontinue\n\t\t}\n\t\tswitch msg.Type {\n\t\tcase msgjson.Request:\n\t\t\tif msg.ID == 0 {\n\t\t\t\tc.sendError(1, msgjson.NewError(msgjson.RPCParseError, \"request id cannot be zero\"))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Look for a registered handler. Failure to find a handler results in an\n\t\t\t// error response but not a disconnect.\n\t\t\thandler := RouteHandler(msg.Route)\n\t\t\tif handler == nil {\n\t\t\t\tc.sendError(msg.ID, msgjson.NewError(msgjson.RPCUnknownRoute,\n\t\t\t\t\t\"unknown route \"+msg.Route))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Handle the request.\n\t\t\trpcError := handler(c, msg)\n\t\t\tif rpcError != nil {\n\t\t\t\tc.sendError(msg.ID, rpcError)\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase msgjson.Response:\n\t\t\tif msg.ID == 0 {\n\t\t\t\tc.sendError(1, msgjson.NewError(msgjson.RPCParseError, \"response id cannot be 0\"))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcb := c.respHandler(msg.ID)\n\t\t\tif cb == nil {\n\t\t\t\tc.sendError(msg.ID, msgjson.NewError(msgjson.UnknownResponseID,\n\t\t\t\t\t\"unknown response ID\"))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcb.f(c, msg)\n\t\t}\n\t}\n\t// Ensure the connection is closed.\n\tc.disconnect()\n\tc.wg.Done()\n}", "title": "" }, { "docid": "73fd7d290d0c9d79672749d99321a3d3", "score": "0.6849345", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Critical(err)\n\t\treturn\n\t}\n\n\tpath := r.URL.String()\n\theaders := GetHeaders(r, config.headers)\n\n\tresponse, err := rpc.VerifyConnection(path, headers)\n\n\tif err != nil {\n\t\tlog.Errorf(\"RPC Connect Error: %v\", err)\n\t\tCloseWS(ws, \"RPC Error\")\n\t\treturn\n\t}\n\n\tlog.Debugf(\"Auth %s\", response)\n\n\tstatus := response.Status.String()\n\n\tif status == \"ERROR\" {\n\t\tlog.Errorf(\"Application error: %s\", response.ErrorMsg)\n\t\tCloseWS(ws, \"Application Error\")\n\t\treturn\n\t}\n\n\tif status == \"FAILURE\" {\n\t\tlog.Warningf(\"Unauthenticated\")\n\t\tCloseWS(ws, \"Unauthenticated\")\n\t\treturn\n\t}\n\n\tconn := &Conn{send: make(chan []byte, 256), ws: ws, path: path, headers: headers, identifiers: response.Identifiers, subscriptions: make(map[string]bool)}\n\tapp.Connected(conn, response.Transmissions)\n\tgo conn.writePump()\n\tconn.readPump()\n}", "title": "" }, { "docid": "dcbc7f78f8a59daf50d8e24da20ade5e", "score": "0.6818694", "text": "func WebsocketHandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tcli := pubsub.NewClient(conn, r.RemoteAddr, ps)\n\tps.AddClient(cli)\n\tgo cli.Read()\n\tgo cli.Write()\n}", "title": "" }, { "docid": "1fc6d52dfa1de2eaa48ae04d788b3d1e", "score": "0.68152463", "text": "func (s *Server) wsHandler(ws *websocket.Conn) {\n\tconn := WSConn{ws}\n\tdefer ws.Close()\n\n\tfor {\n\t\tmsg, err := conn.ReadMessage()\n\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tfmt.Println(\"Error (Read Error):\", err, msg)\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\n\t\ts.handleMessage(&conn, &msg)\n\t}\n}", "title": "" }, { "docid": "61cfa1fe8d0df8cda2397574d2405548", "score": "0.6803789", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "dbdba3a111c9f526d0d623b73d0fba79", "score": "0.679413", "text": "func HandleWebsocketPath(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgradeSocket(w, r)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"websocket upgrade err: %v\\n\", err)\n\t\treturn\n\t}\n\n\tip, err := getReqIP(r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tConnections[ip] = conn\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase m := <-conn.sendQueue:\n\t\t\t\tconn.WriteJSON(m)\n\t\t\tcase <-conn.ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif conn.user != nil {\n\t\t// Note(netux): Needed so the max stacked on the client updates\n\t\tsendPixelsAvailable(conn, \"auth\")\n\t\tsendUserInfo(conn)\n\t\tif conn.user.PixelStacker.Stack > 0 {\n\t\t\tsendPixelsAvailable(conn, \"connected\")\n\t\t}\n\t\tif conn.user.PixelStacker.Stack == 0 {\n\t\t\tsendCooldown(conn, conn.user.PixelStacker.GetCooldownWithDifference())\n\t\t}\n\t\tif !conn.user.PixelStacker.IsTimerRunning() {\n\t\t\tconn.user.PixelStacker.StartTimer()\n\t\t}\n\t}\n\n\tgo handleIncomingMessages(conn)\n\tif conn.user != nil {\n\t\tgo handleUserEvents(conn)\n\t}\n}", "title": "" }, { "docid": "d32bc1f3c5c56778debf34a8cc6279db", "score": "0.67804915", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"serveWs: new connection\\n\")\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Printf(\"serveWs: upgrader.Upgrade() failed with '%s'\\n\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tdefer ws.Close()\n\tws.SetReadLimit(512)\n\tws.SetReadDeadline(time.Now().Add(pongWait))\n\tws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\twsChan := make(chan struct{})\n\tchClose := make(chan struct{})\n\tdefer func() {\n\t\tchClose <- struct{}{}\n\t}()\n\tgo wsWriter(ws, wsChan, chClose)\n\tfor {\n\t\tmsgType, p, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"serveWs: ws.ReadMessage() failed with '%s'\\n\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"Got ws msg type: %d s: '%s'\\n\", msgType, string(p))\n\t\turi := string(p)\n\t\tarticleInfo := articleInfoFromUrl(uri)\n\t\tif articleInfo == nil {\n\t\t\tlog.Printf(\"serveWs: didn't find article for uri %s\\n\", uri)\n\t\t\tcontinue\n\t\t}\n\t\tarticle := articleInfo.this\n\t\tgo fileWatcher(article, wsChan, chClose)\n\t}\n}", "title": "" }, { "docid": "553360d1dfd93d7a9361f6f18cf05e0b", "score": "0.6761472", "text": "func EchoHandler(w http.ResponseWriter, r *http.Request) {\n\tvar upgrader = websocket.Upgrader{\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t}\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tfor {\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = conn.WriteMessage(messageType, p)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"Echoed: %s\", string(p))\n\t}\n}", "title": "" }, { "docid": "aab1f6f5a95f5683c45dddcf88eb1184", "score": "0.6760836", "text": "func ServeWs(w http.ResponseWriter, r *http.Request) {\n\t//upgrade\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Error().Msgf(\"websocket handshake error: %s\", err.Error())\n\t\t\t//todo:\n\t\t}\n\t\treturn\n\t}\n\tdefer ws.Close()\n\tClients[ws] = true\n\tws.WriteMessage(websocket.TextMessage, []byte(\"websocket connection set\"))\n\tfor {\n\t\tmsg := <-OutChann\n\t\tws.WriteJSON(msg)\n\t\tif err != nil {\n\t\t\tlog.Error().Msgf(\"[WS] send msg error: %s\", err.Error())\n\t\t\tws.Close()\n\t\t\tdelete(Clients, ws)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a877f1eac58acc61d97c3b508ec26fc", "score": "0.6760183", "text": "func (r *WsRouter) serveWs(w http.ResponseWriter, req *http.Request) {\n\tconn, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"error upgrading connection to websocket: %v\\n\", err)\n\t\treturn\n\t}\n\n\tc := CreateWsClient(conn, r)\n\tselect {\n\tcase <-r.chDead:\n\t\tc.BeginShutDown()\n\tcase r.chRegister <- c:\n\t}\n}", "title": "" }, { "docid": "bf072b722c6c87a5a47728f45fb628e8", "score": "0.6758826", "text": "func (ws *WSClient) wsHandler() {\n\tfor {\n\t\tmsg, err := ws.readMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar imsg []interface{}\n\t\terr = json.Unmarshal(msg, &imsg)\n\t\tif err != nil || len(imsg) < 3 {\n\t\t\tcontinue\n\t\t}\n\n\t\targ, ok := imsg[0].(float64)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tchid := int(arg)\n\t\targs, ok := imsg[2].([]interface{})\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar wsupdate interface{}\n\t\tif chid == TICKER {\n\t\t\twsupdate, err = convertArgsToTicker(args)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if intInSlice(chid, marketChannels) {\n\t\t\twsupdate, err = convertArgsToMarketUpdate(args)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\n\t\tchname := channelsByID[chid]\n\t\tif ws.Subs[chname] != nil {\n\t\t\tif chid == TICKER {\n\t\t\t\tws.Subs[chname] <- wsupdate\n\t\t\t} else {\n\t\t\t\tws.Subs[chname] <- wsupdate\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb39d58da5a60276ba163c217027cc4f", "score": "0.67386305", "text": "func HanldeWebSocket(context *gin.Context) {\n\twsupgrader := GetUgrader()\n\tconn, err := wsupgrader.Upgrade(context.Writer, context.Request, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor {\n\t\tmessageType, message, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tgo HandleMessage(conn, messageType, message)\n\t}\n}", "title": "" }, { "docid": "07a11e3c9333c79de2889f0a4f83346f", "score": "0.66961783", "text": "func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tvar username string\n\t// 启动服务时将username存下来\n\tvalues, _ := url.ParseQuery(r.URL.RawQuery)\n\tif len(values) == 0 {\n\t\t// 其他客户端(GUI)从head中取login-username\n\t\tusername = r.Header.Get(\"login-username\")\n\n\t} else {\n\t\tusername = values[\"username\"][0]\n\n\t}\n\tdb.Add(username)\n\t// 升级这个请求为 `websocket` 协议\n\tconn, err := Upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(\"client connected:\", conn.RemoteAddr())\n\n\t//初始化当前的客户端的实例,并与\"hub\"中心管理勾搭\n\tclient := &Client{Hub: hub, Conn: conn, Send: make(chan []byte, 256), Username: username}\n\n\tclient.Hub.Register <- client\n\n\t// 通过在新的goroutines中完成所有工作,允许调用者引用内存的集合。\n\t// 其实对当前 `websocket` 连接的 `I/O` 操作\n\t// 写操作(发消息到客户端)-> 这里 `Hub` 会统一处理\n\tgo client.WritePump()\n\t// 读操作(对消息到客户端)-> 读完当前连接立即发 -> 交由 `Hub` 分发消息到所有连接\n\tgo client.ReadPump()\n\n\ttime.Sleep(3 * time.Millisecond)\n\n}", "title": "" }, { "docid": "a636f300f257121e37bc0960b3d25e49", "score": "0.66956854", "text": "func wwwServeWs(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\tclient := wsClient{ws: ws, toClient: make(chan wsMessage, 5), fromClient: make(chan wsMessage, 5), remoteAddr: r.RemoteAddr}\n\twsClientsLock.With(func() {\n\t\twsClients[&client] = time.Now()\n\t})\n\tgo client.handleClient()\n}", "title": "" }, { "docid": "e01878238c905b533f7876266089684a", "score": "0.66792506", "text": "func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tr.Header.Del(\"Origin\")\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tutil.LogError().Println(\"serve ws upgrader error:\", err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256), repeatLogin: false}\n\t//client.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tclient.readPump()\n}", "title": "" }, { "docid": "ef853cf757c6bd3e15f3a6b331a3889e", "score": "0.6677402", "text": "func socketHandler(ws *websocket.Conn) {\n\tfmt.Printf(\"Connected from %s ...\\n\", ws.Request().RemoteAddr)\n\n\twss.conn = append(wss.conn, ws)\n\n\tfor {\n\t\tvar data string\n\t\terr := websocket.Message.Receive(ws, &data)\n\t\tif err == io.EOF {\n\t\t\treturn\n\t\t} else if err != nil {\n\t\t\tlog.Fatal(\"Receiving from websocket failed:\", err)\n\t\t}\n\n\t\t// send to all of the other connections but the\n\t\t// current one, because it's the one sending\n\t\t// the data, so it's already there.\n\t\tfor _, cx := range wss.conn {\n\t\t\tif cx != ws {\n\t\t\t\twebsocket.Message.Send(cx, data)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1bdb777d99a999992060af5bac483eb5", "score": "0.66768813", "text": "func (wsh wsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n\t// Upgrade the HTTP request to a WebSocket\n\tsock, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Create a new client connection\n\tc := client.NewConnection(sock)\n\t// .. and register it into the data provider\n\twsh.factory.Register(c)\n\t// Close the client connection when the http request is closed\n\tdefer func() { wsh.factory.Unregister() }()\n\t// Begin procesing the communication streams\n\tgo c.Writer()\n\tc.Reader()\n}", "title": "" }, { "docid": "64ab2b8b786bcd944d16aceba4815fe6", "score": "0.6652119", "text": "func (handler *WebSocketHandler) Handle(writer http.ResponseWriter, request *http.Request) {\n\tif handler.CheckOrigin != nil {\n\t\tupgrader.CheckOrigin = handler.CheckOrigin\n\t}\n\n\tconn, err := upgrader.Upgrade(writer, request, nil)\n\tif err != nil {\n\t\tzap.L().Error(\"failed to upgrade the incoming connection to a websocket\", zap.Error(err), zap.String(\"remoteAddr\", request.RemoteAddr))\n\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\twriter.Write([]byte(\"<h1>Bad request</h1>\"))\n\t\treturn\n\t}\n\n\tvar userPrincipal *UserPrincipal\n\tvar session *Session\n\tcontextValue := request.Context().Value(SessionKey)\n\tif contextValue != nil {\n\t\tvar ok bool\n\t\tsession, ok = contextValue.(*Session)\n\t\tif !ok {\n\t\t\tzap.L().Error(\"invalid session object in SessionKey\", zap.String(\"remoteAddr\", request.RemoteAddr))\n\t\t\twriter.WriteHeader(http.StatusInternalServerError)\n\t\t\twriter.Write([]byte(\"<h1>bad server configuration</h1>\"))\n\t\t\treturn\n\t\t}\n\t}\n\n\tif session == nil {\n\t\tzap.L().Error(\"session handler is required for websocket handler\", zap.String(\"remoteAddr\", request.RemoteAddr))\n\t\twriter.WriteHeader(http.StatusServiceUnavailable)\n\t\twriter.Write([]byte(\"<h1>A http session is required</h1>\"))\n\t\treturn\n\t}\n\n\tcontextValue = request.Context().Value(UserPrincipalKey)\n\tif contextValue != nil {\n\t\tuserPrincipal, _ = contextValue.(*UserPrincipal)\n\t}\n\n\tif handler.MessageLimit > 0 {\n\t\tconn.SetReadLimit(handler.MessageLimit)\n\t}\n\n\tif handler.WriteCompression {\n\t\tconn.EnableWriteCompression(true)\n\t}\n\n\twebSocketSession := &WebSocketSession{\n\t\trequest.RemoteAddr,\n\t\tuserPrincipal,\n\t\tsession,\n\t\tmake(map[string]interface{}),\n\t\tconn,\n\t\thandler.ReadTimeout,\n\t\thandler.WriteTimeout,\n\t\t&sync.Mutex{},\n\t\t&sync.Mutex{},\n\t}\n\n\tfor key, value := range request.URL.Query() {\n\t\twebSocketSession.Context[key] = value\n\t}\n\n\thandler.Listener.OnConnect(webSocketSession)\n\tgo handler.connectionLoop(webSocketSession)\n}", "title": "" }, { "docid": "e27f77fc0ea686b644884ead0059bcb5", "score": "0.6650846", "text": "func serveWs(w http.ResponseWriter, r *http.Request) (err error) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\troomName := strings.Split(strings.TrimPrefix(r.URL.Path, \"/\"), \"/\")\n\tif len(roomName) < 2 {\n\t\terr = fmt.Errorf(\"must return /room/name\")\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\troom := roomName[0]\n\tname := roomName[1]\n\tc := &connection{send: make(chan []byte, 256), ws: ws, name: name}\n\ts := subscription{c, room, name}\n\tlog.Debugf(\"registering %+v\", s)\n\th.register <- s\n\tlog.Debug(\"done registering\")\n\tgo s.writePump()\n\ts.readPump()\n\treturn\n}", "title": "" }, { "docid": "d3ef3776ae6ff476d7f64e28d66bc7dd", "score": "0.6638564", "text": "func serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\n\tinstance = game.NewGame(game.TeamRed)\n\tg, err := json.Marshal(instance)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tmessage := struct {\n\t\tMsgType string\n\t\tData string\n\t}{\n\t\t\"BoardState\",\n\t\tstring(g),\n\t}\n\n\tm, err := json.Marshal(message)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = conn.WriteMessage(1, []byte(m))\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "dfaebcecf17689014e5458c122fea949", "score": "0.6636468", "text": "func proxyWs(rw http.ResponseWriter, req *http.Request) {\n\tclientConn, err := upgrader.Upgrade(rw, req, nil)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\tdefer clientConn.Close()\n\n\t// Proxy the request to another WebSocket handler of this server.\n\tu := url.URL{\n\t\tHost: \"127.0.0.1:8080\",\n\t\tPath: \"/apis/v1/logstream\",\n\t\tScheme: \"ws\",\n\t}\n\n\t// Need to filter the header for upgrade, as these headers will be added when dial the server.\n\t// Otherwise, there will be duplicate header error.\n\theader := filterHeader(req.Header)\n\n\tserverConn, _, err := websocket.DefaultDialer.Dial(u.String(), header)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\tdefer serverConn.Close()\n\n\tgo transfer(clientConn, serverConn)\n\ttransfer(serverConn, clientConn)\n}", "title": "" }, { "docid": "8d329b2f151796a8da9947796d3950e6", "score": "0.66318333", "text": "func (l *LakeBTC) wsHandleIncomingData() {\n\tl.Websocket.Wg.Add(1)\n\tdefer l.Websocket.Wg.Done()\n\tfor {\n\t\tselect {\n\t\tcase <-l.Websocket.ShutdownC:\n\t\t\treturn\n\t\tcase data := <-l.WebsocketConn.Ticker:\n\t\t\tif l.Verbose {\n\t\t\t\tlog.Debugf(\"%v Websocket message received: %v\", l.Name, data)\n\t\t\t}\n\t\t\tl.Websocket.TrafficAlert <- struct{}{}\n\t\t\terr := l.processTicker(data.Data)\n\t\t\tif err != nil {\n\t\t\t\tl.Websocket.DataHandler <- err\n\t\t\t\treturn\n\t\t\t}\n\t\tcase data := <-l.WebsocketConn.Trade:\n\t\t\tl.Websocket.TrafficAlert <- struct{}{}\n\t\t\tif l.Verbose {\n\t\t\t\tlog.Debugf(\"%v Websocket message received: %v\", l.Name, data)\n\t\t\t}\n\t\t\terr := l.processTrades(data.Data, data.Channel)\n\t\t\tif err != nil {\n\t\t\t\tl.Websocket.DataHandler <- err\n\t\t\t\treturn\n\t\t\t}\n\t\tcase data := <-l.WebsocketConn.Orderbook:\n\t\t\tl.Websocket.TrafficAlert <- struct{}{}\n\t\t\tif l.Verbose {\n\t\t\t\tlog.Debugf(\"%v Websocket message received: %v\", l.Name, data)\n\t\t\t}\n\t\t\terr := l.processOrderbook(data.Data, data.Channel)\n\t\t\tif err != nil {\n\t\t\t\tl.Websocket.DataHandler <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bf6ecfca6111be5e09455396aa2e3801", "score": "0.66313", "text": "func wsHandler(w http.ResponseWriter, req *http.Request) {\n\tconn, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tlib.FileWatcher(watchfilename, conn)\n}", "title": "" }, { "docid": "bb3388947f25293bc50c4a2a0d08e3e6", "score": "0.66299474", "text": "func (p *politeiawww) handleWebsocket(w http.ResponseWriter, r *http.Request, id string) {\n\tlog.Tracef(\"handleWebsocket: %v\", id)\n\tdefer log.Tracef(\"handleWebsocket exit: %v\", id)\n\n\t// Setup context\n\twc := wsContext{\n\t\tuuid: id,\n\t\tsubscriptions: make(map[string]struct{}),\n\t\tpingC: make(chan struct{}),\n\t\terrorC: make(chan www.WSError),\n\t\tdone: make(chan struct{}),\n\t}\n\n\tvar upgrader = websocket.Upgrader{\n\t\tEnableCompression: true,\n\t}\n\n\tvar err error\n\twc.conn, err = upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\thttp.Error(w, \"Could not open websocket connection\",\n\t\t\thttp.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer wc.conn.Close() // causes read to exit as well\n\n\t// Create and assign session to map\n\tp.wsMtx.Lock()\n\tif _, ok := p.ws[id]; !ok {\n\t\tp.ws[id] = make(map[string]*wsContext)\n\t}\n\tfor {\n\t\trid, err := util.Random(16)\n\t\tif err != nil {\n\t\t\tp.wsMtx.Unlock()\n\t\t\thttp.Error(w, \"Could not create random session id\",\n\t\t\t\thttp.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\twc.rid = hex.EncodeToString(rid)\n\t\tif _, ok := p.ws[id][wc.rid]; !ok {\n\t\t\tbreak\n\t\t}\n\t}\n\tp.ws[id][wc.rid] = &wc\n\tp.wsMtx.Unlock()\n\n\t// Reads\n\twc.wg.Add(1)\n\tgo p.handleWebsocketRead(&wc)\n\n\t// Writes\n\twc.wg.Add(1)\n\tgo p.handleWebsocketWrite(&wc)\n\n\t// XXX Example of a server side notifcation. Remove once other commands\n\t// can be used as examples.\n\t// time.Sleep(2 * time.Second)\n\t// p.websocketPing(id)\n\n\twc.wg.Wait()\n\n\t// Remove session id\n\tp.wsMtx.Lock()\n\tdelete(p.ws[id], wc.rid)\n\tif len(p.ws[id]) == 0 {\n\t\t// Remove uuid since it was the last one\n\t\tdelete(p.ws, id)\n\t}\n\tp.wsMtx.Unlock()\n}", "title": "" }, { "docid": "00caba1232bcfd24533b04798114a54b", "score": "0.6618779", "text": "func (wst *WebsocketTransport) Serve(w http.ResponseWriter, r *http.Request) {}", "title": "" }, { "docid": "35411a3a3545eb5c2013e352e551218b", "score": "0.6601174", "text": "func (hub *Hub) Handler(ws *websocket.Conn) {\n\t// Wrap the user, session key, and websocket together\n\tconn := Connection{ws: ws}\n\n\t// Examine the request for the session key and user\n\tr := ws.Request()\n\tif cookie, err := r.Cookie(hub.config.Cookie.Name); err == nil {\n\t\tconn.key = cookie.Value\n\t}\n\n\t// TODO this will request users even if cookie value was \"\" - shortcircuit?\n\tif conn.User = hub.sessions.GetUser(conn.key); !conn.User.Exists() {\n\t\tlog.Printf(\"No user with session: %s\", conn.key)\n\t\treturn\n\t}\n\n\thub.Join(conn)\n\n\t// Send the initial state of the users list\n\tmsg := OutgoingMessage{\n\t\tResource: \"users\",\n\t\tEvent: LIST,\n\t\tContent: hub.Users(),\n\t}\n\twebsocket.JSON.Send(ws, msg)\n\n\t// Send the initial state of the data\n\tmsg = OutgoingMessage{\n\t\tResource: \"things\",\n\t\tEvent: LIST,\n\t\tContent: getThings(hub.conn),\n\t}\n\twebsocket.JSON.Send(ws, msg)\n\n\t// Main event loop\nEvents:\n\tfor {\n\t\tvar event IncomingMessage\n\t\tif err := websocket.JSON.Receive(ws, &event); err != nil {\n\t\t\tlog.Printf(\"error: parse error: %s\", err)\n\t\t\tbreak Events\n\t\t}\n\t\thub.HandleMessage(event)\n\t}\n\n\thub.Leave(conn)\n}", "title": "" }, { "docid": "405f18d0318dbe2cfbd263e6f7cb1e17", "score": "0.65682465", "text": "func ServeWs(hub *Hub, c *gin.Context) {\n\t// 获取前端数据\n\tvar req ChatRequest\n\n\t_ = c.ShouldBind(&req)\n\n\tuserName := req.UserName\n\troomID := req.RoomID\n\t// 获取redis连接(暂未使用)\n\t// pool := c.MustGet(\"test\").(*redis.Pool)\n\t// redisConn := pool.Get()\n\t// defer redisConn.Close()\n\t// 将网络请求变为websocket\n\tvar upGrader = websocket.Upgrader{\n\t\t// 解决跨域问题\n\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\treturn true\n\t\t},\n\t}\n\n\tconn, err := upGrader.Upgrade(c.Writer, c.Request, nil)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// fmt.Println(\"username\" + userName)\n\n\t// fmt.Println(\"roomID\" + roomID)\n\n\tclient := &Client{\n\t\thub: hub,\n\t\tconn: conn,\n\t\tsend: make(chan []byte, 256),\n\t\tusername: []byte(userName),\n\t\troomID: []byte(roomID),\n\t}\n\n\tclient.hub.register <- client\n\n\tgo client.writePump()\n\n\tgo client.readPump()\n}", "title": "" }, { "docid": "8d9d555baee17ec53d19858dad6fcb68", "score": "0.6556054", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tws, err := s.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Print(\"got error while upgrading ws conn: \", err)\n\t\treturn\n\t}\n\tdefer func() {\n\t\terr := ws.Close()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"got error while closing ws conn: %s\", err)\n\t\t}\n\t}()\n\tgo s.writePings(ws)\n\n\tsess := &session{\n\t\tid: uuid.NewV4().String(),\n\t\tws: ws,\n\t}\n\tlog.Printf(\"serving session: %s\", sess.id)\n\tdefer log.Printf(\"done serving session: %s\", sess.id)\n\n\tfor {\n\t\te, err := sess.Receive()\n\t\tif err != nil {\n\t\t\tif !websocket.IsCloseError(err, websocket.CloseNormalClosure) {\n\t\t\t\tlog.Printf(\"got error while rx event: %s %s\", sess.id, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\thandler, ok := s.handlers[e.Cmd]\n\t\tif !ok {\n\t\t\tlog.Printf(\"received invalid command: %s %s\", sess.id, e.Cmd)\n\t\t\terr = sess.Send(handlers.Event{\n\t\t\t\tCmd: e.Cmd,\n\t\t\t\tRequestID: e.RequestID,\n\t\t\t\tError: handlers.InvalidCommand,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"unable to tx: %s\", err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\thandler.HandleEvent(e, sess)\n\t}\n}", "title": "" }, { "docid": "981fc4893609005b9f8b0de00b455808", "score": "0.6537719", "text": "func HandleWebsocket(modules WebsocketModulesInterface) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tprojectID := vars[\"project\"]\n\n\t\tsocket, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\tlog.Println(\"upgrade:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tc := client.CreateWebsocketClient(socket)\n\t\tdefer c.Close()\n\n\t\trealtime := modules.Realtime()\n\n\t\tdefer realtime.RemoveClient(c.ClientID())\n\n\t\tgo c.RoutineWrite()\n\n\t\t// Get client details\n\t\tclientID := c.ClientID()\n\n\t\tc.Read(func(req *model.Message) bool {\n\t\t\tswitch req.Type {\n\t\t\tcase utils.TypeRealtimeSubscribe:\n\t\t\t\t// For realtime subscribe event\n\t\t\t\tdata := new(model.RealtimeRequest)\n\t\t\t\tif err := mapstructure.Decode(req.Data, data); err != nil {\n\t\t\t\t\tlogrus.Errorf(\"Unable to decode incoming subscription request - %v\", err)\n\t\t\t\t\tres := model.RealtimeResponse{Ack: false, Error: err.Error()}\n\t\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tdata.Project = projectID\n\n\t\t\t\t// Subscribe to realtime feed\n\t\t\t\tfeedData, err := realtime.Subscribe(clientID, data, func(feed *model.FeedData) {\n\t\t\t\t\tc.Write(&model.Message{Type: utils.TypeRealtimeFeed, Data: feed})\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"Unable to process incoming subscription request - %v\", err)\n\t\t\t\t\tres := model.RealtimeResponse{Group: data.Group, ID: data.ID, Ack: false, Error: err.Error()}\n\t\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\t// Send response to c\n\t\t\t\tres := model.RealtimeResponse{Group: data.Group, ID: data.ID, Ack: true, Docs: feedData}\n\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\n\t\t\tcase utils.TypeRealtimeUnsubscribe:\n\t\t\t\t// For realtime subscribe event\n\t\t\t\tdata := new(model.RealtimeRequest)\n\t\t\t\tif err := mapstructure.Decode(req.Data, data); err != nil {\n\t\t\t\t\tlogrus.Errorf(\"Unable to decode incoming subscription request - %v\", err)\n\t\t\t\t\tres := model.RealtimeResponse{Ack: false, Error: err.Error()}\n\t\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\tdata.Project = projectID\n\n\t\t\t\tif err := realtime.Unsubscribe(clientID, data); err != nil {\n\t\t\t\t\tres := model.RealtimeResponse{Group: data.Group, ID: data.ID, Ack: false}\n\t\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\t\t\t\t}\n\n\t\t\t\t// Send response to client\n\t\t\t\tres := model.RealtimeResponse{Group: data.Group, ID: data.ID, Ack: true}\n\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: res})\n\t\t\tdefault:\n\t\t\t\tc.Write(&model.Message{ID: req.ID, Type: req.Type, Data: map[string]string{\"error\": \"Invalid message type\"}})\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n}", "title": "" }, { "docid": "034e68623ee5a4da1d8445750f46893e", "score": "0.65358365", "text": "func serveWebsocket(c *gin.Context) {\n\t// upgrade connection to websocket\n\tconn, err := upgrader.Upgrade(c.Writer, c.Request, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tconn.EnableWriteCompression(true)\n\n\t// create two channels for read write concurrency\n\tresultChannel := make(chan node.Result)\n\n\tclient := &Client{conn: conn, write: resultChannel}\n\n\t// run reader and writer in two different go routines\n\t// so they can act concurrently\n\tgo client.streamReader()\n\tgo client.streamWriter()\n}", "title": "" }, { "docid": "f1419bc49825240b5d0b9c745ea86d29", "score": "0.65301865", "text": "func (s *Server) UpgradeHandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := s.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tid := uuid.New()\n\tfmt.Printf(\"Client %v connected.\\n\", id)\n\ts.Lock()\n\ts.websockets[id] = conn\n\ts.Unlock()\n\tgo func() {\n\t\texists := func() bool {\n\t\t\t_, exists := s.websockets[id]\n\t\t\treturn exists\n\t\t}\n\t\tfor exists() {\n\t\t\t_, message, err := conn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\t\tfmt.Printf(\"Websocket read error: %v\", err)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\t\ts.handler(Message{\n\t\t\t\tTimestamp: time.Now(),\n\t\t\t\tID: uuid.New(),\n\t\t\t\tValue: message,\n\t\t\t\tFrom: id,\n\t\t\t})\n\t\t}\n\t\tfmt.Printf(\"Stopped listening to client %v.\\n\", id)\n\t\ts.terminate(id)\n\t}()\n\n}", "title": "" }, { "docid": "c43134135be5d0999aacfdcf234ed475", "score": "0.6526958", "text": "func (p *politeiawww) handleWebsocketWrite(wc *wsContext) {\n\tdefer wc.wg.Done()\n\tlog.Tracef(\"handleWebsocketWrite %v\", wc)\n\tdefer log.Tracef(\"handleWebsocketWrite exit %v\", wc)\n\n\tfor {\n\t\tvar (\n\t\t\tcmd, id string\n\t\t\tpayload interface{}\n\t\t)\n\t\tselect {\n\t\tcase <-wc.done:\n\t\t\treturn\n\t\tcase e, ok := <-wc.errorC:\n\t\t\tif !ok {\n\t\t\t\tlog.Tracef(\"handleWebsocketWrite error not ok\"+\n\t\t\t\t\t\" %v\", wc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcmd = www.WSCError\n\t\t\tid = e.ID\n\t\t\tpayload = e\n\t\tcase _, ok := <-wc.pingC:\n\t\t\tif !ok {\n\t\t\t\tlog.Tracef(\"handleWebsocketWrite ping not ok\"+\n\t\t\t\t\t\" %v\", wc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcmd = www.WSCPing\n\t\t\tid = \"\"\n\t\t\tpayload = www.WSPing{Timestamp: time.Now().Unix()}\n\t\t}\n\n\t\terr := utilwww.WSWrite(wc.conn, cmd, id, payload)\n\t\tif err != nil {\n\t\t\tlog.Tracef(\"handleWebsocketWrite write %v %v\", wc, err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "253372886c50de9c729561a4ad4dc747", "score": "0.6522023", "text": "func live_wsHandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Print(\"upgrade:\", err)\n\t\treturn\n\t}\n\tgo live_data_udp_client(conn, sock)\n}", "title": "" }, { "docid": "c542fd8d0d69cb4387da573cb7862225", "score": "0.6516272", "text": "func (l *Live) handleWS(conn *websocket.Conn) {\n\t// Undo deadlines set by webserver.\n\tconn.SetDeadline(time.Time{})\n\tconn.SetWriteDeadline(time.Time{})\n\tconn.SetReadDeadline(time.Time{})\n\n\tl.lock.Lock()\n\tl.listeners[conn] = true\n\tl.lock.Unlock()\n\n\tbuf := make([]byte, 1024)\n\n\t// If read returns it means that the client is disconnected (when returning\n\t// an error), or that the client sent of something which is a protocol\n\t// violation. We end the connection. Goodbye.\n\tconn.Read(buf)\n\n\tl.lock.Lock()\n\tdelete(l.listeners, conn)\n\tl.lock.Unlock()\n}", "title": "" }, { "docid": "92a593b0ac9e3935948ee9f895d36535", "score": "0.6514537", "text": "func serveWs(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"serveWs: new connection\\n\")\n\n\tvar upgrader = websocket.Upgrader{\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t}\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Printf(\"serveWs: upgrader.Upgrade() failed with '%s'\\n\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tdefer ws.Close()\n\tws.SetReadLimit(512)\n\tws.SetReadDeadline(time.Now().Add(pongWait))\n\tws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\twsChan := make(chan struct{})\n\tclose := make(chan struct{})\n\n\twatcher := startBlogPostsWatcher()\n\tif watcher != nil {\n\t\tdefer watcher.Close()\n\t\tgo watchChanges(watcher, close, wsChan)\n\t}\n\n\tgo wsWriter(ws, wsChan, close)\n\tfor {\n\t\tmsgType, p, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"serveWs: ws.ReadMessage() failed with '%s'\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tlog.Printf(\"Got ws msg type: %d s: '%s'\\n\", msgType, string(p))\n\t\turi := string(p)\n\t\tarticleInfo := articleInfoFromURL(uri)\n\t\tif articleInfo == nil {\n\t\t\tlog.Printf(\"serveWs: didn't find article for uri %s\\n\", uri)\n\t\t\tcontinue\n\t\t}\n\t}\n\tclose <- struct{}{}\n\n}", "title": "" }, { "docid": "533c795a1ebea500fa0a51a3caf7dac3", "score": "0.6498643", "text": "func WebsocketHandler(username string) func(*websocket.Conn) {\n\treturn func(conn *websocket.Conn) {\n\t\tclient := &Client{hub: nil, conn: conn, send: make(chan *websocketMsg, 256), username: username, uid: utils.RandStringBytesMaskImpr(10)}\n\t\tgo client.writePump()\n\t\tclient.readPump()\n\t}\n}", "title": "" }, { "docid": "4d13eadcd52a3122f65ea7aa9f092e7b", "score": "0.6491188", "text": "func ServeWs(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\n\t\treturn\n\t}\n\n\tws, err := upgrader.Upgrade(w, r, nil)\n\n\tc := &connection{\n\t\tactive: true,\n\t\tws: ws,\n\t\tsend: make(chan MessageOut),\n\t\tstop: make(chan bool),\n\t}\n\n\tdefer func() {\n\t\tc.ws.Close()\n\t}()\n\n\tif err != nil {\n\t\tlog.Println(\"Dropping client:\", err)\n\n\t\treturn\n\t}\n\n\tgo c.listenWrite()\n\n\tc.send <- MessageOut{Action: ActionIdentify}\n\n\tc.listenRead()\n\n\tc.setActive(false)\n\tc.timeout = time.NewTimer(h.getTimeout())\n\n\tselect {\n\tcase <-c.timeout.C:\n\tcase <-c.stop:\n\t}\n\n\treg := registration{\n\t\tconn: c,\n\t\tok: make(chan bool),\n\t}\n\n\th.unregister <- reg\n\t<-reg.ok\n\n\t// Empty channel before closing\n\tfor {\n\t\tselect {\n\t\tcase <-c.send:\n\t\t\tcontinue\n\t\tdefault:\n\t\t}\n\n\t\tbreak\n\t}\n\n\tclose(c.send)\n}", "title": "" }, { "docid": "7eaba0720986c5d071561b99f5d8cc6f", "score": "0.64883876", "text": "func (handle *Handle) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\n\t// Set up logger\n\tvar log = handle.log.WithFields(logrus.Fields{\n\t\t\"clientAddress\": r.RemoteAddr,\n\t\t\"userAgent\": r.UserAgent(),\n\t})\n\n\t// Update to WebSocket\n\tconn, err := webSocketUpgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Could not upgrade connection to WebSocket.\")\n\t\thttp.Error(w, \"WebSocket upgrade error\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlog.Info(\"WebSocket connection opened\")\n\n\t// Create a mutex for writing to WebSocket (connection supports only one concurrent reader and one concurrent writer (https://godoc.org/github.com/gorilla/websocket#hdr-Concurrency))\n\twriteMutex := sync.Mutex{}\n\n\t// Create a context for this WebSocket connection\n\tctx, cancel := context.WithCancel(context.Background())\n\n\t// Send binary data up the WebSocket\n\tsendBinary := func(data []byte) error {\n\t\twriteMutex.Lock()\n\t\tconn.SetWriteDeadline(time.Now().Add(50 * time.Millisecond))\n\t\terr := conn.WriteMessage(websocket.BinaryMessage, data)\n\t\twriteMutex.Unlock()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseNormalClosure) {\n\t\t\t\tlog.WithError(err).Error(\"WebSocket error\")\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Create channels with data received from SensingTex controller\n\trx := handle.broker.Sub(\"flex-rx\")\n\n\t// send data from device\n\tgo rx_data_loop(ctx, rx, sendBinary)\n\n\t// Helper function to close the connection\n\tclose := func() {\n\t\thandle.broker.Unsub(rx)\n\n\t\thandle.DeregisterSubscriber()\n\n\t\t// Cancel the context\n\t\tcancel()\n\n\t\t// Close websocket connection\n\t\tconn.Close()\n\n\t\tlog.Info(\"Websocket connection closed\")\n\t}\n\n\t// Start connecting to devices\n\thandle.Connect()\n\n\t// Main loop for the WebSocket connection\n\tgo func() {\n\t\tdefer close()\n\t\tfor {\n\n\t\t\tmessageType, msg, err := conn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseNormalClosure) {\n\t\t\t\t\tlog.WithError(err).Error(\"WebSocket error\")\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif messageType == websocket.BinaryMessage {\n\t\t\t\thandle.broker.TryPub(msg, \"flex-tx\")\n\t\t\t}\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "d98ffa4d23412efe0c04da9e7796bc3b", "score": "0.6461698", "text": "func (b *BTSE) WsHandleData() {\n\tb.Websocket.Wg.Add(1)\n\n\tdefer func() {\n\t\tb.Websocket.Wg.Done()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-b.Websocket.ShutdownC:\n\t\t\treturn\n\n\t\tdefault:\n\t\t\tresp, err := b.WebsocketConn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tb.Websocket.TrafficAlert <- struct{}{}\n\n\t\t\ttype MsgType struct {\n\t\t\t\tType string `json:\"type\"`\n\t\t\t\tProductID string `json:\"product_id\"`\n\t\t\t}\n\n\t\t\tif strings.Contains(string(resp.Raw), \"connect success\") {\n\t\t\t\tif b.Verbose {\n\t\t\t\t\tlog.Debugf(\"%s websocket client successfully connected to %s\",\n\t\t\t\t\t\tb.Name, b.Websocket.GetWebsocketURL())\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmsgType := MsgType{}\n\t\t\terr = common.JSONDecode(resp.Raw, &msgType)\n\t\t\tif err != nil {\n\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch msgType.Type {\n\t\t\tcase \"ticker\":\n\t\t\t\tvar t wsTicker\n\t\t\t\terr = common.JSONDecode(resp.Raw, &t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tp := strings.Replace(t.Price.(string), \",\", \"\", -1)\n\t\t\t\tprice, err := strconv.ParseFloat(p, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tb.Websocket.DataHandler <- wshandler.TickerData{\n\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\tPair: currency.NewPairDelimiter(t.ProductID, \"-\"),\n\t\t\t\t\tAssetType: \"SPOT\",\n\t\t\t\t\tExchange: b.GetName(),\n\t\t\t\t\tOpenPrice: price,\n\t\t\t\t}\n\t\t\tcase \"snapshot\":\n\t\t\t\tsnapshot := websocketOrderbookSnapshot{}\n\t\t\t\terr := common.JSONDecode(resp.Raw, &snapshot)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\terr = b.wsProcessSnapshot(&snapshot)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Websocket.DataHandler <- err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9cc08eb0d8421caddfe1dcac3e731365", "score": "0.6423152", "text": "func (a *App) WebsocketHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif strings.HasPrefix(r.URL.Path, busPrefix) {\n\t\t\ta.busWebsocketHandler(w, r)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "a7912e5094f5137c58801a9d64128dcc", "score": "0.6418268", "text": "func (conn *Conn) handle(ws *websocket.Conn) {\n\tdefer conn.Close()\n\tconn.initialize(ws)\n\n\tfor {\n\t\tconn.resetTimeout()\n\t\tvar data []byte\n\t\tif err := websocket.Message.Receive(ws, &data); err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tklog.Errorf(\"Error on socket receive: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif len(data) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tchannel := data[0]\n\t\tif conn.codec == base64Codec {\n\t\t\tchannel = channel - '0'\n\t\t}\n\t\tdata = data[1:]\n\t\tif int(channel) >= len(conn.channels) {\n\t\t\tklog.V(6).Infof(\"Frame is targeted for a reader %d that is not valid, possible protocol error\", channel)\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := conn.channels[channel].DataFromSocket(data); err != nil {\n\t\t\tklog.Errorf(\"Unable to write frame to %d: %v\\n%s\", channel, err, string(data))\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4fd09508082ba00f4ffe02798793a9e8", "score": "0.64126575", "text": "func (sm *UploMux) handleWS(w http.ResponseWriter, req *http.Request) {\n\tupgrader := websocket.Upgrader{\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\treturn true\n\t\t},\n\t}\n\tconn, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Upgrade the connection using a mux.\n\terr = sm.managedUpgradeConn(mux.NewWSConn(conn))\n\tif err != nil {\n\t\terr = errors.Compose(err, conn.Close())\n\t\tsm.staticLog.Printf(\"failed to upgrade wsconn: %v\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "74c486334f83fd3624d2bf20da3980ed", "score": "0.64121336", "text": "func (g *GroundStation) handleWebSocketMessage(message []byte) []byte {\n\tlog.Printf(\"data %s\", message)\n\tvar m TargetMessage\n\terr := json.Unmarshal(message, &m)\n\tif err != nil {\n\t\tlog.Printf(\"Error while unmarshaling websocket message. Message dropped\")\n\t\treturn nil\n\t}\n\n\tg.patternID++\n\tlog.Printf(\"Send swarmInit\")\n\tg.gossiper.AddExtraMessage(&extramessage.ExtraMessage{\n\t\tSwarmInit: &extramessage.SwarmInit{\n\t\t\tPatternID: strconv.Itoa(g.patternID),\n\t\t\tInitialPos: g.drones,\n\t\t\tTargetPos: m.Targets,\n\t\t},\n\t})\n\tg.nextPosition = m.Targets\n\tg.running = len(g.drones)\n\n\t// Nothing to send back\n\treturn nil\n}", "title": "" }, { "docid": "220c8569ab00fb1cd9653a06fa738acc", "score": "0.64118636", "text": "func (ws *WS) Handler(w http.ResponseWriter, req *http.Request) {\n\tconn, err := ws.upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tws.sidCount++\n\n\tsid := fmt.Sprintf(\"%d\", ws.sidCount)\n\n\tdefer ws.destroyConn(sid)\n\tws.newConn(sid, conn)\n}", "title": "" }, { "docid": "9e3d141f78f7bae38b4e0ba711ae5151", "score": "0.63984513", "text": "func WebsocketDataHandler(ws *wshandler.Websocket, verbose bool) {\n\twg.Add(1)\n\tdefer wg.Done()\n\n\tgo streamDiversion(ws, verbose)\n\n\tfor {\n\t\tselect {\n\t\tcase <-shutdowner:\n\t\t\treturn\n\n\t\tcase data := <-ws.DataHandler:\n\t\t\tswitch d := data.(type) {\n\t\t\tcase string:\n\t\t\t\tswitch d {\n\t\t\t\tcase wshandler.WebsocketNotEnabled:\n\t\t\t\t\tif verbose {\n\t\t\t\t\t\tlog.Warnf(\"routines.go warning - exchange %s weboscket not enabled\",\n\t\t\t\t\t\t\tws.GetName())\n\t\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Infof(d)\n\t\t\t\t}\n\n\t\t\tcase error:\n\t\t\t\tswitch {\n\t\t\t\tcase common.StringContains(d.Error(), \"close 1006\"):\n\t\t\t\t\tgo ws.WebsocketReset()\n\t\t\t\t\tcontinue\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Errorf(\"routines.go exchange %s websocket error - %s\", ws.GetName(), data)\n\t\t\t\t}\n\n\t\t\tcase wshandler.TradeData:\n\t\t\t\t// Trade Data\n\t\t\t\tif verbose {\n\t\t\t\t\tlog.Infoln(\"Websocket trades Updated: \", d)\n\t\t\t\t}\n\n\t\t\tcase wshandler.TickerData:\n\t\t\t\t// Ticker data\n\t\t\t\tif verbose {\n\t\t\t\t\tlog.Infoln(\"Websocket Ticker Updated: \", d)\n\t\t\t\t}\n\t\t\tcase wshandler.KlineData:\n\t\t\t\t// Kline data\n\t\t\t\tif verbose {\n\t\t\t\t\tlog.Infoln(\"Websocket Kline Updated: \", d)\n\t\t\t\t}\n\t\t\tcase wshandler.WebsocketOrderbookUpdate:\n\t\t\t\t// Orderbook data\n\t\t\t\tif verbose {\n\t\t\t\t\tlog.Infoln(\"Websocket Orderbook Updated:\", d)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif verbose {\n\t\t\t\t\tlog.Warnf(\"Websocket Unknown type: %s\", d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b07bfb637dc6400e2fbfe6455fd5c8b2", "score": "0.6381648", "text": "func handleClientWS(w http.ResponseWriter, r *http.Request) {\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\t// CWS stands for client WS\n\t\tlog.Println(\"CWS:\", err)\n\t\treturn\n\t}\n\n\t// Generate a UID to identify this client\n\tclientUID := uuid.NewV4()\n\tlog.Println(\"CWS: Client connected:\", r.RemoteAddr, clientUID)\n\n\t// Create a return channel for this client\n\t// XXX: Hard code return channel size 50: if more than 50 outputs are received before dequeued to client,\n\t// outputs will be discarded\n\tretChannel := make(chan *ResponseObject, 50)\n\tretChLock.Lock()\n\tretChMap[clientUID] = retChannel\n\tretChLock.Unlock()\n\n\tdefer func() {\n\t\tc.Close()\n\t\t// Delete return channel for this client\n\t\tretChLock.Lock()\n\t\tclose(retChMap[clientUID])\n\t\tdelete(retChMap, clientUID)\n\t\tretChLock.Unlock()\n\t\tlog.Println(\"CWS: Client disconnected:\", r.RemoteAddr)\n\t}()\n\n\t// Start the output routine: listen on the return channel and send to client when outputs are received\n\tgo deliverResponseRoutine(retChannel, c)\n\n\tfor {\n\t\t// Read input message from client\n\t\t_, data, err := c.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(\"CWS:\", err)\n\t\t\tbreak\n\t\t}\n\t\tvar reqObject RequestObject\n\t\terr = json.Unmarshal(data, &reqObject)\n\t\tif err != nil {\n\t\t\tlog.Println(\"CWS: Error unmarshalling message!\", err, string(data))\n\t\t}\n\n\t\t// Attach requester's UID to the request input\n\t\treqObject.RID = clientUID.String()\n\t\t// Clear the TID before enqueuing\n\t\ttargetID := reqObject.TID\n\t\treqObject.TID = \"\"\n\n\t\treqChLock.RLock()\n\t\treqChannel := reqChMap[targetID]\n\t\treqChLock.RUnlock()\n\t\tselect {\n\t\tcase reqChannel <- &reqObject:\n\t\t\tlog.Println(\"CWS: Sent:\", reqObject)\n\t\tdefault:\n\t\t\t// Fails to send the input because component's chan is full, or its channel does not exist\n\t\t\tlog.Println(\"CWS: Input channel unavailable. Discarding:\", reqObject)\n\t\t\t// TODO: Server respond with an error message\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "6d165391549e6a73b87d9b297c6e6e93", "score": "0.6379244", "text": "func handleConnections(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"We got a new websocket connection from %s\\n\", r.Header.Get(\"Origin\"))\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\t// Register our new client\n\tclients[conn] = true\n\tfor {\n\t\tmsg := \"{}\"\n\t\t// Read in a new message as JSON and map it to a Message object\n\t\terr := conn.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\tdelete(clients, conn)\n\t\t\tbreak\n\t\t}\n\t\t// Send the newly received message to the broadcast channel\n\t\tfor {\n\t\t\tmsg := \"{}\"\n\t\t\t// Read in a new message as JSON and map it to a Message object\n\t\t\terr := conn.ReadJSON(&msg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\t// let's remove connection from map\n\t\t\t\tdelete(clients, conn)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\t// Make sure we close the connection when the function returns\n\tdefer conn.Close()\n}", "title": "" }, { "docid": "1d8408ea4b40b380d8b8161b6321648a", "score": "0.6369973", "text": "func WSHandler(w http.ResponseWriter, r *http.Request) {\n\thttpSession, _ := session.HTTPSession.Get(r, \"wide-session\")\n\tif httpSession.IsNew {\n\t\thttp.Error(w, \"Forbidden\", http.StatusForbidden)\n\n\t\treturn\n\t}\n\tusername := httpSession.Values[\"username\"].(string)\n\n\tsid := r.URL.Query()[\"sid\"][0]\n\n\tconn, _ := websocket.Upgrade(w, r, nil, 1024, 1024)\n\twsChan := util.WSChannel{Sid: sid, Conn: conn, Request: r, Time: time.Now()}\n\n\tret := map[string]interface{}{\"output\": \"Shell initialized\", \"cmd\": \"init-shell\"}\n\terr := wsChan.WriteJSON(&ret)\n\tif nil != err {\n\t\treturn\n\t}\n\n\tShellWS[sid] = &wsChan\n\n\tlogger.Debugf(\"Open a new [Shell] with session [%s], %d\", sid, len(ShellWS))\n\n\tinput := map[string]interface{}{}\n\n\tfor {\n\t\tif err := wsChan.ReadJSON(&input); err != nil {\n\t\t\tlogger.Error(\"Shell WS ERROR: \" + err.Error())\n\n\t\t\treturn\n\t\t}\n\n\t\tinputCmd := input[\"cmd\"].(string)\n\n\t\tcmds := strings.Split(inputCmd, \"|\")\n\t\tcommands := []*exec.Cmd{}\n\t\tfor _, cmdWithArgs := range cmds {\n\t\t\tcmdWithArgs = strings.TrimSpace(cmdWithArgs)\n\t\t\tcmdWithArgs := strings.Split(cmdWithArgs, \" \")\n\t\t\targs := []string{}\n\t\t\tif len(cmdWithArgs) > 1 {\n\t\t\t\targs = cmdWithArgs[1:]\n\t\t\t}\n\n\t\t\tcmd := exec.Command(cmdWithArgs[0], args...)\n\t\t\tcommands = append(commands, cmd)\n\t\t}\n\n\t\toutput := \"\"\n\t\tif !strings.Contains(inputCmd, \"clear\") {\n\t\t\toutput = pipeCommands(username, commands...)\n\t\t}\n\n\t\tret = map[string]interface{}{\"output\": output, \"cmd\": \"shell-output\"}\n\n\t\tif err := wsChan.WriteJSON(&ret); err != nil {\n\t\t\tlogger.Error(\"Shell WS ERROR: \" + err.Error())\n\t\t\treturn\n\t\t}\n\n\t\twsChan.Refresh()\n\t}\n}", "title": "" }, { "docid": "281e2e656f3859d046d5d860ecd4d807", "score": "0.6363541", "text": "func serve_ws(conn_type string, hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tswitch conn_type {\n\tcase \"dashboard\":\n\t\tclient := &Client{\n\t\t\thub: hub,\n\t\t\tconn_type: conn_type,\n\t\t\tconn: conn,\n\t\t\tSession_packet_send: make(chan structs.PacketSessionData),\n\t\t\tLap_packet_send: make(chan structs.PacketLapData),\n\t\t\tTelemetry_packet_send: make(chan structs.PacketCarTelemetryData),\n\t\t\tCar_status_packet_send: make(chan structs.PacketCarStatusData),\n\t\t\tSave_to_database_alert: make(chan structs.Save_to_database_alerts),\n\t\t\tSave_to_database_status: make(chan structs.Save_to_database_status),\n\t\t}\n\t\tclient.hub.register <- client\n\n\t\t// Allow collection of memory referenced by the caller by doing all work in\n\t\t// new goroutines.\n\t\tclient.catchUp(\"dashboard\")\n\t\tgo client.writeDashboard()\n\t\tgo client.readFromClients()\n\n\tcase \"history\":\n\t\tclient := &Client{\n\t\t\thub: hub,\n\t\t\tconn_type: conn_type,\n\t\t\tconn: conn,\n\t\t\tSave_to_database_alert: make(chan structs.Save_to_database_alerts),\n\t\t\tSave_to_database_status: make(chan structs.Save_to_database_status),\n\t\t}\n\t\tclient.hub.register <- client\n\n\t\t// Allow collection of memory referenced by the caller by doing all work in\n\t\t// new goroutines.\n\t\tclient.catchUp(\"history\")\n\t\tgo client.writeHistory()\n\n\tcase \"time\":\n\t\tclient := &Client{\n\t\t\thub: hub,\n\t\t\tconn_type: conn_type,\n\t\t\tconn: conn,\n\t\t\tLap_packet_send: make(chan structs.PacketLapData),\n\t\t\tSave_to_database_alert: make(chan structs.Save_to_database_alerts),\n\t\t\tSave_to_database_status: make(chan structs.Save_to_database_status),\n\t\t}\n\t\tclient.hub.register <- client\n\n\t\t// Allow collection of memory referenced by the caller by doing all work in\n\t\t// new goroutines.\n\t\tclient.catchUp(\"time\")\n\t\tgo client.writeTime()\n\t\tgo client.readFromClients()\n\n\tdefault:\n\t\tlog.Println(\"ws client type is invalid, type:\", conn_type)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "9c0fd8515057edfe56a0cbdeae42b4e9", "score": "0.6360603", "text": "func handleConnections(writer http.ResponseWriter, request *http.Request) {\n\t// Upgrade the request we got to a websocket\n\tws, err := upgrader.Upgrade(writer, request, nil)\n\tif err != nil {\n\t\tlog.Printf(\"Error Upgrading %v\", err)\n\t\tws.Close()\n\t\treturn\n\t}\n\t// Close the websocket connection when done\n\tdefer ws.Close()\n\tclients[ws] = true\n\n\tfor {\n\t\tvar msg Message\n\n\t\t// Get new msgs from the ws\n\t\t// \"Don't push me, 'cause I'm close to the edge.\"\n\t\terr := ws.ReadJSON(&msg)\n\n\t\t// \"I'm about to lose my head.\"\n\t\tif err != nil {\n\t\t\tif !strings.Contains(err.Error(), \"1001\") {\n\t\t\t\tlog.Printf(\"error reading JSON: %v\", err)\n\t\t\t}\n\t\t\tdelete(clients, ws)\n\t\t\tbreak\n\t\t}\n\t\tmsg.Name, msg.Message = p.Sanitize(msg.Name), p.Sanitize(msg.Message)\n\t\t// Add the timestamp\n\t\tmsg.Timestamp = getTimestamp()\n\n\t\tmsg.Giphy = getGiphy(msg.Giphy)\n\n\t\tbroadcast <- msg\n\t}\n}", "title": "" }, { "docid": "46b7585faee406a1506df90f11c42080", "score": "0.63536143", "text": "func (s *Server) ServeWs(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tif len(s.hubs) == 0 {\n\t\tinitializeHubs(s)\n\t}\n\n\tclient := &Client{hub: s.hubs[\"#general\"],\n\t\tnick: \"anonymous\",\n\t\tconn: conn,\n\t\tsend: make(chan []byte, 256),\n\t\toptions: s.options,\n\t}\n\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "134708909fc3f70e293579fa646e8bb7", "score": "0.63516873", "text": "func (wsh *WebSocketsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"received websocket upgrade request\")\n\t//TODO: Upgrade the connection to a WebSocket, and add the\n\t//new websock.Conn to the Notifier. See\n\t//https://godoc.org/github.com/gorilla/websocket#hdr-Overview\n}", "title": "" }, { "docid": "e8976aaa9ec2dc9bd89d9aba8be78533", "score": "0.6328029", "text": "func socketHandler(w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tdefer conn.Close()\n\n\tif err != nil {\n\t\tlog.Printf(\"upgrader.Upgrade: %v\", err)\n\t\treturn\n\t}\n\n\tfor {\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"conn.ReadMessage: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif err := conn.WriteMessage(messageType, p); err != nil {\n\t\t\tlog.Printf(\"conn.WriteMessage: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "842c33f4ab081bc064a23a2834cb55f2", "score": "0.63264596", "text": "func (s *Server) WS(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"A user is connecting...\")\n\t// defer func() {\n\t// \tif r := recover(); r != nil {\n\t// \t\tlog.Println(\"Warn: Something wrong. Recovered in \", r)\n\t// \t}\n\t// }()\n\n\tupgrader.CheckOrigin = func(r *http.Request) bool {\n\t\t// TODO: can we be stricter?\n\t\treturn true\n\t}\n\t// be aware of ReadBufferSize, WriteBufferSize (default 4096)\n\t// https://pkg.go.dev/github.com/gorilla/websocket?tab=doc#Upgrader\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Coordinator: [!] WS upgrade:\", err)\n\t\treturn\n\t}\n\n\t// Create websocket Client\n\twsClient := cws.NewClient(c)\n\t// clientID := wsClient.GetID()\n\ts.wsClients[wsClient.GetID()] = wsClient\n\t// Add websocket client to chat service\n\t// DEPRECATED because we use external chat\n\t// chatClient := s.chat.AddClient(clientID, wsClient)\n\t// chatClient.Route()\n\tlog.Println(\"Initialized Chat\")\n\t// TODO: Update packet\n\t// Add websocket client to app service\n\tlog.Println(\"Initialized ServiceClient\")\n\n\ts.initClientData(wsClient)\n\tgo func(browserClient *cws.Client) {\n\t\tbrowserClient.Listen()\n\t\tlog.Println(\"Closing connection\")\n\t\t// chatClient.Close()\n\t\tbrowserClient.Close()\n\t\tlog.Println(\"Closed connection\")\n\t}(wsClient)\n}", "title": "" }, { "docid": "dd196a928f2fe2c83136d08724eb9bcf", "score": "0.632115", "text": "func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tremote := &Remote{\n\t\thub: hub,\n\t\tconn: conn,\n\t\tpacketReceiver: newPacketReceiver(),\n\t\tsend: make(chan []byte, 256),\n\t}\n\n\tremote.hub.register <- remote\n\n\tgo remote.read()\n\tgo remote.write()\n}", "title": "" }, { "docid": "998ed0fd28b5da920b7f1bcf4ac5c88a", "score": "0.6317124", "text": "func (this *WebsocketHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\n\tconn, err := upgrader.Upgrade(w, req, nil)\n\tif err != nil {\n\t\tlog.Error(\"Failed to instantiate websocket:\", err)\n\t\treturn\n\t}\n\n\tdefer conn.Close()\n\n\tlog.Info(\"Accepted connection from client: \", conn.RemoteAddr())\n\n\tfor {\n\t\tvar mreq stats.MessageRequest\n\t\tmresp := stats.MessageResponse{\n\t\t\tHost: *flName,\n\t\t\tError: \"\",\n\t\t\tNodes: map[string]stats.NodeStats{},\n\t\t}\n\n\t\tif err := conn.ReadJSON(&mreq); err == nil {\n\n\t\t\tswitch mreq.Type {\n\t\t\tcase stats.STAT:\n\t\t\t\tgetCurrentNodeStat(&mresp)\n\t\t\t\t// Send response message\n\n\t\t\t\tif err = conn.WriteJSON(&mresp); err != nil {\n\t\t\t\t\tlog.Error(\"Failed to respond with node stats:\", err)\n\t\t\t\t}\n\t\t\tcase stats.STATALL:\n\t\t\t\tgetCurrentNodeStat(&mresp)\n\t\t\t\tgetAllNodesStats(&mresp)\n\n\t\t\t\tlog.Debug(\"STATALL nodes response:\", mresp.Nodes)\n\n\t\t\t\tif err = conn.WriteJSON(&mresp); err != nil {\n\t\t\t\t\tlog.Error(\"Failed to respond with all node stats:\", err)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tlog.Warn(\"Received unknown request type:\", mreq.Type)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Debug(\"Terminated connection with client:\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b1fb59ec7c3eb01e55397cbbc4e4b4ff", "score": "0.62983173", "text": "func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tLog(\"Connected\")\n\tNewClient(hub, conn)\n}", "title": "" }, { "docid": "45ea523ef5bed9fc565397a476ffe000", "score": "0.6283644", "text": "func ServeWs(hub *Hub, wrapper *wrapper.Wrapper, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}", "title": "" }, { "docid": "3d33cbff49cac825445a24d93deeeb1c", "score": "0.6275938", "text": "func (hub *ServerHub) ServeWs(w http.ResponseWriter, r *http.Request) {\n\tvar apiKey string\n\ttoken, ok := r.Header[\"Authorization\"]\n\tif ok && len(token) >= 1 {\n\t\tapiKey = token[0]\n\t\tapiKey = strings.TrimPrefix(apiKey, \"Bearer \")\n\t}\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Info(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, sender: make(chan *ClientMsg), receiver: make(chan *ClientMsg)}\n\tclient.hub.register <- client\n\tgo client.startReceiver()\n\tgo client.startSender()\n}", "title": "" }, { "docid": "8b0d7cc4877a92e053c807d8bd6eb027", "score": "0.62615293", "text": "func (ctx *Context) WebSocketUpgradeHandler(w http.ResponseWriter, r *http.Request) {\n\t// state := &SessionState{}\n\t// if _, err := sessions.GetState(r, ctx.SessionKey, ctx.SessionStore, state); err != nil {\n\t// \thttp.Error(w, \"error retrieving current user\", http.StatusUnauthorized)\n\t// \treturn\n\t// }\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Printf(\"Error adding client: %s\", err.Error())\n\t\treturn\n\t}\n\tctx.Notifier.AddClient(conn)\n}", "title": "" }, { "docid": "14a71927ed192214b76c15d86c79bc98", "score": "0.6247882", "text": "func connectHandler(ws *websocket.Conn) {\n\tif currentWebsocket != nil {\n\t\tlog.Printf(\"[hopwatch] already connected to a debugger; Ignore this\\n\")\n\t\treturn\n\t}\n\t// remember the connection for the sendLoop\t\n\tcurrentWebsocket = ws\n\tvar cmd command\n\tif err := websocket.JSON.Receive(currentWebsocket, &cmd); err != nil {\n\t\tlog.Printf(\"[hopwatch] connectHandler.JSON.Receive failed:%v\", err)\n\t} else {\n\t\tlog.Printf(\"[hopwatch] connected to browser. ready to hop\")\n\t\tconnectChannel <- cmd\n\t\treceiveLoop()\n\t}\n}", "title": "" }, { "docid": "22a0d551c76ca59e68bc8a27a4cd3c68", "score": "0.62381995", "text": "func (l *Link) handleWS(o *Link, t rocproto.Packet_Section) {\n\n\tdefer l.ws.Close()\n\tdefer func() { l.ws = nil }()\n\n\tquit := make(chan bool)\n\n\tgo func() {\n\n\t\tdefer func() { quit <- true }()\n\n\t\tfor {\n\t\t\tm := new(rocproto.Packet)\n\t\t\t_, buff, err := l.ws.ReadMessage()\n\t\t\tif misc.CheckError(err, \"Receiving data from conn\", false) != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err = checkBuffer(-1, buff, m); err != nil {\n\t\t\t\te := NewError(rocproto.Error_Packet, err.Error(), int32(t&^rocproto.Packet_CONTROL_SERVER))\n\t\t\t\tlog.Println(\"Error : \", e)\n\t\t\t\tl.out <- e\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Println(\"Received ==>\t\", m)\n\t\t\tlog.Println(m.Header & uint32(t))\n\t\t\troutPacket(m, l, o, t)\n\t\t}\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-quit:\n\t\t\treturn\n\t\tcase m := <-l.out:\n\t\t\tlog.Printf(\"Sending ==>\t%v\\n\", m)\n\t\t\tb, err := proto.Marshal(m)\n\t\t\tif misc.CheckError(err, \"linker.go/handleWS\", false) != nil {\n\t\t\t\tif m == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = l.ws.WriteMessage(websocket.BinaryMessage, b)\n\t\t\tif misc.CheckError(err, \"linker.go/handleWS\", false) != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a9c3a17966a7ba2404af3f16f76d420", "score": "0.62263", "text": "func (h *Hub) ServeWs(w http.ResponseWriter, r *http.Request) {\n\tupgrader.CheckOrigin = func(r *http.Request) bool {\n\t\t// allow any origin to connect.\n\t\treturn true\n\t}\n\n\tif len(h.clients) > 100 {\n\t\tlog.Println(\"too many clients!\") // TODO temporary safety measure; decide on clients limit later.\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tlog.Println(\"onboarding new client\")\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tvar c *client.Client\n\tc = client.NewClient(conn, func() {\n\t\th.unregister <- c\n\t})\n\n\t// register it\n\th.register <- c\n\n\t// start processing routines for the client\n\tgo c.WritePump()\n\tgo c.ReadPump()\n}", "title": "" }, { "docid": "d3d233a3b6c07a0b21ad0fafaa995e9a", "score": "0.62235445", "text": "func wshandler(ws *websocket.Conn) {\n\t// add new conn\n\tconnMU.Lock()\n\tconnections[ws] = true\n\tconnMU.Unlock()\n\t// catches when browser/tab is closed.\n\t// ws.Request.Context.Done() is always nil so have ping\n\t// might do more frequent?\n\tpinger := time.NewTicker(time.Second * 5)\n\n\tdefer func() {\n\n\t\tpinger.Stop()\n\t\tws.Close()\n\t}()\n\n\tgo func() {\n\t\tvar msg string\n\n\t\terr := websocket.Message.Receive(ws, &msg)\n\t\tif err != nil {\n\t\t\tlog.Println(err, \"error in receive\")\n\n\t\t}\n\n\t\tconnMU.Lock()\n\t\t// atomic.AddInt32 not really needed as we lock... do need the Lock() for if numReloading...\n\t\tif numReloading > 0 && atomic.AddInt32(&numReloading, -1) == 0 {\n\t\t\t// page(s) is loaded so unlock and allow next build\n\t\t\tcommon.Unlock()\n\n\t\t}\n\t\tconnMU.Unlock()\n\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-pinger.C:\n\t\t\t// presume no news is good news. err/news == closed i.e refresh/tab/browser closed\n\t\t\tif err := websocket.Message.Send(ws, \"ping\"); err != nil {\n\t\t\t\t// once less for reloading\n\t\t\t\tatomic.AddInt32(&numReloading, -1)\n\t\t\t\tconnMU.Lock()\n\t\t\t\t// remove if not already gone. no-op if already emptied\n\t\t\t\tdelete(connections, ws)\n\t\t\t\tconnMU.Unlock()\n\n\t\t\t\treturn\n\n\t\t\t}\n\n\t\tcase <-reloadC:\n\t\t\tconnMU.Lock()\n\t\t\t// reset\n\t\t\tnumReloading = 0\n\t\t\t// broadcast to all\n\t\t\tfor wlst := range connections {\n\t\t\t\terr := websocket.Message.Send(wlst, \"reload\")\n\t\t\t\t// presume closed/disconnected on error so don't inc numReloading\n\t\t\t\t// will be a tie between pings that could appear in connections but actually gone\n\t\t\t\t// todo: check error and log somewhere\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\n\t\t\t\t}\n\t\t\t\tatomic.AddInt32(&numReloading, 1)\n\n\t\t\t}\n\t\t\t/// empty all conns\n\t\t\tfor k := range connections {\n\t\t\t\tdelete(connections, k)\n\t\t\t}\n\t\t\tconnMU.Unlock()\n\t\t\t// close as new connection each reload, otherwise broken pipe errors etc..\n\t\t\treturn\n\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "6558685ba1d262a17b75f1366bc5207b", "score": "0.6205179", "text": "func WebSocketUpgradeHandler(h http.Handler, authurl string) http.Handler {\n\tclient := &http.Client{\n\t\tTransport: &ochttp.Transport{\n\t\t\tFormatSpanName: func(*http.Request) string {\n\t\t\t\treturn \"viewer.authenticate\"\n\t\t\t},\n\t\t},\n\t}\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif !websocket.IsWebSocketUpgrade(r) || r.Header.Get(TenantHeader) != \"\" {\n\t\t\th.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\treq, err := http.NewRequestWithContext(\n\t\t\tr.Context(), http.MethodGet, authurl, nil,\n\t\t)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\treq.Header.Set(\"X-Forwarded-Host\", r.Host)\n\t\tif username, password, ok := r.BasicAuth(); ok {\n\t\t\treq.SetBasicAuth(username, password)\n\t\t}\n\t\tfor _, c := range r.Cookies() {\n\t\t\treq.AddCookie(c)\n\t\t}\n\n\t\trsp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\t\treturn\n\t\t}\n\t\tdefer rsp.Body.Close()\n\t\tif rsp.StatusCode != http.StatusOK {\n\t\t\thttp.Error(w, \"\", http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\tvar current struct {\n\t\t\tTenant string `json:\"organization\"`\n\t\t\tUser string `json:\"email\"`\n\t\t\tRole string `json:\"role\"`\n\t\t}\n\t\tif err := json.NewDecoder(rsp.Body).Decode(&current); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tr.Header.Set(TenantHeader, current.Tenant)\n\t\tr.Header.Set(UserHeader, current.User)\n\t\tr.Header.Set(RoleHeader, current.Role)\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "9bdeca2a26ff4d94c8c1a378ac56b5c7", "score": "0.6187845", "text": "func Websocket(c echo.Context) error {\n\tws, err := upgrader.Upgrade(c.Response(), c.Request(), nil)\n\tif err != nil {\n\t\tws.Close()\n\t}\n\n\treceiver := models.RegisterReceiver(ws)\n\tw := models.WsMessage{Status: \"init\",\n\t\tTokenStr: receiver.Token.Uuid,\n\t}\n\tws.WriteJSON(&w)\n\n\t// Remove the token from the tokensmap when the user closes the item\n\t_, msg, err := ws.ReadMessage()\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\t// Catch if the user leaves\n\tvar wmsg models.WsMessage\n\terr = json.Unmarshal(msg, &wmsg)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\tws.Close()\n\t} else {\n\t\tif wmsg.Status == \"closed\" {\n\t\t\tmodels.RemoveToken(wmsg.TokenStr)\n\t\t\tws.Close()\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f88cd08436fa3f573b5647eef2ea638", "score": "0.61858445", "text": "func ServeWS(h *Hub, w http.ResponseWriter, r *http.Request) error {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient := &Client{\n\t\thub: h,\n\t\tconn: conn,\n\t\tsend: make(chan []byte, 1<<4),\n\t}\n\n\th.register <- client\n\n\tgo client.handleIncoming()\n\tgo client.handleOutgoing()\n\n\treturn nil\n}", "title": "" }, { "docid": "b910b516c3eb74bb907ec92f653c2faa", "score": "0.6167058", "text": "func (sc *SocketCrutch) ServeHTTP(rw http.ResponseWriter, req *http.Request) {\n\tlog.Debugf(\"handling %s http request %s\", req.Method, req.URL)\n\n\tif sc.handshakeHandler != nil {\n\t\tif ok := sc.handshakeHandler(rw, req); !ok {\n\t\t\tlog.Debug(\"custom handshake failed\")\n\n\t\t\thttp.Error(rw, \"handshake failed\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif atomic.LoadInt32(&sc.connectCounter)+1 > sc.config.maxConnections {\n\t\tlog.Debug(\"too many connections\")\n\n\t\thttp.Error(rw, \"too many connections\", http.StatusServiceUnavailable)\n\n\t\treturn\n\t}\n\n\t// Upgrade websocket connection.\n\tprotocols := websocket.Subprotocols(req)\n\tvar responseHeader http.Header = nil\n\n\tif len(protocols) > 0 {\n\t\tresponseHeader = http.Header{\"Sec-Websocket-Protocol\": {protocols[0]}}\n\t}\n\n\tws, err := sc.upgrader.Upgrade(rw, req, responseHeader)\n\n\tif err != nil {\n\t\tlog.Debugf(\"failed to upgrade websocket: %v\", err)\n\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tsc.errorHandler(nil, err)\n\n\t\t\tlog.Errorf(\"unknown error while upgrade websocket: %v\", err)\n\t\t}\n\n\t\treturn\n\t}\n\n\tsc.createClient(ws, req)\n}", "title": "" }, { "docid": "f8efe37bc592b6cef7969e97365409a0", "score": "0.6166869", "text": "func WebSocketWrapper(app *Application, wsUpgrader *websocket.Upgrader) func(ctx *gin.Context) {\n\treturn func(ctx *gin.Context) {\n\t\twshandler(wsUpgrader, ctx.Writer, ctx.Request, app)\n\t}\n}", "title": "" }, { "docid": "65568d286501c39129b21ed69f9c1c0e", "score": "0.6160309", "text": "func (q *Querier) TailHandler(w http.ResponseWriter, r *http.Request) {\n\tupgrader := websocket.Upgrader{\n\t\tCheckOrigin: func(r *http.Request) bool { return true },\n\t}\n\n\tqueryRequestPtr, err := httpRequestToQueryRequest(r)\n\tif err != nil {\n\t\tserver.WriteError(w, err)\n\t\treturn\n\t}\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlevel.Error(util.Logger).Log(\"Error in upgrading websocket\", fmt.Sprintf(\"%v\", err))\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\terr := conn.Close()\n\t\tlevel.Error(util.Logger).Log(\"Error closing websocket\", fmt.Sprintf(\"%v\", err))\n\t}()\n\n\t// response from httpRequestToQueryRequest is a ptr, if we keep passing pointer down the call then it would stay on\n\t// heap until connection to websocket stays open\n\tqueryRequest := *queryRequestPtr\n\titr := q.tailQuery(r.Context(), &queryRequest)\n\tstream := logproto.Stream{}\n\n\tfor itr.Next() {\n\t\tstream.Entries = []logproto.Entry{itr.Entry()}\n\t\tstream.Labels = itr.Labels()\n\n\t\terr := conn.WriteJSON(stream)\n\t\tif err != nil {\n\t\t\tlevel.Error(util.Logger).Log(\"Error writing to websocket\", fmt.Sprintf(\"%v\", err))\n\t\t\tif err := conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseInternalServerErr, err.Error())); err != nil {\n\t\t\t\tlevel.Error(util.Logger).Log(\"Error writing close message to websocket\", fmt.Sprintf(\"%v\", err))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif err := itr.Error(); err != nil {\n\t\tlevel.Error(util.Logger).Log(\"Error from iterator\", fmt.Sprintf(\"%v\", err))\n\t\tif err := conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseInternalServerErr, err.Error())); err != nil {\n\t\t\tlevel.Error(util.Logger).Log(\"Error writing close message to websocket\", fmt.Sprintf(\"%v\", err))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90b3060ecebef237dd38d1fa215fc70c", "score": "0.6158622", "text": "func (w *WrappedGrpcServer) HandleGrpcWebsocketRequest(resp http.ResponseWriter, req *http.Request) {\n\n\twsConn, err := websocket.Accept(resp, req, &websocket.AcceptOptions{\n\t\tInsecureSkipVerify: true, // managed by ServeHTTP\n\t\tSubprotocols: []string{\"grpc-websockets\"},\n\t\tCompressionMode: w.opts.websocketCompressionMode,\n\t})\n\tif err != nil {\n\t\tgrpclog.Errorf(\"Unable to upgrade websocket request: %v\", err)\n\t\treturn\n\t}\n\n\tif w.websocketReadLimit > 0 {\n\t\twsConn.SetReadLimit(w.websocketReadLimit)\n\t}\n\n\theaders := make(http.Header)\n\tfor _, name := range w.allowedHeaders {\n\t\tif values, exist := req.Header[name]; exist {\n\t\t\theaders[name] = values\n\t\t}\n\t}\n\n\tctx, cancelFunc := context.WithCancel(req.Context())\n\tdefer cancelFunc()\n\n\tmessageType, readBytes, err := wsConn.Read(ctx)\n\tif err != nil {\n\t\tgrpclog.Errorf(\"Unable to read first websocket message: %v %v %v\", messageType, readBytes, err)\n\t\treturn\n\t}\n\n\tif messageType != websocket.MessageBinary {\n\t\tgrpclog.Errorf(\"First websocket message is non-binary\")\n\t\treturn\n\t}\n\n\twsHeaders, err := parseHeaders(string(readBytes))\n\tif err != nil {\n\t\tgrpclog.Errorf(\"Unable to parse websocket headers: %v\", err)\n\t\treturn\n\t}\n\n\trespWriter := newWebSocketResponseWriter(ctx, wsConn)\n\tif w.opts.websocketPingInterval >= time.Second {\n\t\trespWriter.enablePing(w.opts.websocketPingInterval)\n\t}\n\twrappedReader := newWebsocketWrappedReader(ctx, wsConn, respWriter, cancelFunc)\n\n\tfor name, values := range wsHeaders {\n\t\theaders[name] = values\n\t}\n\treq.Body = wrappedReader\n\treq.Method = http.MethodPost\n\treq.Header = headers\n\treq.URL.Path = w.endpointFunc(req)\n\n\tinterceptedRequest, isTextFormat := hackIntoNormalGrpcRequest(req.WithContext(ctx))\n\tif isTextFormat {\n\t\tgrpclog.Errorf(\"web socket text format requests not yet supported\")\n\t}\n\n\tw.handler.ServeHTTP(respWriter, interceptedRequest)\n}", "title": "" }, { "docid": "ff130e476d01b319b4b409ef673684dc", "score": "0.61522895", "text": "func (l *WSListener) Upgrade(w http.ResponseWriter, r *http.Request) {\r\n\tif r.URL.Path != l.path {\r\n\t\tw.WriteHeader(http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tvar err error\r\n\tconn, err := l.upgrader.Upgrade(w, r, nil)\r\n\tif err != nil {\r\n\t\tlog.Errorf(\"failed to upgrade to websocket: %s\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\tvar ed []byte\r\n\tif str := r.Header.Get(\"Sec-WebSocket-Protocol\"); str != \"\" {\r\n\t\tif ed, err = base64.StdEncoding.DecodeString(str); err != nil {\r\n\t\t\tlog.Errorf(\"failed to decode the early payload: %s\", err)\r\n\t\t}\r\n\t}\r\n\r\n\tselect {\r\n\tcase l.ConnChan <- websocketServerConn(conn, ed):\r\n\tdefault:\r\n\t\tlog.Warnln(\"connection queue is full\")\r\n\t\tconn.Close()\r\n\t}\r\n}", "title": "" }, { "docid": "35455712c2baa1a0af219712eb5b3fac", "score": "0.61512446", "text": "func WebsocketProxy(h http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif !websocket.IsWebSocketUpgrade(r) {\n\t\t\th.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\twebsocketProxy(w, r, h)\n\t}\n}", "title": "" }, { "docid": "5ecd3a9f9fbdb2a85bc556f24f7fb384", "score": "0.61509955", "text": "func (h *Hub) HandleWS(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\troom_name := params[\"room\"]\n\n\tc, err := h.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"upgrade:\", err)\n\t\treturn\n\t}\n\tdefer c.Close()\n\troom := h.GetRoom(room_name)\n\tid := room.Join(c)\n\n\t/* Reads from the client's out bound channel and broadcasts it */\n\tgo room.HandleMsg(id)\n\n\t/* Reads from client and if this loop breaks then client disconnected. */\n\troom.clients[id].ReadLoop()\n\troom.Leave(id)\n}", "title": "" }, { "docid": "dcfa66f46b5b2aacc924e9ece2255542", "score": "0.6149646", "text": "func socketHandler(ws *websocket.Conn) {\n\tlog.Print(\"Connected\")\n\t// Connection ends if nothing is received before deadline\n\tdeadline := time.Now().Add(time.Second * 5)\n\tws.SetDeadline(deadline)\n\n\t// File name combines tag and timestamp\n\tuparts := mux.Vars(ws.Request())\n\tstamp := time.Now().UTC().Unix()\n\tfilename := fmt.Sprintf(\"%s-%d.wav\", uparts[\"tag\"], stamp)\n\ttofile := path.Join(OUT, filename)\n\tfile, err := os.Create(tofile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// save stream as it comes in\n\tfor {\n\t\tvar data []byte\n\t\t// todo\n\t\twebsocket.Message.Receive(ws, &data)\n\t\tif len(data) == 0 {\n\t\t\t// client closed connection\n\t\t\tbreak\n\t\t}\n\t\tn, err := file.Write(data)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t\tlog.Printf(\"Saved %d bytes to %s\", n, tofile)\n\t}\n\tfile.Close()\n\t// to keep websocket open you cannot return here\n}", "title": "" } ]
24681308f4ab1888d0efaae98ba2a9dc
EventHandlerGameServerAdd handles events triggered in two occasions: 1. When the controller is first run and has to sync with the cache 2. When a new resource is added via Kubernetes API requests: kubectl, clientgo, http requests, etc.
[ { "docid": "f45646b1cca47ce544dee24d76e3c47d", "score": "0.7705885", "text": "func (c *Controller) EventHandlerGameServerAdd(obj interface{}) error {\n\tkey, addedGameServer, err := IsGameServerKind(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Implement your business logic here.\n\t// I.e: Send a http request to the external world, modify the GameServer status or labels or even\n\t// communicate with your GameServer backend\n\n\t// This is just an example of how to check general changes. Generally, checks will look for differences within the\n\t// resource status\n\tc.logger.Debugf(\"Handled Add GameServer Event: %s - State: %s\", key, addedGameServer.Status.State)\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c28b80dd9bd7d245b1afda611b9249f8", "score": "0.6076364", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"trackingserver-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource TrackingServer\n\terr = c.Watch(&source.Kind{Type: &aiv1alpha1.TrackingServer{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner TrackingServer\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &aiv1alpha1.TrackingServer{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &aiv1alpha1.TrackingServer{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a489b97ff6908dfcfac6ecf87ade7f2", "score": "0.6044777", "text": "func (c *Controller) EventHandlerGameServerUpdate(oldObj, newObj interface{}) error {\n\toldKey, oldGameServer, err := IsGameServerKind(oldObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewKey, newGameServer, err := IsGameServerKind(newObj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Implement your business logic here.\n\t// I.e: Send a http request to the external world, modify the GameServer status or labels or even\n\t// communicate with your GameServer backend\n\n\t// This is just an example of how to check general changes. Generally, checks will look for differences within the\n\t// resource status\n\tif reflect.DeepEqual(oldGameServer, newGameServer) == false {\n\t\tc.logger.Debugf(\"Handled Update GameServer Event: %s (%s) - version %s to %s\", oldKey, newGameServer.Status.State, oldGameServer.ResourceVersion, newGameServer.ResourceVersion)\n\n\t\t// Both properties from the old and the new GameServer can be accessed. Not only Status.\n\t\tif newGameServer.Status.State == agonesv1.GameServerStateReady && newGameServer.DeletionTimestamp.IsZero() {\n\t\t\tc.logger.Infof(\"GameServer Ready %s - %s:%d\", newKey, newGameServer.Status.Address, newGameServer.Status.Ports[0].Port)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tc.logger.Debugf(\"Handled Update GameServer Event: %s - nothing changed\", newKey)\n\n\treturn nil\n}", "title": "" }, { "docid": "8207712b03d48a8be994e16a75d3af15", "score": "0.5935784", "text": "func (*fakeInformer) AddEventHandler(cache.ResourceEventHandler) {}", "title": "" }, { "docid": "0d94fcf982b6af2e49b69591a4d7d541", "score": "0.57845545", "text": "func (s *CNIServer) interceptAdd(cniConfig *CNIConfig) (*cnipb.CniCmdResponse, error) {\n\tklog.Infof(\"CNI Chaining: add for container %s\", cniConfig.ContainerId)\n\tprevResult, response := s.parsePrevResultFromRequest(cniConfig.NetworkConfig)\n\tif response != nil {\n\t\tklog.Infof(\"Failed to parse prev result for container %s\", cniConfig.ContainerId)\n\t\treturn response, nil\n\t}\n\tpodName := string(cniConfig.K8S_POD_NAME)\n\tpodNamespace := string(cniConfig.K8S_POD_NAMESPACE)\n\tif err := s.podConfigurator.connectInterceptedInterface(\n\t\tpodName,\n\t\tpodNamespace,\n\t\tcniConfig.ContainerId,\n\t\ts.hostNetNsPath(cniConfig.Netns),\n\t\tcniConfig.Ifname,\n\t\tprevResult.IPs,\n\t\ts.containerAccess); err != nil {\n\t\treturn &cnipb.CniCmdResponse{CniResult: []byte(\"\")}, fmt.Errorf(\"failed to connect container %s to ovs: %w\", cniConfig.ContainerId, err)\n\t}\n\n\t// we return prevResult, which should be exactly what we received from\n\t// the runtime, potentially converted to the current CNI version used by\n\t// Antrea.\n\treturn resultToResponse(prevResult), nil\n}", "title": "" }, { "docid": "8888a4de4e6c3a5ec89a6bef5d680d20", "score": "0.5692932", "text": "func (c *StaticPodController) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(workQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t}\n}", "title": "" }, { "docid": "2e7d7764ea49da747d44f357d257f25b", "score": "0.56676114", "text": "func (c *Controller) onAdd(obj interface{}) {\n\tcm, ok := obj.(*v1.ConfigMap)\n\tif !ok {\n\t\tlog.WithFields(log.Fields{}).Error(\"Could not convert runtime object to configmap..\")\n\t}\n\n\tif _, ok := cm.Labels[\"crunchy-scheduler\"]; !ok {\n\t\treturn\n\t}\n\n\tif err := c.Scheduler.AddSchedule(cm); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t}).Error(\"Failed to add schedules\")\n\t}\n}", "title": "" }, { "docid": "247a1ff556d319da3d23db8fcc341255", "score": "0.5655034", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"knativeserving-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KnativeServing, only in the expected namespace.\n\trequiredNs := os.Getenv(requiredNsEnvName)\n\terr = c.Watch(&source.Kind{Type: &operatorv1beta1.KnativeServing{}}, &handler.EnqueueRequestForObject{}, predicate.NewPredicateFuncs(func(obj client.Object) bool {\n\t\tif requiredNs == \"\" {\n\t\t\treturn true\n\t\t}\n\t\treturn obj.GetNamespace() == requiredNs\n\t}))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to owned ConfigMaps\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n\t\tOwnerType: &operatorv1beta1.KnativeServing{},\n\t\tIsController: true,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgvkToResource := map[schema.GroupVersionKind]client.Object{\n\t\troutev1.GroupVersion.WithKind(\"Route\"): &routev1.Route{},\n\t}\n\n\t// If console is installed add the ccd resource watcher, otherwise remove it avoid manager exiting due to kind not found.\n\tif consoleutil.IsConsoleInstalled() {\n\t\tgvkToResource[consolev1.GroupVersion.WithKind(\"ConsoleCLIDownload\")] = &consolev1.ConsoleCLIDownload{}\n\t}\n\n\tif !consoleutil.IsConsoleInstalled() {\n\t\tenqueueRequests := handler.MapFunc(func(obj client.Object) []reconcile.Request {\n\t\t\tif obj.GetName() == consoleutil.ConsoleClusterOperatorName {\n\t\t\t\tlog.Info(\"Serving, processing clusteroperator request\", \"name\", obj.GetName())\n\t\t\t\tco := &configv1.ClusterOperator{}\n\t\t\t\tif err = r.(*ReconcileKnativeServing).client.Get(context.Background(), client.ObjectKey{Namespace: \"\", Name: consoleutil.ConsoleClusterOperatorName}, co); err != nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif !consoleutil.IsClusterOperatorAvailable(co.Status) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tconsoleutil.SetConsoleToInstalledStatus()\n\t\t\t\t_ = health.InstallHealthDashboard(r.(*ReconcileKnativeServing).client)\n\t\t\t\tlist := &operatorv1beta1.KnativeServingList{}\n\t\t\t\t// At this point we know that console is available and try to find if there is a Serving instance installed\n\t\t\t\t// and trigger a reconciliation. If there is no instance do nothing as from now on reconciliation loop will do what is needed\n\t\t\t\t// when a new instance is created. In case an instance is deleted we do nothing. We read from cache so the call is cheap.\n\t\t\t\tif err = r.(*ReconcileKnativeServing).client.List(context.Background(), list); err != nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif len(list.Items) > 0 {\n\t\t\t\t\treturn []reconcile.Request{{\n\t\t\t\t\t\tNamespacedName: types.NamespacedName{Namespace: list.Items[0].Namespace, Name: list.Items[0].Name},\n\t\t\t\t\t}}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err = c.Watch(&source.Kind{Type: &configv1.ClusterOperator{}}, handler.EnqueueRequestsFromMapFunc(enqueueRequests), common.SkipPredicate{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, t := range gvkToResource {\n\t\terr = c.Watch(&source.Kind{Type: t}, common.EnqueueRequestByOwnerAnnotations(socommon.ServingOwnerName, socommon.ServingOwnerNamespace))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tr.(*ReconcileKnativeServing).c = &c\n\treturn nil\n}", "title": "" }, { "docid": "929e082d9695b2f78f44a63f362d4c07", "score": "0.56415963", "text": "func (c *PodController) onAdd(obj interface{}) {\n\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\tif err != nil {\n\t\tlog.Printf(\"onAdd: Unable to get key for #%v\", obj, err)\n\t}\n\tlog.Printf(\"onAdd: %v\", key)\n}", "title": "" }, { "docid": "1ead6bac42b7547dd8297de86475d403", "score": "0.5596107", "text": "func (c *Controller) AddConfigMapEventHandler() {\n\n\tc.Informer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: c.onAdd,\n\t\tDeleteFunc: c.onDelete,\n\t})\n\n\tlog.Debugf(\"ConfigMap Controller: added event handler to informer\")\n}", "title": "" }, { "docid": "16438b96de420ff3c00f98d658f3ff83", "score": "0.5561428", "text": "func (c *PgclusterController) onAdd(obj interface{}) {\n\tcluster := obj.(*crv1.Pgcluster)\n\tlog.Debugf(\"[PgclusterController] ns %s onAdd %s\", cluster.ObjectMeta.Namespace, cluster.ObjectMeta.SelfLink)\n\n\t//handle the case when the operator restarts and don't\n\t//process already processed pgclusters\n\tif cluster.Status.State == crv1.PgclusterStateProcessed {\n\t\tlog.Debug(\"pgcluster \" + cluster.ObjectMeta.Name + \" already processed\")\n\t\treturn\n\t}\n\n\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\tif err == nil {\n\t\tlog.Debugf(\"cluster putting key in queue %s\", key)\n\t\tc.Queue.Add(key)\n\t}\n\n}", "title": "" }, { "docid": "a0276b55b614c441ca36ae4d12e7d20c", "score": "0.55374604", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"trustedcabundle-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to the additional trust bundle configmap in \"openshift-logging\".\n\tpred := predicate.Funcs{\n\t\tUpdateFunc: func(e event.UpdateEvent) bool { return handleConfigMap(e.MetaNew) },\n\t\tDeleteFunc: func(e event.DeleteEvent) bool { return false },\n\t\tCreateFunc: func(e event.CreateEvent) bool { return handleConfigMap(e.Meta) },\n\t\tGenericFunc: func(e event.GenericEvent) bool { return false },\n\t}\n\tif err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForObject{}, pred); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1761001a9e41e99deef7cf64bc2a1cf4", "score": "0.5486795", "text": "func (s *server) AddHandler(name string, f func(c *CacheRequest)) error {\n\t_, ok := s.cmds[name]\n\tif ok {\n\t\treturn fmt.Errorf(\"Command '%v' is already registered\", name)\n\t}\n\n\ts.cmds[name] = f\n\treturn nil\n}", "title": "" }, { "docid": "31417ebd64637793c523c108a0f6650f", "score": "0.5486771", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to InferenceService\n\tif err = c.Watch(&source.Kind{Type: &kfserving.InferenceService{}}, &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\tkfservingController := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kfserving.InferenceService{},\n\t}\n\n\t// Watch for changes to Knative Service\n\tif err = c.Watch(&source.Kind{Type: &knservingv1.Service{}}, kfservingController); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Virtual Service\n\tif err = c.Watch(&source.Kind{Type: &v1alpha3.VirtualService{}}, kfservingController); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39ff6c75c954946472e065621761833b", "score": "0.5475972", "text": "func (c *Controller) onAdd(obj interface{}) {\n\n\tnewNs := obj.(*v1.Namespace)\n\n\tlog.Debugf(\"[namespace Controller] OnAdd ns=%s\", newNs.ObjectMeta.SelfLink)\n\tlabels := newNs.GetObjectMeta().GetLabels()\n\tif labels[config.LABEL_VENDOR] != config.LABEL_CRUNCHY || labels[config.LABEL_PGO_INSTALLATION_NAME] != operator.InstallationName {\n\t\tlog.Debugf(\"namespace Controller: onAdd skipping namespace that is not crunchydata or not belonging to this Operator installation %s\", newNs.ObjectMeta.SelfLink)\n\t\treturn\n\t}\n\n\tlog.Debugf(\"namespace Controller: onAdd crunchy namespace %s created\", newNs.ObjectMeta.SelfLink)\n\tc.ControllerManager.AddAndRunControllerGroup(newNs.Name)\n}", "title": "" }, { "docid": "2ffcd756bfe2fd8040b34f83c711c9a1", "score": "0.5462077", "text": "func add(mgr manager.Manager, sharedInfo *sharedinfo.SharedInfo, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"configmap-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treconcileConfigMap, ok := r.(*ReconcileConfigMap)\n\tif !ok {\n\t\tlog.Info(\"Reconciler Interface to ReconcileConfigMap failed\")\n\t\treturn nil\n\t}\n\n\twatchedNamespace := reconcileConfigMap.status.OperatorNamespace\n\tif watchedNamespace == \"\" {\n\t\t// For NcpInstall, ConfigMap and Secret, we only want to watch a single namespace\n\t\t// Pass watchedNamespace into controller Watch func to filer out unexpected namespace changes.\n\t\twatchedNamespace = operatortypes.OperatorNamespace\n\t}\n\n\t// Watch for changes to primary resource NcpInstall CRD\n\t// The NcpInstall CRD changes may appear in mutiple namespaces, only changes from watched namespace of operator will be queued for handler\n\terr = c.Watch(&source.Kind{Type: &operatorv1.NcpInstall{}}, &handler.EnqueueRequestForObject{}, byNameSpaceFilter(watchedNamespace))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ConfigMap\n\t// The configmap resource changes may appear in mutiple namespaces, only changes from watched namespace of operator will be queued for handler\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForObject{}, byNameSpaceFilter(watchedNamespace))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif sharedInfo.AdaptorName == \"openshift4\" {\n\t\t// Watch for changes to primary resource Network CRD\n\t\terr = c.Watch(&source.Kind{Type: &configv1.Network{}}, &handler.EnqueueRequestForObject{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Info(\"Skipping watching Network CRD for non-Openshift4\")\n\t}\n\n\t// Watch for changes to primary resource Secret\n\t// The Secret resouce changes may appear in mutiple namespaces, only changes from watched namespace of operator will be queued for handler\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForObject{}, byNameSpaceFilter(watchedNamespace))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ClusterRole\n\terr = c.Watch(&source.Kind{Type: &rbacv1.ClusterRole{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fa4697c0831965633334af664fbfbb42", "score": "0.5443165", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tvar c controller.Controller\n\tvar err error\n\tif c, err = controller.New(controllerName, mgr, controller.Options{Reconciler: r}); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ServiceMeshControlPlane\n\tif err = c.Watch(&source.Kind{Type: &v1.ServiceMeshControlPlane{}}, &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\t// watch created resources for use in synchronizing ready status\n\tif err = c.Watch(&source.Kind{Type: &appsv1.Deployment{}},\n\t\t&handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &v1.ServiceMeshControlPlane{},\n\t\t},\n\t\townedResourcePredicates); err != nil {\n\t\treturn err\n\t}\n\tif err = c.Watch(&source.Kind{Type: &appsv1.StatefulSet{}},\n\t\t&handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &v1.ServiceMeshControlPlane{},\n\t\t},\n\t\townedResourcePredicates); err != nil {\n\t\treturn err\n\t}\n\tif err = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}},\n\t\t&handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &v1.ServiceMeshControlPlane{},\n\t\t},\n\t\townedResourcePredicates); err != nil {\n\t\treturn err\n\t}\n\n\t// add watch for cni daemon set\n\toperatorNamespace := common.GetOperatorNamespace()\n\tif err = c.Watch(&source.Kind{Type: &appsv1.DaemonSet{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\tToRequests: handler.ToRequestsFunc(func(obj handler.MapObject) []reconcile.Request {\n\t\t\t\tif obj.Meta.GetNamespace() != operatorNamespace {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tsmcpList := &v1.ServiceMeshControlPlaneList{}\n\t\t\t\tif err := mgr.GetClient().List(context.TODO(), nil, smcpList); err != nil {\n\t\t\t\t\tlog.Error(err, \"error listing ServiceMeshControlPlane objects in CNI DaemonSet watcher\")\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\trequests := make([]reconcile.Request, 0, len(smcpList.Items))\n\t\t\t\tfor _, smcp := range smcpList.Items {\n\t\t\t\t\trequests = append(requests, reconcile.Request{\n\t\t\t\t\t\tNamespacedName: types.NamespacedName{\n\t\t\t\t\t\t\tName: smcp.Name,\n\t\t\t\t\t\t\tNamespace: smcp.Namespace,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn requests\n\t\t\t}),\n\t\t},\n\t\townedResourcePredicates); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9e97e43cce69c9c9dad9bc62c293a2d4", "score": "0.5439941", "text": "func (c *Controller) EventHandlerGameServerDelete(obj interface{}) error {\n\tkey, deletedGameServer, err := IsGameServerKind(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Implement your business logic here.\n\t// I.e: Send a http request to the external world, modify the GameServer status or labels or even\n\t// communicate with your GameServer backend\n\n\t// This is just an example of how to check general changes. Generally, checks will look for differences within the\n\t// resource status\n\tc.logger.Debugf(\"Handled Delete GameServer Event: %s - %s\", key, deletedGameServer.DeletionTimestamp.String())\n\n\treturn nil\n}", "title": "" }, { "docid": "6638af53ec5d00eacba3a634e1638ae6", "score": "0.54368407", "text": "func Add(mgr manager.Manager) error {\n\treconciler := &Reconciler{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t}\n\tcnt, err := controller.New(\n\t\tName,\n\t\tmgr,\n\t\tcontroller.Options{\n\t\t\tReconciler: reconciler,\n\t\t})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\t// Primary CR.\n\terr = cnt.Watch(\n\t\t&source.Kind{Type: &api.NetworkMap{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\t&MapPredicate{})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\t// References.\n\terr = cnt.Watch(\n\t\t&source.Kind{\n\t\t\tType: &api.Provider{},\n\t\t},\n\t\tlibref.Handler(),\n\t\t&ProviderPredicate{})\n\tif err != nil {\n\t\tlog.Trace(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "261bbd948015bd615245b1f0f2fa0049", "score": "0.53757024", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"webui-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Webui.\n\tif err = c.Watch(&source.Kind{Type: &v1alpha1.Webui{}}, &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\tserviceMap := map[string]string{\"contrail_manager\": \"webui\"}\n\tsrcPod := &source.Kind{Type: &corev1.Pod{}}\n\tpodHandler := resourceHandler(mgr.GetClient())\n\tpredInitStatus := utils.PodInitStatusChange(serviceMap)\n\tpredPodIPChange := utils.PodIPChange(serviceMap)\n\tpredInitRunning := utils.PodInitRunning(serviceMap)\n\n\tif err = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.Webui{},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tif err = c.Watch(srcPod, podHandler, predPodIPChange); err != nil {\n\t\treturn err\n\t}\n\tif err = c.Watch(srcPod, podHandler, predInitStatus); err != nil {\n\t\treturn err\n\t}\n\tif err = c.Watch(srcPod, podHandler, predInitRunning); err != nil {\n\t\treturn err\n\t}\n\n\tsrcCassandra := &source.Kind{Type: &v1alpha1.Cassandra{}}\n\tcassandraHandler := resourceHandler(mgr.GetClient())\n\tpredCassandraSizeChange := utils.CassandraActiveChange()\n\tif err = c.Watch(srcCassandra, cassandraHandler, predCassandraSizeChange); err != nil {\n\t\treturn err\n\t}\n\n\tsrcConfig := &source.Kind{Type: &v1alpha1.Config{}}\n\tconfigHandler := resourceHandler(mgr.GetClient())\n\tpredConfigSizeChange := utils.ConfigActiveChange()\n\tif err = c.Watch(srcConfig, configHandler, predConfigSizeChange); err != nil {\n\t\treturn err\n\t}\n\n\tsrcSTS := &source.Kind{Type: &appsv1.StatefulSet{}}\n\tstsHandler := &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.Webui{},\n\t}\n\tstsPred := utils.STSStatusChange(utils.WebuiGroupKind())\n\tif err = c.Watch(srcSTS, stsHandler, stsPred); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f8687a0b6400df43fadcb25f7ebd54d0", "score": "0.53656965", "text": "func AddServerHandlers(h *config.HealthConfig, servers []*cadent.Server) {\n\n\tstat_func := func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Cache-Control\", \"private, max-age=0, no-cache\")\n\t\tjsonp := r.URL.Query().Get(\"jsonp\")\n\n\t\tstats_map := make(map[string]*stats.HashServerStats)\n\t\tfor _, serv := range servers {\n\t\t\t// note the server itself populates this every 5 seconds\n\t\t\tstats_map[serv.Name] = serv.GetStats()\n\t\t}\n\t\tresbytes, _ := json.Marshal(stats_map)\n\t\tif len(jsonp) > 0 {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/javascript\")\n\t\t\tfmt.Fprintf(w, fmt.Sprintf(\"%s(\", jsonp))\n\t\t} else {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\t}\n\t\tfmt.Fprintf(w, string(resbytes))\n\t\tif len(jsonp) > 0 {\n\t\t\tfmt.Fprintf(w, \")\")\n\t\t}\n\t}\n\n\thashcheck := func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Cache-Control\", \"private, max-age=0, no-cache\")\n\t\th_key := r.URL.Query().Get(\"key\")\n\t\tif len(h_key) == 0 {\n\t\t\thttp.Error(w, \"Please provide a 'key' to process\", 404)\n\t\t\treturn\n\t\t}\n\t\thasher_map := make(map[string]cadent.ServerHashCheck)\n\n\t\tfor _, serv := range servers {\n\t\t\t// note the server itself populates this ever 5 seconds\n\t\t\thasher_map[serv.Name] = serv.HasherCheck([]byte(h_key))\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tresbytes, _ := json.Marshal(hasher_map)\n\t\tfmt.Fprintf(w, string(resbytes))\n\t}\n\n\th.GetMux().HandleFunc(\"/stats\", stat_func)\n\th.GetMux().HandleFunc(\"/hashcheck\", hashcheck)\n}", "title": "" }, { "docid": "ab31d55d6b3c2684be913a2ba3aee94c", "score": "0.535433", "text": "func (h HandlerFuncs) OnAdd(obj ClusterObject) {\n\tif h.AddFunc != nil {\n\t\th.AddFunc(obj)\n\t}\n}", "title": "" }, { "docid": "f4afc8b8d16c27ad0f668f6174d2754a", "score": "0.5323061", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// set the watchNamespace so we know where to create the OCSInitialization resource\n\tns, err := k8sutil.GetWatchNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\twatchNamespace = ns\n\n\t// Create a new controller\n\tc, err := controller.New(\"storageclusterinitialization-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource StorageClusterInitialization\n\treturn c.Watch(&source.Kind{Type: &ocsv1alpha1.StorageClusterInitialization{}}, &handler.EnqueueRequestForObject{})\n}", "title": "" }, { "docid": "a5654cde4726ab0f11cdcfbd3a16de17", "score": "0.5321645", "text": "func (dc *DemoController) HandleAdd(etype controllers.EventType, obj interface{}) {\n\tpod := obj.(*v1.Pod)\n\tdc.queue.Add(pod)\n\tif len(pod.Status.ContainerStatuses) > 0 {\n\t\tlog.Printf(\"add %v\", pod.Status.ContainerStatuses[0].Ready)\n\t} else {\n\t\tlog.Printf(\"add --\")\n\t}\n\tlog.Printf(\"handle pod add event, %s %s %v\", pod.Name, pod.Namespace, pod.DeletionTimestamp)\n\treturn\n}", "title": "" }, { "docid": "ff467e2dbbc4455d7612c791b94396a0", "score": "0.5311537", "text": "func (c *CaddyController) onIngressAdded(obj *v1.Ingress) {\n\tc.syncQueue.Add(IngressAddedAction{\n\t\tresource: obj,\n\t})\n}", "title": "" }, { "docid": "effb94434431e44a3a749e665d279831", "score": "0.5290677", "text": "func Add(mgr manager.Manager) error {\n\t// Create a webhook server.\n\t//hookServer := mgr.GetWebhookServer()\n\thookServer := &webhook.Server{\n\t\tHost: webhookHost,\n\t\tPort: webhookPort,\n\t\tCertDir: \"/tmp/k8s-webhook-server/serving-certs\",\n\t}\n\tif err := mgr.Add(hookServer); err != nil {\n\t\treturn err\n\t}\n\n\tvalidator := &ValidateNamespace{\n\t\tclient: mgr.GetClient(),\n\n\t\tcodecs: serializer.NewCodecFactory(mgr.GetScheme()),\n\t}\n\n\tvalidatingHook := &webhook.Admission{\n\t\tHandler: admission.HandlerFunc(func(ctx context.Context, req webhook.AdmissionRequest) webhook.AdmissionResponse {\n\t\t\treturn validator.Handle(ctx, req)\n\t\t}),\n\t}\n\n\t// Register the webhooks in the server.\n\thookServer.Register(webhookPath, validatingHook)\n\n\treturn nil\n}", "title": "" }, { "docid": "0b4ab804185ea906de1c6bdd450026cd", "score": "0.52903366", "text": "func (c *ServiceController) AddController(router *mux.Router, s *Server) {\n\tc.Srv = s\n\trouter.Methods(\"POST\").Path(\"/service/add\").Name(\"AddService\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleAddService)))\n\trouter.Methods(\"DELETE\").Path(\"/service/remove/{id}/{name}\").Name(\"RemoveService\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleRemoveService)))\n\trouter.Methods(\"DELETE\").Path(\"/service/remove/{id}\").Name(\"RemoveAll\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleRemoveAll)))\n\trouter.Methods(\"GET\").Path(\"/service/get\").Name(\"GetLocalServices\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleGetLocal)))\n\trouter.Methods(\"GET\").Path(\"/service/search\").Name(\"Search\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleSearch)))\n\n}", "title": "" }, { "docid": "67b834c0e470639e3ff1c7eff1aabbc2", "score": "0.5267283", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"logcollector-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create logcollector-controller: %v\", err)\n\t}\n\n\t// Watch for changes to primary resource LogCollector\n\terr = c.Watch(&source.Kind{Type: &operatorv1.LogCollector{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"logcollector-controller failed to watch primary resource: %v\", err)\n\t}\n\n\terr = utils.AddAPIServerWatch(c)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"logcollector-controller failed to watch APIServer resource: %v\", err)\n\t}\n\n\tif err = imageset.AddImageSetWatch(c); err != nil {\n\t\treturn fmt.Errorf(\"logcollector-controller failed to watch ImageSet: %w\", err)\n\t}\n\n\tfor _, secretName := range []string{\n\t\trender.ElasticsearchLogCollectorUserSecret, render.ElasticsearchEksLogForwarderUserSecret,\n\t\trender.ElasticsearchPublicCertSecret, render.S3FluentdSecretName, render.EksLogForwarderSecret,\n\t\trender.SplunkFluentdTokenSecretName, render.SplunkFluentdCertificateSecretName} {\n\t\tif err = utils.AddSecretsWatch(c, secretName, render.OperatorNamespace()); err != nil {\n\t\t\treturn fmt.Errorf(\"log-collector-controller failed to watch the Secret resource(%s): %v\", secretName, err)\n\t\t}\n\t}\n\n\tfor _, configMapName := range []string{render.FluentdFilterConfigMapName, render.ElasticsearchConfigMapName} {\n\t\tif err = utils.AddConfigMapWatch(c, configMapName, render.OperatorNamespace()); err != nil {\n\t\t\treturn fmt.Errorf(\"logcollector-controller failed to watch ConfigMap %s: %v\", configMapName, err)\n\t\t}\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"logcollector-controller failed to watch the node resource: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c000af733cbaf07753f6c9617f99c10", "score": "0.5262853", "text": "func (c *ConfigObserver) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(workQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t}\n}", "title": "" }, { "docid": "38599a896d72cadb7cb362d830a1cc1d", "score": "0.5257266", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"envoyplugin-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource EnvoyPlugin\n\terr = c.Watch(&source.Kind{Type: &wrapper.EnvoyPlugin{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "370b4822dda908ce5f153bc6693ee0b2", "score": "0.5253121", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tc, err := controller.New(\"service-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3031c032aa9b2fbc6274b4f17a173aa8", "score": "0.525155", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"snatlocalinfo-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource SnatLocalInfo\n\terr = c.Watch(&source.Kind{Type: &aciv1.SnatLocalInfo{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watching for Pod changes\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandlePodsForPodsMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watching for Snat policy changes\n\terr = c.Watch(&source.Kind{Type: &aciv1.SnatPolicy{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandleSnatPolicies(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watching for Deployment changes\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandleDeploymentForDeploymentMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watching for Deployment changes\n\n\terr = c.Watch(&source.Kind{Type: &openv1.DeploymentConfig{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandleDeploymentConfigForDeploymentMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\t//return err\n\t}\n\n\t// Watching for Deployment changes\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandleServicesForServiceMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watching for Namespace changes\n\terr = c.Watch(&source.Kind{Type: &corev1.Namespace{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{ToRequests: HandleNameSpaceForNameSpaceMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a2806f2a8e9555eceef6016269852db", "score": "0.52500516", "text": "func (sc *virtualServiceSource) AddEventHandler(ctx context.Context, handler func()) {\n\tlog.Debug(\"Adding event handler for Istio VirtualService\")\n\n\tsc.virtualserviceInformer.Informer().AddEventHandler(eventHandlerFunc(handler))\n}", "title": "" }, { "docid": "232737fc10cf7a4dbaec3f8e1b8834bd", "score": "0.52372783", "text": "func (m *Metric) HookBeforeServe(s *yell.Server) {\n\tfor fm, info := range s.GetServiceInfo() {\n\t\tfor _, method := range info.Methods {\n\t\t\tname := m.nameFn(fm+\"_\"+strings.Title(method.Name), m.prefix)\n\t\t\tm.hs[name] = metrics.NewRegisteredHistogram(m.name, nil, metrics.NewExpDecaySample(1028, 0.015)) //初始化接口性能数据\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fb914b63ce84adc12349d1caf1026a17", "score": "0.5230298", "text": "func (c *InstallerController) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(installerControllerWorkQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(installerControllerWorkQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(installerControllerWorkQueueKey) },\n\t}\n}", "title": "" }, { "docid": "f23d95a04a68891fc7ee342f760d16d2", "score": "0.5228959", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\tc, err := controller.New(\"virtualservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// watch for virtualservices events\n\treturn c.Watch(&source.Kind{Type: &virtualservice.VirtualService{}}, &handler.EnqueueRequestForObject{})\n\n}", "title": "" }, { "docid": "758b19253cfda39640ddd1877f22d0fa", "score": "0.5224592", "text": "func (ps *PodSyncer) handleAddEvent(obj interface{}) {\n\tpod := obj.(*corev1.Pod)\n\tps.addKindAndVersion(pod)\n\n\tklog.V(4).Infof(\"add pod: %s\", pod.Name)\n\n\tgo syncToNode(watch.Added, util.ResourcePod, pod)\n\n\tsyncToStorage(ps.ctx, watch.Added, util.ResourcePod, pod)\n}", "title": "" }, { "docid": "5c4ab0e7814ed73c050711ba16c9ad77", "score": "0.52201897", "text": "func (c *CaddyController) onResourceAdded(obj interface{}) {\n\tc.syncQueue.Add(ResourceAddedAction{\n\t\tresource: obj,\n\t})\n}", "title": "" }, { "docid": "104d36de4e7e2a00bbed6ea13ba01ca8", "score": "0.5217668", "text": "func addController(mgr manager.Manager, r reconcile.Reconciler, name string, cType client.Object) error {\n\t// Create a new controller\n\tc, err := controller.New(name, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Resource\n\terr = c.Watch(source.Kind(mgr.GetCache(), cType), &handler.EnqueueRequestForObject{})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03d93aabbdf563318c8d450c862de9d4", "score": "0.5211129", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"oidcclientwatcher-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OIDCClientWatcher\n\terr = c.Watch(&source.Kind{Type: &operatorv1alpha1.OIDCClientWatcher{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner OIDCClientWatcher\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &operatorv1alpha1.OIDCClientWatcher{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "790ffcb558d2147a242172a403fdf16e", "score": "0.51803964", "text": "func (vs *ViewServer) AddServer(s string) {\n\tvs.actions[s] = time.Now()\n\tif vs.rfc {\n\t\tif vs.view.Primary == \"\" {\n\t\t\tvs.view.Primary = s\n\t\t\tvs.NewView()\n\t\t}\n\t\tif vs.view.Primary != s && vs.view.Backup == \"\" {\n\t\t\tvs.view.Backup = s\n\t\t\tvs.NewView()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cbcfefa48edd959d36e88c5e9f4819d0", "score": "0.517628", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nginxsdk-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NginxSDK\n\terr = c.Watch(&source.Kind{Type: &sdkoperatorv1alpha1.NginxSDK{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NginxSDK\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sdkoperatorv1alpha1.NginxSDK{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Arvind added custom\n\t//Watch for changes in the service\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sdkoperatorv1alpha1.NginxSDK{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Arvind added custom\n\t//Watch for changes in the configMap\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sdkoperatorv1alpha1.NginxSDK{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2eb06c9fd3a518ebb5d2830cd94ef1f3", "score": "0.5162671", "text": "func (m *Manager) OnAdd(obj interface{}) {\n\tswitch obj := obj.(type) {\n\tcase *v1beta1.Ingress:\n\t\tif changed := m.upsertIngress(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\tcase *v1.Secret:\n\t\tif changed := m.upsertSecret(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a10cef2cd0d50116601b43c5f4d4050e", "score": "0.5152054", "text": "func (d *VirtualMachineController) addLauncherClient(client cmdclient.LauncherClient, sockFile string) error {\n\t// maps require locks for concurrent access\n\td.launcherClientLock.Lock()\n\tdefer d.launcherClientLock.Unlock()\n\n\td.launcherClients[sockFile] = client\n\n\treturn nil\n}", "title": "" }, { "docid": "90633ab38df5d4e851ebc6faa1179e56", "score": "0.51408887", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"auth-controller\", mgr, controller.Options{MaxConcurrentReconciles: 4, Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to configmap\n\terr = c.Watch(&source.Kind{Type: &v1.ConfigMap{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ecddef7168e842567076db6485e68249", "score": "0.5135391", "text": "func (service *ProteusAPI) AddServer(request *Long) (*Long, error) {\n\tresponse := new(Long)\n\terr := service.client.Call(\"\", request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "506b3fd09946a258b6c54c332c806b82", "score": "0.5133337", "text": "func (cc *clusterClientCache) addToClientMap(obj interface{}) {\n\tcc.rwlock.Lock()\n\tdefer cc.rwlock.Unlock()\n\tcluster, ok := obj.(*v1beta1.Cluster)\n\tif !ok {\n\t\treturn\n\t}\n\tpred := getClusterConditionPredicate()\n\t// check status\n\t// skip if not ready\n\tif pred(*cluster) {\n\t\tcc.startClusterLW(cluster, cluster.Name)\n\t}\n}", "title": "" }, { "docid": "cf22920a75881604b012c3e64a498e48", "score": "0.512687", "text": "func (c *PoolController) addVMHandler(obj interface{}) {\n\tvm := obj.(*virtv1.VirtualMachine)\n\n\tif vm.DeletionTimestamp != nil {\n\t\t// on a restart of the controller manager, it's possible a new vm shows up in a state that\n\t\t// is already pending deletion. Prevent the vm from being a creation observation.\n\t\tc.deleteVMHandler(vm)\n\t\treturn\n\t}\n\n\t// If it has a ControllerRef, that's all that matters.\n\tif controllerRef := metav1.GetControllerOf(vm); controllerRef != nil {\n\t\tpool := c.resolveControllerRef(vm.Namespace, controllerRef)\n\t\tif pool == nil {\n\t\t\treturn\n\t\t}\n\t\tpoolKey, err := controller.KeyFunc(pool)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tlog.Log.V(4).Object(vm).Infof(\"VirtualMachine created\")\n\t\tc.expectations.CreationObserved(poolKey)\n\t\tc.enqueuePool(pool)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a84fd3b03d39aa12d709e88562364e31", "score": "0.51215947", "text": "func (l *Client) lifecycleEventHandler(event api.Event) {\n\t// we should always only get lifecycle events due to the handler setup\n\t// but just in case ...\n\tif event.Type != \"lifecycle\" {\n\t\treturn\n\t}\n\n\teventLifecycle := api.EventLifecycle{}\n\terr := json.Unmarshal(event.Metadata, &eventLifecycle)\n\tif err != nil {\n\t\tlogger.Errorf(\"unable to unmarshal to json lifecycle event: %v\", event.Metadata)\n\t\treturn\n\t}\n\n\t// we are only interested in container started events\n\t// TODO: Unregister IP address when container is stopping if network-plugin is CNI\n\tif eventLifecycle.Action != \"container-started\" {\n\t\treturn\n\t}\n\n\tcontainerID := strings.TrimPrefix(eventLifecycle.Source, \"/1.0/containers/\")\n\tc, err := l.GetContainer(containerID)\n\tif err != nil {\n\t\tif IsContainerNotFound(err) {\n\t\t\t// The started container is not a cri container, we also get the error not found\n\t\t\t// So this container can be ignored\n\t\t\treturn\n\t\t}\n\t\tlogger.Errorf(\"lifecycle: ContainerID %v trying to get container: %v\", containerID, err)\n\t\treturn\n\t}\n\n\ts, err := c.Sandbox()\n\tif err != nil {\n\t\tlogger.Errorf(\"lifecycle: ContainerID %v trying to get sandbox: %v\", containerID, err)\n\t\treturn\n\t}\n\tst, err := c.State()\n\tif err != nil {\n\t\tlogger.Errorf(\"lifecycle: ContainerID %v trying to get state: %v\", containerID, err)\n\t\treturn\n\t}\n\n\tswitch s.NetworkConfig.Mode {\n\tcase NetworkCNI:\n\t\t// attach interface using CNI\n\t\tresult, err := network.AttachCNIInterface(s.Metadata.Namespace, s.Metadata.Name, c.ID, st.Pid)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"unable to attach CNI interface to container (%v): %v\", c.ID, err)\n\t\t}\n\t\ts.NetworkConfig.ModeData[\"result\"] = string(result)\n\t\terr = s.apply()\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"unable to save sandbox after attaching CNI interface to container (%v): %v\", c.ID, err)\n\t\t}\n\tdefault:\n\t\t// nothing to do, all other modes need no help after starting\n\t}\n}", "title": "" }, { "docid": "336130e912674ebd085a6402d1cc7750", "score": "0.51091695", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"netservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NetService\n\terr = c.Watch(&source.Kind{Type: &svcctlv1alpha1.NetService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource services and requeue the owner NetService\n\terr = c.Watch(&source.Kind{Type: &corev1.Service{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &svcctlv1alpha1.NetService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource services and requeue the owner NetService\n\terr = c.Watch(&source.Kind{Type: &corev1.Endpoints{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &svcctlv1alpha1.NetService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c4d00cd7e4f2c129c923640e86d63246", "score": "0.50997514", "text": "func AddServer(\n\tconfiguration *Configuration,\n\tgetCurrentConfiguration func() (*Configuration, error),\n\tpublicServer *http.ServeMux,\n\tprivateServer *http.ServeMux) error {\n\n\t// Validate that the configuration was given and is decent\n\tif err := ValidateConfiguration(configuration); err != nil {\n\t\tlog.Error(\"AddServer: Unable to use the configuration for server.\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tif publicServer == nil {\n\t\tlog.Error(\"AddServer: parameter publicServer was given null\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tif privateServer == nil {\n\t\tlog.Error(\"AddServer : parameter privateServer was given null\")\n\t\treturn common.ErrBadConfiguration\n\t}\n\n\tlog.Info(\"Creating SSO Engine.\")\n\n\t// Create an Engine\n\tengine, err := newSsoEngine(configuration)\n\tif err != nil {\n\t\tlog.Error(\"Unable to load the SSO engine.\")\n\t\treturn err\n\t}\n\n\t// Build the function that will reload needed details from the configuration\n\treloadConfiguration := func(currentEngine ssoEngine) (ssoEngine, func(request *http.Request) error, error) {\n\n\t\t// Load the new configuration\n\t\tconfiguration, err := getCurrentConfiguration()\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to load the new SSO engine configuration.\")\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// Create a new Engine\n\t\tnewEngine, err := newSsoEngineKeepingRefreshToken(configuration, currentEngine)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Unable to load the SSO engine.\")\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\treturn newEngine, buildEndpointAuthenticationFunction(*configuration), nil\n\t}\n\n\t// Create a server\n\tvar server authServer = authServerImpl{\n\t\tssoEngine: engine,\n\t\tendpointAuthentication: buildEndpointAuthenticationFunction(*configuration),\n\t\treloadConfiguration: reloadConfiguration,\n\t}\n\n\tlog.Info(\"Adding SSO Server Handler.\")\n\n\t// Add the public endpoints\n\tpublicServer.HandleFunc(\"/token\", server.handleTokenRequest)\n\tpublicServer.HandleFunc(\"/refresh\", server.handleRefreshRequest)\n\n\t// Add the private endpoints\n\tprivateServer.HandleFunc(\"/status\", server.handleGetStatus)\n\tprivateServer.HandleFunc(\"/reload-sso-configuration\", server.handleReloadConfiguration)\n\n\treturn nil\n}", "title": "" }, { "docid": "f8cc32e620ec0ff280a220227f83d1ed", "score": "0.5094668", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"snatglobalinfo-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource SnatGlobalInfo\n\terr = c.Watch(&source.Kind{Type: &aciv1.SnatGlobalInfo{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &aciv1.SnatLocalInfo{}}, &handler.EnqueueRequestsFromMapFunc{ToRequests: HandleLocalInfosMapper(mgr.GetClient(), []predicate.Predicate{})})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32939b592a26d0e36f7f623f0ba00947", "score": "0.50910234", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"alamedaservicekeycode-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Watch for changes to primary resource AlamedaService\n\terr = c.Watch(&source.Kind{Type: &federatoraiv1alpha1.AlamedaService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "50639815e24063d7d82710a4c3ae99df", "score": "0.50820154", "text": "func (c *CaddyController) onSecretAdded(obj *apiv1.Secret) {\n\tif k8s.IsManagedTLSSecret(obj, c.resourceStore.Ingresses) {\n\t\tc.syncQueue.Add(SecretAddedAction{\n\t\t\tresource: obj,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6a0d389d45f607f60ebf85cd2a9b24c6", "score": "0.5066848", "text": "func Add(mgr manager.Manager) error {\n\tif !utildiscovery.DiscoverGVK(controllerKind) {\n\t\treturn nil\n\t}\n\n\tr, err := newReconciler(mgr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn add(mgr, r)\n}", "title": "" }, { "docid": "21e05d515150f2d4c271d4d4db4155fd", "score": "0.5066637", "text": "func (disc *nodeEtcdDiscovery) OnAdd(obj interface{}) {\n\tagent, ok := obj.(*apisbkbcsv2.Agent)\n\tif !ok {\n\t\tblog.Errorf(\"cannot convert to *apisbkbcsv2.Agent: %v\", obj)\n\t\treturn\n\t}\n\tblog.Infof(\"receive Agent(%s) Add event\", agent.Name)\n\tip := agent.Spec.GetAgentIP()\n\tif ip == \"\" {\n\t\tblog.Errorf(\"node %s not found InnerIP\", agent.GetName())\n\t\treturn\n\t}\n\tdisc.nodes[ip] = struct{}{}\n\n\tdisc.eventHandler(Info{Module: disc.module, Key: disc.module})\n}", "title": "" }, { "docid": "5df600352280681c51b8f9dd55e38b76", "score": "0.50660425", "text": "func Add(mgr manager.Manager, context *controllerconfig.Context) error {\n\treconcileMachineLabel := &ReconcileMachineLabel{\n\t\tclient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\toptions: context,\n\t}\n\n\treconciler := reconcile.Reconciler(reconcileMachineLabel)\n\t// create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: reconciler})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not create controller %q\", controllerName)\n\t}\n\n\t// Watch for the machines and enqueue the machineRequests if the machine is occupied by the osd pods\n\terr = c.Watch(&source.Kind{Type: &mapiv1.Machine{}}, handler.EnqueueRequestsFromMapFunc(\n\t\thandler.MapFunc(func(obj client.Object) []reconcile.Request {\n\t\t\tclusterNamespace, isNamespacePresent := obj.GetLabels()[MachineFencingNamespaceLabelKey]\n\t\t\tif !isNamespacePresent || len(clusterNamespace) == 0 {\n\t\t\t\treturn []reconcile.Request{}\n\t\t\t}\n\t\t\tclusterName, isClusterNamePresent := obj.GetLabels()[MachineFencingLabelKey]\n\t\t\tif !isClusterNamePresent || len(clusterName) == 0 {\n\t\t\t\treturn []reconcile.Request{}\n\t\t\t}\n\t\t\treq := reconcile.Request{NamespacedName: types.NamespacedName{Name: clusterName, Namespace: clusterNamespace}}\n\t\t\treturn []reconcile.Request{req}\n\t\t}),\n\t))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not watch machines\")\n\t}\n\n\t// Watch for the osd pods and enqueue the CephCluster in the namespace from the pods\n\treturn c.Watch(&source.Kind{Type: &corev1.Pod{}}, handler.EnqueueRequestsFromMapFunc(\n\t\thandler.MapFunc(func(obj client.Object) []reconcile.Request {\n\t\t\t_, ok := obj.(*corev1.Pod)\n\t\t\tif !ok {\n\t\t\t\treturn []reconcile.Request{}\n\t\t\t}\n\t\t\tlabels := obj.GetLabels()\n\t\t\tif value, present := labels[osdPodLabelKey]; !present || value != osdPODLabelValue {\n\t\t\t\treturn []reconcile.Request{}\n\t\t\t}\n\t\t\tnamespace := obj.GetNamespace()\n\t\t\trookClusterName, present := labels[osdClusterNameLabelKey]\n\t\t\tif !present {\n\t\t\t\treturn []reconcile.Request{}\n\t\t\t}\n\t\t\treq := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: namespace, Name: rookClusterName}}\n\t\t\treturn []reconcile.Request{req}\n\t\t}),\n\t))\n}", "title": "" }, { "docid": "5cc8531579920a14de369e9d8f6da24d", "score": "0.50644916", "text": "func createServiceHandlers(lbc *LoadBalancerController) cache.ResourceEventHandlerFuncs {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tsvc := obj.(*v1.Service)\n\n\t\t\tglog.V(3).Infof(\"Adding service: %v\", svc.Name)\n\t\t\tlbc.AddSyncQueue(svc)\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tsvc, isSvc := obj.(*v1.Service)\n\t\t\tif !isSvc {\n\t\t\t\tdeletedState, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\t\t\tif !ok {\n\t\t\t\t\tglog.V(3).Infof(\"Error received unexpected object: %v\", obj)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsvc, ok = deletedState.Obj.(*v1.Service)\n\t\t\t\tif !ok {\n\t\t\t\t\tglog.V(3).Infof(\"Error DeletedFinalStateUnknown contained non-Service object: %v\", deletedState.Obj)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tglog.V(3).Infof(\"Removing service: %v\", svc.Name)\n\t\t\tlbc.AddSyncQueue(svc)\n\t\t},\n\t\tUpdateFunc: func(old, cur interface{}) {\n\t\t\tif !reflect.DeepEqual(old, cur) {\n\t\t\t\tcurSvc := cur.(*v1.Service)\n\t\t\t\tif lbc.IsExternalServiceForStatus(curSvc) {\n\t\t\t\t\tlbc.AddSyncQueue(curSvc)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\toldSvc := old.(*v1.Service)\n\t\t\t\tif hasServiceChanges(oldSvc, curSvc) {\n\t\t\t\t\tglog.V(3).Infof(\"Service %v changed, syncing\", curSvc.Name)\n\t\t\t\t\tlbc.AddSyncQueue(curSvc)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b2471b720f61ea215ff3053a8bb248e1", "score": "0.50596267", "text": "func (c *Controller) Run(stop <-chan struct{}) {\n\tc.gameServersInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\t// Alternatively, you could set any method that contains the right signature `func(obj interface{})`\n\t\t// AddFunc: c.EventHandlerAdd,\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tif err := c.EventHandlerGameServerAdd(obj); err != nil {\n\t\t\t\tc.logger.WithError(err).Error(\"add event error\")\n\t\t\t}\n\t\t},\n\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\tif err := c.EventHandlerGameServerUpdate(oldObj, newObj); err != nil {\n\t\t\t\tc.logger.WithError(err).Error(\"update event error\")\n\t\t\t}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tif err := c.EventHandlerGameServerDelete(obj); err != nil {\n\t\t\t\tc.logger.WithError(err).Error(\"delete event error\")\n\t\t\t}\n\t\t},\n\t})\n\n\tc.informerFactory.Start(wait.NeverStop)\n\n\t<-stop\n\tc.logger.Info(\"Stopping GameServer Controller\")\n}", "title": "" }, { "docid": "91a2a2d1ab2a81788fa95bc8dea719a5", "score": "0.5056655", "text": "func (s *Server) AddCResHandler(cResH *res.Handler) {\n\tlog.Infof(\"Add the client resource\")\n\ts.resHLock.Lock()\n\tdefer s.resHLock.Unlock()\n\n\t_, exist := s.cResHs[cResH]\n\tif exist {\n\t\treturn\n\t}\n\ts.cResHs[cResH] = struct{}{}\n\n\t// Set write target handler for each handlers.\n\tfor sResH := range s.sResHs {\n\t\tsResH.AddWriteTarget(cResH)\n\t\tcResH.AddWriteTarget(sResH)\n\t}\n}", "title": "" }, { "docid": "a0ea3eeba9b5bdeb5a18b4de8fa95e83", "score": "0.50520694", "text": "func add(mgr manager.Manager, r *ReconcileVitessCluster) error {\n\t// Create a new controller\n\tc, err := controller.New(controllerName, mgr, controller.Options{\n\t\tReconciler: r,\n\t\tMaxConcurrentReconciles: *maxConcurrentReconciles,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource VitessCluster\n\tif err := c.Watch(&source.Kind{Type: &planetscalev2.VitessCluster{}}, &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resources and requeue the owner VitessCluster.\n\tfor _, resource := range watchResources {\n\t\terr := c.Watch(&source.Kind{Type: resource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &planetscalev2.VitessCluster{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Periodically resync even when no Kubernetes events have come in.\n\tif err := c.Watch(r.resync.WatchSource(), &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fc5f3fd7a8bffbc42df9b7dde55e5ba1", "score": "0.5050983", "text": "func (c *DisplayController) AddController(router *mux.Router, s *Server) {\n\tc.Srv = s\n\trouter.Methods(\"GET\").Path(\"/display/refresh\").Name(\"RefreshDisplay\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleRefreshDisplay)))\n\trouter.Methods(\"GET\").Path(\"/display/rebuild\").Name(\"RebuildDisplay\").\n\t\tHandler(Logger(c, http.HandlerFunc(c.handleRebuildDisplay)))\n}", "title": "" }, { "docid": "26870f8f8dc6e17d1934667410ab79ae", "score": "0.5049235", "text": "func Add(mgr manager.Manager, clusterFlavor cnstypes.CnsClusterFlavor,\n\tconfigInfo *commonconfig.ConfigurationInfo, volumeManager volumes.Manager) error {\n\tctx, log := logger.GetNewContextWithLogger()\n\tif clusterFlavor != cnstypes.CnsClusterFlavorWorkload {\n\t\tlog.Debug(\"Not initializing the CnsRegisterVolume Controller as its a non-WCP CSI deployment\")\n\t\treturn nil\n\t}\n\tif clusterFlavor == cnstypes.CnsClusterFlavorWorkload {\n\t\tif commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.TKGsHA) {\n\t\t\tclusterComputeResourceMoIds, err := common.GetClusterComputeResourceMoIds(ctx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"failed to get clusterComputeResourceMoIds. err: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(clusterComputeResourceMoIds) > 1 {\n\t\t\t\tlog.Infof(\"Not initializing the CnsRegisterVolume Controller as stretched supervisor is detected.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\t// Initializes kubernetes client.\n\tk8sclient, err := k8s.NewClient(ctx)\n\tif err != nil {\n\t\tlog.Errorf(\"Creating Kubernetes client failed. Err: %v\", err)\n\t\treturn err\n\t}\n\n\t// eventBroadcaster broadcasts events on cnsregistervolume instances to the\n\t// event sink.\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartRecordingToSink(\n\t\t&typedcorev1.EventSinkImpl{\n\t\t\tInterface: k8sclient.CoreV1().Events(\"\"),\n\t\t},\n\t)\n\trecorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: apis.GroupName})\n\treturn add(mgr, newReconciler(mgr, configInfo, volumeManager, recorder))\n}", "title": "" }, { "docid": "370b0feb22676d2ca32d508697eddd02", "score": "0.5040623", "text": "func Add(mgr manager.Manager, local, minikube bool, clientSet kubernetes.Clientset, config rest.Config, notificationEvents *chan event.Event) error {\n\treturn add(mgr, newReconciler(mgr, local, minikube, clientSet, config, notificationEvents))\n}", "title": "" }, { "docid": "2a565b0104779db308e4e5c72ebd3ffb", "score": "0.50382537", "text": "func OnAddClient(cl iface.Iclient) {\n\tcl.SetHandler(checkMQTTdata, dispathMQTTdata)\n}", "title": "" }, { "docid": "04438195f3fcb7f00a7f59c8ed333cc9", "score": "0.50372446", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clusterversion-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to ClusterVersion\n\terr = c.Watch(&source.Kind{Type: &tenancyv1alpha1.ClusterVersion{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68ef0e9931c05b41952af210b2c45d7d", "score": "0.50326586", "text": "func (s *Service) eventHandler(n client.Notification) {\n\tdefer recoverPanic()\n\n\t// We need only `notifycliententerview` event with `reasonid=0`.\n\t// This event occurs when a user connects to the server.\n\tif n.Type != \"notifycliententerview\" {\n\t\treturn\n\t}\n\tif n.Params[0][\"reasonid\"] != \"0\" {\n\t\treturn\n\t}\n\n\tcluid := n.Params[0][\"client_unique_identifier\"]\n\tclnickname := n.Params[0][\"client_nickname\"]\n\tcldbid := n.Params[0][\"client_database_id\"]\n\n\t// Check if connected user is in the register queue.\n\trecord, ok := s.registerQ[clnickname]\n\tif !ok {\n\t\treturn\n\t}\n\t// Check if the registration record didn't expire.\n\tnow := time.Now().Unix()\n\tif record.at+int64(s.system.Config.TS3RegisterTimer) < now {\n\t\treturn\n\t}\n\n\t// Add user to the proper group.\n\tgroupName := fmt.Sprintf(\"%s %s\", record.user.EveAlliTicker,\n\t\trecord.user.EveCorpTicker)\n\tfound, sgid := s.serverGroupByName(groupName)\n\t// If group not found, create it.\n\tif !found {\n\t\tsgid = s.serverGroupCopy(groupName)\n\t}\n\ts.serverGroupAddClient(sgid, cldbid)\n\n\t// Finally, store user record in the db.\n\trecord.user.TS3CLDBID = cldbid\n\trecord.user.TS3UID = cluid\n\trecord.user.Active = true\n\tif s.store.TS3UIDExists(cluid) {\n\t\ts.store.UpdateUserByUID(record.user)\n\t} else {\n\t\ts.store.CreateUser(record.user)\n\t}\n}", "title": "" }, { "docid": "138bcd2626b1d9e1022cd2d4afd165e8", "score": "0.50315166", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"knativeeventing-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KnativeEventing\n\treturn c.Watch(&source.Kind{Type: &eventingv1alpha1.KnativeEventing{}}, &handler.EnqueueRequestForObject{})\n}", "title": "" }, { "docid": "a4c5e344335f153428dcf9a9c3906f6d", "score": "0.50306135", "text": "func (m *Manager) OnClientPacket(tkn string, p Packet) {\n\t//log.Zap.Info(\"OnClientPacket %v\", p.Type)\n\tswitch t := p.Type.(type) {\n\tcase *Packet_UpdateParameters:\n\t\tfor _, element := range t.UpdateParameters.Parameters {\n\t\t\tswitch param := element.Type.(type) {\n\t\t\tcase *Packet_UpdateParametersPacket_Parameter_CullingArea,\n\t\t\t\t*Packet_UpdateParametersPacket_Parameter_Debug:\n\t\t\t\tManagerInstance.NotifyAll(obs.Event{Value: ClientSettingsUpdate{ClientToken: tkn, Settings: *t}})\n\t\t\tcase *Packet_UpdateParametersPacket_Parameter_TimeScale:\n\t\t\t\tcfg.Get().Logic.TimeScale = param.TimeScale\n\t\t\t}\n\t\t}\n\tcase *Packet_UpdateObject:\n\t\t// This case is actually misleading, UpdateObject client -> server is used to create new objects, not update\n\t\tvar sc Component_SpaceComponent\n\t\tvar behaviour Component_BehaviourTypeComponent\n\t\tfor _, ct := range p.GetUpdateObject().Components {\n\t\t\tswitch c := ct.Type.(type) {\n\t\t\tcase *Component_Space:\n\t\t\t\tsc = *c.Space\n\t\t\tcase *Component_BehaviourType:\n\t\t\t\tbehaviour = *c.BehaviourType\n\t\t\t}\n\t\t}\n\t\tif sc.Position == nil {\n\t\t\tlog.Zap.Info(\"Client requested object update without required args\")\n\t\t\treturn\n\t\t}\n\t\t// Create object\n\t\tswitch behaviour.Tag {\n\t\tcase Component_BehaviourTypeComponent_ANY:\n\t\tcase Component_BehaviourTypeComponent_ANIMAL:\n\t\t\tm.AddHerbivorous(sc.Position, protometry.NewVector3(1, 1, 1), -1)\n\t\tcase Component_BehaviourTypeComponent_VEGETATION: // TODO\n\t\tcase Component_BehaviourTypeComponent_PLAYER: // Are clients allowed to spawn players ?\n\t\t}\n\n\tcase *Packet_UpdateSpaceRequest:\n\t\t// Update requested object after applying physics\n\t\tif t.UpdateSpaceRequest.ActualSpace.Position == nil ||\n\t\t\tt.UpdateSpaceRequest.NewSpace.Position == nil {\n\t\t\tlog.Zap.Info(\"Client requested object space update with incorrect args\")\n\t\t\treturn\n\t\t}\n\n\t\t// Let's find this object in the state\n\t\tb := protometry.NewBoxOfSize(t.UpdateSpaceRequest.ActualSpace.Position.X,\n\t\t\tt.UpdateSpaceRequest.ActualSpace.Position.Y,\n\t\t\tt.UpdateSpaceRequest.ActualSpace.Position.Z,\n\t\t\tcfg.Get().Logic.OctreeSize)\n\t\to := m.networkSystem.objects.Get(t.UpdateSpaceRequest.ObjectId, *b)\n\n\t\tif o != nil {\n\t\t\t// Ignores physics\n\t\t\tManagerInstance.NotifyAll(obs.Event{Value: PhysicsUpdateResponse{\n\t\t\t\tObjects: []struct {\n\t\t\t\t\toctree.Object\n\t\t\t\t\tprotometry.Vector3\n\t\t\t\t}{{Object: *o.Clone(), Vector3: *t.UpdateSpaceRequest.NewSpace.Position}}}})\n\t\t} else { // Update object\n\t\t\tlog.Zap.Info(\"Client tried to update an in-existent object\", zap.String(\"client\", tkn),\n\t\t\t\tzap.Uint64(\"ID\", t.UpdateSpaceRequest.ObjectId))\n\t\t}\n\t\t//log.Zap.Info(\"Object created at %v\", sc.Position)\n\tcase *Packet_Armageddon:\n\t\tlog.Zap.Info(\"Start armageddon\")\n\t\t// My theory is that this function is ran in another goroutine so it's better to get all objects at this given time\n\t\t// One shot and then act instead of iterating\n\t\tobjs := m.networkSystem.objects.GetAllObjects() // TODO: disable suicide ?\n\t\tfor _, obj := range objs {\n\t\t\tm.World.RemoveObject(obj)\n\t\t}\n\tcase *Packet_DestroyObject:\n\t\tdestroy := p.GetDestroyObject()\n\t\to := m.networkSystem.objects.Get(destroy.ObjectId, *destroy.Region)\n\t\tif o != nil {\n\t\t\tlog.Zap.Info(\"Client destroy\", zap.String(\"client\", tkn), zap.Uint64(\"ID\", destroy.ObjectId))\n\t\t\tm.World.RemoveObject(*o)\n\t\t} else {\n\t\t\tlog.Zap.Info(\"Client tried to destroy in-existent object\", zap.String(\"client\", tkn), zap.Uint64(\"ID\", destroy.ObjectId))\n\t\t}\n\tdefault:\n\t\tlog.Zap.Info(\"Client sent unimplemented packet\", zap.Any(\"packet\", t))\n\t}\n}", "title": "" }, { "docid": "75767f6b2db0fa6410da92dda6c546ba", "score": "0.50293094", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"config-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Config\n\terr = c.Watch(&source.Kind{Type: &csiv1.Config{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubresources := []runtime.Object{\n\t\t&appsv1.DaemonSet{},\n\t}\n\n\tfor _, subresource := range subresources {\n\t\terr = c.Watch(&source.Kind{Type: subresource}, &handler.EnqueueRequestForOwner{\n\t\t\tIsController: true,\n\t\t\tOwnerType: &csiv1.Config{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5eb951ba18fc4d409455a05194f04c8d", "score": "0.50291425", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hadoopservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource HadoopService\n\terr = c.Watch(&source.Kind{Type: &alicek106v1alpha1.HadoopService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner HadoopService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &alicek106v1alpha1.HadoopService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5f8a55d542cfb2cefff249fa0821ee17", "score": "0.5029111", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hapcontainer-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource HapContainer\n\terr = c.Watch(&source.Kind{Type: &hapv1alpha1.HapContainer{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner HapContainer\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &hapv1alpha1.HapContainer{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b60099b5ad0392a7f03520a65c5aede", "score": "0.5014237", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nexus-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Nexus\n\terr = c.Watch(&source.Kind{Type: &appsv1alpha1.Nexus{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerWatcher := framework.NewControllerWatcher(r.(*ReconcileNexus).discoveryClient, mgr, c, &appsv1alpha1.Nexus{})\n\twatchedObjects := []framework.WatchedObjects{\n\t\t{\n\t\t\tGroupVersion: routev1.GroupVersion,\n\t\t\tAddToScheme: routev1.Install,\n\t\t\tObjects: []runtime.Object{&routev1.Route{}},\n\t\t},\n\t\t{\n\t\t\tGroupVersion: networking.SchemeGroupVersion,\n\t\t\tAddToScheme: networking.AddToScheme,\n\t\t\tObjects: []runtime.Object{&networking.Ingress{}},\n\t\t},\n\t\t{Objects: []runtime.Object{&corev1.Service{}, &appsv1.Deployment{}, &corev1.PersistentVolumeClaim{}, &corev1.ServiceAccount{}}},\n\t}\n\tif err = controllerWatcher.Watch(watchedObjects...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c76feb136edbe022fc36b72ddb434fc4", "score": "0.5009078", "text": "func (d *VirtualMachineController) addLauncherClient(vmUID types.UID, info *virtcache.LauncherClientInfo) error {\n\td.launcherClients.Store(vmUID, info)\n\treturn nil\n}", "title": "" }, { "docid": "9716ad7f99b069e7512131bee8042683", "score": "0.50053674", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"appengine-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Appengine\n\terr = c.Watch(&source.Kind{Type: &knapv1alpha1.Appengine{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Appengine\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &knapv1alpha1.Appengine{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "449828884a0dfa755be099bf1a47e4b1", "score": "0.5002853", "text": "func AddMock(mock Mock) {\n\tmockSrv.serverMutex.Lock()\n\tdefer mockSrv.serverMutex.Unlock()\n\tkey := mockSrv.getMockKey(mock.Method, mock.Url, mock.ReqBody)\n\tmockSrv.mocks[key] = &mock\n}", "title": "" }, { "docid": "773db4a0734f9548b32828a10a750d74", "score": "0.50017285", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"awsmachine-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to AWSMachine\n\terr = c.Watch(\n\t\t&source.Kind{Type: &infrav1.AWSMachine{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.Watch(\n\t\t&source.Kind{Type: &clusterv1.Machine{}},\n\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\tToRequests: util.MachineToInfrastructureMapFunc(schema.GroupVersionKind{\n\t\t\t\tGroup: infrav1.SchemeGroupVersion.Group,\n\t\t\t\tVersion: infrav1.SchemeGroupVersion.Version,\n\t\t\t\tKind: \"AWSMachine\",\n\t\t\t}),\n\t\t},\n\t)\n}", "title": "" }, { "docid": "392fa964858fa11a33b3a46c9c576858", "score": "0.49862346", "text": "func (c *Controller) Add(obj interface{}) {\n\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\tvar event Event\n\n\tif err == nil {\n\t\tevent.key = key\n\t\tevent.eventType = \"create\"\n\t\tc.queue.Add(event)\n\t}\n}", "title": "" }, { "docid": "dbdb9538a45a6b3be1a0ea34c89adc0d", "score": "0.49772853", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clusterdeployment-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource ClusterDeployment\n\terr = c.Watch(&source.Kind{Type: &hivev1alpha1.ClusterDeployment{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "10031d6d8201b9915baff51b89dd108e", "score": "0.49720484", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller. All injections (e.g. InjectClient) are performed after this call to controller.New()\n\tc, err := controller.New(\"kedacontroller-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KedaController\n\terr = c.Watch(&source.Kind{Type: &kedav1alpha1.KedaController{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to secondary resource Deployment and requeue the owner KedaController\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &kedav1alpha1.KedaController{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "88a12d075665824e6d02f4b2c6f4af9f", "score": "0.49695426", "text": "func RegisterLSCCServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LSCCServiceServer) error {\n\n\tmux.Handle(\"GET\", pattern_LSCCService_GetChaincodeData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_GetChaincodeData_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_GetChaincodeData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_LSCCService_GetInstalledChaincodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_GetInstalledChaincodes_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_GetInstalledChaincodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_LSCCService_GetChaincodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_GetChaincodes_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_GetChaincodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_LSCCService_GetDeploymentSpec_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_GetDeploymentSpec_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_GetDeploymentSpec_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_LSCCService_Install_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_Install_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_Install_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_LSCCService_Deploy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LSCCService_Deploy_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LSCCService_Deploy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "9d7d10b99957b6e3b09c16a39ea89967", "score": "0.49619657", "text": "func (c *Controller) Add(h Handler) {\n\tc.handlers[h.Command()] = h\n}", "title": "" }, { "docid": "25f6365d8f0a12e3bbeb9a60d62f8b92", "score": "0.49510768", "text": "func (c *PruneController) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t}\n}", "title": "" }, { "docid": "25f6365d8f0a12e3bbeb9a60d62f8b92", "score": "0.49510768", "text": "func (c *PruneController) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(pruneControllerWorkQueueKey) },\n\t}\n}", "title": "" }, { "docid": "46809329a6a46fbde0a00f6636e0f6f7", "score": "0.4950927", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"collector-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Collector\n\terr = c.Watch(&source.Kind{Type: &collector.Collector{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dcd95eca5b2f4055b6fc8865c8610d6a", "score": "0.49496418", "text": "func (r *reconciler) AddToManager(ctx context.Context, mgr manager.Manager) error {\n\tr.serverPort = mgr.GetWebhookServer().Port\n\tr.client = mgr.GetClient()\n\n\tpresent, err := isWebhookServerSecretPresent(ctx, mgr.GetAPIReader(), r.ServerSecretName, r.Namespace, r.Identity)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if webhook CA and server cert have not been generated yet, we need to generate them for the first time now,\n\t// otherwise the webhook server will not be able to start (which is a non-leader election runnable and is therefore\n\t// started before this controller)\n\tif !present {\n\t\t// cache is not started yet, we need an uncached client for the initial setup\n\t\tuncachedClient, err := client.NewDelegatingClient(client.NewDelegatingClientInput{\n\t\t\tClient: r.client,\n\t\t\tCacheReader: mgr.GetAPIReader(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create new unchached client: %w\", err)\n\t\t}\n\n\t\tsm, err := r.newSecretsManager(ctx, mgr.GetLogger(), uncachedClient)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create new SecretsManager: %w\", err)\n\t\t}\n\n\t\tif _, err = r.generateWebhookCA(ctx, sm); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif _, err = r.generateWebhookServerCert(ctx, sm); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// add controller, that regenerates the CA and server cert secrets periodically\n\tctrl, err := controller.New(certificateReconcilerName, mgr, controller.Options{\n\t\tReconciler: r,\n\t\tRecoverPanic: pointer.Bool(true),\n\t\t// if going into exponential backoff, wait at most the configured sync period\n\t\tRateLimiter: workqueue.NewWithMaxWaitRateLimiter(workqueue.DefaultControllerRateLimiter(), r.SyncPeriod),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctrl.Watch(controllerutils.EnqueueOnce, nil)\n}", "title": "" }, { "docid": "6dc8d4a3d009722307ed33bbf2d21e9d", "score": "0.49445948", "text": "func (n *NGINXController) OnUpdate(ingressCfg *ingress.Configuration) error {\n\t// Synchronizde the state between Kubernetes and Kong with this order:\n\t//\t- SSL Certificates\n\t//\t- SNIs\n\t// \t- Upstreams\n\t//\t- Upstream targets\n\t// - Consumers\n\t// - Credentials\n\t// \t- Services (and Plugins)\n\t// - Routes (and Plugins)\n\n\t// TODO: All the resources created by the ingress controller add the annotations\n\t// kong-ingress-controller and kubernetes\n\t// This allows the identification of reources that can be removed if they\n\t// are not present in Kubernetes when the sync process is executed.\n\t// For instance an Ingress, Service or Secret is removed.\n\n\terr := n.syncCertificates(ingressCfg.Servers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, server := range ingressCfg.Servers {\n\n\t\terr := n.syncUpstreams(server.Locations, ingressCfg.Backends)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = n.syncConsumers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = n.syncCredentials()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = n.syncGlobalPlugins()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckServices, err := n.syncServices(ingressCfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcheckRoutes, err := n.syncRoutes(ingressCfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// trigger a new sync event to ensure routes and services are up to date\n\t// this is required because the plugins configuration could be incorrect\n\t// if some delete occurred.\n\tif checkServices || checkRoutes {\n\t\tdefer func() {\n\t\t\tn.syncQueue.Enqueue(&extensions.Ingress{})\n\t\t}()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "62e97301b9c243b9275ffecb097b68f7", "score": "0.49433643", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"nginxingress-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\traven.CaptureErrorAndWait(err, nil)\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource NginxIngress\n\terr = c.Watch(&source.Kind{Type: &appv1alpha1.NginxIngress{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\traven.CaptureErrorAndWait(err, nil)\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner NginxIngress\n\terr = c.Watch(&source.Kind{Type: &v1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &appv1alpha1.NginxIngress{},\n\t})\n\tif err != nil {\n\t\traven.CaptureErrorAndWait(err, nil)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cd50d5335a808dbd30eccadec1444658", "score": "0.49422693", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n // Create a new controller\n c, err := controller.New(\"provisioning-controller\", mgr, controller.Options{Reconciler: r})\n if err != nil {\n return err\n }\n\n // Watch for changes to primary resource Provisioning\n err = c.Watch(&source.Kind{Type: &bpav1alpha1.Provisioning{}}, &handler.EnqueueRequestForObject{})\n if err != nil {\n return err\n }\n\n\t// Watch for changes to resource configmap created as a consequence of the provisioning CR\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{\n IsController: true,\n OwnerType: &bpav1alpha1.Provisioning{},\n })\n\n if err != nil {\n return err\n }\n\n //Watch for changes to job resource also created as a consequence of the provisioning CR\n err = c.Watch(&source.Kind{Type: &batchv1.Job{}}, &handler.EnqueueRequestForOwner{\n IsController: true,\n OwnerType: &bpav1alpha1.Provisioning{},\n })\n\n if err != nil {\n return err\n }\n\n // Watch for changes to resource software CR\n err = c.Watch(&source.Kind{Type: &bpav1alpha1.Software{}}, &handler.EnqueueRequestForObject{})\n if err != nil {\n return err\n }\n\n\n return nil\n}", "title": "" }, { "docid": "4fa83d5922f66c3d0baf8cfab8abebc9", "score": "0.49419212", "text": "func (c *ServiceConfig) RegisterEventHandler(handler ServiceHandler) {\n c.eventHandlers = append(c.eventHandlers, handler)\n}", "title": "" }, { "docid": "0a5729b0c7303134e30a93c04b60a5f0", "score": "0.4941791", "text": "func (efci *enhancedFilteredCacheInformer) AddEventHandler(handler toolscache.ResourceEventHandler) {\n\tfor _, informer := range efci.informers {\n\t\tinformer.AddEventHandler(handler)\n\t}\n}", "title": "" }, { "docid": "d180955c0c0112c6b7e2b9999e84f480", "score": "0.49374518", "text": "func (c *CSRApproverOperator) eventHandler() cache.ResourceEventHandler {\n\treturn cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t\tUpdateFunc: func(old, new interface{}) { c.queue.Add(workQueueKey) },\n\t\tDeleteFunc: func(obj interface{}) { c.queue.Add(workQueueKey) },\n\t}\n}", "title": "" }, { "docid": "c7b33ba7b82db177c053142f052a89f3", "score": "0.49358928", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"installlogmonitor-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstallLogPred := predicate.Funcs{\n\t\tCreateFunc: func(e event.CreateEvent) bool {\n\t\t\tif _, ok := e.Meta.GetLabels()[hivev1.HiveInstallLogLabel]; ok {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif strings.HasSuffix(e.Meta.GetName(), \"-install-log\") {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\tif _, ok := e.MetaNew.GetLabels()[hivev1.HiveInstallLogLabel]; ok {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif strings.HasSuffix(e.MetaNew.GetName(), \"-install-log\") {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\tDeleteFunc: func(e event.DeleteEvent) bool {\n\t\t\t// We don't care about deletes.\n\t\t\treturn false\n\t\t},\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForObject{}, installLogPred)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9ecd313b96b6bdd1f0e768e809fb419f", "score": "0.4931484", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"clusterspiffeid-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource SpiffeId\n\terr = c.Watch(&source.Kind{Type: &spiffeidv1alpha1.ClusterSpiffeId{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0c86b28a52247cc55a8c8fcbb63091d", "score": "0.4928748", "text": "func RegisterCapsuleBMServer(e *bm.Engine, server CapsuleBMServer) {\n\tv1CapsuleSvc = server\n\te.GET(\"/live.liveadmin.v1.Capsule/get_coin_list\", capsuleGetCoinList)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_coin_config\", capsuleUpdateCoinConfig)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_coin_status\", capsuleUpdateCoinStatus)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_coin\", capsuleDeleteCoin)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_pool_list\", capsuleGetPoolList)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool\", capsuleUpdatePool)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_pool\", capsuleDeletePool)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool_status\", capsuleUpdatePoolStatus)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_pool_prize\", capsuleGetPoolPrize)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_prize_type\", capsuleGetPrizeType)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_prize_expire\", capsuleGetPrizeExpire)\n\te.POST(\"/live.liveadmin.v1.Capsule/update_pool_prize\", capsuleUpdatePoolPrize)\n\te.POST(\"/live.liveadmin.v1.Capsule/delete_pool_prize\", capsuleDeletePoolPrize)\n\te.GET(\"/live.liveadmin.v1.Capsule/get_coupon_list\", capsuleGetCouponList)\n}", "title": "" }, { "docid": "9e478bd34ba2b340af9d85767198db72", "score": "0.49243996", "text": "func (h *diffHandler) runAdd(ctx context.Context, evt *handler.Event) error {\n\n\tcleanedManifest := evt.K8sManifest\n\th.storage.Add(getObjID(evt), cleanedManifest)\n\n\t// Initial sache sync-up events are \"Add\", we don't want them to be notified\n\t// but we want them to fill up our storage for future comparison\n\tif !evt.K8sEvt.HasSynced {\n\t\tevt.RunNext = false\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6052d41159f4e1698778594730684426", "score": "0.49241513", "text": "func Add(mgr manager.Manager) error {\n\tr := &Reconciler{\n\t\tconnecter: &clusterConnecter{kube: mgr.GetClient()},\n\t\tkube: mgr.GetClient(),\n\t}\n\tc, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot create Kubernetes controller\")\n\t}\n\n\terr = c.Watch(\n\t\t&source.Kind{Type: &v1alpha1.KubernetesApplicationResource{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\t&predicate.Funcs{CreateFunc: CreatePredicate, UpdateFunc: UpdatePredicate},\n\t)\n\treturn errors.Wrapf(err, \"cannot watch for %s\", v1alpha1.KubernetesApplicationResourceKind)\n}", "title": "" }, { "docid": "ec74f59faeadf65d037d9355c633a32e", "score": "0.49163085", "text": "func (s *Store) AddEvent(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tdefer r.Body.Close()\n\n\tvars := mux.Vars(r)\n\tinstanceID := vars[\"instance_id\"]\n\tdata := log.Data{\"instance_id\": instanceID}\n\tap := common.Params{\"instance_id\": instanceID}\n\n\tif err := func() error {\n\t\tevent, err := unmarshalEvent(r.Body)\n\t\tif err != nil {\n\t\t\tlog.ErrorCtx(ctx, errors.WithMessage(err, \"add instance event: failed to unmarshal request body\"), data)\n\t\t\treturn err\n\t\t}\n\n\t\tif err = event.Validate(); err != nil {\n\t\t\tlog.ErrorCtx(ctx, errors.WithMessage(err, \"add instance event: failed to validate event object\"), data)\n\t\t\treturn err\n\t\t}\n\n\t\tif err = s.AddEventToInstance(instanceID, event); err != nil {\n\t\t\tlog.ErrorCtx(ctx, errors.WithMessage(err, \"add instance event: failed to add event to instance in datastore\"), data)\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}(); err != nil {\n\t\tif auditErr := s.Auditor.Record(ctx, AddInstanceEventAction, audit.Unsuccessful, ap); auditErr != nil {\n\t\t\terr = auditErr\n\t\t}\n\t\thandleInstanceErr(ctx, err, w, data)\n\t\treturn\n\t}\n\n\tif auditErr := s.Auditor.Record(ctx, AddInstanceEventAction, audit.Successful, ap); auditErr != nil {\n\t\thandleInstanceErr(ctx, auditErr, w, data)\n\t\treturn\n\t}\n\n\tlog.InfoCtx(ctx, \"add instance event: request successful\", data)\n}", "title": "" }, { "docid": "afc230f9490a90fd782337bb28712c1f", "score": "0.49161014", "text": "func (c *PodController) onUpdate(oldObj, _ interface{}) {\n\tkey, err := cache.MetaNamespaceKeyFunc(oldObj)\n\tif err != nil {\n\t\tlog.Printf(\"onUpdate: Unable to get key for #%v\", oldObj, err)\n\t}\n\tlog.Printf(\"onAdd: %v\", key)\n}", "title": "" }, { "docid": "b570f55e3b1f82a8c99b5aad0611b37e", "score": "0.49129298", "text": "func (g *GoLB) AddServer(s *server.Server) error {\n\tif s == nil || s.Host == \"\" {\n\t\treturn errUnableToAddServer\n\t}\n\ts.ID = discovery.GenID(s)\n\tg.Servers = append(g.Servers, s)\n\tg.Stats.Servers++\n\treturn nil\n}", "title": "" }, { "docid": "5483b947e005dc1a22ba60bc439478d8", "score": "0.49118164", "text": "func TSServer(Cache *lru_ts) {\n\tfor {\n\t\tselect {\n\t\tcase add := <-Cache.add:\n\t\t\t// IF ADD request to cache\n\t\t\tCache.cache.Add(add.key, add.value)\n\t\tcase get := <-Cache.get:\n\t\t\t// IF GET request to cache\n\t\t\tvalue, ok := Cache.cache.Get(get.key)\n\t\t\tget.response <- getRespStruct{value, ok}\n\t\tcase contains := <-Cache.contains:\n\t\t\t// IF CONTAIN request to cache\n\t\t\tok := Cache.cache.Contains(contains.key)\n\t\t\tcontains.response <- containsRespStruct{ok}\n\t\t}\n\t}\n}", "title": "" } ]
a70797cdecb32aa5288e8e2e305f1ea6
GetId returns the Id of a provider
[ { "docid": "b18dc32874c891055578770eaab4c1c3", "score": "0.7719432", "text": "func (p *Provider) GetId() string {\n\treturn p.Id\n}", "title": "" } ]
[ { "docid": "528dde4fc8068d9338635775e176302c", "score": "0.7661389", "text": "func (p *Provider) Id() string {\n return p.Identifier\n}", "title": "" }, { "docid": "be3e4f10bbb454a4fb401f9341b89c38", "score": "0.699652", "text": "func (az Client) GetID() string {\n\treturn az.providerID\n}", "title": "" }, { "docid": "9b4453255016aebef08965026c4cad1a", "score": "0.66787857", "text": "func (p *Provider) GetProviderID() string {\n\treturn p.providerID\n}", "title": "" }, { "docid": "cf9f4462ac053bf463a2058057c752a8", "score": "0.65287447", "text": "func (p *Provider) GetKey() string {\n return \"prov:\" + p.Identifier\n}", "title": "" }, { "docid": "7021f90f7ad92c76d1c167ccd16cfec8", "score": "0.65260005", "text": "func (o *CanonicalFactsOut) GetProviderId() string {\n\tif o == nil || o.ProviderId.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ProviderId.Get()\n}", "title": "" }, { "docid": "54073c12897f430bccad349897b73af5", "score": "0.65043676", "text": "func (o *Subscription) GetProviderId() string {\n\tif o == nil || o.ProviderId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ProviderId\n}", "title": "" }, { "docid": "bcf9a849505f6cd6a9845fc1257d83e1", "score": "0.636342", "text": "func (r *References) GetProviderID() string {\n\tif r == nil || r.ProviderID == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.ProviderID\n}", "title": "" }, { "docid": "4894ad78b85e7aa09fbd69419bfc8443", "score": "0.63485855", "text": "func (t *TournamentStubService) Provider(pr *ProviderRegistration) (*int, *http.Response, error) {\n\treq, err := t.client.NewRequest(http.MethodPost, \"lol/tournament-stub/v3/providers\", pr)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar id *int\n\tresp, err := t.client.Do(req, id)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn id, resp, nil\n}", "title": "" }, { "docid": "b795cc4ea04fcf133986a682e721123f", "score": "0.6344224", "text": "func (o FieldLevelEncryptionProfileEncryptionEntitiesItemOutput) ProviderId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FieldLevelEncryptionProfileEncryptionEntitiesItem) string { return v.ProviderId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e41c67734e32c96d25ea311981d3f034", "score": "0.63440436", "text": "func GetProvider(name string) IdentityProvider {\n\tswitch name {\n\tcase \"githubconfig\":\n\t\treturn github.InitializeProvider()\n\tcase \"shibbolethconfig\":\n\t\treturn shibboleth.InitializeProvider()\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "2769f290d4522f05535c43d619f4daac", "score": "0.6324154", "text": "func (s *sms) ID() string {\n\treturn providerID\n}", "title": "" }, { "docid": "6e5bd3c86ebe3fb1e2c3b637b6e068aa", "score": "0.6320369", "text": "func (tr *OpenIDConnectProvider) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "5ddbbc6ec69f6209d2fa9a7b168b0ab8", "score": "0.630626", "text": "func getInstanceIDfromProviderID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "title": "" }, { "docid": "0e21ff36c5d1fccff47015ad33066013", "score": "0.6305406", "text": "func getProviderID(nodeName string) string {\n\treturn \"aztools://\" + nodeName\n}", "title": "" }, { "docid": "1efb4b011aecb0a45d190ca806ffc484", "score": "0.6302062", "text": "func (p *OAuth2Provider) ID() string {\n\treturn p.IDString\n}", "title": "" }, { "docid": "4689896cb6a36dd53d13aae352e30d42", "score": "0.62985176", "text": "func (o *IdentityCredentialsOidcProvider) GetProvider() string {\n\tif o == nil || o.Provider == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Provider\n}", "title": "" }, { "docid": "beb588f2a6a6088af7cbf2e51888f1cb", "score": "0.6241933", "text": "func (c *Client) ProviderID() gitprovider.ProviderID {\n\treturn ProviderID\n}", "title": "" }, { "docid": "730b8ef5dfaacbff3c115f7057c043dd", "score": "0.62368685", "text": "func (d *DB) GetProvider(ipAddress string) (string, error) {\n\tdata, err := d.query(ipAddress, provider)\n\treturn data.Provider, err\n}", "title": "" }, { "docid": "215d6dbb8e4a5e156380bf632b166fac", "score": "0.62317145", "text": "func (co *PlatformAppCommunication) GetEmailProviderById(ID string) (EmailProvider, error) {\n var (\n rawRequest *RawRequest\n response []byte\n err error\n getEmailProviderByIdResponse EmailProvider\n\t )\n\n \n\n \n\n \n \n \n \n \n \n \n //API call\n rawRequest = NewRequest(\n co.config,\n \"get\",\n fmt.Sprintf(\"/service/platform/communication/v1.0/company/%s/application/%s/email/providers/%s\",co.CompanyID, co.ApplicationID, ID),\n nil,\n nil,\n nil)\n response, err = rawRequest.Execute()\n if err != nil {\n return EmailProvider{}, err\n\t }\n \n err = json.Unmarshal(response, &getEmailProviderByIdResponse)\n if err != nil {\n return EmailProvider{}, common.NewFDKError(err.Error())\n }\n return getEmailProviderByIdResponse, nil\n \n }", "title": "" }, { "docid": "3491d5388543f3480da267cc6b95ae64", "score": "0.62196213", "text": "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "title": "" }, { "docid": "f99ab249118d142b246eec8099488b97", "score": "0.61849004", "text": "func (m *Machine) ProviderID() string {\n\treturn fmt.Sprintf(\"docker:////%s\", m.ContainerName())\n}", "title": "" }, { "docid": "d7757add3d70bb48e7d28f726aca1f87", "score": "0.6147028", "text": "func (m *MachinePoolScope) GetProviderID() string {\n\tif m.AWSMachinePool.Spec.ProviderID != \"\" {\n\t\treturn m.AWSMachinePool.Spec.ProviderID\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "04737f9ccf80f23798d18c8feee0d463", "score": "0.6131469", "text": "func (tr *AccessKey) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "0b5cc4c7ca896dcacebe9b95a65e1b00", "score": "0.6131384", "text": "func (m *MachineScope) GetProviderID() string {\n\tif m.PacketMachine.Spec.ProviderID != nil {\n\t\treturn *m.PacketMachine.Spec.ProviderID\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "79108ba002da9fc77417e1c73b6a4f2c", "score": "0.6129104", "text": "func (p *PaymentsPaymentReceipt) GetProviderID() (value int64) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.ProviderID\n}", "title": "" }, { "docid": "423b4d8cb2442ac467f8af2f18cac23f", "score": "0.6128256", "text": "func GetProvider(ctx context.Context) Provider {\n\tp := ctx.Value(clientKey)\n\tif p == nil {\n\t\treturn ErrorProvider{}\n\t}\n\treturn p.(Provider)\n}", "title": "" }, { "docid": "5f968264a0aaa7a1d869dd29e4855221", "score": "0.6108812", "text": "func Provider(p paymentpb.PaymentProviderId) Interface {\n\tmtx.Lock()\n\tdefer mtx.Unlock()\n\tif v, ok := providers[p]; ok {\n\t\treturn v\n\t}\n\tlog.Panicf(\"payment provider %s isn't registered\", p.String())\n\treturn nil\n}", "title": "" }, { "docid": "421b0c7600824decc4557deb69639c9f", "score": "0.60895073", "text": "func (d *dispatcher) GetProvider(_type string) (provider Provider, exist bool) {\n\tprovider, exist = d.providers[_type]\n\treturn\n}", "title": "" }, { "docid": "a5340cfd026b887c1d7901ea6fcfe868", "score": "0.60737395", "text": "func (m *EducationOneRosterApiDataProvider) GetProviderName()(*string) {\n val, err := m.GetBackingStore().Get(\"providerName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "f82422d1d29394550ff85f2d357890d6", "score": "0.606576", "text": "func (tr *Instance) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "5adbb566c852b92fb58ebea175725c27", "score": "0.6046924", "text": "func (o *OauthProviderSetting) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\treturn \"\"\n\t}\n\treturn *o.Id\n}", "title": "" }, { "docid": "f0d84b20ab8613c79ba733eb7ef0d541", "score": "0.60240126", "text": "func (o GetExtensionProvidersResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetExtensionProvidersResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4f3494c900d3e0aad655533a36a4608d", "score": "0.60223067", "text": "func (r *Repository) GetByID(id uint) (*domain.Provider, error) {\n\tif id == 0 {\n\t\treturn nil, ErrEmptyIDParam\n\t}\n\n\tm := &model.Provider{\n\t\tID: id,\n\t}\n\tif err := r.db.Take(m).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tp, err := m.ToDomain()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "title": "" }, { "docid": "e373162cb7e2ff9fb3ed18f139e87902", "score": "0.60214144", "text": "func (o *DepositCreate) GetProvider() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Provider\n}", "title": "" }, { "docid": "d856707868d0b8e1076495594682a821", "score": "0.6017135", "text": "func (a apiProduct) Provider() string {\n\treturn a.provider\n}", "title": "" }, { "docid": "d856707868d0b8e1076495594682a821", "score": "0.6017135", "text": "func (a apiProduct) Provider() string {\n\treturn a.provider\n}", "title": "" }, { "docid": "3bb240844d49bb25d48a56eef9a16237", "score": "0.6010626", "text": "func (tr *EBSVolume) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "99bf9f15a3730d49c9d6f743dfe9e504", "score": "0.6004821", "text": "func (c *hetznerCloudImplementation) ProviderID() kops.CloudProviderID {\n\treturn kops.CloudProviderHetzner\n}", "title": "" }, { "docid": "1780b627d55d9ade67e60957bf8f8cf4", "score": "0.6004439", "text": "func GetProvider(issuer string) model.Provider {\n\tif p, ok := fileProviderByIssuer[issuer]; ok {\n\t\treturn p\n\t}\n\tif config.Get().Features.Federation.Enabled {\n\t\treturn oidcfed.GetOIDCFedProvider(issuer)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4f15c6edc3560d50e6ca2201d5fe7e1", "score": "0.6002225", "text": "func (tr *Database) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "50a000e755f13ff15ada5508f7b3c168", "score": "0.60018885", "text": "func (istruct *ProviderInfrastructure) GetSingleByID(id int) (models.Provider, error) {\n\tif isDbUpdated(istruct.rows, istruct.lastUpdate) {\n\t\tfor _, provider := range istruct.providerDb {\n\t\t\tif id == provider.ID {\n\t\t\t\treturn provider, nil\n\t\t\t}\n\t\t}\n\t\treturn models.Provider{}, fmt.Errorf(\"Provider with ID %d not found\", id)\n\t}\n\n\tdb, err := openDb()\n\tif err != nil {\n\t\treturn models.Provider{}, err\n\t}\n\tdefer db.Close()\n\n\tstatement, err := db.Prepare(fmt.Sprintf(\"SELECT * FROM %s WHERE ID = ?;\", istruct.tableName))\n\tif err != nil {\n\t\treturn models.Provider{}, err\n\t}\n\tdefer statement.Close()\n\n\trow := statement.QueryRow(id)\n\n\tvar provider models.Provider\n\terr = row.Scan(&provider.ID, &provider.Name, &provider.Contact)\n\tif err == nil {\n\t\treturn provider, nil\n\t}\n\treturn models.Provider{}, err\n}", "title": "" }, { "docid": "b802a9b600b200c8f192b521bfce104b", "score": "0.599088", "text": "func (a *Client) GetAuthOidcProvidersProviderID(params *GetAuthOidcProvidersProviderIDParams) (*GetAuthOidcProvidersProviderIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAuthOidcProvidersProviderIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetAuthOidcProvidersProviderID\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/auth/oidc/providers/{provider-id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetAuthOidcProvidersProviderIDReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetAuthOidcProvidersProviderIDOK), nil\n\n}", "title": "" }, { "docid": "69ac7ffdfa45ea50f15b7159bd423dba", "score": "0.59644234", "text": "func (tr *User) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "69ac7ffdfa45ea50f15b7159bd423dba", "score": "0.59644234", "text": "func (tr *User) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "a7a2cb565d2d231883f35b8f1e18b078", "score": "0.5955285", "text": "func (p *Provider) Get(ctx context.Context, id string) (i *database.Image, err error) {\n\treturn nil, fmt.Errorf(\"get error\")\n}", "title": "" }, { "docid": "bf64c3721482f2cc6838a603ffd64f60", "score": "0.5952657", "text": "func (auth Driver) GetProvider() Provider {\n\treturn auth.provider\n}", "title": "" }, { "docid": "b869945454fe2355ba56021c88665ae0", "score": "0.59471166", "text": "func (tr *SourceRepresentationInstance) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "86d4f80362e235de73ce1f6539879e09", "score": "0.59447914", "text": "func (o *ExternalIdentity) GetProvider() string {\n\tif o == nil || o.Provider == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Provider\n}", "title": "" }, { "docid": "bb7909bc45f88c8946a89a78b5d0d070", "score": "0.59375745", "text": "func (tr *Policy) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "be15d81931abd7d132c1d32cf9eaf7f8", "score": "0.5934967", "text": "func (tr *EIP) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "d4fcc9dd1ad2ac19b68e20660af0d963", "score": "0.59149987", "text": "func (o NodeSpecPatchOutput) ProviderID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeSpecPatch) *string { return v.ProviderID }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d2f21fdaaef21dd174266c4f60c67280", "score": "0.5903931", "text": "func (o GetSamlProvidersResultOutput) Id() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSamlProvidersResult) string { return v.Id }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fbd8aefd12f584a5381931089370f2de", "score": "0.5884454", "text": "func (tr *Group) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "5c5f946773eb52bac1acfa4061155dc6", "score": "0.5866762", "text": "func (tr *SecurityGroup) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "c3f3d8840fbbe13c4222d561faf8a890", "score": "0.5861551", "text": "func (s *Server) ProviderGetByUuid(\n\tctx context.Context,\n\treq *pb.ProviderGetByUuidRequest,\n) (*pb.Provider, error) {\n\tif req.Uuid == \"\" {\n\t\treturn nil, ErrUuidRequired\n\t}\n\trec, err := s.store.ProviderGetByUuid(req.Uuid)\n\tif err != nil {\n\t\tif err == errors.ErrNotFound {\n\t\t\treturn nil, ErrNotFound\n\t\t}\n\t\ts.log.ERR(\n\t\t\t\"failed to get provider with UUID %s from storage: %s\",\n\t\t\treq.Uuid, err,\n\t\t)\n\t\treturn nil, ErrUnknown\n\t}\n\treturn rec.Provider, nil\n}", "title": "" }, { "docid": "f5c94444c6ccbf74137405cad67f03e3", "score": "0.5849357", "text": "func (o NodeSpecOutput) ProviderID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeSpec) *string { return v.ProviderID }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0756c14071e95656440c76e6c9d7043e", "score": "0.58420694", "text": "func (tr *KubernetesClusterNodePool) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "b5a13468c7da80e487f833dac032a76a", "score": "0.5838996", "text": "func (tr *NetworkInterface) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "31c27b5b20380c711bc1b8025a8efc8a", "score": "0.5838081", "text": "func (co *PlatformAppCommunication) GetSmsProviderById(ID string) (SmsProvider, error) {\n var (\n rawRequest *RawRequest\n response []byte\n err error\n getSmsProviderByIdResponse SmsProvider\n\t )\n\n \n\n \n\n \n \n \n \n \n \n \n //API call\n rawRequest = NewRequest(\n co.config,\n \"get\",\n fmt.Sprintf(\"/service/platform/communication/v1.0/company/%s/application/%s/sms/providers/%s\",co.CompanyID, co.ApplicationID, ID),\n nil,\n nil,\n nil)\n response, err = rawRequest.Execute()\n if err != nil {\n return SmsProvider{}, err\n\t }\n \n err = json.Unmarshal(response, &getSmsProviderByIdResponse)\n if err != nil {\n return SmsProvider{}, common.NewFDKError(err.Error())\n }\n return getSmsProviderByIdResponse, nil\n \n }", "title": "" }, { "docid": "4d187e4387e3c621b2e95a32e2a21b98", "score": "0.5832571", "text": "func (tr *InstanceProfile) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "45b32e7b5fabb8a69a16364c872d13c5", "score": "0.58153826", "text": "func (o *DepositDetail) GetProvider() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Provider\n}", "title": "" }, { "docid": "ea7313c9320756848cdd5c857acc296e", "score": "0.58149767", "text": "func (tr *DatabaseInstance) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "adbc65786ecfcb38c554a4c90eb21add", "score": "0.5811859", "text": "func ID() reference.ExtractValueFn {\n\treturn func(mg resource.Managed) string {\n\t\tcr, ok := mg.(*rcv2.ResourceInstance)\n\t\tif !ok {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn cr.Status.AtProvider.ID\n\t}\n}", "title": "" }, { "docid": "a4abead0fdfc81ac30a9c5f3211d149a", "score": "0.57995874", "text": "func (c *Carton) Provider() string {\n\treturn c.name\n}", "title": "" }, { "docid": "eefbb9da6a8523b3f3b264a31db93c78", "score": "0.5791669", "text": "func (c *SubCIDOffer) GetProviderID() string {\n\treturn c.providerID\n}", "title": "" }, { "docid": "97be6a501c4f65d0582629d1276e4981", "score": "0.5780294", "text": "func (tr *InternetGateway) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "d67db7f84a12c78d0841b65b29d4172b", "score": "0.5769244", "text": "func (tr *VPCEndpoint) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "b86b1bc1a8ccbf856b03880b88d13898", "score": "0.5765038", "text": "func (r *Repository) GetOne(pType, urn string) (*domain.Provider, error) {\n\tif pType == \"\" {\n\t\treturn nil, ErrEmptyProviderType\n\t}\n\tif urn == \"\" {\n\t\treturn nil, ErrEmptyProviderURN\n\t}\n\n\tm := &model.Provider{\n\t\tType: pType,\n\t\tURN: urn,\n\t}\n\tif err := r.db.Take(m).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tp, err := m.ToDomain()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, err\n}", "title": "" }, { "docid": "0b8caf393d667db71eac956a13c9fb78", "score": "0.5744849", "text": "func (db *_database) GetUserByProviderId(pid string, full bool) (*proto.User, error) {\n\tdb.logger.Log(\"method\", \"get_user_by_provider_id\", \"pid\", pid)\n\tif pid == \"\" {\n\t\treturn nil, errs.ErrNotFound\n\t}\n\tq := `\n\tSELECT users.key, \n\t\tusers.uid,\n\t\tusers.username,\n\t\tCASE WHEN $2 THEN users.full_name\n\t\t\tWHEN users.full_name_private THEN ''\n\t\t\tELSE users.full_name\n\t\tEND,\n\t\tusers.full_name_private,\n\t\tCASE WHEN $2 THEN users.email\n\t\t\tWHEN users.email_private THEN ''\n\t\t\tELSE users.email\n\t\tEND,\n\t\tusers.email_private,\n\t\tusers.picture_url,\n\t\tusers.biography,\n\t\tCOALESCE(upstreams.ident, ''),\n\t\tproviders.ident,\n\t\tusers.deleted_at IS NOT NULL,\n\t\tCASE WHEN users.password IS NULL OR users.password = '' THEN TRUE\n\t\t\tELSE FALSE\n\t\tEND\n\tFROM users\n\tINNER JOIN providers ON providers.uid = users.provider AND providers.deleted_at IS NULL\n\tLEFT JOIN upstreams ON upstreams.uid = users.upstream AND upstreams.deleted_at IS NULL\n\tWHERE users.provider_id = $1\n\tORDER BY users.created_at DESC\n\tLIMIT 1\n\t`\n\tu := &proto.User{ProviderId: pid}\n\tvar t bool\n\terr := db.conn.QueryRow(q, pid, full).Scan(\n\t\t&u.Key,\n\t\t&u.Uid,\n\t\t&u.Username,\n\t\t&u.FullName,\n\t\t&u.FullNamePrivate,\n\t\t&u.Email,\n\t\t&u.EmailPrivate,\n\t\t&u.PictureUrl,\n\t\t&u.Biography,\n\t\t&u.Upstream,\n\t\t&u.Provider,\n\t\t&t,\n\t\t&u.HasPassword,\n\t)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\treturn nil, errs.ErrNotFound\n\tcase err != nil:\n\t\treturn nil, err\n\t}\n\tif t {\n\t\tu.DeletedAt = \"true\"\n\t} else {\n\t\tu.DeletedAt = \"\"\n\t}\n\tu.PictureUrl = db.avatarURL(u.Uid)\n\treturn u, nil\n}", "title": "" }, { "docid": "3444d0e549b70bdcbe8f18938e488f00", "score": "0.5743999", "text": "func (tr *VPC) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "f0a75128f939b9dadbf108b0a5720a8d", "score": "0.57367325", "text": "func (_Users *usersCaller) GetId(ctx context.Context, owner common.Address) ([8]byte, error) {\n\tvar (\n\t\tret0 = new([8]byte)\n\t)\n\tout := ret0\n\n\terr := _Users.contract.Call(&bind.CallOpts{Context: ctx}, out, \"getId\", owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a022ba38d5a116d3118a49f060f7707d", "score": "0.57260823", "text": "func (k Keeper) Get(ctx sdk.Context, id sdk.Address) (types.Provider, bool) {\n\tstore := ctx.KVStore(k.skey)\n\tkey := providerKey(id)\n\n\tif !store.Has(key) {\n\t\treturn types.Provider{}, false\n\t}\n\n\tbuf := store.Get(key)\n\tvar val types.Provider\n\tk.cdc.MustUnmarshal(buf, &val)\n\treturn val, true\n}", "title": "" }, { "docid": "28e23dc0caa136a681764adc847818c5", "score": "0.5721871", "text": "func (m *ResponsibleSensitiveType) 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": "a7bc4791d84b31d6d63a0b9bccadbdbd", "score": "0.57212687", "text": "func GetUserID(provider, providerUserID string) string {\n\treturn provider + \"/\" + providerUserID\n}", "title": "" }, { "docid": "a7bc4791d84b31d6d63a0b9bccadbdbd", "score": "0.57212687", "text": "func GetUserID(provider, providerUserID string) string {\n\treturn provider + \"/\" + providerUserID\n}", "title": "" }, { "docid": "0c8ea5cd80c6458f49d0b4237a7852e1", "score": "0.5717869", "text": "func (m *MockProvider) GetID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "0c8ea5cd80c6458f49d0b4237a7852e1", "score": "0.5717869", "text": "func (m *MockProvider) GetID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "c8a49ac99f88d9bb0a35bc0ba6010127", "score": "0.57149065", "text": "func GetProvider(typ uint8) providers.Method {\n\tregistryMu.RLock()\n\tdefer registryMu.RUnlock()\n\tp, found := eapProviderRegistry[typ]\n\tif found {\n\t\treturn p\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7da1a1905e656ef4ccf860ffc1c9ffda", "score": "0.57128465", "text": "func (repo authProviderRepository) GetByUserID(id uint64) (*models.AuthProvider, *apperror.AppError) {\n\tmodel := &models.AuthProvider{}\n\n\tif err := repo.Store.Where(\"user_id = ?\", id).Find(model).Error; err != nil {\n\t\treturn nil, apperror.New(ecode.ErrUnableToFetchAuthCode, err, ecode.ErrUnableToFetchAuthMsg)\n\t}\n\treturn model, nil\n}", "title": "" }, { "docid": "cc36d5a964ccc3c1859dde7907298f0b", "score": "0.57118005", "text": "func (o NodeSpecPtrOutput) ProviderID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeSpec) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProviderID\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eb96e136cb40f2e877f84fc4a46e0f49", "score": "0.57049215", "text": "func (o *CloudProvider) GetIDByName() (string, error) {\n\tif o.Name == \"\" {\n\t\treturn \"\", fmt.Errorf(\"CloudProvider name must be provided\")\n\t}\n\tif o.CloudAccountID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"CloudProvider account id must be provided\")\n\t}\n\n\tresult, err := o.Query()\n\tif err != nil {\n\t\terrmsg := fmt.Sprintf(\"Error retrieving cloud provider: %s\", err)\n\t\tlogger.Errorf(errmsg)\n\t\treturn \"\", fmt.Errorf(errmsg)\n\t}\n\to.ID = result[\"ID\"].(string)\n\n\treturn o.ID, nil\n}", "title": "" }, { "docid": "1c57ea9a32122bc444c48752ae572d42", "score": "0.570492", "text": "func serviceIDForProvider(provider *atlas.Provider) string {\n\treturn fmt.Sprintf(\"%s-service-%s\", idPrefix, strings.ToLower(provider.Name))\n}", "title": "" }, { "docid": "099551bec6fe3bb512bc9e4b3fb8cfdd", "score": "0.57040244", "text": "func (o *Subscription) GetProviderIdOk() (*string, bool) {\n\tif o == nil || o.ProviderId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ProviderId, true\n}", "title": "" }, { "docid": "679be7580da3fe0b7765d24031970220", "score": "0.5702525", "text": "func (p Providers) Get(providerName string) (Provider, error) {\n\tfor _, provider := range p {\n\t\tif provider.Name() == providerName {\n\t\t\treturn provider, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"could not find a provider named `%s`\", providerName)\n}", "title": "" }, { "docid": "32553b0f28889c382bb49deefe4c8381", "score": "0.5700304", "text": "func providerIDFromKubeadmConfig(ctx context.Context, mgmtClient client.Client, namespace, name string) (string, error) {\n\tkubeadmConfig := new(bootstrapv1.KubeadmConfig)\n\tkey := client.ObjectKey{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n\n\tif err := mgmtClient.Get(ctx, key, kubeadmConfig); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get bootstrap resource: %w\", err)\n\t}\n\n\t// providerid being set explicitly in the InitConfiguration\n\tif kubeadmConfig.Spec.InitConfiguration != nil && kubeadmConfig.Spec.InitConfiguration.NodeRegistration.KubeletExtraArgs != nil {\n\t\tif value, ok := kubeadmConfig.Spec.InitConfiguration.NodeRegistration.KubeletExtraArgs[\"provider-id\"]; ok {\n\t\t\tif parsed, err := noderefutil.NewProviderID(value); err == nil {\n\t\t\t\treturn parsed.CloudProvider(), nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// providerid being set explicitly in the JoinConfiguration\n\tif kubeadmConfig.Spec.JoinConfiguration != nil && kubeadmConfig.Spec.JoinConfiguration.NodeRegistration.KubeletExtraArgs != nil {\n\t\tif value, ok := kubeadmConfig.Spec.JoinConfiguration.NodeRegistration.KubeletExtraArgs[\"provider-id\"]; ok {\n\t\t\tif parsed, err := noderefutil.NewProviderID(value); err == nil {\n\t\t\t\treturn parsed.CloudProvider(), nil\n\t\t\t}\n\t\t}\n\t}\n\n\t// inspect postkubeadmcommands\n\tfor i := range kubeadmConfig.Spec.PostKubeadmCommands {\n\t\tif strings.Contains(kubeadmConfig.Spec.PostKubeadmCommands[i], \"github.com/packethost/packet-ccm\") {\n\t\t\treturn deprecatedProviderIDPrefix, nil\n\t\t}\n\n\t\tif strings.Contains(kubeadmConfig.Spec.PostKubeadmCommands[i], \"github.com/equinix/cloud-provider-equinix-metal\") {\n\t\t\treturn providerIDPrefix, nil\n\t\t}\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "9e0729b508648db13d095c2265589ec6", "score": "0.5697568", "text": "func (this *BaseInfo)GetId() int64 {\n return this._id\n }", "title": "" }, { "docid": "98da36ce41b53a0b23bfd444ac2c94c5", "score": "0.5694324", "text": "func (o *ClusterCloudProviderInfoRequestCredentials) 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": "fa316079fee89ebbcc17433deb3abac5", "score": "0.5689072", "text": "func (m *CustomerPayment) 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": "4670b7f4021a9410385219570527dfc0", "score": "0.56874895", "text": "func GetProvider(name string) (Provider, error) {\n\tprovidersMutex.Lock()\n\tdefer providersMutex.Unlock()\n\tf, found := providers[name]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"provider %s is not registered\", name)\n\t}\n\treturn f()\n}", "title": "" }, { "docid": "16025d873f2e212571f0cdf66f6a1531", "score": "0.56727165", "text": "func (tr *IOTHubSharedAccessPolicy) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "cb2647030dfb4b0b066cca93ad9744dc", "score": "0.56636214", "text": "func (c *ClusterV2) GetProvider() string {\n\treturn c.Spec.Provider\n}", "title": "" }, { "docid": "abe83bba414bdec5fa87c63871d1cb29", "score": "0.5660091", "text": "func (k *Keeper) GetProvider(ctx sdk.Context, addr hubtypes.ProvAddress) (provider types.Provider, found bool) {\n\tprovider, found = k.GetActiveProvider(ctx, addr)\n\tif found {\n\t\treturn\n\t}\n\n\tprovider, found = k.GetInactiveProvider(ctx, addr)\n\tif found {\n\t\treturn\n\t}\n\n\treturn provider, false\n}", "title": "" }, { "docid": "81f93dde9c6c2b55534f2cc05f3ab50f", "score": "0.56584567", "text": "func (s *SMTP) ID() string {\n\treturn providerID\n}", "title": "" }, { "docid": "ed8f92f810c45e86c6c0ffe6738f51a9", "score": "0.565564", "text": "func (tr *RouteTable) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "fd739924a823ac52297dbf52c7f72dbe", "score": "0.5650543", "text": "func (tr *IOTHubConsumerGroup) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "df1b092265232998347463acde19e54b", "score": "0.5649091", "text": "func (m *ImageType) GetProvider() string {\n\tif m != nil {\n\t\treturn m.Provider\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "3e3d05d52f49bf89e61a9cfb1b1393e8", "score": "0.5638555", "text": "func GetProvider(dst, provider string, req Constraints, pluginProtocolVersion uint) error {\n\tversions, err := listProviderVersions(provider)\n\t// TODO: return multiple errors\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(versions) == 0 {\n\t\treturn fmt.Errorf(\"no plugins found for provider %q\", provider)\n\t}\n\n\tversions = allowedVersions(versions, req)\n\tif len(versions) == 0 {\n\t\treturn fmt.Errorf(\"no version of %q available that fulfills constraints %s\", provider, req)\n\t}\n\n\t// sort them newest to oldest\n\tVersions(versions).Sort()\n\n\t// take the first matching plugin we find\n\tfor _, v := range versions {\n\t\turl := providerURL(provider, v.String())\n\t\tlog.Printf(\"[DEBUG] fetching provider info for %s version %s\", provider, v)\n\t\tif checkPlugin(url, pluginProtocolVersion) {\n\t\t\tlog.Printf(\"[DEBUG] getting provider %q version %q at %s\", provider, v, url)\n\t\t\treturn getter.Get(dst, url)\n\t\t}\n\n\t\tlog.Printf(\"[INFO] incompatible ProtocolVersion for %s version %s\", provider, v)\n\t}\n\n\treturn fmt.Errorf(\"no versions of %q compatible with the plugin ProtocolVersion\", provider)\n}", "title": "" }, { "docid": "4c292c460c0c76d0f17b0fb66822e148", "score": "0.56355435", "text": "func (tr *IOTHub) GetID() string {\n\tif tr.Status.AtProvider.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn *tr.Status.AtProvider.ID\n}", "title": "" }, { "docid": "374b7968efeab2be19059af48c45cfc0", "score": "0.5633839", "text": "func (o NodeSpecPatchPtrOutput) ProviderID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeSpecPatch) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProviderID\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "70d8e6c38d031fec693a9cfefff9d6a6", "score": "0.561279", "text": "func GetProvider(kind string, path string) Provider {\n\tswitch strings.ToLower(kind) {\n\tcase \"db\":\n\t\td := &DBConf{}\n\t\td.fileName = path\n\t\terr := d.initDB()\n\t\tif err != nil {\n\t\t\tlogrus.Error(err)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn d\n\n\t}\n\n\tlogrus.Errorf(\"Unknown config provider type %s\", kind)\n\treturn nil\n}", "title": "" } ]
d7c56e007d289fbb4f06236d8fa6ffd5
NewString returns new string value containing s. The returned string is valid until Reset is called on a.
[ { "docid": "27d91572aedea7d0ef11146aa7489c42", "score": "0.6584852", "text": "func (a *Arena) NewString(s string) *Value {\n\tv := a.c.getValue()\n\tv.t = typeRawString\n\tbLen := len(a.b)\n\ta.b = escapeString(a.b, s)\n\tv.s = b2s(a.b[bLen+1 : len(a.b)-1])\n\treturn v\n}", "title": "" } ]
[ { "docid": "380ee6772bb3403505fa916f666bdd25", "score": "0.70362365", "text": "func NewString(s string) *string { return &s }", "title": "" }, { "docid": "ee3435e2138b699e8a657b27575a964e", "score": "0.66068095", "text": "func NewString(v String) *String { return &v }", "title": "" }, { "docid": "1429703f852cceb1c0ea6ac5933a928b", "score": "0.64524734", "text": "func String(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.6397682", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.6397682", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "dd77e2a1c3cc4ed4d57c2406dbdeaaf1", "score": "0.6397682", "text": "func String(s string) *string { return &s }", "title": "" }, { "docid": "d95113a9be8a561f53dd6e1b9640a95b", "score": "0.6332672", "text": "func NewString(v string) *string {\n\tres := v\n\treturn &res\n}", "title": "" }, { "docid": "c0b5522f6d188dbcaea2cd770904cbda", "score": "0.6241359", "text": "func String(s string) *string { return Ptr(s) }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "37680c4f3161675779a23e01482a8f5b", "score": "0.6180456", "text": "func String(v string) *string { return &v }", "title": "" }, { "docid": "b0dc3169c78547deef0ec5db93f8447d", "score": "0.61730385", "text": "func NewString() Sophier {\n\treturn new(String)\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "8ae83a54c2d2195ebae6eb779f719684", "score": "0.6137776", "text": "func String(v string) *string {\n\tp := new(string)\n\t*p = v\n\treturn p\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "b7f20ef021e3808bf2d89610aae354e6", "score": "0.6124968", "text": "func String(v string) *string {\n\treturn &v\n}", "title": "" }, { "docid": "841e7eb8c6cb7c5a2b4adf425711b837", "score": "0.60848266", "text": "func String(s string) *string {\n\tp := s\n\treturn &p\n}", "title": "" }, { "docid": "413fd3f7855e86f26aa0c64661772339", "score": "0.5898525", "text": "func String(b []byte) MutableString {\n\treturn *(*MutableString)(unsafe.Pointer(&b))\n}", "title": "" }, { "docid": "3b044f1eaf51abcf65da6353c6629bf6", "score": "0.58546", "text": "func NewString(into *string, v string) *StringValue {\n\t*into = v\n\treturn (*StringValue)(into)\n}", "title": "" }, { "docid": "a62f1160b5f9733b103caff530d55998", "score": "0.5849499", "text": "func NewString(val string) *String {\n\taddr := &String{}\n\taddr.Store(val)\n\treturn addr\n}", "title": "" }, { "docid": "8dc3068b9c92c0be7790e37ae4bda098", "score": "0.5848369", "text": "func NewString(aString string, env *Thingy) *Thingy {\n\tt := newThingy()\n\tt.tiipe = \"STRING\"\n\tt.subType = \"NATIVE\"\n\tt.setString(aString)\n\tt.environment = nil\n\tt._stub = func(e *Engine, c *Thingy) *Engine {\n\t\tne := cloneEngine(e, false)\n\t\tne.dataStack = pushStack(ne.dataStack, c)\n\t\t//fmt.Printf(\"StringStep: %v\\n\", c._source)\n\t\treturn ne\n\t}\n\tt.arity = -1\n\tseqID = seqID + 1\n\tt._id = seqID\n\treturn t\n}", "title": "" }, { "docid": "9544dfc50309dab26ce63d659118057e", "score": "0.5841321", "text": "func NewString() *String {\n\treturn &String{}\n}", "title": "" }, { "docid": "a32cb5c7f5b7e5320387f2dac681eb0a", "score": "0.58282554", "text": "func NewString(s string) Value {\n\tsh := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\treturn Value{typ: StringType, p: unsafe.Pointer(sh.Data), v: uint64(sh.Len)}\n}", "title": "" }, { "docid": "c18c399a75336914b6ae2e4e880ecc03", "score": "0.5793944", "text": "func String(str string) *string {\n\treturn &str\n}", "title": "" }, { "docid": "c18c399a75336914b6ae2e4e880ecc03", "score": "0.5793944", "text": "func String(str string) *string {\n\treturn &str\n}", "title": "" }, { "docid": "f45ccafc63ffbae710fada0263a3f41b", "score": "0.5791417", "text": "func NewString(v string) *string {\n\tvp := new(string)\n\t*vp = v\n\treturn vp\n}", "title": "" }, { "docid": "f887760530f5168126fa06ddb0ef01d3", "score": "0.57712317", "text": "func String(value string) *string {\n\treturn &value\n}", "title": "" }, { "docid": "a4b01a925a6254b0ade314652def81e5", "score": "0.5758738", "text": "func NewString(s string) String {\n\treturn String{sql.NullString{String: s, Valid: true}}\n}", "title": "" }, { "docid": "961d049da82e1610bba35e0a9637916e", "score": "0.5705614", "text": "func NewString() *String {\n\treturn &String{\n\t\tbuff: make([]byte, 4),\n\t}\n}", "title": "" }, { "docid": "bf7ad7becbca413b2eb525898496bc73", "score": "0.57026446", "text": "func toStringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "23564028ce51a4a6abadb36210a41069", "score": "0.56377196", "text": "func NewString(s string) Box {\n\tp := uintptr(unsafe.Pointer(&s))\n\tui64 := NaNMask | (uint64(tagString) << TagShift) | (uint64(p) & PayloadMask)\n\treturn *(*Box)(unsafe.Pointer(&ui64))\n}", "title": "" }, { "docid": "39fd2a78157d33003c1d37556a4e0228", "score": "0.558547", "text": "func newStringValue(val string, p *string) *stringValue {\n\t*p = val\n\treturn &stringValue{p, val}\n}", "title": "" }, { "docid": "73e9ad79c9858d2eb881f1d4da486c56", "score": "0.5577019", "text": "func NewString(s string) StringType {\n\treturn StringType(s)\n}", "title": "" }, { "docid": "d98ee5577300df92969cc8811e0a0ae9", "score": "0.55588156", "text": "func NewString() *String {\n\tstringTemp := String{\n\t\ttonCommon: tonCommon{Type: \"string\"},\n\t}\n\n\treturn &stringTemp\n}", "title": "" }, { "docid": "2ad16d134f8bd9fa3ca1195d95776129", "score": "0.5553357", "text": "func NewString(values ...string) *String {\n\ts := &String{}\n\ts.Add(values...)\n\treturn s\n}", "title": "" }, { "docid": "5efb3cd9cc27b89de143d6e519fe35d1", "score": "0.55526984", "text": "func String(s string) Value {\n\treturn stringValue(s)\n}", "title": "" }, { "docid": "e4157db5fddac60053c03cf342359a6d", "score": "0.5526823", "text": "func (c *Constructor) String(name string, value string, help string) *string {\n\tp := new(string)\n\tc.StringVar(p, name, value, help)\n\treturn p\n}", "title": "" }, { "docid": "a3e95aaa95e169d06464fdf8eaaa95e9", "score": "0.5472989", "text": "func NewString(name string) *expvar.String {\n\texisting := expvar.Get(statsPrefix + name)\n\tif existing != nil {\n\t\tif s, ok := existing.(*expvar.String); ok {\n\t\t\treturn s\n\t\t}\n\t\tpanic(fmt.Sprintf(\"%v is set to a non-string value\", name))\n\t}\n\treturn expvar.NewString(statsPrefix + name)\n}", "title": "" }, { "docid": "12305de463da2ffe1e66b3aaf32392cc", "score": "0.54693437", "text": "func String(val string) *string {\n\tif val == \"\" {\n\t\treturn nil\n\t}\n\treturn &val\n}", "title": "" }, { "docid": "5c01a18f1e2960ed22d68d3e443fc5a7", "score": "0.5426822", "text": "func NewString(s string) *StringContainer {\n\tstr := &StringContainer{}\n\n\tstr.update(s)\n\tstr.intVar = newIntVariant(s)\n\n\treturn str\n}", "title": "" }, { "docid": "e77b9571fd853e20ed079424b76cd1bb", "score": "0.54226196", "text": "func aiString(g string) *C.struct_aiString {\n\ts := (*C.struct_aiString)(C.calloc(1, C.size_t(len(g))))\n\ts.length = C.size_t(len(g))\n\tfor i, c := range g {\n\t\ts.data[i] = C.char(c)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "16d3cedc2a2245455017c36eec95a9c1", "score": "0.5421015", "text": "func String(s string) string {\n\treturn string(Bytes([]byte(s)))\n}", "title": "" }, { "docid": "a132c811083a23223eb9938c61128b09", "score": "0.5405688", "text": "func stringPtr(a string) *string {\n\treturn &a\n}", "title": "" }, { "docid": "c2e40d1729abdfe1325a567f8eff755d", "score": "0.5402668", "text": "func (s String) Clone() Value {\n\treturn s\n}", "title": "" }, { "docid": "878cd8515b29e0c528ec990131baee53", "score": "0.53968936", "text": "func stringPointer(s string) *string { return &s }", "title": "" }, { "docid": "a28cffe4be51d6d52efe3edaf214ad83", "score": "0.5392679", "text": "func NewString(items ...string) String {\n\tss := String{}\n\tss.Insert(items...)\n\treturn ss\n}", "title": "" }, { "docid": "575899fff30f1e4a0261b406e4a5331f", "score": "0.5376575", "text": "func NewString(id string) String {\n\treturn String{Base: Base{id: id}}\n}", "title": "" }, { "docid": "3315d82a0fb58b5ec767571696a7033d", "score": "0.53704584", "text": "func NewString(vals ...V) StringA {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.String(f.name, f.defv.(string), f.usage)\n\t}\n\n\tas := a.getA()\n\treturn func(s string) V {\n\t\treturn as(s)\n\t}\n}", "title": "" }, { "docid": "5bd79e6ecad07d0d101f1942b9b99fb2", "score": "0.53674346", "text": "func PtrString(v string) *string { return &v }", "title": "" }, { "docid": "a6daaca81ca746588b555377acfde9b3", "score": "0.5365965", "text": "func String(v string) Value {\n\treturn Value{&stringSource{value: v}}\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.5327366", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.5327366", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "e3041d72d3a8b5a6b668c7893f28513e", "score": "0.5327366", "text": "func StringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "e6a18339a4bbb0a9b4a094452646a564", "score": "0.5297475", "text": "func NewString(s string, valid bool) String {\n\treturn String{\n\t\tString: s,\n\t\tValid: valid,\n\t}\n}", "title": "" }, { "docid": "6c440339b9d58c22c1f1970af5c87883", "score": "0.5296878", "text": "func NewString(s string) String {\n\t// Escaping a string is complicated; we'll just piggyback off of the JSON\n\t// library while this is still a toy.\n\tdata, err := json.Marshal(s)\n\tif err != nil {\n\t\t// I don't think marshalling a string can fail, but let's fail hard if\n\t\t// it does.\n\t\tpanic(\"Unexpected string marshalling error: \" + err.Error())\n\t}\n\t// `data[1:len(data)-1]` because we want to get rid of the quotes, which\n\t// we'll add back on later. This is an artifact of using json.Marshal() to\n\t// escape the string.\n\treturn String{string(data[1 : len(data)-1])}\n}", "title": "" }, { "docid": "2e29e40e075c248b249512be9b07891f", "score": "0.5279572", "text": "func (s *Strings) String() string {\n\treturn fmt.Sprintf(\"%v\", *s)\n}", "title": "" }, { "docid": "cdc515428a18ea84be0020f3fa330a86", "score": "0.52776384", "text": "func NewString(localID, concrete string, val *string) *Attribute {\n\tattr := NewAttribute(localID, concrete, DTString, val)\n\treturn attr\n}", "title": "" }, { "docid": "8c804640ece8663b90b86b9f49940b69", "score": "0.5276975", "text": "func AString(s string, langID uint64) KGObject {\n\tb := new(kgObjectBuilder)\n\tb.resetAndWriteType(KtString, 1+len(s)+19)\n\tb.buff.WriteString(s)\n\tappendUInt64(&b.buff, 19, langID)\n\treturn KGObject{b.buff.String()}\n}", "title": "" }, { "docid": "adfea16e440ba981c83f0e820d3454f6", "score": "0.52634776", "text": "func (c *WriteChain) String(s string) *WriteChain {\n\treturn c.ByteSlice([]byte(s))\n}", "title": "" }, { "docid": "5c3ce789fb7ee2c27cf1564fd319f2e3", "score": "0.52451545", "text": "func NewString(value string) String {\n\treturn String{\n\t\tvalid: true,\n\t\tvalue: value,\n\t}\n}", "title": "" }, { "docid": "6d096606bc27152ef6ce6eb492627fad", "score": "0.52377707", "text": "func SimpleStringValue(s string) Value { return Value{typ: '+', str: []byte(formSingleLine(s))} }", "title": "" }, { "docid": "cb6d896600da46eea97099acfb8624ef", "score": "0.5231103", "text": "func String(s string) dgo.String {\n\treturn makeHString(s)\n}", "title": "" }, { "docid": "cb6d896600da46eea97099acfb8624ef", "score": "0.5231103", "text": "func String(s string) dgo.String {\n\treturn makeHString(s)\n}", "title": "" }, { "docid": "31ec7ec03430b47a139037721b7acb34", "score": "0.52143437", "text": "func NewStringPointer(str string) *string {\n\t//newstr := (str + \" \")[:len(str)]\n\tnewstr := str\n\treturn &newstr\n}", "title": "" }, { "docid": "0d7b2f76c6157ad8969bdbf60b029102", "score": "0.5213573", "text": "func stringPtr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "35396af43fead1fc1f8c349db8c85174", "score": "0.52110684", "text": "func (s LiteralString) String(c Ctx) (string, error) { return c.StaticPlaceholder(string(s)) }", "title": "" }, { "docid": "4bba71cfff092cf3124e360668e7fa67", "score": "0.5210254", "text": "func (tp String) NewString(data string) String {\n\treturn String(data)\n}", "title": "" }, { "docid": "863e48dc4db1d463476f607c57e7161a", "score": "0.51919013", "text": "func pStr(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "618c0e6b4875eb71b2ac6ed4a9eeba67", "score": "0.5180516", "text": "func StringCreate() String {\n return NewString( C.sfString_Create() )\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.51789707", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.51789707", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.51789707", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "4c74601cddb9a92011d333ca371d1531", "score": "0.5175528", "text": "func (s *String) Clone() Object {\n\treturn &String{Value: s.Value}\n}", "title": "" }, { "docid": "bbc77b482bb6933729ceb9a7fa93b16a", "score": "0.5163334", "text": "func NewStringValue(t int64, v string) Value { return NewRawStringValue(t, v) }", "title": "" }, { "docid": "b1552e23efe69b240a9ec3e559f368e7", "score": "0.51019984", "text": "func New() string {\n\treturn *randString(defaultLength)\n}", "title": "" }, { "docid": "3ba1831825f2beb9ea44508025cba2b5", "score": "0.5095861", "text": "func NewString(values ...interface{}) *Stack {\n\treturn New(containers.StringContainer(\"\"), values...)\n}", "title": "" }, { "docid": "0884131bab8e070c31df94dffeffa639", "score": "0.50921977", "text": "func (v *Value) String() string {\n\tb := v.MarshalTo(nil)\n\t// It is safe converting b to string without allocation, since b is no longer\n\t// reachable after this line.\n\treturn b2s(b)\n}", "title": "" }, { "docid": "54188bea0028118099300c0b36b39dc3", "score": "0.5090462", "text": "func StringP(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "54188bea0028118099300c0b36b39dc3", "score": "0.5090462", "text": "func StringP(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "54188bea0028118099300c0b36b39dc3", "score": "0.5090462", "text": "func StringP(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "f3c460a7bc0add917391398f0fbf6d9c", "score": "0.5086789", "text": "func ToString(a Value) (*String, error) {\n\tswitch p := a.(type) {\n\tcase *Character:\n\t\treturn NewString(string([]rune{p.Value})), nil\n\tcase *String:\n\t\treturn p, nil\n\tcase *Blob:\n\t\treturn NewString(string(p.Value)), nil\n\tcase *Symbol:\n\t\treturn NewString(p.Text), nil\n\tcase *Keyword:\n\t\treturn NewString(p.Name()), nil\n\tcase *Type:\n\t\treturn NewString(p.Name()), nil\n\tcase *Number:\n\t\treturn NewString(p.String()), nil\n\tcase *Boolean:\n\t\treturn NewString(p.String()), nil\n\tcase *Vector:\n\t\tvar chars []rune\n\t\tfor _, c := range p.Elements {\n\t\t\tif pc, ok := c.(*Character); ok {\n\t\t\t\tchars = append(chars, pc.Value)\n\t\t\t} else {\n\t\t\t\treturn nil, NewError(ArgumentErrorKey, \"to-string: vector element is not a <character>: \", c)\n\t\t\t}\n\t\t}\n\t\treturn NewString(string(chars)), nil\n\tcase *List:\n\t\tvar chars []rune\n\t\tfor p != EmptyList {\n\t\t\tc := p.Car\n\t\t\tif pc, ok := c.(*Character); ok {\n\t\t\t\tchars = append(chars, pc.Value)\n\t\t\t} else {\n\t\t\t\treturn nil, NewError(ArgumentErrorKey, \"to-string: list element is not a <character>: \", c)\n\t\t\t}\n\t\t\tp = p.Cdr\n\t\t}\n\t\treturn NewString(string(chars)), nil\n\tdefault:\n\t\treturn nil, NewError(ArgumentErrorKey, \"to-string: cannot convert argument to <string>: \", a)\n\t}\n}", "title": "" }, { "docid": "7248ae88029d7f704952d6f1aaa8342f", "score": "0.5080351", "text": "func MakeString(v string) String {\n\treturn String{isSet: true, val: v}\n}", "title": "" }, { "docid": "f38a9c84b0713540a314452b604aa43c", "score": "0.50739664", "text": "func String(input string) (output interface{}, err error) {\n\treturn input, nil\n}", "title": "" }, { "docid": "2fcf7638b7f92a8f8dd3015b0dc14cb4", "score": "0.5071718", "text": "func ToStringPtr(s string) *string {\n\treturn &s\n}", "title": "" } ]
e0e74c3f01b5bf6f2c07d9ad73e27bb2
ClearField clears the value for the given name. It returns an error if the field is not defined in the schema.
[ { "docid": "de09818972ca93e7548abf6cd48c84d1", "score": "0.0", "text": "func (m *QueueItemMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown QueueItem nullable field %s\", name)\n}", "title": "" } ]
[ { "docid": "43e1a5fe3d400d69a80618ff2ebc60dd", "score": "0.76755226", "text": "func (m *QccEnterpriseDataMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown QccEnterpriseData nullable field %s\", name)\n}", "title": "" }, { "docid": "e584288e23d7779c6b6a8aaee4f07c9f", "score": "0.76750916", "text": "func (m *FormMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Form nullable field %s\", name)\n}", "title": "" }, { "docid": "cb86490365b8f9c99400f69aad32f72d", "score": "0.7633773", "text": "func (m *CollectionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Collection nullable field %s\", name)\n}", "title": "" }, { "docid": "409431298868b800b53c5cbbeb0874fd", "score": "0.76292676", "text": "func (m *RentalMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Rental nullable field %s\", name)\n}", "title": "" }, { "docid": "7766222c92ef5419027ae3e69fe101c0", "score": "0.7607228", "text": "func (m *CardMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Card nullable field %s\", name)\n}", "title": "" }, { "docid": "7766222c92ef5419027ae3e69fe101c0", "score": "0.7607228", "text": "func (m *CardMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Card nullable field %s\", name)\n}", "title": "" }, { "docid": "9bc255ac1f28a7e94ff6160d80fec19e", "score": "0.7601104", "text": "func (m *AdminMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Admin nullable field %s\", name)\n}", "title": "" }, { "docid": "8070cf5a2a1f76d7416e074f65c68f7a", "score": "0.7599481", "text": "func (m *MedicalCareMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown MedicalCare nullable field %s\", name)\n}", "title": "" }, { "docid": "8070cf5a2a1f76d7416e074f65c68f7a", "score": "0.7599481", "text": "func (m *MedicalCareMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown MedicalCare nullable field %s\", name)\n}", "title": "" }, { "docid": "576ca13f762721a2ba688978193b0597", "score": "0.75915706", "text": "func (m *CounterMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Counter nullable field %s\", name)\n}", "title": "" }, { "docid": "acd7b5c2c705c8c28c84ec7cc936b81f", "score": "0.7566495", "text": "func (m *MetricsMutation) ClearField(name string) error {\n\tswitch name {\n\tcase metrics.FieldErrorCode:\n\t\tm.ClearErrorCode()\n\t\treturn nil\n\tcase metrics.FieldTransition:\n\t\tm.ClearTransition()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Metrics nullable field %s\", name)\n}", "title": "" }, { "docid": "a5ae019b75d528196c87e713ad984ba2", "score": "0.75599223", "text": "func (m *PaybackMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Payback nullable field %s\", name)\n}", "title": "" }, { "docid": "768cf7f2bd39a473b7af468b676e49ed", "score": "0.75591546", "text": "func (m *MedicalTypeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown MedicalType nullable field %s\", name)\n}", "title": "" }, { "docid": "56be55edf628dfac419ba43fbc39c49b", "score": "0.755907", "text": "func (m *GaugeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Gauge nullable field %s\", name)\n}", "title": "" }, { "docid": "bbf7dcc9fa9109a87029b9c7c23a62c0", "score": "0.7553173", "text": "func (m *DiseaseMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Disease nullable field %s\", name)\n}", "title": "" }, { "docid": "bbf7dcc9fa9109a87029b9c7c23a62c0", "score": "0.7553173", "text": "func (m *DiseaseMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Disease nullable field %s\", name)\n}", "title": "" }, { "docid": "bbf7dcc9fa9109a87029b9c7c23a62c0", "score": "0.7553173", "text": "func (m *DiseaseMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Disease nullable field %s\", name)\n}", "title": "" }, { "docid": "838a5b4953b4a6d7b49208358a554b67", "score": "0.75527173", "text": "func (m *FurnitureMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Furniture nullable field %s\", name)\n}", "title": "" }, { "docid": "09e680c576fec96f0391cef89bf04d4b", "score": "0.75505245", "text": "func (m *GraphMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Graph nullable field %s\", name)\n}", "title": "" }, { "docid": "ce09b38d4be907052eb4c1e7c49ce8fe", "score": "0.7549981", "text": "func (m *CompanyMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Company nullable field %s\", name)\n}", "title": "" }, { "docid": "b5f1d414519e73e46bde7a07ba3c6163", "score": "0.75473773", "text": "func (m *RecordinsuranceMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Recordinsurance nullable field %s\", name)\n}", "title": "" }, { "docid": "fa34ebf978e497a69232978c9d8442d3", "score": "0.7543855", "text": "func (m *MmedicineMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Mmedicine nullable field %s\", name)\n}", "title": "" }, { "docid": "9435a3d3995883d200b322b1ed82efe8", "score": "0.7531995", "text": "func (m *PricetypeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Pricetype nullable field %s\", name)\n}", "title": "" }, { "docid": "2faf222788a64d48c0608d61422c963e", "score": "0.75111616", "text": "func (m *WorkspaceMutation) ClearField(name string) error {\n\tswitch name {\n\tcase workspace.FieldDescription:\n\t\tm.ClearDescription()\n\t\treturn nil\n\tcase workspace.FieldMetadata:\n\t\tm.ClearMetadata()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Workspace nullable field %s\", name)\n}", "title": "" }, { "docid": "e0721cb2d6b0f1fdfbe31217ccba89c0", "score": "0.7510297", "text": "func (m *OAuthConnectionMutation) ClearField(name string) error {\n\tswitch name {\n\tcase oauthconnection.FieldCreatedBy:\n\t\tm.ClearCreatedBy()\n\t\treturn nil\n\tcase oauthconnection.FieldCreatedWith:\n\t\tm.ClearCreatedWith()\n\t\treturn nil\n\tcase oauthconnection.FieldUpdatedBy:\n\t\tm.ClearUpdatedBy()\n\t\treturn nil\n\tcase oauthconnection.FieldUpdatedWith:\n\t\tm.ClearUpdatedWith()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown OAuthConnection nullable field %s\", name)\n}", "title": "" }, { "docid": "005b9134682e3ec8f9176902e48c8dc6", "score": "0.75092727", "text": "func (m *StatusMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Status nullable field %s\", name)\n}", "title": "" }, { "docid": "c028c5f33684c3c7eadf3b773217d5d6", "score": "0.7507068", "text": "func (m *ExpertMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Expert nullable field %s\", name)\n}", "title": "" }, { "docid": "a99ead9d38de7c59e89347fd35ec12fd", "score": "0.75055885", "text": "func (m *MedicalfileMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Medicalfile nullable field %s\", name)\n}", "title": "" }, { "docid": "8acb25e0255f629ae8f06d1ee9dcb4f5", "score": "0.7496101", "text": "func (m *MetricMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Metric nullable field %s\", name)\n}", "title": "" }, { "docid": "3ef6b4290830839babead7b97b6b2f8a", "score": "0.74954975", "text": "func (m *FurnitureTypeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown FurnitureType nullable field %s\", name)\n}", "title": "" }, { "docid": "e19fbc887ff8377de4fedf699abaeb3d", "score": "0.7493421", "text": "func (m *CategoryMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Category nullable field %s\", name)\n}", "title": "" }, { "docid": "e19fbc887ff8377de4fedf699abaeb3d", "score": "0.7493421", "text": "func (m *CategoryMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Category nullable field %s\", name)\n}", "title": "" }, { "docid": "836478e0437eeff358fc284fe96841e5", "score": "0.7491939", "text": "func (m *OperationroomMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Operationroom nullable field %s\", name)\n}", "title": "" }, { "docid": "66de983cab081db0411aff685bfa1adc", "score": "0.74901175", "text": "func (m *TitleMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Title nullable field %s\", name)\n}", "title": "" }, { "docid": "0d4afbaf8e30854793a71f2254083a52", "score": "0.7484802", "text": "func (m *DataRoomMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown DataRoom nullable field %s\", name)\n}", "title": "" }, { "docid": "d871235bf4d39bb1c55a7904c1fd0edc", "score": "0.7475809", "text": "func (m *CounterStaffMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown CounterStaff nullable field %s\", name)\n}", "title": "" }, { "docid": "c23eecbdb81ded10cdce071c3e9a8fbf", "score": "0.74753493", "text": "func (m *StockManagerMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown StockManager nullable field %s\", name)\n}", "title": "" }, { "docid": "a16be01241e0be37c80b5472d21a199c", "score": "0.7471257", "text": "func (m *CardMutation) ClearField(name string) error {\n\tswitch name {\n\tcase card.FieldNumber:\n\t\tm.ClearNumber()\n\t\treturn nil\n\tcase card.FieldOwnerID:\n\t\tm.ClearOwnerID()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Card nullable field %s\", name)\n}", "title": "" }, { "docid": "68413f7f488743529f883fd3367ad5a4", "score": "0.74667406", "text": "func (m *AnswerMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Answer nullable field %s\", name)\n}", "title": "" }, { "docid": "ab2d4745884a74ef6b530184342274e8", "score": "0.74579304", "text": "func (m *DoctorMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Doctor nullable field %s\", name)\n}", "title": "" }, { "docid": "ab2d4745884a74ef6b530184342274e8", "score": "0.74579304", "text": "func (m *DoctorMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Doctor nullable field %s\", name)\n}", "title": "" }, { "docid": "bfc856bc99a6cffc8c90c77b57be134b", "score": "0.7453776", "text": "func (m *MoneytransferMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Moneytransfer nullable field %s\", name)\n}", "title": "" }, { "docid": "fbbca081c5a464c9c36cc2d34352056c", "score": "0.74533284", "text": "func (m *DentalexpenseMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Dentalexpense nullable field %s\", name)\n}", "title": "" }, { "docid": "2f2f3f944a98f750566ef50065e44c9b", "score": "0.74528515", "text": "func (m *ConstructionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Construction nullable field %s\", name)\n}", "title": "" }, { "docid": "7549b8c78fe0fc0dd3a9844c6dde995b", "score": "0.74524766", "text": "func (m *EmployeeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Employee nullable field %s\", name)\n}", "title": "" }, { "docid": "7549b8c78fe0fc0dd3a9844c6dde995b", "score": "0.74524766", "text": "func (m *EmployeeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Employee nullable field %s\", name)\n}", "title": "" }, { "docid": "c8b43718f8bbe60f2fe47ee2f39a8407", "score": "0.7450935", "text": "func (m *PrescriptionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Prescription nullable field %s\", name)\n}", "title": "" }, { "docid": "42d5149eb690d9ba5c2fa19f38564143", "score": "0.74500966", "text": "func (m *BankMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Bank nullable field %s\", name)\n}", "title": "" }, { "docid": "4f43f6b4ed23f742807116ceb157cc02", "score": "0.74494535", "text": "func (m *AmountpaidMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Amountpaid nullable field %s\", name)\n}", "title": "" }, { "docid": "e49cd70572ef2d3dc70963366d9363db", "score": "0.74477065", "text": "func (m *FoodMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Food nullable field %s\", name)\n}", "title": "" }, { "docid": "18763d8871552743c0c3143c49974910", "score": "0.7447182", "text": "func (m *OfficerMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Officer nullable field %s\", name)\n}", "title": "" }, { "docid": "f83748bd6860182182e061625c8de9ac", "score": "0.7444659", "text": "func (m *SystemmemberMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Systemmember nullable field %s\", name)\n}", "title": "" }, { "docid": "f657e2a6cbda456e11d09dfe8606f9eb", "score": "0.7440226", "text": "func (m *OperatingSystemMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown OperatingSystem nullable field %s\", name)\n}", "title": "" }, { "docid": "404fcb85d633e76b2373c28bce3e029a", "score": "0.7438826", "text": "func (m *CategoryMutation) ClearField(name string) error {\n\tswitch name {\n\tcase category.FieldName:\n\t\tm.ClearName()\n\t\treturn nil\n\tcase category.FieldPid:\n\t\tm.ClearPid()\n\t\treturn nil\n\tcase category.FieldIcon:\n\t\tm.ClearIcon()\n\t\treturn nil\n\tcase category.FieldDesc:\n\t\tm.ClearDesc()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Category nullable field %s\", name)\n}", "title": "" }, { "docid": "4518976d67df2aebb871845a018aed27", "score": "0.74328554", "text": "func (m *NurseMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Nurse nullable field %s\", name)\n}", "title": "" }, { "docid": "766e77cb164c01d00dff1daa4a4d1a25", "score": "0.74271774", "text": "func (m *LabelMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Label nullable field %s\", name)\n}", "title": "" }, { "docid": "674cfa51839020320c17ca8873d1cc05", "score": "0.74210596", "text": "func (m *InquiryMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Inquiry nullable field %s\", name)\n}", "title": "" }, { "docid": "873bfe01c7a59713b6fd953eca9990a1", "score": "0.742072", "text": "func (m *HistogramMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Histogram nullable field %s\", name)\n}", "title": "" }, { "docid": "5b5da0a2f70990ffc3c50cb40973b66a", "score": "0.74199533", "text": "func (m *PatientMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Patient nullable field %s\", name)\n}", "title": "" }, { "docid": "5b5da0a2f70990ffc3c50cb40973b66a", "score": "0.74199533", "text": "func (m *PatientMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Patient nullable field %s\", name)\n}", "title": "" }, { "docid": "5b5da0a2f70990ffc3c50cb40973b66a", "score": "0.74199533", "text": "func (m *PatientMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Patient nullable field %s\", name)\n}", "title": "" }, { "docid": "5b5da0a2f70990ffc3c50cb40973b66a", "score": "0.74199533", "text": "func (m *PatientMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Patient nullable field %s\", name)\n}", "title": "" }, { "docid": "5b5da0a2f70990ffc3c50cb40973b66a", "score": "0.74199533", "text": "func (m *PatientMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Patient nullable field %s\", name)\n}", "title": "" }, { "docid": "f4a092249ac65a4fc3ee7b136921dbc5", "score": "0.74198633", "text": "func (m *LessonplanMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Lessonplan nullable field %s\", name)\n}", "title": "" }, { "docid": "9109d9e93fe74e9b7a5c4d24bd68c6ac", "score": "0.7417066", "text": "func (m *CityMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown City nullable field %s\", name)\n}", "title": "" }, { "docid": "b107b6d4373d6a16cc889a4463fe0d5f", "score": "0.7416999", "text": "func (m *QuestionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Question nullable field %s\", name)\n}", "title": "" }, { "docid": "76d210ac3e809a25a27189afc68fb891", "score": "0.7415576", "text": "func (m *CarMutation) ClearField(name string) error {\n\tswitch name {\n\tcase car.FieldNumber:\n\t\tm.ClearNumber()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Car nullable field %s\", name)\n}", "title": "" }, { "docid": "a2af99b406e4a6e213aa74c6a99e643e", "score": "0.74145645", "text": "func (m *HospitalMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Hospital nullable field %s\", name)\n}", "title": "" }, { "docid": "17598cba1d61c3cfc07f0393681bac17", "score": "0.741085", "text": "func (m *PhysicianMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Physician nullable field %s\", name)\n}", "title": "" }, { "docid": "cfa020a5e4dc9a071f490009e603062e", "score": "0.7409048", "text": "func (m *PermissionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Permission nullable field %s\", name)\n}", "title": "" }, { "docid": "640fc85bff02c73930848e05c03cac21", "score": "0.7408627", "text": "func (m *GroupMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Group nullable field %s\", name)\n}", "title": "" }, { "docid": "f0e29e6cbf40b40332837ed086313eb4", "score": "0.74076957", "text": "func (m *SubjectMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Subject nullable field %s\", name)\n}", "title": "" }, { "docid": "2d2a20f7d32ddca1e38648135c0ebb8e", "score": "0.74037063", "text": "func (m *DegreeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Degree nullable field %s\", name)\n}", "title": "" }, { "docid": "95dc9febfec1b18823d2c227ed9fc841", "score": "0.7397038", "text": "func (m *PhoneMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Phone nullable field %s\", name)\n}", "title": "" }, { "docid": "9ea528d4f8925102ad2069abb173927e", "score": "0.73931956", "text": "func (m *PaymentMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Payment nullable field %s\", name)\n}", "title": "" }, { "docid": "763396e26a6d86a38f4a152d0a87f169", "score": "0.73870134", "text": "func (m *SystemequipmentMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Systemequipment nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c7a6efb8256b57069fb4fa38932e50d8", "score": "0.7385544", "text": "func (m *UserMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "c96cfd5c5645425de601e790c3b6358d", "score": "0.73760015", "text": "func (m *InsuranceMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Insurance nullable field %s\", name)\n}", "title": "" }, { "docid": "0bd65def593523f315b1cbc477d3e441", "score": "0.7370695", "text": "func (m *MedicalEquipmentMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown MedicalEquipment nullable field %s\", name)\n}", "title": "" }, { "docid": "5580618c7d874a99d304445599983bb0", "score": "0.7367069", "text": "func (m *MetadataMutation) ClearField(name string) error {\n\tswitch name {\n\tcase metadata.FieldCreatedBy:\n\t\tm.ClearCreatedBy()\n\t\treturn nil\n\tcase metadata.FieldCreatedWith:\n\t\tm.ClearCreatedWith()\n\t\treturn nil\n\tcase metadata.FieldUpdatedBy:\n\t\tm.ClearUpdatedBy()\n\t\treturn nil\n\tcase metadata.FieldUpdatedWith:\n\t\tm.ClearUpdatedWith()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Metadata nullable field %s\", name)\n}", "title": "" }, { "docid": "e19fdda3912ffa7794d120ad498d9c67", "score": "0.73620707", "text": "func (m *BookMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Book nullable field %s\", name)\n}", "title": "" }, { "docid": "3a004e358c86ccb4957eb5a856c452c6", "score": "0.7357902", "text": "func (m *PetMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Pet nullable field %s\", name)\n}", "title": "" }, { "docid": "9f2580963b32754ebe3645e508b2962c", "score": "0.735396", "text": "func (m *StatusOpinionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown StatusOpinion nullable field %s\", name)\n}", "title": "" }, { "docid": "5532e994f15be4c681d8168e27572982", "score": "0.73499066", "text": "func (m *GroupRoleMutation) ClearField(name string) error {\n\tswitch name {\n\tcase grouprole.FieldMetadata:\n\t\tm.ClearMetadata()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown GroupRole nullable field %s\", name)\n}", "title": "" }, { "docid": "28b31a6261e23c71306181e6b2a06c16", "score": "0.7344517", "text": "func (m *CustomerMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Customer nullable field %s\", name)\n}", "title": "" }, { "docid": "c2f7429bab362c427b33d7ea633f87fc", "score": "0.7344305", "text": "func (m *AppointmentMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Appointment nullable field %s\", name)\n}", "title": "" }, { "docid": "7839fe930470d296fa2fcc75c8dfdf18", "score": "0.73437464", "text": "func (m *ProductMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Product nullable field %s\", name)\n}", "title": "" }, { "docid": "0ba3848c461e88d3a8e608297d40d30d", "score": "0.7338647", "text": "func (m *DentistMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Dentist nullable field %s\", name)\n}", "title": "" }, { "docid": "0ba3848c461e88d3a8e608297d40d30d", "score": "0.7338647", "text": "func (m *DentistMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Dentist nullable field %s\", name)\n}", "title": "" }, { "docid": "c6126da482cb4e8203948678e4a2f797", "score": "0.7333902", "text": "func (m *GroupMutation) ClearField(name string) error {\n\tswitch name {\n\tcase group.FieldDescription:\n\t\tm.ClearDescription()\n\t\treturn nil\n\tcase group.FieldMetadata:\n\t\tm.ClearMetadata()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Group nullable field %s\", name)\n}", "title": "" }, { "docid": "08e34329b1b841c3699598aaf1a2e68e", "score": "0.7329549", "text": "func (m *SectionMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown Section nullable field %s\", name)\n}", "title": "" }, { "docid": "d9f70ff151d706fd1b5113688042b803", "score": "0.7327978", "text": "func (m *SettingMutation) ClearField(name string) error {\n\tswitch name {\n\tcase setting.FieldCreatedBy:\n\t\tm.ClearCreatedBy()\n\t\treturn nil\n\tcase setting.FieldCreatedWith:\n\t\tm.ClearCreatedWith()\n\t\treturn nil\n\tcase setting.FieldUpdatedBy:\n\t\tm.ClearUpdatedBy()\n\t\treturn nil\n\tcase setting.FieldUpdatedWith:\n\t\tm.ClearUpdatedWith()\n\t\treturn nil\n\tcase setting.FieldData:\n\t\tm.ClearData()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Setting nullable field %s\", name)\n}", "title": "" }, { "docid": "cdd0d57be695c4c942661070c5b9780d", "score": "0.732593", "text": "func (m *MetadataMutation) ClearField(name string) error {\n\tswitch name {\n\tcase metadata.FieldParentID:\n\t\tm.ClearParentID()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Metadata nullable field %s\", name)\n}", "title": "" }, { "docid": "74c594e3e36b3a598a5993f7c85cd9e5", "score": "0.7319778", "text": "func (m *GroupOfAgeMutation) ClearField(name string) error {\n\treturn fmt.Errorf(\"unknown GroupOfAge nullable field %s\", name)\n}", "title": "" }, { "docid": "10659094cfece8732045798a40f45fdb", "score": "0.7316271", "text": "func (m *UserMutation) ClearField(name string) error {\n\tswitch name {\n\tcase user.FieldTags:\n\t\tm.ClearTags()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown User nullable field %s\", name)\n}", "title": "" }, { "docid": "e5c887c5eeab7f3fdc1607bf2e21be43", "score": "0.7316048", "text": "func (m *ApplicationMutation) ClearField(name string) error {\n\tswitch name {\n\tcase application.FieldStartedAt:\n\t\tm.ClearStartedAt()\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unknown Application nullable field %s\", name)\n}", "title": "" } ]
3c2d9227d678b631e84d6c994022c81e
Get the action function for intersect operation note the intersect cannot keep order because the map cannot keep order
[ { "docid": "108910596908f744d96c554ba134f38b", "score": "0.6472658", "text": "func getIntersect(source2 interface{}) stepAction {\r\n\treturn stepAction(func(src dataSource, option *ParallelOption, first bool) (dest dataSource, keep bool, e error) {\r\n\t\tkeep = option.KeepOrder\r\n\t\tdest, e = filterSet(src, source2, false, option)\r\n\t\treturn\r\n\t})\r\n}", "title": "" } ]
[ { "docid": "2f2d9b22fc7aac6b62f908e24f66bcde", "score": "0.6092801", "text": "func (index *Index[K, F]) Intersect(bounds *primitives.Rect) ([]F, error) {\n\treturn index.Query(bounds, query.Build[K, F]().Query())\n}", "title": "" }, { "docid": "6acbb65a7f49cee39456110fcbe23887", "score": "0.6021463", "text": "func intersect(fs1, fs2 []*ssa.Function) []*ssa.Function {\n\tm := make(map[*ssa.Function]bool)\n\tfor _, f := range fs1 {\n\t\tm[f] = true\n\t}\n\n\tvar res []*ssa.Function\n\tfor _, f := range fs2 {\n\t\tif m[f] {\n\t\t\tres = append(res, f)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "8b38feeda236475805aefdbf762c3afe", "score": "0.5796297", "text": "func intersectionAllowed(op string, lhit, inl, inr bool) bool {\n\tswitch op {\n\tcase union:\n\t\treturn (lhit && !inr) || (!lhit && !inl)\n\tcase intersection:\n\t\treturn (lhit && inr) || (!lhit && inl)\n\tcase difference:\n\t\treturn (lhit && !inr) || (!lhit && inl)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "707b13313a522fb90179516861fa86a8", "score": "0.5722063", "text": "func execmRectangleIntersect(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(image.Rectangle).Intersect(args[1].(image.Rectangle))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "91cb11f1861a76a76d993d81247b29a8", "score": "0.57090765", "text": "func MakeIntersectOperator(op *Operator, operands map[string]string) {\n\tmode := \"all\"\n\tif operands[\"mode\"] == \"any\" {\n\t\tmode = \"any\"\n\t}\n\tmatrix := make(map[[2]int]int)\n\n\tgetMatrixVal := func(cell [2]int, t time.Time) int {\n\t\tval, ok := matrix[cell]\n\t\tif ok {\n\t\t\treturn val\n\t\t}\n\t\tmd := driver.GetMatrixDataBefore(op.Parents[1].Name, cell[0], cell[1], t)\n\t\tif md == nil {\n\t\t\tmatrix[cell] = 0\n\t\t} else {\n\t\t\tmatrix[cell] = md.Val\n\t\t}\n\t\treturn matrix[cell]\n\t}\n\n\t// map from parent sequence ID to our sequence\n\tsequences := make(map[int]*Sequence)\n\n\t// set of parent sequence IDs that failed the intersection test\n\trejectedSeqs := make(map[int]bool)\n\n\top.InitFunc = func(frame *Frame) {\n\t\tdriver.UndoSequences(op.Name, frame.Time)\n\n\t\tfor _, seq := range GetUnterminatedSequences(op.Name) {\n\t\t\tparentID, _ := strconv.Atoi(seq.GetMetadata()[0])\n\t\t\tsequences[parentID] = seq\n\t\t}\n\n\t\top.updateChildRerunTime(frame.Time)\n\t}\n\n\top.Func = func(frame *Frame, pd ParentData) {\n\t\tseqs := pd.Sequences[0]\n\t\tmatrixData := pd.MatrixData[0]\n\n\t\t// update matrix\n\t\tfor _, md := range matrixData {\n\t\t\tmatrix[[2]int{md.I, md.J}] = md.Val\n\t\t}\n\n\t\t// evaluate new sequences\n\t\t// TODO: should we do evaluation only when sequence is about to disappear?\n\t\t// (so we use the latest image data)\n\t\tfor _, seq := range seqs {\n\t\t\tif sequences[seq.ID] != nil || rejectedSeqs[seq.ID] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// determine intersection depending on mode\n\t\t\tvar okay bool\n\t\t\tif mode == \"all\" {\n\t\t\t\tokay = true\n\t\t\t\tfor _, member := range seq.Members {\n\t\t\t\t\tcell := ToCell(member.Detection.Polygon.Bounds().Center(), MatrixGridSize)\n\t\t\t\t\tval := getMatrixVal(cell, frame.Time)\n\t\t\t\t\tif val <= 0 {\n\t\t\t\t\t\tokay = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if mode == \"any\" {\n\t\t\t\tokay = false\n\t\t\t\tfor _, member := range seq.Members {\n\t\t\t\t\tcell := ToCell(member.Detection.Polygon.Bounds().Center(), MatrixGridSize)\n\t\t\t\t\tval := getMatrixVal(cell, frame.Time)\n\t\t\t\t\tif val > 0 {\n\t\t\t\t\t\tokay = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !okay {\n\t\t\t\trejectedSeqs[seq.ID] = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmySeq := NewSequence(op.Name, seq.Time)\n\t\t\tmySeq.AddMetadata(fmt.Sprintf(\"%d\", seq.ID), seq.Time)\n\t\t\tfor _, member := range seq.Members {\n\t\t\t\tmySeq.AddMember(member.Detection, seq.Time)\n\t\t\t}\n\t\t\tmySeq.Terminate(mySeq.Members[len(mySeq.Members)-1].Detection.Time)\n\t\t\tsequences[seq.ID] = mySeq\n\t\t}\n\t}\n\n\top.Loader = op.SequenceLoader\n}", "title": "" }, { "docid": "36a1d242e5950d28264f5164f7905d1c", "score": "0.54945797", "text": "func (f *Filter) Intersect(g *Filter) {\n\tcheckBinop(f, g)\n\tf.intersect(g)\n}", "title": "" }, { "docid": "af2cdcec0935d48993e77208e1dc7ac3", "score": "0.547869", "text": "func (c MethodsCollection) Intersect() pIntersect {\n\treturn pIntersect{\n\t\tMethod: c.MustGet(\"Intersect\"),\n\t}\n}", "title": "" }, { "docid": "a6448e7d1665ee019c43e2cb47895ce7", "score": "0.54245317", "text": "func Problem350() {\n\n\ttest11 := []int{1, 2, 2, 1}\n\ttest12 := []int{2, 2}\n\tfmt.Println(intersect(test11, test12))\n\n\ttest21 := []int{4, 9, 5}\n\ttest22 := []int{9, 4, 9, 8, 4}\n\tfmt.Println(intersect(test21, test22))\n\n}", "title": "" }, { "docid": "e2b3cf9b49ca5afed662a581eb80c204", "score": "0.53968894", "text": "func (any) Intersect(c Constraint) Constraint {\r\n\treturn c\r\n}", "title": "" }, { "docid": "4b01e8839dd3379eda6a2ace0c086b49", "score": "0.5350557", "text": "func intersect(A, B, C, D *point) bool {\n\treturn (direction(A, C, D)*direction(B, C, D) <= 0) && (direction(C, A, B)*direction(D, A, B) <= 0)\n}", "title": "" }, { "docid": "143b5198e88122ddfab90ee2793d561a", "score": "0.534462", "text": "func (w Wire) Intersect(other Wire) []h.Point {\n\tvar res []h.Point\n\tfor k := range w {\n\t\tif _, ok := other[k]; ok {\n\t\t\tres = append(res, k)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9d6245919275b91adbf00af31aa3bcb7", "score": "0.53325635", "text": "func (sd SignedDistance) OpIntersection(x, y float64) float64 {\n\treturn MathMax(x, y)\n}", "title": "" }, { "docid": "b30f045957836f4cbfb506fcffb7deae", "score": "0.5315318", "text": "func Intersect(rows ...string) string {\n\treturn rowOperation(\"Intersect\", rows...)\n}", "title": "" }, { "docid": "b52430c7c9086591104e2555c979394f", "score": "0.5225291", "text": "func andIntersect(\n\tmatching VectorMatching,\n\tlhs, rhs []block.SeriesMeta,\n) ([]indexMatcher, []block.SeriesMeta) {\n\tidFunction := hashFunc(matching.On, matching.MatchingLabels...)\n\t// The set of signatures for the right-hand side.\n\trightSigs := make(map[uint64]int, len(rhs))\n\tfor idx, meta := range rhs {\n\t\trightSigs[idFunction(meta.Tags)] = idx\n\t}\n\n\tmatchers := make([]indexMatcher, 0, len(lhs))\n\tmetas := make([]block.SeriesMeta, 0, len(lhs))\n\tfor lhsIndex, ls := range lhs {\n\t\tif rhsIndex, ok := rightSigs[idFunction(ls.Tags)]; ok {\n\t\t\tmatcher := indexMatcher{\n\t\t\t\tlhsIndex: lhsIndex,\n\t\t\t\trhsIndex: rhsIndex,\n\t\t\t}\n\n\t\t\tmatchers = append(matchers, matcher)\n\t\t\tmetas = append(metas, lhs[lhsIndex])\n\t\t}\n\t}\n\n\treturn matchers[:len(matchers)], metas[:len(metas)]\n}", "title": "" }, { "docid": "4ccf08cf1e5c870cb89c85b167a2db63", "score": "0.5165071", "text": "func intersection(L1, L2 *LineSegment) int {\n\trel1 := L1.L.RelationOf(L2.A) * L1.L.RelationOf(L2.B)\n\trel2 := L2.L.RelationOf(L1.A) * L2.L.RelationOf(L1.B)\n\tif rel1 > 0 {\n\t\treturn 1\n\t}\n\tif rel2 > 0 {\n\t\treturn 1\n\t}\n\tif rel1 == 0 {\n\t\treturn 0\n\t}\n\tif rel2 == 0 {\n\t\treturn 0\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "0595af2c79db801c37deb6ec54102ce0", "score": "0.5148612", "text": "func (ra *ResAccumulator) Intersection(other resmap.ResMap) error {\n\totherIds := other.AllIds()\n\tfor _, curId := range ra.resMap.AllIds() {\n\t\ttoDelete := true\n\t\tfor _, otherId := range otherIds {\n\t\t\tif otherId == curId {\n\t\t\t\ttoDelete = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif toDelete {\n\t\t\terr := ra.resMap.Remove(curId)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dafc6087437ef5cc228904a5cde0c1b7", "score": "0.5146033", "text": "func TestIntersectSlice(t *testing.T) {\n\tslice1 := []uint32{0, 1, 2, 3}\n\tslice2 := []uint32{3, 4, 5}\n\n\tresult := IntersectSlice(slice1, slice2)\n\tassert.Equal(t, 1, len(result))\n\tassert.Equal(t, uint32(3), result[0])\n}", "title": "" }, { "docid": "be825fb225e29f55418688fe8a230b04", "score": "0.51062226", "text": "func (m pIntersect) Underlying() *models.Method {\n\treturn m.Method\n}", "title": "" }, { "docid": "3ac6bd19058894899f69964a6a85c270", "score": "0.50929135", "text": "func intersect(a, b []model.Fingerprint) []model.Fingerprint {\n\tif a == nil {\n\t\treturn b\n\t}\n\tresult := []model.Fingerprint{}\n\tfor i, j := 0, 0; i < len(a) && j < len(b); {\n\t\tif a[i] == b[j] {\n\t\t\tresult = append(result, a[i])\n\t\t}\n\t\tif a[i] < b[j] {\n\t\t\ti++\n\t\t} else {\n\t\t\tj++\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "73bec412d12705b3c52ab2d36b469f34", "score": "0.5064283", "text": "func intersect(\n\tmatching *logical.VectorMatching,\n\tlhs, rhs []block.SeriesMeta,\n) ([]int, []int, []block.SeriesMeta) {\n\tidFunction := logical.HashFunc(matching.On, matching.MatchingLabels...)\n\t// The set of signatures for the right-hand side.\n\trightSigs := make(map[uint64]int, len(rhs))\n\tfor idx, meta := range rhs {\n\t\trightSigs[idFunction(meta.Tags)] = idx\n\t}\n\n\ttakeLeft := make([]int, 0, initIndexSliceLength)\n\tcorrespondingRight := make([]int, 0, initIndexSliceLength)\n\tleftMetas := make([]block.SeriesMeta, 0, initIndexSliceLength)\n\n\tfor lIdx, ls := range lhs {\n\t\t// If there's a matching entry in the left-hand side Vector, add the sample.\n\t\tid := idFunction(ls.Tags)\n\t\tif rIdx, ok := rightSigs[id]; ok {\n\t\t\ttakeLeft = append(takeLeft, lIdx)\n\t\t\tcorrespondingRight = append(correspondingRight, rIdx)\n\t\t\tleftMetas = append(leftMetas, ls)\n\t\t}\n\t}\n\n\treturn takeLeft, correspondingRight, leftMetas\n}", "title": "" }, { "docid": "03d6e35388a51982faad7419554cce74", "score": "0.50636023", "text": "func openIntersects(shape1, shape2 Components) bool {\n\tfor _, line1 := range shape1.lines() {\n\t\tfor _, line2 := range shape2.lines() {\n\t\t\tif linesIntersect(line1, line2) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "982d4ff1e4231ac9aef1e214bfdd4c5c", "score": "0.5061873", "text": "func (none) Intersect(Constraint) Constraint {\r\n\treturn None()\r\n}", "title": "" }, { "docid": "5f955211c72924f3d3b74b6f4abe6f84", "score": "0.5058539", "text": "func intersect(a, b, c point) (bool, bool) {\n\t// a and b both above c -> nope\n\tif a.y > c.y && b.y > c.y {\n\t\treturn false, false\n\t}\n\t// ensure a is to left of b\n\tif a.x > b.x {\n\t\ta, b = b, a\n\t}\n\t// a and b both on left or right of c -> nope\n\tif !(a.x <= b.x && b.x >= c.x) {\n\t\treturn false, false\n\t}\n\tif a.y <= c.y && b.y <= c.y {\n\t\treturn a.y == c.y && b.y == c.y, true\n\t}\n\t// a is left-ish, b is right-ish,\n\t// a/b are on opposite vertical sides\n\n}", "title": "" }, { "docid": "e1fc4300d28e25aac1ac91f4f1aec18a", "score": "0.5053196", "text": "func (self *Circle) Intersects(a *Circle, b *Circle) bool{\n return self.Object.Call(\"intersects\", a, b).Bool()\n}", "title": "" }, { "docid": "a3f9f6bac12f3a8ceca4ddb36ef8f4f2", "score": "0.5039429", "text": "func intersect(a, b, c, d []int32) bool {\n\tif intersectProp(a, b, c, d) {\n\t\treturn true\n\t} else if between(a, b, c) || between(a, b, d) || between(c, d, a) || between(c, d, b) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2e803c3e3494e231349f5afcf663aebe", "score": "0.5029944", "text": "func (obj Object) Intersect(other Object) [][3]*Term {\n\tr := [][3]*Term{}\n\tfor _, i := range obj {\n\t\tfor _, j := range other {\n\t\t\tif i[0].Equal(j[0]) {\n\t\t\t\tr = append(r, [...]*Term{&Term{Value: i[0].Value}, i[1], j[1]})\n\t\t\t}\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "d6b69193e19fd495927ed96aecd41d68", "score": "0.50149757", "text": "func (a Seg2) DoesIsect(b Seg2) bool {\n aray := a.Ray()\n bray := b.Ray()\n\n bp := b.P.Sub(a.P)\n bq := b.Q.Sub(a.P)\n ap := a.P.Sub(b.P)\n aq := a.Q.Sub(b.P)\n\n cross_bp := CrossProduct(aray, bp)\n cross_bq := CrossProduct(aray, bq)\n cross_ap := CrossProduct(bray, ap)\n cross_aq := CrossProduct(bray, aq)\n\n return ((cross_ap < 0 && cross_aq > 0) || (cross_ap > 0 && cross_aq < 0)) &&\n ((cross_bp < 0 && cross_bq > 0) || (cross_bp > 0 && cross_bq < 0))\n}", "title": "" }, { "docid": "d23efc9d15e3dcf4e3aa05ef3f9e13ee", "score": "0.50109595", "text": "func TestIntersectionOfTwoArrays(t *testing.T) {\n\tfmt.Println(intersection([]int{4, 9, 5}, []int{9, 4, 9, 8, 4}))\n}", "title": "" }, { "docid": "0382529efe44fd4f6d2b20e6732005eb", "score": "0.50076365", "text": "func TestIntersectionOfTwoArraysIi(t *testing.T) {\n\tfmt.Println(intersect([]int{1, 2, 2,2,3,3,4, 1}, []int{2, 2,3,3}))\n\tfmt.Println(intersect([]int{4, 9, 5}, []int{9, 4, 9, 8, 4}))\n}", "title": "" }, { "docid": "307447fe05f62f26af51ea741e71c3e6", "score": "0.49621987", "text": "func (b *Bitset32) Intersection(ob *Bitset32) (result *Bitset32) {\n\tb, ob = sortByLength32(b, ob)\n\tresult = New32(b.n)\n\tfor i, w := range b.b {\n\t\tresult.b[i] = w & ob.b[i]\n\t}\n\treturn\n}", "title": "" }, { "docid": "d155535196e62dc8e26666ce85869378", "score": "0.495849", "text": "func (m *GlyphMesher) intersect(buf []Point, l lineSegment, g QuadGlyph, verts []gfx.Vec3) (hitBuffer []Point, vertsOut []gfx.Vec3) {\n\thitBuffer = buf\n\n\tvar scale float32 = 0.0005\n\tvar ptSize float32 = 0.01\n\n\tswitch swtch {\n\tcase 0:\n\t\tverts = m.debugPoints(verts, g, scale, ptSize*2, true)\n\tcase 1:\n\t\tverts = m.debugPoints(verts, g, scale, ptSize*2, true)\n\t\tverts = m.debugPoints(verts, g, scale, ptSize, false)\n\tcase 2:\n\t\tverts = m.debugPoints(verts, g, scale, ptSize*2, true)\n\t\tverts = m.debugPoints(verts, g, scale, ptSize, false)\n\t}\n\treturn nil, verts\n\n\ttestLine := func(a, b Point) {\n\t\tp0 := gfx.Vec3{float32(a.X) * scale, 0, float32(a.Y) * scale}\n\t\tp1 := gfx.Vec3{float32(b.X) * scale, 0, float32(b.Y) * scale}\n\t\tverts = appendLine(verts, p0, p1, ptSize)\n\n\t\t/*\n\t\t\tcntLine := lineSegment{\n\t\t\t\tStart: points[i],\n\t\t\t\tEnd: points[i+2],\n\t\t\t}\n\t\t\tp, status := l.intersect(cntLine)\n\t\t\tif status == hit {\n\t\t\t\thitBuffer = append(hitBuffer, p)\n\t\t\t}/* else if status == collinear {\n\t\t\t\thitBuffer = append(hitBuffer, cntLine.Start)\n\t\t\t\thitBuffer = append(hitBuffer, cntLine.End)\n\t\t\t}*/\n\t}\n\n\t// Test each line of each contour, while ignoring control points.\n\tfor c := 0; c < g.NumContours(); c++ {\n\t\tpoints := g.Contour(c)\n\t\tlog.Println(len(points))\n\t\tfor i := 3; i < len(points); i += 2 {\n\t\t\ttestLine(points[i], points[i-2])\n\t\t}\n\n\t\t// FIXME: remove\n\t\tswitch swtch {\n\t\tcase 0:\n\t\t\t// Contour closing.\n\t\t\ttestLine(points[1], points[len(points)-1])\n\t\t}\n\t\tbreak\n\t}\n\tvertsOut = verts\n\treturn\n}", "title": "" }, { "docid": "a387837e0634016057c7da3d658424c2", "score": "0.49432784", "text": "func Intersection(lessThan func(T, T) bool, opt_array ...T) []T {\n\trest := Uniq(Flatten(Rest(opt_array), true), false)\n\treturn Filter(Uniq(opt_array[0], false), func(this T, idx T, list T) bool {\n\t\treturn Every(rest, func(that T, idx2 T, list T) bool {\n\t\t\treturn IndexOf(rest, this, lessThan) != -1\n\t\t})\n\t})\n}", "title": "" }, { "docid": "caf3d8d7f4ace7313de0b63f635e555e", "score": "0.49418062", "text": "func (c *Unary) Intersection(other *Unary) *Unary {\n\trequest := &eplpbv1.GeometryRequest{\n\t\tOperator: eplpbv1.OperatorType_INTERSECTION,\n\t}\n\n\treturn c.append(request, other)\n}", "title": "" }, { "docid": "988c923e19006055a9f27c483c4c80b4", "score": "0.4941458", "text": "func (s1 Segmentf64) Intersect(s2 Segmentf64) bool {\r\n\ts1 = s1.Standardize()\r\n\ts2 = s2.Standardize()\r\n\tv1 := s1.ToVector()\r\n\tv2 := s2.ToVector()\r\n\tif v2.Mult(v1) == 0 {\r\n\t\t// parallel\r\n\t\trefVec1 := NewVector2f64(s2.Point1.X-s1.Point2.X, s2.Point1.Y-s1.Point2.Y)\r\n\t\trefVec2 := NewVector2f64(s1.Point1.X-s2.Point1.X, s1.Point1.Y-s2.Point1.Y)\r\n\t\tif refVec1.Mult(refVec2) == 0 {\r\n\t\t\t// in one line\r\n\t\t\treturn s2.Point1.X <= s1.Point2.X && s1.Point1.X <= s2.Point1.X && s2.Point1.Y <= s1.Point2.Y && s1.Point1.Y <= s2.Point1.Y\r\n\t\t} else {\r\n\t\t\t// parallel\r\n\t\t\treturn false\r\n\t\t}\r\n\t} else {\r\n\t\t// no parallel\r\n\t\treturn s1.Straddle(s2) && s2.Straddle(s1)\r\n\t}\r\n}", "title": "" }, { "docid": "a9a74af8dbfef118d0555b9d063ae81d", "score": "0.49391443", "text": "func Intersection(first, second []string) []string {\n\tvar third []string\n\titerMap := make(map[string]bool)\n\tfor _, element := range second {\n\t\titerMap[element] = true\n\t}\n\tfor _, element := range first {\n\t\tif _, ok := iterMap[element]; ok {\n\t\t\tthird = append(third, element)\n\t\t}\n\t}\n\treturn third\n}", "title": "" }, { "docid": "3800eefbff4bdad4d12aaf55bb564e08", "score": "0.49068305", "text": "func intersection(a, b []string) (c []string) {\n\tm := make(map[string]bool)\n\n\tfor _, item := range a {\n\t\tm[item] = true\n\t}\n\n\tfor _, item := range b {\n\t\tif _, ok := m[item]; ok {\n\t\t\tc = append(c, item)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2497f18e14d628bcf2bc6c4891b2e2a2", "score": "0.4892394", "text": "func (iv *Vector) Intersects(other *Vector) bool {\n\tkeys := iv.KeyVector.Intersects(other.KeyVector)\n\tmods := iv.ModifierVector.Intersects(other.ModifierVector)\n\tbuttons := iv.MouseButtonVector.Intersects(other.MouseButtonVector)\n\n\treturn keys || mods || buttons\n}", "title": "" }, { "docid": "c41d9d208b6bec10b3e6f3c19dedce8e", "score": "0.48896816", "text": "func (s Spans) Intersection() Spans {\n\treturn s.IntersectionWithHandler(func(intersectingEvent1, intersectingEvent2, intersectionSpan Span) Span {\n\t\treturn intersectionSpan\n\t})\n}", "title": "" }, { "docid": "58df0b2b79532b273f7e00b4a1aa6786", "score": "0.4886351", "text": "func (this *Region) Intersect(other *Region) Status {\n\treturn Status(C.cairo_region_intersect(this.c(), other.c()))\n}", "title": "" }, { "docid": "3464ecf1607a70c77d3703bde053909b", "score": "0.48759657", "text": "func (self *Circle) IntersectsI(args ...interface{}) bool{\n return self.Object.Call(\"intersects\", args).Bool()\n}", "title": "" }, { "docid": "c7b966e9bbfe2d7d02b3db3e7101518b", "score": "0.48716626", "text": "func Intersection(a, b interface{}) interface{}{\n\n\tv := reflect.ValueOf(a)\n\tu := reflect.ValueOf(b)\n\tvar inter []interface{}\n\tfor i := 0; i < v.Len(); i++ {\n\t\t// var item []interface{}\n\t\titem := v.Index(i).Interface()\n\t\tin := reflect.ValueOf(item)\n\t\t\tif Contains(u, in) {\n\t\t\tinter = append(inter, in)\t \n\t\t\t}\n\t\t}\n\t\n\tresult := inter\n\treturn result\n}", "title": "" }, { "docid": "b549df9dd5fad7dbd9445a44ac587e46", "score": "0.486524", "text": "func intersection(nums1 []int, nums2 []int) []int {\r\n\trst := []int{}\r\n\tmap1 := make(map[int]bool)\r\n\tfor _, num := range nums1 {\r\n\t\tmap1[num] = true\r\n\t}\r\n\tfor _, num := range nums2 {\r\n\t\tif _, ok := map1[num]; ok {\r\n\t\t\tdelete(map1, num)\r\n\t\t\trst = append(rst, num)\r\n\t\t}\r\n\t}\r\n\treturn rst\r\n}", "title": "" }, { "docid": "55d014eaef1a80e3afa1d4e95e204a38", "score": "0.4860586", "text": "func (_ *ContainsOp) Op() FilterOp {\n\treturn FilterOpContains\n}", "title": "" }, { "docid": "0783812f29a44e1047521e4490cfe4b3", "score": "0.48302075", "text": "func (a Seg2) DoesIsectOrTouch(b Seg2) bool {\n aray := a.Ray()\n bray := b.Ray()\n\n bp := b.P.Sub(a.P)\n bq := b.Q.Sub(a.P)\n ap := a.P.Sub(b.P)\n aq := a.Q.Sub(b.P)\n\n cross_bp := CrossProduct(aray, bp)\n cross_bq := CrossProduct(aray, bq)\n cross_ap := CrossProduct(bray, ap)\n cross_aq := CrossProduct(bray, aq)\n\n return ((cross_ap <= 0 && cross_aq >= 0) || (cross_ap >= 0 && cross_aq <= 0)) &&\n ((cross_bp <= 0 && cross_bq >= 0) || (cross_bp >= 0 && cross_bq <= 0))\n}", "title": "" }, { "docid": "9aae1f45893acc5424881cc7fb78c5ac", "score": "0.48288983", "text": "func Intersection(a []corev1.ResourceName, b []corev1.ResourceName) []corev1.ResourceName {\n\tresult := make([]corev1.ResourceName, 0, len(a))\n\tfor _, item := range a {\n\t\tif Contains(result, item) {\n\t\t\tcontinue\n\t\t}\n\t\tif !Contains(b, item) {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, item)\n\t}\n\tsort.Slice(result, func(i, j int) bool { return result[i] < result[j] })\n\treturn result\n}", "title": "" }, { "docid": "aa0c058aae64a9d0a863fca3b65e0b7b", "score": "0.4825897", "text": "func IntersectTwoMap(IDsA, IDsB map[int]bool) map[int]bool {\n\tvar retIDs map[int]bool // for traversal it is smaller one\n\tvar checkIDs map[int]bool // for checking it is bigger one\n\tif len(IDsA) >= len(IDsB) {\n\t\tretIDs = IDsB\n\t\tcheckIDs = IDsA\n\t} else {\n\t\tretIDs = IDsA\n\t\tcheckIDs = IDsB\n\t}\n\tfor id := range retIDs {\n\t\tif _, exists := checkIDs[id]; !exists {\n\t\t\tdelete(checkIDs, id)\n\t\t}\n\t}\n\treturn retIDs\n}", "title": "" }, { "docid": "66ed03db8d1965949ba1a43ed8b67d60", "score": "0.48161858", "text": "func coreIntersection(slice1, slice2 innerSlice, equaller Equaller) innerSlice {\n\tresult := makeInnerSlice(slice1, 0, 0)\n\tfor i1 := 0; i1 < slice1.length(); i1++ {\n\t\titem1 := slice1.get(i1)\n\t\tfor i2 := 0; i2 < slice2.length(); i2++ {\n\t\t\titem2 := slice2.get(i2)\n\t\t\tif equaller(item1, item2) {\n\t\t\t\tresult.append(item1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1da11b1f6d4d4e8f498ad99e2e29ab38", "score": "0.48081058", "text": "func main() {\n\t// same object means same list suffix ? so we need to find common suffix then so we can start from back with 2 pointers\n\t// it s simple link list though, so we would want to reverse it first so we can traverse in order, but thats not efficient\n\t// cut the list to same length because only that part can have a matching suffix,\n\t// actually, dont need to cut just move the pointer there\n\n\ta := []int{2, 4, 77, 3, 7, 8, 10}\n\tb := []int{99, 1, 8, 10}\n\tia := 0\n\tib := 0\n\t// move indexes until tails are the same length\n\tfor i := 0; i < len(a)-len(b); i++ {\n\t\tia++ // next\n\t}\n\tfor i := 0; i < len(b)-len(a); i++ {\n\t\tib++ // next\n\t}\n\t// iterate the two pointers until we get the same node\n\tfor ia < len(a) && ib < len(b) {\n\t\tif a[ia] == b[ib] {\n\t\t\tfmt.Printf(\"found intersection at %d \\n\", a[ia])\n\t\t\treturn\n\t\t}\n\t\tia++ // next\n\t\tib++ // next\n\t}\n\tfmt.Println(\"No intersection\")\n}", "title": "" }, { "docid": "5c57c9a5e9d1bd0f526e3668a84f7281", "score": "0.4806257", "text": "func findTheTarget_02(a1 []int, a2 []int, target int) bool {\n\tmap1 := make(map[int]bool)\n\tmap2 := make(map[int]bool)\n\n\tfor i := 0; i < len(a1); i++ {\n\t\tmap1[a1[i]] = true\n\t\tmap2[a2[i]] = true\n\t}\n\n\tfor k, _ := range map1 {\n\t\tif _, ok := map2[target - k]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n\n}", "title": "" }, { "docid": "2d4a3193f76129648040971ff8fc6067", "score": "0.47983703", "text": "func (m pIntersect) Extend(fnct func(m.CurrencySet, m.CurrencySet) m.CurrencySet) pIntersect {\n\treturn pIntersect{\n\t\tMethod: m.Method.Extend(fnct),\n\t}\n}", "title": "" }, { "docid": "9e59e535f5fd79678a94bf054c820ed0", "score": "0.4789068", "text": "func Intersects(a, b geom.Geometry) (bool, error) {\n\tresult, err := binaryOpB(a, b, func(h C.GEOSContextHandle_t, a, b *C.GEOSGeometry) C.char {\n\t\treturn C.GEOSIntersects_r(h, a, b)\n\t})\n\treturn result, wrap(err, \"executing GEOSIntersects_r\")\n}", "title": "" }, { "docid": "7411115ded74bda52c6fbf937e48833d", "score": "0.4782278", "text": "func Intersection(a, b geom.Geometry, opts ...geom.ConstructorOption) (geom.Geometry, error) {\n\tg, err := binaryOpG(a, b, opts, func(ctx C.GEOSContextHandle_t, a, b *C.GEOSGeometry) *C.GEOSGeometry {\n\t\treturn C.GEOSIntersection_r(ctx, a, b)\n\t})\n\treturn g, wrap(err, \"executing GEOSIntersection_r\")\n}", "title": "" }, { "docid": "e7e4dff9b486328aef1aaebdac253efd", "score": "0.47710934", "text": "func (this *Underscore) Intersection(lessThan func(T, T) bool, opt_array ...T) *Underscore {\n\tv, _ := this.wrapped.([]T)\n\treturn this.result(Intersection(lessThan, append(v, opt_array...)))\n}", "title": "" }, { "docid": "8b9afac89d243794765dcf7b2e04d861", "score": "0.47655132", "text": "func (m *MockShape) Intersect(r *Ray, si *SurfaceInteraction, testAlphaTexture bool) (bool, float64) {\n\tret := m.ctrl.Call(m, \"Intersect\", r, si, testAlphaTexture)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(float64)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "716fec0e9e71d442e3bc7e2a05b1c4d7", "score": "0.47585863", "text": "func intersectionSelector(a, b Selector) Selector {\n\treturn func(n *html.Node) bool {\n\t\treturn a(n) && b(n)\n\t}\n}", "title": "" }, { "docid": "54b4e33f252f872f5c00e8f859285cc1", "score": "0.47567767", "text": "func doIntersect(l, other *Line) bool {\n\t// Find the four orientations needed for general and\n\t// special cases\n\to1 := calculateOrientation(l.p1, l.p2, other.p1)\n\to2 := calculateOrientation(l.p1, l.p2, other.p2)\n\to3 := calculateOrientation(other.p1, other.p2, l.p1)\n\to4 := calculateOrientation(other.p1, other.p2, l.p2)\n\n\t// General case\n\tif o1 != o2 && o3 != o4 {\n\t\treturn true\n\t}\n\n\t// Special Cases\n\t// l.p1, l.p2 and other.p1 are colinear and other.p1 lies on segment l.p1l.p2\n\tif o1 == Colinear && onSegment(l.p1, other.p1, l.p2) {\n\t\treturn true\n\t}\n\n\t// l.p1, l.p2 and other.p2 are colinear and other.p2 lies on segment l.p1l.p2\n\tif o2 == Colinear && onSegment(l.p1, other.p2, l.p2) {\n\t\treturn true\n\t}\n\n\t// p2, other.p2 and l.p1 are colinear and l.p1 lies on segment p2other.p2\n\tif o3 == Colinear && onSegment(other.p1, l.p1, other.p2) {\n\t\treturn true\n\t}\n\n\t// p2, other.p2 and l.p2 are colinear and l.p2 lies on segment p2other.p2\n\tif o4 == 0 && onSegment(other.p1, l.p2, other.p2) {\n\t\treturn true\n\t}\n\n\treturn false // Doesn't fall in any of the above cases\n}", "title": "" }, { "docid": "0aaf6a8f5813336a67e468c7d083f16a", "score": "0.47561625", "text": "func (ms *MapSet) Intersection(s Set) Set {\n\tu := ms\n\tfor e, _ := range *u {\n\t\tif !s.Contains(e) {\n\t\t\tu.Remove(e)\n\t\t}\n\t}\n\treturn u\n}", "title": "" }, { "docid": "c2fa71f2ab755cd0172a1a0974479673", "score": "0.4753978", "text": "func (r *Region) Intersect(other *Region) Status {\n\tc_r := (*C.cairo_region_t)(r.ToC())\n\tc_other := (*C.cairo_region_t)(other.ToC())\n\n\tretC := C.cairo_region_intersect(c_r, c_other)\n\treturn Status(retC)\n}", "title": "" }, { "docid": "3857def10f0a681adbbe0f144004e3ab", "score": "0.47523567", "text": "func (g *Geometry) Intersects(other *Geometry) (bool, error) {\n\treturn g.binaryPred(\"Intersects\", cGEOSIntersects, other)\n}", "title": "" }, { "docid": "eddd9b2e80f607d257ca2d0eba58035b", "score": "0.47497135", "text": "func opcodeMap(f *Func) map[Op]int {\n\tm := map[Op]int{}\n\tfor _, b := range f.Blocks {\n\t\tfor _, v := range b.Values {\n\t\t\tm[v.Op]++\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "53d888db7473135d9d64dfb6f844bc01", "score": "0.4748084", "text": "func TestHitAllNegative(t *testing.T) {\n\t// Given\n\ts := sphere.New()\n\ti1 := shape.NewIntersection(-2.0, s)\n\ti2 := shape.NewIntersection(-1.0, s)\n\txs := shape.Intersections{i2, i1}\n\n\t// When\n\ti := xs.Hit()\n\n\t// Then\n\tassert.Nil(t, i)\n}", "title": "" }, { "docid": "ee284eca2933f94c6924169e0f21b2f3", "score": "0.47451293", "text": "func (e Envelope) Intersects(o Envelope) bool {\n\treturn true &&\n\t\t(e.min.X <= o.max.X) && (e.max.X >= o.min.X) &&\n\t\t(e.min.Y <= o.max.Y) && (e.max.Y >= o.min.Y)\n}", "title": "" }, { "docid": "8685dc68a6f57bf03e4e53db4b640db3", "score": "0.47376588", "text": "func (p Point) Intersection(another Geometry) Geometry {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "11b22434ddf40c40a5281de2cca9e7c7", "score": "0.4736267", "text": "func (p *Plane) Intersection(ray geometry.Ray, tMin, tMax float64) (*material.RayHit, bool) {\r\n\tdenominator := ray.Direction.Dot(p.Normal)\r\n\tif p.IsCulled && denominator > -1e-7 {\r\n\t\treturn nil, false\r\n\t} else if denominator < 1e-7 && denominator > -1e-7 {\r\n\t\treturn nil, false\r\n\t}\r\n\tPlaneVector := ray.Origin.To(p.Point)\r\n\tt := PlaneVector.Dot(p.Normal) / denominator\r\n\r\n\tif t < tMin || t > tMax {\r\n\t\treturn nil, false\r\n\t}\r\n\r\n\treturn &material.RayHit{\r\n\t\tRay: ray,\r\n\t\tNormalAtHit: p.Normal,\r\n\t\tTime: t,\r\n\t\tMaterial: p.mat,\r\n\t}, true\r\n}", "title": "" }, { "docid": "4c3fb2579cd8224ecbc7752ee3956070", "score": "0.47339007", "text": "func (this IntSet) Intersection(otherSets ...IntSet) <-chan []int {\n\targs := this.args(\"sinter\")\n\tfor _, set := range otherSets {\n\t\targs = append(args, set.key)\n\t}\n\treturn intsChannel(SliceCommand(this, args...))\n}", "title": "" }, { "docid": "ed31e911e941d4760dc497913f036df5", "score": "0.47318792", "text": "func (b Box) Intersection(o Box) vector3.Vector3 {\n panic(errors.New(\"intersection not implemented\"))\n return vector3.Vector3{}\n}", "title": "" }, { "docid": "5c49c6e580ddb83b5b06a01b4c7c3e12", "score": "0.47303587", "text": "func (gdt *Plane) IntersectsSegment(\n\tr_dest Vector3 /* godot_vector3 */, p_begin Vector3 /* godot_vector3 */, p_end Vector3, /* godot_vector3 */\n) bool {\n\n\t/* go_godot_plane_intersects_segment(API_STRUCT, *godot_vector3, *godot_vector3, *godot_vector3) ->godot_bool */\n\n\tapi := CoreApi\n\trcv := (*C.godot_plane)(unsafe.Pointer(gdt))\n\tin0 := (*C.godot_vector3)(unsafe.Pointer(&r_dest))\n\tin1 := (*C.godot_vector3)(unsafe.Pointer(&p_begin))\n\tin2 := (*C.godot_vector3)(unsafe.Pointer(&p_end))\n\n\tret := C.go_godot_plane_intersects_segment(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t\tin1,\n\t\tin2,\n\t)\n\truntime.KeepAlive(in0)\n\truntime.KeepAlive(in1)\n\truntime.KeepAlive(in2)\n\n\treturn *(*bool)(unsafe.Pointer(&ret))\n}", "title": "" }, { "docid": "f1246864980674d79cee180249a11fc7", "score": "0.4724897", "text": "func (this Set) Intersection(otherSets ...Set) <-chan []string {\n\targs := this.args(\"sinter\")\n\tfor _, set := range otherSets {\n\t\targs = append(args, set.key)\n\t}\n\treturn SliceCommand(this, args...)\n}", "title": "" }, { "docid": "886ef0a1401daa47175db5e7b34066d3", "score": "0.4721235", "text": "func (c *checker) match(read *operation) *operation {\n\t//for _, v := range c.Graph.BFSReverse(read) {\n\tfor v := range c.Graph.Vertices() {\n\t\tif read.output == v.(*operation).input {\n\t\t\treturn v.(*operation)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8043a49b76a5d1f9b9df0996d1691b2d", "score": "0.4720945", "text": "func main() {\n\tvar nums1, nums2 []int\n\n\tnums1 = []int{4, 9, 5}\n\tnums2 = []int{9, 4, 9, 8, 4}\n\tfmt.Println(intersect(nums1, nums2))\n\n\tnums1 = []int{1}\n\tnums2 = []int{1}\n\tfmt.Println(intersect(nums1, nums2))\n}", "title": "" }, { "docid": "5759288b1f86e75adc18fc1958845479", "score": "0.47195378", "text": "func (t *Triangle) Intersection(ray geometry.Ray, tMin, tMax float64) (*material.RayHit, bool) {\r\n\tab := t.A.To(t.B)\r\n\tac := t.A.To(t.C)\r\n\tpVector := ray.Direction.Cross(ac)\r\n\tdeterminant := ab.Dot(pVector)\r\n\tif t.IsCulled && determinant < 1e-7 {\r\n\t\t// This ray is parallel to this Triangle or back-facing.\r\n\t\treturn nil, false\r\n\t} else if determinant > -1e-7 && determinant < 1e-7 {\r\n\t\treturn nil, false\r\n\t}\r\n\r\n\tinverseDeterminant := 1.0 / determinant\r\n\r\n\ttVector := t.A.To(ray.Origin)\r\n\tu := inverseDeterminant * (tVector.Dot(pVector))\r\n\tif u < 0.0 || u > 1.0 {\r\n\t\treturn nil, false\r\n\t}\r\n\r\n\tqVector := tVector.Cross(ab)\r\n\tv := inverseDeterminant * (ray.Direction.Dot(qVector))\r\n\tif v < 0.0 || u+v > 1.0 {\r\n\t\treturn nil, false\r\n\t}\r\n\r\n\t// At this stage we can compute time to find out where the intersection point is on the line.\r\n\ttime := inverseDeterminant * (ac.Dot(qVector))\r\n\tif time >= tMin && time <= tMax {\r\n\t\t// ray intersection\r\n\t\treturn &material.RayHit{\r\n\t\t\tRay: ray,\r\n\t\t\tNormalAtHit: t.normal,\r\n\t\t\tTime: time,\r\n\t\t\tU: 0,\r\n\t\t\tV: 0,\r\n\t\t\tMaterial: t.mat,\r\n\t\t}, true\r\n\t}\r\n\treturn nil, false\r\n}", "title": "" }, { "docid": "239683d7063dd1f70aab57245673f80f", "score": "0.47171304", "text": "func intersects(b0, b1 bounds) bool {\n\tfor d := 0; d < K; d++ {\n\t\tif b1[0][d] > b0[1][d] || b1[1][d] < b0[0][d] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c87278cb1e65aa7957ced1101460daab", "score": "0.47169605", "text": "func (ii *InvertedIndex) Intersect(terms []string) (result []int) {\n sort.Slice(terms, func(i, j int) bool { return len(ii.postingsLists[terms[i]]) < len(ii.postingsLists[terms[j]]) })\n result = ii.PostingsList(terms[0])\n pointer := 1\n for pointer < len(terms) && len(result) != 0 {\n result = IntersectPosting(result, ii.PostingsList(terms[pointer]))\n pointer++\n }\n return\n}", "title": "" }, { "docid": "541abd81126c002d4465d5d54f9729e6", "score": "0.47151944", "text": "func (tree *Treap) Intersection(rhs *Treap) (result, diff1, diff2 *Treap) {\n\n\tresult = NewTreap(tree.Less)\n\tdiff1 = NewTreap(tree.Less)\n\tdiff2 = NewTreap(tree.Less)\n\n\t__intersectionPrefix(*tree.rootPtr, rhs.rootPtr, result.rootPtr,\n\t\tdiff1.rootPtr, diff2.rootPtr, tree.Less)\n\n\t*tree.rootPtr = nullNodePtr\n\tdiff2.JoinDup(rhs)\n\n\treturn\n}", "title": "" }, { "docid": "e08500533b29e09e2fb1e2fe69b0a106", "score": "0.471273", "text": "func (l1 *Line) Intersect(l2 Line) []Vector {\n\tvar intersections []Vector\n\td := (l1.A.X-l1.B.X)*(l2.A.Y-l2.B.Y) - (l1.A.Y-l1.B.Y)*(l2.A.X-l2.B.X)\n\tif d != 0 {\n\t\txi := ((l2.A.X-l2.B.X)*(l1.A.X*l1.B.Y-l1.A.Y*l1.B.X) - (l1.A.X-l1.B.X)*(l2.A.X*l2.B.Y-l2.A.Y*l2.B.X)) / d\n\t\tyi := ((l2.A.Y-l2.B.Y)*(l1.A.X*l1.B.Y-l1.A.Y*l1.B.X) - (l1.A.Y-l1.B.Y)*(l2.A.X*l2.B.Y-l2.A.Y*l2.B.X)) / d\n\t\tif !((l1.A.X < xi && l1.B.X < xi) || (l1.A.X > xi && l1.B.X > xi) ||\n\t\t\t(l1.A.Y < yi && l1.B.Y < yi) || (l1.A.Y > yi && l1.B.Y > yi) ||\n\t\t\t(l2.A.X < xi && l2.B.X < xi) || (l2.A.X > xi && l2.B.X > xi) ||\n\t\t\t(l2.A.Y < yi && l2.B.Y < yi) || (l2.A.Y > yi && l2.B.Y > yi)) {\n\t\t\tintersections = append(intersections, Vector{xi, yi})\n\t\t}\n\t}\n\treturn intersections\n}", "title": "" }, { "docid": "50bb87ac22162cabba3ec07fcab09f7a", "score": "0.47048557", "text": "func (pr pointRange) intersect(selOrg, selEnd string) pointRange {\n\tif pr.isPoint() {\n\t\tif selOrg <= pr.org && pr.org < selEnd {\n\t\t\treturn pr\n\t\t}\n\t} else { // range\n\t\tpr = pointRange{org: max(pr.org, selOrg), end: min(pr.end, selEnd)}\n\t\tif pr.org < pr.end {\n\t\t\treturn pr\n\t\t}\n\t}\n\treturn pointRange{org: \"z\", end: \"a\"} // conflict\n}", "title": "" }, { "docid": "4bc4848c956bcf23ed6f562230647372", "score": "0.47020847", "text": "func (g *Geometry) Intersection(other *Geometry) (*Geometry, error) {\n\treturn g.binaryTopo(\"Intersection\", cGEOSIntersection, other)\n}", "title": "" }, { "docid": "96b5e215156d55f7238bce55ee68e7a7", "score": "0.46978465", "text": "func (d DriverCapabilities) Intersection(capabilities DriverCapabilities) DriverCapabilities {\n\tif capabilities == all {\n\t\treturn d\n\t}\n\tif d == all {\n\t\treturn capabilities\n\t}\n\n\tlookup := make(map[string]bool)\n\tfor _, c := range d.list() {\n\t\tlookup[c] = true\n\t}\n\tvar found []string\n\tfor _, c := range capabilities.list() {\n\t\tif lookup[c] {\n\t\t\tfound = append(found, c)\n\t\t}\n\t}\n\n\tintersection := DriverCapabilities(strings.Join(found, \",\"))\n\treturn intersection\n}", "title": "" }, { "docid": "83e66342dfb573cf2e52caae31632ecc", "score": "0.4696445", "text": "func (c *column) Intersect(dst *bitmap.Bitmap) {\n\tc.RLock()\n\tdst.And(*c.Index())\n\tc.RUnlock()\n}", "title": "" }, { "docid": "4b90f60b1efdc42e6ee92f9ea0d795d5", "score": "0.4693608", "text": "func subsetActions(first, second []string) bool {\n\tset := make(map[string]int)\n\tfor _, value := range second {\n\t\tset[value]++\n\t}\n\tfor _, value := range first {\n\t\tif count, found := set[value]; !found {\n\t\t\treturn false\n\t\t} else if count < 1 {\n\t\t\treturn false\n\t\t} else {\n\t\t\tset[value] = count - 1\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "65ee77ebfbf31344279676aa203f8f62", "score": "0.4692847", "text": "func (gdt *AABB) Intersection(\n\tp_with AABB, /* godot_aabb */\n) AABB {\n\n\t/* go_godot_aabb_intersection(API_STRUCT, *godot_aabb) ->godot_aabb */\n\n\tapi := CoreApi\n\trcv := (*C.godot_aabb)(unsafe.Pointer(gdt))\n\tin0 := (*C.godot_aabb)(unsafe.Pointer(&p_with))\n\n\tret := C.go_godot_aabb_intersection(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t)\n\truntime.KeepAlive(in0)\n\n\treturn *(*AABB)(unsafe.Pointer(&ret))\n}", "title": "" }, { "docid": "62c5ed67ed1543293bfc73c405582e98", "score": "0.4682112", "text": "func Intersection(a []int, b []int) []int {\n\tvar c []int\n\ti, j := 0, 0\n\tfor true {\n\t\tif a[i] < b[j] {\n\t\t\ti++\n\t\t\tif i > len(a)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else if a[i] > b[j] {\n\t\t\tj++\n\t\t\tif j > len(b)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tc = append(c, a[i])\n\t\t\ti++\n\t\t\tif i > len(a)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn c\n}", "title": "" }, { "docid": "66614846f7b24a5626572e8e2320dcb7", "score": "0.46775845", "text": "func IncludesMap(tb testing.TB, exp, act interface{}) {\n\tif ok := includesMap(exp, act); !ok {\n\t\ttb.FailNow()\n\t}\n}", "title": "" }, { "docid": "770ba5d4b5ddd14a677bf0b55ece2a62", "score": "0.4677238", "text": "func (resourceSet ResourceSet) Intersection(sset ResourceSet) ResourceSet {\n\tnset := NewResourceSet()\n\tfor k := range resourceSet {\n\t\tif _, ok := sset[k]; ok {\n\t\t\tnset.Add(k)\n\t\t}\n\t}\n\n\treturn nset\n}", "title": "" }, { "docid": "d29301e148eaad3c55d64bf367f2fbbb", "score": "0.46750572", "text": "func (recv *Widget) RegionIntersect(region *cairo.Region) *cairo.Region {\n\tc_region := (*C.cairo_region_t)(C.NULL)\n\tif region != nil {\n\t\tc_region = (*C.cairo_region_t)(region.ToC())\n\t}\n\n\tretC := C.gtk_widget_region_intersect((*C.GtkWidget)(recv.native), c_region)\n\tretGo := cairo.RegionNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "ed315df7242976f079aa0579ac54da10", "score": "0.46744603", "text": "func filterMapOperation(cmd *MapSetCommand, input *riakMapOperation, path []string, op *riak.MapOperation) *riak.MapOperation {\n\n\tif op == nil {\n\t\top = &riak.MapOperation{}\n\t}\n\n\t// Not implemented:\n\t// RemoveRegister()\n\t// RemoveCounter()\n\t// RemoveFlag()\n\t// RemoveMap()\n\t// RemoveSet()\n\n\t// AddToSet\n\tfor key, values := range input.addToSets {\n\t\tfor _, value := range values {\n\t\t\tif cmd.filterAllowPath(append(path, key)...) {\n\t\t\t\top.AddToSet(key, value)\n\t\t\t}\n\t\t}\n\t}\n\n\t// RemoveFromSet\n\tfor key, values := range input.removeFromSets {\n\t\tfor _, value := range values {\n\t\t\tif cmd.filterAllowPath(append(path, key)...) {\n\t\t\t\top.RemoveFromSet(key, value)\n\t\t\t}\n\t\t}\n\t}\n\n\t// SetRegister\n\tfor key, value := range input.registersToSet {\n\t\tif cmd.filterAllowPath(append(path, key)...) {\n\t\t\top.SetRegister(key, value)\n\t\t}\n\t}\n\n\t// Map\n\tfor key, value := range input.maps {\n\t\t// No filtering is performed here\n\t\tsubOp := op.Map(key)\n\t\tfilterMapOperation(cmd, value, append(path, key), subOp)\n\t}\n\n\t// IncrementCounter\n\tfor key, value := range input.incrementCounters {\n\t\tif cmd.filterAllowPath(append(path, key)...) {\n\t\t\top.IncrementCounter(key, value)\n\t\t}\n\t}\n\n\t// SetFlag\n\tfor key, value := range input.flagsToSet {\n\t\tif cmd.filterAllowPath(append(path, key)...) {\n\t\t\top.SetFlag(key, value)\n\t\t}\n\t}\n\n\treturn op\n}", "title": "" }, { "docid": "b31b27e5fcffaf22fbf2839bd5a24e7f", "score": "0.4672557", "text": "func (gdt *AABB) IntersectsSegment(\n\tp_from Vector3 /* godot_vector3 */, p_to Vector3, /* godot_vector3 */\n) bool {\n\n\t/* go_godot_aabb_intersects_segment(API_STRUCT, *godot_vector3, *godot_vector3) ->godot_bool */\n\n\tapi := CoreApi\n\trcv := (*C.godot_aabb)(unsafe.Pointer(gdt))\n\tin0 := (*C.godot_vector3)(unsafe.Pointer(&p_from))\n\tin1 := (*C.godot_vector3)(unsafe.Pointer(&p_to))\n\n\tret := C.go_godot_aabb_intersects_segment(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t\tin1,\n\t)\n\truntime.KeepAlive(in0)\n\truntime.KeepAlive(in1)\n\n\treturn *(*bool)(unsafe.Pointer(&ret))\n}", "title": "" }, { "docid": "e0310cd47ac249907da1b86764dd5c41", "score": "0.46697477", "text": "func intersect(slice1, slice2 []string) []string {\n\tvar result []string\n\tfor _, i := range slice1 {\n\t\tif Contains(slice2, i) {\n\t\t\tresult = append(result, i)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "192815d7ea1f0ff5ca86e72c3c6d4464", "score": "0.46652383", "text": "func (s Spans) IntersectionWithHandler(intersectHandlerFunc IntersectionHandlerFunc) Spans {\n\tvar sorted Spans\n\tsorted = append(sorted, s...)\n\tsort.Stable(ByStart(sorted))\n\n\tactives := Spans{sorted[0]}\n\n\tintersections := Spans{}\n\n\tfor _, b := range sorted[1:] {\n\t\t// Tidy up the active span list\n\t\tactives = filter(actives, func(t Span) bool {\n\t\t\t// If this value is identical to one in actives, don't filter it.\n\t\t\tif b.Start() == t.Start() && b.End() == t.End() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// If this value starts after the one in actives finishes, filter the active.\n\t\t\treturn b.Start().After(t.End())\n\t\t})\n\n\t\tfor _, a := range actives {\n\t\t\tif overlap(a, b) {\n\t\t\t\tspanStart := getMax(EndPoint{a.Start(), a.StartType()}, EndPoint{b.Start(), b.StartType()})\n\t\t\t\tspanEnd := getMin(EndPoint{a.End(), a.EndType()}, EndPoint{b.End(), b.EndType()})\n\n\t\t\t\tif a.Start().Equal(b.Start()) {\n\t\t\t\t\tspanStart.Type = getTightestIntervalType(a.StartType(), b.StartType())\n\t\t\t\t}\n\t\t\t\tif a.End().Equal(b.End()) {\n\t\t\t\t\tspanEnd.Type = getTightestIntervalType(a.EndType(), b.EndType())\n\t\t\t\t}\n\t\t\t\tspan := NewWithTypes(spanStart.Element, spanEnd.Element, spanStart.Type, spanEnd.Type)\n\t\t\t\tintersection := intersectHandlerFunc(a, b, span)\n\t\t\t\tintersections = append(intersections, intersection)\n\t\t\t}\n\t\t}\n\t\tactives = append(actives, b)\n\t}\n\treturn intersections\n}", "title": "" }, { "docid": "4b7c181cb735fb6546bb12752ddedfb8", "score": "0.46529666", "text": "func intersect(a, b []string) (c []string) {\n\tc = []string{}\n\tfor _, aa := range a {\n\t\tfor _, bb := range b {\n\t\t\tif aa == bb {\n\t\t\t\tc = append(c, aa)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2b3d43e535fbd66474e6c5a50dad0b2b", "score": "0.46377033", "text": "func (setGroup *setGroup) Intersect(setKeys ...interface{}) []interface{} {\n\tsetGroup.mutex.RLock()\n\tdefer setGroup.mutex.RUnlock()\n\n\tsetKeysLen := len(setKeys)\n\tsetKeysRelational := make([][][1024]uint64, setKeysLen)\n\tvar intersectResult []interface{}\n\tminIterationsOffset := math.MaxUint32\n\tfor setKeyIndex, setKey := range setKeys {\n\t\t// judgment the set exists, if not, return []interface{}{}\n\t\tsetMemberBitMap, setExist := setGroup.groupSetRelationalMap[setKey]\n\t\tif !setExist {\n\t\t\treturn intersectResult\n\t\t}\n\t\tif setMemberBitMap == nil || len(setMemberBitMap) == 0 {\n\t\t\treturn intersectResult\n\t\t}\n\t\tif len(setMemberBitMap) < minIterationsOffset {\n\t\t\tminIterationsOffset = len(setMemberBitMap)\n\t\t}\n\t\tsetKeysRelational[setKeyIndex] = setMemberBitMap\n\t}\n\n\t// iterate from minIterationsOffset to 0 find the intersection\n\tfor iter := minIterationsOffset - 1; iter >= 0; iter-- {\n\t\tif setGroup.indexProduceCounter>>6>>10 < uint64(iter) {\n\t\t\tcontinue\n\t\t}\n\t\tindexOffset := setGroup.indexProduceCounter - uint64(iter)<<10<<6\n\t\tbitMapIndex := 1023\n\t\tif indexOffset < 1<<10<<6 {\n\t\t\tbitMapIndex = int(indexOffset)>>6 + 1\n\t\t}\n\n\t\tfor ; bitMapIndex >= 0; bitMapIndex-- {\n\t\t\titemIterBitMap := uint64(math.MaxUint64)\n\t\t\tfor _, setMemberBitMap := range setKeysRelational {\n\t\t\t\titemIterBitMap &= setMemberBitMap[iter][bitMapIndex]\n\t\t\t\tif itemIterBitMap == 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif itemIterBitMap > 0 {\n\t\t\t\tfor nBit := 0; nBit < 63; nBit++ {\n\t\t\t\t\tif (itemIterBitMap>>nBit)&1 == 1 {\n\t\t\t\t\t\tintersectResult = append(intersectResult, setGroup.indexMemberSlice[iter*(1<<16)+bitMapIndex*64+nBit].member)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn intersectResult\n}", "title": "" }, { "docid": "c230920dac6dd01e5b42d0eb5665aa38", "score": "0.4634531", "text": "func (w *Wire) Intersection(other Wire) []utils.Point2D {\n\tvar res []utils.Point2D\n\n\texcludePoint := utils.Point2D{\n\t\tX: 0,\n\t\tY: 0,\n\t}\n\n\tfor p := range w.Coordinates {\n\t\tif other.IsOnPoint(p) && p != excludePoint {\n\t\t\tres = append(res, p)\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "f8a9cc646b283dc569d4b8d891b5371b", "score": "0.46332142", "text": "func (c *connectivityGroup) intersect(cg *connectivityGroup) *connectivityGroup {\n\tret := &connectivityGroup{\n\t\tset: c.set.intersect(cg.set),\n\t\tparticipatingHosts: c.participatingHosts,\n\t\tparticipatingPrimaryGroups: c.participatingPrimaryGroups,\n\t}\n\tret.mergeParticipants(cg)\n\treturn ret\n}", "title": "" }, { "docid": "21316a1469300b84f53d2bdb82d9dd7a", "score": "0.46306485", "text": "func (p *PointLight) Intersect(r *util.Ray) *util.Hitrecord {\n\treturn nil\n}", "title": "" }, { "docid": "42ff9931af50d8c6da2a2153f3c4c861", "score": "0.46271905", "text": "func (sd SignedDistance) OpSmoothIntersection(x, y, k float64) float64 {\n\th := Clamp(0.5-0.5*(y-x)/k, 0.0, 1.0)\n\n\treturn Lerp(y, x, h) + k*h*(1.0-h)\n}", "title": "" }, { "docid": "6f8b5b8f21150ffe2c453e77d2ff186d", "score": "0.46232313", "text": "func intersectionRange(start, end, newStart, newEnd int) (s int, e int) {\n\tif start > newStart {\n\t\ts = start\n\t} else {\n\t\ts = newStart\n\t}\n\n\tif end < newEnd {\n\t\te = end\n\t} else {\n\t\te = newEnd\n\t}\n\treturn s, e\n}", "title": "" }, { "docid": "6ec519620494c0f6659ab4218b68529f", "score": "0.46137914", "text": "func (csg *Csg) Intersect(ray *ray.Ray) []*Intersection {\n\tr := csg.transformRay(ray)\n\tints := csg.left.Intersect(r)\n\tints = append(ints, csg.right.Intersect(r)...)\n\n\treturn csg.filterIntersections(sortIntersections(ints))\n}", "title": "" }, { "docid": "c5256d7807572600dc48cea96ab743e2", "score": "0.46132028", "text": "func (t *Triangle) LocalIntersect(r *algebra.Ray) ([]*Intersection, bool) {\n\txs := make([]*Intersection, 0, 0)\n\tdirection := r.Get()[\"direction\"]\n\tdirCrossProduct, err := algebra.CrossProduct(direction, t.e2)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdet, err := algebra.DotProduct(t.e1, dirCrossProduct)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif math.Abs(det) <= algebra.EPSILON {\n\t\treturn xs, false\n\t}\n\n\torigin := r.Get()[\"origin\"]\n\tf := 1.0 / det\n\tp1ToOrigin, err := origin.Subtract(t.p1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tu, err := algebra.DotProduct(p1ToOrigin, dirCrossProduct)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tu *= f\n\tif u < 0 || u > 1 {\n\t\treturn xs, false\n\t}\n\n\toriginCross, err := algebra.CrossProduct(p1ToOrigin, t.e1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tv, err := algebra.DotProduct(direction, originCross)\n\tv *= f\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif v < 0 || (u+v) > 1 {\n\t\treturn xs, false\n\t}\n\n\tpos, err := algebra.DotProduct(t.e2, originCross)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpos *= f\n\txs = append(xs, NewIntersection(t, pos))\n\treturn xs, true\n}", "title": "" }, { "docid": "48c4b0f2617ac462c506a642adf69ab8", "score": "0.46130615", "text": "func intersection[T constraints.Ordered](pS ...[]T) []T {\n\thash := make(map[T]*int) // value, counter\n\tresult := make([]T, 0)\n\tfor _, slice := range pS {\n\t\tduplicationHash := make(map[T]bool) // duplication checking for individual slice\n\t\tfor _, value := range slice {\n\t\t\tif _, isDup := duplicationHash[value]; !isDup { // is not duplicated in slice\n\t\t\t\tif counter := hash[value]; counter != nil { // is found in hash counter map\n\t\t\t\t\tif *counter++; *counter >= len(pS) { // is found in every slice\n\t\t\t\t\t\tresult = append(result, value)\n\t\t\t\t\t}\n\t\t\t\t} else { // not found in hash counter map\n\t\t\t\t\ti := 1\n\t\t\t\t\thash[value] = &i\n\t\t\t\t}\n\t\t\t\tduplicationHash[value] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "a67b16a4ec49c68cc2dd8ad414acc644", "score": "0.4611485", "text": "func adjsIntersectP(a ClumpAdj, b ClumpAdj, m map[string]*Clump) bool {\n\ta1, found := m[a.EndIDs[0]]\n\tif !found {\n\t\treturn false\n\t}\n\ta2, found := m[a.EndIDs[1]]\n\tif !found {\n\t\treturn false\n\t}\n\tb1, found := m[b.EndIDs[0]]\n\tif !found {\n\t\treturn false\n\t}\n\tb2, found := m[b.EndIDs[1]]\n\tif !found {\n\t\treturn false\n\t}\n\tendSet := map[string]bool{ // if two adjs \"share\" an endpoint, that's not ∩. Count distinct endpoints:\n\t\ta.EndIDs[0]: true,\n\t\ta.EndIDs[1]: true,\n\t\tb.EndIDs[0]: true,\n\t\tb.EndIDs[1]: true,\n\t}\n\tif len(endSet) < 4 {\n\t\treturn false\n\t}\n\treturn segsIntersectP(a1.Lat, a1.Lng, a2.Lat, a2.Lng, b1.Lat, b1.Lng, b2.Lat, b2.Lng)\n}", "title": "" } ]
e9a3fb28b61c005ccb17c9b1e60146e1
TemplateAction implements TemplateAction interface
[ { "docid": "9d0ccec4117b6bce16a5485658eb4799", "score": "0.6917955", "text": "func (*DatetimePickerAction) TemplateAction() {}", "title": "" } ]
[ { "docid": "4651849fd5886f0eed5e3ef3cca72732", "score": "0.80447865", "text": "func (*MessageAction) TemplateAction() {}", "title": "" }, { "docid": "4651849fd5886f0eed5e3ef3cca72732", "score": "0.80447865", "text": "func (*MessageAction) TemplateAction() {}", "title": "" }, { "docid": "2583c8666d1701fe1e592245c2e24730", "score": "0.8038708", "text": "func (*URIAction) TemplateAction() {}", "title": "" }, { "docid": "2583c8666d1701fe1e592245c2e24730", "score": "0.8038708", "text": "func (*URIAction) TemplateAction() {}", "title": "" }, { "docid": "324ae3b26061787dfd50b8435d1194d5", "score": "0.7695131", "text": "func (*PostbackAction) TemplateAction() {}", "title": "" }, { "docid": "324ae3b26061787dfd50b8435d1194d5", "score": "0.7695131", "text": "func (*PostbackAction) TemplateAction() {}", "title": "" }, { "docid": "31d17295a8b7d10b197a6fb926979fad", "score": "0.7410658", "text": "func (ForwardRequestAction) Template() string { return \"request-forward-action\" }", "title": "" }, { "docid": "5d0e725b25f38098c72b50a63d6fd2df", "score": "0.6126914", "text": "func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {}", "title": "" }, { "docid": "c4820a1f76e791f76a555fbaaa0fd7cb", "score": "0.6003523", "text": "func (m *Module) OutputTemplate(template func(interface{}) bar.Output) base.WithClickHandler {\n\treturn m.OutputFunc(func(i Info) bar.Output { return template(i) })\n}", "title": "" }, { "docid": "0dc4c997e798e22bb5dcd014b5d3a109", "score": "0.5992375", "text": "func TemplateExecuteTemplate(t *template.Template, wr io.Writer, name string, data interface{}) error", "title": "" }, { "docid": "809f6b072bd662e954461394a172c815", "score": "0.5887287", "text": "func HandlerTemplate(c echo.Context, cmd func(c echo.Context) (*Response, error)) (erro error) {\n\terro = nil\n\tresponse := &Response{}\n\n\tdefer func() {\n\t\tif erro == nil {\n\t\t\terro = c.JSON(http.StatusOK, response)\n\t\t}\n\t}()\n\n\tresponse, erro = cmd(c)\n\treturn\n}", "title": "" }, { "docid": "0fe1ee657a7746b6f74213a5a2e8bf85", "score": "0.58778465", "text": "func TemplateExecute(t *template.Template, wr io.Writer, data interface{}) error", "title": "" }, { "docid": "7e936e6788a70759edc1be6ac52d790e", "score": "0.5839041", "text": "func (t *Template) Execute(wr io.Writer, data interface{}) error {}", "title": "" }, { "docid": "ffafa7d659eda28d6f29ac12015f15ac", "score": "0.57982343", "text": "func (c *Client) template(template uint, data map[string]interface{}) (string, error) {\n\tpanic(\"TODO\")\n}", "title": "" }, { "docid": "07197718f2b2c8213457836933b93f30", "score": "0.57604796", "text": "func NewActionTemplate(name string, actionType string) *ActionTemplate {\n\treturn &ActionTemplate{\n\t\tActionType: actionType,\n\t\tName: name,\n\t\tPackages: []PackageReference{},\n\t\tParameters: []ActionTemplateParameter{},\n\t\tProperties: map[string]PropertyValue{},\n\t\tresource: *newResource(),\n\t}\n}", "title": "" }, { "docid": "5d34eab99ce5b08e43c517606fc5d534", "score": "0.5598224", "text": "func ExecuteTemplate(w http.ResponseWriter, tmpl string, data interface{}) {\n\ttemplates.ExecuteTemplate(w, tmpl, data)\n}", "title": "" }, { "docid": "9f064743297e1aa8fad8b79eb399df95", "score": "0.54896647", "text": "func ExecuteTemplate(txtTemplate string, context interface{}) (string, error) {\n\treturn ExecuteTemplateFunctions(txtTemplate, nil, context)\n}", "title": "" }, { "docid": "97524310bdbe5307a2061e5c2003d656", "score": "0.5478506", "text": "func (ctx *Context) ExecuteTemplate(i interface{}) (interface{}, error) {\n\treturn template.Execute(i, ctx)\n}", "title": "" }, { "docid": "0d644711b55598babe09b2f96f5c0528", "score": "0.54163975", "text": "func applyTemplate() {\n var templateString = []byte(indexTemplate);\n req, err := http.NewRequest(\"POST\", \"http://localhost:9200\" + \"/_template/tbresults_template\", bytes.NewBuffer(templateString))\n req.Header.Set(\"Content-Type\", \"application/json\")\n httpClient := &http.Client{}\n resp, err := httpClient.Do(req)\n defer resp.Body.Close()\n if err != nil {\n\tpanic(err)\n } else {\n\tfmt.Println(\"Template created for the index\")\n\ttemplateApplied = true\n }\n}", "title": "" }, { "docid": "1747c941bfbf1ebd71d9012bd5c960c3", "score": "0.54096377", "text": "func (a *ActionTemplate) Validate() error {\n\tv := validator.New()\n\tif err := v.RegisterValidation(\"notblank\", validators.NotBlank); err != nil {\n\t\treturn err\n\t}\n\n\treturn v.Struct(a)\n}", "title": "" }, { "docid": "5477456b2a8ac29269946174aafbf79e", "score": "0.5400356", "text": "func (k *KatibUIHandler) EditTemplate(w http.ResponseWriter, r *http.Request) {\n\n\tvar data map[string]interface{}\n\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\tlog.Printf(\"Failed to decode body: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tupdatedConfigMapNamespace := data[\"updatedConfigMapNamespace\"].(string)\n\tupdatedConfigMapName := data[\"updatedConfigMapName\"].(string)\n\tconfigMapPath := data[\"configMapPath\"].(string)\n\tupdatedConfigMapPath := data[\"updatedConfigMapPath\"].(string)\n\tupdatedTemplateYaml := data[\"updatedTemplateYaml\"].(string)\n\n\tuser, err := IsAuthorized(consts.ActionTypeUpdate, updatedConfigMapNamespace, corev1.ResourceConfigMaps.String(), \"\", updatedConfigMapName, corev1.SchemeGroupVersion, k.katibClient.GetClient(), r)\n\tif user == \"\" && err != nil {\n\t\tlog.Printf(\"No user provided in kubeflow-userid header.\")\n\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Printf(\"The user: %s is not authorized to edit configmap: %s in namespace: %s \\n\", user, updatedConfigMapName, updatedConfigMapNamespace)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\tnewTemplates, err := k.updateTrialTemplates(updatedConfigMapNamespace, updatedConfigMapName, configMapPath, updatedConfigMapPath, updatedTemplateYaml, ActionTypeEdit, r)\n\tif err != nil {\n\t\tlog.Printf(\"updateTrialTemplates failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tTrialTemplatesResponse := TrialTemplatesResponse{\n\t\tData: newTemplates,\n\t}\n\tresponse, err := json.Marshal(TrialTemplatesResponse)\n\tif err != nil {\n\t\tlog.Printf(\"Marhal failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif _, err = w.Write(response); err != nil {\n\t\tlog.Printf(\"Write failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e84865ea24d861323a8243ee6adb0747", "score": "0.538865", "text": "func (r *REParams) Template() string {\n\treturn \"${remoteexec.Wrapper}\" + r.wrapperArgs()\n}", "title": "" }, { "docid": "0cd0c9034a38eb050343c49890886582", "score": "0.53867817", "text": "func Template(s *symbols.SymbolTable, args []interface{}) (interface{}, error) {\n\tvar err error\n\tif len(args) == 0 {\n\t\treturn nil, errors.ErrArgumentCount\n\t}\n\ttree, ok := args[0].(*template.Template)\n\tif !ok {\n\t\treturn nil, errors.ErrArgumentCount\n\t}\n\n\troot := tree.Tree.Root\n\tfor _, n := range root.Nodes {\n\t\t//fmt.Printf(\"Node[%2d]: %#v\\n\", i, n)\n\t\tif n.Type() == tparse.NodeTemplate {\n\t\t\ttemplateNode := n.(*tparse.TemplateNode)\n\t\t\t// Get the named template and add it's tree here\n\t\t\ttv, ok := s.Get(templateNode.Name)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.ErrInvalidTemplateName.Context(templateNode.Name)\n\t\t\t}\n\t\t\tt, ok := tv.(*template.Template)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.ErrInvalidType\n\t\t\t}\n\t\t\t_, err = tree.AddParseTree(templateNode.Name, t.Tree)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar r bytes.Buffer\n\tif len(args) == 1 {\n\t\terr = tree.Execute(&r, nil)\n\t} else {\n\t\terr = tree.Execute(&r, args[1])\n\t}\n\treturn r.String(), err\n}", "title": "" }, { "docid": "d7e4752f8e55efc8c86f648e3e936446", "score": "0.5378023", "text": "func TextAction(text string, url string) *Action {\n\treturn &Action{\"text\", text, url, false}\n}", "title": "" }, { "docid": "bec6106252db37b9c19af4e144063e3a", "score": "0.5322886", "text": "func handleTemplate(w http.ResponseWriter, arg string, queryParams url.Values) {\n\ttplFileName := filepath.Join(\"testdata\", arg+\".tpl\")\n\ttplFile, err := afero.ReadFile(fs, tplFileName)\n\tif os.IsNotExist(err) {\n\t\thandleHTTPCode(w, \"404\")\n\t\treturn\n\t}\n\tif handleError(w, err) {\n\t\treturn\n\t}\n\tt, err := template.New(\"response\").Parse(string(tplFile))\n\tif handleError(w, err) {\n\t\treturn\n\t}\n\tdata := map[string]string{}\n\tfor k, vs := range queryParams {\n\t\tdata[k] = vs[len(vs)-1]\n\t}\n\thandleError(w, t.Execute(w, data))\n}", "title": "" }, { "docid": "2d89ef29351e1a429a39f5b84cb381a0", "score": "0.5296172", "text": "func (t Template) Execute(ctx context.Context, ch1 chan error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn\n\tdefault:\n\t\tch1 <- t.RenderAndWrite()\n\t}\n}", "title": "" }, { "docid": "7a5ae64050f6dbe8b71fc040f72f5107", "score": "0.52877307", "text": "func (p Project) executeTemplate(tmpl string, overwrite bool) error {\n\treturn execProjectTemplate(p, tmpl, overwrite)\n}", "title": "" }, { "docid": "24e62787ef2522007af9968fce4ed5ef", "score": "0.52824646", "text": "func TemplateCommand(c *cli.Context) error {\n\ttemplate := c.Args().First()\n\tif template != a.ResourceShow && template != a.ResourceEpisode {\n\t\tfmt.Println(fmt.Sprintf(\"\\nDon't know how to create '%s'\", template))\n\t\treturn nil\n\t}\n\n\tname := \"NAME\"\n\tif c.NArg() == 2 {\n\t\tname = c.Args().Get(1)\n\t}\n\t// extract flags or set defaults\n\tguid := c.String(\"id\")\n\tif guid == \"\" {\n\t\tguid, _ = util.ShortUUID()\n\t}\n\tparent := c.String(\"parent\")\n\tif parent == \"\" {\n\t\tparent = \"PARENT-NAME\"\n\t}\n\tparentGUID := c.String(\"parentid\")\n\tif parentGUID == \"\" {\n\t\tparentGUID = \"PARENT-ID\"\n\t}\n\n\t// create the yamls\n\tif template == \"show\" {\n\n\t\tshow := a.DefaultShow(name, \"TITLE\", \"SUMMARY\", guid, a.DefaultPortalEndpoint, a.DefaultCDNEndpoint)\n\t\terr := dump(fmt.Sprintf(\"show-%s.yaml\", guid), show)\n\t\tif err != nil {\n\t\t\tprintError(c, err)\n\t\t\treturn nil\n\t\t}\n\t} else {\n\n\t\tepisode := a.DefaultEpisode(name, parent, guid, parentGUID, a.DefaultPortalEndpoint, a.DefaultCDNEndpoint)\n\t\terr := dump(fmt.Sprintf(\"episode-%s.yaml\", guid), episode)\n\t\tif err != nil {\n\t\t\tprintError(c, err)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "99c8241345781dc964f86c5f44948753", "score": "0.52495843", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p interface{}) {\n\terr := templates.ExecuteTemplate(w, tmpl, p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "99c8241345781dc964f86c5f44948753", "score": "0.52495843", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p interface{}) {\n\terr := templates.ExecuteTemplate(w, tmpl, p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "d301a735957b23767ca48439da6ab90b", "score": "0.52490324", "text": "func (k *KatibUIHandler) DeleteTemplate(w http.ResponseWriter, r *http.Request) {\n\n\tvar data map[string]interface{}\n\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\tlog.Printf(\"Failed to decode body: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tupdatedConfigMapNamespace := data[\"updatedConfigMapNamespace\"].(string)\n\tupdatedConfigMapName := data[\"updatedConfigMapName\"].(string)\n\tupdatedConfigMapPath := data[\"updatedConfigMapPath\"].(string)\n\n\tuser, err := IsAuthorized(consts.ActionTypeDelete, updatedConfigMapNamespace, corev1.ResourceConfigMaps.String(), \"\", updatedConfigMapName, corev1.SchemeGroupVersion, k.katibClient.GetClient(), r)\n\tif user == \"\" && err != nil {\n\t\tlog.Printf(\"No user provided in kubeflow-userid header.\")\n\t\thttp.Error(w, err.Error(), http.StatusUnauthorized)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Printf(\"The user: %s is not authorized to delete configmap: %s in namespace: %s \\n\", user, updatedConfigMapName, updatedConfigMapNamespace)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\tnewTemplates, err := k.updateTrialTemplates(updatedConfigMapNamespace, updatedConfigMapName, \"\", updatedConfigMapPath, \"\", ActionTypeDelete, r)\n\tif err != nil {\n\t\tlog.Printf(\"updateTrialTemplates failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tTrialTemplatesResponse := TrialTemplatesResponse{\n\t\tData: newTemplates,\n\t}\n\n\tresponse, err := json.Marshal(TrialTemplatesResponse)\n\tif err != nil {\n\t\tlog.Printf(\"Marhal failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif _, err = w.Write(response); err != nil {\n\t\tlog.Printf(\"Write failed: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a06c120d83db20e41e9b8655c170d5a5", "score": "0.52345514", "text": "func executeTemplate(context *common.AppContext, name string, params map[string]interface{}) []byte {\n\tcontext.Log.Println(\"Executing template named\", name)\n\tt, err := template.ParseFiles(\"views/\" + name + \".html\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\tmarkup := new(bytes.Buffer)\n\terr = t.Execute(markup, params)\n\tif err != nil {\n\t\tcontext.Log.Panic(err)\n\t\treturn nil\n\t}\n\treturn markup.Bytes()\n}", "title": "" }, { "docid": "56de522781c0eddf1eadd58164fc08f3", "score": "0.5213099", "text": "func (pkg *SwarmPackage) ExecuteTemplate() {\n\n\tif len(pkg.name) == 0 {\n\t\tlog.Panicf(\"Service unit is not inited. Use NewService()\")\n\t}\n\n\tpkgFilename := filepath.Join(pkg.dir, config.Global.SwarmPkgTmplFile)\n\n\tlog.Debugf(\"Templating service: %s\", pkg.name)\n\terr := template.ExecTemplate(pkgFilename, &pkg.manifest, pkg.configData)\n\tcheckErr(err)\n\tlog.Debugf(\"Service %s manifest after templating: \\n%s\", pkg.name, pkg.manifest.String())\n\tcheckErr(err)\n\tpkg.readyForDeploy = true\n\n}", "title": "" }, { "docid": "a0c55225d3802cebf4eeb75023a8dd1d", "score": "0.51939285", "text": "func (x *Extemplate) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {\n\ttmpl := x.Lookup(name)\n\tif tmpl == nil {\n\t\treturn fmt.Errorf(\"extemplate: no template %q\", name)\n\t}\n\n\treturn tmpl.Execute(wr, data)\n}", "title": "" }, { "docid": "b860e354502aa2919767d5fc6883c526", "score": "0.51895595", "text": "func templateExecute(w http.ResponseWriter, tmpl *template.Template, data interface{}) error {\n\tvar buf bytes.Buffer\n\tif err := tmpl.Execute(&buf, data); err != nil {\n\t\treturn err\n\t}\n\n\tif n, err := buf.WriteTo(w); n == 0 {\n\t\t// Only forward the error if nothing was written.\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0ca5c50c23b05d5cc8cb7b8b5654e159", "score": "0.5179998", "text": "func Build(ctx context.Context, tx *types.TxData, actions []Action, maxTime time.Time, timeRange uint64) (*Template, error) {\n\tbuilder := TemplateBuilder{\n\t\tbase: tx,\n\t\tmaxTime: maxTime,\n\t\ttimeRange: timeRange,\n\t}\n\n\t// Build all of the actions, updating the builder.\n\tvar errs []error\n\tfor i, action := range actions {\n\t\terr := action.Build(ctx, &builder)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"module\": logModule, \"action index\": i, \"error\": err}).Error(\"Loop tx's action\")\n\t\t\terrs = append(errs, errors.WithDetailf(err, \"action index %v\", i))\n\t\t}\n\t}\n\n\t// If there were any errors, rollback and return a composite error.\n\tif len(errs) > 0 {\n\t\tbuilder.Rollback()\n\t\treturn nil, errors.WithData(ErrAction, \"actions\", errs)\n\t}\n\n\t// Build the transaction template.\n\ttpl, tx, err := builder.Build()\n\tif err != nil {\n\t\tbuilder.Rollback()\n\t\treturn nil, err\n\t}\n\n\t/*TODO: This part is use for check the balance, but now we are using btm as gas fee\n\tthe rule need to be rewrite when we have time\n\terr = checkBlankCheck(tx)\n\tif err != nil {\n\t\tbuilder.rollback()\n\t\treturn nil, err\n\t}*/\n\n\treturn tpl, nil\n}", "title": "" }, { "docid": "7a257ac4c678fa156ccbb1033c4e5ce7", "score": "0.51780725", "text": "func UpdateTemplate(w http.ResponseWriter, r *http.Request) {\n\toldTemplate := context.Get(r, \"template\").(db.Template)\n\n\tvar template db.Template\n\tif !helpers.Bind(w, r, &template) {\n\t\treturn\n\t}\n\n\t// project ID and template ID in the body and the path must be the same\n\n\tif template.ID != oldTemplate.ID {\n\t\thelpers.WriteJSON(w, http.StatusBadRequest, map[string]string{\n\t\t\t\"error\": \"template id in URL and in body must be the same\",\n\t\t})\n\t\treturn\n\t}\n\n\tif template.ProjectID != oldTemplate.ProjectID {\n\t\thelpers.WriteJSON(w, http.StatusBadRequest, map[string]string{\n\t\t\t\"error\": \"You can not move template to other project\",\n\t\t})\n\t\treturn\n\t}\n\n\tif template.Arguments != nil && *template.Arguments == \"\" {\n\t\ttemplate.Arguments = nil\n\t}\n\n\terr := helpers.Store(r).UpdateTemplate(template)\n\tif err != nil {\n\t\thelpers.WriteError(w, err)\n\t\treturn\n\t}\n\n\tuser := context.Get(r, \"user\").(*db.User)\n\n\tdesc := \"Template ID \" + strconv.Itoa(template.ID) + \" updated\"\n\tobjType := db.EventTemplate\n\n\t_, err = helpers.Store(r).CreateEvent(db.Event{\n\t\tUserID: &user.ID,\n\t\tProjectID: &template.ProjectID,\n\t\tDescription: &desc,\n\t\tObjectID: &template.ID,\n\t\tObjectType: &objType,\n\t})\n\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "75b9ea6d652d508fdb1898d651af7136", "score": "0.51571065", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page){\n err := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n if err != nil{\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "adeb7a3b691594e6c544701abae9db52", "score": "0.5150192", "text": "func execTemplate(t *template.Template, name string, data interface{}) (template.HTML, error) {\n\tb := new(bytes.Buffer)\n\terr := t.ExecuteTemplate(b, name, data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn template.HTML(b.String()), nil\n}", "title": "" }, { "docid": "f6c56af921935ab688f1dd5397b69b67", "score": "0.51473725", "text": "func (res *Resource) Action(action string, storage store.Action, allow bool) {\n\tmatcher := path.Join(patID, action)\n\n\tvar handler = res.notAllowedHandler\n\tif allow {\n\t\thandler = func(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t\t\tres.actionHandler(ctx, w, r, storage)\n\t\t}\n\t}\n\n\tres.HandleFuncC(pat.Post(matcher), handler)\n\tres.addRoute(post, matcher, allow)\n}", "title": "" }, { "docid": "14228302bf0855e8f18ddf90b939c526", "score": "0.51406693", "text": "func executeTemplate(tmplText []byte, params interface{}, w io.Writer) error {\n\tt, err := createTemplate(tmplText)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := t.Execute(w, params); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5d853e2d1c2d6a40a0095d23e3aeb87", "score": "0.51379675", "text": "func (c *ServicedCli) initTemplate() {\n\tc.app.Commands = append(c.app.Commands, cli.Command{\n\t\tName: \"template\",\n\t\tUsage: \"Administers templates\",\n\t\tDescription: \"\",\n\t\tSubcommands: []cli.Command{\n\t\t\t{\n\t\t\t\tName: \"list\",\n\t\t\t\tUsage: \"Lists all templates\",\n\t\t\t\tDescription: \"serviced template list [TEMPLATEID]\",\n\t\t\t\tBashComplete: c.printTemplatesFirst,\n\t\t\t\tAction: c.cmdTemplateList,\n\t\t\t\tFlags: []cli.Flag{\n\t\t\t\t\tcli.BoolFlag{\n\t\t\t\t\t\tName: \"verbose, v\",\n\t\t\t\t\t\tUsage: \"Show JSON format\",\n\t\t\t\t\t},\n\t\t\t\t\tcli.StringFlag{\n\t\t\t\t\t\tName: \"show-fields\",\n\t\t\t\t\t\tValue: \"TemplateID,Name,Description\",\n\t\t\t\t\t\tUsage: \"Comma-delimited list describing which fields to display\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}, {\n\t\t\t\tName: \"add\",\n\t\t\t\tUsage: \"Add a new template\",\n\t\t\t\tDescription: \"serviced template add FILE\",\n\t\t\t\tAction: c.cmdTemplateAdd,\n\t\t\t}, {\n\t\t\t\tName: \"remove\",\n\t\t\t\tShortName: \"rm\",\n\t\t\t\tUsage: \"Remove an existing template\",\n\t\t\t\tDescription: \"serviced template remove TEMPLATEID ...\",\n\t\t\t\tBashComplete: c.printTemplatesAll,\n\t\t\t\tAction: c.cmdTemplateRemove,\n\t\t\t}, {\n\t\t\t\tName: \"deploy\",\n\t\t\t\tUsage: \"Deploys a template's services to a pool\",\n\t\t\t\tDescription: \"serviced template deploy TEMPLATEID POOLID DEPLOYMENTID\",\n\t\t\t\tBashComplete: c.printTemplateDeploy,\n\t\t\t\tAction: c.cmdTemplateDeploy,\n\t\t\t\tFlags: []cli.Flag{\n\t\t\t\t\tcli.BoolFlag{\n\t\t\t\t\t\tName: \"manual-assign-ips\",\n\t\t\t\t\t\tUsage: \"Manually assign IP addresses\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}, {\n\t\t\t\tName: \"compile\",\n\t\t\t\tUsage: \"Convert a directory of service definitions into a template\",\n\t\t\t\tDescription: \"serviced template compile PATH\",\n\t\t\t\tAction: c.cmdTemplateCompile,\n\t\t\t\tFlags: []cli.Flag{\n\t\t\t\t\tcli.GenericFlag{\n\t\t\t\t\t\tName: \"map\",\n\t\t\t\t\t\tValue: &api.ImageMap{},\n\t\t\t\t\t\tUsage: \"Map a given image name to another (e.g. -map zenoss/zenoss5x:latest,quay.io/zenoss-core:alpha2)\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "11e11712d5e1d0881db9b986762d76b3", "score": "0.51360726", "text": "func TemplateEmbed(writer http.ResponseWriter, request *http.Request) { //! dynamic template menggunakan directory\n\tt := template.Must(template.ParseFS(templates, \"template/*.gohtml\"))\n\tt.ExecuteTemplate(writer, \"simple.gohtml\", \"Hello Go Template HTML File\")\n}", "title": "" }, { "docid": "b4aa2496b15aaa10deb896066093cc32", "score": "0.51348144", "text": "func (c *TemplateInstanceController) instantiate(templateInstance *templatev1.TemplateInstance) error {\n\tif templateInstance.Spec.Requester == nil || templateInstance.Spec.Requester.Username == \"\" {\n\t\treturn fmt.Errorf(\"spec.requester.username not set\")\n\t}\n\n\textra := map[string][]string{}\n\tfor k, v := range templateInstance.Spec.Requester.Extra {\n\t\textra[k] = []string(v)\n\t}\n\n\tu := &user.DefaultInfo{\n\t\tName: templateInstance.Spec.Requester.Username,\n\t\tUID: templateInstance.Spec.Requester.UID,\n\t\tGroups: templateInstance.Spec.Requester.Groups,\n\t\tExtra: extra,\n\t}\n\n\tvar secret *corev1.Secret\n\tif templateInstance.Spec.Secret != nil {\n\t\tif err := util.Authorize(c.sarClient.SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{\n\t\t\tNamespace: templateInstance.Namespace,\n\t\t\tVerb: \"get\",\n\t\t\tGroup: corev1.GroupName,\n\t\t\tResource: \"secrets\",\n\t\t\tName: templateInstance.Spec.Secret.Name,\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts, err := c.kc.CoreV1().Secrets(templateInstance.Namespace).Get(templateInstance.Spec.Secret.Name, metav1.GetOptions{})\n\t\tsecret = s\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttemplatePtr := &templateInstance.Spec.Template\n\ttemplate := templatePtr.DeepCopy()\n\n\tif secret != nil {\n\t\tfor i, param := range template.Parameters {\n\t\t\tif value, ok := secret.Data[param.Name]; ok {\n\t\t\t\ttemplate.Parameters[i].Value = string(value)\n\t\t\t\ttemplate.Parameters[i].Generate = \"\"\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := util.Authorize(c.sarClient.SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{\n\t\tNamespace: templateInstance.Namespace,\n\t\tVerb: \"create\",\n\t\tGroup: templatev1.GroupName,\n\t\tResource: \"templateconfigs\",\n\t\tName: template.Name,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tglog.V(4).Infof(\"TemplateInstance controller: creating TemplateConfig for %s/%s\", templateInstance.Namespace, templateInstance.Name)\n\n\tv1Template, err := legacyscheme.Scheme.ConvertToVersion(template, templatev1.GroupVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprocessedObjects, err := templateprocessing.NewDynamicTemplateProcessor(c.dynamicClient).ProcessToList(v1Template.(*templatev1.Template))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, obj := range processedObjects.Items {\n\t\tlabels := obj.GetLabels()\n\t\tif labels == nil {\n\t\t\tlabels = make(map[string]string)\n\t\t}\n\t\tlabels[TemplateInstanceOwner] = string(templateInstance.UID)\n\t\tobj.SetLabels(labels)\n\t}\n\n\t// First, do all the SARs to ensure the requester actually has permissions\n\t// to create.\n\tglog.V(4).Infof(\"TemplateInstance controller: running SARs for %s/%s\", templateInstance.Namespace, templateInstance.Name)\n\tallErrors := []error{}\n\tfor _, currObj := range processedObjects.Items {\n\t\trestMapping, mappingErr := c.dynamicRestMapper.RESTMapping(currObj.GroupVersionKind().GroupKind(), currObj.GroupVersionKind().Version)\n\t\tif mappingErr != nil {\n\t\t\tallErrors = append(allErrors, mappingErr)\n\t\t\tcontinue\n\t\t}\n\n\t\tnamespace, nsErr := c.processNamespace(templateInstance.Namespace, currObj.GetNamespace(), restMapping.Scope.Name() == meta.RESTScopeNameRoot)\n\t\tif nsErr != nil {\n\t\t\tallErrors = append(allErrors, nsErr)\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := util.Authorize(c.sarClient.SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{\n\t\t\tNamespace: namespace,\n\t\t\tVerb: \"create\",\n\t\t\tGroup: restMapping.Resource.Group,\n\t\t\tResource: restMapping.Resource.Resource,\n\t\t\tName: currObj.GetName(),\n\t\t}); err != nil {\n\t\t\tallErrors = append(allErrors, err)\n\t\t\tcontinue\n\t\t}\n\t}\n\tif len(allErrors) > 0 {\n\t\treturn utilerrors.NewAggregate(allErrors)\n\t}\n\n\t// Second, create the objects, being tolerant if they already exist and are\n\t// labelled as having previously been created by us.\n\tglog.V(4).Infof(\"TemplateInstance controller: creating objects for %s/%s\", templateInstance.Namespace, templateInstance.Name)\n\ttemplateInstance.Status.Objects = nil\n\tallErrors = []error{}\n\tfor _, currObj := range processedObjects.Items {\n\t\trestMapping, mappingErr := c.dynamicRestMapper.RESTMapping(currObj.GroupVersionKind().GroupKind(), currObj.GroupVersionKind().Version)\n\t\tif mappingErr != nil {\n\t\t\tallErrors = append(allErrors, mappingErr)\n\t\t\tcontinue\n\t\t}\n\n\t\tnamespace, nsErr := c.processNamespace(templateInstance.Namespace, currObj.GetNamespace(), restMapping.Scope.Name() == meta.RESTScopeNameRoot)\n\t\tif nsErr != nil {\n\t\t\tallErrors = append(allErrors, nsErr)\n\t\t\tcontinue\n\t\t}\n\n\t\tcreateObj, createErr := c.dynamicClient.Resource(restMapping.Resource).Namespace(namespace).Create(&currObj)\n\t\tif kerrors.IsAlreadyExists(createErr) {\n\t\t\tfreshGottenObj, getErr := c.dynamicClient.Resource(restMapping.Resource).Namespace(namespace).Get(currObj.GetName(), metav1.GetOptions{})\n\t\t\tif getErr != nil {\n\t\t\t\tallErrors = append(allErrors, getErr)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\towner, ok := freshGottenObj.GetLabels()[TemplateInstanceOwner]\n\t\t\t// if the labels match, it's already our object so pretend we created\n\t\t\t// it successfully.\n\t\t\tif ok && owner == string(templateInstance.UID) {\n\t\t\t\tcreateObj, createErr = freshGottenObj, nil\n\t\t\t} else {\n\t\t\t\tallErrors = append(allErrors, createErr)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif createErr != nil {\n\t\t\tallErrors = append(allErrors, createErr)\n\t\t\tcontinue\n\t\t}\n\n\t\ttemplateInstance.Status.Objects = append(templateInstance.Status.Objects,\n\t\t\ttemplatev1.TemplateInstanceObject{\n\t\t\t\tRef: corev1.ObjectReference{\n\t\t\t\t\tKind: restMapping.GroupVersionKind.Kind,\n\t\t\t\t\tNamespace: namespace,\n\t\t\t\t\tName: createObj.GetName(),\n\t\t\t\t\tUID: createObj.GetUID(),\n\t\t\t\t\tAPIVersion: restMapping.GroupVersionKind.GroupVersion().String(),\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t}\n\n\t// unconditionally add finalizer to the templateinstance because it should always have one.\n\t// TODO perhaps this should be done in a strategy long term.\n\thasFinalizer := false\n\tfor _, v := range templateInstance.Finalizers {\n\t\tif v == TemplateInstanceFinalizer {\n\t\t\thasFinalizer = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !hasFinalizer {\n\t\ttemplateInstance.Finalizers = append(templateInstance.Finalizers, TemplateInstanceFinalizer)\n\t}\n\tif len(allErrors) > 0 {\n\t\treturn utilerrors.NewAggregate(allErrors)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52e0efec9f3a4f7d42aff56993f6ec3f", "score": "0.51311105", "text": "func executeTemplate(filter string, respBody interface{}) error {\n\ttmpl, err := template.New(\"template\").Parse(filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = tmpl.Execute(os.Stdout, respBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94d77cafc9c9e06e19e51895572be9a1", "score": "0.5114605", "text": "func (i Index) Action_create() IndexAction {\n\treturn IndexAction{C.clang_IndexAction_create(i.c)}\n}", "title": "" }, { "docid": "5e781a08acc4a5b29411f40a3fc01168", "score": "0.5107699", "text": "func (t *Template) Name() string {}", "title": "" }, { "docid": "3a2a87663457c7565b9a951cf2a54626", "score": "0.51005375", "text": "func (a *DeployAction) TemplatePath() string {\n\tif a.override != nil && a.override.TemplatePath != \"\" {\n\t\treturn a.override.TemplatePath\n\t}\n\n\t// Use path.Join instead of filepath to join with \"/\" instead of OS-specific file separators.\n\treturn path.Join(DefaultPipelineArtifactsDir, fmt.Sprintf(WorkloadCfnTemplateNameFormat, a.name, a.envName))\n}", "title": "" }, { "docid": "546db6907780539856309f74068a0d33", "score": "0.5098806", "text": "func (m *MayaTemplate) execute(storeIdentifier string) error {\n\tvar isExecuted bool\n\tvar err error\n\tif m.isPutExtnV1B1Deploy() {\n\t\tisExecuted, err = m.putExtnV1B1Deploy()\n\t} else if m.isPutCoreV1Service() {\n\t\tisExecuted, err = m.putCoreV1Service(storeIdentifier)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isExecuted {\n\t\treturn nil\n\t} else {\n\t\treturn fmt.Errorf(\"Not supported operation '%v'\", m.TemplateMeta)\n\t}\n}", "title": "" }, { "docid": "7802d2502c0b84bd2b2b76b83b2827ac", "score": "0.5086334", "text": "func (op *ListOp) Template(val string) *ListOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"template\", val)\n\t}\n\treturn op\n}", "title": "" }, { "docid": "2432032a39079594d2fa5cfbc2639f69", "score": "0.50653946", "text": "func (t tTemplates) New(w http.ResponseWriter, r *http.Request, ctr, act string) *contr.Templates {\n\tc := &contr.Templates{\n\n\t\tAction: act,\n\n\t\tController: ctr,\n\t}\n\treturn c\n}", "title": "" }, { "docid": "4c64aadf6e3e424db635b20e87255810", "score": "0.50614035", "text": "func testTemplate(tplname string) error {\n\treturn executeTemplate(tplname, \"\", 0, 0, 0)\n}", "title": "" }, { "docid": "0017832cf7ef34b57b3cc9010cfdc883", "score": "0.50521743", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page){\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil{\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "f576f633e6f3da40e22538f7241e46a0", "score": "0.5045091", "text": "func ExecuteTemplate(tmpl ExecutableTemplate, data interface{}) string {\n\tvar b bytes.Buffer\n\ttmpl.Execute(&b, data)\n\treturn b.String()\n}", "title": "" }, { "docid": "787abec29d22c1e7560c871a689dcfb2", "score": "0.503543", "text": "func display(w http.ResponseWriter, tmpl string, data interface{}) {\n templates.ExecuteTemplate(w, tmpl, data)\n}", "title": "" }, { "docid": "c4ae2ef3483e96af999500abed37ec36", "score": "0.5024806", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\n\terr := temp.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "9d881555e7c98a2d21c7a1c0e0c8d6bd", "score": "0.5006309", "text": "func ztpAction(action string) (string, error) {\n\tvar output string\n\t// result.Body is of type []interface{}, since any data may be returned by\n\t// the host server. The application is responsible for performing\n\t// type assertions to get the correct data.\n\tresult := HostQuery(\"ztp.\" + action)\n\tif result.Err != nil {\n\t\treturn output, result.Err\n\t}\n\tif ((action == \"status\") || (action == \"getcfg\")) {\n\t\t// ztp.status returns an exit code and the stdout of the command\n\t\t// We only care about the stdout (which is at [1] in the slice)\n\t\toutput, _ = result.Body[0].(string)\n }\n\treturn output, nil\n}", "title": "" }, { "docid": "261a0decfa99716fcc07d09e3476dc46", "score": "0.5006026", "text": "func (o TemplatePermissionOutput) Actions() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TemplatePermission) []string { return v.Actions }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "6296580283fbf2b96f472cad8d318be4", "score": "0.500247", "text": "func (o EventContentResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventContentResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "90b1f7e3a8873fc955a2234ad47a9005", "score": "0.4994915", "text": "func (t *templateImpl) Execute(wr io.Writer, data interface{}) error {\n\treturn t.template.Execute(wr, data)\n}", "title": "" }, { "docid": "2d4a510f0aae65acbbed22c926858fe7", "score": "0.49946317", "text": "func RawAction(c *cli.Context) {\n\tfirst := c.Args().First()\n\tif first == \"\" {\n\t\tfmt.Println(\"'raw' requires one argument\")\n\t\treturn\n\t}\n\terr := eng.Raw(eng.apiServer, first)\n\tif err != nil {\n\t\tfmt.Println(\"Failed: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "e25ad4c8a28e185ba980252ac49b5a41", "score": "0.4970556", "text": "func XUpdateTemplate(paramId string, params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) {\n\thandlerPath := \"update-template\"\n\tif xSubcommand {\n\t\thandlerPath = \"x \" + handlerPath\n\t}\n\n\tserver := viper.GetString(\"server\")\n\tif server == \"\" {\n\t\tserver = xServers()[viper.GetInt(\"server-index\")][\"url\"]\n\t}\n\n\turl := server + \"/template/{id}\"\n\turl = strings.Replace(url, \"{id}\", paramId, 1)\n\n\treq := cli.Client.Put().URL(url)\n\n\tif body != \"\" {\n\t\treq = req.AddHeader(\"Content-Type\", \"application/json\").BodyString(body)\n\t}\n\n\tcli.HandleBefore(handlerPath, params, req)\n\n\tresp, err := req.Do()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Request failed\")\n\t}\n\n\tvar decoded map[string]interface{}\n\n\tif resp.StatusCode < 400 {\n\t\tif err := cli.UnmarshalResponse(resp, &decoded); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"Unmarshalling response failed\")\n\t\t}\n\t} else {\n\t\treturn nil, nil, errors.Errorf(\"HTTP %d: %s\", resp.StatusCode, resp.String())\n\t}\n\n\tafter := cli.HandleAfter(handlerPath, params, resp, decoded)\n\tif after != nil {\n\t\tdecoded = after.(map[string]interface{})\n\t}\n\n\treturn resp, decoded, nil\n}", "title": "" }, { "docid": "692aea32f827724467061c9e1bad938b", "score": "0.49693394", "text": "func (n *NoOpHandler) Action(m *Message, logger Logger) (*Message, error) {\n\treturn NewMessage(m.Data, m.Context), nil\n}", "title": "" }, { "docid": "7112d5d595a7fba66ccd9d5d7c8b5c79", "score": "0.49674532", "text": "func (*PostbackAction) QuickReplyAction() {}", "title": "" }, { "docid": "7112d5d595a7fba66ccd9d5d7c8b5c79", "score": "0.49674532", "text": "func (*PostbackAction) QuickReplyAction() {}", "title": "" }, { "docid": "5af4c9dfbf22ea5ac77704d1418725cc", "score": "0.49652913", "text": "func (c *InfrastructureClusterTemplateContract) Template() *InfrastructureClusterTemplateTemplate {\n\treturn &InfrastructureClusterTemplateTemplate{}\n}", "title": "" }, { "docid": "744a14104d2a708d37cd2879d440866f", "score": "0.49635226", "text": "func (c *Clause) UsageAction(context *UsageContext) *Clause {\n\tc.PreAction(func(e *ParseElement, c *ParseContext) error {\n\t\tc.Application.UsageForContextWithTemplate(context, c)\n\t\tc.Application.terminate(0)\n\t\treturn nil\n\t})\n\treturn c\n}", "title": "" }, { "docid": "2498ec607db8ae5438da6647cdd94480", "score": "0.49586716", "text": "func (p Params) TemplateInput(namespace string) string {\n\treturn helper.AddNamespace(p.ID(), namespace)\n}", "title": "" }, { "docid": "7e9a483a751ed7ceb7f8ebae4f4b65d0", "score": "0.49545592", "text": "func init() {\n\tRegisterAction(\"add_tag\", newAddTagAction)\n\tRegisterAction(\"remove_tag\", newRemoveTagAction)\n}", "title": "" }, { "docid": "c23ab9ed2fd598abb64c942870ab45b6", "score": "0.49393865", "text": "func (o FilteringTagResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FilteringTagResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3511ca2c4ef9b35ca0154144d6071815", "score": "0.49387637", "text": "func (o IPRuleOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IPRule) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7b9c2a70b5864c47347ddb8afbe797f1", "score": "0.49159592", "text": "func Action(v string) *Attribute { return &Attribute{Name: \"action\", Val: v} }", "title": "" }, { "docid": "b2d561f2cdba63f0fadb769388a1030a", "score": "0.49078584", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := gTemplates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "86dcd808d935009289651e96ee4f5143", "score": "0.49068022", "text": "func TemplateName(t *template.Template,) string", "title": "" }, { "docid": "bd671255dcdd45ed2c650bfd4ed9ed6c", "score": "0.4902855", "text": "func Template() *template.Template {\n\treturn template.New(\"\").Funcs(funcs)\n}", "title": "" }, { "docid": "fe85cb3f6a0f8acf8a35168dbc900ff1", "score": "0.49008232", "text": "func (t *Template) Execute(data interface{}) (subject *bytes.Buffer, html *bytes.Buffer, text *bytes.Buffer, err error) {\n\tsubject = &bytes.Buffer{}\n\thtml = &bytes.Buffer{}\n\ttext = &bytes.Buffer{}\n\tif err := t.Subject.Execute(subject, data); err != nil {\n\t\treturn subject, html, text, err\n\t}\n\tif err := t.HTML.Execute(html, data); err != nil {\n\t\treturn subject, html, text, err\n\t}\n\t// Allow for the text template to be nil.\n\tif t.Text != nil {\n\t\tif err := t.Text.Execute(text, data); err != nil {\n\t\t\treturn subject, text, text, err\n\t\t}\n\t}\n\treturn subject, html, text, nil\n}", "title": "" }, { "docid": "0b653a99a53b1c4433a8cb4c3c92775d", "score": "0.4900165", "text": "func XCopyTemplate(paramId string, params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) {\n\thandlerPath := \"copy-template\"\n\tif xSubcommand {\n\t\thandlerPath = \"x \" + handlerPath\n\t}\n\n\tserver := viper.GetString(\"server\")\n\tif server == \"\" {\n\t\tserver = xServers()[viper.GetInt(\"server-index\")][\"url\"]\n\t}\n\n\turl := server + \"/template/{id}\"\n\turl = strings.Replace(url, \"{id}\", paramId, 1)\n\n\treq := cli.Client.Post().URL(url)\n\n\tif body != \"\" {\n\t\treq = req.AddHeader(\"Content-Type\", \"application/json\").BodyString(body)\n\t}\n\n\tcli.HandleBefore(handlerPath, params, req)\n\n\tresp, err := req.Do()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Request failed\")\n\t}\n\n\tvar decoded map[string]interface{}\n\n\tif resp.StatusCode < 400 {\n\t\tif err := cli.UnmarshalResponse(resp, &decoded); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"Unmarshalling response failed\")\n\t\t}\n\t} else {\n\t\treturn nil, nil, errors.Errorf(\"HTTP %d: %s\", resp.StatusCode, resp.String())\n\t}\n\n\tafter := cli.HandleAfter(handlerPath, params, resp, decoded)\n\tif after != nil {\n\t\tdecoded = after.(map[string]interface{})\n\t}\n\n\treturn resp, decoded, nil\n}", "title": "" }, { "docid": "0b653a99a53b1c4433a8cb4c3c92775d", "score": "0.4900165", "text": "func XCopyTemplate(paramId string, params *viper.Viper, body string) (*gentleman.Response, map[string]interface{}, error) {\n\thandlerPath := \"copy-template\"\n\tif xSubcommand {\n\t\thandlerPath = \"x \" + handlerPath\n\t}\n\n\tserver := viper.GetString(\"server\")\n\tif server == \"\" {\n\t\tserver = xServers()[viper.GetInt(\"server-index\")][\"url\"]\n\t}\n\n\turl := server + \"/template/{id}\"\n\turl = strings.Replace(url, \"{id}\", paramId, 1)\n\n\treq := cli.Client.Post().URL(url)\n\n\tif body != \"\" {\n\t\treq = req.AddHeader(\"Content-Type\", \"application/json\").BodyString(body)\n\t}\n\n\tcli.HandleBefore(handlerPath, params, req)\n\n\tresp, err := req.Do()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"Request failed\")\n\t}\n\n\tvar decoded map[string]interface{}\n\n\tif resp.StatusCode < 400 {\n\t\tif err := cli.UnmarshalResponse(resp, &decoded); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"Unmarshalling response failed\")\n\t\t}\n\t} else {\n\t\treturn nil, nil, errors.Errorf(\"HTTP %d: %s\", resp.StatusCode, resp.String())\n\t}\n\n\tafter := cli.HandleAfter(handlerPath, params, resp, decoded)\n\tif after != nil {\n\t\tdecoded = after.(map[string]interface{})\n\t}\n\n\treturn resp, decoded, nil\n}", "title": "" }, { "docid": "9553c17e7cbfeb24e52ef3dbd9f1298b", "score": "0.489972", "text": "func (ctl *controller) ChatIndexAction(ctx *gin.Context) {\n\tctl.logger.Info(\"ChatIndexAction\")\n\n\t// View\n\tctx.HTML(http.StatusOK, \"pages/chat/index.tmpl\", gin.H{\n\t\t\"title\": \"Chat Page\",\n\t})\n}", "title": "" }, { "docid": "73fde8f04ec05d5f843d32570b7218b3", "score": "0.489916", "text": "func (t *Template) Execute(w io.Writer, m map[string]interface{}) (int64, error) {\n\treturn t.ExecuteFunc(w, func(w io.Writer, tag string) (int, error) { return stdTagFunc(w, tag, m) })\n}", "title": "" }, { "docid": "de4cc4f44fc166d361437eee4ac12875", "score": "0.4894582", "text": "func (s *SourceState) executeTemplate(templateAbsPath AbsPath) ([]byte, error) {\n\tdata, err := s.system.ReadFile(templateAbsPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.ExecuteTemplateData(string(templateAbsPath), data)\n}", "title": "" }, { "docid": "a672dd41d5aa9915b884e8763e609a83", "score": "0.4892992", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, s *Stream){\n err := templates.ExecuteTemplate(w, tmpl+\".html\", s)\n if err != nil{\n http.Error(w, err.Error(), http.StatusInternalServerError)\n }\n}", "title": "" }, { "docid": "55d7d775a3bf0cddf253f083c062db76", "score": "0.48890096", "text": "func (e *Elastic) InitTemplate() error {\n\tif err := e.checkClient(); err != nil {\n\t\treturn err\n\t}\n\tctx := context.Background()\n\t_, err := e.Client.IndexPutTemplate(\"teamsacs-template\").BodyJson(_mapping).Do(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbfb14547d940a6b87437e714f42b903", "score": "0.4888281", "text": "func (a *Api) templateGetHandler(w http.ResponseWriter, r *http.Request) {\n\tmetrics2.GetCounter(templateGetCallMetric).Inc(1)\n\thashOrName := chi.URLParam(r, hashOrNameVar)\n\tt, ok := a.getType(w, r)\n\tif !ok {\n\t\treturn\n\t}\n\n\tl := scrap.ToLang(chi.URLParam(r, langVar))\n\tif l == scrap.UnknownLang {\n\t\thttputils.ReportError(w, errUnknownLang, \"Unknown language.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tif err := a.scrapExchange.Expand(r.Context(), t, hashOrName, l, w); err != nil {\n\t\thttputils.ReportError(w, err, \"Failed to expand scrap.\", http.StatusBadRequest)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e687a2bfc34eb801970081bd197a8b95", "score": "0.4887064", "text": "func ApplyTemplate(u EkUrl, descriptorContent []byte, parameters map[string]interface{}) (out bytes.Buffer, err error) {\n\n\t// Parse/execute it as a Go template\n\tout = bytes.Buffer{}\n\ttpl, err := template.New(u.String()).Parse(string(descriptorContent))\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = tpl.Execute(&out, parameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "605edca11395bf01ce2ebde556cc09e9", "score": "0.4881021", "text": "func (c *ServicedCli) printTemplateDeploy(ctx *cli.Context) {\n\tvar output []string\n\n\tswitch len(ctx.Args()) {\n\tcase 0:\n\t\toutput = c.templates()\n\tcase 1:\n\t\toutput = c.pools()\n\t}\n\n\tfor _, o := range output {\n\t\tfmt.Println(o)\n\t}\n}", "title": "" }, { "docid": "e37572a84579db4a416a1b83c3f7cf89", "score": "0.48782098", "text": "func (o FilteringTagOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FilteringTag) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ec318d3f85494b339dbcc5012578af6c", "score": "0.48775253", "text": "func TemplateOption(t *template.Template, opt ...string) *template.Template", "title": "" }, { "docid": "6e571d4404d4b8ab467faf674d1f630f", "score": "0.48748058", "text": "func (p *SSHAction) View() SSHActionView {\n\treturn SSHActionView{ж: p}\n}", "title": "" }, { "docid": "a092de5922007fc3ad648a3f28eadfdc", "score": "0.48737603", "text": "func showTemplate(w http.ResponseWriter, values interface{}, htmlFilesInResource ...string) {\n\tt, err := template.ParseFiles(htmlFilesInResource...)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, `Error on Parsing Template`, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tt.Execute(w, values)\n}", "title": "" }, { "docid": "f99065541fc2a383039235970f549c21", "score": "0.4870048", "text": "func Template(config interface{}, exporter Exporter) (\n\ttmpl string, err error) {\n\tc := New(config)\n\tif configurable, ok := exporter.(Configurable); ok {\n\t\terr = c.Configure(configurable)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn c.Template(exporter)\n}", "title": "" }, { "docid": "9d3eed4a80e7eec5380c25f57a75c5bc", "score": "0.48686096", "text": "func ActionOnZone(zoneID, actionType, resourceType string, resourceCapacity int) string {\n fullUrl := HostUrl + \"/rest/zones/\" + zoneID + \"/actions\"\n values := map[string]interface{}{\n \"type\": actionType,\n \"resourceOp\": map[string]interface{}{\n \"resourceType\": resourceType, \n \"resourceCapacity\": resourceCapacity}}\n return callHttpRequest(\"POST\", fullUrl, nil, values)\n}", "title": "" }, { "docid": "e5dd41db9fbd8cf7b0399ee7840aa1df", "score": "0.48635426", "text": "func (a *app) serveTemplate(w http.ResponseWriter, name string, data interface{}) error {\n\tvar out bytes.Buffer\n\t// write to a buffer first to avoid writing the HTTP headers in case of an error\n\terr := a.pages.ExecuteTemplate(&out, name, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// succeeded, attempt to write the output\n\t_, err = w.Write(out.Bytes())\n\treturn err\n}", "title": "" }, { "docid": "06922d03602300b5db592df381078903", "score": "0.48571625", "text": "func (panel *Panel) Execute(w http.ResponseWriter, accounts *data.Accounts) error {\n\ttype TemplateData struct {\n\t\tAccounts *data.Accounts\n\t}\n\n\ttplData := TemplateData{\n\t\tAccounts: accounts,\n\t}\n\n\treturn panel.tpl.Execute(w, tplData)\n}", "title": "" }, { "docid": "18f6c7f01603d6c45401a92b9f7fba5b", "score": "0.4851297", "text": "func Execute(w io.Writer, name string, data interface{}) error {\n\treturn internal.Templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "e3911ec3554ec1f052ca19e67ad687e2", "score": "0.4851082", "text": "func display(w http.ResponseWriter, tmpl string, data interface{}) {\n\ttemplates.ExecuteTemplate(w, tmpl, data)\n}", "title": "" }, { "docid": "c826c2d271135d6305a0706b9ed3c463", "score": "0.48507947", "text": "func render(w http.ResponseWriter, tpl_name string, ctx interface{}) {\n\tif ctx == nil {\n\t\tctx = render_context\n\t}\n\terr := tpl.ExecuteTemplate(w, tpl_name, ctx)\n\tif err != nil {\n\t\tlog.Println(\"ERROR Render: \", err)\n\t}\n}", "title": "" }, { "docid": "bd33a107f632151d4805201f235d9fd3", "score": "0.48386428", "text": "func (h *templateHook) Update(ctx context.Context, req *interfaces.TaskUpdateRequest, resp *interfaces.TaskUpdateResponse) error {\n\th.managerLock.Lock()\n\tdefer h.managerLock.Unlock()\n\n\t// Nothing to do\n\tif h.templateManager == nil {\n\t\treturn nil\n\t}\n\n\t// Check if either the Nomad or Vault tokens have changed\n\tif req.VaultToken == h.vaultToken && req.NomadToken == h.nomadToken {\n\t\treturn nil\n\t} else {\n\t\th.vaultToken = req.VaultToken\n\t\th.nomadToken = req.NomadToken\n\t}\n\n\t// Shutdown the old template\n\th.templateManager.Stop()\n\th.templateManager = nil\n\n\t// Create the new template\n\tif _, err := h.newManager(); err != nil {\n\t\terr := fmt.Errorf(\"failed to build template manager: %v\", err)\n\t\th.logger.Error(\"failed to build template manager\", \"error\", err)\n\t\th.config.lifecycle.Kill(context.Background(),\n\t\t\tstructs.NewTaskEvent(structs.TaskKilling).\n\t\t\t\tSetFailsTask().\n\t\t\t\tSetDisplayMessage(fmt.Sprintf(\"Template update %v\", err)))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "76a84e02461c2d715dba1f301fb375ed", "score": "0.48358876", "text": "func RenderTemplate(w http.ResponseWriter, r *http.Request, name string, data map[string]interface{}) {\n\tif data == nil {\n\t\tdata = map[string]interface{}{}\n\t}\n\tdata[\"CurrentUser\"] = RequestUser(r)\n\tdata[\"Flash\"] = r.URL.Query().Get(\"flash\")\n\tfuncs := template.FuncMap{\n\t\t\"yield\": func() (template.HTML, error) {\n\t\t\tbuf := bytes.NewBuffer(nil)\n\t\t\ttemplates.ExecuteTemplate(buf, name, data)\n\t\t\treturn template.HTML(buf.String()), nil\n\t\t},\n\t}\n\n\tcloneLayout, _ := layout.Clone()\n\tcloneLayout.Funcs(funcs)\n\n\terr := cloneLayout.Execute(w, data)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(errorTemplate, name, err), http.StatusInternalServerError)\n\t}\n}", "title": "" } ]
f14fc43bb72f61a682a6a8b32ee960fe
unDeleteValueVersion removes tombstone if it exists
[ { "docid": "e8ff43d34d9ccaf1f82f9d2077828ac5", "score": "0.8173092", "text": "func (db *GBucket) unDeleteValueVersion(val []byte, version dvid.VersionID) {\n\tfor currpos := db.vsize; currpos < int32(len(val)); currpos += db.vsize {\n\t\tcurrval := int32(binary.LittleEndian.Uint32(val[currpos : currpos+db.vsize]))\n\t\tif dvid.VersionID(currval) == STOPVERSIONPREFIX {\n\t\t\tbreak\n\t\t}\n\n\t\tif currval < 0 {\n\t\t\tcurrval *= -1\n\t\t}\n\t\tif dvid.VersionID(currval) == version {\n\t\t\ttempintbuffer := make([]byte, db.vsize)\n\t\t\tbinary.LittleEndian.PutUint32(tempintbuffer, uint32(currval))\n\t\t\t// overwrite tombstone\n\t\t\tfor i := int32(0); i < db.vsize; i++ {\n\t\t\t\tval[currpos+i] = tempintbuffer[i]\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "cb1cf4961f1b5b9220b885fe1b90ccd1", "score": "0.7229483", "text": "func (db *GBucket) deleteVersion(ctx storage.Context, baseKey storage.Key, version dvid.VersionID, useTombstone bool) error {\n\t/* Note: Don't worry about delete race conditions because if deleletd with tombstone\n\teither the tombstone will be found or an empty value will be found which is the same.\n\tIf the value is permanently deleted, it probably should have obliterated the version\n\tand no writes should have been done. Worst-case behavior is the delete will behave\n\tlike a tombstone when it should have been a complete delete.*/\n\n\t// grab handle\n\tvar bucket *api.BucketHandle\n\tvar err error\n\tif bucket, err = db.bucketHandle(ctx); err != nil {\n\t\treturn err\n\t}\n\tobj_handle := bucket.Object(hex.EncodeToString(baseKey))\n\n\t// the loop is necessary for potential conflicting, concurrent operations\n\tfor true {\n\t\t// fetch data\n\t\tval, genid, err := db.getValueGen(ctx, baseKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif val == nil {\n\t\t\t// no value, nothing to delete\n\t\t\treturn nil\n\t\t}\n\n\t\t// if no tombstone and only version, do a conditional delete\n\t\tif !useTombstone {\n\t\t\tif db.onlyBaseVersion(val) && version == db.baseVersion(val) {\n\t\t\t\t// transactional delete\n\t\t\t\tvar conditions api.Conditions\n\t\t\t\tconditions.GenerationMatch = genid\n\t\t\t\tif conditions.GenerationMatch == 0 {\n\t\t\t\t\tconditions.DoesNotExist = true\n\t\t\t\t}\n\t\t\t\tobj_handle_temp := obj_handle.If(conditions)\n\n\t\t\t\terr = obj_handle_temp.Delete(db.ctx)\n\t\t\t\tif err != ErrCondFail {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// modify header for version (add tombstone, remove if no tombstone)\n\t\tval, hasexternalchange := db.deleteHeaderVersion(ctx, val, version, useTombstone)\n\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t// transaction write val (non-block wait group)\n\t\t\tvar conditions api.Conditions\n\t\t\tconditions.GenerationMatch = genid\n\t\t\tif conditions.GenerationMatch == 0 {\n\t\t\t\tconditions.DoesNotExist = true\n\t\t\t}\n\t\t\tobj_handle_temp := obj_handle.If(conditions)\n\t\t\t// set main function scope error\n\t\t\terr = db.putVhandle(obj_handle_temp, val)\n\t\t}()\n\n\t\t// Note: could speculatively delete earlier but this saves network ops and also still need to wait for base value to be written\n\t\t// the delete can be done in parallel because in the case of a delete/post\n\t\t// if the value does not exist on either value it is a delete\n\t\t// potentially change behavior in the future!!\n\t\tif hasexternalchange {\n\t\t\t// delete specific key\n\t\t\ttk, _ := storage.TKeyFromKey(baseKey)\n\t\t\ttempkey := ctx.ConstructKeyVersion(tk, version)\n\t\t\twg.Add(1)\n\t\t\tgo func(key storage.Key) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tdb.rawDelete(ctx, tempkey)\n\t\t\t}(tempkey)\n\t\t}\n\n\t\t// wait and check for errors (only repeat if conditional fail\n\t\twg.Wait()\n\t\tif err != ErrCondFail {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f1b4b6b69df33bb204d727cccba31a32", "score": "0.5841461", "text": "func (db *GBucket) deleteHeaderVersion(ctx storage.Context, val []byte, version dvid.VersionID, useTombstone bool) ([]byte, bool) {\n\tmasterver := dvid.VersionID(binary.LittleEndian.Uint32(val[0:db.vsize]))\n\tdeletemaster := false\n\n\t// create a new buffer to store\n\tbuffersize := int32(len(val))\n\tif masterver == version {\n\t\tdeletemaster = true\n\t\tif buffersize > int32((int32(ctx.(storage.VersionedCtx).NumVersions())+int32(2))*db.vsize) {\n\t\t\tbuffersize = int32(int32(ctx.(storage.VersionedCtx).NumVersions())+2) * db.vsize\n\t\t}\n\t}\n\tnewbuffer := make([]byte, 0, buffersize)\n\n\t// copyheader\n\tif deletemaster && !useTombstone {\n\t\t// make ownerless if no tombstone and head deleted\n\t\ttempintbuffer := make([]byte, 4)\n\t\tbinary.LittleEndian.PutUint32(tempintbuffer, 0)\n\t\tnewbuffer = append(newbuffer, tempintbuffer...)\n\t} else {\n\t\t// retain owner\n\t\tnewbuffer = append(newbuffer, val[0:db.vsize]...)\n\t}\n\n\tcurrpos := db.vsize\n\tfoundversion := false\n\n\tfor ; currpos < int32(len(val)); currpos += db.vsize {\n\t\tcurrval := int32(binary.LittleEndian.Uint32(val[currpos : currpos+db.vsize]))\n\n\t\t// stop reading if at end of prefix\n\t\tif dvid.VersionID(currval) == STOPVERSIONPREFIX {\n\t\t\t// version not found but tombstone should still be added\n\t\t\t// (technically not necessary if no previous version is an ancestor)\n\t\t\tif !foundversion && useTombstone {\n\t\t\t\ttempintbuffer := make([]byte, 4)\n\t\t\t\tdelver := int32(-1 * int32(version))\n\t\t\t\tbinary.LittleEndian.PutUint32(tempintbuffer, uint32(delver))\n\t\t\t\tnewbuffer = append(newbuffer, tempintbuffer...)\n\t\t\t}\n\n\t\t\tnewbuffer = append(newbuffer, val[currpos:currpos+db.vsize]...)\n\t\t\tcurrpos += db.vsize\n\t\t\tbreak\n\t\t}\n\t\t// if it is alreaedy negated then nothing needs to be done\n\t\tif currval == int32(version) {\n\t\t\tfoundversion = true\n\t\t\tif useTombstone {\n\t\t\t\t// append negate\n\t\t\t\tcurrval *= -1\n\t\t\t\ttempintbuffer := make([]byte, 4)\n\t\t\t\tbinary.LittleEndian.PutUint32(tempintbuffer, uint32(currval))\n\t\t\t\tnewbuffer = append(newbuffer, tempintbuffer...)\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\t// append\n\t\t\tnewbuffer = append(newbuffer, val[currpos:currpos+db.vsize]...)\n\t\t}\n\t}\n\n\t// copy the rest of the data\n\tif !deletemaster {\n\t\tnewbuffer = append(newbuffer, val[currpos:len(val)]...)\n\t}\n\n\t// if a version for deletion was found and it is not the master, a delete will be required\n\treturn newbuffer, foundversion && !deletemaster\n}", "title": "" }, { "docid": "1ed20b44cadc102ae3a9ae77eed1322f", "score": "0.5542021", "text": "func (z *xlMetaV2) DeleteVersion(fi FileInfo) (string, bool, error) {\n\t// This is a situation where versionId is explicitly\n\t// specified as \"null\", as we do not save \"null\"\n\t// string it is considered empty. But empty also\n\t// means the version which matches will be purged.\n\tif fi.VersionID == nullVersionID {\n\t\tfi.VersionID = \"\"\n\t}\n\n\tvar uv uuid.UUID\n\tvar err error\n\tif fi.VersionID != \"\" {\n\t\tuv, err = uuid.Parse(fi.VersionID)\n\t\tif err != nil {\n\t\t\treturn \"\", false, errFileVersionNotFound\n\t\t}\n\t}\n\n\tvar ventry xlMetaV2Version\n\tif fi.Deleted {\n\t\tventry = xlMetaV2Version{\n\t\t\tType: DeleteType,\n\t\t\tDeleteMarker: &xlMetaV2DeleteMarker{\n\t\t\t\tVersionID: uv,\n\t\t\t\tModTime: fi.ModTime.UnixNano(),\n\t\t\t\tMetaSys: make(map[string][]byte),\n\t\t\t},\n\t\t}\n\t\tif !ventry.Valid() {\n\t\t\treturn \"\", false, errors.New(\"internal error: invalid version entry generated\")\n\t\t}\n\t}\n\tupdateVersion := false\n\tif fi.VersionPurgeStatus.Empty() && (fi.DeleteMarkerReplicationStatus == \"REPLICA\" || fi.DeleteMarkerReplicationStatus == \"\") {\n\t\tupdateVersion = fi.MarkDeleted\n\t} else {\n\t\t// for replication scenario\n\t\tif fi.Deleted && fi.VersionPurgeStatus != Complete {\n\t\t\tif !fi.VersionPurgeStatus.Empty() || fi.DeleteMarkerReplicationStatus != \"\" {\n\t\t\t\tupdateVersion = true\n\t\t\t}\n\t\t}\n\t\t// object or delete-marker versioned delete is not complete\n\t\tif !fi.VersionPurgeStatus.Empty() && fi.VersionPurgeStatus != Complete {\n\t\t\tupdateVersion = true\n\t\t}\n\t}\n\tif fi.Deleted {\n\t\tif fi.DeleteMarkerReplicationStatus != \"\" {\n\t\t\tventry.DeleteMarker.MetaSys[xhttp.AmzBucketReplicationStatus] = []byte(fi.DeleteMarkerReplicationStatus)\n\t\t}\n\t\tif !fi.VersionPurgeStatus.Empty() {\n\t\t\tventry.DeleteMarker.MetaSys[VersionPurgeStatusKey] = []byte(fi.VersionPurgeStatus)\n\t\t}\n\t}\n\n\tfor i, version := range z.Versions {\n\t\tif !version.Valid() {\n\t\t\treturn \"\", false, errFileCorrupt\n\t\t}\n\t\tswitch version.Type {\n\t\tcase LegacyType:\n\t\t\tif version.ObjectV1.VersionID == fi.VersionID {\n\t\t\t\tz.Versions = append(z.Versions[:i], z.Versions[i+1:]...)\n\t\t\t\tif fi.Deleted {\n\t\t\t\t\tz.Versions = append(z.Versions, ventry)\n\t\t\t\t}\n\t\t\t\treturn version.ObjectV1.DataDir, len(z.Versions) == 0, nil\n\t\t\t}\n\t\tcase DeleteType:\n\t\t\tif version.DeleteMarker.VersionID == uv {\n\t\t\t\tif updateVersion {\n\t\t\t\t\tif len(z.Versions[i].DeleteMarker.MetaSys) == 0 {\n\t\t\t\t\t\tz.Versions[i].DeleteMarker.MetaSys = make(map[string][]byte)\n\t\t\t\t\t}\n\t\t\t\t\tdelete(z.Versions[i].DeleteMarker.MetaSys, xhttp.AmzBucketReplicationStatus)\n\t\t\t\t\tdelete(z.Versions[i].DeleteMarker.MetaSys, VersionPurgeStatusKey)\n\t\t\t\t\tif fi.DeleteMarkerReplicationStatus != \"\" {\n\t\t\t\t\t\tz.Versions[i].DeleteMarker.MetaSys[xhttp.AmzBucketReplicationStatus] = []byte(fi.DeleteMarkerReplicationStatus)\n\t\t\t\t\t}\n\t\t\t\t\tif !fi.VersionPurgeStatus.Empty() {\n\t\t\t\t\t\tz.Versions[i].DeleteMarker.MetaSys[VersionPurgeStatusKey] = []byte(fi.VersionPurgeStatus)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tz.Versions = append(z.Versions[:i], z.Versions[i+1:]...)\n\t\t\t\t\tif fi.MarkDeleted && (fi.VersionPurgeStatus.Empty() || (fi.VersionPurgeStatus != Complete)) {\n\t\t\t\t\t\tz.Versions = append(z.Versions, ventry)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn \"\", len(z.Versions) == 0, nil\n\t\t\t}\n\t\tcase ObjectType:\n\t\t\tif version.ObjectV2.VersionID == uv && updateVersion {\n\t\t\t\tz.Versions[i].ObjectV2.MetaSys[VersionPurgeStatusKey] = []byte(fi.VersionPurgeStatus)\n\t\t\t\treturn \"\", len(z.Versions) == 0, nil\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, version := range z.Versions {\n\t\tif !version.Valid() {\n\t\t\treturn \"\", false, errFileCorrupt\n\t\t}\n\t\tswitch version.Type {\n\t\tcase ObjectType:\n\t\t\tif version.ObjectV2.VersionID == uv {\n\t\t\t\tswitch {\n\t\t\t\tcase fi.ExpireRestored:\n\t\t\t\t\tz.Versions[i].ObjectV2.RemoveRestoreHdrs()\n\n\t\t\t\tcase fi.TransitionStatus == lifecycle.TransitionComplete:\n\t\t\t\t\tz.Versions[i].ObjectV2.SetTransition(fi)\n\n\t\t\t\tdefault:\n\t\t\t\t\tz.Versions = append(z.Versions[:i], z.Versions[i+1:]...)\n\t\t\t\t\t// if uv has tiered content we add a\n\t\t\t\t\t// free-version to track it for\n\t\t\t\t\t// asynchronous deletion via scanner.\n\t\t\t\t\tif freeVersion, toFree := version.ObjectV2.InitFreeVersion(fi); toFree {\n\t\t\t\t\t\tz.Versions = append(z.Versions, freeVersion)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif fi.Deleted {\n\t\t\t\t\tz.Versions = append(z.Versions, ventry)\n\t\t\t\t}\n\t\t\t\tif z.SharedDataDirCount(version.ObjectV2.VersionID, version.ObjectV2.DataDir) > 0 {\n\t\t\t\t\t// Found that another version references the same dataDir\n\t\t\t\t\t// we shouldn't remove it, and only remove the version instead\n\t\t\t\t\treturn \"\", len(z.Versions) == 0, nil\n\t\t\t\t}\n\t\t\t\treturn uuid.UUID(version.ObjectV2.DataDir).String(), len(z.Versions) == 0, nil\n\t\t\t}\n\t\t}\n\t}\n\n\tif fi.Deleted {\n\t\tz.Versions = append(z.Versions, ventry)\n\t\treturn \"\", false, nil\n\t}\n\treturn \"\", false, errFileVersionNotFound\n}", "title": "" }, { "docid": "832b309ca19ce25ce556151b6761e2de", "score": "0.54969627", "text": "func removeJSONRevision(jsonValue *[]byte) error {\n\tjsonVal, err := castToJSON(*jsonValue)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed to unmarshal couchdb JSON data: %+v\", err)\n\t\treturn err\n\t}\n\tjsonVal.removeRevField()\n\tif *jsonValue, err = jsonVal.toBytes(); err != nil {\n\t\tlogger.Errorf(\"Failed to marshal couchdb JSON data: %+v\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "df907992018c2ae23cbeed065fded9d0", "score": "0.53941697", "text": "func DeleteKeysValue(hive reg.Key, keypath string, keyobject string) {\n k, err := reg.OpenKey(hive, keypath, reg.ALL_ACCESS)\n if err != nil {\n fmt.Println(err)\n return\n }\n defer k.Close()\n k.DeleteValue(keyobject)\n}", "title": "" }, { "docid": "41df44c42c19a1742ce14e3e977564d9", "score": "0.531177", "text": "func (_BaseContentSpace *BaseContentSpaceTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "d401e558c10d322f2e5cde7ad02bbb32", "score": "0.5304266", "text": "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "ddafec9beb8ec08a4a1d002648f145cc", "score": "0.5289537", "text": "func (_BaseContent *BaseContentTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContent.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "22fa13c289ff622fe6cbdc50213da869", "score": "0.5276045", "text": "func (v Values) Del(key string) {}", "title": "" }, { "docid": "6f1ee051b8bf370a1967d0edb8d3dda9", "score": "0.5263994", "text": "func (db *GBucket) deleteV(ctx storage.Context, k storage.Key) error {\n\t// retrieve repo bucket\n\tvar bucket *api.BucketHandle\n\tvar err error\n\tif ctx == nil {\n\t\t// use default buckert\n\t\tbucket = db.bucket\n\t} else {\n\t\tif bucket, err = db.bucketHandle(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// gets handle (no network op)\n\tobj_handle := bucket.Object(hex.EncodeToString(k))\n\n\treturn obj_handle.Delete(db.ctx)\n}", "title": "" }, { "docid": "6060780df3c751d90ddcf137dda84d30", "score": "0.52391994", "text": "func (_BaseTenantSpace *BaseTenantSpaceTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseTenantSpace.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "e1ad752cea9d1ded221835dadbc01599", "score": "0.52370113", "text": "func (ins *QueryInstance) Delete() error {\n\n\t// In memory database\n\tif ins.db.config.MemoryStorage {\n\t\tins.db.MemoryStorageDB.Delete(ins.key)\n\t\treturn nil\n\t}\n\t// Disk database\n\tif ins.db.config.LevelDB {\n\t\tins.db.GetOrCreateLevelDBwithPanic().Delete(ins.key, nil)\n\t\treturn nil\n\t}\n\n\tpanic(\"NewHashTreeDB must use LevelDB!\")\n\n\t/*\n\t\t// File database\n\t\tins.ClearSearchIndexCache()\n\t\tofstItem, err := ins.SearchIndex()\n\t\tif err != nil {\n\t\t\treturn err // error\n\t\t}\n\t\tif ofstItem == nil {\n\t\t\treturn nil // not find ok\n\t\t}\n\t\tif ofstItem.Type == IndexItemTypeValueDelete {\n\t\t\treturn nil // already deleted\n\t\t}\n\t\tif ofstItem.Type != IndexItemTypeValue {\n\t\t\treturn nil // not value\n\t\t}\n\t\te2 := ins.readSegmentDataFillItem(ofstItem, false)\n\t\tif e2 != nil {\n\t\t\treturn e2 // error\n\t\t}\n\t\tif bytes.Compare(ins.key, ofstItem.ValueKey) != 0 {\n\t\t\t// read target ok other one\n\t\t\treturn nil\n\t\t}\n\t\tif ins.db.config.KeepDeleteMark {\n\t\t\tofstItem.Type = IndexItemTypeValueDelete // mark delete\n\t\t} else {\n\t\t\tofstItem.Type = 0 // nothing\n\t\t}\n\t\tvar valueSegmentOffset = ofstItem.ValueSegmentOffset\n\t\tif !ins.db.config.ForbidGC && !ins.db.config.KeepDeleteMark {\n\t\t\te := ins.collecteGarbageSpace(ofstItem) // Collecte Garbage Space\n\t\t\tif e != nil {\n\t\t\t\treturn e\n\t\t\t}\n\t\t\tofstItem.ValueSegmentOffset = 0\n\t\t}\n\t\t_, e := ins.updateSearchItem(ofstItem) // update index\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\t// update value\n\t\tif ins.db.config.SaveMarkBeforeValue {\n\t\t\t// write delete mark\n\t\t\tins.writeSegmentDataEx(valueSegmentOffset, []byte{IndexItemTypeValueDelete})\n\t\t}\n\t*/\n\treturn nil\n}", "title": "" }, { "docid": "d6f32cda3a6f7b0ac531c00b28f7fc6a", "score": "0.5228748", "text": "func (i *GenericMultiIndex[ReferencingKey, ReferencedKey, PrimaryKey, Value]) Unreference(\n\tctx context.Context,\n\tpk PrimaryKey,\n\tvalue Value,\n) error {\n\trefs, err := i.getRefs(pk, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ref := range refs {\n\t\terr = i.refs.Remove(ctx, Join(ref.Referring, ref.Referred))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7dcb3f6f730dc89be79ea939fee2bade", "score": "0.5225358", "text": "func (_BaseContentType *BaseContentTypeTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContentType.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "3bd0ee65a9c355dd729b16367e0713f9", "score": "0.5219669", "text": "func UnexportedValue(rv reflect.Value) any {\n\tif rv.CanAddr() {\n\t\t// create new value from addr, now can be read and set.\n\t\treturn reflect.NewAt(rv.Type(), unsafe.Pointer(rv.UnsafeAddr())).Elem().Interface()\n\t}\n\n\t// If the rv is not addressable this trick won't work, but you can create an addressable copy like this\n\trs2 := reflect.New(rv.Type()).Elem()\n\trs2.Set(rv)\n\trv = rs2.Field(0)\n\trv = reflect.NewAt(rv.Type(), unsafe.Pointer(rv.UnsafeAddr())).Elem()\n\t// Now rv can be read. TIP: Setting will succeed but only affects the temporary copy.\n\treturn rv.Interface()\n}", "title": "" }, { "docid": "38c94bf25acc12bf179f0cb5013a5c3e", "score": "0.5217361", "text": "func (s *StoreSqlite) DeleteValue(k string) error {\n\t_, err := s.DeleteStmt.Exec(k)\n\tgotils.CheckNotFatal(err)\n\treturn err\n}", "title": "" }, { "docid": "4fb17728db89306379849e37df054994", "score": "0.52049", "text": "func (s *schemaVersionSyncer) removeSelfVersionPath() error {\n\tstartTime := time.Now()\n\tvar err error\n\tdefer func() {\n\t\tmetrics.DeploySyncerHistogram.WithLabelValues(metrics.SyncerClear, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds())\n\t}()\n\n\terr = util.DeleteKeyFromEtcd(s.selfSchemaVerPath, s.etcdCli, keyOpDefaultRetryCnt, util.KeyOpDefaultTimeout)\n\treturn errors.Trace(err)\n}", "title": "" }, { "docid": "41294b75dbc5dba39e90fc105c795928", "score": "0.5197256", "text": "func execUndelete(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := syscall.Undelete(args[0].(string))\n\tp.Ret(1, ret)\n}", "title": "" }, { "docid": "c2cc6917d166920f9937705614d30fb6", "score": "0.5189512", "text": "func (_Container *ContainerTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Container.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "a1c8312e6ab6d342e118b1b913c92a1d", "score": "0.5179238", "text": "func (_BaseTenantConsumerGroup *BaseTenantConsumerGroupTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseTenantConsumerGroup.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "c6ca6db398480e71427169845f403dfc", "score": "0.5165189", "text": "func (_BaseLibrary *BaseLibraryTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "5c1084bc1ed8f6e261f6a30aef3e329a", "score": "0.51443887", "text": "func (val *value) Del(k string) {\n\tif _, exists := val.Data[k]; exists {\n\t\tdelete(val.Data, k)\n\t\tval.UpdatedAt = timestamper()\n\t}\n}", "title": "" }, { "docid": "4012553c71ec52b24853e69f5cecacec", "score": "0.5141494", "text": "func DeleteTagValue(id int) (err error) {\n\to := orm.NewOrm()\n\tv := TagValue{Id: id}\n\t// ascertain id exists in the database\n\tif err = o.Read(&v); err == nil {\n\t\tvar num int64\n\t\tif num, err = o.Delete(&TagValue{Id: id}); err == nil {\n\t\t\tfmt.Println(\"Number of records deleted in database:\", num)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dd4b8a1251044f4312b57ac94422afa3", "score": "0.5141436", "text": "func Delete(value string) bool {\n\tfp := fingerprint(value)\n\thashIndexOne := hash(value)\n\thashIndexTwo := hashIndexOne ^ hash(fp)\n\n\tbucketLock.Lock()\n\tdefer bucketLock.Unlock()\n\n\treturn removeValue(fp, hashIndexOne, hashIndexTwo)\n}", "title": "" }, { "docid": "8f40a8ae32e9b144f1c6e558e4f2f837", "score": "0.5128937", "text": "func (l *List) DeleteValue(v interface{}) {\n\tif l.len < 1 {\n\t\treturn\n\t}\n\n\tcurr := l.root.next\n\n\t// Check if the value is at head\n\tif curr.value == v {\n\t\tl.root.next = curr.next\n\t\tcurr.next = nil\n\t\tl.len--\n\t\treturn\n\t}\n\n\tprev := curr\n\tcurr = prev.next\n\n\tfor ; curr != nil; curr = curr.next {\n\t\tif curr.value == v {\n\t\t\tbreak\n\t\t}\n\t\tprev = curr\n\t}\n\n\t// Indicates reached the end of list and value wasn't found\n\tif curr == nil {\n\t\treturn\n\t}\n\n\tprev.next = curr.next\n\tcurr.next = nil // Make sure to clear to avoid memory leaks\n\tl.len--\n}", "title": "" }, { "docid": "58c0ab5a6feab92cf189e990e5ad2cc1", "score": "0.5097309", "text": "func (e *entryVT) unexpungeLocked() (wasExpungedVT bool) {\n\treturn atomic.CompareAndSwapPointer(&e.p, expungedVT, nil)\n}", "title": "" }, { "docid": "a1fe25fdc7146bd84f0080e7cc739f92", "score": "0.5083896", "text": "func VersionDelete(c *gin.Context) {\n\tmod := session.Mod(c)\n\trecord := session.Version(c)\n\n\terr := store.DeleteVersion(\n\t\tc,\n\t\tmod.ID,\n\t\trecord,\n\t)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to delete 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\": \"Failed to delete version\",\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\tgin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"message\": \"Successfully deleted version\",\n\t\t},\n\t)\n}", "title": "" }, { "docid": "8d275dff691fa725aa227ed6ee82c990", "score": "0.5076478", "text": "func (_BaseAccessControlGroup *BaseAccessControlGroupTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessControlGroup.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "3601c0bdafa4a21d75573d52c25e70db", "score": "0.507354", "text": "func kvRemove(rtc client.RuntimeClient, signer signature.Signer, key []byte) error {\n\tctx := context.Background()\n\tchainCtx, err := GetChainContext(ctx, rtc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tac := accounts.NewV1(rtc)\n\tnonce, err := ac.Nonce(ctx, client.RoundLatest, types.NewAddress(signer.Public()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttx := types.NewTransaction(&types.Fee{\n\t\tGas: defaultGasAmount,\n\t}, \"keyvalue.Remove\", kvKey{\n\t\tKey: key,\n\t})\n\ttx.AppendAuthSignature(signer.Public(), nonce)\n\n\tgas, err := core.NewV1(rtc).EstimateGas(ctx, client.RoundLatest, tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttx.AuthInfo.Fee.Gas = gas\n\n\tstx := tx.PrepareForSigning()\n\tif err = stx.AppendSign(chainCtx, signer); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := rtc.SubmitTx(ctx, stx.UnverifiedTransaction()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94945931d96cf93757f155d44cef255f", "score": "0.5073032", "text": "func (op *ObjectPath) Delete() {\n\t// fmt.Println(\"\\n### In delete() ###\")\n\tlastVal := op.LastVal()\n\tswitch lastVal.Kind() {\n\tcase reflect.Map:\n\t\tif lastVal.MapIndex(op.Path[op.index].GetKey()).IsValid() {\n\t\t\t// Setting a Map value to the 'nil' value clears the key.\n\t\t\top.Set(reflect.Value{})\n\t\t}\n\tcase reflect.Slice:\n\t\tlastVal.Set(lastVal.Slice(0, lastVal.Len()-1))\n\tcase reflect.Ptr:\n\t\tlastVal.Set(reflect.Zero(lastVal.Type()))\n\tdefault:\n\t\tpanic(NewPatchError(\"unhandled delete kind '%v'\", lastVal.Kind()))\n\t}\n\t// fmt.Println(\"### Leaving delete() ###\")\n}", "title": "" }, { "docid": "1862db770a3c738776212587dd499c62", "score": "0.5059327", "text": "func (t *RPCExt) RemoveValue(args *util.RPCExtArgs, reply *int) error {\n\tprocessExtCall(*args, util.RV)\n\treturn nil\n}", "title": "" }, { "docid": "9705940098560e9ebf39fe415a5bab7f", "score": "0.5054341", "text": "func (r *KV) DeleteValue(key []byte) error {\n\twb := gorocksdb.NewWriteBatch()\n\tdefer wb.Destroy()\n\twb.Delete(key)\n\treturn r.db.Write(r.wo, wb)\n}", "title": "" }, { "docid": "eb59d494dd9121bd0348f7c909199f38", "score": "0.5041615", "text": "func (h Handler) deleteVal(w http.ResponseWriter, r *http.Request) {\n\t// Retrieve the \":key\" route parameter.\n\tkey, ok := mux.Var(r, \"key\")\n\tif !ok {\n\t\twriteErr(w, http.StatusInternalServerError, \"can't get key\")\n\t}\n\n\t// Get one value by key:\n\tval, ok := h.store.get(key)\n\tif ok {\n\t\th.store.delete(key)\n\t\twriteMap(w, map[string]interface{}{key: val})\n\t} else {\n\t\twriteKeyErr(w, key)\n\t}\n}", "title": "" }, { "docid": "18ad9c80afffcf6f7f5b4a3bd6776660", "score": "0.5039957", "text": "func (coll *InMemoryMutexCollection) DeleteValueIfEqual(obj *storage.MetaDataObj) bool {\n\tcoll.Lock()\n\tdefer coll.Unlock()\n\tif ret, ok := coll.storage[obj.Key]; ok {\n\t\tif bytes.Equal(ret.Data, obj.Data) {\n\t\t\tdelete(coll.storage, obj.Key)\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false // values are not equal\n\t\t}\n\t} else {\n\t\treturn true\n\t}\n\n}", "title": "" }, { "docid": "0e3bb28d49b6ba5c5eb345d6a9f9d2f5", "score": "0.50306207", "text": "func (wv *WsubVersion) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !wv._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif wv._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM jlabo.wsub_version WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, wv.ID)\n\t_, err = db.Exec(sqlstr, wv.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\twv._deleted = true\n\n\treturn nil\n}", "title": "" }, { "docid": "46cf7f91ce711ddae006200f78caec21", "score": "0.5019049", "text": "func (c *Configuration) ResetDeleteVersionAfter() {\n\tc.DeleteVersionAfter = nil\n}", "title": "" }, { "docid": "a169e7ce5452345b74c9db3e3fb43880", "score": "0.5002722", "text": "func (_Editable *EditableTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Editable.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "title": "" }, { "docid": "68344f91421ae03fe4be7ff7d4748c6a", "score": "0.4999402", "text": "func Xsqlite3ValueFree(tls *libc.TLS, v uintptr) {\n\tif !(v != 0) {\n\t\treturn\n\t}\n\tXsqlite3VdbeMemRelease(tls, v)\n\tXsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(v)).Fdb, v)\n}", "title": "" }, { "docid": "876cb92a5ed4ba93e6e27d95435fe63a", "score": "0.49979523", "text": "func (db *GBucket) extractValueVersion(val []byte) ([]byte, []byte) {\n\tcurrpos := db.vsize\n\tfor ; currpos < int32(len(val)); currpos += db.vsize {\n\t\tcurrval := binary.LittleEndian.Uint32(val[currpos : currpos+db.vsize])\n\t\tif dvid.VersionID(currval) == STOPVERSIONPREFIX {\n\t\t\tcurrpos += db.vsize\n\t\t\tbreak\n\t\t}\n\t}\n\tvalueversion_header := make([]byte, 0, currpos)\n\tvalueversion_header = append(valueversion_header, val[0:currpos]...)\n\n\treturn valueversion_header, val[currpos:len(val)]\n}", "title": "" }, { "docid": "34e998d96f4ede262d8d8279195bbc0c", "score": "0.497724", "text": "func (ls *listStruct) DelByValue(val interface{}) {\n\tpos := ls.Index(val)\n\tif pos != -1 {\n\t\tls.DelByIndex(pos)\n\t}\n}", "title": "" }, { "docid": "6b5f401e235c3f70b6bd7b4549d9a131", "score": "0.49718994", "text": "func (e *entry) ValueReset() {\n\tatomic.StorePointer(&e.p, noContentPointer)\n}", "title": "" }, { "docid": "4c4f04361be519859a9eefe832ab20cf", "score": "0.496961", "text": "func DeleteLocked(ctx context.Context, store *coal.Store, value Value) (bool, error) {\n\t// trace\n\tctx, span := xo.Trace(ctx, \"glut/DeleteLocked\")\n\tdefer span.End()\n\n\t// get base\n\tbase := value.GetBase()\n\n\t// get key\n\tkey, err := GetKey(value)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// log key and token\n\tspan.Tag(\"key\", key)\n\tspan.Tag(\"token\", base.Token.Hex())\n\n\t// check token\n\tif base.Token.IsZero() {\n\t\treturn false, xo.F(\"missing token\")\n\t}\n\n\t// delete value\n\tdeleted, err := store.M(&Model{}).DeleteFirst(ctx, nil, bson.M{\n\t\t\"Key\": key,\n\t\t\"Token\": base.Token,\n\t\t\"Locked\": bson.M{\n\t\t\t\"$gt\": time.Now(),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn deleted, nil\n}", "title": "" }, { "docid": "b0112619b4b3c40efceecba039ef758c", "score": "0.49630257", "text": "func (fv *familyVersion) removeVersion(v Version) {\n\tfv.mutex.Lock()\n\tif v != fv.current {\n\t\tdelete(fv.activeVersions, v.ID())\n\t}\n\tfv.mutex.Unlock()\n}", "title": "" }, { "docid": "4d4adfe9664c422179b5f8f174922409", "score": "0.4960397", "text": "func DeleteVersion(requester Requester, collectionName string, key string,\n\tversionIdentifier string) error {\n\tmethod := \"DELETE\"\n\thostName := requester.CollectionHostName(collectionName)\n\n\tvar path string\n\tif versionIdentifier == \"\" {\n\t\tpath = fmt.Sprintf(\"/data/%s\", url.QueryEscape(key))\n\t} else {\n\t\tvalues := url.Values{}\n\t\tvalues.Add(\"version\", versionIdentifier)\n\t\tpath = fmt.Sprintf(\"/data/%s?%s\", url.QueryEscape(key), values.Encode())\n\t}\n\n\trequest, err := requester.CreateRequest(method, hostName, path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresponse, err := requester.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif response.StatusCode != http.StatusOK {\n\t\terr = HTTPError{response.StatusCode,\n\t\t\tfmt.Sprintf(\"DELETE %s %s failed %s\", hostName, path, response.Body)}\n\t\treturn err\n\t}\n\n\tdefer response.Body.Close()\n\tresponseBody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar resultMap map[string]bool\n\terr = json.Unmarshal(responseBody, &resultMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !resultMap[\"success\"] {\n\t\terr = fmt.Errorf(\"unexpected 'false' for 'success'\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "181ed6ddc5e12ee18a4fc95e10a9f546", "score": "0.49479738", "text": "func (u *VersionFile) AfterDelete(tx *gorm.DB) error {\n\tvar (\n\t\terr error\n\t\tdest string\n\t)\n\n\tif config.S3.Enabled {\n\t\tdest = u.RelativePath()\n\t} else {\n\t\tdest, err = u.AbsolutePath()\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := AttachmentDelete(dest); err != nil {\n\t\treturn fmt.Errorf(\"Failed to remove version. %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f8809193ec5bec5a0df858e1b3649271", "score": "0.49233314", "text": "func (db *GBucket) updateValueVersion(ctx storage.Context, baseval []byte, newval []byte) ([]byte, []byte, dvid.VersionID, error) {\n\tismasterhead := ctx.(storage.VersionedCtx).Head()\n\n\t// grab current head prefix\n\tcurrentmaster := dvid.VersionID(0)\n\n\tif baseval != nil {\n\t\tcurrentmaster = db.baseVersion(baseval)\n\t}\n\n\t// check if master\n\tismaster := false\n\tif currentmaster != 0 {\n\t\tismaster = ctx.(storage.VersionedCtx).MasterVersion(currentmaster)\n\t}\n\n\t// check if new data\n\tif baseval == nil {\n\t\t// newval will also be nil\n\t\tbasevalmod := db.initValueVersion(ctx.VersionID(), newval)\n\t\treturn basevalmod, nil, 0, nil\n\t} else if ctx.VersionID() == currentmaster {\n\t\t// overwrite if same version\n\t\t// replace old value with new value\n\t\texists, hastombstone := db.hasVersion(baseval, ctx.VersionID())\n\t\tbaseprefix, _ := db.extractValueVersion(baseval)\n\n\t\tif !exists {\n\t\t\t// add key if deleted before\n\t\t\tbaseprefix = db.appendValueVersion(baseprefix, currentmaster)\n\t\t} else if hastombstone {\n\t\t\t// remove tombstone\n\t\t\tdb.unDeleteValueVersion(baseprefix, currentmaster)\n\t\t}\n\n\t\t// concatentate data to value prefix\n\t\tbasevalmod := baseprefix\n\t\tbasevalmod = append(baseprefix, newval...)\n\n\t\t// return mod base val\n\t\treturn basevalmod, nil, 0, nil\n\t} else if exists, hastombstone := db.hasVersion(baseval, ctx.VersionID()); exists {\n\t\t// Data already exists outside of base\n\t\tvar basevalmod []byte\n\n\t\tif hastombstone {\n\t\t\t// if tombstone, untombstone and load new baseval\n\t\t\tdb.unDeleteValueVersion(baseval, ctx.VersionID())\n\t\t\tbasevalmod = baseval\n\t\t}\n\t\t// return basevalmod (might be nil) and off version\n\t\treturn basevalmod, newval, ctx.VersionID(), nil\n\t} else if ismasterhead || !ismaster {\n\t\t// Eviction if new data has higher priority\n\t\t// create new prefix and data\n\t\tbaseprefix, evictvalmod := db.extractValueVersion(baseval)\n\t\tbaseprefix = db.appendValueVersion(baseprefix, ctx.VersionID())\n\t\tdb.replaceMaster(baseprefix, ctx.VersionID())\n\t\tbasevalmod := append(baseprefix, newval...)\n\n\t\t// return new base data and evicted previous master\n\t\treturn basevalmod, evictvalmod, currentmaster, nil\n\t}\n\t// else create a new off critical value version\n\n\t// add version to base header (mod base val)\n\tbaseprefix, baseval := db.extractValueVersion(baseval)\n\tbaseprefix = db.appendValueVersion(baseprefix, ctx.VersionID())\n\tbasevalmod := append(baseprefix, baseval...)\n\n\t// return new val with version id\n\treturn basevalmod, newval, ctx.VersionID(), nil\n\n}", "title": "" }, { "docid": "ffc9b78f2f644e77c85cbc58e8578221", "score": "0.49219927", "text": "func _374sqlite3ValueFree(tls *crt.TLS, _v uintptr /* *Tsqlite3_value */) {\n\tif _v != 0 {\n\t\tgoto _1\n\t}\n\n\treturn\n\n_1:\n\t_400sqlite3VdbeMemRelease(tls, _v)\n\t_379sqlite3DbFreeNN(tls, *(*uintptr)(unsafe.Pointer(_v + 32)), _v)\n}", "title": "" }, { "docid": "aab91dd19521c3ae8995ac28aa88033b", "score": "0.48948976", "text": "func VersionBuildDelete(c *gin.Context) {\n\tform := &model.VersionBuildParams{}\n\n\tif err := c.BindJSON(&form); err != nil {\n\t\tlogrus.Warnf(\"Failed to bind version build 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 build data\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tform.Mod = c.Param(\"mod\")\n\tform.Version = c.Param(\"version\")\n\n\tassigned := store.GetVersionHasBuild(\n\t\tc,\n\t\tform,\n\t)\n\n\tif !assigned {\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\": \"Build is not assigned\",\n\t\t\t},\n\t\t)\n\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\terr := store.DeleteVersionBuild(\n\t\tc,\n\t\tform,\n\t)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Failed to delete version build. %s\", err)\n\n\t\tc.JSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusInternalServerError,\n\t\t\t\t\"message\": \"Failed to unlink build\",\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\tgin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"message\": \"Successfully unlinked build\",\n\t\t},\n\t)\n}", "title": "" }, { "docid": "42c6de2562c1e2962460e73a9c20d444", "score": "0.48640394", "text": "func (o *CrawlProperty) RemoveAgentVersion(ctx context.Context, exec boil.ContextExecutor, related *AgentVersion) error {\n\tvar err error\n\n\tqueries.SetScanner(&o.AgentVersionID, nil)\n\tif _, err = o.Update(ctx, exec, boil.Whitelist(\"agent_version_id\")); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\tif o.R != nil {\n\t\to.R.AgentVersion = nil\n\t}\n\tif related == nil || related.R == nil {\n\t\treturn nil\n\t}\n\n\tfor i, ri := range related.R.CrawlProperties {\n\t\tif queries.Equal(o.AgentVersionID, ri.AgentVersionID) {\n\t\t\tcontinue\n\t\t}\n\n\t\tln := len(related.R.CrawlProperties)\n\t\tif ln > 1 && i < ln-1 {\n\t\t\trelated.R.CrawlProperties[i] = related.R.CrawlProperties[ln-1]\n\t\t}\n\t\trelated.R.CrawlProperties = related.R.CrawlProperties[:ln-1]\n\t\tbreak\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a9b14df53b4ea2cb608dd620d9e8f98", "score": "0.4851625", "text": "func (m *typedMap) delete(key string) *revisionedValue {\n\tread, _ := m.read.Load().(readOnly)\n\te, ok := read.m[key]\n\tif !ok && read.amended {\n\t\tm.mu.Lock()\n\t\tread, _ = m.read.Load().(readOnly)\n\t\te, ok = read.m[key]\n\t\tif !ok && read.amended {\n\t\t\tdelete(m.dirty, key)\n\t\t}\n\t\tm.mu.Unlock()\n\t}\n\tif ok {\n\t\treturn e.delete()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "accd99fce0834095e064a1f1e316c928", "score": "0.485047", "text": "func Xsqlite3_value_free(tls *crt.TLS, _pOld uintptr /* *Tsqlite3_value */) {\n\t_374sqlite3ValueFree(tls, _pOld)\n}", "title": "" }, { "docid": "bdb10bb446c3585ebbed4c4ef9290013", "score": "0.4830918", "text": "func (pndb *PNodeDB) PruneBelowVersion(ctx context.Context, version Sequence) error {\n\tps := GetPruneStats(ctx)\n\tvar total int64\n\tvar count int64\n\tvar leaves int64\n\tbatch := make([]Key, 0, BatchSize)\n\thandler := func(ctx context.Context, key Key, node Node) error {\n\t\ttotal++\n\t\tif node.GetVersion() >= version {\n\t\t\tif _, ok := node.(*LeafNode); ok {\n\t\t\t\tleaves++\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tcount++\n\t\ttkey := make([]byte, len(key))\n\t\tcopy(tkey, key)\n\t\tbatch = append(batch, tkey)\n\t\tif len(batch) == BatchSize {\n\t\t\terr := pndb.MultiDeleteNode(batch)\n\t\t\tbatch = batch[:0]\n\t\t\tif err != nil {\n\t\t\t\tLogger.Error(\"prune below origin - error deleting node\", zap.String(\"key\", ToHex(key)), zap.Any(\"old_version\", node.GetVersion()), zap.Any(\"new_version\", version), zap.Error(err))\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\terr := pndb.Iterate(ctx, handler)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(batch) > 0 {\n\t\terr := pndb.MultiDeleteNode(batch)\n\t\tif err != nil {\n\t\t\tLogger.Error(\"prune below origin - error deleting node\", zap.Any(\"new_version\", version), zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t}\n\tpndb.Flush()\n\tif ps != nil {\n\t\tps.Total = total\n\t\tps.Leaves = leaves\n\t\tps.Deleted = count\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a8711d1008fa8e4e4d8879b9f4663db6", "score": "0.48239598", "text": "func (h *Handler) unarchiveVariant(c echo.Context) (e error) {\n\tctx := c.(*cuxs.Context)\n\n\tvar id int64\n\tvar m *model.ItemVariant\n\tvar r UnarchiveItemVariant\n\n\tif id, e = common.Decrypt(ctx.Param(\"id\")); e == nil {\n\t\tif m, e = GetDetailItemVariant(\"id\", id); e == nil {\n\t\t\tr.isArchived = m.IsArchived\n\t\t\tr.isDeleted = m.IsDeleted\n\t\t\tif e = ctx.Bind(&r); e == nil {\n\t\t\t\tif e = m.Unarchive(); e == nil {\n\t\t\t\t\tctx.Data(m)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\te = echo.ErrNotFound\n\t\t}\n\t}\n\n\treturn ctx.Serve(e)\n}", "title": "" }, { "docid": "25a5a103dec8419726c96803d7da880d", "score": "0.48207232", "text": "func Test_StorageVersionDeletedOnLeaseDeletion(t *testing.T) {\n\tlease1 := newKubeApiserverLease(\"kube-apiserver-1\", \"kube-apiserver-1\")\n\n\tstorageVersion := &apiserverinternalv1alpha1.StorageVersion{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"k8s.test.resources\",\n\t\t},\n\t\tStatus: apiserverinternalv1alpha1.StorageVersionStatus{\n\t\t\tStorageVersions: []apiserverinternalv1alpha1.ServerStorageVersion{\n\t\t\t\t{\n\t\t\t\t\tAPIServerID: \"kube-apiserver-1\",\n\t\t\t\t\tEncodingVersion: \"v1\",\n\t\t\t\t\tDecodableVersions: []string{\"v1\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tclientset := fake.NewSimpleClientset(lease1, storageVersion)\n\t_, ctx := ktesting.NewTestContext(t)\n\tsetupController(ctx, clientset)\n\n\t// Delete the lease object and verify that storage version status is updated\n\tif err := clientset.CoordinationV1().Leases(metav1.NamespaceSystem).Delete(context.Background(), \"kube-apiserver-1\", metav1.DeleteOptions{}); err != nil {\n\t\tt.Fatalf(\"error deleting lease object: %v\", err)\n\t}\n\n\t// add a delay to ensure controller had a chance to reconcile\n\ttime.Sleep(2 * time.Second)\n\n\t// expect deleted\n\t_, err := clientset.InternalV1alpha1().StorageVersions().Get(context.Background(), \"k8s.test.resources\", metav1.GetOptions{})\n\tif !apierrors.IsNotFound(err) {\n\t\tt.Fatalf(\"expected IsNotFound error, got: %v\", err)\n\t}\n}", "title": "" }, { "docid": "c2ee99a774da914c66ad4c4fe1fa4551", "score": "0.48191518", "text": "func (b *bitmapV) withoutValue() (t itrie, removed int) {\n\tn := newBitmap_(b.occupied_)\n\tn.copy(&b.bitmap_)\n\treturn n, 1\n}", "title": "" }, { "docid": "9ef54850c3386ca1cb5332a4864e0141", "score": "0.48098966", "text": "func (conn StorageConn) UnDelUser(username string) error {\n\treturn conn.simpleEditUser(\"UPDATE user_archive SET deleted = FALSE WHERE name = ? COLLATE NOCASE\", username)\n}", "title": "" }, { "docid": "955098378e3192c5d20d6399aa1f6e80", "score": "0.4802206", "text": "func TestRemove2(t *testing.T) {\n\tr := New32()\n\tt.Logf(\"Tree empty\\n\")\n\tr.Do(func(r1 *Radix32, i int) {\n\t\tt.Logf(\"[%010p %010p] (%2d): %032b/%d -> %d\\n\", r1.branch[0], r1.branch[1], i, r1.key, r1.bits, r1.Value)\n\t})\n\tk, v := uint32(0x90000000), uint32(2013)\n\tr.Insert(k, bits32, v)\n\n\tt.Logf(\"Tree complete\\n\")\n\tr.Do(func(r1 *Radix32, i int) {\n\t\tt.Logf(\"[%010p %010p] (%2d): %032b/%d -> %d\\n\", r1.branch[0], r1.branch[1], i, r1.key, r1.bits, r1.Value)\n\t})\n\tt.Logf(\"Tree after removal of %032b/%d %d (%x %d)\\n\", k, bits32, v, k, k)\n\tr.Remove(k, bits32)\n\tr.Do(func(r1 *Radix32, i int) {\n\t\tt.Logf(\"[%010p %010p] (%2d): %032b/%d -> %d\\n\", r1.branch[0], r1.branch[1], i, r1.key, r1.bits, r1.Value)\n\t})\n}", "title": "" }, { "docid": "007dec33f598d10226c04c7d28d6650e", "score": "0.4796849", "text": "func (d *DummyCookie) DeleteValue(Name string) error {\n\treturn nil\n}", "title": "" }, { "docid": "a9eed50b8559126abfc588daeeb25402", "score": "0.479284", "text": "func DeleteNodeRevision_bodyViaBodyValue(iBodyValue string) (err error) {\n\tvar has bool\n\tvar _NodeRevision_body = &NodeRevision_body{BodyValue: iBodyValue}\n\tif has, err = Engine.Get(_NodeRevision_body); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"body_value = ?\", iBodyValue).Delete(new(NodeRevision_body)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6d24ec644885ecf140435b760e554ecc", "score": "0.4780495", "text": "func (db *data) DeleteVersion(mod int64, record *model.Version, current *model.User) error {\n\trecord.ModID = mod\n\n\treturn db.Delete(\n\t\trecord,\n\t).Error\n}", "title": "" }, { "docid": "7089987cade99aafadb23312dcfccf91", "score": "0.47783527", "text": "func (v *NullableSyntheticsAPIStepSubtype) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "0ae3a06ad311fc724701672b86e160d9", "score": "0.4776544", "text": "func (s *WysteriaServer) DeleteVersion(id string) error {\n\terr := s.shouldServeRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.searchbase.DeleteVersion(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.database.DeleteVersion(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlinked, err := s.searchbase.QueryLink(defaultQueryLimit, 0, linkedTo(id)...)\n\tif err == nil && len(linked) > 0 {\n\t\ts.searchbase.DeleteLink(linked...)\n\t\ts.database.DeleteLink(linked...)\n\t}\n\n\tchildren, err := s.searchbase.QueryResource(defaultQueryLimit, 0, childrenOf(id)...)\n\tif err == nil && len(children) > 0 {\n\t\ts.searchbase.DeleteResource(children...)\n\t\ts.database.DeleteResource(children...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "638cc3473e37ae44c44d794b5907baee", "score": "0.4768394", "text": "func (v Value) Del(key string) {\n\tdelete(v, key)\n}", "title": "" }, { "docid": "e85407422914f8af89adae4ff452b5ec", "score": "0.47682467", "text": "func (v Values) Del(name string) {\n\tif v != nil {\n\t\tdelete(v, name)\n\t}\n}", "title": "" }, { "docid": "60d067b0bd13e914d609345dc56522ab", "score": "0.47567797", "text": "func (m *VocaMutation) ResetValue() {\n\tm.value = nil\n}", "title": "" }, { "docid": "6d9026f674b91a58c0aa430d1694594c", "score": "0.47564086", "text": "func Xsqlite3_value_free(tls *libc.TLS, pOld uintptr) {\n\tXsqlite3ValueFree(tls, pOld)\n}", "title": "" }, { "docid": "1d2f8b97371a4ab3c5d127f54a9032ff", "score": "0.47536546", "text": "func (mvc *MockVersionConnector) AbortVersion(versionId string) error {\n\tfor idx, t := range mvc.CachedTasks {\n\t\tif t.Version == versionId && (t.Status == evergreen.TaskStarted || t.Status == evergreen.TaskDispatched) {\n\t\t\tif !t.Aborted {\n\t\t\t\tpt := &mvc.CachedTasks[idx]\n\t\t\t\tpt.Aborted = true\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f92f7c5819549ae62ddc88e1f16c10c", "score": "0.4734278", "text": "func DeletePostmetaViaMetaValue(iMetaValue string) (err error) {\n\tvar has bool\n\tvar _Postmeta = &Postmeta{MetaValue: iMetaValue}\n\tif has, err = Engine.Get(_Postmeta); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"meta_value = ?\", iMetaValue).Delete(new(Postmeta)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "566498f7b5a8cfc2d001bb562fa7971d", "score": "0.47329447", "text": "func (r *MongoRepository) DeleteOne(id entity.ID, version entity.Version) (int, error) {\n\tcoll := r.db.Collection(\"variants\")\n\n\tresult, err := coll.DeleteOne(\n\t\tcontext.TODO(),\n\t\tbson.D{primitive.E{Key: \"_id\", Value: id}, primitive.E{Key: \"_V\", Value: version}},\n\t)\n\n\tif err != nil {\n\t\treturn int(result.DeletedCount), err\n\t}\n\n\treturn int(result.DeletedCount), nil\n\n}", "title": "" }, { "docid": "385e271d12e073f8b01b7cb77facb062", "score": "0.47320896", "text": "func (n *Node) modifyValue(ctx context.Context, hv *hashBits, k []byte, v *cbg.Deferred) error {\n\tidx, err := hv.Next(n.bitWidth)\n\tif err != nil {\n\t\treturn ErrMaxDepth\n\t}\n\n\t// if the element expected at this node isn't here then we can be sure it\n\t// doesn't exist in the HAMT already and can insert it at the appropriate\n\t// position.\n\tif n.Bitfield.Bit(idx) != 1 {\n\t\treturn n.insertKV(idx, k, v)\n\t}\n\n\t// otherwise, the value is either local or in a child\n\n\t// perform a popcount of bits up to the `idx` to find `cindex`\n\tcindex := byte(n.indexForBitPos(idx))\n\n\tchild := n.getPointer(cindex)\n\tif child.isShard() {\n\t\t// if isShard, we have a pointer to a child that we need to load and\n\t\t// delegate our modify operation to\n\t\tchnd, err := child.loadChild(ctx, n.store, n.bitWidth, n.hash)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := chnd.modifyValue(ctx, hv, k, v); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// CHAMP optimization, ensure the HAMT retains its canonical form for the\n\t\t// current data it contains. This may involve collapsing child nodes if\n\t\t// they no longer contain enough elements to justify their stand-alone\n\t\t// existence.\n\t\tif v == nil {\n\t\t\tif err := n.cleanChild(chnd, cindex); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// if not isShard, then either the key/value pair is local here and can be\n\t// modified (or deleted) here or needs to be added as a new child node if\n\t// there is an overflow.\n\n\tif v == nil {\n\t\t// delete operation, find the child and remove it, compacting the bucket in\n\t\t// the process\n\t\tfor i, p := range child.KVs {\n\t\t\tif bytes.Equal(p.Key, k) {\n\t\t\t\tif len(child.KVs) == 1 {\n\t\t\t\t\t// last element in the bucket, remove it and update the bitfield\n\t\t\t\t\treturn n.rmPointer(cindex, idx)\n\t\t\t\t}\n\n\t\t\t\tcopy(child.KVs[i:], child.KVs[i+1:])\n\t\t\t\tchild.KVs = child.KVs[:len(child.KVs)-1]\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn ErrNotFound\n\t}\n\n\t// modify existing, check if key already exists\n\tfor _, p := range child.KVs {\n\t\tif bytes.Equal(p.Key, k) {\n\t\t\tp.Value = v\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif len(child.KVs) >= arrayWidth {\n\t\t// bucket is full, create a child node (shard) with all existing bucket\n\t\t// elements plus the new one and set it in the place of the bucket\n\t\t// TODO(rvagg): this all of the modifyValue() calls are going to result\n\t\t// in a store.Put(), this could be improved by allowing NewNode() to take\n\t\t// the bulk set of elements, or modifying modifyValue() for the case\n\t\t// where we know for sure that the elements will go into buckets and\n\t\t// not cause an overflow - i.e. we just need to take each element, hash it\n\t\t// and consume the correct number of bytes off the digest and figure out\n\t\t// where it should be in the new node.\n\t\tsub := NewNode(n.store)\n\t\tsub.bitWidth = n.bitWidth\n\t\tsub.hash = n.hash\n\t\thvcopy := &hashBits{b: hv.b, consumed: hv.consumed}\n\t\tif err := sub.modifyValue(ctx, hvcopy, k, v); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, p := range child.KVs {\n\t\t\tchhv := &hashBits{b: n.hash([]byte(p.Key)), consumed: hv.consumed}\n\t\t\tif err := sub.modifyValue(ctx, chhv, p.Key, p.Value); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tc, err := n.store.Put(ctx, sub)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn n.setPointer(cindex, &Pointer{Link: c})\n\t}\n\n\t// otherwise insert the new element into the array in order, the ordering is\n\t// important to retain canonical form\n\tnp := &KV{Key: k, Value: v}\n\tfor i := 0; i < len(child.KVs); i++ {\n\t\tif bytes.Compare(k, child.KVs[i].Key) < 0 {\n\t\t\tchild.KVs = append(child.KVs[:i], append([]*KV{np}, child.KVs[i:]...)...)\n\t\t\treturn nil\n\t\t}\n\t}\n\tchild.KVs = append(child.KVs, np)\n\treturn nil\n}", "title": "" }, { "docid": "56c55022b4b35811259c167810b68da5", "score": "0.47248358", "text": "func GetAdminDeleteVersion(c *gin.Context) {\n\tdatabase.Db.Delete(database.Version{}, \"ID = ?\", c.Param(\"id\"))\n\tc.Redirect(http.StatusFound, \"/admin/versions\")\n}", "title": "" }, { "docid": "3b901b1a658caffcdabf4bb95c05de05", "score": "0.47234014", "text": "func (s StorageMap) RemoveValue(interpreter *Interpreter, key string) {\n\texistingKeyStorable, existingValueStorable, err := s.orderedMap.Remove(\n\t\tStringAtreeComparator,\n\t\tStringAtreeHashInput,\n\t\tStringAtreeValue(key),\n\t)\n\tif err != nil {\n\t\tif _, ok := err.(*atree.KeyNotFoundError); ok {\n\t\t\treturn\n\t\t}\n\t\tpanic(errors.NewExternalError(err))\n\t}\n\tinterpreter.maybeValidateAtreeValue(s.orderedMap)\n\n\t// Key\n\n\t// NOTE: key / field name is stringAtreeValue,\n\t// and not a Value, so no need to deep remove\n\tinterpreter.RemoveReferencedSlab(existingKeyStorable)\n\n\t// Value\n\n\tif existingValueStorable != nil {\n\t\tconfig := interpreter.SharedState.Config\n\t\texistingValue := StoredValue(interpreter, existingValueStorable, config.Storage)\n\t\texistingValue.DeepRemove(interpreter)\n\t\tinterpreter.RemoveReferencedSlab(existingValueStorable)\n\t}\n}", "title": "" }, { "docid": "3b14705de878dfba57f394fda7a2fc23", "score": "0.47208512", "text": "func (v Value) Unpack() interface{} {\n\tswitch v := v.Value.(type) {\n\tcase *Value_Box:\n\t\treturn v.Box.Get()\n\tcase *Value_Path:\n\t\treturn v.Path\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Unsupported value type %T\", v))\n\t}\n}", "title": "" }, { "docid": "8d6e9051fd1b4918047eb972f95269ca", "score": "0.4717965", "text": "func (e *mongoEndpoint) DeleteVersion(ids ...string) error {\n\treturn e.deleteById(tableVersion, ids...)\n}", "title": "" }, { "docid": "05fd28f7ecd60f088b4853875d0cb99a", "score": "0.47143945", "text": "func (s secretVersionService) Delete(path string) error {\n\tsecretPath, err := api.NewSecretPath(path)\n\tif err != nil {\n\t\treturn errio.Error(err)\n\t}\n\n\tversion, err := secretPath.GetVersion()\n\tif err != nil {\n\t\treturn errio.Error(err)\n\t}\n\n\tsecretBlindName, err := s.client.convertPathToBlindName(secretPath)\n\tif err != nil {\n\t\treturn errio.Error(err)\n\t}\n\n\terr = s.client.httpClient.DeleteSecretVersion(secretBlindName, version)\n\tif err != nil {\n\t\treturn errio.Error(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "39f0131c17190d35fc4f63397490ab68", "score": "0.4709493", "text": "func (it *memIterator) RefValue() []byte {\n\tv := it.memit.Value()\n\tif (it.removeTsType == KVType || it.removeTsType == HashType) && len(v) >= tsLen {\n\t\tv = v[:len(v)-tsLen]\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8ed5e4ab56518ab5784d3e8851e5030c", "score": "0.46988517", "text": "func (b *Bolt) Del(key cipher.SHA256) (err error) {\n\terr = b.do(func(objs *bolt.Bucket) (err error) {\n\t\tvar obj *data.Object\n\t\tif obj, err = getObject(objs, key); err != nil {\n\t\t\treturn\n\t\t}\n\t\tb.changeStatAfterDel(obj.RC, vol(obj.Val))\n\t\treturn objs.Delete(key[:])\n\t})\n\treturn\n}", "title": "" }, { "docid": "76eaa5d272ff8b56e55e3f0e6c6016b7", "score": "0.46912184", "text": "func _1091invokeValueDestructor(tls *crt.TLS, _p uintptr /* uintptr */, _xDel uintptr /* *func(*crt.TLS, uintptr) */, _pCtx uintptr /* *Tsqlite3_context */) (r int32) {\n\tif _xDel != 0 {\n\t\tgoto _1\n\t}\n\n\tgoto _2\n\n_1:\n\tif _xDel != uintptr(4294967295) {\n\t\tgoto _3\n\t}\n\n\tgoto _4\n\n_3:\n\tfn16(_xDel)(tls, _p)\n_4:\n_2:\n\tif _pCtx == 0 {\n\t\tgoto _5\n\t}\n\n\tXsqlite3_result_error_toobig(tls, _pCtx)\n_5:\n\treturn int32(18)\n}", "title": "" }, { "docid": "8c36a2d204e7af63cd81ec2d97e2e946", "score": "0.46745715", "text": "func processDeletion(ctx context.Context, k *kabanerov1alpha2.Kabanero, client client.Client, reqLogger logr.Logger) (bool, error) {\n\t// The kabanero instance is not deleted. Create a finalizer if it was not created already.\n\tkabaneroFinalizer := \"kabanero.io.kabanero-operator\"\n\tfoundFinalizer := isFinalizerInList(k, kabaneroFinalizer)\n\tbeingDeleted := !k.ObjectMeta.DeletionTimestamp.IsZero()\n\tif !beingDeleted {\n\t\tif !foundFinalizer {\n\t\t\tk.ObjectMeta.Finalizers = append(k.ObjectMeta.Finalizers, kabaneroFinalizer)\n\t\t\t// Need to cache the Group/Version/Kind here because the Update call\n\t\t\t// will clear them. This is fixed in controller-runtime v0.2.0 /\n\t\t\t// operator-sdk 0.11.0. TODO\n\t\t\tgvk := k.GroupVersionKind()\n\t\t\terr := client.Update(ctx, k)\n\t\t\tif err != nil {\n\t\t\t\treqLogger.Error(err, \"Unable to set the kabanero operator finalizer.\")\n\t\t\t\treturn beingDeleted, err\n\t\t\t}\n\t\t\tk.SetGroupVersionKind(gvk)\n\t\t}\n\n\t\treturn beingDeleted, nil\n\t}\n\n\t// The instance is being deleted.\n\tif foundFinalizer {\n\t\t// Drive kabanero cleanup processing.\n\t\terr := cleanup(ctx, k, client, reqLogger)\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Error during cleanup processing.\")\n\t\t\treturn beingDeleted, err\n\t\t}\n\n\t\t// Remove the finalizer entry from the instance.\n\t\tvar newFinalizerList []string\n\t\tfor _, finalizer := range k.ObjectMeta.Finalizers {\n\t\t\tif finalizer == kabaneroFinalizer {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewFinalizerList = append(newFinalizerList, finalizer)\n\t\t}\n\n\t\tk.ObjectMeta.Finalizers = newFinalizerList\n\n\t\t// Need to cache the Group/Version/Kind here because the Update call\n\t\t// will clear them. This is fixed in controller-runtime v0.2.0 /\n\t\t// operator-sdk 0.11.0. TODO\n\t\tgvk := k.GroupVersionKind()\n\t\terr = client.Update(ctx, k)\n\n\t\tif err != nil {\n\t\t\treqLogger.Error(err, \"Error while attempting to remove the finalizer.\")\n\t\t\treturn beingDeleted, err\n\t\t}\n\n\t\tk.SetGroupVersionKind(gvk)\n\t}\n\n\treturn beingDeleted, nil\n}", "title": "" }, { "docid": "f4157104ed3c7caceab9216005535976", "score": "0.46696457", "text": "func Xsqlite3VdbeDelete(tls *libc.TLS, p uintptr) {\n\tvar db uintptr\n\n\tdb = (*Vdbe)(unsafe.Pointer(p)).Fdb\n\n\tsqlite3VdbeClearObject(tls, db, p)\n\tif (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) {\n\t\t*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FppVPrev)) = (*Vdbe)(unsafe.Pointer(p)).FpVNext\n\t\tif (*Vdbe)(unsafe.Pointer(p)).FpVNext != 0 {\n\t\t\t(*Vdbe)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FpVNext)).FppVPrev = (*Vdbe)(unsafe.Pointer(p)).FppVPrev\n\t\t}\n\t}\n\tXsqlite3DbNNFreeNN(tls, db, p)\n}", "title": "" }, { "docid": "a079a99eafab4ade5f745c8b78884c45", "score": "0.46638793", "text": "func (client *TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string, options *TagsDeleteValueOptions) (*http.Response, error) {\n\treq, err := client.deleteValueCreateRequest(ctx, tagName, tagValue, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.HasStatusCode(http.StatusOK, http.StatusNoContent) {\n\t\treturn nil, client.deleteValueHandleError(resp)\n\t}\n\treturn resp.Response, nil\n}", "title": "" }, { "docid": "87561df60a712cfd101ca89c9e62b1d6", "score": "0.4662501", "text": "func (rs *releasesStore) delete(rel *release, storage helmStorage) bool {\n\trs.mutex.Lock()\n\tdefer rs.mutex.Unlock()\n\n\tif rs.store[storage][rel.namespacedName()] == nil {\n\t\treturn false\n\t}\n\n\tdelete(rs.store[storage][rel.namespacedName()], rel.revision())\n\n\tif len(rs.store[storage][rel.namespacedName()]) > 0 {\n\t\trs.latestRevisions[storage][rel.namespacedName()] = rs.latestRevision(rel, storage)\n\t\treturn true\n\t}\n\n\tdelete(rs.store[storage], rel.namespacedName())\n\tdelete(rs.latestRevisions[storage], rel.namespacedName())\n\n\treturn false\n}", "title": "" }, { "docid": "ff6f1ccfb3bf3320dd176dc65c231830", "score": "0.46293107", "text": "func _378sqlite3VdbeDelete(tls *crt.TLS, _p uintptr /* *TVdbe */) {\n\tvar _db uintptr // *Tsqlite3\n\n\tif _p != 0 {\n\t\tgoto _1\n\t}\n\n\treturn\n\n_1:\n\t_db = *(*uintptr)(unsafe.Pointer(_p))\n\n\t_434sqlite3VdbeClearObject(tls, _db, _p)\n\tif (*(*uintptr)(unsafe.Pointer(_p + 4))) == 0 {\n\t\tgoto _2\n\t}\n\n\t*(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_p + 4))) + 8)) = *(*uintptr)(unsafe.Pointer(_p + 8))\n\tgoto _3\n\n_2:\n\t*(*uintptr)(unsafe.Pointer(_db + 4)) = *(*uintptr)(unsafe.Pointer(_p + 8))\n_3:\n\tif (*(*uintptr)(unsafe.Pointer(_p + 8))) == 0 {\n\t\tgoto _4\n\t}\n\n\t*(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_p + 8))) + 4)) = *(*uintptr)(unsafe.Pointer(_p + 4))\n_4:\n\t*(*Tu32)(unsafe.Pointer(_p + 20)) = Tu32(0x5606c3c8)\n\t*(*uintptr)(unsafe.Pointer(_p)) = null\n\t_379sqlite3DbFreeNN(tls, _db, _p)\n}", "title": "" }, { "docid": "b3e11eaa92fc1a7bce7f15add6273eab", "score": "0.46272078", "text": "func (i *inv) Del(token string, status ticketvote.VoteStatusT) error {\n\t// Find the existing entry\n\tentries := i.Entries[status]\n\tvar (\n\t\tidx int // Index of target entry\n\t\tfound bool\n\t)\n\tfor k, v := range entries {\n\t\tif v.Token == token {\n\t\t\tidx = k\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn fmt.Errorf(\"entry not found %v %v\", token, status)\n\t}\n\n\t// Delete the entry from the list (linear time)\n\tcopy(entries[idx:], entries[idx+1:]) // Shift entries[i+1:] left one index\n\tentries[len(entries)-1] = invEntry{} // Del last element (write zero value)\n\tentries = entries[:len(entries)-1] // Truncate slice\n\n\t// Save the updated list\n\ti.Entries[status] = entries\n\n\treturn nil\n}", "title": "" }, { "docid": "061262cf0dd38caa7589862b385cbf0d", "score": "0.46244743", "text": "func (iea *indexEditAccumulatorImpl) Delete(ctx context.Context, keyHash, partialKeyHash hash.Hash, key, value types.Tuple) error {\n\tif _, ok := iea.uncommitted.adds[keyHash]; ok {\n\t\tdelete(iea.uncommitted.adds, keyHash)\n\t\tdelete(iea.uncommitted.partialAdds[partialKeyHash], keyHash)\n\t} else {\n\t\tiea.uncommitted.deletes[keyHash] = &hashedTuple{key, value, partialKeyHash}\n\t}\n\n\tiea.uncommitted.ops++\n\tif iea.flushingUncommitted {\n\t\tiea.uncommittedEA.AddEdit(key, nil)\n\n\t\tif iea.uncommitted.ops-iea.lastFlush > indexFlushThreshold {\n\t\t\tiea.flushUncommitted()\n\t\t}\n\t} else if iea.uncommitted.ops > indexFlushThreshold {\n\t\tiea.flushUncommitted()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c5bd9e745b56a677ec79aa46c160061", "score": "0.46212712", "text": "func (e Value) Unwrap() error {\n\treturn e.Err\n}", "title": "" }, { "docid": "7f9e2f0752f82dfd8f43a6c4acd44b2a", "score": "0.46144682", "text": "func deletePolicyPackVersionPath(orgName, policyPackName, versionTag string) string {\n\treturn fmt.Sprintf(\n\t\t\"/api/orgs/%s/policypacks/%s/versions/%s\", orgName, policyPackName, versionTag)\n}", "title": "" }, { "docid": "21bee4d5428aa56e6f1a3aa79cc22993", "score": "0.46142086", "text": "func flushKV(prefix string, kv *consulapi.KV) error {\n\tfmt.Printf(\"Flushing KV storage prefix(%s)\\n\", prefix)\n\t_, err := kv.DeleteTree(prefix, nil)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to flush KV storage\")\n\t\tlog.Panic(err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "3cd595839c07707295bc4690c328d1d3", "score": "0.46139038", "text": "func sqliteFactoidForgetValue(key string, value string) error {\n\t_, err := sqliteCon.Exec(\"DELETE FROM factoids WHERE key = ? AND value = ?;\", key, value)\n\treturn err\n}", "title": "" }, { "docid": "e83e0a8bad4735a0793273434754b165", "score": "0.4607861", "text": "func (t *Transaction) deleteNumericOrBooleanIndex(fs *fieldSpec, ms *modelSpec, modelID string) {\n\tindexKey, err := ms.fieldIndexKey(fs.name)\n\tif err != nil {\n\t\tt.setError(err)\n\t}\n\tt.Command(\"ZREM\", redis.Args{indexKey, modelID}, nil)\n}", "title": "" }, { "docid": "9761086f53b4bfb45a6ed3f7595e67df", "score": "0.46075842", "text": "func (s *Partition) giveOld(v ValueWithToken) {\n\tif len(v.Value) == 0 {\n\t\ts.inFlight.Delete(v.Token)\n\t\treturn\n\t}\n\tselect {\n\tcase s.oldValues <- v:\n\tdefault:\n\t\t// Old partition buffer is full, just drop the value\n\t}\n}", "title": "" }, { "docid": "021efda4ee96131c40ce58b3ef824e40", "score": "0.46057242", "text": "func (db *GBucket) valuePatch(ctx storage.Context, tk storage.TKey, f storage.PatchFunc) error {\n\tvar bucket *api.BucketHandle\n\tvar err error\n\tif bucket, err = db.bucketHandle(ctx); err != nil {\n\t\treturn err\n\t}\n\tbasekey := ctx.ConstructKeyVersion(tk, dvid.VersionID(0))\n\n\tinitval := false\n\n\t// loop until success (similar to POST loop but adds patching code and offval write protection)\n\tfor true {\n\t\tvar genid int64\n\t\toffgenid := int64(0)\n\t\tvar offval []byte\n\n\t\t// if the value was already inited (even by accident) -- grab id\n\t\tif initval {\n\t\t\t_, offgenid, err = db.getValueGen(ctx, ctx.ConstructKey(tk))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// perform genid get\n\t\tbaseval, genid, err := db.getValueGen(ctx, basekey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// check if the value already likely exists and\n\t\t// fetch that value with a genid\n\t\tif baseval != nil {\n\t\t\tbaseversionid := db.baseVersion(baseval)\n\t\t\trelevantver := dvid.VersionID(0)\n\n\t\t\t// find most relevant key\n\t\t\tallkeys := db.extractPrefixKeys(ctx, tk, baseval)\n\t\t\ttkvs := []*storage.KeyValue{}\n\t\t\tfor _, key := range allkeys {\n\t\t\t\ttkvs = append(tkvs, &storage.KeyValue{key, []byte{}})\n\t\t\t}\n\t\t\tkv, _ := ctx.(storage.VersionedCtx).VersionedKeyValue(tkvs)\n\t\t\tif kv != nil {\n\t\t\t\t// strip version\n\t\t\t\trelevantver, _ = ctx.(storage.VersionedCtx).VersionFromKey(kv.K)\n\t\t\t}\n\n\t\t\t// perform another get if another version is more relevant\n\t\t\tif baseversionid != relevantver {\n\t\t\t\tvar offgenid2 int64\n\t\t\t\toffval, offgenid2, err = db.getValueGen(ctx, ctx.ConstructKeyVersion(tk, relevantver))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// if current version is what was fetched, set the genid\n\t\t\t\tif relevantver == ctx.VersionID() {\n\t\t\t\t\toffgenid = offgenid2\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toffval = db.sliceDataVersionPrefix(baseval)\n\t\t\t}\n\t\t}\n\n\t\t// treat it as a post of offval data\n\t\tbaseval, offval, offversion, err := db.updateValueVersion(ctx, baseval, offval)\n\n\t\t// set to nil in case these values are len 0 slices\n\t\tif len(offval) == 0 {\n\t\t\toffval = nil\n\t\t}\n\t\tif len(baseval) == 0 {\n\t\t\tbaseval = nil\n\t\t}\n\n\t\t// offval or baseval must be modified\n\t\tif offversion == ctx.VersionID() {\n\t\t\t// apply patch to val (offval could be empty)\n\t\t\toffval, err = f(offval)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tbaseprefix, basevalripped := db.extractValueVersion(baseval)\n\t\t\t// set to nil if there is no value since that is expected by patch function\n\t\t\tif len(basevalripped) == 0 {\n\t\t\t\tbasevalripped = nil\n\n\t\t\t}\n\t\t\tbasevalripped, err = f(basevalripped)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbaseval = append(baseprefix, basevalripped...)\n\t\t}\n\n\t\t// post off value\n\t\tif offval != nil {\n\t\t\tobj_handle := bucket.Object(hex.EncodeToString(ctx.ConstructKey(tk)))\n\t\t\t// set condition if offdata is patch\n\t\t\tif offversion == ctx.VersionID() {\n\t\t\t\tvar conditions api.Conditions\n\t\t\t\tconditions.GenerationMatch = offgenid\n\t\t\t\tif conditions.GenerationMatch == 0 {\n\t\t\t\t\tconditions.DoesNotExist = true\n\t\t\t\t}\n\t\t\t\tobj_handle = obj_handle.If(conditions)\n\n\t\t\t\t// note that value already exists\n\t\t\t\tinitval = true\n\t\t\t}\n\t\t\terr = db.putVhandle(obj_handle, offval)\n\t\t\tif err == ErrCondFail {\n\t\t\t\tcontinue\n\t\t\t} else if err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\n\t\t// post main value\n\t\tif baseval != nil {\n\t\t\tobj_handle := bucket.Object(hex.EncodeToString(basekey))\n\t\t\tvar conditions api.Conditions\n\t\t\tconditions.GenerationMatch = genid\n\t\t\tif conditions.GenerationMatch == 0 {\n\t\t\t\tconditions.DoesNotExist = true\n\t\t\t}\n\t\t\tobj_handle = obj_handle.If(conditions)\n\n\t\t\terr = db.putVhandle(obj_handle, baseval)\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t} else if err != ErrCondFail {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "ab01cff8c1315c82e3463d8d603ce11a", "score": "0.46005368", "text": "func (v Value) Unify(w Value) Value {\n\tif v.v == nil {\n\t\treturn w\n\t}\n\tif w.v == nil || w.v == v.v {\n\t\treturn v\n\t}\n\n\tn := &adt.Vertex{}\n\taddConjuncts(n, v.v)\n\taddConjuncts(n, w.v)\n\n\tctx := newContext(v.idx)\n\tn.Finalize(ctx)\n\n\tn.Parent = v.v.Parent\n\tn.Label = v.v.Label\n\tn.Closed = v.v.Closed || w.v.Closed\n\n\tif err := n.Err(ctx, adt.Finalized); err != nil {\n\t\treturn makeValue(v.idx, n, v.parent_)\n\t}\n\tif err := allowed(ctx, v.v, n); err != nil {\n\t\treturn newErrValue(w, err)\n\t}\n\tif err := allowed(ctx, w.v, n); err != nil {\n\t\treturn newErrValue(v, err)\n\t}\n\n\treturn makeValue(v.idx, n, v.parent_)\n}", "title": "" }, { "docid": "9499442443274be1d666860e37f9c865", "score": "0.4596786", "text": "func (self *StringToStrings) ScrubValue(value string) {\n\t// NOTE: Alternate, less efficient implementation:\n\t// NOTE: Subroutine does the locking for this one.\n\t// for key := range self.db {\n\t// \tself.ScrubValueFromKey(value, key)\n\t// }\n\n\tself.lock.Lock()\n\tdefer self.lock.Unlock()\n\n\tfor key, list := range self.db {\n\t\tlist.Delete(value)\n\t\tif len(list.Strings()) == 0 {\n\t\t\tdelete(self.db, key)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "29cdbd108b0ac31acec0117f583b579e", "score": "0.45915118", "text": "func (r *ReconcileBOSHDeployment) handleDeletion(ctx context.Context, instance *bdv1.BOSHDeployment) (reconcile.Result, error) {\n\n\texistingConfigs, err := r.owner.ListConfigsOwnedBy(ctx, instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.Wrapf(err, \"Could not list ConfigMaps and Secrets owned by '%s'\", instance.Name)\n\t}\n\terr = r.owner.RemoveOwnerReferences(ctx, instance, existingConfigs)\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"Could not remove OwnerReferences pointing to instance '%s': %s\", instance.Name, err)\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: 1 * time.Second}, err\n\t}\n\n\t// Use createOrUpdate pattern to remove finalizer\n\t_, err = controllerutil.CreateOrUpdate(ctx, r.client, instance.DeepCopy(), func(obj runtime.Object) error {\n\t\texstInstance, ok := obj.(*bdv1.BOSHDeployment)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"object is not a BOSHDeployment\")\n\t\t}\n\t\tfinalizer.RemoveFinalizer(exstInstance)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"Could not remove finalizer from BOSHDeployment '%s': %s\", instance.GetName(), err)\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: 1 * time.Second}, errors.Wrapf(err, \"Could updating BOSHDeployment '%s'\", instance.GetName())\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "63899832133dd538800c300130b29900", "score": "0.45809543", "text": "func AbortVersion(versionId, caller string) error {\n\t_, err := task.UpdateAll(\n\t\tbson.M{\n\t\t\ttask.VersionKey: versionId,\n\t\t\ttask.StatusKey: bson.M{\"$in\": evergreen.AbortableStatuses},\n\t\t},\n\t\tbson.M{\"$set\": bson.M{task.AbortedKey: true}},\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error setting aborted statuses\")\n\t}\n\tids, err := task.FindAllTaskIDsFromVersion(versionId)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error finding tasks by version id\")\n\t}\n\tif len(ids) > 0 {\n\t\tevent.LogManyTaskAbortRequests(ids, caller)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18a891f866e5eb413b83ec1430e58620", "score": "0.45807573", "text": "func (r *Reconciler) delete(instance *servingv1alpha1.KnativeServing) error {\n\tif len(instance.GetFinalizers()) == 0 || instance.GetFinalizers()[0] != finalizerName {\n\t\treturn nil\n\t}\n\tif len(r.servings) == 0 {\n\t\tif err := r.config.DeleteAll(&metav1.DeleteOptions{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// The deletionTimestamp might've changed. Fetch the resource again.\n\trefetched, err := r.knativeServingLister.KnativeServings(instance.Namespace).Get(instance.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\trefetched.SetFinalizers(refetched.GetFinalizers()[1:])\n\t_, err = r.KnativeServingClientSet.OperatorV1alpha1().KnativeServings(refetched.Namespace).Update(refetched)\n\treturn err\n}", "title": "" }, { "docid": "f82287407776ac48ff6aafab713f1899", "score": "0.45745572", "text": "func (s *service) unexportFilesystem(ctx context.Context, volID, hostID, nodeID, volumeContextID, arrayID string, unity *gounity.Client) error {\n\n\tctx, log, rid := GetRunidLog(ctx)\n\tfileAPI := gounity.NewFilesystem(unity)\n\tisSnapshot := false\n\tfilesystem, err := fileAPI.FindFilesystemByID(ctx, volID)\n\tvar snapResp *types.Snapshot\n\tif err != nil {\n\t\tsnapshotAPI := gounity.NewSnapshot(unity)\n\t\tsnapResp, err = snapshotAPI.FindSnapshotByID(ctx, volID)\n\t\tif err != nil {\n\t\t\t// If the filesystem isn't found, k8s will retry Controller Unpublish forever so...\n\t\t\t// There is no way back if filesystem isn't found and so considering this scenario idempotent\n\t\t\tif err == gounity.ErrorFilesystemNotFound || err == gounity.ErrorSnapshotNotFound {\n\t\t\t\tlog.Debugf(\"Filesystem %s not found on the array %s during Controller Unpublish. Hence considering the call to be idempotent\", volID, arrayID)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn status.Error(codes.Internal, utils.GetMessageWithRunID(rid, \"Find filesystem %s failed with error: %v\", volID, err))\n\t\t}\n\t\tisSnapshot = true\n\t\tfilesystem, err = s.getFilesystemByResourceID(ctx, snapResp.SnapshotContent.StorageResource.ID, arrayID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t//Remove host access from NFS Share\n\tnfsShareName := NFSShareNamePrefix + filesystem.FileContent.Name\n\tif isSnapshot {\n\t\tnfsShareName = NFSShareNamePrefix + snapResp.SnapshotContent.Name\n\t}\n\tshareExists := false\n\tdeleteShare := true\n\tvar nfsShareID string\n\tfor _, nfsShare := range filesystem.FileContent.NFSShare {\n\t\tif isSnapshot {\n\t\t\tif nfsShare.Path == NFSShareLocalPath && nfsShare.ParentSnap.ID == volID {\n\t\t\t\tshareExists = true\n\t\t\t\tif nfsShare.Name != nfsShareName {\n\t\t\t\t\t//This means that share was created manually on array, hence don't delete via driver\n\t\t\t\t\tdeleteShare = false\n\t\t\t\t\tnfsShareName = nfsShare.Name\n\t\t\t\t}\n\t\t\t\tnfsShareID = nfsShare.ID\n\t\t\t}\n\t\t} else {\n\t\t\tif nfsShare.Path == NFSShareLocalPath && nfsShare.ParentSnap.ID == \"\" {\n\t\t\t\tshareExists = true\n\t\t\t\tif nfsShare.Name != nfsShareName {\n\t\t\t\t\t//This means that share was created manually on array, hence don't delete via driver\n\t\t\t\t\tdeleteShare = false\n\t\t\t\t\tnfsShareName = nfsShare.Name\n\t\t\t\t}\n\t\t\t\tnfsShareID = nfsShare.ID\n\t\t\t}\n\t\t}\n\t}\n\tif !shareExists {\n\t\tlog.Infof(\"NFS Share: %s not found on array.\", nfsShareName)\n\t\treturn nil\n\t}\n\n\tnfsShareResp, err := fileAPI.FindNFSShareByID(ctx, nfsShareID)\n\tif err != nil {\n\t\treturn status.Error(codes.NotFound, utils.GetMessageWithRunID(rid, \"Find NFS Share: %s failed. Error: %v\", nfsShareID, err))\n\t}\n\treadOnlyHosts := nfsShareResp.NFSShareContent.ReadOnlyHosts\n\treadWriteHosts := nfsShareResp.NFSShareContent.ReadWriteHosts\n\treadOnlyRootHosts := nfsShareResp.NFSShareContent.ReadOnlyRootAccessHosts\n\treadWriteRootHosts := nfsShareResp.NFSShareContent.RootAccessHosts\n\n\tfoundIncompatible := false\n\tfoundReadOnly := false\n\tfoundReadWrite := false\n\totherHostsWithAccess := len(readOnlyHosts)\n\tvar readHostIDList, readWriteHostIDList []string\n\tfor _, host := range readOnlyHosts {\n\t\tif host.ID == hostID {\n\t\t\tfoundIncompatible = true\n\t\t\tbreak\n\t\t}\n\t}\n\totherHostsWithAccess += len(readWriteHosts)\n\tif !foundIncompatible {\n\t\tfor _, host := range readWriteHosts {\n\t\t\tif host.ID == hostID {\n\t\t\t\tfoundIncompatible = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\totherHostsWithAccess += len(readOnlyRootHosts)\n\tif !foundIncompatible {\n\t\tfor _, host := range readOnlyRootHosts {\n\t\t\tif host.ID == hostID {\n\t\t\t\tfoundReadOnly = true\n\t\t\t\totherHostsWithAccess--\n\t\t\t} else {\n\t\t\t\treadHostIDList = append(readHostIDList, host.ID)\n\t\t\t}\n\t\t}\n\t}\n\totherHostsWithAccess += len(readWriteRootHosts)\n\tif !foundIncompatible {\n\t\tfor _, host := range readWriteRootHosts {\n\t\t\tif host.ID == hostID {\n\t\t\t\tfoundReadWrite = true\n\t\t\t\totherHostsWithAccess--\n\t\t\t} else {\n\t\t\t\treadWriteHostIDList = append(readWriteHostIDList, host.ID)\n\t\t\t}\n\t\t}\n\t}\n\tif foundIncompatible {\n\t\treturn status.Error(codes.NotFound, utils.GetMessageWithRunID(rid, \"Cannot remove host access. Host: %s has access on NFS Share: %s with incompatible access mode.\", nodeID, nfsShareID))\n\t}\n\tif foundReadOnly {\n\t\tif isSnapshot {\n\t\t\terr = fileAPI.ModifyNFSShareCreatedFromSnapshotHostAccess(ctx, nfsShareID, readHostIDList, gounity.ReadOnlyRootAccessType)\n\t\t} else {\n\t\t\terr = fileAPI.ModifyNFSShareHostAccess(ctx, volID, nfsShareID, readHostIDList, gounity.ReadOnlyRootAccessType)\n\t\t}\n\t} else if foundReadWrite {\n\t\tif isSnapshot {\n\t\t\terr = fileAPI.ModifyNFSShareCreatedFromSnapshotHostAccess(ctx, nfsShareID, readWriteHostIDList, gounity.ReadWriteRootAccessType)\n\t\t} else {\n\t\t\terr = fileAPI.ModifyNFSShareHostAccess(ctx, volID, nfsShareID, readWriteHostIDList, gounity.ReadWriteRootAccessType)\n\t\t}\n\t} else {\n\t\t//Idempotent case\n\t\tlog.Infof(\"Host: %s has no access on NFS Share: %s\", nodeID, nfsShareID)\n\t}\n\tif err != nil {\n\t\treturn status.Error(codes.NotFound, utils.GetMessageWithRunID(rid, \"Removing host %s access to NFS Share failed. Error: %v\", nodeID, err))\n\t}\n\tlog.Debugf(\"Host: %s access is removed from NFS Share: %s\", nodeID, nfsShareID)\n\n\t//Delete NFS Share\n\tif deleteShare {\n\t\tif otherHostsWithAccess > 0 {\n\t\t\tlog.Infof(\"NFS Share: %s can not be deleted as other hosts have access on it.\", nfsShareID)\n\t\t} else {\n\t\t\tif isSnapshot {\n\t\t\t\terr = fileAPI.DeleteNFSShareCreatedFromSnapshot(ctx, nfsShareID)\n\t\t\t} else {\n\t\t\t\terr = fileAPI.DeleteNFSShare(ctx, filesystem.FileContent.ID, nfsShareID)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn status.Error(codes.NotFound, utils.GetMessageWithRunID(rid, \"Delete NFS Share: %s Failed with error: %v\", nfsShareID, err))\n\t\t\t}\n\t\t\tlog.Debugf(\"NFS Share: %s deleted successfully.\", nfsShareID)\n\t\t}\n\t}\n\tlog.Debugf(\"ControllerUnpublishVolume successful for volid: [%s]\", volumeContextID)\n\n\treturn nil\n}", "title": "" }, { "docid": "63d824e180f780c8ba7354cc379142ef", "score": "0.45689246", "text": "func (s *synchronizer) unsetMirrorFileBackup(ctx context.Context, path, bucketSlug string) error {\n\tmf, err := s.model.FindMirrorFileByPathAndBucketSlug(ctx, path, bucketSlug)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif mf == nil {\n\t\tlog.Warn(fmt.Sprintf(\"mirror file (path=%+v bucketSlug=%+v) does not exist\", path, bucketSlug))\n\t\treturn nil\n\t}\n\n\t// do not delete the instance because it might be shared\n\tmf.Backup = false\n\tmf.BackupInProgress = false\n\n\tif _, err = s.model.UpdateMirrorFile(ctx, mf); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "77b42a0e8097ccad883b9e08b9617bda", "score": "0.45589998", "text": "func deleteValues(node sqalx.Node, errorOnNothingDeleted bool, t []interface{}) error {\n\ttx, err := node.Beginx()\n\tif err != nil {\n\t\treturn stacktrace.Propagate(err, \"\")\n\t}\n\tdefer tx.Rollback()\n\n\tor := sq.Or{}\n\n\ttableName := \"\"\n\tfor _, ti := range t {\n\t\tvar fields []structDBfield\n\t\tfields, tableName = getStructInfo(ti)\n\t\tdeleteEqs := make(map[string]interface{})\n\t\tfor _, field := range fields {\n\t\t\tif field.key {\n\t\t\t\tdeleteEqs[field.column] = field.value\n\t\t\t}\n\t\t}\n\n\t\tif len(deleteEqs) == 0 {\n\t\t\treturn stacktrace.NewError(\"type does not have any known keys\")\n\t\t}\n\t\tor = append(or, sq.Eq(deleteEqs))\n\t}\n\n\tbuilder := sdb.Delete(tableName).Where(or)\n\tlogger.Println(builder.ToSql())\n\tresult, err := builder.RunWith(tx).Exec()\n\tif err != nil {\n\t\treturn stacktrace.Propagate(err, \"\")\n\t}\n\tif errorOnNothingDeleted {\n\t\trowsAffected, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn stacktrace.Propagate(err, \"\")\n\t\t}\n\t\tif rowsAffected == 0 {\n\t\t\treturn sql.ErrNoRows\n\t\t}\n\t}\n\treturn stacktrace.Propagate(tx.Commit(), \"\")\n}", "title": "" } ]
d0de8c4514348c2bff2473acbe2ad6cb
Prints a message to stdout if flag to enable trace output is set
[ { "docid": "ac675f6703d0f922c5a4922abb54daba", "score": "0.7172919", "text": "func printTrace(msg string) {\n\tif Trace {\n\t\tfmt.Printf(\"TRACE %s: %s\\n\", getFormattedTime(), msg)\n\t}\n}", "title": "" } ]
[ { "docid": "af7861557b01eeae9afcde9cfee8bfa2", "score": "0.6601827", "text": "func printTracef(msg string, args ...interface{}) {\n\tif Trace {\n\t\tprintTrace(fmt.Sprintf(msg, args...))\n\t}\n}", "title": "" }, { "docid": "b14108c4bb6140f1d44f7a221354f4da", "score": "0.6567928", "text": "func ToggleTrace(should bool) {\n\tif should {\n\t\tos.Setenv(\"SHIELD_TRACE\", \"1\")\n\t\tDEBUG(\"enabling TRACE output\")\n\t} else {\n\t\tos.Unsetenv(\"SHIELD_TRACE\")\n\t}\n}", "title": "" }, { "docid": "feb73971f6129dc97fda160d9ce054a1", "score": "0.63608235", "text": "func (w Wrapper) IsTrace() bool { return false }", "title": "" }, { "docid": "8f905fa327aba9a513d6d9d89c60f2f9", "score": "0.63449425", "text": "func trace(template string, args ...interface{}) {\n\tif false {\n\t\tlog.Printf(\"data/abstract: \"+template, args...)\n\t}\n}", "title": "" }, { "docid": "b448158e5124abb88a30c605a52c7780", "score": "0.6317327", "text": "func Trace(text string) bool {\n\treturn Log(TraceLevel, text)\n}", "title": "" }, { "docid": "7afd37bc3570f69f04f2a21a392696f8", "score": "0.6256746", "text": "func (bl *BeeLogger) Trace(format string, v ...interface{}) {\n\tif LevelDebug > bl.level {\n\t\treturn\n\t}\n\tmsg := fmt.Sprintf(\"[D] \"+format, v...)\n\tbl.writerMsg(LevelDebug, msg)\n}", "title": "" }, { "docid": "7d070bcf9dcc4a2a230c93123b5625e2", "score": "0.62087893", "text": "func (b *Simple) CanTrace() bool { return true }", "title": "" }, { "docid": "2a3513ba0f6764659d5c064b25296f1c", "score": "0.62007016", "text": "func (l *DefaultLogger) Trace(message string) {\n\tprintln(\"TRA | \" + message)\n}", "title": "" }, { "docid": "04e02935abe8bd50e00d8d7f038ed9e2", "score": "0.6176407", "text": "func Trace(v ...interface{}) {\n\tif lvl == lt {\n\t\tlog(out, px, \"trace\", v...)\n\t}\n}", "title": "" }, { "docid": "959a2aee8adc2e9625ca45b1c055447e", "score": "0.6164543", "text": "func trace(s string) { fmt.Println(\"entering:\", s) }", "title": "" }, { "docid": "3ace7e1f7ead6171190a7679654f15d8", "score": "0.6145475", "text": "func (log *Log) Trace(message ...interface{}) {\n\tif log.level <= TRACE {\n\t\tlog.Println(\"TRACE:\", message)\n\t}\n}", "title": "" }, { "docid": "100349b715aeece5d9f2da152ae9b93c", "score": "0.6069997", "text": "func trace(pattern string, args ...interface{}) {\n\t// don't do the probably expensive Sprintf() if not needed\n\tif !wantsTrace {\n\t\treturn\n\t}\n\n\t// this could all be made into one long statement but we have\n\t// compilers to do such things for us. let's sip a mint julep\n\t// and spell this out in glorious exposition.\n\n\t// make sure there is one and only one newline\n\tnlPattern := strings.TrimSpace(pattern) + \"\\n\"\n\tmsg := fmt.Sprintf(nlPattern, args...)\n\ttraceOut.Write([]byte(msg))\n}", "title": "" }, { "docid": "a733541ed4fcab9dd56b019a81372fb8", "score": "0.60687417", "text": "func (l StandardOutputDispatcher) Trace(msg string) {\n\tl.Log(logging.TraceMessage(msg))\n}", "title": "" }, { "docid": "b8be38f07a197fae1a8a5832f6d88642", "score": "0.60651904", "text": "func (w Wrapper) Trace(msg string, args ...interface{}) {\n\tw.Zap.Info(msg, convertToZapAny(args...)...)\n}", "title": "" }, { "docid": "fefc0d1aea0d3694866c8118bafcaf8a", "score": "0.60437226", "text": "func Trace(message ...interface{}) {\n\tstd.Trace(message...)\n}", "title": "" }, { "docid": "f4a8f50ad8a4247e7126e74f4bf025d1", "score": "0.6007038", "text": "func TraceOn(w io.Writer) {\n\ttraceOut = w\n\twantsTrace = true\n}", "title": "" }, { "docid": "12ae1c3a1d2dd2584435ca575314eb5d", "score": "0.6001742", "text": "func Trace(args ...any) { std.log(TraceLevel, args) }", "title": "" }, { "docid": "77c14c7e2ddde45dd456356ae5d200dd", "score": "0.5946111", "text": "func Trace(format string, v ...interface{}) {\n\tif LogInstance != nil {\n\t\tLogInstance.TracePrint(\"> \"+format+\"\\n\", v...)\n\t}\n}", "title": "" }, { "docid": "bdff45945ec54c0a333440cf2da1be81", "score": "0.59048796", "text": "func (fl FileLogger) Trace(msgs ...interface{}) {\n\tif fl.logLvl > trace {\n\t\treturn\n\t}\n\tmsgs = append([]interface{}{getCallingStack()}, msgs...)\n\tfl.trace.Println(extractText(msgs))\n}", "title": "" }, { "docid": "a17d1647c52ac4eeb24c91423d54f513", "score": "0.58752316", "text": "func (l *Logger) Trace(v ...interface{}) {\n\tif l.level == lt {\n\t\tlog(l.out, l.prefix, \"trace\", v...)\n\t}\n}", "title": "" }, { "docid": "e2f44f458971605c33fb79146a97a8e7", "score": "0.58702034", "text": "func (c customLogger) Trace(message string) {\n\n\tinitLogger()\n\tlog.Printf(\"%s %s\", terminal.Colorize(\"[TRACE]\", terminal.CYAN), message)\n}", "title": "" }, { "docid": "e30200c539822716189fb3d43338a5a4", "score": "0.58510494", "text": "func Tracef(ft string, v ...interface{}) {\n\tif lvl == lt {\n\t\tlogf(out, px, \"trace\", ft, v...)\n\t}\n}", "title": "" }, { "docid": "6aeeca7ceba18e87c716c25aeda027d1", "score": "0.5819185", "text": "func (p *Logger) Trace(v ...interface{}) {\n\tp.print(\"T\", fmt.Sprint(v...), Trace)\n}", "title": "" }, { "docid": "3bb8dc2d227fd1e47354330a1267a778", "score": "0.5818007", "text": "func (l Logger) Trace(msg ...interface{}) {\n\tif ce := l.logger.Check(zap.DebugLevel-1, fmt.Sprint(msg...)); ce != nil {\n\t\tce.Write()\n\t}\n}", "title": "" }, { "docid": "e22bae45710e847726eb44ffaabdb6f4", "score": "0.5807163", "text": "func (l *thundraLogger) Trace(v ...interface{}) {\n\tif logLevelCode > traceLogLevelCode {\n\t\treturn\n\t}\n\tlogManager.recentLogLevel = traceLogLevel\n\tlogManager.recentLogLevelCode = traceLogLevelCode\n\tl.Output(2, fmt.Sprint(v...))\n}", "title": "" }, { "docid": "8121aeb2648437d870abdec9ae9f9a39", "score": "0.5801562", "text": "func (self *Client) tracef(format string, args ...interface{}) {\n\tif self.tracelog != nil {\n\t\tself.tracelog.Printf(format, args...)\n\t}\n}", "title": "" }, { "docid": "7afe58e233d77c13287910530f0c9185", "score": "0.5790156", "text": "func (l *Logger) Trace(message string) {\n\tif l.level <= TRACE {\n\t\tl.log(message, TRACE)\n\t}\n}", "title": "" }, { "docid": "2c64ddfae8ed88fcad0526ca098267e2", "score": "0.57871884", "text": "func (p *Pipeline) EnableTrace() {\n\tutils.EnableVerbose()\n}", "title": "" }, { "docid": "232f13f9429bc68f1382ea4d1115e054", "score": "0.577167", "text": "func EnableTracing() {\n\ttracing = true\n}", "title": "" }, { "docid": "eaecb711d753372b799f90114e9ad309", "score": "0.5766763", "text": "func Trace(msg string) {\n\tglobalLogger.Trace(msg)\n}", "title": "" }, { "docid": "87bc14cefe3780bcc8161bb35c47d11d", "score": "0.5763873", "text": "func Trace(format string, ctx ...interface{}) {\n\tformat = fmt.Sprintf(format, ctx...)\n\troot.write(format, LvlTrace, nil)\n}", "title": "" }, { "docid": "41a18a5b003c4f5f04fbfe27293a33c9", "score": "0.57387316", "text": "func (LCWLogger *fullLCWLogger) Trace(message ...interface{}) {\n\tif LCWLogger.highestLevel >= TraceLevel {\n\t\tif LCWLogger.setLogger == nil {\n\t\t\tif LCWLogger.forceFlush.IsSet() {\n\t\t\t\twg := &sync.WaitGroup{}\n\t\t\t\twg.Add(1)\n\t\t\t\tLCWLogger.logQueue <- LCWLogger.wrapMessage(TraceLevel, wg, message...)\n\t\t\t\twg.Wait()\n\t\t\t} else {\n\t\t\t\tLCWLogger.logQueue <- LCWLogger.wrapMessage(TraceLevel, nil, message...)\n\t\t\t}\n\t\t} else {\n\t\t\tLCWLogger.setLogger.Debug(message...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21cc212f0f46c9146519963463c7e603", "score": "0.5737298", "text": "func (ll *LeveledLogger) Trace(msg string) {\n\tll.Tracef(\"%s\", msg)\n}", "title": "" }, { "docid": "27de8921c83c55d21b89666b31056066", "score": "0.5733863", "text": "func ConsoleTrace(s string) {\n\tprintConsole(TRACE, s)\n}", "title": "" }, { "docid": "e6ed8ed1d6888ef79945243587e02be1", "score": "0.5714011", "text": "func (l *Logger) Tracef(format string, v ...interface{}) {\n\tif LogTrace <= l.level {\n\t\tl.write(format, \"TRACE\", v...)\n\t}\n}", "title": "" }, { "docid": "7927aae20f2c3c2f6a63c868928cabd8", "score": "0.56989753", "text": "func Trace(str string, o interface{}) {\n\tif args.Trace {\n\t\tobjStr, err := ToString(o)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"unable to marshal: %v\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"%s: %s\", str, fmt.Sprintln(string(objStr)))\n\t}\n}", "title": "" }, { "docid": "0972bd8e87d0117e097164b42c3eefcf", "score": "0.5689216", "text": "func (t *tracer) Trace(a ...interface{}) {\n\tif _, err := fmt.Fprint(t.out, a...); err != nil {\n\t\tlog.Fatalf(\"failed to trace: %v\", a...)\n\t}\n\tif _, err := fmt.Fprintln(t.out); err != nil {\n\t\tlog.Fatalf(\"failed to add line to trace\")\n\t}\n\n}", "title": "" }, { "docid": "3260d764a1c4874f9c40ee3147ff5eb5", "score": "0.56883806", "text": "func TraceOff() {\n\twantsTrace = false\n\ttraceOut = io.Discard\n}", "title": "" }, { "docid": "7a41b424d5613303a051b839b412b245", "score": "0.5670051", "text": "func Trace(v ...interface{}) {\n\tstd.Trace(v...)\n}", "title": "" }, { "docid": "8992cb90edb462460e657f2a2ee5fc22", "score": "0.5665958", "text": "func (logger *GPLogger) Trace(key string, value interface{}, msg string) {\n\tlogger.print.WithField(key, value).Trace(msg)\n\tif logger.RunMode == \"release\" {\n\t\tlogger.write.WithField(key, value).Trace(msg)\n\t}\n\n}", "title": "" }, { "docid": "5590ee7646a810f4bdd7a70e7766267c", "score": "0.5655639", "text": "func Trace(v ...interface{}) {\n\tTracef(fmt.Sprint(v))\n}", "title": "" }, { "docid": "7bf89baaeb57ca55feb786d3ce2ca182", "score": "0.56312555", "text": "func Trace(title string, functionName string, format string, a ...interface{}) {\n\tlogger.Trace.Output(2, fmt.Sprintf(\"%s : %s : Info : %s\\n\", title, functionName, fmt.Sprintf(format, a...)))\n}", "title": "" }, { "docid": "988e6372c423ec5096b82a733d2561d4", "score": "0.5617712", "text": "func ctrace(name string, args ...interface{}) {\n\t//log.Printf(\"TRACE %s(%v)\", name, args)\n}", "title": "" }, { "docid": "9714c20c6900d5a2f2f2af5ec30b7f98", "score": "0.56109804", "text": "func Trace(v ...interface{}) {\n\tconsole.Trace(v...)\n}", "title": "" }, { "docid": "118b774d1377651550104aefd524c9f2", "score": "0.56079197", "text": "func (l *Logger) Trace(args ...interface{}) {\n\tl.Log(TraceLevel, args...)\n}", "title": "" }, { "docid": "16317dbb5f3c90cae7ce859525304314", "score": "0.55983347", "text": "func (l *Logger) Tracef(ft string, v ...interface{}) {\n\tif l.level == lt {\n\t\tlogf(l.out, l.prefix, \"trace\", ft, v...)\n\t}\n}", "title": "" }, { "docid": "a46ae5a5597c934cadfeb1b48b58dccc", "score": "0.55925846", "text": "func Trace(format string, args ...interface{}) {\n\tlog.Warnf(format, args...)\n}", "title": "" }, { "docid": "335211beefa28b43c19b41922f86f0f3", "score": "0.55889493", "text": "func main() {\n\tf, err := os.Create(\"trace.out\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create trace output file: %v\", err)\n\t}\n\n\tdefer func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tlog.Fatalf(\"failed to close trace file: %v\", err)\n\t\t}\n\t}()\n\n\tif err := trace.Start(f); err != nil {\n\t\tlog.Fatalf(\"failed to start trace: %v\", err)\n\t}\n\t// your program here\n\tgo RunMyProgram()\n\tgo printHello()\n\ttime.Sleep(time.Second * 2)\n\tdefer trace.Stop()\n\n}", "title": "" }, { "docid": "64bdd91bdfa519a02a7465793a1badb8", "score": "0.5584685", "text": "func (sl *nilLogger) Tracef(format string, args ...interface{}) {}", "title": "" }, { "docid": "c22b00d5893bebaa61faf79a9bc29ff6", "score": "0.5577855", "text": "func (p *Parser) printTrace(a ...interface{}) {\n\tif !p.trace {\n\t\treturn\n\t}\n\n\tconst dots = \". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \"\n\tconst n = len(dots)\n\n\tfmt.Printf(\"%5d:%3d: \", 1, 1)\n\ti := 2 * p.indent\n\tfor i > n {\n\t\tfmt.Print(dots)\n\t\ti -= n\n\t}\n\t// i <= n\n\tfmt.Print(dots[0:i])\n\tfmt.Println(a...)\n}", "title": "" }, { "docid": "f433a1f7773b4c40a43c272b55d830c2", "score": "0.5555852", "text": "func (t *nilTracer) Trace(a ...interface{}) {}", "title": "" }, { "docid": "f433a1f7773b4c40a43c272b55d830c2", "score": "0.5555852", "text": "func (t *nilTracer) Trace(a ...interface{}) {}", "title": "" }, { "docid": "1946765ea4077251a54c78eb46416b83", "score": "0.5554239", "text": "func Trace(arg0 interface{}, args ...interface{}) {\n dfl.Trace(arg0, args...)\n}", "title": "" }, { "docid": "3ab3c88b6e5b22ff597ec5cb112fb710", "score": "0.55375856", "text": "func (self *TLogger) Trace(v ...interface{}) {\r\n\tmsg := fmt.Sprint(v...)\r\n\tself.manager.write(LevelTrace, \"[TRACE] \"+msg)\r\n}", "title": "" }, { "docid": "31d9195d65eba479b0b571048f4cbfa7", "score": "0.55350286", "text": "func PrintTrains(model_ptr *Simulation_Model, talking_mode Simulation_Mode) {\n\tif talking_mode == Talking_Mode {\n\t\tPrintTrainsAlways(model_ptr)\n\t}\n\n}", "title": "" }, { "docid": "eaae029672e6156d7b2984944c35070d", "score": "0.5521662", "text": "func (lc EdgeXLogger) Trace(msg string, labels ...string) error {\n\tlc.stdOutLogger.SetPrefix(\"TRACE: \")\n\tlc.stdOutLogger.Println(msg)\n\treturn lc.log(support_domain.TRACE, msg, labels)\n}", "title": "" }, { "docid": "61d1b5c75e91606c3325bd21f0d33eed", "score": "0.5510201", "text": "func (bl *Logger) Tracef(format string, v ...interface{}) {\r\n\tif LevelTrace > bl.level {\r\n\t\treturn\r\n\t}\r\n\tmsg := fmt.Sprintf(\"[T] \"+format, v...)\r\n\tbl.writerMsg(LevelTrace, msg)\r\n}", "title": "" }, { "docid": "617def8d58856688987009766ffe1c4d", "score": "0.5501768", "text": "func (l *Log) Trace(msg string, keysAndValues ...interface{}) {\n\tif (*l.log).V(2).Enabled() {\n\t\t// The V(1) level here is intentional:\n\t\t// sTRACE = finer DEBUG logging but is only enabled by setting V=2\n\t\t(*l.log).V(1).Info(fmt.Sprintf(\"TRACE: %s\", msg), keysAndValues...)\n\t}\n}", "title": "" }, { "docid": "14003ba549f7f656ac5a41b8aef3d81b", "score": "0.5500026", "text": "func (nt *nilTracer) Trace(a ...interface{}) {}", "title": "" }, { "docid": "66209d9f12a9f19aa87633365fd3396d", "score": "0.5491493", "text": "func (l *Logger) Traceln(message string) {\n\tif LogTrace <= l.level {\n\t\tl.write(message, \"TRACE\")\n\t}\n}", "title": "" }, { "docid": "062da495b5b7fa0c7f32834a20a03751", "score": "0.54754794", "text": "func Trace(a ...interface{}) {\n\tlogger.Trace.Output(2, fmt.Sprintf(\"%s\\n\", fmt.Sprint(a...)))\n}", "title": "" }, { "docid": "c9fd550a2d88b2e5896a5f1cccf627eb", "score": "0.54670686", "text": "func Tracef(format string, args ...any) { std.logf(TraceLevel, format, args) }", "title": "" }, { "docid": "7421c28c2eca852e301fb4ac1d843069", "score": "0.546123", "text": "func Trace(msg string, args ...interface{}) {\n\tmyLogger.Tracef(msg, args...)\n}", "title": "" }, { "docid": "0e316601ed1d4de5f5c241754bc2308e", "score": "0.5452278", "text": "func traceInterceptor(ctx context.Context, log *logit.Log) {\n\ttrace, ok := ctx.Value(\"trace\").(string)\n\tif !ok {\n\t\ttrace = \"unknown trace\"\n\t}\n\n\tlog.String(\"trace\", trace)\n}", "title": "" }, { "docid": "5f85b36851318e1a1e2b449d0407abe5", "score": "0.5448449", "text": "func Tracef(format string, v ...interface{}) {\n\twriteLog(\"[TRACE]\", LevelTrace, format, v...)\n}", "title": "" }, { "docid": "c07a8f8d64cff2c793b54319f3ff417f", "score": "0.54212886", "text": "func trace(args ...interface{}) {\n\tif !tracing {\n\t\treturn\n\t}\n\tprint(\"ogle demon: \")\n\tfor i, arg := range args {\n\t\tif i > 0 {\n\t\t\tprint(\" \")\n\t\t}\n\t\t// A little help. Built-in print isn't very capable.\n\t\tswitch arg := arg.(type) {\n\t\tcase stringer:\n\t\t\tprint(arg.String())\n\t\tcase error:\n\t\t\tprint(arg.Error())\n\t\tcase []byte:\n\t\t\tprint(\"[\")\n\t\t\tfor i := range arg {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tprint(\" \")\n\t\t\t\t}\n\t\t\t\tprintHex(arg[i])\n\t\t\t}\n\t\t\tprint(\"]\")\n\t\tcase int:\n\t\t\tprint(arg)\n\t\tcase string:\n\t\t\tprint(arg)\n\t\tcase uintptr:\n\t\t\tprint(\"0x\")\n\t\t\tfor i := ptrSize - 1; i >= 0; i-- {\n\t\t\t\tprintHex(byte(arg >> uint(8*i)))\n\t\t\t}\n\t\tdefault:\n\t\t\tprint(arg)\n\t\t}\n\t}\n\tprint(\"\\n\")\n}", "title": "" }, { "docid": "700cf65a1c97066944dddbda59ca8d8d", "score": "0.5409485", "text": "func IsTraceMode() bool {\n\treturn os.Getenv(\"TRACE\") != \"\"\n}", "title": "" }, { "docid": "26c0f2ae2bad655753d3483bbb50d70b", "score": "0.53601116", "text": "func (instance *tracer) Trace(msg ...interface{}) Tracer {\n\tif !valid.IsNil(instance) && instance.enabled {\n\t\tmessage := \"--- \" + instance.buildMessage(0) + \": \" + strprocess.FormatStrings(msg...)\n\t\tmessage = strings.ReplaceAll(message, \"\\n\", \"\\t\")\n\t\tif message != \"\" {\n\t\t\tlogrus.WithContext(instance.context).Tracef(message)\n\t\t}\n\t}\n\treturn instance\n}", "title": "" }, { "docid": "9ae2d145eabd005e58c680ab61560185", "score": "0.5357168", "text": "func TestOutputEnabled1(){\n\n}", "title": "" }, { "docid": "1ca0636ec5dbb25765ba81d3f6736bc8", "score": "0.53524065", "text": "func SetTrace(trace bool) {\n\tglobalTraceEnabled = trace\n}", "title": "" }, { "docid": "fa40846dc099507b36465b06742a1211", "score": "0.53397214", "text": "func (l *Logger) Tracef(format string, args ...interface{}) {\n\tif l.level <= TRACE {\n\t\tl.log(fmt.Sprintf(format, args...), TRACE)\n\t}\n}", "title": "" }, { "docid": "974a3e400043c9f1d979a2544c1e2e23", "score": "0.53393024", "text": "func init() {\n\tlog.SetPrefix(\"TRACE: \")\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)\n}", "title": "" }, { "docid": "974a3e400043c9f1d979a2544c1e2e23", "score": "0.53393024", "text": "func init() {\n\tlog.SetPrefix(\"TRACE: \")\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)\n}", "title": "" }, { "docid": "d968ae3498afdc67ee5d14df97121230", "score": "0.5332193", "text": "func (l Logger) Tracef(template string, args ...interface{}) {\n\tif ce := l.logger.Check(zap.DebugLevel-1, fmt.Sprintf(template, args...)); ce != nil {\n\t\tce.Write()\n\t}\n}", "title": "" }, { "docid": "0b37f3c59b0f2dda94d5503b206371ea", "score": "0.53282464", "text": "func Trace(msg string, ctx ...Ctx) {\n\tLog.Trace(msg, ctx...)\n}", "title": "" }, { "docid": "2f9dd2dd420de685adc05c0846c8f2d2", "score": "0.53192854", "text": "func TestOutputEnabled2(){\n\n}", "title": "" }, { "docid": "5686160fb2992e547c8692bc024339ce", "score": "0.53152406", "text": "func main() {\n\tvar err error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\tsummary := flag.Bool(\"summary\", true, \"print trace summary\")\n\tcdf := flag.Bool(\"cdf\", false, \"print propagation delay CDF\")\n\tjsonOut := flag.String(\"json\", \"\", \"save analysis output to json file\")\n\ttopic := flag.String(\"topic\", \"\", \"analyze traces for a specific topic only\")\n\tflag.Parse()\n\n\tstat := &tracestat{\n\t\tpeers: make(map[peer.ID]*msgstat),\n\t\ttopics: make(map[string]struct{}),\n\t\tmsgsInTopic: make(map[string]struct{}),\n\t\tmsgs: make(map[string][]int64),\n\t\tdelays: make(map[string][]int64),\n\t}\n\n\tif *topic != \"\" {\n\t\t// do a first pass to get the msgIDs in the topic\n\t\tfor _, f := range flag.Args() {\n\t\t\terr = load(f, func(evt *pb.TraceEvent) {\n\t\t\t\tstat.markEventForTopic(evt, *topic)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// and now do a second pass adding events for the relevant topic only\n\t\tfor _, f := range flag.Args() {\n\t\t\terr = load(f, stat.addEventForTopic)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tfor _, f := range flag.Args() {\n\t\t\terr = load(f, stat.addEvent)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tif *cdf || *jsonOut != \"\" {\n\t\tstat.compute()\n\t}\n\n\t// this will just print some stuff to stdout\n\t// TODO: produce JSON output\n\tif *summary {\n\t\tstat.printSummary()\n\t}\n\tif *cdf {\n\t\tstat.printCDF()\n\t}\n\tif *jsonOut != \"\" {\n\t\terr = stat.dumpJSON(*jsonOut)\n\t}\n}", "title": "" }, { "docid": "fb962176337d3624d850dc6f49f3a9fe", "score": "0.53135717", "text": "func (s *Service) Trace(msg string, args ...interface{}) {\n\ts.Log.Trace(msg, args...)\n}", "title": "" }, { "docid": "160dd1790e066ab94d99951177dc7c8e", "score": "0.5294223", "text": "func (rcb *runtimeControlBlock) trace(level int, messageFormat string, messageArgs ...interface{}) {\n\tqueryLogger := rcb.getClient().queryLogger\n\tif queryLogger == nil || level < queryLogger.traceLevel {\n\t\treturn\n\t}\n\n\tif rcb.sqlHashTag == nil {\n\t\tvar sql string\n\t\tps := rcb.getRequest().PreparedStatement\n\t\tif ps != nil {\n\t\t\tsql = ps.sqlText\n\t\t} else {\n\t\t\tsql = rcb.getRequest().Statement\n\t\t}\n\t\tdata := md5.Sum([]byte(sql))\n\t\t// To generate a compact output, use the first 4 bytes as a tag.\n\t\trcb.sqlHashTag = data[:4]\n\t\tqueryLogger.Trace(\"[%x] SQL: %s\", rcb.sqlHashTag, sql)\n\t}\n\n\ttag := fmt.Sprintf(\"[%x] \", rcb.sqlHashTag)\n\tqueryLogger.Trace(tag+messageFormat, messageArgs...)\n}", "title": "" }, { "docid": "9db3942acb47f824921b766ebc6539d9", "score": "0.529235", "text": "func main() {\n\tflag.Parse()\n\n\tif len(flag.Args()) == 0 && config.Help {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\n\tif len(flag.Args()) != 1 {\n\t\tfmt.Fprintln(os.Stderr, \"Host not suplied\")\n\t\tfmt.Fprintln(os.Stderr, \"\")\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\n\thost, port, err := tracetcp.SplitHostAndPort(flag.Args()[0], 80)\n\texitOnError(err)\n\n\tip, err := tracetcp.LookupAddress(host)\n\texitOnError(err)\n\n\ttrace := tracetcp.NewTrace()\n\ttrace.BeginTrace(ip, port, config.StartHop, config.EndHop, config.Queries, config.Timeout)\n\n\tif !config.Verbose {\n\t\tlog.SetOutput(ioutil.Discard)\n\t}\n\n\twriter, err := tracetcp.GetOutputWriter(config.OutputWriter)\n\texitOnError(err)\n\n\twriter.Init(port, config.StartHop, config.EndHop, config.Queries, config.NoLookups, os.Stdout)\n\n\tfor {\n\t\tev := <-trace.Events\n\t\twriter.Event(ev)\n\n\t\tif config.Verbose {\n\t\t\tfmt.Println(ev)\n\t\t}\n\t\tif ev.Type == tracetcp.TraceComplete {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32eb42450c6aea0035faa1a8feb91186", "score": "0.52918214", "text": "func (log *Log) Trace(message string) {\n\tlog.Log(common.NewMessage(common.MessageTrace, log.target, message))\n}", "title": "" }, { "docid": "2952903696abec06e8a4c395a2bea4d7", "score": "0.52905947", "text": "func Tracef(format string, v ...interface{}) { defaultLogger.Tracef(format, v...) }", "title": "" }, { "docid": "d9086a6ebdd695c7611d76f879280706", "score": "0.528873", "text": "func Strace(c *exec.Cmd, out io.Writer) error {\n\treturn Trace(c, PrintTraces(out))\n}", "title": "" }, { "docid": "5a8217f22c4edfe5111d3dae9e58eca8", "score": "0.5278684", "text": "func (*logger) Trace(v ...interface{}) { log.TraceStackDepth(2, v...) }", "title": "" }, { "docid": "0ee3a1dd7100af4dda7912b1bde0e0ec", "score": "0.52771425", "text": "func trace(p *Parser, msg string) *Parser {\n\tp.printTrace(msg, \"(\")\n\tp.indent++\n\treturn p\n}", "title": "" }, { "docid": "072b1875a6b7852e9062b8168474f2f9", "score": "0.5275961", "text": "func TestEnableOutput(){\n\n}", "title": "" }, { "docid": "603db6a9991678991f91d49a27116cfc", "score": "0.52721727", "text": "func main() {\n\tshow(LogMessage{\"Hot hot\"})\n\tshow(ErrorMessage{Message: \"Not not not\"})\n}", "title": "" }, { "docid": "6e2e7e140af5101ae2637989806de9df", "score": "0.5269415", "text": "func ConsoleTracef(format string, v ...interface{}) {\n\tprintfConsole(TRACE, format, v...)\n}", "title": "" }, { "docid": "2db7c715dc6fa9efa1e9adbf8341723f", "score": "0.52534145", "text": "func vlog(args ...interface{}) {\n\tpost := fmt.Sprintln(args...)\n\tif flagNoExecute {\n\t\tlog.Output(2, progName+\" [INFO] \"+post)\n\t} else if flagVerbose {\n\t\tlog.Output(2, progName+\" [VERBOSE] \"+post)\n\t}\n}", "title": "" }, { "docid": "7ebf9a2a0fffa9b67b0a55928edef59a", "score": "0.5244413", "text": "func Trace(arg0 interface{}, args ...interface{}) {\n\tdlog.Trace(arg0, args...)\n}", "title": "" }, { "docid": "7ce977b2badfe2b2202c183189948497", "score": "0.52437013", "text": "func _79disable_debug_trace_modes(tls crt.TLS) {\n}", "title": "" }, { "docid": "22fc228814306f9ae647a54f98f6549d", "score": "0.52396405", "text": "func (l *Logger) Tracef(context interface{}, function string, format string, a ...interface{}) {\n\tif l.level() >= LevelTrace {\n\t\tUp1.Tracef(context, function, format, a...)\n\t}\n}", "title": "" }, { "docid": "e4b11f256d5a204dcffd768a9f7e90bc", "score": "0.5232306", "text": "func (log *Logger) Trace(arg0 interface{}, args ...interface{}) {\n switch first := arg0.(type) {\n case string:\n log.logf(TRACE, first, args...)\n case func() string:\n log.logc(TRACE, first)\n default:\n log.logf(TRACE,\n fmt.Sprint(arg0) + strings.Repeat(\" %v\", len(args)), args...)\n }\n}", "title": "" }, { "docid": "7af73a00cc55ce27eee3dc40dbfb4c74", "score": "0.5215774", "text": "func Mark(a ...interface{}) {\n\tlogger.Trace.Output(2, fmt.Sprintf(\"[%s] %s\\n\", getCaller(), fmt.Sprint(a...)))\n}", "title": "" }, { "docid": "790c423564221c9a3dd65aea4933f423", "score": "0.5205329", "text": "func Tracef(format string, v ...interface{}) {\n\tconsole.Tracef(format, v...)\n}", "title": "" }, { "docid": "d4f691b4d7dafe55b064f326cc16478e", "score": "0.51962113", "text": "func (t Tracee) shouldPrintEvent(e int32) bool {\n\t// if we got a trace for a non-essential event, it means the user explicitly requested it (using `-e`), or the user doesn't care (trace all by default). In both cases it's ok to print.\n\t// for essential events we need to check if the user actually wanted this event\n\tif print, isEssential := essentialEvents[e]; isEssential {\n\t\treturn print\n\t}\n\treturn true\n}", "title": "" }, { "docid": "21fdfbcebf38bed3d51aaddd75656eca", "score": "0.518888", "text": "func (c *Simulator) Trace(w io.Writer) {\n\tc.Processor.TraceWriter = w\n}", "title": "" }, { "docid": "bcba29b33dace9a0ded284c04867507c", "score": "0.5185488", "text": "func verboseEnabled(callerDepth int, level Level) bool {\n\treturn vflags.enabled(callerDepth+1, level)\n}", "title": "" }, { "docid": "7fdc761c01f154ad9cee543a8d4f5cbc", "score": "0.51574624", "text": "func Trace(v ...interface{}) {\n\tdefaultContext.Trace(v...)\n}", "title": "" }, { "docid": "a054b4b8fc381af6b95f9948039b272c", "score": "0.51424307", "text": "func (l *TestLogger) Trace(msg string, fields ...map[string]interface{}) {\n\tl.record(Trace, msg, fields)\n}", "title": "" } ]
60ded679536f823ff67f8f0ea9bf0940
getPivotFieldsOrder provides a function to get order list of pivot table fields.
[ { "docid": "b898d69b2d2f61097ee9c43a12965501", "score": "0.77758956", "text": "func (f *File) getPivotFieldsOrder(opts *PivotTableOptions) ([]string, error) {\n\tvar order []string\n\tdataRange := f.getDefinedNameRefTo(opts.DataRange, opts.pivotTableSheetName)\n\tif dataRange == \"\" {\n\t\tdataRange = opts.DataRange\n\t}\n\tdataSheet, coordinates, err := f.adjustRange(dataRange)\n\tif err != nil {\n\t\treturn order, fmt.Errorf(\"parameter 'DataRange' parsing error: %s\", err.Error())\n\t}\n\tfor col := coordinates[0]; col <= coordinates[2]; col++ {\n\t\tcoordinate, _ := CoordinatesToCellName(col, coordinates[1])\n\t\tname, err := f.GetCellValue(dataSheet, coordinate)\n\t\tif err != nil {\n\t\t\treturn order, err\n\t\t}\n\t\torder = append(order, name)\n\t}\n\treturn order, nil\n}", "title": "" } ]
[ { "docid": "1eabd653c3a7dcb65912a01d8d8327d8", "score": "0.597181", "text": "func (f *File) getPivotFieldsIndex(fields []PivotTableField, opts *PivotTableOptions) ([]int, error) {\n\tvar pivotFieldsIndex []int\n\torders, err := f.getPivotFieldsOrder(opts)\n\tif err != nil {\n\t\treturn pivotFieldsIndex, err\n\t}\n\tfor _, field := range fields {\n\t\tif pos := inStrSlice(orders, field.Data, true); pos != -1 {\n\t\t\tpivotFieldsIndex = append(pivotFieldsIndex, pos)\n\t\t}\n\t}\n\treturn pivotFieldsIndex, nil\n}", "title": "" }, { "docid": "c6167ca31df3090bcc2fb500bfb505e9", "score": "0.558457", "text": "func OrdinalFields(typ types.FidlType, namePrefix string, n int) string {\n\tvar builder strings.Builder\n\tfor i := 1; i <= n; i++ {\n\t\tif i > 1 {\n\t\t\tbuilder.WriteRune('\\n')\n\t\t}\n\t\tbuilder.WriteString(fmt.Sprintf(\"%d: %s%d %s;\", i, namePrefix, i, typ))\n\t}\n\treturn builder.String()\n}", "title": "" }, { "docid": "029d71278072638c20a890142702f190", "score": "0.5509053", "text": "func (oa *OrderedAggregate) GetFields(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\tqr, err := oa.Input.GetFields(ctx, vcursor, bindVars)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqr = &sqltypes.Result{Fields: convertFields(qr.Fields, oa.Aggregates)}\n\treturn qr.Truncate(oa.TruncateColumnCount), nil\n}", "title": "" }, { "docid": "5ffccba5aee50260ac66148d462f6876", "score": "0.5330007", "text": "func (o IndexFieldOutput) Order() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexField) *string { return v.Order }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0a5c82e4d5f528f8d822a165c963753e", "score": "0.52924645", "text": "func (fm FieldMap) OrderedKeys() []string {\n\tkeys := fm.Keys()\n\tsort.Strings(keys)\n\treturn keys\n}", "title": "" }, { "docid": "aabf29fa24eae1506d4a08cae9b9f7b7", "score": "0.52726316", "text": "func (pfmq *ParticipantFlowModuleQuery) Order(o ...OrderFunc) *ParticipantFlowModuleQuery {\n\tpfmq.order = append(pfmq.order, o...)\n\treturn pfmq\n}", "title": "" }, { "docid": "4d83f3f1da71756828dcd37f05bf3e1f", "score": "0.52492386", "text": "func (f *File) addPivotFields(pt *xlsxPivotTableDefinition, opts *PivotTableOptions) error {\n\torder, err := f.getPivotFieldsOrder(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tx := 0\n\tfor _, name := range order {\n\t\tif inPivotTableField(opts.Rows, name) != -1 {\n\t\t\trowOptions, ok := f.getPivotTableFieldOptions(name, opts.Rows)\n\t\t\tvar items []*xlsxItem\n\t\t\tif !ok || !rowOptions.DefaultSubtotal {\n\t\t\t\titems = append(items, &xlsxItem{X: &x})\n\t\t\t} else {\n\t\t\t\titems = append(items, &xlsxItem{T: \"default\"})\n\t\t\t}\n\n\t\t\tpt.PivotFields.PivotField = append(pt.PivotFields.PivotField, &xlsxPivotField{\n\t\t\t\tName: f.getPivotTableFieldName(name, opts.Rows),\n\t\t\t\tAxis: \"axisRow\",\n\t\t\t\tDataField: inPivotTableField(opts.Data, name) != -1,\n\t\t\t\tCompact: &rowOptions.Compact,\n\t\t\t\tOutline: &rowOptions.Outline,\n\t\t\t\tDefaultSubtotal: &rowOptions.DefaultSubtotal,\n\t\t\t\tItems: &xlsxItems{\n\t\t\t\t\tCount: len(items),\n\t\t\t\t\tItem: items,\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif inPivotTableField(opts.Filter, name) != -1 {\n\t\t\tpt.PivotFields.PivotField = append(pt.PivotFields.PivotField, &xlsxPivotField{\n\t\t\t\tAxis: \"axisPage\",\n\t\t\t\tDataField: inPivotTableField(opts.Data, name) != -1,\n\t\t\t\tName: f.getPivotTableFieldName(name, opts.Columns),\n\t\t\t\tItems: &xlsxItems{\n\t\t\t\t\tCount: 1,\n\t\t\t\t\tItem: []*xlsxItem{\n\t\t\t\t\t\t{T: \"default\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif inPivotTableField(opts.Columns, name) != -1 {\n\t\t\tcolumnOptions, ok := f.getPivotTableFieldOptions(name, opts.Columns)\n\t\t\tvar items []*xlsxItem\n\t\t\tif !ok || !columnOptions.DefaultSubtotal {\n\t\t\t\titems = append(items, &xlsxItem{X: &x})\n\t\t\t} else {\n\t\t\t\titems = append(items, &xlsxItem{T: \"default\"})\n\t\t\t}\n\t\t\tpt.PivotFields.PivotField = append(pt.PivotFields.PivotField, &xlsxPivotField{\n\t\t\t\tName: f.getPivotTableFieldName(name, opts.Columns),\n\t\t\t\tAxis: \"axisCol\",\n\t\t\t\tDataField: inPivotTableField(opts.Data, name) != -1,\n\t\t\t\tCompact: &columnOptions.Compact,\n\t\t\t\tOutline: &columnOptions.Outline,\n\t\t\t\tDefaultSubtotal: &columnOptions.DefaultSubtotal,\n\t\t\t\tItems: &xlsxItems{\n\t\t\t\t\tCount: len(items),\n\t\t\t\t\tItem: items,\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif inPivotTableField(opts.Data, name) != -1 {\n\t\t\tpt.PivotFields.PivotField = append(pt.PivotFields.PivotField, &xlsxPivotField{\n\t\t\t\tDataField: true,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tpt.PivotFields.PivotField = append(pt.PivotFields.PivotField, &xlsxPivotField{})\n\t}\n\treturn err\n}", "title": "" }, { "docid": "316c6cbc45855fae5235d2d0550c4a4a", "score": "0.52248216", "text": "func (o *URLFieldFieldSerializerWithRelatedFields) GetOrder() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Order\n}", "title": "" }, { "docid": "73bda2f4e64799d4f250010eeb164d2f", "score": "0.52108496", "text": "func (fq *FormQuery) Order(o ...OrderFunc) *FormQuery {\n\tfq.order = append(fq.order, o...)\n\treturn fq\n}", "title": "" }, { "docid": "e4af3f4f631170ca127781cdecdea9fb", "score": "0.52011657", "text": "func (o *LinkRowFieldField) GetOrder() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Order\n}", "title": "" }, { "docid": "9c9e948ff321ac2e2b6817b10c4f67af", "score": "0.51772624", "text": "func TagFields(pointer interface{}, priority []string) ([]*Field, error) {\n\treturn getFieldValuesByTagPriority(pointer, priority, map[string]struct{}{})\n}", "title": "" }, { "docid": "02e5cf99893e28cbd6bccb72ae832e03", "score": "0.51172745", "text": "func OrderByFieldType_Values() []string {\n\treturn []string{\n\t\tOrderByFieldTypeRelevance,\n\t\tOrderByFieldTypeName,\n\t\tOrderByFieldTypeSize,\n\t\tOrderByFieldTypeCreatedTimestamp,\n\t\tOrderByFieldTypeModifiedTimestamp,\n\t}\n}", "title": "" }, { "docid": "26aa82a020db950ab8e63f2e5ca10b63", "score": "0.510207", "text": "func NewOrderedFields() *OrderedFields {\n\treturn &OrderedFields{\n\t\tm: make(map[string]FieldValue),\n\t}\n}", "title": "" }, { "docid": "6c7314000882df43f4dba697c955713b", "score": "0.51014805", "text": "func (doctree *DocumentTree) PropertyOrder() []Property {\n\tpropOrder := []Property{}\n\tfor _, leaf := range doctree.leaves {\n\t\tpropOrder = append(propOrder, leaf.Property)\n\t}\n\treturn propOrder\n}", "title": "" }, { "docid": "9365ef15b0a8488ab651c810ba2a02df", "score": "0.50448525", "text": "func SortFields(wsSepStrings ...string) []string {\n\tslice := []string{}\n\n\tfor _, s := range wsSepStrings {\n\t\tslice = append(slice, strings.Fields(s)...)\n\t}\n\n\tslice = UniqueStrings(slice)\n\tsort.Strings(slice)\n\treturn slice\n}", "title": "" }, { "docid": "d26979dde8f278d0d22b1096614c5322", "score": "0.5008079", "text": "func GetFieldNames(object interface{}, sorted bool, reversed bool) []string {\n\treturn GetFieldNamesFromValue(reflect.ValueOf(object), sorted, reversed)\n}", "title": "" }, { "docid": "64b2c4c21d8faada2cac7d328fbf95c8", "score": "0.49948633", "text": "func (sf *SloppyFile) sortFields() {\n\tfor _, services := range sf.Services {\n\t\tfor _, app := range services {\n\t\t\tsort.Sort(app.Env)\n\t\t\tsort.Strings(app.App.Dependencies)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f849cc86d92d6460b7f3cff2f1c33510", "score": "0.49851978", "text": "func getFields(o interface{}) []string {\n\tt := reflect.TypeOf(o)\n\tresult := make([]string, t.NumField())\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tresult[i] = t.Field(i).Name\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "891f41f830fab9dec5f5535008a47d55", "score": "0.49546996", "text": "func (pipq *PositionInPharmacistQuery) Order(o ...OrderFunc) *PositionInPharmacistQuery {\n\tpipq.order = append(pipq.order, o...)\n\treturn pipq\n}", "title": "" }, { "docid": "24def0bc728dfea377aaa42cddd033e1", "score": "0.49456862", "text": "func (m *WorkOrderMutation) Fields() []string {\n\tfields := make([]string, 0, 10)\n\tif m.create_time != nil {\n\t\tfields = append(fields, workorder.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, workorder.FieldUpdateTime)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, workorder.FieldName)\n\t}\n\tif m.status != nil {\n\t\tfields = append(fields, workorder.FieldStatus)\n\t}\n\tif m.priority != nil {\n\t\tfields = append(fields, workorder.FieldPriority)\n\t}\n\tif m.description != nil {\n\t\tfields = append(fields, workorder.FieldDescription)\n\t}\n\tif m.install_date != nil {\n\t\tfields = append(fields, workorder.FieldInstallDate)\n\t}\n\tif m.creation_date != nil {\n\t\tfields = append(fields, workorder.FieldCreationDate)\n\t}\n\tif m.index != nil {\n\t\tfields = append(fields, workorder.FieldIndex)\n\t}\n\tif m.close_date != nil {\n\t\tfields = append(fields, workorder.FieldCloseDate)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "d29f7530cc1664df67a0cdd30dfc95e2", "score": "0.49227953", "text": "func (q *Query) Order(orders ...string) *Query {\nloop:\n\tfor _, order := range orders {\n\t\tif order == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tind := strings.Index(order, \" \")\n\t\tif ind != -1 {\n\t\t\tfield := order[:ind]\n\t\t\tsort := order[ind+1:]\n\t\t\tswitch internal.UpperString(sort) {\n\t\t\tcase \"ASC\", \"DESC\", \"ASC NULLS FIRST\", \"DESC NULLS FIRST\",\n\t\t\t\t\"ASC NULLS LAST\", \"DESC NULLS LAST\":\n\t\t\t\tq = q.OrderExpr(\"? ?\", types.Ident(field), types.Safe(sort))\n\t\t\t\tcontinue loop\n\t\t\t}\n\t\t}\n\n\t\tq.order = append(q.order, fieldAppender{order})\n\t}\n\treturn q\n}", "title": "" }, { "docid": "d660aaa1e0a8bd73d9ab52f9683a4242", "score": "0.49086106", "text": "func (eq *ExperienceQuery) Order(o ...OrderFunc) *ExperienceQuery {\n\teq.order = append(eq.order, o...)\n\treturn eq\n}", "title": "" }, { "docid": "6e10c79ee6b65a709b9dba31ad01958d", "score": "0.49052206", "text": "func (mtq *MetaTableQuery) Order(o ...Order) *MetaTableQuery {\n\tmtq.order = append(mtq.order, o...)\n\treturn mtq\n}", "title": "" }, { "docid": "d79202431094a62f654c043d6a048a77", "score": "0.4900797", "text": "func (fmq *FlowMilestoneQuery) Order(o ...OrderFunc) *FlowMilestoneQuery {\n\tfmq.order = append(fmq.order, o...)\n\treturn fmq\n}", "title": "" }, { "docid": "58ed0f80fff2fa9709ca9fd4e8af102a", "score": "0.48986167", "text": "func (mwfoq *MessageWithFieldOneQuery) Order(o ...OrderFunc) *MessageWithFieldOneQuery {\n\tmwfoq.order = append(mwfoq.order, o...)\n\treturn mwfoq\n}", "title": "" }, { "docid": "647c618a9f3f4ef1b0da13395ce90d16", "score": "0.48962647", "text": "func (gtq *GroupTagQuery) Order(o ...OrderFunc) *GroupTagQuery {\n\tgtq.order = append(gtq.order, o...)\n\treturn gtq\n}", "title": "" }, { "docid": "dccb578ce2f79252221b808c8adee4ed", "score": "0.4891986", "text": "func (fiq *FlowInstanceQuery) Order(o ...OrderFunc) *FlowInstanceQuery {\n\tfiq.order = append(fiq.order, o...)\n\treturn fiq\n}", "title": "" }, { "docid": "394f83e0e8b0c5f3acdd40effc520ff0", "score": "0.48754096", "text": "func extractOrderBy(stmt *sqlparser.Select) ([]string, []string, error) {\n\tvar flds []string\n\tvar dirs []string\n\n\tfor _, item := range stmt.OrderBy {\n\t\tswitch colExpr := item.Expr.(type) {\n\t\tcase *sqlparser.ColName:\n\t\t\tcolName := colExpr.Name.String()\n\t\t\tflds = append(flds, colName)\n\t\t\tdirs = append(dirs, item.Direction)\n\t\t}\n\t}\n\n\treturn flds, dirs, nil\n}", "title": "" }, { "docid": "5fe2e3e6d1d9c0083f6ba1546627bece", "score": "0.48589793", "text": "func (mtq *MedicineTypeQuery) Order(o ...OrderFunc) *MedicineTypeQuery {\n\tmtq.order = append(mtq.order, o...)\n\treturn mtq\n}", "title": "" }, { "docid": "a20b6089d854b181bbb2d0c582f1e72e", "score": "0.48477405", "text": "func (o *FormViewView) GetOrder() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.Order\n}", "title": "" }, { "docid": "df69474c2d8dc114575798fa52e08d92", "score": "0.48425037", "text": "func (u *UpdatePinnedDialogs) GetOrder() (value []DialogPeerClass, ok bool) {\n\tif !u.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn u.Order, true\n}", "title": "" }, { "docid": "a8fae075784f85cae9d5a0487a6f9b92", "score": "0.48370633", "text": "func (o *OrderedFields) Keys() []string {\n\treturn o.keys\n}", "title": "" }, { "docid": "d187ce3d76539779adbcd3b528a43880", "score": "0.48346478", "text": "func (sql *SQL) OrderBy(fields ...string) *SQL {\n\tif len(fields) == 0 {\n\t\tpanic(\"wrong order field\")\n\t}\n\tfor i := 0; i < len(fields); i++ {\n\t\tif i == len(fields)-2 {\n\t\t\tsql.Order += \" \" + sql.wrap(fields[i]) + \" \" + fields[i+1]\n\t\t\treturn sql\n\t\t}\n\t\tsql.Order += \" \" + sql.wrap(fields[i]) + \" and \"\n\t}\n\treturn sql\n}", "title": "" }, { "docid": "e232a22988a7a1de6fb21c5984868516", "score": "0.48147178", "text": "func (f *File) getPivotTableFieldsName(fields []PivotTableField) []string {\n\tfield := make([]string, len(fields))\n\tfor idx, fld := range fields {\n\t\tif len(fld.Name) > MaxFieldLength {\n\t\t\tfield[idx] = fld.Name[:MaxFieldLength]\n\t\t\tcontinue\n\t\t}\n\t\tfield[idx] = fld.Name\n\t}\n\treturn field\n}", "title": "" }, { "docid": "e43935de3a09f847172712740a07e19c", "score": "0.47924826", "text": "func (ps *pulloutSubquery) Order() int {\n\treturn ps.order\n}", "title": "" }, { "docid": "440bef5617ff47399b37c656db9a5768", "score": "0.47761574", "text": "func (qb *QueryBuilder) getOrderBy(et entities.EntityType, qo *odata.QueryOptions) string {\n\tif qo != nil && !qo.QueryOrderBy.IsNil() {\n\t\treturn fmt.Sprintf(\"%v %v\", selectMappings[et][strings.ToLower(qo.QueryOrderBy.Property)], strings.ToUpper(qo.QueryOrderBy.Suffix))\n\t}\n\n\treturn fmt.Sprintf(\"%s DESC\", selectMappings[et][idField])\n}", "title": "" }, { "docid": "e215b8d44a06e5ad6d17abd655d8e2da", "score": "0.47692472", "text": "func (Pet) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"name\").\n\t\t\tAnnotations(entgql.OrderField(\"name\")),\n\t}\n}", "title": "" }, { "docid": "107983a12c20423cc68acd1099aff115", "score": "0.47610605", "text": "func (m *DoctorordersheetMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m._Name != nil {\n\t\tfields = append(fields, doctorordersheet.FieldName)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "e226208473e552f95f87c1a9ba4bca22", "score": "0.47588116", "text": "func (pocq *PointOfContactQuery) Order(o ...OrderFunc) *PointOfContactQuery {\n\tpocq.order = append(pocq.order, o...)\n\treturn pocq\n}", "title": "" }, { "docid": "8c413dbae8dccd41c13abec209286d94", "score": "0.47388205", "text": "func (m *WorkOrderMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, workorder.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "221de775460873b1692e3a8549adcd44", "score": "0.47343525", "text": "func (q *Query) Fields() []*Field {\n\treturn q.fields\n}", "title": "" }, { "docid": "efb33d9da762095246ecc425da8f2de4", "score": "0.47220662", "text": "func (ommq *OutcomeMeasuresModuleQuery) Order(o ...OrderFunc) *OutcomeMeasuresModuleQuery {\n\tommq.order = append(ommq.order, o...)\n\treturn ommq\n}", "title": "" }, { "docid": "47b746f649ad10b1d2c7650841362feb", "score": "0.47183833", "text": "func (fm *FinalModelOrder) GetFields(fbeValue *Order) (int, error) {\n var err error = nil\n fbeCurrentOffset := 0\n fbeCurrentSize := 0\n fbeFieldSize := 0\n\n fm.Id.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.Id, fbeFieldSize, err = fm.Id.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.Symbol.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.Symbol, fbeFieldSize, err = fm.Symbol.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.Side.SetFBEOffset(fbeCurrentOffset)\n if fbeFieldSize, err = fm.Side.GetValue(&fbeValue.Side); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.Type.SetFBEOffset(fbeCurrentOffset)\n if fbeFieldSize, err = fm.Type.GetValue(&fbeValue.Type); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.Price.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.Price, fbeFieldSize, err = fm.Price.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.Volume.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.Volume, fbeFieldSize, err = fm.Volume.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n return fbeCurrentSize, err\n}", "title": "" }, { "docid": "541a3b7b548b5f341c88ea36207135ca", "score": "0.47056383", "text": "func (m *WorkOrderDefinitionMutation) Fields() []string {\n\tfields := make([]string, 0, 3)\n\tif m.create_time != nil {\n\t\tfields = append(fields, workorderdefinition.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, workorderdefinition.FieldUpdateTime)\n\t}\n\tif m.index != nil {\n\t\tfields = append(fields, workorderdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "6f604b150af50116f77db0d7c4dd469d", "score": "0.47027537", "text": "func (q *PlayerQuery) Order(cols ...kallax.ColumnOrder) *PlayerQuery {\n\tq.BaseQuery.Order(cols...)\n\treturn q\n}", "title": "" }, { "docid": "e70506398b930b4ad88a4f8b13d80829", "score": "0.46914846", "text": "func (p *plugin) GetOrderFirst() []string {\n\tif p.KindOrderFirst != nil && len(p.KindOrderFirst) != 0 {\n\t\treturn p.KindOrderFirst\n\t}\n\n\tswitch p.BuiltinOrderName {\n\tcase kustomizelegacyorder:\n\t\treturn []string{\n\t\t\t\"Namespace\",\n\t\t\t\"ResourceQuota\",\n\t\t\t\"StorageClass\",\n\t\t\t\"CustomResourceDefinition\",\n\t\t\t\"MutatingWebhookConfiguration\",\n\t\t\t\"ServiceAccount\",\n\t\t\t\"PodSecurityPolicy\",\n\t\t\t\"Role\",\n\t\t\t\"ClusterRole\",\n\t\t\t\"RoleBinding\",\n\t\t\t\"ClusterRoleBinding\",\n\t\t\t\"ConfigMap\",\n\t\t\t\"Secret\",\n\t\t\t\"Service\",\n\t\t\t\"LimitRange\",\n\t\t\t\"PriorityClass\",\n\t\t\t\"Deployment\",\n\t\t\t\"StatefulSet\",\n\t\t\t\"CronJob\",\n\t\t\t\"PodDisruptionBudget\",\n\t\t}\n\n\tcase kubectlapply, kubectldelete:\n\t\t// kubectl apply friendly order\n\t\treturn []string{\n\t\t\t\"Namespace\",\n\t\t\t\"ResourceQuota\",\n\t\t\t\"LimitRange\",\n\t\t\t\"PodSecurityPolicy\",\n\t\t\t\"Secret\",\n\t\t\t\"ConfigMap\",\n\t\t\t\"StorageClass\",\n\t\t\t\"PersistentVolume\",\n\t\t\t\"PersistentVolumeClaim\",\n\t\t\t\"ServiceAccount\",\n\t\t\t\"CustomResourceDefinition\",\n\t\t\t\"ClusterRole\",\n\t\t\t\"ClusterRoleBinding\",\n\t\t\t\"Role\",\n\t\t\t\"RoleBinding\",\n\t\t\t\"Service\",\n\t\t\t\"DaemonSet\",\n\t\t\t\"Pod\",\n\t\t\t\"ReplicationController\",\n\t\t\t\"ReplicaSet\",\n\t\t\t\"Deployment\",\n\t\t\t\"StatefulSet\",\n\t\t\t\"Job\",\n\t\t\t\"CronJob\",\n\t\t\t\"Ingress\",\n\t\t\t\"APIService\",\n\t\t}\n\n\tdefault:\n\t\t// kubectl apply friendly order\n\t\treturn []string{\n\t\t\t\"Namespace\",\n\t\t\t\"ResourceQuota\",\n\t\t\t\"LimitRange\",\n\t\t\t\"PodSecurityPolicy\",\n\t\t\t\"Secret\",\n\t\t\t\"ConfigMap\",\n\t\t\t\"StorageClass\",\n\t\t\t\"PersistentVolume\",\n\t\t\t\"PersistentVolumeClaim\",\n\t\t\t\"ServiceAccount\",\n\t\t\t\"CustomResourceDefinition\",\n\t\t\t\"ClusterRole\",\n\t\t\t\"ClusterRoleBinding\",\n\t\t\t\"Role\",\n\t\t\t\"RoleBinding\",\n\t\t\t\"Service\",\n\t\t\t\"DaemonSet\",\n\t\t\t\"Pod\",\n\t\t\t\"ReplicationController\",\n\t\t\t\"ReplicaSet\",\n\t\t\t\"Deployment\",\n\t\t\t\"StatefulSet\",\n\t\t\t\"Job\",\n\t\t\t\"CronJob\",\n\t\t\t\"Ingress\",\n\t\t\t\"APIService\",\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3657f2cd3bee2db0b8739c0272a48dd3", "score": "0.46901602", "text": "func GetListVirtualNodesSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "959cf3c48365151315f0d351aa5b8130", "score": "0.468829", "text": "func (m *FooMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.foo_foo != nil {\n\t\tfields = append(fields, foo.FieldFooFoo)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "d212309716a4fbb0008e24d47adda802", "score": "0.46841347", "text": "func (q *Query) Order(fieldName string) *Query {\n\tif q.dq == nil {\n\t\tq.dq = datastore.NewQuery(q.entity)\n\t}\n\tq.dq = q.dq.Order(fieldName)\n\treturn q\n}", "title": "" }, { "docid": "8d1881a38d1bceee88831dec168ff47c", "score": "0.4658538", "text": "func (d Document) Fields() []string {\n\treturn d.meta.Fields()\n}", "title": "" }, { "docid": "109a5023b0cfd903d27a8a2ccb524da8", "score": "0.4658307", "text": "func GetListFsuCollectionsSortOrderEnumStringValues() []string {\n\treturn []string{\n\t\t\"ASC\",\n\t\t\"DESC\",\n\t}\n}", "title": "" }, { "docid": "66e53a6f55f2dd067fbe429abb21792a", "score": "0.4644798", "text": "func (b PagingSearchBuilder) GetOrderByCriteria() string {\n\tif b.isSortByPrimaryKey() {\n\t\treturn fmt.Sprintf(\"%s %s\", b.PrimaryKey, b.getSortOrder())\n\t}\n\n\treturn fmt.Sprintf(\"%s %s,%s\", b.SortColumn, b.getSortOrder(), b.PrimaryKey)\n\n}", "title": "" }, { "docid": "425d181ac0c71900593fd08426620987", "score": "0.4642952", "text": "func (t Table) Fields(model interface{}) ([]*Field, error) {\n\tfields := []*Field{}\n\tmt := reflect.TypeOf(model)\n\tmv := reflect.ValueOf(model)\n\tif mt.Kind() == reflect.Ptr {\n\t\tmt = mt.Elem()\n\t\tmv = mv.Elem()\n\t} else {\n\t\treturn nil, liberr.Wrap(MustBePtrErr)\n\t}\n\tif mv.Kind() != reflect.Struct {\n\t\treturn nil, liberr.Wrap(MustBeObjectErr)\n\t}\n\tfor i := 0; i < mt.NumField(); i++ {\n\t\tft := mt.Field(i)\n\t\tfv := mv.Field(i)\n\t\tif !fv.CanSet() {\n\t\t\tcontinue\n\t\t}\n\t\tswitch fv.Kind() {\n\t\tcase reflect.Struct:\n\t\t\tsqlTag, found := ft.Tag.Lookup(Tag)\n\t\t\tif !found {\n\t\t\t\tnested, err := t.Fields(fv.Addr().Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\tfields = append(fields, nested...)\n\t\t\t} else {\n\t\t\t\tfields = append(\n\t\t\t\t\tfields,\n\t\t\t\t\t&Field{\n\t\t\t\t\t\tTag: sqlTag,\n\t\t\t\t\t\tName: ft.Name,\n\t\t\t\t\t\tValue: &fv,\n\t\t\t\t\t})\n\t\t\t}\n\t\tcase reflect.Slice,\n\t\t\treflect.Map,\n\t\t\treflect.String,\n\t\t\treflect.Bool,\n\t\t\treflect.Int,\n\t\t\treflect.Int8,\n\t\t\treflect.Int16,\n\t\t\treflect.Int32,\n\t\t\treflect.Int64:\n\t\t\tsqlTag, found := ft.Tag.Lookup(Tag)\n\t\t\tif !found {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfields = append(\n\t\t\t\tfields,\n\t\t\t\t&Field{\n\t\t\t\t\tTag: sqlTag,\n\t\t\t\t\tName: ft.Name,\n\t\t\t\t\tValue: &fv,\n\t\t\t\t})\n\t\t}\n\t}\n\n\treturn fields, nil\n}", "title": "" }, { "docid": "895801e708b0b81ec6a99278e28a1ab1", "score": "0.46395266", "text": "func sortedKeys(m interface{}) []string {\n\tvalue := reflect.ValueOf(m)\n\tif value.Kind() != reflect.Map || value.Type().Key().Kind() != reflect.String {\n\t\treturn nil\n\t}\n\n\tvalueKeys := value.MapKeys()\n\tkeys := make([]string, len(valueKeys))\n\tfor i, k := range valueKeys {\n\t\tkeys[i] = k.String()\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "title": "" }, { "docid": "9eb59bda95cbcc380e4a8f8d86290b6a", "score": "0.46352986", "text": "func (f *File) getPivotTableFieldOptions(name string, fields []PivotTableField) (options PivotTableField, ok bool) {\n\tfor _, field := range fields {\n\t\tif field.Data == name {\n\t\t\toptions, ok = field, true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c616da4dd43981fd12eb17d1ba981bb9", "score": "0.46272844", "text": "func (uomq *UnitOfMedicineQuery) Order(o ...OrderFunc) *UnitOfMedicineQuery {\n\tuomq.order = append(uomq.order, o...)\n\treturn uomq\n}", "title": "" }, { "docid": "c748e08d9115a89d764d0b5da3d4e40d", "score": "0.46265778", "text": "func (m *FloorPlanMutation) Fields() []string {\n\tfields := make([]string, 0, 3)\n\tif m.create_time != nil {\n\t\tfields = append(fields, floorplan.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, floorplan.FieldUpdateTime)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, floorplan.FieldName)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "3eeb42366f8288b90a17624ed443b0c2", "score": "0.46197182", "text": "func (djiq *DetectionJobInstanceQuery) Order(o ...OrderFunc) *DetectionJobInstanceQuery {\n\tdjiq.order = append(djiq.order, o...)\n\treturn djiq\n}", "title": "" }, { "docid": "505801643dd36c2aefb0fff9fbdf9898", "score": "0.4618244", "text": "func (f *File) getPivotTableFieldsSubtotal(fields []PivotTableField) []string {\n\tfield := make([]string, len(fields))\n\tenums := []string{\"average\", \"count\", \"countNums\", \"max\", \"min\", \"product\", \"stdDev\", \"stdDevp\", \"sum\", \"var\", \"varp\"}\n\tinEnums := func(enums []string, val string) string {\n\t\tfor _, enum := range enums {\n\t\t\tif strings.EqualFold(enum, val) {\n\t\t\t\treturn enum\n\t\t\t}\n\t\t}\n\t\treturn \"sum\"\n\t}\n\tfor idx, fld := range fields {\n\t\tfield[idx] = inEnums(enums, fld.Subtotal)\n\t}\n\treturn field\n}", "title": "" }, { "docid": "5ce2219bf5a6e8940a844b2ebeff6c21", "score": "0.46041602", "text": "func (o *LogQueryDefinitionSort) GetOrder() WidgetSort {\n\tif o == nil {\n\t\tvar ret WidgetSort\n\t\treturn ret\n\t}\n\n\treturn o.Order\n}", "title": "" }, { "docid": "6d5c8f4ed0e5d74ccf498118689be435", "score": "0.459915", "text": "func (fq *FundQuery) Order(o ...OrderFunc) *FundQuery {\n\tfq.order = append(fq.order, o...)\n\treturn fq\n}", "title": "" }, { "docid": "ac0aa7129ce6e861765878e5600ce889", "score": "0.45989957", "text": "func (rtq *RuleTypeQuery) Order(o ...OrderFunc) *RuleTypeQuery {\n\trtq.order = append(rtq.order, o...)\n\treturn rtq\n}", "title": "" }, { "docid": "0fd511c1743cd19c93df03c26a68d6c2", "score": "0.45981255", "text": "func (m *PermissionsPolicyMutation) Fields() []string {\n\tfields := make([]string, 0, 7)\n\tif m.create_time != nil {\n\t\tfields = append(fields, permissionspolicy.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, permissionspolicy.FieldUpdateTime)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, permissionspolicy.FieldName)\n\t}\n\tif m.description != nil {\n\t\tfields = append(fields, permissionspolicy.FieldDescription)\n\t}\n\tif m.is_global != nil {\n\t\tfields = append(fields, permissionspolicy.FieldIsGlobal)\n\t}\n\tif m.inventory_policy != nil {\n\t\tfields = append(fields, permissionspolicy.FieldInventoryPolicy)\n\t}\n\tif m.workforce_policy != nil {\n\t\tfields = append(fields, permissionspolicy.FieldWorkforcePolicy)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "5d7b3b6dcf2ad77f2d163001228d883b", "score": "0.4594397", "text": "func (model Announcement) GetFields() (string, []string, []string, error) {\n\treturn helper.GetFields(model)\n}", "title": "" }, { "docid": "2f3cc043f1f1672a27eeccb2306d4b57", "score": "0.45843437", "text": "func (m *WorkOrderDefinitionMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, workorderdefinition.FieldIndex)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "8a82ae1764051315e1f2ad874a8527c3", "score": "0.45764205", "text": "func PossibleDefinitionQueryOrderValues() []DefinitionQueryOrder {\n\treturn []DefinitionQueryOrder{DefinitionNameAscending, DefinitionNameDescending, LastModifiedAscending, LastModifiedDescending, None}\n}", "title": "" }, { "docid": "3b0f2af3bc36d321a75e147cd6c40fc1", "score": "0.45710236", "text": "func (rwq *ReportWalletQuery) Order(o ...OrderFunc) *ReportWalletQuery {\n\trwq.order = append(rwq.order, o...)\n\treturn rwq\n}", "title": "" }, { "docid": "008a6415d8880436085a2e5689ea8776", "score": "0.45643055", "text": "func (receiver *UserDefinedModel) GetStructFields(model extension.Model) []reflect.StructField {\n\tstructFieldList := make([]reflect.StructField, len(receiver.structFieldList), len(receiver.structFieldList))\n\tfor i := 0; i < len(receiver.structFieldList); i++ {\n\t\tstructFieldList[i] = receiver.structFieldList[i]\n\t}\n\n\treturn structFieldList\n}", "title": "" }, { "docid": "fbe79d780e725dd7da106d712ada0662", "score": "0.45598638", "text": "func (lq *LogexportQuery) Order(o ...OrderFunc) *LogexportQuery {\n\tlq.order = append(lq.order, o...)\n\treturn lq\n}", "title": "" }, { "docid": "28f92e2be51dad3143f1e6f1a04876d1", "score": "0.45590937", "text": "func (u *MessagesUpdateDialogFiltersOrderRequest) GetOrder() (value []int) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Order\n}", "title": "" }, { "docid": "bf4b2cdf37433d393e457099303acd35", "score": "0.45541823", "text": "func (x *SearchDataItemsRequest) GetOrderBy() string {\n\tif x != nil {\n\t\treturn x.OrderBy\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "088736b04442710ad6618432c8e7e44e", "score": "0.45513165", "text": "func (s GetPhoneNumberOrderOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.PhoneNumberOrder != nil {\n\t\tv := s.PhoneNumberOrder\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"PhoneNumberOrder\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e83b6ef7e0d699faa11ae87714d10e0", "score": "0.45497566", "text": "func (m *WorkOrderTypeMutation) Fields() []string {\n\tfields := make([]string, 0, 4)\n\tif m.create_time != nil {\n\t\tfields = append(fields, workordertype.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, workordertype.FieldUpdateTime)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, workordertype.FieldName)\n\t}\n\tif m.description != nil {\n\t\tfields = append(fields, workordertype.FieldDescription)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1f76e28776629245c48c28b9b42a6974", "score": "0.4546146", "text": "func (m *PetMutation) Fields() []string {\n\tfields := make([]string, 0, 7)\n\tif m.created_at != nil {\n\t\tfields = append(fields, pet.FieldCreatedAt)\n\t}\n\tif m.updated_at != nil {\n\t\tfields = append(fields, pet.FieldUpdatedAt)\n\t}\n\tif m.removed_at != nil {\n\t\tfields = append(fields, pet.FieldRemovedAt)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, pet.FieldName)\n\t}\n\tif m.species != nil {\n\t\tfields = append(fields, pet.FieldSpecies)\n\t}\n\tif m.birth_date != nil {\n\t\tfields = append(fields, pet.FieldBirthDate)\n\t}\n\tif m.details != nil {\n\t\tfields = append(fields, pet.FieldDetails)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "3516b38612cf99d0daa10491366a8283", "score": "0.4544544", "text": "func (ut UserType) FieldNameList() []string {\n\tnamesList := make([]string, len(ut.fields))\n\tfor i, field := range ut.fields {\n\t\tnamesList[i] = field.ident.name\n\t}\n\treturn namesList\n}", "title": "" }, { "docid": "efe5d082030efb8b4a6d6ff358e19642", "score": "0.4539941", "text": "func (p *Parser) parseSortFields() (SortFields, error) {\n\tvar fields SortFields\n\n\ttok, pos, lit := p.scanIgnoreWhitespace()\n\n\tswitch tok {\n\t// The first field after an order by may not have a field name (e.g. ORDER BY ASC)\n\tcase ASC, DESC:\n\t\tfields = append(fields, &SortField{Ascending: (tok == ASC)})\n\t// If it's a token, parse it as a sort field. At least one is required.\n\tcase IDENT:\n\t\tp.unscan()\n\t\tfield, err := p.parseSortField()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfields = append(fields, field)\n\t// Parse error...\n\tdefault:\n\t\treturn nil, newParseError(tokstr(tok, lit), []string{\"identifier\", \"ASC\", \"DESC\"}, pos)\n\t}\n\n\t// Parse additional fields.\n\tfor {\n\t\ttok, _, _ := p.scanIgnoreWhitespace()\n\n\t\tif tok != COMMA {\n\t\t\tp.unscan()\n\t\t\tbreak\n\t\t}\n\n\t\tfield, err := p.parseSortField()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfields = append(fields, field)\n\t}\n\n\treturn fields, nil\n}", "title": "" }, { "docid": "64005449b5a789138295d9b17b592e61", "score": "0.45359004", "text": "func IndexedFields() []string {\n\tout := make([]string, 0, len(indexedFields))\n\tfor k := range indexedFields {\n\t\tout = append(out, k)\n\t}\n\treturn out\n}", "title": "" }, { "docid": "3db33e59bb32ba828c119e400c806e57", "score": "0.45339957", "text": "func (rq *RightoftreatmentQuery) Order(o ...OrderFunc) *RightoftreatmentQuery {\n\trq.order = append(rq.order, o...)\n\treturn rq\n}", "title": "" }, { "docid": "b2df470895da195c03ba50ac7a1e13c9", "score": "0.4533069", "text": "func (params *ListParams) getOrderByString(sortingParam *SortingListParameter) (string, error) {\n\tif custom := params.getCustomSorting(sortingParam.Field); custom != nil {\n\t\treturn custom.Func(sortingParam.Direction, params)\n\t}\n\ttransformName := params.transformName(sortingParam.Field)\n\tif len(strings.Split(transformName, sqlTableFieldDelimiter)) == 1 {\n\t\ttransformName = params.addTablePrefix(transformName)\n\t}\n\n\treturn fmt.Sprintf(\"%s %s\", transformName, sortingParam.Direction), nil\n}", "title": "" }, { "docid": "7d169df4c967aa33d21514f30c951fa4", "score": "0.45321646", "text": "func (ulq *UserLoginQuery) Order(o ...userlogin.OrderOption) *UserLoginQuery {\n\tulq.order = append(ulq.order, o...)\n\treturn ulq\n}", "title": "" }, { "docid": "515766583e21f687f1d51ef38df31f64", "score": "0.45280623", "text": "func (Orderproduct) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.Time(\"addedtime\"),\n\t\tfield.Int(\"stock\").Positive(),\n\t\tfield.String(\"shipment\").NotEmpty(),\n\t\tfield.String(\"detail\").NotEmpty(),\n\t}\n}", "title": "" }, { "docid": "9db3cdd4edbe797cf0ead4ec89e36167", "score": "0.45197353", "text": "func getFields(fm fieldmap, columns []string) ([]int, error) {\n\tvar num int\n\tvar ok bool\n\tfields := make([]int, len(columns))\n\tfor i, name := range columns {\n\t\t// find that name in the struct\n\t\tnum, ok = fm[name]\n\t\tif !ok {\n\t\t\tfmt.Println(fm)\n\t\t\treturn fields, errors.New(\"Could not find name \" + name + \" in interface\")\n\t\t}\n\t\tfields[i] = num\n\t}\n\treturn fields, nil\n}", "title": "" }, { "docid": "70e9a2fb2ebf2c73e70183b9f0e670a7", "score": "0.4516156", "text": "func GetListVirtualNodesSortOrderEnumValues() []ListVirtualNodesSortOrderEnum {\n\tvalues := make([]ListVirtualNodesSortOrderEnum, 0)\n\tfor _, v := range mappingListVirtualNodesSortOrderEnum {\n\t\tvalues = append(values, v)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "27a97b5da09c4394810a2bd49525bfce", "score": "0.45159042", "text": "func (m *PaytypeMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.paytype != nil {\n\t\tfields = append(fields, paytype.FieldPaytype)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "10e84157aeb4c047108b663584cfcbd6", "score": "0.45135874", "text": "func (params *ListParams) GetOrderByString() string {\n\torderByParts := make([]string, 0)\n\n\tfor _, sorting := range params.Sortings {\n\t\tif orderPart, err := params.getOrderByString(&sorting); err != nil {\n\t\t} else {\n\t\t\torderByParts = append(orderByParts, orderPart)\n\t\t}\n\t}\n\treturn strings.Join(orderByParts, \",\")\n}", "title": "" }, { "docid": "7b8d87d54755446d73cadea62264f7a9", "score": "0.4505429", "text": "func (pq *PCQuery) Order(o ...pc.OrderOption) *PCQuery {\n\tpq.order = append(pq.order, o...)\n\treturn pq\n}", "title": "" }, { "docid": "df9e64bfb5a7de0305b6973c1418e324", "score": "0.4500239", "text": "func (pq *PhysicaltherapyroomQuery) Order(o ...OrderFunc) *PhysicaltherapyroomQuery {\n\tpq.order = append(pq.order, o...)\n\treturn pq\n}", "title": "" }, { "docid": "eae230822e083b8da7fadeab02d6d7b7", "score": "0.44961745", "text": "func GetStructFields(type_ reflect.Type) []reflect.StructField {\n\tif v, ok := structFieldsCache.Load(type_); ok {\n\t\treturn v.([]reflect.StructField)\n\t}\n\n\tvar structFields []reflect.StructField\n\tfields := type_.NumField()\n\tfor index := 0; index < fields; index++ {\n\t\tstructField := type_.Field(index)\n\t\tif structField.Anonymous && (structField.Type.Kind() == reflect.Ptr) {\n\t\t\tfor _, structField = range GetStructFields(structField.Type.Elem()) {\n\t\t\t\tstructFields = appendStructField(structFields, structField)\n\t\t\t}\n\t\t} else {\n\t\t\tstructFields = appendStructField(structFields, structField)\n\t\t}\n\t}\n\n\tstructFieldsCache.Store(type_, structFields)\n\n\treturn structFields\n}", "title": "" }, { "docid": "f761e6edd9f540bcaa9e63814c8da86d", "score": "0.4494111", "text": "func (g *GoModel) Fields() []Field {\n\tgmFs := g.GothicModel.Fields()\n\tggFs := make([]Field, 0, g.Struct.FieldCount())\n\tfor _, f := range gmFs {\n\t\tkind, ok := Types[f.Type()]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tggFs = append(ggFs, Field{\n\t\t\tbase: f,\n\t\t\tkind: kind,\n\t\t})\n\t}\n\treturn ggFs\n}", "title": "" }, { "docid": "3ca554b88adb7ff253735b81fdb71249", "score": "0.44937053", "text": "func (o PartitionStorageDescriptorSortColumnOutput) SortOrder() pulumi.IntOutput {\n\treturn o.ApplyT(func(v PartitionStorageDescriptorSortColumn) int { return v.SortOrder }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "607996f39721bcd67a85e5daabdae4b0", "score": "0.44883797", "text": "func (q *Query) Order(fieldName string) *Query {\n\tif q.order.fieldName != \"\" {\n\t\t// TODO: allow secondary sort orders?\n\t\tq.setErrorIfNone(errors.New(\"zoom: error in Query.Order: previous order already specified. Only one order per query is allowed.\"))\n\t}\n\tvar ot orderType\n\tif strings.HasPrefix(fieldName, \"-\") {\n\t\tot = descending\n\t\t// remove the \"-\" prefix\n\t\tfieldName = fieldName[1:]\n\t} else {\n\t\tot = ascending\n\t}\n\tif _, found := q.modelSpec.field(fieldName); found {\n\t\tindexType, found := q.modelSpec.indexTypeForField(fieldName)\n\t\tif !found {\n\t\t\t// the field was not indexed\n\t\t\t// TODO: add support for ordering unindexed fields in some cases?\n\t\t\terr := fmt.Errorf(\"zoom: error in Query.Order: field %s in type %s is not indexed. Can only order by indexed fields\", fieldName, q.modelSpec.modelType.String())\n\t\t\tq.setErrorIfNone(err)\n\t\t}\n\t\tredisName, _ := q.modelSpec.redisNameForFieldName(fieldName)\n\t\tq.order = order{\n\t\t\tfieldName: fieldName,\n\t\t\tredisName: redisName,\n\t\t\torderType: ot,\n\t\t\tindexType: indexType,\n\t\t\tindexed: true,\n\t\t}\n\t} else {\n\t\t// fieldName was invalid\n\t\terr := fmt.Errorf(\"zoom: error in Query.Order: could not find field %s in type %s\", fieldName, q.modelSpec.modelType.String())\n\t\tq.setErrorIfNone(err)\n\t}\n\n\treturn q\n}", "title": "" }, { "docid": "46db02d1cd8302cfdb95c1eb681c8d8a", "score": "0.44863582", "text": "func (OperatingSystem) Fields() []ent.Field {\n\treturn []ent.Field{}\n}", "title": "" }, { "docid": "e468455a3c9e717a72606869f411b50a", "score": "0.4483912", "text": "func (f *File) addPivotPageFields(pt *xlsxPivotTableDefinition, opts *PivotTableOptions) error {\n\t// page fields\n\tpageFieldsIndex, err := f.getPivotFieldsIndex(opts.Filter, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpageFieldsName := f.getPivotTableFieldsName(opts.Filter)\n\tfor idx, pageField := range pageFieldsIndex {\n\t\tif pt.PageFields == nil {\n\t\t\tpt.PageFields = &xlsxPageFields{}\n\t\t}\n\t\tpt.PageFields.PageField = append(pt.PageFields.PageField, &xlsxPageField{\n\t\t\tName: pageFieldsName[idx],\n\t\t\tFld: pageField,\n\t\t})\n\t}\n\n\t// count page fields\n\tif pt.PageFields != nil {\n\t\tpt.PageFields.Count = len(pt.PageFields.PageField)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "975c266c5796bdcd90eb8b746855d3af", "score": "0.44817966", "text": "func (o *ChangeWidgetRequest) GetOrderBy() WidgetOrderBy {\n\tif o == nil || o.OrderBy == nil {\n\t\tvar ret WidgetOrderBy\n\t\treturn ret\n\t}\n\treturn *o.OrderBy\n}", "title": "" }, { "docid": "780a8356da582d1b69a296a629187674", "score": "0.44715452", "text": "func (o TableSchemaPtrOutput) Fields() TableFieldSchemaArrayOutput {\n\treturn o.ApplyT(func(v *TableSchema) []TableFieldSchema {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Fields\n\t}).(TableFieldSchemaArrayOutput)\n}", "title": "" }, { "docid": "c3f4d33f6fac3370bb8368ed46b7baed", "score": "0.4463335", "text": "func (qss querySpecs) Fields() []string {\n\tfields := make([]string, 0)\n\tfor _, qs := range qss {\n\t\tfields = append(fields, qs.field)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "ad1b13546709bf5d14ce016a1f19d885", "score": "0.44630596", "text": "func (eq *EmpQuery) Order(o ...OrderFunc) *EmpQuery {\n\teq.order = append(eq.order, o...)\n\treturn eq\n}", "title": "" }, { "docid": "b6816f96ba7a6c8a9dffd26ef5b2a22e", "score": "0.44568828", "text": "func (m *PropertyTypeMutation) Fields() []string {\n\tfields := make([]string, 0, 20)\n\tif m.create_time != nil {\n\t\tfields = append(fields, propertytype.FieldCreateTime)\n\t}\n\tif m.update_time != nil {\n\t\tfields = append(fields, propertytype.FieldUpdateTime)\n\t}\n\tif m._type != nil {\n\t\tfields = append(fields, propertytype.FieldType)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, propertytype.FieldName)\n\t}\n\tif m.external_id != nil {\n\t\tfields = append(fields, propertytype.FieldExternalID)\n\t}\n\tif m.index != nil {\n\t\tfields = append(fields, propertytype.FieldIndex)\n\t}\n\tif m.category != nil {\n\t\tfields = append(fields, propertytype.FieldCategory)\n\t}\n\tif m.int_val != nil {\n\t\tfields = append(fields, propertytype.FieldIntVal)\n\t}\n\tif m.bool_val != nil {\n\t\tfields = append(fields, propertytype.FieldBoolVal)\n\t}\n\tif m.float_val != nil {\n\t\tfields = append(fields, propertytype.FieldFloatVal)\n\t}\n\tif m.latitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLatitudeVal)\n\t}\n\tif m.longitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLongitudeVal)\n\t}\n\tif m.string_val != nil {\n\t\tfields = append(fields, propertytype.FieldStringVal)\n\t}\n\tif m.range_from_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeFromVal)\n\t}\n\tif m.range_to_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeToVal)\n\t}\n\tif m.is_instance_property != nil {\n\t\tfields = append(fields, propertytype.FieldIsInstanceProperty)\n\t}\n\tif m.editable != nil {\n\t\tfields = append(fields, propertytype.FieldEditable)\n\t}\n\tif m.mandatory != nil {\n\t\tfields = append(fields, propertytype.FieldMandatory)\n\t}\n\tif m.deleted != nil {\n\t\tfields = append(fields, propertytype.FieldDeleted)\n\t}\n\tif m.nodeType != nil {\n\t\tfields = append(fields, propertytype.FieldNodeType)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "1c08e1b27f0e4557dc3fdf19c326a749", "score": "0.4450938", "text": "func (m *PropertyTypeMutation) AddedFields() []string {\n\tvar fields []string\n\tif m.addindex != nil {\n\t\tfields = append(fields, propertytype.FieldIndex)\n\t}\n\tif m.addint_val != nil {\n\t\tfields = append(fields, propertytype.FieldIntVal)\n\t}\n\tif m.addfloat_val != nil {\n\t\tfields = append(fields, propertytype.FieldFloatVal)\n\t}\n\tif m.addlatitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLatitudeVal)\n\t}\n\tif m.addlongitude_val != nil {\n\t\tfields = append(fields, propertytype.FieldLongitudeVal)\n\t}\n\tif m.addrange_from_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeFromVal)\n\t}\n\tif m.addrange_to_val != nil {\n\t\tfields = append(fields, propertytype.FieldRangeToVal)\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "c9bdcc3509b6a3ea2f16b0dcaa575d34", "score": "0.4447633", "text": "func SortSliceByField(list interface{}, field string, compare func(interface{}, interface{}) bool) {\n\tlistValue := reflect.ValueOf(list)\n\tsort.SliceStable(list, func(i, j int) bool {\n\t\tfield1 := listValue.Index(i).Elem().FieldByName(field).Interface()\n\t\tfield2 := listValue.Index(j).Elem().FieldByName(field).Interface()\n\t\treturn compare(field1, field2)\n\t})\n}", "title": "" } ]
3622ce328e177677ca2eab4b7e898fef
TestHTTPResp is a helper function to process a request and test its response
[ { "docid": "84020d21a70bc88cee949e954c00a61a", "score": "0.77181", "text": "func TestHTTPResp(t *testing.T, r *gin.Engine, req *http.Request, f func(rr *httptest.ResponseRecorder) bool) {\n\t// Create a response recorder\n\trecorder := httptest.NewRecorder()\n\n\t// Create the service and process the above request.\n\tr.ServeHTTP(recorder, req)\n\n\tif !f(recorder) {\n\t\tt.Fail()\n\t}\n}", "title": "" } ]
[ { "docid": "e9f7745ca3ff9f91cedf1b83fcd96c23", "score": "0.7013709", "text": "func testHTTPResponse(t *testing.T, r *gin.Engine, req *http.Request, f func(w *httptest.ResponseRecorder) bool) {\n\n\t// Create a response recorder\n\tw := httptest.NewRecorder()\n\n\t// Create the service and process the above request.\n\tr.ServeHTTP(w, req)\n\n\tif !f(w) {\n\t\tt.Fail()\n\t}\n}", "title": "" }, { "docid": "5081b29548d28eae28a4cd9c170f3bbe", "score": "0.6860279", "text": "func TestCheckHTTPResponse(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tgotResp *http.Response\n\t\twantResp testutil.HTTPResponse\n\t\twantDiff string\n\t}{\n\t\t{\n\t\t\tname: \"responses not equal\",\n\t\t\tgotResp: &http.Response{\n\t\t\t\tStatusCode: 101,\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"some value\"},\n\t\t\t\t\t\"Header2\": {\"some other value\"},\n\t\t\t\t},\n\t\t\t\tBody: ioutil.NopCloser(strings.NewReader(\"hello buddy!\")),\n\t\t\t},\n\t\t\twantResp: testutil.HTTPResponse{\n\t\t\t\tStatusCode: 200,\n\t\t\t\tHeader: http.Header{\"Header1\": {\"a different value\"}},\n\t\t\t\tBody: \"hello buddy-ol-pal!\",\n\t\t\t},\n\t\t\twantDiff: `response does not match what is expected:\ngot status code 101, want 200\nheader \"Header1\" got value \"some value\", want \"a different value\"\nbody is not expected, strings differ at index 11, from that index on:\n##### got string #####\n!\n##### want string #####\n-ol-pal!`,\n\t\t},\n\t\t{\n\t\t\tname: \"responses equal\",\n\t\t\tgotResp: &http.Response{\n\t\t\t\tStatusCode: 200,\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"a different value\"},\n\t\t\t\t\t\"Header2\": {\"some other value\"},\n\t\t\t\t},\n\t\t\t\tBody: ioutil.NopCloser(strings.NewReader(\"hello buddy-ol-pal!\")),\n\t\t\t},\n\t\t\twantResp: testutil.HTTPResponse{\n\t\t\t\tStatusCode: 200,\n\t\t\t\tHeader: http.Header{\"Header1\": {\"a different value\"}},\n\t\t\t\tBody: \"hello buddy-ol-pal!\",\n\t\t\t},\n\t\t\twantDiff: \"\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tif diff := testutil.CompareStrings(testutil.CheckHTTPResponse(test.gotResp, test.wantResp), test.wantDiff); diff != \"\" {\n\t\t\t\tt.Error(diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b6b0580789d551d36408c65c2c555772", "score": "0.67689216", "text": "func (ah *AssertHTTP) httpResponse(t testing.TB, r *http.Request, wantCode int, want ...string) func() (bool, error) {\n\tt.Helper()\n\tlogger := GetLoggerFromT()\n\n\treturn func() (bool, error) {\n\t\tt.Logf(\"Sending HTTP Request %s %s\", r.Method, r.URL.String())\n\t\tgot, err := ah.httpClient.Do(r)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tdefer got.Body.Close()\n\n\t\t// Determine if the request is successful, and if the response indicates\n\t\t// we should attempt a retry.\n\t\tok, retry := httpRetryCondition(got.StatusCode)\n\t\tif ok {\n\t\t\tlogger.Logf(t, \"Successful HTTP Request %s %s\", r.Method, r.URL.String())\n\t\t}\n\n\t\t// e is the wrapped error for all expectation mismatches.\n\t\tvar e error\n\t\tif got.StatusCode != wantCode {\n\t\t\te = errors.Join(e, fmt.Errorf(\"response code: got %d, want %d\", got.StatusCode, wantCode))\n\t\t}\n\n\t\t// No further processing required.\n\t\tif len(want) == 0 {\n\t\t\treturn false, e\n\t\t}\n\n\t\tb, err := io.ReadAll(got.Body)\n\t\tif err != nil {\n\t\t\treturn retry, errors.Join(e, err)\n\t\t}\n\n\t\tif len(b) == 0 {\n\t\t\treturn retry, errors.Join(e, errors.New(\"empty response body\"))\n\t\t}\n\n\t\tout := string(b)\n\t\tvar bodyErr error\n\t\tfor _, fragment := range want {\n\t\t\tif !strings.Contains(out, fragment) {\n\t\t\t\tbodyErr = errors.Join(bodyErr, fmt.Errorf(\"response body does not contain %q\", fragment))\n\t\t\t}\n\t\t}\n\n\t\t// Only log errors and response body once.\n\t\tif bodyErr != nil {\n\t\t\tlogger.Logf(t, \"response output:\")\n\t\t\tlogger.Logf(t, strings.TrimSpace(out))\n\t\t\treturn retry, errors.Join(e, bodyErr)\n\t\t}\n\n\t\treturn retry, e\n\t}\n}", "title": "" }, { "docid": "5efd6ec9e5c6b1c436f004cfc17e9db9", "score": "0.6597721", "text": "func CheckHTTPResponse(gotResp *http.Response, wantResp HTTPResponse) string {\n\tdiffs := []string{}\n\tif got, want := gotResp.StatusCode, wantResp.StatusCode; got != want {\n\t\tdiffs = append(diffs, fmt.Sprintf(\"got status code %d, want %d\", got, want))\n\t}\n\tfor headerName := range wantResp.Header {\n\t\tif got, want := gotResp.Header.Get(headerName), wantResp.Header.Get(headerName); got != want {\n\t\t\tdiffs = append(diffs, fmt.Sprintf(\"header %q got value %q, want %q\", headerName, got, want))\n\t\t}\n\t}\n\tif diff := CompareStrings(MustReadAll(gotResp.Body), wantResp.Body); diff != \"\" {\n\t\tdiffs = append(diffs, \"body is not expected, \"+diff)\n\t}\n\tif len(diffs) > 0 {\n\t\treturn \"response does not match what is expected:\\n\" + strings.Join(diffs, \"\\n\")\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "adf70f7f93ba08e6465955070bc012d0", "score": "0.646634", "text": "func testHTTP(\n\tt *testing.T,\n\tresp, expects interface{},\n\tbodyBytes []byte,\n\tmethod, routeFormat string,\n\trouteFields ...interface{}) {\n\trespBytes, err := httpRequestBuilder{\n\t\tmethod: method,\n\t\troute: fmt.Sprintf(routeFormat, routeFields...),\n\t\tbody: bodyBytes,\n\t}.Test(t)\n\tif err != nil {\n\t\tt.Fatal(errors.Wrap(err, \"cannot make http request\"))\n\t}\n\n\terr = json.Unmarshal(respBytes, &resp)\n\tif err != nil {\n\t\tt.Fatal(errors.Wrapf(err, \"json error, got response: %q\", string(respBytes)))\n\t}\n\n\tif !reflect.DeepEqual(resp, expects) {\n\t\tt.Fatalf(\"Expect: %+v, got %+v\", expects, resp)\n\t}\n}", "title": "" }, { "docid": "0b1889f415360bbae97ebc38a20c1a44", "score": "0.63602823", "text": "func checkResponse(t *testing.T, code int, resp *http.Response) *http.Response {\n\tt.Log(code, resp.StatusCode, resp.Status, http.StatusText(resp.StatusCode))\n\tif resp.StatusCode != code {\n\t\tt.Fatalf(\"wrong code; got:%+v want:%+v\", resp.StatusCode, code)\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "2d38b85881f755b6e2b8cb15c04522a8", "score": "0.63486665", "text": "func (ah *AssertHTTP) AssertResponse(t testing.TB, r *http.Request, wantCode int, want ...string) {\n\tt.Helper()\n\t_, err := ah.httpResponse(t, r, wantCode, want...)()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "33adcf601cbc18d85970f50895796fcc", "score": "0.62665397", "text": "func assertResponse(resp *http.Response, expected builder.APIResponse) (bool, error) {\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Ensure status code is what is expected\n\tif expected.StatusCode != resp.StatusCode {\n\t\treturn false, fmt.Errorf(\"Unexpected status code received\\n\\nExpected:\\n%v\\n\\nActual:\\n%v\\n\\n\", expected.StatusCode, resp.StatusCode)\n\t}\n\n\t// NOTE: There are basically 3 ways for us to compare request body content.\n\t// 1) First is by directly comapring the content bytes to what is stored\n\t// in the `Body` variable in the test.\n\t// 2) Second is by directly comparing JSON content, by comparing the JSON\n\t// provided with what is provided in the HTTP response.\n\t// 3) Third is by only looking at the structure of the returned JSON.\n\t//\n\t// It is important that we only perform one of these three actions as it\n\t// could result in weird behaviour if we do otherwise.\n\n\t// Ensure the bodies are the same only if the expected body is non-empty\n\t// NOTE: Right now we have no way of asserting the response body is empty\n\tif expected.Body != \"\" && expected.Body != string(body) {\n\t\treturn false, fmt.Errorf(\"Mismatching bodies\\n\\nExpected:\\n%v\\n\\nActual:\\n%v\\n\\n\", expected.Body, string(body))\n\t}\n\n\t// Check the structure of the response if TypeOf is present in API Test\n\tif expected.Body == \"\" && expected.TypeOf != nil {\n\t\t// TypeOf will be one of interface{}, map[string]interface{} or string\n\t\tvar actual interface{}\n\n\t\terr = json.Unmarshal(body, &actual)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"received JSON in unexpected format %v\", err)\n\t\t}\n\n\t\tif !assertJSONStructure(actual, *expected.TypeOf) {\n\t\t\treturn false, fmt.Errorf(\"mismatching JSON structure\")\n\t\t}\n\t}\n\n\t// Only assert JSON if defined and body is not\n\tif expected.TypeOf == nil && expected.Body == \"\" && expected.JSON != nil {\n\t\tvar actual interface{}\n\n\t\terr = json.Unmarshal(body, &actual)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"Received unexpected error when unmarshaling JSON %v\", err)\n\t\t}\n\n\t\tif !assertJSON(actual, expected.JSON) {\n\t\t\treturn false, fmt.Errorf(\"Mismatching JSON\")\n\t\t}\n\t}\n\n\t// Ensure headers are what we expect\n\tfor key, value := range expected.Headers {\n\t\tif value != resp.Header.Get(key) {\n\t\t\treturn false, fmt.Errorf(\"Mismatching %v header\\n\\nExpected:\\n%v\\n\\nActual:\\n%v\\n\\n\", key, value, resp.Header.Get(key))\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "55b5d525fe850072ee0729364241009f", "score": "0.61475646", "text": "func sendTestRequest(url string, method string, content []byte) (string, http.Header, string, *http.Response) {\n\tvar req *http.Request\n\tvar err error\n\n\tif content != nil {\n\t\treq, err = http.NewRequest(method, url, bytes.NewBuffer(content))\n\t} else {\n\t\treq, err = http.NewRequest(method, url, nil)\n\t}\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tbodyStr := strings.Trim(string(body), \" \\n\")\n\n\t// Try json decoding first\n\n\tout := bytes.Buffer{}\n\terr = json.Indent(&out, []byte(bodyStr), \"\", \" \")\n\tif err == nil {\n\t\treturn resp.Status, resp.Header, out.String(), resp\n\t}\n\n\t// Just return the body\n\n\treturn resp.Status, resp.Header, bodyStr, resp\n}", "title": "" }, { "docid": "8785f5013fbba602ecaa6088b6ec198f", "score": "0.6105726", "text": "func DoRequestResponse(url string) interface{} {\n fmt.Println(\"==============Request - Response===========\")\n req := fasthttp.AcquireRequest()\n req.SetRequestURI(url)\n res := fasthttp.AcquireResponse()\n err := fasthttp.Do(req, res)\n\tif err != nil {\n\t\tfmt.Printf(\"Client get failed: %s\\n\", err)\n\t}\n\tif res.StatusCode() != fasthttp.StatusOK {\n\t\tfmt.Printf(\"Expected status code %d but got %d\\n\", fasthttp.StatusOK, res.StatusCode())\n\t}\n\tbody := res.Body()\n fmt.Println(\"successful response!\")\n return string(body)\n}", "title": "" }, { "docid": "3e762414f05ff9314cd4c2ab4e9c68bf", "score": "0.6058187", "text": "func testGetHTTP(server *httptest.Server, request string) *http.Response {\n\tresponse, err := http.Get(fmt.Sprintf(\"%s/%s\", server.URL, request))\n\tif err != nil {\n\t\tlog.Fatalf(\"main_test.go: TestGetHTTP(): http.Get() error: %v\", err)\n\t}\n\treturn response\n}", "title": "" }, { "docid": "aacadeff42eb37e0d184307fe6e340f9", "score": "0.60354507", "text": "func checkOK(t *testing.T, resp *http.Response) *http.Response {\n\treturn checkResponse(t, http.StatusOK, resp)\n}", "title": "" }, { "docid": "057e39a285c0e6d977bee897503b560f", "score": "0.5990258", "text": "func (c *_Crawler) CheckTestResponse(ctx context.Context, resp *http.Response) error {\n\tif err := c.Parse(ctx, resp, func(c context.Context, i interface{}) error {\n\t\treturn nil\n\t}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3a44a7657f3051970d948a5631bbfed", "score": "0.5983327", "text": "func testRequest(t *testing.T, handler http.Handler, expCode int, expBody resBodyComparer) {\n\tt.Helper()\n\n\t// Before making request, wait for the background check to execute at least once\n\twaitForBackgroundCheck()\n\n\trec := httptest.NewRecorder()\n\thandler.ServeHTTP(rec, nil)\n\tresp := rec.Result()\n\tassert.Equal(t, expCode, resp.StatusCode)\n\tdefer resp.Body.Close()\n\tdata, err := io.ReadAll(resp.Body)\n\trequire.NoError(t, err)\n\tif expBody != nil {\n\t\texpBody(t, data)\n\t}\n}", "title": "" }, { "docid": "5ab63546911aaadaa2f29dd9e956b335", "score": "0.5966043", "text": "func DoHTTPProbe(req *http.Request, client GetHTTPInterface) (probe.Result, string, error) {\n\turl := req.URL\n\theaders := req.Header\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\t// Convert errors into failures to catch timeouts.\n\t\treturn probe.Failure, err.Error(), nil\n\t}\n\tdefer res.Body.Close()\n\tb, err := utilio.ReadAtMost(res.Body, maxRespBodyLength)\n\tif err != nil {\n\t\tif err == utilio.ErrLimitReached {\n\t\t\tklog.V(4).Infof(\"Non fatal body truncation for %s, Response: %v\", url.String(), *res)\n\t\t} else {\n\t\t\treturn probe.Failure, \"\", err\n\t\t}\n\t}\n\tbody := string(b)\n\tif res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {\n\t\tif res.StatusCode >= http.StatusMultipleChoices { // Redirect\n\t\t\tklog.V(4).Infof(\"Probe terminated redirects for %s, Response: %v\", url.String(), *res)\n\t\t\treturn probe.Warning, fmt.Sprintf(\"Probe terminated redirects, Response body: %v\", body), nil\n\t\t}\n\t\tklog.V(4).Infof(\"Probe succeeded for %s, Response: %v\", url.String(), *res)\n\t\treturn probe.Success, body, nil\n\t}\n\tklog.V(4).Infof(\"Probe failed for %s with request headers %v, response body: %v\", url.String(), headers, body)\n\t// Note: Until https://issue.k8s.io/99425 is addressed, this user-facing failure message must not contain the response body.\n\tfailureMsg := fmt.Sprintf(\"HTTP probe failed with statuscode: %d\", res.StatusCode)\n\treturn probe.Failure, failureMsg, nil\n}", "title": "" }, { "docid": "4d40671892fe3321fa9a4d9fa8be75a0", "score": "0.5928778", "text": "func ParseGetTestResponse(rsp *http.Response) (*GetTestResponse, error) {\n\tbodyBytes, err := io.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetTestResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "b82ef784033957c948c3b505ab2341fb", "score": "0.5906017", "text": "func checkResp(resp *http.Response, err error) (*http.Response, error) {\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tswitch i := resp.StatusCode; {\n\t// Valid request, return the response.\n\tcase i == 200 || i == 201 || i == 202 || i == 204:\n\t\treturn resp, nil\n\t// Invalid request, parse the XML error returned and return it.\n\tcase i == 400 || i == 401 || i == 403 || i == 404 || i == 405 || i == 406 || i == 409 || i == 415 || i == 500 || i == 503 || i == 504:\n\t\treturn nil, parseErr(resp)\n\t// Unhandled response.\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unhandled API response, please report this issue, status code: %s\", resp.Status)\n\t}\n}", "title": "" }, { "docid": "747e132bed1eba42f9afcaff5f7bd6f9", "score": "0.58760345", "text": "func checkSendResponse(t testing.TB, expectedReq customresources.Request, expectedResponse customresources.Response) func(customresources.Request, customresources.Response) error {\n\treturn func(req customresources.Request, response customresources.Response) error {\n\t\tassert.Equal(t, expectedReq, req)\n\t\tassert.Equal(t, expectedResponse, response)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3e69cf82c1fb8696f381f35904fd2182", "score": "0.5869471", "text": "func TestResponseInRequest(t *testing.T) {\n\tdnsProxy := createTestProxy(t, nil)\n\terr := dnsProxy.Start()\n\tassert.Nil(t, err)\n\n\taddr := dnsProxy.Addr(ProtoUDP)\n\tclient := &dns.Client{Net: \"udp\", Timeout: 500 * time.Millisecond}\n\n\treq := createTestMessage()\n\treq.Response = true\n\n\tr, _, err := client.Exchange(req, addr.String())\n\tassert.NotNil(t, err)\n\tassert.Nil(t, r)\n\n\t_ = dnsProxy.Stop()\n}", "title": "" }, { "docid": "1e0ef1a0d60ae25846547ba97153d8e6", "score": "0.5845634", "text": "func (c *Client) processResponse(httpResp *http.Response, req Request) (Result, error) {\n\tdata, err := ioutil.ReadAll(httpResp.Body)\n\thttpResp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif httpResp.StatusCode == http.StatusOK {\n\t\treturn c.processOKResponse(data, req)\n\t}\n\n\treturn nil, c.processNotOKResponse(data, httpResp.StatusCode)\n}", "title": "" }, { "docid": "8e904fd95df3b3cffe6cbc53d3681985", "score": "0.5842312", "text": "func testProxyRequest(t *testing.T, url string, expectedStatus int, expectedBody string) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tt.Fatalf(\"Proxy request failed on '%s': %s\", url, err.Error())\n\t}\n\n\tif resp.StatusCode != expectedStatus {\n\t\tt.Fatalf(\"Response status with url %s does not match expected value. Actual: %d. Expected: %d.\",\n\t\t\turl, resp.StatusCode, expectedStatus)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"Couldn't read response body: %s\", err.Error())\n\t}\n\n\tbodyStr := string(body)\n\tif bodyStr != expectedBody {\n\t\tt.Fatalf(\"Response body does not match expected value. Actual: \\\"%s\\\" Expected: \\\"%s\\\"\",\n\t\t\tbodyStr, expectedBody)\n\t}\n}", "title": "" }, { "docid": "08d9dfc52930539f28b7a2f835cbcda4", "score": "0.58225244", "text": "func MockResponse(w http.ResponseWriter, req *http.Request) {\n\tw.Write([]byte(\"OK\"))\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "4092feebb6cc29b1d2f73bc455ad151a", "score": "0.57439905", "text": "func HTTPStatusCodeMatch(tk urlgetter.TestKeys, ctrl ControlResponse) (out *bool) {\n\tcontrol := ctrl.HTTPRequest.StatusCode\n\tif len(tk.Requests) < 1 {\n\t\treturn // no real status code\n\t}\n\tmeasurement := tk.Requests[0].Response.Code\n\tif control <= 0 {\n\t\treturn // no real status code\n\t}\n\tif measurement <= 0 {\n\t\treturn // no real status code\n\t}\n\tvalue := control == measurement\n\tif value {\n\t\t// if the status codes are equal, they clearly match\n\t\tout = &value\n\t\treturn\n\t}\n\t// This fix is part of Web Connectivity in MK and in Python since\n\t// basically forever; my recollection is that we want to work around\n\t// cases where the test helper is failing(?!). Unlike previous\n\t// implementations, this implementation avoids a false positive\n\t// when both measurement and control statuses are 500.\n\tif control/100 == 5 {\n\t\treturn\n\t}\n\tout = &value\n\treturn\n}", "title": "" }, { "docid": "ba9d93a81a4e16599a8e22750b9ad1f1", "score": "0.5736305", "text": "func (c testHTTPClient) Get(url string) (*http.Response, error) {\n\tresp, ok := testResponse[url]\n\tif ok {\n\t\treturn &http.Response{\n\t\t\tStatus: \"200 OK\",\n\t\t\tStatusCode: 200,\n\t\t\tProto: \"HTTP/1.0\",\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(resp))),\n\t\t}, nil\n\t}\n\treturn nil, errors.New(\"404\")\n}", "title": "" }, { "docid": "f8f065808d6cc0f36abe7db3d178d1e6", "score": "0.57346994", "text": "func runTestGet(t *testing.T, s *Server, textPbPath string, wantRetCode codes.Code, wantRespVal interface{}, useModels []*gnmipb.ModelData) {\n\t// Send request\n\tvar pbPath gnmipb.Path\n\tif err := proto.UnmarshalText(textPbPath, &pbPath); err != nil {\n\t\tt.Fatalf(\"error in unmarshaling path: %v\", err)\n\t}\n\treq := &gnmipb.GetRequest{\n\t\tPath: []*gnmipb.Path{&pbPath},\n\t\tEncoding: gnmipb.Encoding_JSON_IETF,\n\t\tUseModels: useModels,\n\t}\n\tt.Log(\"req:\", req)\n\tresp, err := s.Get(nil, req)\n\tt.Log(\"resp:\", resp)\n\n\t// Check return code\n\tif status.Code(err) != wantRetCode {\n\t\tt.Fatalf(\"got return code %v, want %v\", status.Code(err), wantRetCode)\n\t}\n\n\t// Check response value\n\tvar gotVal interface{}\n\tif resp != nil {\n\t\tnotifs := resp.GetNotification()\n\t\tif len(notifs) != 1 {\n\t\t\tt.Fatalf(\"got %d notifications, want 1\", len(notifs))\n\t\t}\n\t\tupdates := notifs[0].GetUpdate()\n\t\tif len(updates) != 1 {\n\t\t\tt.Fatalf(\"got %d updates in the notification, want 1\", len(updates))\n\t\t}\n\t\tval := updates[0].GetVal()\n\t\tif val == nil {\n\t\t\treturn\n\t\t}\n\t\tif val.GetJsonIetfVal() == nil {\n\t\t\tgotVal, err = value.ToScalar(val)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"got: %v, want a scalar value\", gotVal)\n\t\t\t}\n\t\t} else {\n\t\t\t// Unmarshal json data to gotVal container for comparison\n\t\t\tif err := json.Unmarshal(val.GetJsonIetfVal(), &gotVal); err != nil {\n\t\t\t\tt.Fatalf(\"error in unmarshaling IETF JSON data to json container: %v\", err)\n\t\t\t}\n\t\t\tvar wantJSONStruct interface{}\n\t\t\tif err := json.Unmarshal([]byte(wantRespVal.(string)), &wantJSONStruct); err != nil {\n\t\t\t\tt.Fatalf(\"error in unmarshaling IETF JSON data to json container: %v\", err)\n\t\t\t}\n\t\t\twantRespVal = wantJSONStruct\n\t\t}\n\t}\n\n\tif !reflect.DeepEqual(gotVal, wantRespVal) {\n\t\tt.Errorf(\"got: %v (%T),\\nwant %v (%T)\", gotVal, gotVal, wantRespVal, wantRespVal)\n\t}\n}", "title": "" }, { "docid": "50f65bff87e3938ad2058669e827f8ef", "score": "0.5733728", "text": "func httpGetRespondsWithCode(goTest *testing.T, url string, code int) bool {\n\tstatusCode, _, err := httpClient.HttpGetE(goTest, url)\n\tif err != nil {\n\t\tgoTest.Fatal(err)\n\t}\n\n\treturn statusCode == code\n}", "title": "" }, { "docid": "fd6f776075f344c6b7898be699f2b829", "score": "0.5689426", "text": "func processHTTPResponse(resp *http.Response, err error, holder interface{}) error {\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"API does not respond\"))\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\t// check http return code\n\tif resp.StatusCode != 200 {\n\t\t//bytes, _ := ioutil.ReadAll(resp.Body)\n\t\tlog.Error(\"Bad HTTP return code \", resp.StatusCode)\n\t\treturn fmt.Errorf(\"Bad HTTP return code %d\", resp.StatusCode)\n\t}\n\n\t// Unmarshall response into given struct\n\tif err = json.NewDecoder(resp.Body).Decode(holder); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "803ebf8cf1428bbf933dd7c95cef0e64", "score": "0.5688135", "text": "func httpServerMock(t *testing.T) *httptest.Server {\n\t// Start a local HTTP server\n\th := func(rw http.ResponseWriter, r *http.Request) {\n\t\tt.Logf(\"URL: %v\", r.URL.String())\n\t\tswitch r.URL.Path {\n\t\tcase \"/test_Empty\":\n\t\t\t_, err := rw.Write([]byte(``))\n\t\t\tassert.Nil(t, err)\n\t\tcase \"/test_InvalidJson\":\n\t\t\t_, err := rw.Write([]byte(`Not valid JSON`))\n\t\t\tassert.Nil(t, err)\n\t\tcase \"/test_IntegerResponse\":\n\t\t\t_, err := rw.Write([]byte(`{\"jsonrpc\": \"2.0\", \"result\": 1, \"id\": 0}`))\n\t\t\tassert.Nil(t, err)\n\n\t\tcase \"/test_OneStringParam\":\n\t\t\ttype jsonResponse struct {\n\t\t\t\tMethod, Jsonrpc string\n\t\t\t\tID int\n\t\t\t\tParams map[string]string\n\t\t\t}\n\t\t\tresponse := jsonResponse{}\n\t\t\tif err := json.Unmarshal(streamToByte(t, r.Body),\n\t\t\t\t&response); err != nil {\n\t\t\t\tt.Fatalf(\"Received unvalid JSON: %v\", err)\n\t\t\t}\n\t\t\tif response.Method != \"test1\" {\n\t\t\t\tt.Fatalf(\"Received method %v, expected test1\", response.Method)\n\t\t\t}\n\t\t\tv := response.Params[\"param1\"]\n\t\t\tif v != \"value1\" {\n\t\t\t\tt.Fatalf(\"Received param1 value %v, expected value1\", v)\n\t\t\t}\n\t\t\t_, err := rw.Write([]byte(`{\"jsonrpc\": \"2.0\", \"result\": 1, \"id\": 0}`))\n\t\t\tassert.Nil(t, err)\n\n\t\tcase \"/test_OneIntParam\":\n\t\t\tbody := streamToByte(t, r.Body)\n\t\t\ttype jsonResponse2 struct {\n\t\t\t\tMethod, Jsonrpc string\n\t\t\t\tID int\n\t\t\t\tParams []int\n\t\t\t}\n\t\t\tresponse := jsonResponse2{}\n\t\t\tif err := json.Unmarshal(body, &response); err != nil {\n\t\t\t\tt.Fatalf(\"Received unvalid JSON: %v\", err)\n\t\t\t}\n\t\t\tif response.Method != \"test1\" {\n\t\t\t\tt.Fatalf(\"Received method %v, expected test1\",\n\t\t\t\t\tresponse.Method)\n\t\t\t}\n\t\t\tv := response.Params\n\n\t\t\tif len(v) != 1 || v[0] != 42 {\n\t\t\t\tt.Fatalf(\"Received param1 value %v, expected [42]\", v)\n\t\t\t}\n\t\t\t_, err := rw.Write([]byte(`{\"jsonrpc\": \"2.0\", \"result\": 1, \"id\": 0}`))\n\t\t\tassert.Nil(t, err)\n\n\t\tcase \"/test_ListParam\":\n\t\t\tbody := streamToByte(t, r.Body)\n\t\t\tt.Logf(\"%s\", body)\n\t\t\ttype jsonResponse struct {\n\t\t\t\tMethod, Jsonrpc string\n\t\t\t\tID int\n\t\t\t\tParams []interface{}\n\t\t\t}\n\t\t\tresponse := jsonResponse{}\n\t\t\tif err := json.Unmarshal(body, &response); err != nil {\n\t\t\t\tt.Fatalf(\"Received unvalid JSON: %v\", err)\n\t\t\t}\n\t\t\tv := response.Params\n\t\t\tif int(v[0].(float64)) != 8 || v[1].(string) != \"value2\" {\n\t\t\t\tt.Fatalf(\"Received value %v, expected [8, \\\"value2\\\"]\", v)\n\t\t\t}\n\t\t\t_, err := rw.Write([]byte(`{\"jsonrpc\": \"2.0\", \"result\": 1, \"id\": 0}`))\n\t\t\tassert.Nil(t, err)\n\n\t\tcase \"/test_BasicAuth\":\n\t\t\tuser, pass, ok := r.BasicAuth()\n\t\t\tif !ok || subtle.ConstantTimeCompare([]byte(user),\n\t\t\t\t[]byte(\"user1\")) != 1 ||\n\t\t\t\tsubtle.ConstantTimeCompare([]byte(pass),\n\t\t\t\t\t[]byte(\"pass1\")) != 1 {\n\t\t\t\tt.Fatalf(\"expected true, (%v,%v), got %v,(%v,%v)\",\n\t\t\t\t\tusername, password, ok, user, pass)\n\t\t\t}\n\t\t\t_, err := rw.Write([]byte(`{\"jsonrpc\": \"2.0\", \"result\": 1, \"id\": 0}`))\n\t\t\tassert.Nil(t, err)\n\n\t\tdefault:\n\t\t\tt.Fatalf(\"Unexpected path: %v\", r.URL.Path)\n\t\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\t}\n\t}\n\n\treturn httptest.NewServer(\n\t\thttp.HandlerFunc(h))\n}", "title": "" }, { "docid": "5f087fa48a30c4d434e1cf06476a0adc", "score": "0.5686635", "text": "func ReadHTTPResp(r *http.Response, data interface{}) error {\n\tif r.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"Server responded with %d\", r.StatusCode)\n\t}\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(body, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9c403a50b6c52b37cfd25d71c5b4e3e3", "score": "0.5671719", "text": "func assertHealthIsOk(t *testing.T, httpURL string) {\n\tresp, err := http.Get(httpURL)\n\tif err != nil {\n\t\tt.Fatalf(\"Got error GETing: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tt.Errorf(\"expected status code %d, got %d\", http.StatusOK, resp.StatusCode)\n\t}\n\tbody, readErr := ioutil.ReadAll(resp.Body)\n\tif readErr != nil {\n\t\t// copying the response body did not work\n\t\tt.Fatalf(\"Cannot copy resp: %#v\", readErr)\n\t}\n\tresult := string(body)\n\tif !strings.Contains(result, \"ok\") {\n\t\tt.Errorf(\"expected body contains ok, got %s\", result)\n\t}\n}", "title": "" }, { "docid": "afe8eb7bf32e3578cdcb94a5cfba6ed5", "score": "0.56711626", "text": "func (client *Client) doHttpRequest(c *http.Client, hreq *http.Request, resp interface{}) (*http.Response, error) {\n\n\thresp, err := c.Do(hreq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif client.Debug {\n\t\tlog.Printf(\"%s %s %d\\n\", hreq.Method, hreq.URL.String(), hresp.StatusCode)\n\t\tlog.Printf(\"http url:%#v\", hreq.URL)\n\t\tcontentType := hresp.Header.Get(\"Content-Type\")\n\t\tif contentType == \"application/xml\" || contentType == \"text/xml\" {\n\t\t\tdump, _ := httputil.DumpResponse(hresp, true)\n\t\t\tlog.Printf(\"%s\\n\", dump)\n\t\t} else {\n\t\t\tlog.Printf(\"Response Content-Type: %s\\n\", contentType)\n\t\t}\n\t}\n\tif hresp.StatusCode != 200 && hresp.StatusCode != 204 && hresp.StatusCode != 206 {\n\t\treturn nil, client.buildError(hresp)\n\t}\n\tif resp != nil {\n\t\terr = xml.NewDecoder(hresp.Body).Decode(resp)\n\t\thresp.Body.Close()\n\n\t\tif client.Debug {\n\t\t\tlog.Printf(\"cos> decoded xml into %#v\", resp)\n\t\t}\n\n\t}\n\treturn hresp, err\n}", "title": "" }, { "docid": "c3cf781a5c12d07c211cbff634c77875", "score": "0.56675255", "text": "func (s *AesServer) TestResponse(attemptKey_b *big.Int,\n\twup []byte,\n\tC_i *big.Int,\n) []byte {\n\taesWrapper := AesCBCWrapper{\n\t\tKey: PaddingKey(attemptKey_b.Bytes()),\n\t}\n\tencryptedMsg := aesWrapper.CBC_encrypt(wup)\n\n\tresponse := s.Response(C_i, encryptedMsg)\n\n\treturn response\n}", "title": "" }, { "docid": "ec64c93eb52ba683037778cc20432c2f", "score": "0.56641906", "text": "func verifyResponse(jobstore datastore.Datastore, job *job.Job, r *result) bool {\n\n\tfmt.Printf(\"Response status code: %d\\n\", r.res.StatusCode)\n\tfmt.Printf(\"Expected status code: %d\\n\", job.Response.StatusCode)\n\n\t// check if the status code matches the expected status code\n\tif r.res.StatusCode == job.Response.StatusCode {\n\t\t// if the status codes match, check if the response body matches the expected\n\t\tif bodiesAreEqual(r.res, job.Response.Body) {\n\t\t\tjob.Status = \"passing\"\n\t\t\tjobstore.Update(job.ID, job)\n\t\t\treturn true\n\t\t}\n\t}\n\tjob.Status = \"failing\"\n\tjobstore.Update(job.ID, job)\n\treturn false\n}", "title": "" }, { "docid": "e883a5b1b84edee4c3d95d2d2023c4e2", "score": "0.56512576", "text": "func httpRespToString(resp *http.Response) (string, error) {\n\tif resp == nil || resp.Body == nil {\n\t\treturn \"\", nil\n\t}\n\tstrBuilder := strings.Builder{}\n\tdefer resp.Body.Close()\n\tif resp.ContentLength > 0 {\n\t\tstrBuilder.Grow(int(resp.ContentLength))\n\t}\n\tbytesNum, err := io.Copy(&strBuilder, resp.Body)\n\trespStr := strBuilder.String()\n\tif err != nil {\n\t\trespStrNewLen := len(respStr)\n\t\tif respStrNewLen > 1024 {\n\t\t\trespStrNewLen = 1024\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"HTTP request failed. URL: '%s', Read-ERROR: '%s', HTTP-CODE: '%s', BODY(top): '%s', HTTP-HEADERS: %v, HTTP-BODY-BUFFER-LENGTH: %v\", resp.Request.URL.RequestURI(), err, resp.Status, respStr[:respStrNewLen], resp.Header, bytesNum)\n\t}\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\trespStrNewLen := len(respStr)\n\t\tif respStrNewLen > 1024 {\n\t\t\trespStrNewLen = 1024\n\t\t}\n\t\terr = fmt.Errorf(\"HTTP request failed. URL: '%s', HTTP-ERROR: '%s', BODY: '%s', HTTP-HEADERS: %v, HTTP-BODY-BUFFER-LENGTH: %v\", resp.Request.URL.RequestURI(), resp.Status, respStr[:respStrNewLen], resp.Header, bytesNum)\n\t}\n\n\treturn respStr, err\n}", "title": "" }, { "docid": "193d90fe7d9c321df64ac8cd90de9ad2", "score": "0.5638539", "text": "func assertJSONResponse(t *testing.T, r *http.Response, statusCode int, expectedObj map[string]interface{}) {\n\t// Check status code.\n\tif r.StatusCode != statusCode {\n\t\tt.Fatalf(\"expected status %d, got %d\", statusCode, r.StatusCode)\n\t}\n\n\t// Check Content-Type header.\n\texpectedCT := \"application/json; charset=utf-8\"\n\tct, ok := r.Header[\"Content-Type\"]\n\tif !ok {\n\t\tt.Fatal(\"No Content-Type header found in response\")\n\t}\n\tif len(ct) != 1 {\n\t\tt.Fatalf(\"expected 1 Content-Type header, got %d\", len(ct))\n\t}\n\tif ct[0] != expectedCT {\n\t\tt.Fatalf(\"expected Content-Type \\\"%s\\\", got \\\"%s\\\"\", expectedCT, ct[0])\n\t}\n\n\t// Check body.\n\tvar actualObj map[string]interface{}\n\tif err := json.NewDecoder(r.Body).Decode(&actualObj); err != nil {\n\t\tt.Fatal(errors.Wrap(err, \"Unable to decode response body\"))\n\t}\n\tif !reflect.DeepEqual(expectedObj, actualObj) {\n\t\tfmt.Println(\"Expected:\\n\", expectedObj)\n\t\tfmt.Println(\"Actual:\\n\", actualObj)\n\t\tt.Fatal(\"Unexpected response\")\n\t}\n}", "title": "" }, { "docid": "5a71a3a34b4ff8f0e20d9949ce8ceb59", "score": "0.5637953", "text": "func (r *Reader) HTTPResponse(contentLen int64) error {\n\n\tnum, err := io.ReadAtLeast(r.r, r.buf, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt := time.Now()\n\ta := append([]byte(fmt.Sprintf(\"HTTP/1.0 200 OK\\r\\nServer: Apache\\r\\nDate: %s\\r\\nContent-Type: image/jpeg\\r\\nContent-Length: %d\\r\\nLast-Modified: %s\\r\\nConnection: keep-alive\\r\\nAccept-Ranges: bytes\\r\\n\\r\\n\", t.Format(time.ANSIC), contentLen, t.Format(time.ANSIC))), r.buf[:num]...)\n\n\t// HTTP OK with Body\n\tr.Reciever.tcpLayer = r.Reciever.tcp(r.Sender)\n\tr.Reciever.tcpLayer.ACK = true\n\tr.Reciever.tcpLayer.Ack = r.Sender.Seq\n\tr.Reciever.tcpLayer.Seq = r.Reciever.Seq\n\tr.Reciever.tcpLayer.PSH = true\n\tr.PacketBuf = append(r.PacketBuf, r.Reciever.genTCPPack(a))\n\tr.Reciever.Seq += uint32(len(a))\n\n\t//ACK\n\tr.Sender.tcpLayer = r.Sender.tcp(r.Reciever)\n\tr.Sender.tcpLayer.ACK = true\n\tr.Sender.tcpLayer.Seq = r.Sender.Seq\n\tr.Sender.tcpLayer.Ack = r.Reciever.Seq\n\tr.PacketBuf = append(r.PacketBuf, r.Sender.genTCPPack())\n\treturn nil\n}", "title": "" }, { "docid": "43b4e4759a1fcb83599457557d9f0a04", "score": "0.56318784", "text": "func getResponse(t *testing.T, method, url string, headers map[string]string, body io.Reader) *http.Response {\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor k, v := range headers {\n\t\treq.Header.Set(k, v)\n\t}\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "c9bad9473cf789def2a544bc9022b025", "score": "0.5617607", "text": "func Response(req *http.Request, timeout time.Duration) (*http.Response, error) {\n\treturn doTryRequest(req, timeout, nil)\n}", "title": "" }, { "docid": "4ebf4b820733f7f8517dfe8ae6edebf4", "score": "0.5605503", "text": "func httpResponseStatus(response *http.Response) string {\n\tvar status string\n\tif response.StatusCode == http.StatusBadRequest {\n\t\tbuffer, _ := ioutil.ReadAll(response.Body)\n\t\tlog.Println(string(buffer))\n\t\tstatus = readErrorResponse(string(buffer))\n\t}\n\tif response.StatusCode == http.StatusNotFound {\n\t\tstatus = \"[ Couldn't retrieve the content. 404 Not found. ]\"\n\t}\n\tif response.StatusCode == http.StatusUnauthorized {\n\t\tstatus = \"[ Invalid user login credentials, Please check username OR password ! ]\"\n\t}\n\treturn status\n}", "title": "" }, { "docid": "dafe91ef5d1ed97c00ae9372a8ef3f2e", "score": "0.5605261", "text": "func (c *MockClient) Do(req *http.Request) (*http.Response, error) {\n\ttime.Sleep(10 * time.Millisecond)\n\tkey := fmt.Sprintf(\"%s:%s\", req.Method, req.URL)\n\tmockRes, ok := c.Responses[key]\n\tif !ok {\n\t\terr := fmt.Errorf(\"could not find uri %s\", key)\n\t\treturn nil, httputil.NotFoundError(err)\n\t}\n\n\tif mockRes.Err != nil {\n\t\treturn nil, mockRes.Err\n\t}\n\n\tvar body io.ReadCloser\n\theaders := http.Header{}\n\tif mockRes.Body != nil {\n\t\tbytesBody, err := json.Marshal(mockRes.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbody = ioutil.NopCloser(bytes.NewBuffer(bytesBody))\n\t\theaders.Add(\"Content-Type\", \"application/json\")\n\t} else {\n\t\tbody = http.NoBody\n\t}\n\n\tstatus := http.StatusOK\n\tres := &http.Response{\n\t\tProto: \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tStatus: fmt.Sprintf(\"%d - %s\", status, http.StatusText(status)),\n\t\tStatusCode: status,\n\t\tBody: body,\n\t\tHeader: headers,\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "2b9896e89cb146572786c8eea567bcdb", "score": "0.5600664", "text": "func TestCheckHTTPRequest(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tgotReq *http.Request\n\t\twantReq testutil.HTTPRequest\n\t\twantDiff string\n\t}{\n\t\t{\n\t\t\tname: \"requests not equal\",\n\t\t\tgotReq: &http.Request{\n\t\t\t\tMethod: \"DELETE\",\n\t\t\t\tURL: &url.URL{\n\t\t\t\t\tScheme: \"http\",\n\t\t\t\t\tHost: \"hello.com\",\n\t\t\t\t},\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"some value\"},\n\t\t\t\t\t\"Header2\": {\"some other value\"},\n\t\t\t\t},\n\t\t\t\tBody: ioutil.NopCloser(strings.NewReader(\"hello buddy!\")),\n\t\t\t},\n\t\t\twantReq: testutil.HTTPRequest{\n\t\t\t\tMethod: \"POST\",\n\t\t\t\tURL: \"http://hello-there.com\",\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"a different value\"},\n\t\t\t\t},\n\t\t\t\tBody: \"goodbye buddy!\",\n\t\t\t},\n\t\t\twantDiff: `request does not match what is expected:\nheader \"Header1\" got value \"some value\", want \"a different value\"\ngot method \"DELETE\", want \"POST\"\ngot url:\n \"http://hello.com\"\nwant:\n \"http://hello-there.com\"\nbody is not expected, strings differ at index 0, from that index on:\n##### got string #####\nhello buddy!\n##### want string #####\ngoodbye buddy!`,\n\t\t},\n\t\t{\n\t\t\tname: \"requests equal\",\n\t\t\tgotReq: &http.Request{\n\t\t\t\tMethod: \"POST\",\n\t\t\t\tURL: &url.URL{\n\t\t\t\t\tScheme: \"http\",\n\t\t\t\t\tHost: \"hello.com\",\n\t\t\t\t},\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"a different value\"},\n\t\t\t\t\t\"Header2\": {\"some value\"},\n\t\t\t\t},\n\t\t\t\tBody: ioutil.NopCloser(strings.NewReader(\"hello buddy!\")),\n\t\t\t},\n\t\t\twantReq: testutil.HTTPRequest{\n\t\t\t\tMethod: \"POST\",\n\t\t\t\tURL: \"http://hello.com\",\n\t\t\t\tHeader: http.Header{\n\t\t\t\t\t\"Header1\": {\"a different value\"},\n\t\t\t\t},\n\t\t\t\tBody: \"hello buddy!\",\n\t\t\t},\n\t\t\twantDiff: \"\",\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tif diff := testutil.CompareStrings(testutil.CheckHTTPRequest(test.gotReq, test.wantReq), test.wantDiff); diff != \"\" {\n\t\t\t\tt.Error(\"did not get expected diff\\n\" + diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f19fa96fc2b8c43e0ff68ea6982da2ec", "score": "0.5599599", "text": "func TestPostDataAndReturnResponse(t *testing.T) {\n\tmsg := messageData{Message: \"Testing 123\"}\n\tdata := postDataAndReturnResponse(msg)\n\tif data.Message != \"Testing 123\" {\n\t\tt.Errorf(\"Expected string 'Testing 123' but received: '%s'\", data)\n\t}\n}", "title": "" }, { "docid": "d5a712ca2249f5bc02aeee5e8d95b781", "score": "0.55955803", "text": "func AssertEchoResponse(expected, given response.ServiceResponse, comparer TestDataComparer) error {\n\tif expected.Status.Code != given.Status.Code {\n\t\treturn fmt.Errorf(\"expected status code %d but was %d\", expected.Status.Code, given.Status.Code)\n\t}\n\tif expected.Status.Error != given.Status.Error {\n\t\treturn fmt.Errorf(\"expected status error %v but was %v\", expected.Status.Error, given.Status.Error)\n\t}\n\tif expected.Status.Message != \"\" && expected.Status.Message != given.Status.Message {\n\t\treturn fmt.Errorf(\"expected status message %s but was %s\", expected.Status.Message, given.Status.Message)\n\t}\n\tif expected.Data != nil {\n\t\treturn comparer(expected.Data, given.Data)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "471dceb73f04b25f8c92172cce7ebb1f", "score": "0.5591519", "text": "func TestBuildResponse(t *testing.T) {\n\n\tresp := BuildResponse(\"http://testurl.com\", 200, 15)\n\n\tif resp == \"\" {\n\t\tt.Errorf(\"Received incorrect response\")\n\t}\n\n}", "title": "" }, { "docid": "92c43cc1dcdfd4cf03f07b2069fab67b", "score": "0.5590919", "text": "func CheckResponse(resp *http.Response, logger *log.Entry) error {\n\tdefer resp.Body.Close()\n\t_, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"error reading response body\")\n\t}\n\n\tif resp.StatusCode >= 200 && resp.StatusCode <= 299 {\n\t\tlogger.Debugf(\"Response code: %d\", resp.StatusCode)\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"response status code is %d\", resp.StatusCode)\n}", "title": "" }, { "docid": "ab90708a665c131ebb6a2e87bb0e0d35", "score": "0.5583127", "text": "func (s *Server) TestHTTPRequest(method, path string, header H, body io.Reader) *ResponseRecorder {\n\tw := NewResponseRecorder()\n\treq, _ := http.NewRequest(method, path, body)\n\n\tfor key, val := range header {\n\t\treq.Header.Add(key, val.(string))\n\t}\n\n\ts.ServeHTTP(w, req)\n\treturn w\n}", "title": "" }, { "docid": "0001041c04e4bd766d3989fe494411f0", "score": "0.55746406", "text": "func DoHTTPProbe(url *url.URL, headers http.Header, client GetHTTPInterface) (probe.Result, string, error) {\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\t// Convert errors into failures to catch timeouts.\n\t\treturn probe.Failure, err.Error(), nil\n\t}\n\tif _, ok := headers[\"User-Agent\"]; !ok {\n\t\tif headers == nil {\n\t\t\theaders = http.Header{}\n\t\t}\n\t\t// explicitly set User-Agent so it's not set to default Go value\n\t\tv := version.Get()\n\t\theaders.Set(\"User-Agent\", fmt.Sprintf(\"kube-probe/%s.%s\", v.Major, v.Minor))\n\t}\n\treq.Header = headers\n\tif headers.Get(\"Host\") != \"\" {\n\t\treq.Host = headers.Get(\"Host\")\n\t}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\t// Convert errors into failures to catch timeouts.\n\t\treturn probe.Failure, err.Error(), nil\n\t}\n\tdefer res.Body.Close()\n\tb, err := utilio.ReadAtMost(res.Body, maxRespBodyLength)\n\tif err != nil {\n\t\tif err == utilio.ErrLimitReached {\n\t\t\tprobe.PLog.V(utils.Warn).Info(fmt.Sprintf(\"Non fatal body truncation for %s, Response: %v\", url.String(), *res))\n\t\t} else {\n\t\t\treturn probe.Failure, \"\", err\n\t\t}\n\t}\n\tbody := string(b)\n\tif res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {\n\t\tvar out string\n\t\tdata := ResponseData{}\n\t\terr := json.Unmarshal(b, &data)\n\t\tif err == nil {\n\t\t\tif data.Data != nil {\n\t\t\t\tif _, ok := data.Data.(string); ok {\n\t\t\t\t\tout = strings.ToLower(data.Data.(string))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tprobe.PLog.V(utils.Warn).Info(\"unmarshal error\", \"error\", err)\n\t\t\tout = body\n\t\t}\n\t\tif res.StatusCode >= http.StatusMultipleChoices { // Redirect\n\t\t\tprobe.PLog.V(utils.Warn).Info(fmt.Sprintf(\"Probe terminated redirects for %s, Response: %v\", url.String(), *res))\n\n\t\t\treturn probe.Warning, out, nil\n\t\t}\n\t\tprobe.PLog.V(utils.Info).Info(fmt.Sprintf(\"Probe succeeded for %s, Response: %v\", url.String(), *res))\n\t\treturn probe.Success, out, nil\n\t}\n\tprobe.PLog.V(utils.Warn).Info(fmt.Sprintf(\"Probe failed for %s with request headers %v, response body: %v\", url.String(), headers, body))\n\treturn probe.Failure, fmt.Sprintf(\"HTTP probe failed with statuscode: %d\", res.StatusCode), nil\n}", "title": "" }, { "docid": "e46d41ce47b06ccaa0f0766b576fa932", "score": "0.5565124", "text": "func processHTTPResponse(resp *http.Response, err error, holder interface{}) error {\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check http return code\n\tif resp.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Bad HTTP return code %d\", resp.StatusCode)\n\t}\n\n\t// Unmarshall response into given struct\n\treturn json.NewDecoder(resp.Body).Decode(holder)\n}", "title": "" }, { "docid": "c56d7f31f4031d10b4856c489eb7ae05", "score": "0.55639285", "text": "func Test_GetStatusByTask_4(t *testing.T) {\r\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\r\n\t\tfmt.Fprintln(w, `{\"status\":1,\"msg\":\"List not exist: list_id=5\",\"data\":[]}`)\r\n\t}))\r\n\tdefer ts.Close()\r\n\r\n\t_, err := getVipStatusByTask(ts.URL)\r\n\tif err == nil {\r\n\t\tt.Error(\"should decode error\")\r\n\t}\r\n}", "title": "" }, { "docid": "f573ce3dae990caf411e0784b48c450f", "score": "0.55575144", "text": "func checkResp(resp *http.Response, err error) (*http.Response, error) {\n\t// If the err is already there, there was an error higher\n\t// up the chain, so just return that\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tswitch i := resp.StatusCode; {\n\tcase i == 200:\n\t\treturn resp, nil\n\tcase i == 201:\n\t\treturn resp, nil\n\tcase i == 202:\n\t\treturn resp, nil\n\tcase i == 204:\n\t\treturn resp, nil\n\tcase i == 400:\n\t\treturn nil, parseErr(resp)\n\tcase i == 401:\n\t\treturn nil, parseErr(resp)\n\tcase i == 402:\n\t\treturn nil, parseErr(resp)\n\tcase i == 422:\n\t\treturn nil, parseErr(resp)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"API Error: %s\", resp.Status)\n\t}\n}", "title": "" }, { "docid": "84eac1132e63edeaa72f5c36b1328a6b", "score": "0.55351484", "text": "func (th *testHandler) ServeHTTP(res *http.Response, req *http.Request) {\n\tth.request.method = req.Method\n\n\t// Ignore error because if there is an error it will be caught by body\n\t// comparison in test.\n\tth.request.body, _ = ioutil.ReadAll(req.Body)\n\n\tres.Status = th.response.status\n\tres.Write(th.response.body)\n}", "title": "" }, { "docid": "8ed36072bc0d74fe23035e6055ae9bd1", "score": "0.5532766", "text": "func Test_GetStatus(t *testing.T) {\n\trw := httptest.NewRecorder()\n\tGetStatus(rw)\n\n\texpCode := http.StatusOK\n\texpBody := `{\"status\":\"ok\"}`\n\tassert.Equal(t, rw.Code, expCode, \"GetStatus() returned unexpected status code\")\n\tassert.Equal(t, rw.Body.String(), expBody, \"GetStatus() returned unexpected body\")\n}", "title": "" }, { "docid": "aadb167b560363e60a4db11577658f0f", "score": "0.5527755", "text": "func TestIdentityResponse(t *testing.T) {\n\tsetParallel(t)\n\tdefer afterTest(t)\n\thandler := HandlerFunc(func(rw ResponseWriter, req *Request) {\n\t\trw.Header().Set(\"Content-Length\", \"3\")\n\t\trw.Header().Set(\"Transfer-Encoding\", req.FormValue(\"te\"))\n\t\tswitch {\n\t\tcase req.FormValue(\"overwrite\") == \"1\":\n\t\t\t_, err := rw.Write([]byte(\"foo TOO LONG\"))\n\t\t\tif err != ErrContentLength {\n\t\t\t\tt.Errorf(\"expected ErrContentLength; got %v\", err)\n\t\t\t}\n\t\tcase req.FormValue(\"underwrite\") == \"1\":\n\t\t\trw.Header().Set(\"Content-Length\", \"500\")\n\t\t\trw.Write([]byte(\"too short\"))\n\t\tdefault:\n\t\t\trw.Write([]byte(\"foo\"))\n\t\t}\n\t})\n\n\tts := httptest.NewServer(handler)\n\tdefer ts.Close()\n\n\tc := ts.Client()\n\n\t// Note: this relies on the assumption (which is true) that\n\t// Get sends HTTP/1.1 or greater requests. Otherwise the\n\t// server wouldn't have the choice to send back chunked\n\t// responses.\n\tfor _, te := range []string{\"\", \"identity\"} {\n\t\turl := ts.URL + \"/?te=\" + te\n\t\tres, err := c.Get(url)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error with Get of %s: %v\", url, err)\n\t\t}\n\t\tif cl, expected := res.ContentLength, int64(3); cl != expected {\n\t\t\tt.Errorf(\"for %s expected res.ContentLength of %d; got %d\", url, expected, cl)\n\t\t}\n\t\tif cl, expected := res.Header.Get(\"Content-Length\"), \"3\"; cl != expected {\n\t\t\tt.Errorf(\"for %s expected Content-Length header of %q; got %q\", url, expected, cl)\n\t\t}\n\t\tif tl, expected := len(res.TransferEncoding), 0; tl != expected {\n\t\t\tt.Errorf(\"for %s expected len(res.TransferEncoding) of %d; got %d (%v)\",\n\t\t\t\turl, expected, tl, res.TransferEncoding)\n\t\t}\n\t\tres.Body.Close()\n\t}\n\n\t// Verify that ErrContentLength is returned\n\turl := ts.URL + \"/?overwrite=1\"\n\tres, err := c.Get(url)\n\tif err != nil {\n\t\tt.Fatalf(\"error with Get of %s: %v\", url, err)\n\t}\n\tres.Body.Close()\n\n\t// Verify that the connection is closed when the declared Content-Length\n\t// is larger than what the handler wrote.\n\tconn, err := net.Dial(\"tcp\", ts.Listener.Addr().String())\n\tif err != nil {\n\t\tt.Fatalf(\"error dialing: %v\", err)\n\t}\n\t_, err = conn.Write([]byte(\"GET /?underwrite=1 HTTP/1.1\\r\\nHost: foo\\r\\n\\r\\n\"))\n\tif err != nil {\n\t\tt.Fatalf(\"error writing: %v\", err)\n\t}\n\n\t// The ReadAll will hang for a failing test.\n\tgot, _ := io.ReadAll(conn)\n\texpectedSuffix := \"\\r\\n\\r\\ntoo short\"\n\tif !strings.HasSuffix(string(got), expectedSuffix) {\n\t\tt.Errorf(\"Expected output to end with %q; got response body %q\",\n\t\t\texpectedSuffix, string(got))\n\t}\n}", "title": "" }, { "docid": "9c491f93b8c5783594dee4eb59275d00", "score": "0.5524876", "text": "func (ah *AssertHTTP) AssertResponseWithRetry(t testing.TB, r *http.Request, wantCode int, want ...string) {\n\tt.Helper()\n\tif ah.retryCount == 0 || ah.retryInterval == 0 {\n\t\tah.AssertSuccess(t, r)\n\t\treturn\n\t}\n\n\terr := PollE(t, ah.httpResponse(t, r, wantCode, want...), ah.retryCount, ah.retryInterval)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n}", "title": "" }, { "docid": "b7e43cc4e80cb20ad028efda95ddb5f6", "score": "0.55239993", "text": "func checkResponse(resp *http.Response, err error) ([]byte, error) {\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode == 404 {\n\t\treturn nil, ErrNotFound\n\t}\n\tif (resp.StatusCode / 100) != 2 {\n\t\treturn nil, fmt.Errorf(\"[STATUS CODE - %d]\\t%s\", resp.StatusCode, body)\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "1951dec2866b848b9874cb9ed27eec33", "score": "0.55175453", "text": "func expectHTTPGet(url string, code int) error {\n\tr, err := http.Get(url)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %v\", err)\n\t}\n\tif r.StatusCode != code {\n\t\treturn fmt.Errorf(\"unexpected response: %v\", r.StatusCode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "728d2c43f6833ef5102455d6a6a68186", "score": "0.5516561", "text": "func (t *Tester) exec(req *http.Request, path string) (ret *TestResponse) {\n\tt.addSession(req)\n\n\tclient := &http.Client{\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tret = testResponseFromError(err)\n\t\tret.T = t.T\n\t\tret.Path = path\n\t\tret.Method = req.Method\n\t\treturn\n\t}\n\n\tret = TestResponseFromResponse(res)\n\tret.T = t.T\n\tret.Path = path\n\tret.Method = req.Method\n\n\tt.recoverSession(ret)\n\n\treturn\n}", "title": "" }, { "docid": "278f8932a8d9044d2e5012e2f8a1cfe4", "score": "0.55141157", "text": "func GetLocalHTTPResponse(t *testing.T, rawurl string, timeoutSecsAry ...int) (string, *http.Response, error) {\n\tvar timeoutSecs = 60\n\tif len(timeoutSecsAry) > 0 {\n\t\ttimeoutSecs = timeoutSecsAry[0]\n\t}\n\ttimeoutTime := time.Duration(timeoutSecs) * time.Second\n\tassert := asrt.New(t)\n\n\tu, err := url.Parse(rawurl)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to parse url %s: %v\", rawurl, err)\n\t}\n\tport := u.Port()\n\n\tdockerIP, err := dockerutil.GetDockerIP()\n\tassert.NoError(err)\n\n\tfakeHost := u.Hostname()\n\t// Add the port if there is one.\n\tu.Host = dockerIP\n\tif port != \"\" {\n\t\tu.Host = u.Host + \":\" + port\n\t}\n\tlocalAddress := u.String()\n\n\t// use ServerName: fakeHost to verify basic usage of certificate.\n\t// This technique is from https://stackoverflow.com/a/47169975/215713\n\ttransport := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{ServerName: fakeHost},\n\t}\n\n\t// Do not follow redirects, https://stackoverflow.com/a/38150816/215713\n\tclient := &http.Client{\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t\tTransport: transport,\n\t\tTimeout: timeoutTime,\n\t}\n\n\treq, err := http.NewRequest(\"GET\", localAddress, nil)\n\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"Failed to NewRequest GET %s: %v\", localAddress, err)\n\t}\n\treq.Host = fakeHost\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", resp, err\n\t}\n\n\t//nolint: errcheck\n\tdefer resp.Body.Close()\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", resp, fmt.Errorf(\"unable to ReadAll resp.body: %v\", err)\n\t}\n\tbodyString := string(bodyBytes)\n\tif resp.StatusCode != 200 {\n\t\treturn bodyString, resp, fmt.Errorf(\"http status code for '%s' was %d, not 200\", localAddress, resp.StatusCode)\n\t}\n\treturn bodyString, resp, nil\n}", "title": "" }, { "docid": "ff46513140bdc5f299adacaec3703190", "score": "0.55138934", "text": "func (h *HTTPMonitor) httpCheck() error {\n\tfullURL := h.constructURL()\n\n\th.RMC.Log.WithField(\"fullURL\", fullURL).Debug(\"Performing http check\")\n\n\tresp, err := h.performRequest(h.RMC.Config.HTTPMethod, fullURL, h.RMC.Config.HTTPRequestBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check if StatusCode matches\n\tif resp.StatusCode != h.RMC.Config.HTTPStatusCode {\n\t\treturn fmt.Errorf(\"Received status code '%v' does not match expected status code '%v'\",\n\t\t\tresp.StatusCode, h.RMC.Config.HTTPStatusCode)\n\t}\n\n\t// If Expect is set, verify if returned response contains expected data\n\tif h.RMC.Config.Expect != \"\" {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Unable to read response body to perform content expectancy check: %v\", err.Error())\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif !strings.Contains(string(data), h.RMC.Config.Expect) {\n\t\t\treturn fmt.Errorf(\"Received response body '%v' does not contain expected content '%v'\",\n\t\t\t\tstring(data), h.RMC.Config.Expect)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "81106d9d361e8991f97e981e3a4cce7d", "score": "0.55126095", "text": "func getResponse(r *http.Request) ([]byte, error) {\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 30,\n\t}\n\tresp, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif _, ok := resp.Header[\"X-Error-Code\"]; ok {\n\t\treturn nil, errors.New(resp.Header.Get(\"X-Error-Message\"))\n\t}\n\n\tb, _ := ioutil.ReadAll(resp.Body)\n\treturn b, nil\n}", "title": "" }, { "docid": "d89b2745b26b77814141db4d069da149", "score": "0.5510192", "text": "func checkResponseCode(t *testing.T, expected, actual int) {\n\t// if response status is equal to tested status then ok\n\tif expected != actual {\n\t\tt.Errorf(\"Expected response code %d. Got %d\\n\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "c0b1bdbd34b0a045ec42533fe139360d", "score": "0.5508323", "text": "func (cl *RestClient) CheckResponse(m string) {\n\tresp, err := restGet(\"Room\", cl.client, cl.ip, cl.port)\n\tif err != nil {\n\t\tcl.test.Errorf(\"Error with restGet: %v\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\tcl.test.Errorf(\"Rest CheckResponse() rest GET got %v want 200\", resp.StatusCode)\n\t}\n\tdec := json.NewDecoder(resp.Body)\n\tvar messages []string\n\terr = dec.Decode(&messages)\n\tif err != nil {\n\t\tcl.test.Errorf(\"Error decoding in Rest CheckResponse: %v\", err)\n\t}\n\tresp.Body.Close()\n\tfor _, mg := range messages {\n\t\tcl.messages = append(cl.messages, mg)\n\t}\n\tnewMessage := RemoveTime(cl.messages[0])\n\tcl.messages = cl.messages[1:]\n\tif newMessage != m {\n\t\tcl.test.Errorf(\"Rest CheckResponse() got %v want %v Client:%v Room:%v\", newMessage, m,cl.name, cl.room)\n\t}\n}", "title": "" }, { "docid": "71c69183e91377012853759b61e3f85d", "score": "0.5504417", "text": "func checkContent(t *testing.T, response *httptest.ResponseRecorder, content string) {\n\n\tbody, _ := ioutil.ReadAll(response.Body)\n\tif string(body) != content {\n\t\tt.Fatalf(\"Non-expected content %s, expected %s\", string(body), content)\n\t}\n}", "title": "" }, { "docid": "71c69183e91377012853759b61e3f85d", "score": "0.5504417", "text": "func checkContent(t *testing.T, response *httptest.ResponseRecorder, content string) {\n\n\tbody, _ := ioutil.ReadAll(response.Body)\n\tif string(body) != content {\n\t\tt.Fatalf(\"Non-expected content %s, expected %s\", string(body), content)\n\t}\n}", "title": "" }, { "docid": "3dcf53964903abba2a9b0ae156c9e833", "score": "0.549891", "text": "func testGetStats() bool {\n\n\t/*\n\t** Wait five second prior to sending the GET request\n\t */\n\ttime.Sleep(5000 * time.Millisecond)\n\n\tlog.Println(\"Starting GET /stats testGetStats\")\n\tresp, err := http.Get(\"http://localhost:8080/stats\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tlog.Println(string(body))\n\n\tif strings.Contains(string(body), MultipleStatsResponse) {\n\t\tlog.Printf(\"GET /stats testGetStats test passed\\n\\n\")\n\t\treturn true\n\t} else {\n\t\tlog.Printf(\"GET /stats testGetStats test failed.\\n Expected: %s\\n\", SingleStatsResponse)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "47649e63c102d0c2334fc53abedbff6b", "score": "0.54943943", "text": "func getResponse(url string) *http.Response {\n tr := new(http.Transport)\n client := &http.Client{Transport: tr}\n resp, err := client.Get(url)\n errorChecker(err)\n return resp\n}", "title": "" }, { "docid": "905614cd6b8d3e29a201fdb6d24e01fa", "score": "0.54827225", "text": "func runTestGet(t *testing.T, s *Server, textPbPath string, wantRetCode codes.Code, wantRespVal interface{}, useModels []*pb.ModelData) {\n\t// Send request\n\tvar pbPath pb.Path\n\tif err := proto.UnmarshalText(textPbPath, &pbPath); err != nil {\n\t\tt.Fatalf(\"error in unmarshaling path: %v\", err)\n\t}\n\treq := &pb.GetRequest{\n\t\tPath: []*pb.Path{&pbPath},\n\t\tEncoding: pb.Encoding_JSON_IETF,\n\t\tUseModels: useModels,\n\t}\n\tresp, err := s.Get(nil, req)\n\n\t// Check return code\n\tgotRetStatus, ok := status.FromError(err)\n\tif !ok {\n\t\tt.Fatal(\"got a non-grpc error from grpc call\")\n\t}\n\tif gotRetStatus.Code() != wantRetCode {\n\t\tt.Fatalf(\"got return code %v, want %v\", gotRetStatus.Code(), wantRetCode)\n\t}\n\n\t// Check response value\n\tvar gotVal interface{}\n\tif resp != nil {\n\t\tnotifs := resp.GetNotification()\n\t\tif len(notifs) != 1 {\n\t\t\tt.Fatalf(\"got %d notifications, want 1\", len(notifs))\n\t\t}\n\t\tupdates := notifs[0].GetUpdate()\n\t\tif len(updates) != 1 {\n\t\t\tt.Fatalf(\"got %d updates in the notification, want 1\", len(updates))\n\t\t}\n\t\tval := updates[0].GetVal()\n\t\tif val.GetJsonIetfVal() == nil {\n\t\t\tgotVal, err = value.ToScalar(val)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"got: %v, want a scalar value\", gotVal)\n\t\t\t}\n\t\t} else {\n\t\t\t// Unmarshal json data to gotVal container for comparison\n\t\t\tif err := json.Unmarshal(val.GetJsonIetfVal(), &gotVal); err != nil {\n\t\t\t\tt.Fatalf(\"error in unmarshaling IETF JSON data to json container: %v\", err)\n\t\t\t}\n\t\t\tvar wantJSONStruct interface{}\n\t\t\tif err := json.Unmarshal([]byte(wantRespVal.(string)), &wantJSONStruct); err != nil {\n\t\t\t\tt.Fatalf(\"error in unmarshaling IETF JSON data to json container: %v\", err)\n\t\t\t}\n\t\t\twantRespVal = wantJSONStruct\n\t\t}\n\t}\n\n\tif !reflect.DeepEqual(gotVal, wantRespVal) {\n\t\tt.Errorf(\"got: %v (%T),\\nwant %v (%T)\", gotVal, gotVal, wantRespVal, wantRespVal)\n\t}\n}", "title": "" }, { "docid": "cf181dd318801938a4bb85072e7c7cd2", "score": "0.54738265", "text": "func httpCheck(url string, Headers *[]HTTPHeader) (int, string) {\n\tcode := 0\n\n\tvar netTransport = &http.Transport{\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: 2 * time.Second,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: 2 * time.Second,\n\t}\n\tvar netClient = &http.Client{\n\t\tTimeout: time.Second * 2,\n\t\tTransport: netTransport,\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn 0, \"\"\n\t}\n\tfor _, h := range *Headers {\n\t\treq.Header.Add(h.Name, h.Value)\n\t}\n\tresp, err := netClient.Do(req)\n\tif err != nil {\n\t\treturn 0, \"\"\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode > 0 {\n\t\tcode = resp.StatusCode\n\t}\n\tif code != http.StatusOK {\n\t\treturn code, \"\"\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn code, \"\"\n\t}\n\n\tinfoString := maxString(string(body), 128, true)\n\treturn code, infoString\n}", "title": "" }, { "docid": "fe3266989943125bad9b26f76d84ad0e", "score": "0.5466198", "text": "func (c *Client) Do(t TestingTB, req *Request, expectedStatusCode int) *Response {\n\tstatus, headers, body, err := dumpRequest(req.Request)\n\tif err != nil {\n\t\tt.Fatalf(\"can't dump request: %s\", err)\n\t}\n\n\tcolorF := func(b []byte) string { return color.BlueString(string(b)) }\n\tif *vF {\n\t\tt.Logf(\"\\n%s\\n%s\\n\\n%s\\n\", colorF(status), colorF(headers), colorF(body))\n\t} else {\n\t\tt.Logf(\"\\n%s\\n\", colorF(status))\n\t}\n\n\tif req.Recorder != nil && req.RequestWC != nil {\n\t\terr = req.Recorder.RecordRequest(req.Request, status, headers, body, req.RequestWC)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to record request: %s\", err)\n\t\t}\n\t\tif f, ok := req.RequestWC.(*os.File); ok {\n\t\t\tt.Logf(\"request recorded to %s\", f.Name())\n\t\t} else {\n\t\t\tt.Logf(\"request recorded\")\n\t\t}\n\t}\n\n\tr, err := c.HTTPClient.Do(req.Request)\n\tif r != nil {\n\t\tdefer r.Body.Close()\n\t}\n\tif err != nil {\n\t\tt.Fatalf(\"can't make request: %s\", err)\n\t}\n\n\tresp := &Response{Response: r}\n\n\tstatus, headers, body, err = dumpResponse(resp.Response)\n\tif err != nil {\n\t\tt.Fatalf(\"can't dump response: %s\", err)\n\t}\n\n\tswitch {\n\tcase resp.StatusCode >= 400:\n\t\tcolorF = func(b []byte) string { return color.RedString(string(b)) }\n\tcase resp.StatusCode >= 300:\n\t\tcolorF = func(b []byte) string { return color.YellowString(string(b)) }\n\tdefault:\n\t\tcolorF = func(b []byte) string { return color.GreenString(string(b)) }\n\t}\n\n\tif *vF {\n\t\tt.Logf(\"\\n%s\\n%s\\n\\n%s\\n\", colorF(status), colorF(headers), colorF(body))\n\t} else {\n\t\tt.Logf(\"\\n%s\\n\", colorF(status))\n\t}\n\n\tif req.Recorder != nil && req.ResponseWC != nil {\n\t\terr = req.Recorder.RecordResponse(resp.Response, status, headers, body, req.ResponseWC)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to record response: %s\", err)\n\t\t}\n\t\tif f, ok := req.ResponseWC.(*os.File); ok {\n\t\t\tt.Logf(\"response recorded to %s\", f.Name())\n\t\t} else {\n\t\t\tt.Logf(\"response recorded\")\n\t\t}\n\t}\n\n\tif resp.StatusCode != expectedStatusCode {\n\t\tt.Errorf(\"%s %s: expected %d, got %s\", req.Method, req.URL.String(), expectedStatusCode, resp.Status)\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "97f29fb3bf740da9981abe9b1ad0bc12", "score": "0.54631233", "text": "func requestResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, checks []basic.Validator) {\n\tresp := ProcessRequest(ctx, w, r, checks)\n\tif resp.ErrorCode != server.StatusSuccess {\n\t\tlog.Warningf(ctx, \"could not process request %v\", resp)\n\t}\n\n\tjsonResponse, err := json.Marshal(resp)\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"json.Marshal(%v) failed: %v\", resp, err)\n\t\thttp.Error(\n\t\t\tw,\n\t\t\tfmt.Sprintf(\"json.Marshal(%v) failed: %v\", resp, err),\n\t\t\thttp.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(jsonResponse)\n\n\tif resp.ErrorCode == server.StatusSuccess {\n\t\tlog.Infof(ctx, \"successfully processed requestID '%q'\", resp.RequestID)\n\t}\n}", "title": "" }, { "docid": "bfaac0e49cd6e342f95df2e8bff39052", "score": "0.5461592", "text": "func assertResponseCode(t *testing.T, expectedCode int, resp *httptest.ResponseRecorder) {\n\tt.Helper()\n\tt.Logf(\"code:%d\", resp.Code)\n\tif expectedCode != resp.Code {\n\t\tt.Errorf(\"status code %d expected.\", expectedCode)\n\t\tt.Logf(\"Response:\\n%s\", resp.Body.String())\n\t}\n}", "title": "" }, { "docid": "27d3d2978312fccc32f273aeb0adeef4", "score": "0.5457989", "text": "func CreateHTTPResponse(respcode int, data ...string) *resty.Response {\n\tvar resBody string\n\theaders := make(map[string]string)\n\n\tif len(data) < 2 { // if no body is provided, create one\n\t\tresBody = \"\"\n\t}\n\n\tfor k, v := range data {\n\t\tif k == 1 {\n\t\t\tresBody = v\n\n\t\t\tcontinue\n\t\t}\n\t\tif k%2 == 0 {\n\t\t\tcontinue\n\t\t}\n\t\theaders[data[k-1]] = v\n\t}\n\tmockedServer, mockedServerURL := HTTPServer(respcode, resBody, headers)\n\tdefer mockedServer.Close()\n\tres, _ := resty.R().Get(mockedServerURL)\n\n\treturn res\n}", "title": "" }, { "docid": "2ce7c377fdb78895ed8897c25db688b8", "score": "0.54525065", "text": "func (*testClient) Do(req *http.Request) (*http.Response, error) {\n\treturn responseStub, errorStub\n}", "title": "" }, { "docid": "a2ee6a0804756e3ba2ab5633544d74f7", "score": "0.54510146", "text": "func getHTTPResponse(url string, token string) (*http.Response, error) {\n\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If a token is present, add it to the http.request\n\tif token != \"\" {\n\t\treq.Header.Add(\"Authorization\", \"token \"+token)\n\t}\n\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "7d6d6f2eba7d0e2c72221556ef817bde", "score": "0.54504573", "text": "func test(w http.ResponseWriter, r *http.Request) {\n\tbody := r.Body\n\tif body == http.NoBody {\n\t\tfmt.Println(\"Body is nil\")\n\t} else {\n\t\treceived, err := ioutil.ReadAll(body)\n\t\tfmt.Println(len(received))\n\t\tif len(received) == 0 {\n\t\t\tfmt.Println(\"Received empty body\")\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(\"Received error\", string(received))\n\t}\n\n}", "title": "" }, { "docid": "8b9263613aabf7e88428235a3010848f", "score": "0.5430953", "text": "func TestTemplateProxyResponse(t *testing.T) {\n\ttests := []struct {\n\t\tlabel string\n\t\texpectedRetCode int\n\t\texpectedResponse string\n\t\texpectedHost string\n\t\texpectedPort int\n\t\texpectedContentType string\n\t}{\n\t\t{\"Valid site\", http.StatusOK, getHTMLTemplate(t), \"localhost\", 8080, \"text/html\"},\n\t\t{\"Nonexisting site\", http.StatusOK, \"\", \"localhost\", 8080, \"text/html\"},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.label, func(t *testing.T) {\n\t\t\tchromeInstanceManager := chrome.NewInstanceManager(true)\n\t\t\tstreaminghdpHandler, err := streaminghdpreviews.New(test.expectedHost, test.expectedPort, chromeInstanceManager, staticDir)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Failed to get HDPreviews handler: %v\", err)\n\t\t\t}\n\n\t\t\tenv, err := testutil.NewTestEnvironment(streaminghdpHandler, http.HandlerFunc(\n\t\t\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\t\t\tw.Header().Set(\"Content-Type\", test.expectedContentType)\n\t\t\t\t\tw.WriteHeader(test.expectedRetCode)\n\t\t\t\t},\n\t\t\t))\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Cannot create test environment: %v\", err)\n\t\t\t}\n\t\t\treq, err := http.NewRequest(\"GET\", env.OriginServer.URL+\"?req_for_preview=1\", nil)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"NewRequest: %v\", err)\n\t\t\t}\n\t\t\tresponse, _ := env.Transport.RoundTrip(req)\n\t\t\tif got, want := response.StatusCode, test.expectedRetCode; got != want {\n\t\t\t\tt.Fatalf(\"Requesting to %v got statusCode: %v, want: %v\", env.OriginServer.URL, got, want)\n\t\t\t}\n\n\t\t\tif response.StatusCode == http.StatusOK {\n\t\t\t\tif got, want := response.Header[\"Content-Type\"][0], test.expectedContentType; got != want {\n\t\t\t\t\tt.Fatalf(\"Incorrect Content-type wanted: %v got %v\", want, got)\n\t\t\t\t}\n\t\t\t\tif !response.Uncompressed {\n\t\t\t\t\tt.Fatalf(\"The response should have already been uncompressed.\")\n\t\t\t\t}\n\t\t\t\tbodyBytes, err := ioutil.ReadAll(response.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"failed to read body from the HTTP response: %v\", err)\n\t\t\t\t}\n\t\t\t\tif got, wanted := string(bodyBytes), test.expectedResponse; len(got) < len(wanted)-15 {\n\t\t\t\t\t// Just a simple check.\n\t\t\t\t\t// If the template was executed properly, then it should be slightly smaller.\n\t\t\t\t\tt.Errorf(\"body doesn't match wanted: %v got: %v\\n\", wanted, got)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8b1e288cc6ae5d8ddd0df5996dae347c", "score": "0.5426122", "text": "func (a *apiVerifier) verifyResponse(res *http.Response, req *http.Request) error {\n\tresponse, produces, err := a.getResponseDef(req, res)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbody, err := readResponseBody(res)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"response not valid\")\n\t}\n\terr = checkIfSchemaOrBodyIsEmpty(response.Schema, len(body))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"either defined schema or response body is empty\")\n\t}\n\n\tcontentType, err := a.matchContentType(res.Header.Get(\"Content-Type\"), produces)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdecoded, err := decodeBody(contentType, body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to decode response\")\n\t}\n\treturn validate.AgainstSchema(response.Schema, decoded, strfmt.Default)\n}", "title": "" }, { "docid": "9211c625ae99cf9a82624d92c5615253", "score": "0.5425425", "text": "func postAndTest(api string, v interface{}, expectedStatusCode int, expectedStatus string) error {\n\trespBytes, response, err := post(api, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif response.StatusCode != expectedStatusCode {\n\t\terrorString := fmt.Sprintf(\"Expected StatusCode %d, got %d instead\", expectedStatusCode, response.StatusCode)\n\t\treturn errors.New(errorString)\n\t}\n\n\tvar s core.ResponseData\n\tif err = json.Unmarshal(respBytes, &s); err != nil {\n\t\treturn err\n\t}\n\n\tif s.Status != expectedStatus {\n\t\terrorString := fmt.Sprintf(\"Expected Status \\\"%s\\\", got \\\"%s\\\" instead\", expectedStatus, s.Status)\n\t\treturn errors.New(errorString)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "45966d6fb3374a18f467339896e058f3", "score": "0.542446", "text": "func fetchResponse(url string) *http.Response {\n\tr, err := http.Get(url)\n\tcheck(err)\n\treturn r\n}", "title": "" }, { "docid": "158052eb1d24377b98b247dd54a59b93", "score": "0.5423125", "text": "func (api *APIServer) getResponse(url string) ([]byte, error) {\n\tresp, err := http.Get(api.urlServer + url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Response code not \"200 OK\"\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn []byte(\"0\"), nil\n\t}\n\n\t// Read response\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn body, err\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "dd5480efa3a2aeab067192481fb1c110", "score": "0.54208636", "text": "func TestResponseFromResponse(res *http.Response) (ret *TestResponse) {\n\tret = &TestResponse{\n\t\tCode: res.StatusCode,\n\t\tResponse: res,\n\t}\n\n\tret.Body, ret.Err = ioutil.ReadAll(res.Body)\n\tif ret.Err != nil {\n\t\treturn\n\t}\n\n\tret.Cookies = map[string]string{}\n\n\tfor _, cookie := range res.Cookies() {\n\t\tret.Cookies[cookie.Name] = cookie.Value\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "af1f213ef8188de8ca51e1b775c1ab26", "score": "0.54198515", "text": "func getHTTPServer() *httptest.Server {\n\treturn httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tbody, code := getResponseJSON(r.RequestURI)\n\t\tw.WriteHeader(code)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(body) //nolint:errcheck // ignore the returned error as the test will fail anyway\n\t}))\n}", "title": "" }, { "docid": "9980b7b3443d3f7531691c588dd80898", "score": "0.54196656", "text": "func getHttpServer(t *testing.T, callCount *int) *httptest.Server {\n\thttpServer := httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) {\n\t\tswitch request.Method {\n\t\tcase http.MethodPost:\n\n\t\t\t// Update The Number Of Calls (Async Safe)\n\t\t\t*callCount++\n\n\t\t\t// Verify Request Content-Type Header\n\t\t\trequestContentTypeHeader := request.Header.Get(\"Content-Type\")\n\t\t\tif requestContentTypeHeader != \"application/json\" {\n\t\t\t\tt.Errorf(\"expected HTTP request ContentType Header: application/json got: %+v\", requestContentTypeHeader)\n\t\t\t}\n\n\t\t\t// Verify The Request Body\n\t\t\tbodyBytes, err := ioutil.ReadAll(request.Body)\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"expected to be able to read HTTP request Body without error: %+v\", err)\n\t\t\t} else {\n\t\t\t\tbodyMap := make(map[string]string)\n\t\t\t\t_ = json.Unmarshal(bodyBytes, &bodyMap) // Ignore Unexpected Errors - Should Not Happen Due To Controlled Test Data\n\t\t\t\tif !reflect.DeepEqual(bodyMap, testValue) {\n\t\t\t\t\tt.Errorf(\"expected HTTP request Body: %+v got: %+v\", testValue, bodyMap)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Send Success Response (This is the default, but just to be explicit)\n\t\t\tresponseWriter.WriteHeader(http.StatusOK)\n\n\t\tdefault:\n\t\t\tt.Errorf(\"expected HTTP request method: POST got: %+v\", request.Method)\n\n\t\t}\n\t}))\n\treturn httpServer\n}", "title": "" }, { "docid": "86dfa6b07285ada46f1b2ab8d9e52ee6", "score": "0.5417738", "text": "func DebugHTTPResponse(data []byte, err error) {\n\tfmt.Println(\"[DEBUG]:: DebugHTTPResponse\")\n\tfmt.Println(\"=============================\")\n\tfmt.Println(\"Response: \")\n\tfmt.Println(\"-----------------------------\")\n\tDebugHTTP(data, err)\n\tfmt.Println(\"-----------------------------\")\n\tfmt.Println(\"End-Response: \")\n}", "title": "" }, { "docid": "aea04639674f94c0425107be5c492fb1", "score": "0.5410932", "text": "func Test_ReadResponse(t *testing.T) {\n\tt.Run(\"Return empty response Error\", func(t *testing.T) {\n\t\tbuf := bytes.NewBuffer([]byte(``))\n\t\trc := ioutil.NopCloser(buf)\n\n\t\tresponse := &http.Response{\n\t\t\tContentLength: 10,\n\t\t\tBody: rc,\n\t\t}\n\t\tb, err := readResponse(response)\n\n\t\tif len(b) != 0 {\n\t\t\tt.Error(\"Something parsed from empty response\")\n\t\t}\n\n\t\tif err.Error() != errors.New(\"Empty response\").Error() {\n\t\t\tt.Error(\"Empty response should throw: [Empty response] error\")\n\t\t}\n\t})\n\n\tt.Run(\"Bump error on Read from Buffer error\", func(t *testing.T) {\n\t\tbuf := strings.NewReader(\"Non empty response\")\n\t\treader := &fakeReader{buf}\n\t\trc := ioutil.NopCloser(reader)\n\n\t\tresponse := &http.Response{\n\t\t\tContentLength: 10,\n\t\t\tBody: rc,\n\t\t}\n\t\t_, err := readResponse(response)\n\n\t\tif err.Error() != errors.New(\"OMG!\").Error() {\n\t\t\tt.Error(\"Should throw: [OMG!] error\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2b15c717e6ae9b4533e0918a84efd16d", "score": "0.54030246", "text": "func testServerRequest(t *testing.T, writeReq func(*serverTester), checkReq func(*http.Request)) {\n\tgotReq := make(chan bool, 1)\n\tst := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Body == nil {\n\t\t\tt.Fatal(\"nil Body\")\n\t\t}\n\t\tcheckReq(r)\n\t\tgotReq <- true\n\t})\n\tdefer st.Close()\n\n\tst.greet()\n\twriteReq(st)\n\t<-gotReq\n}", "title": "" }, { "docid": "c11fce9cf64822996a83b17801869824", "score": "0.53983283", "text": "func httpGetRespondsWith200(goTest *testing.T, output infratests.TerraformOutput) {\n\thostname := output[\"apim_gateway_url\"].(string) + \"/petstore/v1/pet/0\"\n\tmaxRetries := 20\n\ttimeBetweenRetries := 2 * time.Second\n\ttlsConfig := tls.Config{}\n\n\terr := httpClient.HttpGetWithRetryWithCustomValidationE(\n\t\tgoTest,\n\t\thostname,\n\t\t&tlsConfig,\n\t\tmaxRetries,\n\t\ttimeBetweenRetries,\n\t\tfunc(status int, content string) bool {\n\t\t\treturn status == 200\n\t\t},\n\t)\n\tif err != nil {\n\t\tgoTest.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "e58f6adffb5900f95a58e4586e45db48", "score": "0.53882575", "text": "func CheckResponse(resp *http.Response) error {\n\tif code := resp.StatusCode; 200 <= code && code <= 299 {\n\t\treturn nil\n\t}\n\terrorResponse := &ErrorResponse{}\n\terrorResponse.HTTPResponse = resp\n\terr := json.NewDecoder(resp.Body).Decode(errorResponse)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn errorResponse\n}", "title": "" }, { "docid": "b26c68b2681d934760f7713d11ae4590", "score": "0.5388233", "text": "func TestHealthCheck(t *testing.T) {\n req, err := http.NewRequest(\"GET\", \"/\", nil)\n\n if err != nil {\n t.Errorf(\"An error occurred. %v\", err)\n }\n\n rr := httptest.NewRecorder()\n handler := http.HandlerFunc(greeting)\n\n handler.ServeHTTP(rr, req)\n\n if status := rr.Code; status != http.StatusOK {\n t.Errorf(\"Handler returned wrong status code. Got %v, want %v\", status, http.StatusOK)\n }\n\n\n dt := time.Now()\n expected := fmt.Sprintf(\"Hello! Welcome to my containerized web server in Golang!\\nToday's date and time is: %s\", dt.Format(\"02-01-2006 15:04:05 Monday\"))\n if rr.Body.String() != expected {\n t.Errorf(\"Handler returned incorrect body: Got %v, want %v\", rr.Body.String(), expected)\n }\n}", "title": "" }, { "docid": "7ac64d8c712ee1daa62111f48c1b1d51", "score": "0.53875387", "text": "func GetResponse(url string) (res *http.Response, err error) {\n\t// InsecureSkipVerify to false for production\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := http.Client{\n\t\tTransport: tr,\n\t\tTimeout: time.Second * TIMEOUT, // Maximum of 2 secs\n\t}\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tretry := RETRY\n\tfor i := 1; i <= retry; i++ {\n\t\tvar getErr error\n\t\t// make the request\n\t\tres, getErr = client.Do(req)\n\t\tif getErr != nil {\n\t\t\tlog.Warn(\"Attempt \", i, getErr)\n\t\t\tif i >= retry {\n\t\t\t\treturn nil, getErr\n\t\t\t}\n\t\t} else {\n\t\t\tretry = 0\n\t\t}\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "ed4ec0120a42a73b619c8926f4d24cbd", "score": "0.5384365", "text": "func (suite *BaseHandlerTestSuite) CheckResponseTeapot(resp middleware.Responder) {\n\tsuite.CheckErrorResponse(resp, http.StatusTeapot, \"Teapot\")\n}", "title": "" }, { "docid": "89945136ed46aa5c80ca0b9fb128ccb4", "score": "0.5380902", "text": "func (pr *MockWsPrinter) Response(*http.Response, time.Duration) {}", "title": "" }, { "docid": "b0570e4fc256171e3c06c2e32be56ab5", "score": "0.537433", "text": "func TestStatus(t *testing.T) {\n\tredirectHeaders := map[string]string{\n\t\t\"Location\": \"/redirect/1\",\n\t}\n\tunauthorizedHeaders := map[string]string{\n\t\t\"WWW-Authenticate\": `Basic realm=\"Fake Realm\"`,\n\t}\n\ttests := []struct {\n\t\tcode int\n\t\theaders map[string]string\n\t\tbody string\n\t}{\n\t\t// 100 is tested as a special case below\n\t\t{200, nil, \"\"},\n\t\t{300, map[string]string{\"Location\": \"/image/jpeg\"}, `<!doctype html>\n<head>\n<title>Multiple Choices</title>\n</head>\n<body>\n<ul>\n<li><a href=\"/image/jpeg\">/image/jpeg</a></li>\n<li><a href=\"/image/png\">/image/png</a></li>\n<li><a href=\"/image/svg\">/image/svg</a></li>\n</body>\n</html>`},\n\t\t{301, redirectHeaders, \"\"},\n\t\t{302, redirectHeaders, \"\"},\n\t\t{308, map[string]string{\"Location\": \"/image/jpeg\"}, `<!doctype html>\n<head>\n<title>Permanent Redirect</title>\n</head>\n<body>Permanently redirected to <a href=\"/image/jpeg\">/image/jpeg</a>\n</body>\n</html>`},\n\t\t{401, unauthorizedHeaders, \"\"},\n\t\t{418, nil, \"I'm a teapot!\"},\n\t\t{500, nil, \"\"}, // maximum allowed status code\n\t\t{599, nil, \"\"}, // maximum allowed status code\n\t}\n\n\tfor _, test := range tests {\n\t\ttest := test\n\t\tt.Run(fmt.Sprintf(\"ok/status/%d\", test.code), func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\treq, _ := http.NewRequest(\"GET\", srv.URL+fmt.Sprintf(\"/status/%d\", test.code), nil)\n\t\t\tresp := must.DoReq(t, client, req)\n\t\t\tdefer consumeAndCloseBody(resp)\n\t\t\tassert.StatusCode(t, resp, test.code)\n\t\t\tassert.BodyEquals(t, resp, test.body)\n\t\t\tfor key, val := range test.headers {\n\t\t\t\tassert.Header(t, resp, key, val)\n\t\t\t}\n\t\t})\n\t}\n\n\terrorTests := []struct {\n\t\turl string\n\t\tstatus int\n\t}{\n\t\t{\"/status\", http.StatusNotFound},\n\t\t{\"/status/\", http.StatusBadRequest},\n\t\t{\"/status/200/foo\", http.StatusNotFound},\n\t\t{\"/status/3.14\", http.StatusBadRequest},\n\t\t{\"/status/foo\", http.StatusBadRequest},\n\t\t{\"/status/600\", http.StatusBadRequest},\n\t\t{\"/status/1024\", http.StatusBadRequest},\n\t}\n\n\tfor _, test := range errorTests {\n\t\ttest := test\n\t\tt.Run(\"error\"+test.url, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\treq := newTestRequest(t, \"GET\", test.url)\n\t\t\tresp := must.DoReq(t, client, req)\n\t\t\tdefer consumeAndCloseBody(resp)\n\t\t\tassert.StatusCode(t, resp, test.status)\n\t\t})\n\t}\n\n\tt.Run(\"HTTP 100 Continue status code supported\", func(t *testing.T) {\n\t\t// The stdlib http client automagically handles 100 Continue responses\n\t\t// by continuing the request until a \"final\" 200 OK response is\n\t\t// received, which prevents us from confirming that a 100 Continue\n\t\t// response is sent when using the http client directly.\n\t\t//\n\t\t// So, here we instead manally write the request to the wire and read\n\t\t// the initial response, which will give us access to the 100 Continue\n\t\t// indication we need.\n\t\tt.Parallel()\n\n\t\tconn, err := net.Dial(\"tcp\", srv.Listener.Addr().String())\n\t\tassert.NilError(t, err)\n\t\tdefer conn.Close()\n\n\t\treq := newTestRequest(t, \"GET\", \"/status/100\")\n\t\treqBytes, err := httputil.DumpRequestOut(req, false)\n\t\tassert.NilError(t, err)\n\n\t\tn, err := conn.Write(reqBytes)\n\t\tassert.NilError(t, err)\n\t\tassert.Equal(t, n, len(reqBytes), \"incorrect number of bytes written\")\n\n\t\tresp, err := http.ReadResponse(bufio.NewReader(conn), req)\n\t\tassert.NilError(t, err)\n\t\tassert.StatusCode(t, resp, http.StatusContinue)\n\t})\n}", "title": "" }, { "docid": "c9a5fa723baf3cb6ac3426740f83ffe2", "score": "0.5365935", "text": "func TestHTTP_GetError(t *testing.T) {\n\n\tif common.Config.API_URL == \"\" {\n\t\tTHTTPConfig()\n\t}\n\n\tdata, err := Get(common.EOS_URL+\"/v1/chain/get_info\", map[string]string{\"aé%\": \"b\", \"c\": \"dé@#\"})\n\n\tfmt.Println(\"err: \", err)\n\tassert.NotNil(t, err, \"test get error\")\n\n\tif err != nil {\n\t\tassert.NotNil(t, err.Custom, \"test http error, should not be nil\")\n\t}\n\n\tfmt.Println(\"data: \", data)\n\tassert.Nil(t, data, \"test result, should be nil\")\n\n}", "title": "" }, { "docid": "84148a1032b423e9380c5fd7004ea825", "score": "0.5360795", "text": "func CheckResponse(r *http.Response) error {\n\tif r.StatusCode == 200 {\n\t\treturn nil\n\t}\n\n\terrorResponse := &ErrorResponse{Response: r}\n\terrorResponse.Message = \"unknown error\"\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err == nil && data != nil {\n\t\terrorResponse.Body = data\n\t}\n\n\treturn errorResponse\n}", "title": "" }, { "docid": "325f7e70f130fdf311527b2d64dd9503", "score": "0.5356905", "text": "func CheckResponse(resp *http.Response) error {\n\tif resp.StatusCode == http.StatusOK {\n\t\treturn nil\n\t}\n\n\terrorResponse := &ErrorResponse{Response: resp}\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err == nil && data != nil {\n\t\tjson.Unmarshal(data, errorResponse)\n\t}\n\n\treturn errorResponse\n}", "title": "" }, { "docid": "81243a9ac0a0afa47769b778b03f67e4", "score": "0.53550124", "text": "func doRequestRes(req *http.Request) (int, *Models.Res) {\n\tresp, err := http.DefaultClient.Do(req)\n\tSo(err, ShouldEqual, nil)\n\tb, err := ioutil.ReadAll(resp.Body)\n\tSo(err, ShouldEqual, nil)\n\tSo(resp.Body.Close(), ShouldEqual, nil)\n\tvar res Models.Res\n\tSo(json.Unmarshal(b, &res), ShouldEqual, nil)\n\n\treturn resp.StatusCode, &res\n}", "title": "" }, { "docid": "9e30e23484671f634a1998a27841d7b2", "score": "0.5349897", "text": "func DoRequestAndReceiveResponse(url string) (*http.Response, error) {\n\tlogger := servicelog.GetInstance()\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\tlogger.Println(time.Now().UTC(), \"Http new request error\")\n\t\treturn nil, err\n\n\t}\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlogger.Println(time.Now().UTC(), \"bad error in client Do\")\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "19f7d788b85186c831e6ece0b17754f0", "score": "0.534448", "text": "func TestRpcJsonResponseStruct(t *testing.T) {\n\tRegisterTestingT(t)\n\trpcClient := NewClient(httpServer.URL)\n\n\t// empty return body is an error\n\tresponseBody = ``\n\tres, err := rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).NotTo(BeNil())\n\tExpect(res).To(BeNil())\n\n\t// not a json body is an error\n\tresponseBody = `{ \"not\": \"a\", \"json\": \"object\"`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).NotTo(BeNil())\n\tExpect(res).To(BeNil())\n\n\t// field \"anotherField\" not allowed in rpc response is an error\n\tresponseBody = `{ \"anotherField\": \"norpc\"}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).NotTo(BeNil())\n\tExpect(res).To(BeNil())\n\n\t// TODO: result must contain one of \"result\", \"error\"\n\t// TODO: is there an efficient way to do this?\n\t/*responseBody = `{}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).NotTo(BeNil())\n\tExpect(res).To(BeNil())*/\n\n\t// result null is ok\n\tresponseBody = `{\"result\": null}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\n\t// error null is ok\n\tresponseBody = `{\"error\": null}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\n\t// result and error null is ok\n\tresponseBody = `{\"result\": null, \"error\": null}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\n\t// TODO: result must not contain both of \"result\", \"error\" != null\n\t// TODO: is there an efficient way to do this?\n\t/*responseBody = `{ \"result\": 123, \"error\": {\"code\": 123, \"message\": \"something wrong\"}}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).NotTo(BeNil())\n\tExpect(res).To(BeNil())*/\n\n\t// result string is ok\n\tresponseBody = `{\"result\": \"ok\"}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(Equal(\"ok\"))\n\n\t// result with error null is ok\n\tresponseBody = `{\"result\": \"ok\", \"error\": null}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(Equal(\"ok\"))\n\n\t// error with result null is ok\n\tresponseBody = `{\"error\": {\"code\": 123, \"message\": \"something wrong\"}, \"result\": null}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error.Code).To(Equal(123))\n\tExpect(res.Error.Message).To(Equal(\"something wrong\"))\n\n\t// TODO: empty error is not ok, must at least contain code and message\n\t/*responseBody = `{ \"error\": {}}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).NotTo(BeNil())*/\n\n\t// TODO: only code in error is not ok, must at least contain code and message\n\t/*responseBody = `{ \"error\": {\"code\": 123}}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).NotTo(BeNil())*/\n\n\t// TODO: only message in error is not ok, must at least contain code and message\n\t/*responseBody = `{ \"error\": {\"message\": \"something wrong\"}}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error).NotTo(BeNil())*/\n\n\t// error with code and message is ok\n\tresponseBody = `{ \"error\": {\"code\": 123, \"message\": \"something wrong\"}}`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Result).To(BeNil())\n\tExpect(res.Error.Code).To(Equal(123))\n\tExpect(res.Error.Message).To(Equal(\"something wrong\"))\n\n\t// check results\n\n\t// should return int correctly\n\tresponseBody = `{ \"result\": 1 }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\ti, err := res.GetInt()\n\tExpect(err).To(BeNil())\n\tExpect(i).To(Equal(int64(1)))\n\n\t// error on wrong type\n\ti = 3\n\tresponseBody = `{ \"result\": \"notAnInt\" }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\ti, err = res.GetInt()\n\tExpect(err).NotTo(BeNil())\n\tExpect(i).To(Equal(int64(0)))\n\n\t// error on result null\n\ti = 3\n\tresponseBody = `{ \"result\": null }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\ti, err = res.GetInt()\n\tExpect(err).NotTo(BeNil())\n\tExpect(i).To(Equal(int64(0)))\n\n\tb := false\n\tresponseBody = `{ \"result\": true }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\tb, err = res.GetBool()\n\tExpect(err).To(BeNil())\n\tExpect(b).To(Equal(true))\n\n\tb = true\n\tresponseBody = `{ \"result\": 123 }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\tb, err = res.GetBool()\n\tExpect(err).NotTo(BeNil())\n\tExpect(b).To(Equal(false))\n\n\tvar p *Person\n\tresponseBody = `{ \"result\": {\"name\": \"Alex\", \"age\": 35, \"anotherField\": \"something\"} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p)\n\tExpect(err).To(BeNil())\n\tExpect(p.Name).To(Equal(\"Alex\"))\n\tExpect(p.Age).To(Equal(35))\n\tExpect(p.Country).To(Equal(\"\"))\n\n\t// TODO: How to check if result could be parsed or if it is default?\n\tp = nil\n\tresponseBody = `{ \"result\": {\"anotherField\": \"something\"} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p)\n\tExpect(err).To(BeNil())\n\tExpect(p).NotTo(BeNil())\n\n\t// TODO: HERE######\n\tvar pp *PointerFieldPerson\n\tresponseBody = `{ \"result\": {\"anotherField\": \"something\", \"country\": \"Germany\"} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&pp)\n\tExpect(err).To(BeNil())\n\tExpect(pp.Name).To(BeNil())\n\tExpect(pp.Age).To(BeNil())\n\tExpect(*pp.Country).To(Equal(\"Germany\"))\n\n\tp = nil\n\tresponseBody = `{ \"result\": null }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p)\n\tExpect(err).To(BeNil())\n\tExpect(p).To(BeNil())\n\n\t// passing nil is an error\n\tp = nil\n\tresponseBody = `{ \"result\": null }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(p)\n\tExpect(err).NotTo(BeNil())\n\tExpect(p).To(BeNil())\n\n\tp2 := &Person{\n\t\tName: \"Alex\",\n\t}\n\tresponseBody = `{ \"result\": null }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p2)\n\tExpect(err).To(BeNil())\n\tExpect(p2).To(BeNil())\n\n\tp2 = &Person{\n\t\tName: \"Alex\",\n\t}\n\tresponseBody = `{ \"result\": {\"age\": 35} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(p2)\n\tExpect(err).To(BeNil())\n\tExpect(p2.Name).To(Equal(\"Alex\"))\n\tExpect(p2.Age).To(Equal(35))\n\n\t// prefilled struct is kept on no result\n\tp3 := Person{\n\t\tName: \"Alex\",\n\t}\n\tresponseBody = `{ \"result\": null }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p3)\n\tExpect(err).To(BeNil())\n\tExpect(p3.Name).To(Equal(\"Alex\"))\n\n\t// prefilled struct is extended / overwritten\n\tp3 = Person{\n\t\tName: \"Alex\",\n\t\tAge: 123,\n\t}\n\tresponseBody = `{ \"result\": {\"age\": 35, \"country\": \"Germany\"} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(&p3)\n\tExpect(err).To(BeNil())\n\tExpect(p3.Name).To(Equal(\"Alex\"))\n\tExpect(p3.Age).To(Equal(35))\n\tExpect(p3.Country).To(Equal(\"Germany\"))\n\n\t// nil is an error\n\tresponseBody = `{ \"result\": {\"age\": 35} }`\n\tres, err = rpcClient.Call(\"something\", 1, 2, 3)\n\t<-requestChan\n\tExpect(err).To(BeNil())\n\tExpect(res.Error).To(BeNil())\n\terr = res.GetObject(nil)\n\tExpect(err).NotTo(BeNil())\n}", "title": "" }, { "docid": "3cdcc61d35b9a4250e720b872d78c252", "score": "0.5331153", "text": "func TestRestResponse(t *testing.T) {\n\tc, err := NewClientFromLogin(accountName,\n\t\tpassword, \"\", \"\", LocalSplunkMgmntURL, false)\n\tif err != nil {\n\t\tt.Fatal(\"Unable to get access token. Check that Splunk is running.\")\n\t}\n\n\tresponse, err := c.GetEntities([]string{\"services\", \"properties\"})\n\tif err != nil {\n\t\tt.Fatal(\"Error querying endpoint, check that Splunk is running\")\n\t}\n\n\tconst expecting = \"properties\"\n\tif response.Title != expecting {\n\t\tt.Logf(\"Expecting title: %v\\t Received: %v\", expecting, response.Title)\n\t\tt.Fail()\n\t}\n}", "title": "" } ]
a545585348144d6f8cae010a3bf7e5e5
HasManagedAppPolicies returns a boolean if a field has been set.
[ { "docid": "93c7f100c4d18b5fa63d42874b4b8014", "score": "0.8574063", "text": "func (o *DeviceAppManagement) HasManagedAppPolicies() bool {\n\tif o != nil && o.ManagedAppPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "957806b2b6130b55dcf295a9c347d719", "score": "0.8454527", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasManagedAppPolicies() bool {\n\tif o != nil && o.ManagedAppPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2c0eba0e570c73744529e494277061c", "score": "0.64529914", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasIosManagedAppProtections() bool {\n\tif o != nil && o.IosManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7524f5619ba6892fd94813c6f129a2f8", "score": "0.63366574", "text": "func (o *DeviceAppManagement) HasIosManagedAppProtections() bool {\n\tif o != nil && o.IosManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a0114d840274ee8b6f5b636d9e4fd48a", "score": "0.63228524", "text": "func (o *DeviceAppManagement) HasMdmWindowsInformationProtectionPolicies() bool {\n\tif o != nil && o.MdmWindowsInformationProtectionPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8da04256753a1d9fb1b767cb97fe7edf", "score": "0.63097256", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasMdmWindowsInformationProtectionPolicies() bool {\n\tif o != nil && o.MdmWindowsInformationProtectionPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "943553b7d8221f4b56068534fc19000e", "score": "0.6304325", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasManagedAppRegistrations() bool {\n\tif o != nil && o.ManagedAppRegistrations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "79c4ec75962e1355f018eaf7cbe672ae", "score": "0.628698", "text": "func (o *DeviceAppManagement) HasManagedAppRegistrations() bool {\n\tif o != nil && o.ManagedAppRegistrations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7908fc965da91714f7056b77e71c0c47", "score": "0.6263728", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasApps() bool {\n\tif o != nil && o.Apps != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "36ea4caae1ce42c7e09f1b18cbd97de7", "score": "0.62585604", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasTargetedManagedAppConfigurations() bool {\n\tif o != nil && o.TargetedManagedAppConfigurations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "34630fab784630d73080ed819954c858", "score": "0.62310034", "text": "func (o *DeviceAppManagement) HasTargetedManagedAppConfigurations() bool {\n\tif o != nil && o.TargetedManagedAppConfigurations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7ca7d14584400724367c9daf1f03ee81", "score": "0.6188739", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasWindowsInformationProtectionPolicies() bool {\n\tif o != nil && o.WindowsInformationProtectionPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "33147660286e065f620990ced445c388", "score": "0.6169082", "text": "func (o *DeviceAppManagement) GetManagedAppPoliciesOk() ([]MicrosoftGraphManagedAppPolicy, bool) {\n\tif o == nil || o.ManagedAppPolicies == nil {\n\t\tvar ret []MicrosoftGraphManagedAppPolicy\n\t\treturn ret, false\n\t}\n\treturn *o.ManagedAppPolicies, true\n}", "title": "" }, { "docid": "e1afcc8d81181db661adeb6b02abb5ea", "score": "0.6165364", "text": "func (o *MicrosoftGraphDeviceAppManagement) GetManagedAppPoliciesOk() ([]MicrosoftGraphManagedAppPolicy, bool) {\n\tif o == nil || o.ManagedAppPolicies == nil {\n\t\tvar ret []MicrosoftGraphManagedAppPolicy\n\t\treturn ret, false\n\t}\n\treturn *o.ManagedAppPolicies, true\n}", "title": "" }, { "docid": "689712b6a9cfee42c2db3c95dcd66a37", "score": "0.61646825", "text": "func (o *DeviceAppManagement) HasWindowsInformationProtectionPolicies() bool {\n\tif o != nil && o.WindowsInformationProtectionPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "912fae9ba41be0088457253ff0893882", "score": "0.6065286", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasManagedAppStatuses() bool {\n\tif o != nil && o.ManagedAppStatuses != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "41461608de326ed835c6b85968d33ce2", "score": "0.6042336", "text": "func (o *DeviceAppManagement) HasManagedEBooks() bool {\n\tif o != nil && o.ManagedEBooks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32c42492255cd56bf0303571fdc592f1", "score": "0.601749", "text": "func (o *DeviceAppManagement) HasManagedAppStatuses() bool {\n\tif o != nil && o.ManagedAppStatuses != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "473e7c8d967c5cce26e189733e6c822b", "score": "0.600222", "text": "func (o *UserDTO) HasAccessPolicies() bool {\n\tif o != nil && o.AccessPolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "22343bf6fc7e287bb406edfae2cf87b7", "score": "0.5993995", "text": "func (o *InlineResponse20039PersonPermissions) HasCanManagePeople() bool {\n\tif o != nil && o.CanManagePeople != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "040628db0a235baa89c6029bd82ee0fb", "score": "0.5992481", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasIsEnabledForMicrosoftStoreForBusiness() bool {\n\tif o != nil && o.IsEnabledForMicrosoftStoreForBusiness != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6a2b05a8b4bbec1e38d7e5856bfcbd7f", "score": "0.5980795", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasManagedEBooks() bool {\n\tif o != nil && o.ManagedEBooks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "071fb02c26d2b50ca93b5e0f5be65658", "score": "0.5948769", "text": "func (o *DeviceAppManagement) HasIsEnabledForMicrosoftStoreForBusiness() bool {\n\tif o != nil && o.IsEnabledForMicrosoftStoreForBusiness != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "00587fb05d9b698450bbc9986681ef14", "score": "0.5927906", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasDeployedAppCount() bool {\n\tif o != nil && o.DeployedAppCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6c5226e5601663804126b05b5c471484", "score": "0.591466", "text": "func (o *VirtualizationVmwareDatastoreCluster) HasPolicyEnforcementAutomationMode() bool {\n\tif o != nil && o.PolicyEnforcementAutomationMode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8f949e26bc1cfdb62cf1dc8c613ba740", "score": "0.5892579", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasDefaultManagedAppProtections() bool {\n\tif o != nil && o.DefaultManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "40914f4fd3f4852dffbe4314f845b0f8", "score": "0.58809024", "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": "4d62241e087625c8db4ae710ed7330fc", "score": "0.5861455", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasAppsAllowTrustedAppsSideloading() bool {\n\tif o != nil && o.AppsAllowTrustedAppsSideloading != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fa8d7d3ae5d8ed5d16bf43a86604860f", "score": "0.5833572", "text": "func (o *MicrosoftGraphDeviceAppManagement) GetManagedAppPolicies() []MicrosoftGraphManagedAppPolicy {\n\tif o == nil || o.ManagedAppPolicies == nil {\n\t\tvar ret []MicrosoftGraphManagedAppPolicy\n\t\treturn ret\n\t}\n\treturn *o.ManagedAppPolicies\n}", "title": "" }, { "docid": "9e7fc76a67c0bebf9a35ad38270c72ae", "score": "0.58216214", "text": "func (o *DeviceAppManagement) GetManagedAppPolicies() []MicrosoftGraphManagedAppPolicy {\n\tif o == nil || o.ManagedAppPolicies == nil {\n\t\tvar ret []MicrosoftGraphManagedAppPolicy\n\t\treturn ret\n\t}\n\treturn *o.ManagedAppPolicies\n}", "title": "" }, { "docid": "6199f92fbdb9c71d7c300467ad74eb39", "score": "0.58206534", "text": "func (o *DeviceAppManagement) HasDefaultManagedAppProtections() bool {\n\tif o != nil && o.DefaultManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7d2e0a5109b8142f655e1df08681bd9c", "score": "0.58074737", "text": "func (o *MicrosoftGraphTeamMemberSettings) HasAllowAddRemoveApps() bool {\n\tif o != nil && o.AllowAddRemoveApps != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6ffd79dbc997717f3bc33221e6479ac0", "score": "0.57859004", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasManagedBrowserToOpenLinksRequired() bool {\n\tif o != nil && o.ManagedBrowserToOpenLinksRequired != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "093b43f5116c107486e2e8c6adcdee61", "score": "0.56984144", "text": "func (o *DeviceAppManagement) HasAndroidManagedAppProtections() bool {\n\tif o != nil && o.AndroidManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f2fe994e64da63d38a156cfe6d309bae", "score": "0.56669384", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasIsAssigned() bool {\n\tif o != nil && o.IsAssigned != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b6585226952f396a5154cc529c101d90", "score": "0.56548977", "text": "func (o *InlineObject1) HasApps() bool {\n\tif o != nil && o.Apps != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "feaf994d8141af4f9629fccb70ca5a44", "score": "0.56308836", "text": "func (m *Application) GetAppManagementPolicies()([]AppManagementPolicyable) {\n val, err := m.GetBackingStore().Get(\"appManagementPolicies\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]AppManagementPolicyable)\n }\n return nil\n}", "title": "" }, { "docid": "6b7db857b4d6d6ed7c73b91f3e2fafa0", "score": "0.5616054", "text": "func (o *Policy) HasPolicyNotificationSettings() bool {\n\tif o != nil && o.PolicyNotificationSettings != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f645c31dc041c7e89156e29aa9f40a0d", "score": "0.5601421", "text": "func (o *IdentityCreateUserRequest) HasAuthorizedApplications() bool {\n\tif o != nil && o.AuthorizedApplications != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e72b787a9b5741500c97086c524daab0", "score": "0.5576428", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasAllowedDataStorageLocations() bool {\n\tif o != nil && o.AllowedDataStorageLocations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "afcdbc8d5e405fb49f91ca2c3784ee7e", "score": "0.5550632", "text": "func (o *MicrosoftGraphDeviceAppManagement) SetManagedAppPolicies(v []MicrosoftGraphManagedAppPolicy) {\n\to.ManagedAppPolicies = &v\n}", "title": "" }, { "docid": "21a50f87a39b4ed942c967b7f543ae74", "score": "0.55167603", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasAllowedOutboundDataTransferDestinations() bool {\n\tif o != nil && o.AllowedOutboundDataTransferDestinations != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0afa6675e51b736deba7e592254a626b", "score": "0.5514043", "text": "func (o *SkuRules) HasAllowed() bool {\n\tif o != nil && o.Allowed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f94e47c47b5827fc19f1cbf7f6359aa2", "score": "0.5495496", "text": "func (o *MicrosoftGraphDeviceEnrollmentPlatformRestriction) HasPlatformBlocked() bool {\n\tif o != nil && o.PlatformBlocked != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8057dd88e2a90c14506f5be2b150ca89", "score": "0.5490849", "text": "func (o *StorageDiskGroupPolicyAllOf) HasStoragePolicies() bool {\n\tif o != nil && o.StoragePolicies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e7268a8d18a33cad7c4cb27820c2a833", "score": "0.5479675", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasAssignments() bool {\n\tif o != nil && o.Assignments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4c8818bb7ec48fb239488b3d6b723205", "score": "0.5479571", "text": "func isOrganizationPolicyUnset(d *schema.ResourceData) bool {\n\tlistPolicy := d.Get(\"list_policy\").([]interface{})\n\tbooleanPolicy := d.Get(\"boolean_policy\").([]interface{})\n\trestorePolicy := d.Get(\"restore_policy\").([]interface{})\n\n\treturn len(listPolicy)+len(booleanPolicy)+len(restorePolicy) == 0\n}", "title": "" }, { "docid": "bb8213a49cec6c54afc6e09840827eca", "score": "0.5471117", "text": "func (o *HyperflexClusterBackupPolicyInventoryAllOf) HasPolicyMoid() bool {\n\tif o != nil && o.PolicyMoid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "32e53c9e35099f0b2113c489cf4786d7", "score": "0.5462002", "text": "func (o *Permission) HasApplication() bool {\n\tif o != nil && o.Application != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b8628c850536ab6b94f735dd68cfe6e1", "score": "0.5455484", "text": "func (o *IamLdapPolicy) HasProviders() bool {\n\tif o != nil && o.Providers != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7c581e467964db328c9772bcae0e554b", "score": "0.54542655", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasAppsBlockWindowsStoreOriginatedApps() bool {\n\tif o != nil && o.AppsBlockWindowsStoreOriginatedApps != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f8bdc11c7c757ba89b46717f205cf230", "score": "0.54516953", "text": "func (o *DeviceAppManagement) SetManagedAppPolicies(v []MicrosoftGraphManagedAppPolicy) {\n\to.ManagedAppPolicies = &v\n}", "title": "" }, { "docid": "12396776c7b909a6098b646af12f5906", "score": "0.54310566", "text": "func (m *Manageable) GetManagementPolicies() xpv1.ManagementPolicies { return m.Policy }", "title": "" }, { "docid": "3502327587c1540a2a5783a1dcf2609d", "score": "0.5422401", "text": "func (o *WafTrafficV2) HasPolicyWhitelisted() bool {\n\tif o != nil && o.PolicyWhitelisted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "58f1b36f1ec52a788c48995fdeca5577", "score": "0.5413846", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasAndroidManagedAppProtections() bool {\n\tif o != nil && o.AndroidManagedAppProtections != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5dbbfb8de394c5d61888b40dcedf2d9c", "score": "0.53849727", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasAllowedInboundDataTransferSources() bool {\n\tif o != nil && o.AllowedInboundDataTransferSources != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cdf42a1428ec504fcbacc5a05c7d17aa", "score": "0.53826773", "text": "func (o *UpdateCustomer) HasCorporate() bool {\n\tif o != nil && !IsNil(o.Corporate) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6f2b78ddcbd8a9fd7a73f07833f32724", "score": "0.53780854", "text": "func (o *Item) HasConsentedProducts() bool {\n\tif o != nil && o.ConsentedProducts != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8cb2e2aa35101536c73fac3aca058036", "score": "0.5348768", "text": "func (o *DeviceAppManagement) HasVppTokens() bool {\n\tif o != nil && o.VppTokens != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "646e1ba077ffdd60be0e2bceb263166b", "score": "0.5347339", "text": "func (o *PolicySpec) HasPolicyNotificationSettings() bool {\n\tif o != nil && o.PolicyNotificationSettings != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "27a29a54459b9986379b763002496f21", "score": "0.5340752", "text": "func (o *MicrosoftGraphManagedDeviceOverview) HasMdmEnrolledCount() bool {\n\tif o != nil && o.MdmEnrolledCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0ca192e9c50f2e52af7c07c34e0199d0", "score": "0.5335406", "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": "08fbd2e47e52a579bd91ba09880214d3", "score": "0.5335232", "text": "func (o *System) HasEntitlementCount() bool {\n\tif o != nil && !IsNil(o.EntitlementCount) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "82d075afbccade5f4a2d9dd3253d09d8", "score": "0.53305244", "text": "func (o *PolicyConfigChangeAllOf) HasPolicyDisruptions() bool {\n\tif o != nil && o.PolicyDisruptions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6843a3b3978b5ad609bd985501511b0d", "score": "0.53235805", "text": "func (pad *PodAnnotationData) HasPolicyViolations() bool {\n\treturn pad.policyViolationCount > 0\n}", "title": "" }, { "docid": "91512a6ed12bb275cf30c4c889fafcd5", "score": "0.5312528", "text": "func (o *ModelsAuthorizerResponse) HasAllow() bool {\n\tif o != nil && o.Allow != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aba529ad101a3eb06ef9972214ecadd6", "score": "0.5307767", "text": "func (o *Policy) HasEmbeddedResources() bool {\n\tif o != nil && o.EmbeddedResources != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "61b2085f92c56ef6a1bfd076b5655579", "score": "0.5303755", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasVppTokens() bool {\n\tif o != nil && o.VppTokens != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e66bb81addda45a75488b1058381a548", "score": "0.53005916", "text": "func (o *MicrosoftGraphSharedPcAccountManagerPolicy) HasAccountDeletionPolicy() bool {\n\tif o != nil && o.AccountDeletionPolicy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5f118bbc44de397ac9eb61fa35acd6a7", "score": "0.5299571", "text": "func (o *IamSystem) HasPrivilegeSets() bool {\n\tif o != nil && o.PrivilegeSets != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "68659b3a1da2002463f3413ca358b0d7", "score": "0.5297503", "text": "func (m *WindowsIdentityProtectionConfiguration) GetUseCertificatesForOnPremisesAuthEnabled()(*bool) {\n val, err := m.GetBackingStore().Get(\"useCertificatesForOnPremisesAuthEnabled\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "153fa6dc41984941ec0507aba3da9e71", "score": "0.5285662", "text": "func (o *AzureMonitor) HasAppSecret() bool {\n\tif o != nil && o.AppSecret != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "35546162ca1d6b27e3eb82f2fa7225a0", "score": "0.5255601", "text": "func (o *JsonV1ObjectMeta) HasManagedFields() bool {\n\tif o != nil && o.ManagedFields != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "95108b1288de8ede0196a5213b52e514", "score": "0.5246968", "text": "func (o *MicrosoftGraphDeviceEnrollmentPlatformRestriction) HasPersonalDeviceEnrollmentBlocked() bool {\n\tif o != nil && o.PersonalDeviceEnrollmentBlocked != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "54939944093221f71403d43c21496192", "score": "0.52464294", "text": "func (o *ModelsBackup) HasReclaimPolicy() bool {\n\tif o != nil && o.ReclaimPolicy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "58cee2f550ada52c3f18828d8eff07d6", "score": "0.5229969", "text": "func (m *IosKerberosSingleSignOnExtension) GetManagedAppsInBundleIdACLIncluded()(*bool) {\n val, err := m.GetBackingStore().Get(\"managedAppsInBundleIdACLIncluded\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "cfbbc957614e90ec3fd5247ce58a6fb4", "score": "0.51992923", "text": "func (s *Service) IsManaged(ctx context.Context) (bool, error) {\n\treturn true, nil\n}", "title": "" }, { "docid": "91aab293fb41fcfb7afe0fbcec04b2d1", "score": "0.5196587", "text": "func (o *Customer) HasCorporate() bool {\n\tif o != nil && !IsNil(o.Corporate) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c37b45314567c3561565258e0c914899", "score": "0.51917934", "text": "func HasManage() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ManageTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, true, ManageTable, ManageColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "bb33bfa7caa40c128c968ddb102c6181", "score": "0.51798767", "text": "func (o *StorageNetAppIpInterface) HasServicePolicyName() bool {\n\tif o != nil && o.ServicePolicyName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6dc81513cce03b5279fd3536fba51742", "score": "0.5168473", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasOrganizationalCredentialsRequired() bool {\n\tif o != nil && o.OrganizationalCredentialsRequired != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c616956f79d4d80d8c242517c0bfa5f", "score": "0.5167267", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasPeriodOnlineBeforeAccessCheck() bool {\n\tif o != nil && o.PeriodOnlineBeforeAccessCheck != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd416cbcd7c3cafe64a363f9cca02ede", "score": "0.5152616", "text": "func (m *ServicePrincipalItemRequestBuilder) AppManagementPolicies()(*ItemAppManagementPoliciesRequestBuilder) {\n return NewItemAppManagementPoliciesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "86aeed1735e745cde2900a1fa6b09dc0", "score": "0.5146035", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasWindowsStoreEnablePrivateStoreOnly() bool {\n\tif o != nil && o.WindowsStoreEnablePrivateStoreOnly != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a22e9fef55a918a2e79a37107feab18d", "score": "0.5144702", "text": "func (o *Policy) HasExcludedItems() bool {\n\tif o != nil && o.ExcludedItems != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fa12092060d80688407255d656fc0eb8", "score": "0.51446915", "text": "func (d *DeploymentController) canManage(gvr schema.GroupVersionResource, name, namespace string) (bool, string) {\n\tstore, f := d.clients[gvr]\n\tif !f {\n\t\tlog.Warnf(\"unknown GVR %v\", gvr)\n\t\t// Even though we don't know what it is, allow users to put the resource. We won't be able to\n\t\t// protect against overwrites though.\n\t\treturn true, \"\"\n\t}\n\tobj := store.Get(name, namespace)\n\tif obj == nil {\n\t\t// no object, we can manage it\n\t\treturn true, \"\"\n\t}\n\t_, managed := obj.GetLabels()[constants.ManagedGatewayLabel]\n\t// If object already exists, we can only manage it if it has the label\n\treturn managed, obj.GetResourceVersion()\n}", "title": "" }, { "docid": "c8b00e82225ad0dab62d5697263b30bc", "score": "0.5135128", "text": "func (o *CondHclStatus) HasManagedObject() bool {\n\tif o != nil && o.ManagedObject != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1449945c364d5335c5953cd7b881a0d2", "score": "0.5097664", "text": "func (o *MicrosoftGraphManagedDeviceOverview) HasEnrolledDeviceCount() bool {\n\tif o != nil && o.EnrolledDeviceCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5a713d9e73abc547be3dc8219863cfea", "score": "0.5091312", "text": "func (ath *Authorization) HasAdminScope() bool {\n\treturn strings.Contains(ath.Scope, ScopeAPIAdmin)\n}", "title": "" }, { "docid": "2e726f35949457c215f2e3904bedab7c", "score": "0.50877994", "text": "func (o *IamLdapPolicy) HasEnabled() bool {\n\tif o != nil && o.Enabled != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8da5a6edcecc79173c27523ad0e0896f", "score": "0.50773925", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasSharedUserAppDataAllowed() bool {\n\tif o != nil && o.SharedUserAppDataAllowed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "241c9d20fc6e51ceeb2256f6cef65896", "score": "0.50663227", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasSettingsBlockSettingsApp() bool {\n\tif o != nil && o.SettingsBlockSettingsApp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9555be94d225658c6dd53ba7ce873087", "score": "0.5062561", "text": "func (o *MicrosoftGraphDeviceAppManagement) HasMicrosoftStoreForBusinessLanguage() bool {\n\tif o != nil && o.MicrosoftStoreForBusinessLanguage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "acd6acbaadb3abbd3a998aa4c1944aac", "score": "0.50622994", "text": "func HasManagedByLabel(obj *unstructured.Unstructured) bool {\n\tval := GetLabel(obj, LabelManagedBy)\n\tif isComputedValue(val) {\n\t\treturn true\n\t}\n\t// now we should check to see if the user has specified a label via EnvVar\n\t// we should also check to see if that value is the same as what is in the metadata\n\tlabelVal, exists := os.LookupEnv(\"PULUMI_KUBERNETES_MANAGED_BY_LABEL\")\n\tif exists {\n\t\treturn labelVal == val.(string)\n\t}\n\tstr, ok := val.(string)\n\treturn ok && str == \"pulumi\"\n}", "title": "" }, { "docid": "114f4435797f491704bc40b935971fa3", "score": "0.50603503", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasSaveAsBlocked() bool {\n\tif o != nil && o.SaveAsBlocked != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8e28882ccd09e8f0d5a78b8818747154", "score": "0.5051059", "text": "func (o *MicrosoftGraphIosManagedAppProtection) HasDisableAppPinIfDevicePinIsSet() bool {\n\tif o != nil && o.DisableAppPinIfDevicePinIsSet != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "557151bb34cc349dfaffb33549d3139c", "score": "0.5049052", "text": "func (o *Policy) HasLinks() bool {\n\tif o != nil && o.Links != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7f569e58ac85c0a94e4741b96452b84a", "score": "0.50451714", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasSettingsBlockAppsPage() bool {\n\tif o != nil && o.SettingsBlockAppsPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "daeaf4f089088d70b412341a06f56048", "score": "0.50426847", "text": "func (o *OAuthAppWithOwnerLogin) HasOwnerLogin() bool {\n\tif o != nil && o.OwnerLogin != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c87433a2077f9d249274853747472be1", "score": "0.5041236", "text": "func (o *PolicyinventoryJobInfoAllOf) HasPolicyName() bool {\n\tif o != nil && o.PolicyName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aac4784d7aaf8e566a16a429e0d8d980", "score": "0.5039754", "text": "func (o *MicrosoftGraphWindows10GeneralConfiguration) HasPrivacyAutoAcceptPairingAndConsentPrompts() bool {\n\tif o != nil && o.PrivacyAutoAcceptPairingAndConsentPrompts != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
9bf1922794e5f6f8edb7d805d5076984
The approximate frames per second
[ { "docid": "75bad2068e404ad9232ff5b307e87f6d", "score": "0.66860116", "text": "func (t Timer) FPS() int {\n\treturn t.fps\n}", "title": "" } ]
[ { "docid": "13e344b4a2237997cfcc5de8bf6779bf", "score": "0.72259307", "text": "func FramesElapsed() int {\n\treturn framesElapsed\n}", "title": "" }, { "docid": "79491cd067e1b5d943b430d7c7c76488", "score": "0.6788058", "text": "func (c *Clock) FrameRate() float64 {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\n\t// If the application stalled and stopped calling Tick as it should, we\n\t// should report near-zero FPS. To do this we consider the fact that more\n\t// than one second has passed and recalculate the FPS right now if so.\n\tdelta := getTime() - c.lastFrameTime\n\tif delta > time.Second {\n\t\treturn float64(time.Second / delta)\n\t}\n\treturn c.frameRate\n}", "title": "" }, { "docid": "220c14b176f2737e8ab3932fc629984c", "score": "0.6600797", "text": "func (c *Clock) Tick() {\n\tc.access.Lock()\n\tdefer c.access.Unlock()\n\n\tfirstFrame := false\n\tif c.frameCount == 0 {\n\t\tfirstFrame = true\n\t\tc.frameCount = 1\n\t}\n\n\tframeStartTime := getTime()\n\n\t// Frames per second\n\tcalcFrameRate := func() {\n\t\t// Calculate time difference between this frame and the last frame\n\t\tc.delta = getTime() - c.lastFrameTime\n\t\tif c.delta > 0 {\n\t\t\tc.frameRate = float64(time.Second / c.delta)\n\t\t}\n\t}\n\n\t// We need to calculate the frame rate and delta times right now, because\n\t// we use them when considering how long to sleep for in the event we have\n\t// an maximum frame rate.\n\tcalcFrameRate()\n\n\tif c.maxFrameRate > 0 {\n\t\tif c.frameRate > c.maxFrameRate {\n\t\t\t// Sleep long enough that we stay under the max frame rate.\n\t\t\ttimeToSleep := time.Duration(float64(time.Second)/c.maxFrameRate) - c.delta\n\n\t\t\t// Sleep in small increments to get near-perfect.\n\t\t\tinc := 128\n\t\t\tfor i := 0; i < inc; i++ {\n\t\t\t\t// Sleep for one increment and then recheck the frame-rate to\n\t\t\t\t// determine if more sleeping is needed.\n\t\t\t\ttime.Sleep(timeToSleep / time.Duration(inc))\n\t\t\t\tcalcFrameRate()\n\t\t\t\tif c.frameRate <= c.maxFrameRate {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Update the average samples\n\tfor i, sample := range c.avgSamples {\n\t\tif i-1 >= 0 {\n\t\t\tc.avgSamples[i-1] = sample\n\t\t}\n\t}\n\tc.avgSamples[len(c.avgSamples)-1] = c.delta.Seconds()\n\n\t// Calculate the average frame rate.\n\tc.avgFrameRate = 0\n\tfor _, sample := range c.avgSamples {\n\t\tc.avgFrameRate += sample\n\t}\n\tc.avgFrameRate /= float64(len(c.avgSamples))\n\n\t// Store for calculation deviation further down\n\tavgFrameRateDelta := c.avgFrameRate\n\n\t// Convert to frames per second\n\tc.avgFrameRate = 1.0 / c.avgFrameRate\n\n\t// Calculate the standard deviation of frame times\n\tvariance := 0.0\n\tfor i, sample := range c.avgSamples {\n\t\tif i < len(c.avgSamples)-1 {\n\t\t\tdiff := sample - avgFrameRateDelta\n\t\t\tvariance += (diff * diff)\n\t\t}\n\t}\n\tc.frameRateDeviation = math.Sqrt(variance / float64(len(c.avgSamples)))\n\n\tc.lastFrameTime = frameStartTime\n\n\tif !firstFrame {\n\t\tc.frameCount++\n\t}\n}", "title": "" }, { "docid": "2047879ff02dbbcf50a3ac848b0228db", "score": "0.6539804", "text": "func (f *simpleTracker) FPS() int {\n\treturn f.framesLastSecond\n}", "title": "" }, { "docid": "d6173bcc47d92e92cfcffd2e652806ff", "score": "0.6488177", "text": "func (ticker *Ticker) Tick() (deltat, framerate float64) {\n\tticker.deltat = time.Since(ticker.last).Seconds()\n\tticker.last = time.Now()\n\n\tif ticker.frametime >= 1 {\n\t\tticker.totalFrames += int64(ticker.frames)\n\t\tticker.totalFrametime += ticker.frametime\n\n\t\tticker.frametime = 0\n\t\tticker.frames = 0\n\t} else {\n\t\tticker.frames++\n\t\tticker.frametime += ticker.deltat\n\t}\n\n\tif ticker.frametime == 0 {\n\t\tticker.avgFramerate = float64(ticker.totalFrames) / ticker.totalFrametime\n\t\tticker.framerate = ticker.avgFramerate\n\t} else {\n\t\tticker.framerate = float64(ticker.frames) / ticker.frametime\n\t}\n\n\tif ticker.storePrev {\n\t\tif ticker.prevFPSOffset == MAX_PREV_FPS {\n\t\t\tticker.prevFPSOffset = 0\n\t\t}\n\n\t\tticker.prevFPS[ticker.prevFPSOffset] = float32(ticker.framerate)\n\t\tticker.prevFPSOffset++\n\t}\n\n\treturn ticker.deltat, ticker.framerate\n}", "title": "" }, { "docid": "11cc2e5774bf4fbac5bc6f8f288dc405", "score": "0.6209545", "text": "func (f *simpleTracker) Framerate() float32 {\n\tif f.framesLastSecond == 0 {\n\t\treturn -1\n\t}\n\treturn 1000 / float32(f.framesLastSecond)\n}", "title": "" }, { "docid": "019723ddd4b84d40795983d86b488394", "score": "0.6196311", "text": "func (s *Sync) Fps() fixed.F8 {\n\treturn s.mainClock.Div(s.frameCycles)\n}", "title": "" }, { "docid": "dee0c6ecab8b1771ec57d79253670f63", "score": "0.6162301", "text": "func totalFrames(zoomFactor, finalWidth float64) (frames int) {\n\tfor curZoom := 4.0; curZoom >= finalWidth; frames++ {\n\t\tcurZoom = 4.0 / math.Pow(zoomFactor, float64(frames))\n\t}\n\treturn\n}", "title": "" }, { "docid": "a15ccd4413a22fc6a0f5054dd77c7452", "score": "0.6158239", "text": "func (c *Clock) AvgFrameRate() float64 {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\n\treturn c.avgFrameRate\n}", "title": "" }, { "docid": "4800b7048b3f84a3fc78e6aaa8502201", "score": "0.60936433", "text": "func CurrentFPS() float64 {\n\treturn fps\n}", "title": "" }, { "docid": "3ba75bc71af930aa647ee53aa6591172", "score": "0.6069068", "text": "func (b Datarate) GigabitsPerSecond() float64 {\n\treturn float64(b / GigabitPerSecond)\n}", "title": "" }, { "docid": "6888f5f54a060758b86d790fc7f1d1dd", "score": "0.6029656", "text": "func (wnd *Window) FPS() float32 {\n\treturn wnd.fps\n}", "title": "" }, { "docid": "10ff7f29e488114598938b4a8e9de9e9", "score": "0.6004881", "text": "func currentMs() uint32 { return uint32(time.Since(refTime) / time.Millisecond) }", "title": "" }, { "docid": "8ee6b39b32c613ed70e44a61838d7bcc", "score": "0.5998853", "text": "func (ticker Ticker) Framerate() float64 {\n\treturn ticker.framerate\n}", "title": "" }, { "docid": "d16b21a86d52318ab795debd4e120945", "score": "0.5912652", "text": "func currentMs() uint32 { return uint32(tsc.UnixNano() / int64(time.Millisecond)) }", "title": "" }, { "docid": "4b9d354157d85d9a772b018f997146fc", "score": "0.58164513", "text": "func (a EWMAXSnapshot) Rate() float64 { return float64(a) }", "title": "" }, { "docid": "214523b29796be8d4e2fabbe1a3b3060", "score": "0.5813296", "text": "func (ticker Ticker) AvgFramerate() float64 {\n\treturn ticker.avgFramerate\n}", "title": "" }, { "docid": "f094a8c7d6f81e50df0a8f123445c33a", "score": "0.5766071", "text": "func (b Datarate) GibibitsPerSecond() float64 {\n\treturn float64(b / GibibitPerSecond)\n}", "title": "" }, { "docid": "e57afbda3fc86324a385c831ef559eb0", "score": "0.5760725", "text": "func (b Datarate) BytesPerSecond() float64 {\n\treturn float64(b / BytePerSecond)\n}", "title": "" }, { "docid": "a30100547b0d33b69bb2b24205d7d033", "score": "0.57147384", "text": "func (tm *ThroughputMetric) Rate() int64 {\n\tif tm.Bytes == 0 {\n\t\treturn 0\n\t}\n\treturn int64((float64(tm.Bytes) / float64(tm.WorkDuration+tm.IdleDuration)) *\n\t\tfloat64(time.Second))\n}", "title": "" }, { "docid": "0524a8383d7087a45af9848a4e3ecdb4", "score": "0.57052994", "text": "func (iri *InterlaceRepeatedInfo) Frames() int { return iri.Neither + iri.Top + iri.Bottom }", "title": "" }, { "docid": "71ba636999353d87bb76ab54bd3f297c", "score": "0.56453717", "text": "func (c *Clock) FrameCount() uint64 {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\n\treturn c.frameCount\n}", "title": "" }, { "docid": "bebdfdd849b7e05821a5a350086edcb2", "score": "0.56284606", "text": "func (p *Player) Current() time.Duration {\n\tsample := int64(0)\n\tp.sync(func() {\n\t\tsample = p.pos / bytesPerSample / channelNum\n\t})\n\treturn time.Duration(sample) * time.Second / time.Duration(p.sampleRate)\n}", "title": "" }, { "docid": "c928e6b20352d686023f004db6cc30d8", "score": "0.56159633", "text": "func rate(d time.Duration, precision time.Duration) float64 {\n\treturn float64(precision) / float64(d)\n}", "title": "" }, { "docid": "399192f3471751e66e7bd38f02b70d29", "score": "0.5590852", "text": "func (b Datarate) MebibitsPerSecond() float64 {\n\treturn float64(b / MebibitPerSecond)\n}", "title": "" }, { "docid": "967149f986d7633e400103a4546e7258", "score": "0.5577717", "text": "func (c *Clock) MaxFrameRate() float64 {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\n\treturn c.maxFrameRate\n}", "title": "" }, { "docid": "daa26e3df309e2961acb9ae6135392c9", "score": "0.5563668", "text": "func (glw *Glw) GetFPS () int {\n\treturn glw.fps\n}", "title": "" }, { "docid": "0d31bcc7602b7ad9e5c16d96a92e40ac", "score": "0.5563568", "text": "func Update() {\n\t// Calculate current time\n\tcurrentTime = getCurrentTime()\n\n\t// Calculate current delta time\n\tvar delta float32 = currentTime - startTime\n\n\t// Store the time elapsed since the last frame began\n\taccumulator += delta\n\n\t// Fixed time stepping loop\n\tfor accumulator >= deltaTime {\n\t\tstep()\n\t\taccumulator -= deltaTime\n\t}\n\n\t// Record the starting of this frame\n\tstartTime = currentTime\n}", "title": "" }, { "docid": "a4c66f295480caf20a0047455dcbc1bc", "score": "0.55581975", "text": "func (b Datarate) MegabitsPerSecond() float64 {\n\treturn float64(b / MegabitPerSecond)\n}", "title": "" }, { "docid": "269c64f412708862450b817ed5ac89db", "score": "0.5548362", "text": "func (memoryFs) Precision() time.Duration { return time.Nanosecond }", "title": "" }, { "docid": "60d10bef33e46e6cbb2ebeb7fa1e4343", "score": "0.5539579", "text": "func (b Datarate) GibibytesPerSecond() float64 {\n\treturn float64(b / GibibytePerSecond)\n}", "title": "" }, { "docid": "bda13d1c3b3a1af50e3768d9ab3bb18b", "score": "0.5537038", "text": "func (t CPUTimes) Delta() float64 {\n\t// fmt.Printf(\"CurOnCPU: %d PrevOnCPU: %d CurWT: %d PrevWT: %d\\n\",\n\t// t.CurrentOnCPUTime, t.PrevOnCPUTime,\n\t// t.CurrentRunTime, t.PrevRunTime)\n\treturn float64(t.CurrentOnCPUTime-t.PrevOnCPUTime) / float64(t.CurrentRunTime-t.PrevRunTime)\n}", "title": "" }, { "docid": "4350cd0700c08d5e4c1cfc08d24d97ab", "score": "0.5511765", "text": "func (d *CodecDescriptor) CodecFrameSamplesCalculate() int64 {\n\treturn int64(d.ChannelCount) * CODEC_FRAME_TIME_BASE * int64(d.SamplingRate) / 1000\n}", "title": "" }, { "docid": "0ee97b3d9d10acaa2cd5e8833fe8bc6a", "score": "0.5501659", "text": "func runtimeNano() int64", "title": "" }, { "docid": "0ee97b3d9d10acaa2cd5e8833fe8bc6a", "score": "0.5501659", "text": "func runtimeNano() int64", "title": "" }, { "docid": "99504fdbeeaf27215c92286daf95c15d", "score": "0.5497869", "text": "func ms(t time.Time) int64 {\n\treturn t.UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "7ff1d0648359c5c76f5acfb5b72477ef", "score": "0.5494747", "text": "func (b Datarate) BitsPerSecond() float64 {\n\treturn float64(b)\n}", "title": "" }, { "docid": "5538283709db03954ca4bb9ee69fdc9c", "score": "0.5485987", "text": "func msSince(start time.Time) float64 {\n\treturn float64(time.Since(start) / time.Millisecond)\n}", "title": "" }, { "docid": "e587d0e11fbb1f6573ccf696cf8b27c5", "score": "0.5461102", "text": "func tickspersecond() int64 {\n\tr := ticks.val.Load()\n\tif r != 0 {\n\t\treturn r\n\t}\n\tlock(&ticks.lock)\n\tr = ticks.val.Load()\n\tif r == 0 {\n\t\tt0 := nanotime()\n\t\tc0 := cputicks()\n\t\tusleep(100 * 1000)\n\t\tt1 := nanotime()\n\t\tc1 := cputicks()\n\t\tif t1 == t0 {\n\t\t\tt1++\n\t\t}\n\t\tr = (c1 - c0) * 1000 * 1000 * 1000 / (t1 - t0)\n\t\tif r == 0 {\n\t\t\tr++\n\t\t}\n\t\tticks.val.Store(r)\n\t}\n\tunlock(&ticks.lock)\n\treturn r\n}", "title": "" }, { "docid": "8eb1e55392d085d5b8d4e4a17ef2738b", "score": "0.5458033", "text": "func (_this *MediaRecorder) VideoBitsPerSecond() uint {\n\tvar ret uint\n\tvalue := _this.Value_JS.Get(\"videoBitsPerSecond\")\n\tret = (uint)((value).Int())\n\treturn ret\n}", "title": "" }, { "docid": "3f882b494586a5720f9918a714259af2", "score": "0.545536", "text": "func (tem *TimeEstimationManager) getSpeed() float64 {\n\t// Convert from bytes/ms to MB/s\n\treturn tem.SpeedsAverage * bytesPerMilliSecToMBPerSec\n}", "title": "" }, { "docid": "dd8c437a763f9f3d37619b10b5de3f4e", "score": "0.54553187", "text": "func (s Stm) ElapsedRatio(base int) float64 {\n\treturn float64(s.count) / float64(base)\n}", "title": "" }, { "docid": "3257fb4d1f83e04973b607b67624b339", "score": "0.5448412", "text": "func getCurrentTime() float32 {\n\treturn float32(getTimeCount()) / float32(frequency) * 1000\n}", "title": "" }, { "docid": "438324dddb702d82e4c4f1d966c0ab32", "score": "0.5445482", "text": "func (t Duration) Gigaseconds() float64 {\n\treturn float64(t / Gigasecond)\n}", "title": "" }, { "docid": "7ba935df50a5145ad333d178a3e8f183", "score": "0.54263645", "text": "func (n *Network) pktTime(b int) time.Duration {\n\tif n.Kbps <= 0 {\n\t\treturn time.Duration(0)\n\t}\n\treturn time.Duration(b) * time.Second / time.Duration(n.Kbps*(1024/8))\n}", "title": "" }, { "docid": "575a709a41eaa2119894f5c6014ba433", "score": "0.5424371", "text": "func (b Datarate) YottabitsPerSecond() float64 {\n\treturn float64(b / YottabitPerSecond)\n}", "title": "" }, { "docid": "1f25ea7016b4eec5d85000f5ea73e9e2", "score": "0.5421231", "text": "func (b Datarate) YottabytesPerSecond() float64 {\n\treturn float64(b / YottabytePerSecond)\n}", "title": "" }, { "docid": "53ff42c88641dbc10c8ad3d76b53bee0", "score": "0.5415138", "text": "func reportFPS(p *perf.Values, name, logPath string) error {\n\tb, err := ioutil.ReadFile(logPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to read file\")\n\t}\n\n\tregExpFPS := regexp.MustCompile(`(?m)^\\[LOG\\] Measured decoder FPS: ([+\\-]?[0-9.]+)$`)\n\tmatches := regExpFPS.FindAllStringSubmatch(string(b), -1)\n\tif len(matches) != 1 {\n\t\treturn errors.Errorf(\"found %d FPS matches in %v; want 1\", len(matches), filepath.Base(logPath))\n\t}\n\n\tfps, err := strconv.ParseFloat(matches[0][1], 64)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to parse FPS value %q\", matches[0][1])\n\t}\n\n\tp.Set(perf.Metric{\n\t\tName: fmt.Sprintf(\"tast_%s.fps\", name),\n\t\tUnit: \"fps\",\n\t\tDirection: perf.BiggerIsBetter,\n\t}, fps)\n\treturn nil\n}", "title": "" }, { "docid": "75d0688f0ce4c89adcb881852c4f8ebb", "score": "0.5413053", "text": "func now() float64 {\n\treturn float64(time.Now().UnixNano()) / 1e9\n}", "title": "" }, { "docid": "5ed44f6d79c5c36483221f2dd2143a44", "score": "0.54115486", "text": "func (b Datarate) PebibitsPerSecond() float64 {\n\treturn float64(b / PebibitPerSecond)\n}", "title": "" }, { "docid": "5da1954341a166b831b46a6ff551e5a4", "score": "0.54060245", "text": "func (b Datarate) PebibytesPerSecond() float64 {\n\treturn float64(b / PebibytePerSecond)\n}", "title": "" }, { "docid": "558d53f2b1877d795465a23742c8c9de", "score": "0.54017365", "text": "func (ticker Ticker) PrevFramerates() []float32 {\n\treturn ticker.prevFPS\n}", "title": "" }, { "docid": "5eacee66b4fda309cb45aa194818c175", "score": "0.53814894", "text": "func (timer *Timer) Tick() float64 {\n\tt := time.Now().UnixNano()\n\tdt := t - timer.t0\n\tif dt <= 0 {\n\t\treturn 0\n\t}\n\trate := 1.0e9 / float64(dt)\n\ttimer.t0 = t\n\ttimer.Rate = (0.0*timer.Rate + 1.0*rate)\n\treturn timer.Rate\n}", "title": "" }, { "docid": "1a368e396904490eb76db69169f791da", "score": "0.5380264", "text": "func (c *ChromeAnimation) GetPlaybackRate() (float64, error) {\n recvCh, _ := sendCustomReturn(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"Animation.getPlaybackRate\"})\n resp := <-recvCh\n\n var chromeData struct {\n Result struct { \n PlaybackRate float64 \n }\n }\n\n err := json.Unmarshal(resp.Data, &chromeData)\n if err != nil {\n cerr := &ChromeErrorResponse{}\n chromeError := json.Unmarshal(resp.Data, cerr)\n if chromeError == nil && cerr.Error != nil {\n return 0, &ChromeRequestErr{Resp: cerr}\n }\n return 0, err\n }\n\n return chromeData.Result.PlaybackRate, nil\n}", "title": "" }, { "docid": "d572a2cbe94574b48862945a6e202cb2", "score": "0.5375086", "text": "func (ticker Ticker) TargetFrametime() time.Duration {\n\treturn ticker.targetFrametime\n}", "title": "" }, { "docid": "768fa1f44baf14d9f6be906d7b2cc73f", "score": "0.5372741", "text": "func (g *GifGenerator) Speed(speed float64) {\n\tg.speed = speed\n}", "title": "" }, { "docid": "d7a87b4e9e8a9b78f7ea895b5bb3b2d4", "score": "0.5366091", "text": "func (c *FPSCounter) NextFrame() {\n\tc.frames[c.ticks % len(c.frames)]++\n}", "title": "" }, { "docid": "1bc3e670646b6a72322dfbb88846aaa7", "score": "0.5364673", "text": "func (s *Sample) Rate() int64 {\n\treturn int64(float64(s.JobMsgCnt) / s.Duration().Seconds())\n}", "title": "" }, { "docid": "a733231cb076f10944ee59ce331f9b5c", "score": "0.5362198", "text": "func GetSpeed() uint32 {\n\tlastPacketTimeLocker.Lock()\n\tif last10PacketTime == 0 {\n\t\tlast10PacketTime = 1\n\t}\n\tret := (last10PacketSize / last10PacketTime) * 1000\n\tlastPacketTimeLocker.Unlock()\n\treturn ret\n\t// return uint64(finish)\n}", "title": "" }, { "docid": "26f27de765dc7fdf85a1ef5b53aace37", "score": "0.5353851", "text": "func (b Datarate) MebibytesPerSecond() float64 {\n\treturn float64(b / MebibytePerSecond)\n}", "title": "" }, { "docid": "c66c5b73094f78bf07076cf9ad3e63e8", "score": "0.5336215", "text": "func (ts *timeseries) rate() float64 {\n\tdeltaTime := ts.headTime().Sub(ts.tailTime()).Seconds()\n\tif deltaTime == 0 {\n\t\treturn 0\n\t}\n\treturn float64(ts.delta()) / deltaTime\n}", "title": "" }, { "docid": "232fe937c814bcb66f55ae4c9278bc71", "score": "0.53295577", "text": "func getRequestRate(success, failure uint64, timeWindow string) float64 {\n\twindowLength, err := time.ParseDuration(timeWindow)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn 0.0\n\t}\n\treturn float64(success+failure) / windowLength.Seconds()\n}", "title": "" }, { "docid": "ae78dcc634e0f525b0fc958338b118ee", "score": "0.5324536", "text": "func timeElapsedSince(start time.Time) int64 {\n\treturn time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds()\n}", "title": "" }, { "docid": "31f9c0b8f87271f87a32a4fa94cbb135", "score": "0.5323624", "text": "func (c *Client) EstimatedDisplayFps() (prop interface{}, err error) {\n\treturn c.GetProperty(\"estimated-display-fps\")\n}", "title": "" }, { "docid": "aa9adbc195c47666dd925ba18272a2c2", "score": "0.5322969", "text": "func calcTime(startTime time.Time) (float64){\n return float64(time.Now().UnixNano() - startTime.UnixNano()) / 1000000000\n}", "title": "" }, { "docid": "115b61fae5888acbd6285fc23f02bc66", "score": "0.5320986", "text": "func (s *Sample) Throughput() float64 {\n\treturn float64(s.MsgBytes) / s.Duration().Seconds()\n}", "title": "" }, { "docid": "3fe3b7ffd309d949ea7c2a6e0f669b16", "score": "0.53169864", "text": "func (b Datarate) YobibytesPerSecond() float64 {\n\treturn float64(b / YobibytePerSecond)\n}", "title": "" }, { "docid": "7f47a75b576a2f587b4045586913f292", "score": "0.52894384", "text": "func ms(d time.Duration) int {\n\treturn int(d / time.Millisecond)\n}", "title": "" }, { "docid": "722ed2bd5913ef71168e961ce3b01c10", "score": "0.52872765", "text": "func samplePeriod(factor, multiplier int) time.Duration {\n\tif sps := sampleRate(factor, multiplier); sps > 0.0 {\n\t\treturn time.Duration(float64(time.Second) / sps)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "369438a86a4c1df180056b80201a1ee8", "score": "0.5262444", "text": "func (b Frame) NumSamples() int {\n\treturn b.Channel(0).NumSamples()\n}", "title": "" }, { "docid": "bc0481bb1c5c409b50d8c495ad2ef345", "score": "0.5260478", "text": "func (_this *MediaRecorder) AudioBitsPerSecond() uint {\n\tvar ret uint\n\tvalue := _this.Value_JS.Get(\"audioBitsPerSecond\")\n\tret = (uint)((value).Int())\n\treturn ret\n}", "title": "" }, { "docid": "8ec9f028f3b0d3462ad93a115711c0b4", "score": "0.5259949", "text": "func (b Datarate) YobibitsPerSecond() float64 {\n\treturn float64(b / YobibitPerSecond)\n}", "title": "" }, { "docid": "cb7c2ef525b27ef667b372814d6de755", "score": "0.5253485", "text": "func (b Datarate) PetabytesPerSecond() float64 {\n\treturn float64(b / PetabytePerSecond)\n}", "title": "" }, { "docid": "c0bf24a4eba4db91adf88c1189407807", "score": "0.52518463", "text": "func (c *Clock) FrameRateDeviation() float64 {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\n\treturn c.frameRateDeviation\n}", "title": "" }, { "docid": "fab30756f65d0c32a893ba14426e98b2", "score": "0.52466017", "text": "func (b Datarate) TebibitsPerSecond() float64 {\n\treturn float64(b / TebibitPerSecond)\n}", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "9ed2b7b5ddb9d248eaf6d974d8af00b5", "score": "0.52453965", "text": "func nanotime() int64", "title": "" }, { "docid": "d01ca03c68dbe0b8e9287c7670de4ded", "score": "0.52396584", "text": "func (b Datarate) ExabytesPerSecond() float64 {\n\treturn float64(b / ExabytePerSecond)\n}", "title": "" }, { "docid": "d6f8b7b02a69cb9c7fc27253547a2993", "score": "0.5236382", "text": "func Frames(ff Runner, vid string) ([]float64, error) {\n\tstdout, err := ff.ExecFFprobe(\"-loglevel\", \"error\",\n\t\t\"-select_streams\", \"v\",\n\t\t\"-show_entries\", \"frame=pkt_pts_time\",\n\t\t\"-of\", \"csv=print_section=0\",\n\t\tvid,\n\t)\n\tif err != nil {\n\t\tlog.Print(streams.ReadString(stdout))\n\t\treturn nil, err\n\t}\n\n\treturn ParseFloats(stdout)\n}", "title": "" }, { "docid": "41c0eb94c92e64e5af71a8d360274894", "score": "0.523366", "text": "func (c *Client) Fps() (prop interface{}, err error) {\n\treturn c.GetProperty(\"fps\")\n}", "title": "" }, { "docid": "6a40e8c07b4ef8e756b9bbd6eb88cdef", "score": "0.52169263", "text": "func (d Duration) Milliseconds() int64 { return int64(d) / 1e6 }", "title": "" }, { "docid": "44a73d22504c88d3a6f584715c9bac1f", "score": "0.5203443", "text": "func calculate_rate(bigger, smaller, seconds float64) float64 {\n\tdiff := calculate_diff(bigger, smaller)\n\n\tif seconds <= 0 { // negative seconds is weird\n\t\treturn diff\n\t} else {\n\t\treturn diff / seconds\n\t}\n}", "title": "" }, { "docid": "e056a3712f84ec7b69e63b13ecf5a6f5", "score": "0.52003217", "text": "func (sr SampleRate) N(d time.Duration) int {\n\treturn int(d * time.Duration(sr) / time.Second)\n}", "title": "" }, { "docid": "1990605d0c8bcf8a85cf7d1023f80ddc", "score": "0.51885223", "text": "func (f *Fs) Precision() time.Duration {\n\treturn time.Second\n}", "title": "" }, { "docid": "76d54102584b3c3593f5b62e7a59d9d7", "score": "0.5188021", "text": "func (c *Clock) LastFrame() time.Duration {\n\tc.access.RLock()\n\tdefer c.access.RUnlock()\n\treturn c.lastFrameTime\n}", "title": "" }, { "docid": "3aea644b94688efa91ef8978e06f6c27", "score": "0.5187737", "text": "func (srl *SimpleRateLimiter) GetLimitPerSecond() float64 {\n\treturn nanosPerSecFloat / (float64)(srl.nanosPerUnit)\n}", "title": "" }, { "docid": "76dfb906fe335585029cfdcf819f83ce", "score": "0.51715285", "text": "func (b Datarate) TebibytesPerSecond() float64 {\n\treturn float64(b / TebibytePerSecond)\n}", "title": "" }, { "docid": "6cf6766861ccc4f37874c499c8f8e78d", "score": "0.5156437", "text": "func (b Datarate) GigabytesPerSecond() float64 {\n\treturn float64(b / GigabytePerSecond)\n}", "title": "" }, { "docid": "fb343526cb672dcdeff00129a8c5431b", "score": "0.5155026", "text": "func (t Duration) Petaseconds() float64 {\n\treturn float64(t / Petasecond)\n}", "title": "" }, { "docid": "ad7222177e5622b020031ff8b2ced361", "score": "0.515259", "text": "func countOverTime(samples []promql.Point) float64 {\n\treturn float64(len(samples))\n}", "title": "" }, { "docid": "40326f05e62f8cadc0ad68e2c0b45198", "score": "0.51490444", "text": "func CurrentMicros() int64 {\n\treturn time.Now().UnixNano() / int64(time.Microsecond)\n}", "title": "" }, { "docid": "72d8f18485de9a989a0fefa070117e44", "score": "0.5146883", "text": "func (b Datarate) ExbibytesPerSecond() float64 {\n\treturn float64(b / ExbibytePerSecond)\n}", "title": "" }, { "docid": "43d80cbbd1890630bfece54e0d215587", "score": "0.5145559", "text": "func (v *AacDecoder) AacSamplesPerFrame() int {\n\treturn int(C.aacdec_aac_samples_per_frame(&v.m))\n}", "title": "" }, { "docid": "c58059892a7cd256e3f3d4a7f00aec53", "score": "0.51432145", "text": "func (f *simpleTracker) Update() {\n\tcurrTime := f.timeGetter()\n\tf.prevLastUpdateTime = f.lastUpdateTime\n\tf.lastUpdateTime = currTime\n\n\tf.frameCounter++\n\tif currTime.Sub(f.prevTime) > time.Second {\n\t\tf.framesLastSecond = f.frameCounter\n\t\tf.frameCounter = 0\n\t\tf.prevTime = currTime\n\t}\n}", "title": "" } ]
0a124105905b5c7f2ee5023f99db98e4
resolve perform the the DoH call.
[ { "docid": "944056a2564c5abb3801facfe4dbfe3e", "score": "0.7061531", "text": "func (r DOH) resolve(ctx context.Context, q query.Query, buf []byte, rt http.RoundTripper) (n int, i ResolveInfo, err error) {\n\tvar ci ClientInfo\n\tif r.ClientInfo != nil {\n\t\tci = r.ClientInfo(q)\n\t}\n\turl := r.URL\n\tif r.GetURL != nil {\n\t\turl = r.GetURL(q)\n\t}\n\tif url == \"\" {\n\t\turl = \"https://0.0.0.0\"\n\t}\n\tvar now time.Time\n\tn = -1\n\t// RFC1035, section 7.4: The results of an inverse query should not be cached\n\tif q.Type != query.TypePTR && r.Cache != nil {\n\t\tnow = time.Now()\n\t\tif v, found := r.Cache.Get(cacheKey{url, q.Class, q.Type, q.Name}); found {\n\t\t\tif v, ok := v.(*cacheValue); ok {\n\t\t\t\tmsg, minTTL := v.AdjustedResponse(q.ID, r.CacheMaxTTL, now)\n\t\t\t\tcopy(buf, msg)\n\t\t\t\tn = len(msg)\n\t\t\t\ti.Transport = v.trans\n\t\t\t\ti.FromCache = true\n\t\t\t\tif minTTL > 0 {\n\t\t\t\t\treturn n, i, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewReader(q.Payload))\n\tif err != nil {\n\t\treturn n, i, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/dns-message\")\n\tfor name, values := range r.ExtraHeaders {\n\t\treq.Header[name] = values\n\t}\n\tif ci.ID != \"\" {\n\t\treq.Header.Set(\"X-Device-Id\", ci.ID)\n\t}\n\tif ci.IP != \"\" {\n\t\treq.Header.Set(\"X-Device-Ip\", ci.IP)\n\t}\n\tif ci.Model != \"\" {\n\t\treq.Header.Set(\"X-Device-Model\", ci.Model)\n\t}\n\tif ci.Name != \"\" {\n\t\treq.Header.Set(\"X-Device-Name\", ci.Name)\n\t}\n\tif rt == nil {\n\t\trt = http.DefaultTransport\n\t}\n\tres, err := rt.RoundTrip(req)\n\tif err != nil {\n\t\treturn n, i, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\treturn n, i, fmt.Errorf(\"error code: %d\", res.StatusCode)\n\t}\n\tn, err = readDNSResponse(res.Body, buf)\n\ti.Transport = res.Proto\n\ti.FromCache = false\n\tif r.Cache != nil {\n\t\tv := &cacheValue{\n\t\t\ttime: now,\n\t\t\tmsg: make([]byte, n),\n\t\t\ttrans: res.Proto,\n\t\t}\n\t\tcopy(v.msg, buf[:n])\n\t\tr.Cache.Add(cacheKey{url, q.Class, q.Type, q.Name}, v)\n\t}\n\treturn n, i, err\n}", "title": "" } ]
[ { "docid": "bc5eaa2f5011ba488b0b98bb4773408a", "score": "0.7161481", "text": "func (r *DOH) resolve(ctx context.Context, q query.Query, buf []byte, rt http.RoundTripper) (n int, i ResolveInfo, err error) {\n\tvar ci ClientInfo\n\tif r.ClientInfo != nil {\n\t\tci = r.ClientInfo(q)\n\t}\n\turl := r.URL\n\tif r.GetURL != nil {\n\t\turl = r.GetURL(q)\n\t}\n\tif url == \"\" {\n\t\turl = \"https://0.0.0.0\"\n\t}\n\tvar now time.Time\n\tn = 0\n\t// RFC1035, section 7.4: The results of an inverse query should not be cached\n\tif q.Type != query.TypePTR && r.Cache != nil {\n\t\tnow = time.Now()\n\t\tif v, found := r.Cache.Get(cacheKey{url, q.Class, q.Type, q.Name}); found {\n\t\t\tif v, ok := v.(*cacheValue); ok {\n\t\t\t\tvar minTTL uint32\n\t\t\t\tn, minTTL = v.AdjustedResponse(buf, q.ID, r.CacheMaxAge, r.MaxTTL, now)\n\t\t\t\ti.Transport = v.trans\n\t\t\t\ti.FromCache = true\n\t\t\t\t// Use cached entry if TTL is in the future and isn't older than\n\t\t\t\t// the configuration last change.\n\t\t\t\tif minTTL > 0 && r.lastMod(url).Before(v.time) {\n\t\t\t\t\treturn n, i, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewReader(q.Payload))\n\tif err != nil {\n\t\treturn n, i, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/dns-message\")\n\treq.Header.Set(\"X-Conf-Last-Modified\", \"true\")\n\tfor name, values := range r.ExtraHeaders {\n\t\treq.Header[name] = values\n\t}\n\tif ci.ID != \"\" {\n\t\treq.Header.Set(\"X-Device-Id\", ci.ID)\n\t}\n\tif ci.IP != \"\" {\n\t\treq.Header.Set(\"X-Device-Ip\", ci.IP)\n\t}\n\tif ci.Model != \"\" {\n\t\treq.Header.Set(\"X-Device-Model\", ci.Model)\n\t}\n\tif ci.Name != \"\" {\n\t\treq.Header.Set(\"X-Device-Name\", ci.Name)\n\t}\n\tif rt == nil {\n\t\trt = http.DefaultTransport\n\t}\n\tres, err := rt.RoundTrip(req)\n\tif err != nil {\n\t\treturn n, i, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\treturn n, i, fmt.Errorf(\"error code: %d\", res.StatusCode)\n\t}\n\tvar truncated bool\n\tn, truncated, err = readDNSResponse(res.Body, buf)\n\ti.Transport = res.Proto\n\ti.FromCache = false\n\tif n > 0 && !truncated && err == nil && r.Cache != nil {\n\t\tv := &cacheValue{\n\t\t\ttime: now,\n\t\t\tmsg: make([]byte, n),\n\t\t\ttrans: res.Proto,\n\t\t}\n\t\tcopy(v.msg, buf[:n])\n\t\tr.Cache.Add(cacheKey{url, q.Class, q.Type, q.Name}, v)\n\t\tr.updateLastMod(url, res.Header.Get(\"X-Conf-Last-Modified\"))\n\t}\n\tif r.MaxTTL > 0 && n > 0 {\n\t\tupdateTTL(buf[:n], 0, 0, r.MaxTTL)\n\t}\n\treturn n, i, err\n}", "title": "" }, { "docid": "3a34594cbe81c861fde0f008bf00d9a4", "score": "0.6198497", "text": "func (a *Arguments) Resolve(s *db.Session, r *http.Request) error {\n\tg, _ := errgroup.WithContext(r.Context())\n\tg.Go(func() error {\n\t\tdepartment, err := database.ReadDepartment(s, []string{a.DepartmentName})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(department) == 0 {\n\t\t\treturn server.NewHTTPError(http.StatusBadRequest, \"Wrong department name\")\n\t\t}\n\t\ta.departmentID = department[0].ID\n\n\t\treturn nil\n\t})\n\n\tg.Go(func() error {\n\t\tappointment, err := database.ReadAppointment(s, []string{a.AppointmentName})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(appointment) == 0 {\n\t\t\treturn server.NewHTTPError(http.StatusBadRequest, \"Wrong appointment name\")\n\t\t}\n\t\ta.appointmentID = appointment[0].ID\n\n\t\treturn nil\n\t})\n\n\treturn g.Wait()\n}", "title": "" }, { "docid": "94b8b7f75fd81ab0bc7a2e026a51aa88", "score": "0.61154133", "text": "func (s *Server) resolve(w http.ResponseWriter, r *http.Request, shortID string) {\n\tid, err := parseID(shortID)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"error parsing ID as base36 integer: %v\", err)\n\t}\n\n\tlongURL, err := s.index.LookupID(id)\n\tif err != nil {\n\t\tif xerrors.Is(err, ErrNotFound) {\n\t\t\twriteError(w, http.StatusNotFound, \"unknown link ID %s (parsed as %d)\", shortID, id)\n\t\t\treturn\n\t\t}\n\t\twriteError(w, http.StatusInternalServerError, \"error shortening URL: %v\", err)\n\t\treturn\n\t}\n\n\tif !s.quiet {\n\t\tlog.Println(\"resolved\", shortID, \"to\", longURL)\n\t}\n\n\thttp.Redirect(w, r, longURL, http.StatusFound)\n}", "title": "" }, { "docid": "98f67bcbe308ddeb4d71235122e94254", "score": "0.5992444", "text": "func (r *resolver) resolve() {\n\tr.buildTypeMap()\n\tr.fillValMap()\n}", "title": "" }, { "docid": "00aeb9841a18d2e995c314f1b4d38608", "score": "0.59464145", "text": "func (b binding) resolve(c Container) (interface{}, error) {\n\tif b.instance != nil {\n\t\treturn b.instance, nil\n\t}\n\n\treturn c.invoke(b.resolver)\n}", "title": "" }, { "docid": "41c75c1720857056d7b6a1c3b212efcd", "score": "0.59217286", "text": "func (o *ResolveHandler) Resolve(rw http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\tdefer func() {\n\t\to.metrics.HTTPResolveTime(time.Since(startTime))\n\t}()\n\n\tid := getID(req)\n\topts, err := getResolutionOptions(req)\n\tif err != nil {\n\t\tcommon.WriteError(rw, http.StatusBadRequest, err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Resolving DID document for ID\", log.WithID(id))\n\tresponse, err := o.doResolve(id, opts...)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"... resolved DID document for ID\", log.WithID(id), logfields.WithDocument(response.Document))\n\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "title": "" }, { "docid": "6e370676a1108659a46b5c44ab8b0072", "score": "0.584224", "text": "func (r *Resolver) Resolve(args ResolveArgs) (res Resolution, err error) {\n\tvar ks = r.state.KS\n\n\tdefer func() {\n\t\tif ks != nil {\n\t\t\tks.Mu.RUnlock()\n\t\t}\n\t}()\n\tks.Mu.RLock()\n\n\tvar localID pb.ProcessSpec_ID\n\n\tif r.state.LocalMemberInd != -1 {\n\t\tlocalID = r.state.Members[r.state.LocalMemberInd].\n\t\t\tDecoded.(allocator.Member).MemberValue.(*pc.ConsumerSpec).Id\n\t} else {\n\t\t// During graceful shutdown, we may still serve requests even after our\n\t\t// local member key has been removed from Etcd. We don't want to outright\n\t\t// fail these requests as we can usefully proxy them. Use a placeholder\n\t\t// to ensure |localID| doesn't match ProcessSpec_ID{}, and for logging.\n\t\tlocalID = pb.ProcessSpec_ID{Zone: \"local ConsumerSpec\", Suffix: \"missing from Etcd\"}\n\t}\n\n\tif hdr := args.ProxyHeader; hdr != nil {\n\t\t// Sanity check the proxy broker is using our same Etcd cluster.\n\t\tif hdr.Etcd.ClusterId != ks.Header.ClusterId {\n\t\t\terr = fmt.Errorf(\"proxied request Etcd ClusterId doesn't match our own (%d vs %d)\",\n\t\t\t\thdr.Etcd.ClusterId, ks.Header.ClusterId)\n\t\t\treturn\n\t\t}\n\t\t// Sanity-check that the proxy broker reached the intended recipient.\n\t\tif hdr.ProcessId != localID {\n\t\t\terr = fmt.Errorf(\"proxied request ProcessId doesn't match our own (%s vs %s)\",\n\t\t\t\t&hdr.ProcessId, &localID)\n\t\t\treturn\n\t\t}\n\n\t\tif hdr.Etcd.Revision > ks.Header.Revision {\n\t\t\taddTrace(args.Context, \" ... at revision %d, but want at least %d\", ks.Header.Revision, hdr.Etcd.Revision)\n\n\t\t\tif err = ks.WaitForRevision(args.Context, hdr.Etcd.Revision); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\taddTrace(args.Context, \"WaitForRevision(%d) => %d\", hdr.Etcd.Revision, ks.Header.Revision)\n\t\t}\n\t}\n\tres.Header.Etcd = pb.FromEtcdResponseHeader(ks.Header)\n\n\t// Extract ShardSpec.\n\tif item, ok := allocator.LookupItem(ks, args.ShardID.String()); ok {\n\t\tres.Spec = item.ItemValue.(*pc.ShardSpec)\n\t}\n\t// Extract Route.\n\tvar assignments = ks.KeyValues.Prefixed(\n\t\tallocator.ItemAssignmentsPrefix(ks, args.ShardID.String()))\n\n\tres.Header.Route.Init(assignments)\n\tres.Header.Route.AttachEndpoints(ks)\n\n\t// Select a responsible ConsumerSpec.\n\tif res.Header.Route.Primary != -1 {\n\t\tres.Header.ProcessId = res.Header.Route.Members[res.Header.Route.Primary]\n\t}\n\n\t// Select a response Status code.\n\tif res.Spec == nil {\n\t\tres.Status = pc.Status_SHARD_NOT_FOUND\n\t} else if res.Header.ProcessId == (pb.ProcessSpec_ID{}) {\n\t\tres.Status = pc.Status_NO_SHARD_PRIMARY\n\t} else if !args.MayProxy && res.Header.ProcessId != localID {\n\t\tres.Status = pc.Status_NOT_SHARD_PRIMARY\n\t} else {\n\t\tres.Status = pc.Status_OK\n\t}\n\n\tif res.Status != pc.Status_OK {\n\t\t// If we're returning an error, the effective ProcessId is ourselves\n\t\t// (since we authored the error response).\n\t\tres.Header.ProcessId = localID\n\t} else if res.Header.ProcessId == localID {\n\t\tif r.shards == nil {\n\t\t\terr = ErrResolverStopped\n\t\t\treturn\n\t\t}\n\n\t\tvar shard, ok = r.shards[args.ShardID]\n\t\tif !ok {\n\t\t\tpanic(\"expected local shard for ID \" + args.ShardID.String())\n\t\t}\n\n\t\tks.Mu.RUnlock() // We no longer require |ks|; don't hold the lock.\n\t\tks = nil\n\n\t\t// |shard| is the assigned primary, but it may still be recovering.\n\t\t// Block until |storeReadyCh| is select-able.\n\t\tselect {\n\t\tcase <-shard.storeReadyCh:\n\t\t\t// Pass.\n\t\tdefault:\n\t\t\taddTrace(args.Context, \" ... still recovering; must wait for storeReadyCh to resolve\")\n\t\t\tselect {\n\t\t\tcase <-shard.storeReadyCh:\n\t\t\t\t// Pass.\n\t\t\tcase <-args.Context.Done():\n\t\t\t\terr = args.Context.Err()\n\t\t\t\treturn\n\t\t\tcase <-shard.ctx.Done():\n\t\t\t\terr = shard.ctx.Err()\n\t\t\t\treturn\n\t\t\t}\n\t\t\taddTrace(args.Context, \"<-shard.storeReadyCh\")\n\t\t}\n\n\t\t// Ensure args.ReadThrough are satisfied, blocking if required.\n\t\tfor {\n\t\t\tvar ch chan struct{}\n\n\t\t\tshard.progress.Lock()\n\t\t\tfor j, o := range args.ReadThrough {\n\t\t\t\tif a, ok := shard.progress.readThrough[j]; ok && a < o {\n\t\t\t\t\taddTrace(args.Context, \" ... journal %s at read offset %d, but want at least %d\", j, a, o)\n\t\t\t\t\tch = shard.progress.signalCh\n\t\t\t\t}\n\t\t\t}\n\t\t\tshard.progress.Unlock()\n\n\t\t\tif ch == nil {\n\t\t\t\tbreak // All args.ReadThrough are satisfied.\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-ch:\n\t\t\t\t// Pass.\n\t\t\tcase <-args.Context.Done():\n\t\t\t\terr = args.Context.Err()\n\t\t\t\treturn\n\t\t\tcase <-shard.ctx.Done():\n\t\t\t\terr = shard.ctx.Err()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tshard.wg.Add(1)\n\t\tres.Shard = shard\n\t\tres.Store = shard.store\n\t\tres.Done = shard.wg.Done\n\t}\n\n\taddTrace(args.Context, \"resolve(%s) => %s, header: %s, shard: %t\",\n\t\targs.ShardID, res.Status, &res.Header, res.Shard != nil)\n\n\treturn\n}", "title": "" }, { "docid": "3ae902fccbd2a60c4624d3255f59e0d4", "score": "0.5834011", "text": "func (r Resolver) Resolve(dst string) error {\n\treturn exec.RunCommand(Command(dst))\n}", "title": "" }, { "docid": "a6e440e9ddbc11e8462d6c2295dea7c7", "score": "0.5821088", "text": "func (d *memory) resolveLocked(ctx context.Context, id id.ID) (interface{}, error) {\n\t// Look up the record with the provided identifier.\n\tr, got := d.records[id]\n\tif !got {\n\t\t// Database doesn't recognise this identifier.\n\t\treturn nil, fmt.Errorf(\"Resource '%v' not found\", id)\n\t}\n\n\trs := r.resolveState\n\tif rs == nil {\n\t\t// First request for this resolvable.\n\n\t\t// Grab the resolve chain from the caller's context.\n\t\trc := &resolveChain{r, getResolveChain(ctx)}\n\n\t\t// Build a cancellable context for the resolve from database's resolve\n\t\t// context. We use this as we don't to cancel the resolve if a single\n\t\t// caller cancel's their context.\n\t\tresolveCtx, cancel := task.WithCancel(d.resolveCtx)\n\n\t\trs = &resolveState{\n\t\t\tctx: rc.bind(resolveCtx),\n\t\t\tfinished: make(chan struct{}),\n\t\t\tcancel: cancel,\n\t\t}\n\t\tr.resolveState = rs\n\n\t\t// Build the resolvable on a separate go-routine.\n\t\tgo func(ctx context.Context) {\n\t\t\tdefer d.resolvePanicHandler(ctx)\n\t\t\terr := r.resolve(ctx)\n\n\t\t\t// Signal that the resolvable has finished.\n\t\t\td.mutex.Lock()\n\t\t\tclose(rs.finished)\n\t\t\trs.err, rs.finished = err, nil\n\t\t\td.mutex.Unlock()\n\t\t}(rs.ctx)\n\t}\n\n\tif finished := rs.finished; finished != nil {\n\t\t// Buildable has not yet finished.\n\t\t// Increment the waiting go-routine counter.\n\t\trs.waiting++\n\t\trs.callstacks = append(rs.callstacks, getCallstack(4))\n\t\t// Wait for either the resolve to finish or ctx to be cancelled.\n\t\td.mutex.Unlock()\n\t\tselect {\n\t\tcase <-finished:\n\t\tcase <-task.ShouldStop(ctx):\n\t\t}\n\t\td.mutex.Lock()\n\n\t\t// Decrement the waiting go-routine counter.\n\t\trs.waiting--\n\t\tif rs.waiting == 0 && rs.finished != nil {\n\t\t\t// There's no more go-routines waiting for this resolvable and it\n\t\t\t// hasn't finished yet. Cancel it and remove the resolve state from\n\t\t\t// the record.\n\t\t\trs.cancel()\n\t\t\tr.resolveState = nil\n\t\t\td.records[id] = r\n\t\t}\n\t}\n\n\tif err := task.StopReason(ctx); err != nil {\n\t\treturn nil, err // Context was cancelled.\n\t}\n\tif rs.err != nil {\n\t\treturn nil, rs.err // Resolve errored.\n\t}\n\treturn r.object, nil // Done.\n}", "title": "" }, { "docid": "76b1ebabf2eede6c010b73ef23c86453", "score": "0.5807813", "text": "func (r *Resolver) ResolveNow(opt resolver.ResolveNowOption) {\n\n}", "title": "" }, { "docid": "589c913bc850308a5cbc538a17705e07", "score": "0.5754493", "text": "func queryResolve(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper)(res []byte, err sdk.Error){\n\tname:=path[0]\n\n\tvalue:=keeper.ResolveName(ctx, name)\n\n\tif value==\"\"{\n\t\treturn []byte{}, sdk.ErrUnknownRequest(\"could not resolve name\")\n\n\t}\n\tbz, err2:=codec.MarshalJSONIndent(keeper.cdc, QueryResResolve{value})\n\tif err2!=nil{\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\treturn bz, nil\n\n}", "title": "" }, { "docid": "c02c99a7c809fd57ec37a708f4b7d5cc", "score": "0.57169616", "text": "func (c *loadConstraint) presolve(h *hvn) {\n\todst := onodeid(c.dst)\n\tosrc := onodeid(c.src)\n\tif c.offset == 0 {\n\t\th.addEdge(odst, h.ref(osrc)) // dst --> *src\n\t} else {\n\t\t// We don't interpret load-with-offset, e.g. results\n\t\t// of map value lookup, R-block of dynamic call, slice\n\t\t// copy/append, reflection.\n\t\th.markIndirect(odst, \"load with offset\")\n\t}\n}", "title": "" }, { "docid": "29132eba74af67679ed8c37abcf9a89a", "score": "0.56793845", "text": "func (c *addrConstraint) presolve(h *hvn) {\n\t// Each object (src) is an initial PE label.\n\tlabel := peLabel(c.src) // label < N\n\tif debugHVNVerbose && h.log != nil {\n\t\t// duplicate log messages are possible\n\t\tfmt.Fprintf(h.log, \"\\tcreate p%d: {&n%d}\\n\", label, c.src)\n\t}\n\todst := onodeid(c.dst)\n\tosrc := onodeid(c.src)\n\n\t// Assign dst this label.\n\th.onodes[odst].peLabels.Insert(int(label))\n\tif debugHVNVerbose && h.log != nil {\n\t\tfmt.Fprintf(h.log, \"\\to%d has p%d\\n\", odst, label)\n\t}\n\n\th.addImplicitEdge(h.ref(odst), osrc) // *dst ~~> src.\n}", "title": "" }, { "docid": "660f58aa70bd8a9284671c17b227ad80", "score": "0.5666414", "text": "func (p *pluginHostProvider) Resolve(ctx context.Context, repo *v1.Repository) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tresp, err := p.C.Resolve(ctx, &common.ResolveRequest{\n\t\tRepository: repo,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t*repo = *resp.Repository\n\treturn nil\n}", "title": "" }, { "docid": "39441287e7dd134094d1fa23515a3f98", "score": "0.56445473", "text": "func queryResolve(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper) (res []byte, err sdk.Error) {\n\thash := path[0]\n\n\tvalue := keeper.GetHash(ctx, hash)\n\n\tif value == \"\" {\n\t\treturn []byte{}, sdk.ErrUnknownRequest(\"could not resolve hash\")\n\t}\n\n\tbz, err2 := codec.MarshalJSONIndent(keeper.cdc, QueryResResolve{value})\n\tif err2 != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "title": "" }, { "docid": "cc6b54410cb0ecbbeb6a952354e42731", "score": "0.56275326", "text": "func Resolve(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\n\treq := c.Get(\"http.Request\", nil).(*http.Request)\n\tres := c.Get(\"http.ResponseWriter\", nil).(http.ResponseWriter)\n\tcfg := p.Get(\"config\", nil).(ZolverYaml)\n\ttpls := p.Get(\"tpl\", nil).(map[string]*template.Template)\n\n\thost := strings.SplitN(req.Host, \":\", 2)\n\n\tc.Logf(\"info\", \"Requested host: %s\", host[0])\n\troute, ok := cfg[host[0]]\n\tif !ok {\n\t\thttp.NotFound(res, req)\n\t\treturn nil, nil\n\t}\n\n\tnewurl, err := destination(req, &route, tpls)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), 500)\n\t\treturn nil, nil\n\t}\n\n\tc.Logf(\"info\", \"Rerouting %s to %s\", req.URL.String(), newurl)\n\n\t//res.Header().Add(\"location\", route.To)\n\thttp.Redirect(res, req, newurl, 302)\n\treturn nil, nil\n}", "title": "" }, { "docid": "b0d40bdba6480577af8025d6bea059a3", "score": "0.5623314", "text": "func (o *ResolveHandler) Resolve(rw http.ResponseWriter, req *http.Request) {\n\tid := getID(req)\n\tlogger.Debugf(\"Resolving DID document for ID [%s]\", id)\n\tresponse, err := o.doResolve(id)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\n\tlogger.Debugf(\"... resolved DID document for ID [%s]: %s\", id, response.Document)\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "title": "" }, { "docid": "5bb84c49ac2ff2e79376edfbe2277001", "score": "0.55981547", "text": "func (c *storeConstraint) presolve(h *hvn) {\n\todst := onodeid(c.dst)\n\tosrc := onodeid(c.src)\n\tif c.offset == 0 {\n\t\th.onodes[h.ref(odst)].edges.Insert(int(osrc)) // *dst --> src\n\t\tif debugHVNVerbose && h.log != nil {\n\t\t\tfmt.Fprintf(h.log, \"\\to%d --> o%d\\n\", h.ref(odst), osrc)\n\t\t}\n\t}\n\t// We don't interpret store-with-offset.\n\t// See discussion of soundness at markIndirectNodes.\n}", "title": "" }, { "docid": "06cdc29f9f0faa477509c467f007cc9b", "score": "0.55942017", "text": "func (tx *Transaction) ResolveRemoteHost() {\n tx.Mux.Lock()\n defer tx.Mux.Unlock()\n addr, err := net.LookupAddr(\"198.252.206.16\")\n if err != nil{\n return\n }\n //TODO: ADD CACHE\n tx.Collections[\"remote_host\"].AddToKey(\"\", addr[0])\n}", "title": "" }, { "docid": "1d0cc78185f72e25bfb8d504aa1ed42d", "score": "0.55789876", "text": "func (*xdsResolver) ResolveNow(o resolver.ResolveNowOptions) {}", "title": "" }, { "docid": "8d7fffd5ab2b68c4f1749f46c654bdf3", "score": "0.55358356", "text": "func (c *typeFilterConstraint) presolve(h *hvn) {\n\th.markIndirect(onodeid(c.dst), \"typeFilter result\")\n}", "title": "" }, { "docid": "78db4d4327a49007cec0c0960069f800", "score": "0.55271554", "text": "func (k *Kurz) Resolve(w http.ResponseWriter, r *http.Request) {\n\n\tshort := mux.Vars(r)[\"short\"]\n\tkurl, err := k.load(short)\n\tif err == nil {\n\t\tgo k.redis.Hincrby(kurl.Key, \"Clicks\", 1)\n\t\thttp.Redirect(w, r, kurl.LongUrl, http.StatusMovedPermanently)\n\t} else {\n\t\thttp.Redirect(w, r, k.fileNotFound, http.StatusMovedPermanently)\n\t}\n}", "title": "" }, { "docid": "55e66881d0a6c36255422b14921bfba6", "score": "0.552297", "text": "func (c *untagConstraint) presolve(h *hvn) {\n\todst := onodeid(c.dst)\n\tfor end := odst + onodeid(h.a.sizeof(c.typ)); odst < end; odst++ {\n\t\th.markIndirect(odst, \"untag result\")\n\t}\n}", "title": "" }, { "docid": "726025f0622c58257d4be765edefdd92", "score": "0.55159754", "text": "func (s *server) CompletionResolve(ctx context.Context, params *CompletionItem) (result *CompletionItem, err error) {\n\tresult = new(CompletionItem)\n\terr = s.Conn.Call(ctx, MethodCompletionItemResolve, params, result)\n\n\treturn result, err\n}", "title": "" }, { "docid": "199e974b7815afd3675f58aa64fea9d0", "score": "0.5427085", "text": "func (*LocalResolver) ResolveNow(o resolver.ResolveNowOption) {}", "title": "" }, { "docid": "391b34a9c2260a0d02166ef5e87584af", "score": "0.53737944", "text": "func (r *Resolver) Resolve(id controller.ID) (topodevice.ID, error) {\n\treturn topodevice.ID(devicesnapshot.ID(id.String()).GetDeviceID()), nil\n}", "title": "" }, { "docid": "b275fd3edbf21f0bd47a8b92d84e6c2b", "score": "0.5358216", "text": "func DoLookupWorker(udp *dns.Client, tcp *dns.Client, conn *dns.Conn, q Question, nameServer string, recursive bool, edns0subnet *dns.EDNS0_SUBNET, dnssec bool, checkingDisabled bool) (Result, zdns.Status, error) {\n\tres := Result{Answers: []interface{}{}, Authorities: []interface{}{}, Additional: []interface{}{}}\n\tres.Resolver = nameServer\n\n\tm := new(dns.Msg)\n\tm.SetQuestion(dotName(q.Name), q.Type)\n\tm.Question[0].Qclass = q.Class\n\tm.RecursionDesired = recursive\n\tm.CheckingDisabled = checkingDisabled\n\n\tm.SetEdns0(1232, dnssec)\n\tif edns0subnet != nil {\n\t\topt := m.Extra[0].(*dns.OPT)\n\t\topt.Option = append(opt.Option, edns0subnet)\n\t}\n\n\tvar r *dns.Msg\n\tvar err error\n\tif udp != nil {\n\t\tres.Protocol = \"udp\"\n\t\tif conn != nil {\n\t\t\tdst, _ := net.ResolveUDPAddr(\"udp\", nameServer)\n\t\t\tr, _, err = udp.ExchangeWithConnTo(m, conn, dst)\n\t\t} else {\n\t\t\tr, _, err = udp.Exchange(m, nameServer)\n\t\t}\n\t\t// if record comes back truncated, but we have a TCP connection, try again with that\n\t\tif r != nil && (r.Truncated || r.Rcode == dns.RcodeBadTrunc) {\n\t\t\tif tcp != nil {\n\t\t\t\treturn DoLookupWorker(nil, tcp, conn, q, nameServer, recursive, edns0subnet, dnssec, checkingDisabled)\n\t\t\t} else {\n\t\t\t\treturn res, zdns.STATUS_TRUNCATED, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tres.Protocol = \"tcp\"\n\t\tr, _, err = tcp.Exchange(m, nameServer)\n\t}\n\tif err != nil || r == nil {\n\t\tif nerr, ok := err.(net.Error); ok {\n\t\t\tif nerr.Timeout() {\n\t\t\t\treturn res, zdns.STATUS_TIMEOUT, nil\n\t\t\t} else if nerr.Temporary() {\n\t\t\t\treturn res, zdns.STATUS_TEMPORARY, err\n\t\t\t}\n\t\t}\n\t\treturn res, zdns.STATUS_ERROR, err\n\t}\n\n\tif r.Rcode != dns.RcodeSuccess {\n\t\treturn res, TranslateMiekgErrorCode(r.Rcode), nil\n\t}\n\n\tres.Flags.Response = r.Response\n\tres.Flags.Opcode = r.Opcode\n\tres.Flags.Authoritative = r.Authoritative\n\tres.Flags.Truncated = r.Truncated\n\tres.Flags.RecursionDesired = r.RecursionDesired\n\tres.Flags.RecursionAvailable = r.RecursionAvailable\n\tres.Flags.Authenticated = r.AuthenticatedData\n\tres.Flags.CheckingDisabled = r.CheckingDisabled\n\tres.Flags.ErrorCode = r.Rcode\n\n\tfor _, ans := range r.Answer {\n\t\tinner := ParseAnswer(ans)\n\t\tif inner != nil {\n\t\t\tres.Answers = append(res.Answers, inner)\n\t\t}\n\t}\n\tfor _, ans := range r.Extra {\n\t\tinner := ParseAnswer(ans)\n\t\tif inner != nil {\n\t\t\tres.Additional = append(res.Additional, inner)\n\t\t}\n\t}\n\tfor _, ans := range r.Ns {\n\t\tinner := ParseAnswer(ans)\n\t\tif inner != nil {\n\t\t\tres.Authorities = append(res.Authorities, inner)\n\t\t}\n\t}\n\treturn res, zdns.STATUS_NOERROR, nil\n}", "title": "" }, { "docid": "de880074868ff0e994f82cfdb761b1a7", "score": "0.5341781", "text": "func (a *commonPathResolver) resolve(dir, target string) (string, error) {\n\tcmd := exec.Command(\"go\", \"list\", \"-m\", \"-json\")\n\tcmd.Dir = dir\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to determine module information via [%v] in %s: %v\\n%s\", cmd, dir, err, out)\n\t}\n\tvar gomod struct {\n\t\tDir string\n\t\tPath string\n\t}\n\tif err := json.Unmarshal(out, &gomod); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to parse module information: %v\\n%s\", err, out)\n\t}\n\tif gomod.Dir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"failed to resolve module root within %s: resolve %+v\", dir, gomod)\n\t}\n\troot := gomod.Dir\n\tbin := filepath.Join(root, commonPathBin)\n\tif err := os.MkdirAll(bin, 0777); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create %s: %v\", bin, err)\n\t}\n\tbuildTarget := filepath.Join(bin, \"cue\")\n\ta.rootsLock.Lock()\n\tdefer a.rootsLock.Unlock()\n\tonce, ok := a.roots[root]\n\tif !ok {\n\t\tonce = new(sync.Once)\n\t\ta.roots[root] = once\n\t}\n\tvar version string\n\tif gomod.Path == cueModule {\n\t\tcommit, err := gitDir(dir, \"rev-parse\", \"HEAD\")\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to rev-parse HEAD: %v\", err)\n\t\t}\n\t\tversion = strings.TrimSpace(commit)\n\t} else {\n\t\tcmd := exec.Command(\"go\", \"list\", \"-m\", \"-f\", \"{{.Version}}\", cueModule)\n\t\tcmd.Dir = dir\n\t\tout, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to resolve version for module %s in %s: %v\", cueModule, dir, err)\n\t\t}\n\t\tversion = strings.TrimSpace(string(out))\n\t}\n\tvar onceerr error\n\tonce.Do(func() {\n\t\tonceerr = a.buildDir(dir, buildTarget)\n\t})\n\tif onceerr != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to build CUE in %s: %v\", root, onceerr)\n\t}\n\treturn version, copyExecutableFile(buildTarget, target)\n}", "title": "" }, { "docid": "37750524b8c6186ff90d127532b6b7f1", "score": "0.533384", "text": "func (fs *filesystem) resolve(ref string, digest string) (string, http.RoundTripper, name.Reference, error) {\n\tfs.pullTransportsMu.Lock()\n\tdefer fs.pullTransportsMu.Unlock()\n\n\t// Parse reference in docker convention\n\tnamed, err := docker.ParseDockerRef(ref)\n\tif err != nil {\n\t\treturn \"\", nil, nil, err\n\t}\n\tvar (\n\t\tscheme = \"https\"\n\t\thost = docker.Domain(named)\n\t\tpath = docker.Path(named)\n\t\topts []name.Option\n\t)\n\tif host == \"docker.io\" {\n\t\thost = \"registry-1.docker.io\"\n\t}\n\tfor _, i := range fs.insecure {\n\t\tif ok, _ := regexp.Match(i, []byte(host)); ok {\n\t\t\tscheme = \"http\"\n\t\t\topts = append(opts, name.Insecure)\n\t\t\tbreak\n\t\t}\n\t}\n\turl := fmt.Sprintf(\"%s://%s/v2/%s/blobs/%s\", scheme, host, path, digest)\n\tnameref, err := name.ParseReference(fmt.Sprintf(\"%s/%s\", host, path), opts...)\n\tif err != nil {\n\t\treturn \"\", nil, nil, fmt.Errorf(\"failed to parse reference %q: %v\", ref, err)\n\t}\n\n\t// Try to use cached transport (cahced per reference name)\n\ttr, ok := fs.pullTransports[nameref.Name()]\n\tif ok {\n\t\t// Check the connectivity of the transport (and redirect if necessary)\n\t\tif url, err := checkAndRedirect(url, tr); err == nil {\n\t\t\treturn url, tr, nameref, nil\n\t\t}\n\t}\n\n\t// Refresh the transport and check the connectivity\n\tif tr, err = authnTransport(http.DefaultTransport, nameref); err != nil {\n\t\treturn \"\", nil, nil, err\n\t}\n\tif url, err = checkAndRedirect(url, tr); err != nil {\n\t\treturn \"\", nil, nil, err\n\t}\n\n\t// Update transports cache\n\tfs.pullTransports[nameref.Name()] = tr\n\n\treturn url, tr, nameref, nil\n}", "title": "" }, { "docid": "f0883c2cf28f508c3b48ca8d75294ec8", "score": "0.5331931", "text": "func (r *Resolver) Resolve(target string) (naming.Watcher, error) {\n\treturn r, nil\n}", "title": "" }, { "docid": "f0883c2cf28f508c3b48ca8d75294ec8", "score": "0.5331931", "text": "func (r *Resolver) Resolve(target string) (naming.Watcher, error) {\n\treturn r, nil\n}", "title": "" }, { "docid": "fcf113492c58a9edd0e90feaa76d93cf", "score": "0.5317028", "text": "func doLookups(Technique, Domain, tld string, out chan<- Record, resolve, geolocate, whoisflag bool) {\n\tdefer wg.Done()\n\tr := new(Record)\n\tr.Technique = Technique\n\tr.Domain = Domain + \".\" + tld\n\tif resolve {\n\t\tr.A = aLookup(r.Domain)\n\t}\n\tif geolocate {\n\t\tr.Geolocation = geoLookup(aLookup(r.Domain))\n\t}\n\tif whoisflag {\n\t\trecord := whoisLookup(r.Domain)\n\t\tif len(record) > 0 {\n\t\t\tr.WhoisCreation = record[0]\n\t\t\tr.WhoisModification = record[1]\n\t\t} else {\n\t\t\tr.WhoisCreation = \"\"\n\t\t\tr.WhoisModification = \"\"\n\t\t}\n\t}\n\tout <- *r\n}", "title": "" }, { "docid": "fe13c807ca10096fa7d08b6275cc4864", "score": "0.53152776", "text": "func queryResolveIdentity(ctx sdk.Context, path []string, keeper Keeper) (res []byte, err sdk.Error) {\n\tdid := types.Did(path[0])\n\n\tidentityResult := IdentityResult{}\n\tidentityResult.Did = did\n\tidentityResult.DdoReference = keeper.GetDdoReferenceByDid(ctx, did)\n\n\tbz, err2 := codec.MarshalJSONIndent(keeper.cdc, identityResult)\n\tif err2 != nil {\n\t\tpanic(\"Could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "title": "" }, { "docid": "38a354d291db18663971e4864f8401f3", "score": "0.5301213", "text": "func Resolve(status chan Proxy, host string, timeout time.Duration) {\n\n\tvar proxy Proxy\n\tproxy.Address = host\n\n\tt0 := time.Now()\n\t_, err := net.DialTimeout(\"tcp\", host, timeout)\n\tif err != nil {\n\t\tproxy.ResponseTime = time.Now().Sub(t0)\n\t\tproxy.Alive = false\n\t\tstatus <- proxy\n\t\treturn\n\t}\n\n\tproxy.ResponseTime = time.Now().Sub(t0)\n\tproxy.Alive = true\n\tstatus <- proxy\n\treturn\n}", "title": "" }, { "docid": "a8bb617b495ffb90db4d794ea1887317", "score": "0.52983594", "text": "func (c Persistent) Resolve(ctx context.Context) error {\n\treturn capnp.Client(c).Resolve(ctx)\n}", "title": "" }, { "docid": "f6a52db96605b2f411cdfb7795044d80", "score": "0.52694184", "text": "func resolve(commit *git.Commit, name string, result map[string]Feature) error {\n\tif _, ok := result[name]; ok {\n\t\treturn nil\n\t}\n\n\tfeature, err := getFeature(commit, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, depName := range feature.Meta.Dependencies {\n\t\terr = resolve(commit, depName, result)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tresult[name] = feature\n\n\treturn nil\n}", "title": "" }, { "docid": "4e96823e9d23dbd0875d57d6da175b88", "score": "0.52660024", "text": "func (w *Worklog) Resolve(ctx context.Context, orgID *identity.ID,\n\tident *apitypes.WorklogID) (*apitypes.WorklogResult, error) {\n\n\titem, err := w.Get(ctx, orgID, ident)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif item == nil {\n\t\treturn nil, nil\n\t}\n\n\tswitch item.Type() {\n\tcase apitypes.SecretRotateWorklogType:\n\t\treturn &apitypes.WorklogResult{\n\t\t\tID: item.ID,\n\t\t\tState: apitypes.ManualWorklogResult,\n\t\t\tMessage: \"Please set a new value for the secret at \" + item.Subject,\n\t\t}, nil\n\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "2098ef9bf25fe9927b3069682824e740", "score": "0.52644837", "text": "func (c *Client) resolveRef(\n\tctx context.Context,\n\tbasePath string,\n\treference string,\n) (string, error) {\n\tcanonicalRef, err := c.canonicalizeRef(ctx, reference)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresp, err := c.sendRequest(ctx, http.MethodGet, path.Join(basePath, canonicalRef), nil, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer safeClose(resp.Body)\n\n\t// Note: This depends on all root-level objects having an \"id\" field.\n\ttype idResult struct {\n\t\tID string `json:\"id\"`\n\t}\n\n\tvar body idResult\n\tif err := parseResponse(resp, &body); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn body.ID, nil\n}", "title": "" }, { "docid": "73656eb66a91d5831fa23c42863f757a", "score": "0.5256738", "text": "func (f ResolverFunc) Resolve(target string) (naming.Watcher, error) {\n\treturn f(target)\n}", "title": "" }, { "docid": "13b4ecd82548f733491d38b77b458874", "score": "0.5244284", "text": "func (s *Lookup) DoLookup(name, nameServer string) (interface{}, zdns.Trace, zdns.Status, error) {\n\tif s.Factory.LookupAllNameServers {\n\t\tl := MiekgLookupClient{}\n\t\treturn s.DoLookupAllNameservers(l, name, nameServer)\n\t} else {\n\t\treturn s.DoMiekgLookup(Question{Name: name, Type: s.DNSType, Class: s.DNSClass}, nameServer)\n\t}\n}", "title": "" }, { "docid": "f2858e6eec67a337535f9ff9779cf79b", "score": "0.52397954", "text": "func (vm *viewManager) resolve(ctx *Context) {\n\t// Resolving view by convention and configuration\n\treply := ctx.Reply()\n\tif reply.Rdr == nil {\n\t\treply.Rdr = &htmlRender{}\n\t}\n\n\thtmlRdr, ok := reply.Rdr.(*htmlRender)\n\tif !ok || htmlRdr.Template != nil {\n\t\t// 1. If its not type `htmlRender`, possibly custom render implementation\n\t\t// 2. Template already populated in it\n\t\t// So no need to go forward\n\t\treturn\n\t}\n\n\tif len(htmlRdr.Layout) == 0 && vm.defaultLayoutEnabled {\n\t\thtmlRdr.Layout = vm.defaultTmplLayout\n\t}\n\n\tif htmlRdr.ViewArgs == nil {\n\t\thtmlRdr.ViewArgs = make(map[string]interface{})\n\t}\n\n\tfor k, v := range ctx.ViewArgs() {\n\t\tif _, found := htmlRdr.ViewArgs[k]; found {\n\t\t\tcontinue\n\t\t}\n\t\thtmlRdr.ViewArgs[k] = v\n\t}\n\n\t// Add ViewArgs values from framework\n\tvm.addFrameworkValuesIntoViewArgs(ctx)\n\n\tvar tmplPath, tmplName string\n\n\t// If user not provided the template info, auto resolve by convention\n\tif len(htmlRdr.Filename) == 0 {\n\t\ttmplName = ctx.action.Name + vm.fileExt\n\t\ttmplPath = filepath.Join(ctx.controller.Namespace, ctx.controller.NoSuffixName)\n\t} else {\n\t\t// User provided view info like layout, filename.\n\t\t// Taking full-control of view rendering.\n\t\t// Scenario's:\n\t\t// 1. filename with relative path\n\t\t// 2. filename with root page path\n\t\ttmplName = filepath.Base(htmlRdr.Filename)\n\t\ttmplPath = filepath.Dir(htmlRdr.Filename)\n\n\t\tif strings.HasPrefix(htmlRdr.Filename, \"/\") {\n\t\t\ttmplPath = strings.TrimLeft(tmplPath, \"/\")\n\t\t} else {\n\t\t\ttmplPath = filepath.Join(ctx.controller.Namespace, ctx.controller.NoSuffixName, tmplPath)\n\t\t}\n\t}\n\n\ttmplPath = filepath.Join(\"pages\", tmplPath)\n\n\tctx.Log().Tracef(\"view(layout:%s path:%s name:%s)\", htmlRdr.Layout, tmplPath, tmplName)\n\tvar err error\n\tif htmlRdr.Template, err = vm.engine.Get(htmlRdr.Layout, tmplPath, tmplName); err != nil {\n\t\tif err == view.ErrTemplateNotFound {\n\t\t\ttmplFile := filepath.Join(\"views\", tmplPath, tmplName)\n\t\t\tif !vm.filenameCaseSensitive {\n\t\t\t\ttmplFile = strings.ToLower(tmplFile)\n\t\t\t}\n\n\t\t\tctx.Log().Errorf(\"template not found: %s\", tmplFile)\n\t\t\tif vm.a.IsEnvProfile(\"prod\") {\n\t\t\t\thtmlRdr.ViewArgs[\"ViewNotFound\"] = \"View Not Found\"\n\t\t\t} else {\n\t\t\t\thtmlRdr.ViewArgs[\"ViewNotFound\"] = \"View Not Found: \" + tmplFile\n\t\t\t}\n\t\t\thtmlRdr.Layout = \"\"\n\t\t\thtmlRdr.Template = vm.notFoundTmpl\n\t\t} else {\n\t\t\tctx.Log().Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d7eb884439b3eb63a272e42aaece0e4a", "score": "0.5227899", "text": "func resolveHost(host string) string {\n\tif net.ParseIP(host) != nil {\n\t\treturn host\n\t}\n\n\tvar ip net.IP\n\tEventually(func() error {\n\t\tips, err := net.LookupIP(host)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ips) == 0 {\n\t\t\treturn errors.New(\"0 IPs returned from DNS\")\n\t\t}\n\t\tip = ips[0]\n\t\treturn nil\n\t}, time.Minute, time.Second*5).Should(Succeed())\n\n\treturn ip.String()\n}", "title": "" }, { "docid": "d7eb884439b3eb63a272e42aaece0e4a", "score": "0.5227899", "text": "func resolveHost(host string) string {\n\tif net.ParseIP(host) != nil {\n\t\treturn host\n\t}\n\n\tvar ip net.IP\n\tEventually(func() error {\n\t\tips, err := net.LookupIP(host)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ips) == 0 {\n\t\t\treturn errors.New(\"0 IPs returned from DNS\")\n\t\t}\n\t\tip = ips[0]\n\t\treturn nil\n\t}, time.Minute, time.Second*5).Should(Succeed())\n\n\treturn ip.String()\n}", "title": "" }, { "docid": "a9e379e7ad6788c35935dd695d71b29e", "score": "0.5206101", "text": "func (r *StateResolvable) Resolve(ctx context.Context) (interface{}, error) {\n\tctx = SetupContext(ctx, r.Path.After.Capture, r.Config)\n\tobj, _, _, err := state(ctx, r.Path, r.Config)\n\treturn obj, err\n}", "title": "" }, { "docid": "d0d0336cf395c6cf97afc5b363905fb7", "score": "0.51888067", "text": "func (h *htlcTimeoutResolver) Resolve() (ContractResolver, er.R) {\n\t// If we're already resolved, then we can exit early.\n\tif h.resolved {\n\t\treturn nil, nil\n\t}\n\n\t// If we haven't already sent the output to the utxo nursery, then\n\t// we'll do so now.\n\tif !h.outputIncubating {\n\t\tlog.Tracef(\"%T(%v): incubating htlc output\", h,\n\t\t\th.htlcResolution.ClaimOutpoint)\n\n\t\terr := h.IncubateOutputs(\n\t\t\th.ChanPoint, &h.htlcResolution, nil,\n\t\t\th.broadcastHeight,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\th.outputIncubating = true\n\n\t\tif err := h.Checkpoint(h); err != nil {\n\t\t\tlog.Errorf(\"unable to Checkpoint: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar spendTxID *chainhash.Hash\n\n\t// waitForOutputResolution waits for the HTLC output to be fully\n\t// resolved. The output is considered fully resolved once it has been\n\t// spent, and the spending transaction has been fully confirmed.\n\twaitForOutputResolution := func() er.R {\n\t\t// We first need to register to see when the HTLC output itself\n\t\t// has been spent by a confirmed transaction.\n\t\tspendNtfn, err := h.Notifier.RegisterSpendNtfn(\n\t\t\t&h.htlcResolution.ClaimOutpoint,\n\t\t\th.htlcResolution.SweepSignDesc.Output.PkScript,\n\t\t\th.broadcastHeight,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tselect {\n\t\tcase spendDetail, ok := <-spendNtfn.Spend:\n\t\t\tif !ok {\n\t\t\t\treturn errResolverShuttingDown.Default()\n\t\t\t}\n\t\t\tspendTxID = spendDetail.SpenderTxHash\n\n\t\tcase <-h.quit:\n\t\t\treturn errResolverShuttingDown.Default()\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Now that we've handed off the HTLC to the nursery, we'll watch for a\n\t// spend of the output, and make our next move off of that. Depending\n\t// on if this is our commitment, or the remote party's commitment,\n\t// we'll be watching a different outpoint and script.\n\toutpointToWatch, scriptToWatch, err := h.chainDetailsToWatch()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tspendNtfn, err := h.Notifier.RegisterSpendNtfn(\n\t\toutpointToWatch, scriptToWatch, h.broadcastHeight,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Infof(\"%T(%v): waiting for HTLC output %v to be spent\"+\n\t\t\"fully confirmed\", h, h.htlcResolution.ClaimOutpoint,\n\t\toutpointToWatch)\n\n\t// We'll block here until either we exit, or the HTLC output on the\n\t// commitment transaction has been spent.\n\tvar (\n\t\tspend *chainntnfs.SpendDetail\n\t\tok bool\n\t)\n\tselect {\n\tcase spend, ok = <-spendNtfn.Spend:\n\t\tif !ok {\n\t\t\treturn nil, errResolverShuttingDown.Default()\n\t\t}\n\t\tspendTxID = spend.SpenderTxHash\n\n\tcase <-h.quit:\n\t\treturn nil, errResolverShuttingDown.Default()\n\t}\n\n\t// If the spend reveals the pre-image, then we'll enter the clean up\n\t// workflow to pass the pre-image back to the incoming link, add it to\n\t// the witness cache, and exit.\n\tif isSuccessSpend(spend, h.htlcResolution.SignedTimeoutTx != nil) {\n\t\tlog.Infof(\"%T(%v): HTLC has been swept with pre-image by \"+\n\t\t\t\"remote party during timeout flow! Adding pre-image to \"+\n\t\t\t\"witness cache\", h.htlcResolution.ClaimOutpoint)\n\n\t\treturn h.claimCleanUp(spend)\n\t}\n\n\tlog.Infof(\"%T(%v): resolving htlc with incoming fail msg, fully \"+\n\t\t\"confirmed\", h, h.htlcResolution.ClaimOutpoint)\n\n\t// At this point, the second-level transaction is sufficiently\n\t// confirmed, or a transaction directly spending the output is.\n\t// Therefore, we can now send back our clean up message, failing the\n\t// HTLC on the incoming link.\n\tfailureMsg := &lnwire.FailPermanentChannelFailure{}\n\tif err := h.DeliverResolutionMsg(ResolutionMsg{\n\t\tSourceChan: h.ShortChanID,\n\t\tHtlcIndex: h.htlc.HtlcIndex,\n\t\tFailure: failureMsg,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar reports []*channeldb.ResolverReport\n\n\t// Finally, if this was an output on our commitment transaction, we'll\n\t// wait for the second-level HTLC output to be spent, and for that\n\t// transaction itself to confirm.\n\tif h.htlcResolution.SignedTimeoutTx != nil {\n\t\tlog.Infof(\"%T(%v): waiting for nursery to spend CSV delayed \"+\n\t\t\t\"output\", h, h.htlcResolution.ClaimOutpoint)\n\t\tif err := waitForOutputResolution(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Once our timeout tx has confirmed, we add a resolution for\n\t\t// our timeoutTx tx first stage transaction.\n\t\ttimeoutTx := h.htlcResolution.SignedTimeoutTx\n\t\tspendHash := timeoutTx.TxHash()\n\n\t\treports = append(reports, &channeldb.ResolverReport{\n\t\t\tOutPoint: timeoutTx.TxIn[0].PreviousOutPoint,\n\t\t\tAmount: h.htlc.Amt.ToSatoshis(),\n\t\t\tResolverType: channeldb.ResolverTypeOutgoingHtlc,\n\t\t\tResolverOutcome: channeldb.ResolverOutcomeFirstStage,\n\t\t\tSpendTxID: &spendHash,\n\t\t})\n\t}\n\n\t// With the clean up message sent, we'll now mark the contract\n\t// resolved, record the timeout and the sweep txid on disk, and wait.\n\th.resolved = true\n\n\tamt := btcutil.Amount(h.htlcResolution.SweepSignDesc.Output.Value)\n\treports = append(reports, &channeldb.ResolverReport{\n\t\tOutPoint: h.htlcResolution.ClaimOutpoint,\n\t\tAmount: amt,\n\t\tResolverType: channeldb.ResolverTypeOutgoingHtlc,\n\t\tResolverOutcome: channeldb.ResolverOutcomeTimeout,\n\t\tSpendTxID: spendTxID,\n\t})\n\n\treturn nil, h.Checkpoint(h, reports...)\n}", "title": "" }, { "docid": "3ed916f3fda151a3e73d8a2c30035ccf", "score": "0.51579833", "text": "func (high *hostIDGetHandler) Run(ctx context.Context) gimlet.Responder {\n\tfoundHost, err := high.sc.FindHostById(high.hostID)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Database error for find() by distro id '%s'\", high.hostID))\n\t}\n\n\thostModel := &model.APIHost{}\n\tif err = hostModel.BuildFromService(*foundHost); err != nil {\n\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrap(err, \"API Error converting from host.Host to model.APIHost\"))\n\t}\n\n\tif foundHost.RunningTask != \"\" {\n\t\trunningTask, err := high.sc.FindTaskById(foundHost.RunningTask)\n\t\tif err != nil {\n\t\t\tif apiErr, ok := err.(gimlet.ErrorResponse); !ok || (ok && apiErr.StatusCode != http.StatusNotFound) {\n\t\t\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrap(err, \"Database error\"))\n\t\t\t}\n\t\t}\n\n\t\tif err = hostModel.BuildFromService(runningTask); err != nil {\n\t\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrap(err, \"problem adding task data to host response\"))\n\t\t}\n\t}\n\n\treturn gimlet.NewJSONResponse(hostModel)\n}", "title": "" }, { "docid": "5b5e192132b8a531446ad170f5101eff", "score": "0.5149495", "text": "func (r *Resolver) resolve(ctx context.Context, repoCtx v2.Repository, name, version string, withBlobResolver bool) (*v2.ComponentDescriptor, ctf.BlobResolver, error) {\n\tvar repo v2.OCIRegistryRepository\n\tswitch r := repoCtx.(type) {\n\tcase *v2.UnstructuredTypedObject:\n\t\tif err := r.DecodeInto(&repo); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\tcase *v2.OCIRegistryRepository:\n\t\trepo = *r\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"unknown repository context type %s\", repoCtx.GetType())\n\t}\n\n\t// setup logger\n\tlog := logr.FromContext(ctx)\n\tif log == nil {\n\t\tlog = r.log\n\t}\n\tlog = log.WithValues(\"repoCtxType\", repoCtx.GetType(), \"baseUrl\", repo.BaseURL, \"name\", name, \"version\", version)\n\n\tif r.cache != nil {\n\t\tcd, err := r.cache.Get(ctx, repo, name, version)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, ctf.NotFoundError) {\n\t\t\t\tlog.V(5).Info(err.Error())\n\t\t\t} else {\n\t\t\t\tlog.Error(err, \"unable to get component descriptor\")\n\t\t\t}\n\t\t} else {\n\t\t\tif withBlobResolver {\n\t\t\t\tmanifest, ref , err := r.fetchManifest(ctx, repo, name, version)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, err\n\t\t\t\t}\n\t\t\t\treturn cd, NewBlobResolver(r.client, ref, manifest, cd), nil\n\t\t\t}\n\t\t\treturn cd, nil, nil\n\t\t}\n\t}\n\n\tmanifest, ref , err := r.fetchManifest(ctx, repo, name, version)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcomponentConfig, err := r.getComponentConfig(ctx, ref, manifest)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcomponentDescriptorLayer := GetLayerWithDigest(manifest.Layers, componentConfig.ComponentDescriptorLayer.Digest)\n\tif componentDescriptorLayer == nil {\n\t\treturn nil, nil, fmt.Errorf(\"no component descriptor layer defined\")\n\t}\n\n\tvar componentDescriptorLayerBytes bytes.Buffer\n\tif err := r.client.Fetch(ctx, ref, *componentDescriptorLayer, &componentDescriptorLayerBytes); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to fetch component descriptor layer: %w\", err)\n\t}\n\n\tcomponentDescriptorBytes := componentDescriptorLayerBytes.Bytes()\n\tswitch componentDescriptorLayer.MediaType {\n\tcase ComponentDescriptorTarMimeType, LegacyComponentDescriptorTarMimeType:\n\t\tcomponentDescriptorBytes, err = ReadComponentDescriptorFromTar(&componentDescriptorLayerBytes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"unable to read component descriptor from tar: %w\", err)\n\t\t}\n\tcase ComponentDescriptorJSONMimeType:\n\tdefault:\n\t\treturn nil, nil, fmt.Errorf(\"unsupported media type %q\", componentDescriptorLayer.MediaType)\n\t}\n\n\tcd := &v2.ComponentDescriptor{}\n\tif err := codec.Decode(componentDescriptorBytes, cd, r.decodeOpts...); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to decode component descriptor: %w\", err)\n\t}\n\tif err := v2.InjectRepositoryContext(cd, &repo); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif r.cache != nil {\n\t\tif err := r.cache.Store(ctx, cd.DeepCopy()); err != nil {\n\t\t\tlog.Error(err, \"unable to store component descriptor\")\n\t\t}\n\t}\n\n\tif withBlobResolver {\n\t\treturn cd, NewBlobResolver(r.client, ref, manifest, cd), nil\n\t}\n\treturn cd, nil, nil\n}", "title": "" }, { "docid": "8c76569fe367069182eece3c5d5bba85", "score": "0.5144861", "text": "func (self *RawDispatcher) resolve(rawPath string) (string, string, *restObj) {\n\tpath := rawPath\n\tif strings.HasSuffix(path,\"/\") && path!=\"/\" {\n\t\tpath=path[0:len(path)-1]\n\t}\n\tpre := self.Prefix + \"/\"\n\tif self.Prefix != \"\" {\n\t\tif !strings.HasPrefix(path, pre) {\n\t\t\tpanic(fmt.Sprintf(\"expected prefix %s on the URL path but not found on: %s\", pre, path))\n\t\t}\n\t\tpath = path[len(pre):]\n\t}\n\td, ok := self.Res[path]\n\tvar id string\n\tresult := path\n\tif !ok {\n\t\ti := strings.LastIndex(path, \"/\")\n\t\tif i == -1 {\n\t\t\treturn \"\", \"\", nil\n\t\t}\n\t\tid = path[i+1:]\n\t\tvar uriPathParent string\n\t\turiPathParent = path[:i]\n\t\td, ok = self.Res[uriPathParent]\n\t\tif !ok {\n\t\t\treturn \"\", \"\", nil\n\t\t}\n\t\tresult = uriPathParent\n\t}\n\treturn result, id, d\n}", "title": "" }, { "docid": "1868fb422c46ec3537d1fcffb1fcd1e8", "score": "0.51399547", "text": "func (d *DatadogMetricInternal) resolveQuery(query string) {\n\tresolvedQuery, err := resolveQuery(query)\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to resolve DatadogMetric query %q: %v\", d.query, err)\n\t\td.Valid = false\n\t\td.Error = fmt.Errorf(\"Cannot resolve query: %v\", err)\n\t\td.UpdateTime = time.Now().UTC()\n\t\td.resolvedQuery = nil\n\t\treturn\n\t}\n\tif resolvedQuery != \"\" {\n\t\tlog.Infof(\"DatadogMetric query %q was resolved successfully, new query: %q\", query, resolvedQuery)\n\t\td.resolvedQuery = &resolvedQuery\n\t\treturn\n\t}\n\td.resolvedQuery = &d.query\n}", "title": "" }, { "docid": "5fd8e647919ba4d7604fe3f7adcd935e", "score": "0.5116726", "text": "func (b *Browser) resolve_service_discovery(op *dnssd.ResolveOp, err error, host string, port int, txt map[string]string){\n if err != nil {\n log.Printf(\"Resolving discovery failed: %s\", err)\n return\n }\n update_device_map(b.DeviceMap, op.Name(), host, port, txt)\n}", "title": "" }, { "docid": "0c15a5d280b1cdd7a85bc90b4c8129a4", "score": "0.51142853", "text": "func (r Resolver) Resolve(dst string) error {\n\tif err := os.RemoveAll(dst); err != nil {\n\t\treturn err\n\t}\n\treturn exec.RunCommand(Command(dst))\n}", "title": "" }, { "docid": "fe37d2b7b2214b1ef8d9de877080548c", "score": "0.5104896", "text": "func (s *hashResolverServer) ResolveHash(ctx context.Context, req *pb.ResolveRequest) (*pb.ResolveResponse, error) {\n\n\tvar deal *deal\n\n\tlog.Printf(\"ResolveHash stating with for hash: %v amount %v \",req.Hash, req.Amount)\n\n\tfor _, d := range deals{\n\t\tif hex.EncodeToString(d.hash[:]) == req.Hash{\n\t\t\tdeal = d\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif deal == nil{\n\t\tlog.Printf(\"Something went wrong. Can't find deal in hashResolverServer: %v \",req.Hash)\n\t\treturn nil, fmt.Errorf(\"Something went wrong. Can't find deal in hashResolverServer\")\n\t}\n\n\t// If I'm the taker I need to forward the payment to the other chanin\n\t// TODO: check that I got the right amount before sending out the agreed amount\n\tif deal.myRole == Taker{\n\n\t\tlog.Printf(\"Taker code\")\n\n\t\tcmdLnd := s.p2pServer.lnBTC\n\n\t\tswitch deal.makerCoin{\n\t\tcase pbp2p.CoinType_BTC:\n\n\t\tcase pbp2p.CoinType_LTC:\n\t\t\tcmdLnd = s.p2pServer.lnLTC\n\n\t\t}\n\n\t\tlncctx := context.Background()\n\t\tresp, err := cmdLnd.SendPaymentSync(lncctx,&lnrpc.SendRequest{\n\t\t\tDestString:deal.makerPubKey,\n\t\t\tAmt:deal.makerAmount,\n\t\t\tPaymentHash:deal.hash[:],\n\t\t})\n\t\tif err != nil{\n\t\t\terr = fmt.Errorf(\"Got error sending %d %v by taker - %v\",\n\t\t\t\tdeal.makerAmount,deal.makerCoin.String(),err)\n\t\t\tlog.Printf(err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\tif resp.PaymentError != \"\"{\n\t\t\terr = fmt.Errorf(\"Got PaymentError sending %d %v by taker - %v\",\n\t\t\t\tdeal.makerAmount,deal.makerCoin.String(), resp.PaymentError)\n\t\t\tlog.Printf(err.Error())\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlog.Printf(\"sendPayment response from maker to taker:%v\",spew.Sdump(resp))\n\n\n\t\treturn &pb.ResolveResponse{\n\t\t\tPreimage: hex.EncodeToString(resp.PaymentPreimage[:]),\n\t\t}, nil\n\t}\n\n\t// If we are here we are the maker\n\tlog.Printf(\"Maker code\")\n\n\treturn &pb.ResolveResponse{\n\t\tPreimage: hex.EncodeToString(deal.preImage[:]),\n\t}, nil\n\n}", "title": "" }, { "docid": "6cd8f18a7a2fc209f4fc0da07b022a4c", "score": "0.50979686", "text": "func (m *LeaseManager) resolveName(\n\ttxn *client.Txn, dbID sqlbase.ID, tableName string,\n) (sqlbase.ID, error) {\n\tnameKey := tableKey{dbID, tableName}\n\tkey := nameKey.Key()\n\tgr, err := txn.Get(key)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif !gr.Exists() {\n\t\treturn 0, sqlbase.ErrDescriptorNotFound\n\t}\n\treturn sqlbase.ID(gr.ValueInt()), nil\n}", "title": "" }, { "docid": "952201a7b3563c290cba36d3c7e4707d", "score": "0.50954616", "text": "func (_VirtualChannelResolverInterface *VirtualChannelResolverInterfaceCaller) Resolve(opts *bind.CallOpts, _virtualAddr [32]byte) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _VirtualChannelResolverInterface.contract.Call(opts, out, \"resolve\", _virtualAddr)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a722c8b69335a675b9e6f449ea6268dd", "score": "0.50892603", "text": "func (nettest *Nettest) ResolverLookup(ctx context.Context) error {\n\treturn errors.New(\"Not implemented\")\n}", "title": "" }, { "docid": "932f412035133928c582cc54c331797f", "score": "0.5085881", "text": "func resolve(host string, port int) *net.UDPAddr {\n\taddr := fmt.Sprintf(\"%s:%d\", host, port)\n\tvar (\n\t\tresolved *net.UDPAddr\n\t\tresolveErr error\n\t)\n\tfor i := 0; i < 10; i++ {\n\t\tresolved, resolveErr = net.ResolveUDPAddr(udp, addr)\n\t\tif resolveErr == nil {\n\t\t\treturn resolved\n\t\t}\n\t\ttime.Sleep(time.Millisecond * 300 * time.Duration(i))\n\t}\n\tpanic(resolveErr)\n}", "title": "" }, { "docid": "f9d666cbcecdb92ac752c76c93090b6f", "score": "0.50813764", "text": "func (r *Fastest) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {\n\tlog := logger(r.id, q, ci)\n\n\ttype response struct {\n\t\tr Resolver\n\t\ta *dns.Msg\n\t\terr error\n\t}\n\n\tresponseCh := make(chan response, len(r.resolvers))\n\n\t// Send the query to all resolvers. The responses are collected in a buffered channel\n\tfor _, resolver := range r.resolvers {\n\t\tresolver := resolver\n\t\tgo func() {\n\t\t\ta, err := resolver.Resolve(q, ci)\n\t\t\tresponseCh <- response{resolver, a, err}\n\t\t}()\n\t}\n\n\t// Wait for responses, the first one that is successful is returned while the remaining open requests\n\t// are abandoned.\n\tvar i int\n\tfor resolverResponse := range responseCh {\n\t\tresolver, a, err := resolverResponse.r, resolverResponse.a, resolverResponse.err\n\t\tif err == nil && (a == nil || a.Rcode != dns.RcodeServerFailure) { // Return immediately if successful\n\t\t\tlog.WithField(\"resolver\", resolver.String()).Trace(\"using response from resolver\")\n\t\t\treturn a, err\n\t\t}\n\t\tlog.WithField(\"resolver\", resolver.String()).WithError(err).Debug(\"resolver returned failure, waiting for next response\")\n\n\t\t// If all responses were bad, return the last one\n\t\tif i++; i >= len(r.resolvers) {\n\t\t\treturn a, err\n\t\t}\n\t}\n\treturn nil, nil // should never be reached\n}", "title": "" }, { "docid": "ae35c142a8850853a7aa04d453e611d0", "score": "0.5074897", "text": "func (e externalResolver) resolve(importpath, dir string) (label, error) {\n\tprefix := specialCases(importpath)\n\tif prefix == \"\" {\n\t\tr, err := repoRootForImportPath(importpath, false)\n\t\tif err != nil {\n\t\t\treturn label{}, err\n\t\t}\n\t\tprefix = r.Root\n\t}\n\n\tvar pkg string\n\tif importpath != prefix {\n\t\tpkg = strings.TrimPrefix(importpath, prefix+\"/\")\n\t}\n\n\treturn label{\n\t\trepo: ImportPathToBazelRepoName(prefix),\n\t\tpkg: pkg,\n\t\tname: defaultLibName,\n\t}, nil\n}", "title": "" }, { "docid": "84e6879c8a22f3b0c4f7aacad69ca46f", "score": "0.50744575", "text": "func (r *EtcdRegistry) Resolve(target string) (naming.Watcher, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), ResolverTimeOut)\n\twatcher := &EtcdWatcher{\n\t\tcli: r.cli,\n\t\ttarget: target,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t}\n\treturn watcher, nil\n}", "title": "" }, { "docid": "46b7a409a35856a19a3f9d66048a13ed", "score": "0.5073967", "text": "func (r *GreetingRequest) Resolve(ctx huma.Context, prefix *huma.PathBuffer) []error {\n\tif strings.Contains(r.Name, \"err\") {\n\t\treturn []error{&huma.ErrorDetail{\n\t\t\tLocation: \"path.name\",\n\t\t\tMessage: \"I do not like this name!\",\n\t\t\tValue: r.Name,\n\t\t}}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf76b9eb53ff3a1403c34424b2670ae9", "score": "0.5059154", "text": "func (s *Store) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) {\n\treturn s.resolver.Resolve(ctx, reference)\n}", "title": "" }, { "docid": "cc6ce8d95fa3f70c3b11464cb0584922", "score": "0.505914", "text": "func (c *Resolver) Resolve(target string) (naming.Watcher, error) {\n\tif pilotClient == nil {\n\t\treturn nil, fmt.Errorf(\"PilotClient not initialized. Use SetPilotClient prior to any operation\")\n\t}\n\tlog.Bg().Info(\"Starting look aside resolver for \" + target)\n\treturn newPilotWatcher(target), nil\n}", "title": "" }, { "docid": "c629f7a33683c73f2c00048c4bed42e4", "score": "0.5053831", "text": "func (*GRPCResolver) ResolveNow(o grpcresolver.ResolveNowOption) {\n}", "title": "" }, { "docid": "3b0e5e9d16b0203d80dc3c00b52033b0", "score": "0.5050583", "text": "func (self *Cache) _resolveURL1O(url string, data interface{}) string{\n return self.Object.Call(\"_resolveURL\", url, data).String()\n}", "title": "" }, { "docid": "dca74faf5f62e7770958c08a1752997a", "score": "0.50286704", "text": "func queryResolveDomainHandler(ctx sdk.Context, _ []string, req abci.RequestQuery, k Keeper) ([]byte, error) {\n\tq := new(QueryResolveDomain)\n\terr := queries.DefaultQueryDecode(req.Data, q)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())\n\t}\n\tif err = q.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tfilter := &types.Domain{Name: q.Name}\n\tdomain := new(types.Domain)\n\tif err = k.DomainStore(ctx).Read(filter.PrimaryKey(), domain); err != nil {\n\t\treturn nil, sdkerrors.Wrapf(types.ErrDomainDoesNotExist, \"not found: %s\", q.Name)\n\t}\n\t// return response\n\trespBytes, err := queries.DefaultQueryEncode(QueryResolveDomainResponse{Domain: *domain})\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrJSONMarshal, err.Error())\n\t}\n\treturn respBytes, nil\n}", "title": "" }, { "docid": "e2b325bbb16291c03f6498831df6ea0b", "score": "0.50117326", "text": "func DoQuery(\n\tdomainName string,\n\tdomainResolverIP []string,\n\tdomainResolverPort string,\n\tqueryType uint16,\n\tqueryOpt *dns.OPT, t string) (*dns.Msg, *MyError.MyError) {\n\n\tc := ClientPool.Get().(*dns.Client)\n\tdefer func(c *dns.Client) {\n\t\tgo func() {\n\t\t\tRenewDnsClient(c)\n\t\t\tClientPool.Put(c)\n\t\t}()\n\t}(c)\n\tc.Net = t\n\n\t//\tm := &dns.Msg{}\n\tm := DnsMsgPool.Get().(*dns.Msg)\n\tdefer func(m *dns.Msg) {\n\t\tgo func() {\n\t\t\tRenewDnsMsg(m)\n\t\t\tDnsMsgPool.Put(m)\n\t\t}()\n\t}(m)\n\tm.AuthenticatedData = true\n\tm.RecursionDesired = true\n\t//\tm.Truncated= false\n\tm.SetQuestion(dns.Fqdn(domainName), queryType)\n\n\tif queryOpt != nil {\n\t\tm.Extra = append(m.Extra, queryOpt)\n\t}\n\tvar x = make(chan *dns.Msg)\n\tvar closesig = make(chan struct{})\n\tfor _, ds := range domainResolverIP {\n\t\tgo func(c *dns.Client, m *dns.Msg, ds, dp string, queryType uint16, closesig chan struct{}) {\n\t\t\tselect {\n\t\t\tcase x <- doQuery(*c, *m, ds, domainResolverPort, queryType, closesig):\n\t\t\tdefault:\n\t\t\t}\n\t\t}(c, m, ds, domainResolverPort, queryType, closesig)\n\t}\n\n\tif r := <-x; r != nil {\n\t\tclose(closesig)\n\t\treturn r, nil\n\t} else {\n\t\treturn nil, MyError.NewError(MyError.ERROR_UNKNOWN, \"Query failed \"+domainName)\n\t}\n}", "title": "" }, { "docid": "1ba5a417d4d56a59cb0c4a17317ba0da", "score": "0.50094527", "text": "func (_VirtContractResolver *VirtContractResolverCaller) Resolve(opts *bind.CallOpts, virt [32]byte) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _VirtContractResolver.contract.Call(opts, out, \"resolve\", virt)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e555db1b92883c72caeb105d84d9515a", "score": "0.5003982", "text": "func (r *ResourceMetaResolvable) Resolve(ctx context.Context) (interface{}, error) {\n\tctx = capture.Put(ctx, r.After.Commands.Capture)\n\tstate := capture.NewState(ctx)\n\tresult := &gfxapi.ResourceMeta{\n\t\tIDMap: gfxapi.ResourceMap{},\n\t}\n\tp := &path.ResourceData{Id: r.Id, After: r.After}\n\tresource, err := buildResource(ctx, state, p, result.IDMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult.Resource = resource\n\treturn result, nil\n}", "title": "" }, { "docid": "9fbb3127bc2b266521fbec3aebbea9e0", "score": "0.50034815", "text": "func (c *Client) resolveCname(target string) ([]dns.RR, string) {\n\tvar chain []dns.RR\n\tnow := c.Clock.Now()\n\tfor {\n\t\tentry := c.cnames[target]\n\t\tif entry == nil {\n\t\t\treturn chain, target\n\t\t}\n\t\tentry.rr.Header().Ttl = entry.ttl(now)\n\t\tchain = append(chain, entry.rr)\n\t\ttarget = entry.cname().Target\n\t}\n}", "title": "" }, { "docid": "d585d77b8de74339d05ce628b6063b5c", "score": "0.5002932", "text": "func (a *App) resolveRequest(ctx context.Context, reqID string, userEmail string, resolution Resolution) error {\n\tparams := types.AccessRequestUpdate{RequestID: reqID, Reason: resolution.Reason}\n\n\tswitch resolution.Tag {\n\tcase ResolvedApproved:\n\t\tparams.State = types.RequestState_APPROVED\n\tcase ResolvedDenied:\n\t\tparams.State = types.RequestState_DENIED\n\tdefault:\n\t\treturn trace.BadParameter(\"unknown resolution tag %v\", resolution.Tag)\n\t}\n\n\tdelegator := fmt.Sprintf(\"%s:%s\", pluginName, userEmail)\n\n\tif err := a.teleport.SetAccessRequestState(apiutils.WithDelegator(ctx, delegator), params); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tlogger.Get(ctx).Infof(\"Jira user %s the request\", resolution.Tag)\n\treturn nil\n}", "title": "" }, { "docid": "d60fa6e5ba0fd5777310e3bc31b32dee", "score": "0.5001189", "text": "func (_IStaking *IStakingTransactor) ResolveChallenge(opts *bind.TransactOpts, winner common.Address, loser common.Address, challengeType *big.Int) (*types.Transaction, error) {\n\treturn _IStaking.contract.Transact(opts, \"resolveChallenge\", winner, loser, challengeType)\n}", "title": "" }, { "docid": "1a5c4a11d8e69b58a0a274cf891abcbc", "score": "0.49854773", "text": "func (r *FootprintResolvable) Resolve(ctx context.Context) (interface{}, error) {\n\tc, err := capture.ResolveFromPath(ctx, r.Capture)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmds := c.Commands\n\tbuilders := map[api.API]FootprintBuilder{}\n\n\tft := NewFootprint(ctx, cmds)\n\n\ts := c.NewState()\n\tt0 := footprintBuildCounter.Start()\n\tdefer footprintBuildCounter.Stop(t0)\n\tapi.ForeachCmd(ctx, cmds, func(ctx context.Context, id api.CmdID, cmd api.Cmd) error {\n\t\ta := cmd.API()\n\t\tif _, ok := builders[cmd.API()]; !ok {\n\t\t\tif bp, ok := cmd.API().(FootprintBuilderProvider); ok {\n\t\t\t\tbuilders[cmd.API()] = bp.FootprintBuilder(ctx)\n\t\t\t} else {\n\t\t\t\t// API does not provide execution footprint info, always keep commands\n\t\t\t\t// from such APIs alive.\n\t\t\t\tbh := NewBehavior(api.SubCmdIdx{uint64(id)}, &dummyMachine{})\n\t\t\t\tbh.Alive = true\n\t\t\t\t// Even if the command does not belong to an API that provides\n\t\t\t\t// execution footprint info, we still need to mutate it in the new\n\t\t\t\t// state, because following commands in other APIs may depends on the\n\t\t\t\t// side effect of the this command.\n\t\t\t\tif err := cmd.Mutate(ctx, s, nil); err != nil {\n\t\t\t\t\tbh.Aborted = true\n\t\t\t\t\t// TODO: This error should be moved to report view.\n\t\t\t\t\treturn fmt.Errorf(\"Command %v %v: %v\", id, cmd, err)\n\t\t\t\t}\n\t\t\t\tft.AddBehavior(ctx, bh)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tbuilders[a].BuildFootprint(ctx, s, ft, id, cmd)\n\t\treturn nil\n\t})\n\treturn ft, nil\n}", "title": "" }, { "docid": "28534d5476739a4b9ea93ce56caa0213", "score": "0.4981542", "text": "func Resolve(fqdn string, qtype uint16, resolver string) (resp *dns.Msg, err error) {\n\tresp, err = resolveTransport(\"udp\", fqdn, qtype, resolver)\n\tif err != nil {\n\t\tif resp != nil && resp.Truncated {\n\t\t\tlog.Debug(\"Response truncated, retrying with TCP\")\n\t\t\tresp, err = resolveTransport(\"tcp\", fqdn, qtype, resolver)\n\t\t} else {\n\t\t\tlog.WithFields(log.Fields{\"fqdn\": fqdn, \"resolver\": resolver}).Warn(\"Recurser error: \", err)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c06ec3b13ee921a5d2a1f79f84f5e7f9", "score": "0.49771732", "text": "func (p *Pool) execute(id int, dw doWork) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\n\t\t\t// Capture the stack trace\n\t\t\tbuf := make([]byte, 10000)\n\t\t\truntime.Stack(buf, false)\n\n\t\t\tp.Event(dw.context, \"execute\", \"ERROR : %s\", string(buf))\n\t\t}\n\t}()\n\n\t// Perform the work.\n\tdw.do.Work(dw.context, id)\n}", "title": "" }, { "docid": "2b4158abfadae0361c8be6d7eb8f1f01", "score": "0.4972328", "text": "func (r *ReconcileBOSHDeployment) resolveManifest(ctx context.Context, bdpl *bdv1.BOSHDeployment) (*bdm.Manifest, error) {\n\tlog.Debug(ctx, \"Resolving manifest\")\n\tmanifest, err := r.withops.Manifest(ctx, bdpl, bdpl.GetNamespace())\n\tif err != nil {\n\t\treturn nil, log.WithEvent(bdpl, \"WithOpsManifestError\").Errorf(ctx, \"Error resolving the manifest '%s': %s\", bdpl.GetNamespacedName(), err)\n\t}\n\n\treturn manifest, nil\n}", "title": "" }, { "docid": "c171c1731b63aa28d0b87ef60da61f98", "score": "0.49686024", "text": "func (t *Topographer) Resolve(ctx context.Context,\n\tip net.IP,\n\tproviders []string) (ResolveResult, error) {\n\tt.rwmutex.RLock()\n\tdefer t.rwmutex.RUnlock()\n\n\tctx, cancel := context.WithCancel(ctx)\n\n\tdefer cancel()\n\n\tip = ip.To16()\n\trv := ResolveResult{\n\t\tIP: ip,\n\t}\n\n\tif t.closed {\n\t\treturn rv, ErrTopographerShutdown\n\t}\n\n\tprovidersToUse, err := t.getProvidersToUse(providers)\n\tif err != nil {\n\t\treturn rv, err\n\t}\n\n\tresultChannel := make(chan ResolveResult)\n\twg := &sync.WaitGroup{}\n\tgroupRequest := newPoolGroupRequest(ctx, resultChannel,\n\t\tprovidersToUse, wg, t.workerPool)\n\n\tif err := groupRequest.Do(ctx, ip); err != nil {\n\t\treturn rv, nil\n\t}\n\n\trv = <-resultChannel\n\n\twg.Wait()\n\tclose(resultChannel)\n\n\treturn rv, nil\n}", "title": "" }, { "docid": "45d645a7ebd8babdf1247e987e661bde", "score": "0.49668056", "text": "func (dpdo *DeathPlaceDeleteOne) Exec(ctx context.Context) error {\n\tn, err := dpdo.dpd.Exec(ctx)\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase n == 0:\n\t\treturn &NotFoundError{deathplace.Label}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "9e77f562e31e158ae15a753fd9b4f4de", "score": "0.49596775", "text": "func (c BridgeHttpSession) Resolve(ctx context.Context) error {\n\treturn capnp.Client(c).Resolve(ctx)\n}", "title": "" }, { "docid": "4821e7f0917ab395459a71beb646b47e", "score": "0.49524266", "text": "func resolveTask(ps Resolver, id string, task *types.TaskSpec, resolvedC chan []sourceFnRef) error {\n\tif task == nil || resolvedC == nil {\n\t\treturn nil\n\t}\n\n\ttoResolve := []string{task.FunctionRef}\n\tresolved := []sourceFnRef{}\n\n\tif constr := task.GetExecConstraints(); constr != nil {\n\t\tif constr.GetMultiZone() {\n\t\t\tzoneVariants := types.GenZoneVariants(task.FunctionRef)\n\t\t\ttoResolve = append(toResolve, zoneVariants...)\n\t\t}\n\t}\n\n\t// resolve all of the functions across all zones for the given task\n\tfor _, r := range toResolve {\n\t\tt, err := ps.Resolve(r)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Error resolving fn %v, reason: %+v --- Skipping\", r, err)\n\t\t\tcontinue\n\t\t}\n\t\tresolved = append(resolved, sourceFnRef{\n\t\t\tsrc: r,\n\t\t\tFnRef: &t,\n\t\t})\n\t}\n\n\tif len(resolved) < 1 {\n\t\treturn fmt.Errorf(\"Could not resolve fnRef: %v\", task.FunctionRef)\n\t}\n\n\tresolvedC <- resolved\n\treturn nil\n}", "title": "" }, { "docid": "2844afb4b656a41b20f052dc62615fa3", "score": "0.49520016", "text": "func (r Resolver) Resolve(host string) *ResolvedHost {\n\thostname := r.resolveHostname(host)\n\n\tport, err := r.sshConfig.Get(host, \"Port\")\n\tif err != nil {\n\t\tport = \"\"\n\t}\n\n\tuser, err := r.sshConfig.Get(host, \"User\")\n\tif err != nil {\n\t\tuser = \"\"\n\t}\n\n\tkey := r.resolveKey(host)\n\n\treturn &ResolvedHost{\n\t\tHostname: hostname,\n\t\tPort: port,\n\t\tUser: user,\n\t\tKey: key,\n\t}\n}", "title": "" }, { "docid": "d9d9b4b2ab44676c6e5b8b3899cdbf5d", "score": "0.49410605", "text": "func (r etcd) ResolveNow(rn resolver.ResolveNowOptions) {\n\t// will force to update address list immediately\n}", "title": "" }, { "docid": "7da035ef48c2df579ba2aa4f9dd2944a", "score": "0.49398404", "text": "func (er *EtcdResolver) Resolve(target string) (naming.Watcher, error) {\n\tif er.ServiceName == \"\" {\n\t\treturn nil, errors.New(\"wonaming: no service name provided\")\n\t}\n\n\t// generate etcd client, return if error\n\tendpoints := strings.Split(target, \",\")\n\tconf := etcd.Config{\n\t\tEndpoints: endpoints,\n\t\tTransport: etcd.DefaultTransport,\n\t\tHeaderTimeoutPerRequest: time.Second,\n\t}\n\n\tclient, err := etcd.New(conf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"wonaming: creat etcd error: %s\", err.Error())\n\t}\n\n\tkapi := etcd.NewKeysAPI(client)\n\n\t// Return EtcdWatcher\n\twatcher := &EtcdWatcher{\n\t\tprefix: er.prefix,\n\t\tsrvName: er.ServiceName,\n\t\tclient: &client,\n\t\tkapi: kapi,\n\t\taddrs: nil,\n\t}\n\treturn watcher, nil\n}", "title": "" }, { "docid": "1f6e2828f3d78e91c1ed59a88946eab3", "score": "0.49265575", "text": "func (r *reconciler) resolveObjectReference(namespace string, ref *corev1.ObjectReference) (string, error) {\n\tresourceClient, err := CreateResourceInterface(r.restConfig, ref, namespace)\n\tif err != nil {\n\t\tglog.Warningf(\"failed to create dynamic client resource: %v\", err)\n\t\treturn \"\", err\n\t}\n\n\tobj, err := resourceClient.Get(ref.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tglog.Warningf(\"failed to get object: %v\", err)\n\t\treturn \"\", err\n\t}\n\tstatus, ok := obj.Object[\"status\"]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"%q does not contain status\", ref.Name)\n\t}\n\tstatusMap := status.(map[string]interface{})\n\tserviceName, ok := statusMap[targetFieldName]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"%q does not contain field %q in status\", targetFieldName, ref.Name)\n\t}\n\tserviceNameStr, ok := serviceName.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"%q status field %q is not a string\", targetFieldName, ref.Name)\n\t}\n\treturn serviceNameStr, nil\n}", "title": "" }, { "docid": "2a36c447fe3d1a90e8f0f3efbca2e629", "score": "0.4925033", "text": "func (c *Client) Resolved(unit string, retry bool) error {\n\tp := params.Resolved{\n\t\tUnitName: unit,\n\t\tRetry: retry,\n\t}\n\treturn c.call(\"Resolved\", p, nil)\n}", "title": "" }, { "docid": "5289dcd1374199dd1b5ef32b7fcb3cc0", "score": "0.49197668", "text": "func (self *Cache) _resolveURLI(args ...interface{}) string{\n return self.Object.Call(\"_resolveURL\", args).String()\n}", "title": "" }, { "docid": "8c25ad29e288ca52e5d3c43eca680e75", "score": "0.49159223", "text": "func (p *Program) resolve() {\n\taddress := 0\n\tfor _, inst := range p.Instructions {\n\t\titype, err := inst.GetType()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif itype == L {\n\t\t\t// extrsact the label from the instruction and assign the next address\n\t\t\tlabel := strings.Trim(inst.Text, \"()\")\n\t\t\t//fmt.Fprintln(os.Stderr, \"Symbol[\", label, \"] = \", address)\n\t\t\tSymbols[label] = address\n\t\t} else {\n\t\t\taddress++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "30738a6920b6b1b9092aa0a415e8e607", "score": "0.49106473", "text": "func (e *Nacos) Lookup(ctx context.Context, w dns.ResponseWriter, r *dns.Msg, state request.Request, name string, typ uint16) (int, error) {\n\n\tNacosClientLogger.Info(\"lookup \" + name + \" from upstream \")\n\n\tcode, err := e.Proxys.ServeDNS(ctx, state.W, state.Req)\n\tif err == nil {\n\t} else {\n\t\tNacosClientLogger.Warn(\"error while lookup dom: \", err)\n\t}\n\treturn code, err\n\n}", "title": "" }, { "docid": "7805bb556d16f5c4cb4f6408ce6d5358", "score": "0.49097186", "text": "func (_CanonicalTransactionChain *CanonicalTransactionChainCaller) Resolve(opts *bind.CallOpts, _name string) (common.Address, error) {\n\tvar out []interface{}\n\terr := _CanonicalTransactionChain.contract.Call(opts, &out, \"resolve\", _name)\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": "55b3bdc44fd779d269a74e0e1f795e5f", "score": "0.49083555", "text": "func (sc *ServiceConfig) resolvePath(targetPath string) string {\n\t// TODO Process ., .., ../., ~, etc.\n\treturn targetPath\n}", "title": "" }, { "docid": "71cb4c15e39a4b6d89ba42bb89543b67", "score": "0.49080542", "text": "func (h *HookMetaData) Resolve(evt *Event) error {\n\tdata := &model.HookEvent{\n\t\tPolicyID: h.PolicyID,\n\t\tEventType: h.EventType,\n\t\tTarget: h.Target,\n\t\tPayload: h.Payload,\n\t}\n\n\tevt.Topic = h.Target.Type\n\tevt.Data = data\n\treturn nil\n}", "title": "" }, { "docid": "bb9a6e64790e293ac5b2c9cadbff09e8", "score": "0.49072912", "text": "func resolver(w dns.ResponseWriter, req *dns.Msg) {\n\tmsg, err := dns.Exchange(req, dnsserver)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't query: %v\", err)\n\t\t// TODO return error Msg\n\t\treturn\n\t}\n\n\tfor _, rr := range msg.Answer {\n\t\t// TODO do this for only one record, delete the others.\n\t\tif rr.Header().Rrtype == dns.TypeA {\n\t\t\ta := rr.(*dns.A)\n\n\t\t\taddrpool.Lock()\n\t\t\taddr, ok := addrpool.domains[a.Hdr.Name]\n\t\t\t// Maybe we should also Get it on ok to push it up the LRU cache.\n\t\t\tif !ok {\n\t\t\t\taddrpool.pool.RemoveOldest()\n\t\t\t\taddrpool.pool.Add(ip4touint32(addrpool.freeaddr), a.Hdr.Name)\n\t\t\t\tlog.Printf(\"Adding %v -> %s\", addrpool.freeaddr, a.Hdr.Name)\n\t\t\t\taddr = addrpool.freeaddr\n\t\t\t\taddrpool.domains[a.Hdr.Name] = addr\n\t\t\t}\n\t\t\taddrpool.Unlock()\n\n\t\t\tlog.Println(\"Type A:\", a.A)\n\t\t\ta.A = addr\n\t\t\ta.Hdr.Ttl = 1\n\t\t}\n\t}\n\n\tw.WriteMsg(msg)\n}", "title": "" }, { "docid": "a14c323955449f63ecab2d9e76b2b9fe", "score": "0.4904508", "text": "func MountResolveHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleIncidentOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"PUT\", \"/api/governance/projects/{project_id}/incidents/{incident_id}/resolve\", f)\n}", "title": "" }, { "docid": "73b774233fc04081a0784c7cb5fc2429", "score": "0.49020973", "text": "func (rc RedisCache) Resolve(w ResponseWriter, r Request) error {\n\tkey := fmt.Sprintf(\"%s:%s\", r.QtypeString(), r.Name)\n\n\tconn := rc.pool.Get()\n\tdefer conn.Close()\n\n\tresp, err := redis.Strings(conn.Do(\"LRANGE\", key, 0, -1))\n\tif err != nil {\n\t\treturn Error{TypeExternalError, err, \"failed to get records\"}\n\t}\n\tif len(resp) == 0 {\n\t\treturn rc.resolveFromUpstream(w, r, key)\n\t}\n\n\treturn rc.resolveFromCache(w, r, resp)\n}", "title": "" }, { "docid": "eb5a433394f21cc1b6de35cffd2bd688", "score": "0.48994055", "text": "func (r *Cache) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {\n\tif len(q.Question) < 1 {\n\t\treturn nil, errors.New(\"no question in query\")\n\t}\n\t// While multiple questions in one DNS message is part of the standard,\n\t// it's not actually supported by servers. If we do get one of those,\n\t// just pass it through and bypass caching.\n\tif len(q.Question) > 1 {\n\t\treturn r.resolver.Resolve(q, ci)\n\t}\n\n\tlog := logger(r.id, q, ci)\n\n\t// Flush the cache if the magic query name is received and flushing is enabled.\n\tif r.FlushQuery != \"\" && r.FlushQuery == q.Question[0].Name {\n\t\tlog.Info(\"flushing cache\")\n\t\tr.backend.Flush()\n\t\ta := new(dns.Msg)\n\t\treturn a.SetReply(q), nil\n\t}\n\n\t// Returned an answer from the cache if one exists\n\ta, prefetchEligible, ok := r.answerFromCache(q)\n\tif ok {\n\t\tlog.Debug(\"cache-hit\")\n\t\tr.metrics.hit.Add(1)\n\n\t\t// If prefetch is enabled and the TTL has fallen below the trigger time, send\n\t\t// a concurrent query upstream (to refresh the cached record)\n\t\tif prefetchEligible && r.CacheOptions.PrefetchTrigger > 0 {\n\t\t\tif min, ok := minTTL(a); ok && min < r.CacheOptions.PrefetchTrigger {\n\t\t\t\tprefetchQ := q.Copy()\n\t\t\t\tgo func() {\n\t\t\t\t\tlog.Debug(\"prefetching record\")\n\n\t\t\t\t\t// Send the same query upstream\n\t\t\t\t\tprefetchA, err := r.resolver.Resolve(prefetchQ, ci)\n\t\t\t\t\tif err != nil || prefetchA == nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Don't cache truncated responses\n\t\t\t\t\tif prefetchA.Truncated {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the prefetched record has a lower TTL than what we had already, there\n\t\t\t\t\t// is no point in storing it in the cache. This can happen when the upstream\n\t\t\t\t\t// resolver also uses caching.\n\t\t\t\t\tif prefetchAMin, ok := minTTL(prefetchA); !ok || prefetchAMin < min {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Put the upstream response into the cache and return it.\n\t\t\t\t\tr.storeInCache(prefetchQ, prefetchA)\n\t\t\t\t}()\n\t\t\t}\n\t\t}\n\n\t\treturn a, nil\n\t}\n\tr.metrics.miss.Add(1)\n\n\tlog.WithField(\"resolver\", r.resolver.String()).Debug(\"cache-miss, forwarding\")\n\n\t// Get a response from upstream\n\ta, err := r.resolver.Resolve(q.Copy(), ci)\n\tif err != nil || a == nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't cache truncated responses\n\tif a.Truncated {\n\t\treturn a, nil\n\t}\n\n\t// Put the upstream response into the cache and return it. Need to store\n\t// a copy since other elements might modify the response, like the replacer.\n\tr.storeInCache(q, a.Copy())\n\treturn a, nil\n}", "title": "" }, { "docid": "e1e3ad32b204b7398073963191aff1dc", "score": "0.48937586", "text": "func (r *BaseResolver) Resolve(ctx context.Context, name, qtype string, priority int) ([]requests.DNSAnswer, bool, error) {\n\tif priority != PriorityCritical && priority != PriorityHigh && priority != PriorityLow {\n\t\treturn []requests.DNSAnswer{}, false, &ResolveError{\n\t\t\tErr: fmt.Sprintf(\"Resolver: Invalid priority parameter: %d\", priority),\n\t\t\tRcode: 100,\n\t\t}\n\t}\n\n\tif avail, err := r.Available(); !avail {\n\t\treturn []requests.DNSAnswer{}, true, err\n\t}\n\n\tqt, err := textToTypeNum(qtype)\n\tif err != nil {\n\t\treturn nil, false, &ResolveError{\n\t\t\tErr: err.Error(),\n\t\t\tRcode: 100,\n\t\t}\n\t}\n\n\tresultChan := make(chan *resolveResult)\n\t// Use the correct queue based on the priority\n\tr.xchgQueues[priority].Append(&resolveRequest{\n\t\tName: name,\n\t\tQtype: qt,\n\t\tResult: resultChan,\n\t})\n\tresult := <-resultChan\n\n\tr.Lock()\n\tr.stats[QueryCompleted] = r.stats[QueryCompleted] + 1\n\tr.Unlock()\n\n\t// Report the completion of the DNS query\n\tif b := ctx.Value(requests.ContextEventBus); b != nil {\n\t\tbus := b.(*eventbus.EventBus)\n\n\t\tbus.Publish(requests.ResolveCompleted, time.Now())\n\t}\n\n\treturn result.Records, result.Again, result.Err\n}", "title": "" }, { "docid": "de6fd83aef88a7fd97d3edb809d073be", "score": "0.48745325", "text": "func (l *register) resolve(ids interface{}, typ reflect.Type) (reflect.Value, error) {\n\tif reflect.TypeOf(ids).Kind() != reflect.Slice {\n\t\treturn reflect.Value{}, errors.New(\"ids must be a slice\")\n\t}\n\n\n\tresolvers, ok := l.resolvers[typ]\n\tif !ok {\n\t\tif resolvers, ok = l.resolvers[reflect.PtrTo(typ)]; !ok {\n\t\t\treturn reflect.Value{}, fmt.Errorf(\"no resolvers found for %v\", typ.String())\n\t\t}\n\t}\n\n\tfn, ok := resolvers[reflect.TypeOf(ids).Elem()]\n\tif !ok {\n\t\treturn reflect.Value{}, fmt.Errorf(\"no resolvers found for %v with key type %v\", typ.String(), reflect.TypeOf(ids).Elem().String())\n\t}\n\n\tldr := &loader{*l, nil}\n\tvals, err := fn(context.TODO(), ldr, ids)\n\tif err != nil {\n\t\treturn reflect.Value{}, err\n\t}\n\tif err := ldr.execute(); err != nil {\n\t\treturn reflect.Value{}, err\n\t}\n\n\trefVals := reflect.ValueOf(vals)\n\tif refVals.Len() != reflect.ValueOf(ids).Len() {\n\t\treturn reflect.Value{}, errors.New(\"not all items found\")\n\t}\n\n\treturn refVals, nil\n}", "title": "" }, { "docid": "dea1a29ed25e52cd36ff3c9c7f94f14a", "score": "0.48704296", "text": "func (c *compoundRepositoryProvider) Resolve(ctx context.Context, repo *v1.Repository) error {\n\tprov, err := c.getProvider(repo.Host)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn prov.Resolve(ctx, repo)\n}", "title": "" }, { "docid": "6bd61a51d63fcba1c37d8c8a96428ab4", "score": "0.48580042", "text": "func (r *Store) Do(cmd string, args ...interface{}) (reply interface{}, err error) {\n\tconn := r.pool.Get()\n\t// conn.Close() returns an error but we are already returning regarding error\n\t// while returning the Do(..) response\n\tdefer conn.Close()\n\treply, err = conn.Do(cmd, args...)\n\treturn\n}", "title": "" }, { "docid": "c3751587b0868d65dca32d699700c5a8", "score": "0.4844804", "text": "func (self *Cache) _resolveURL(url string) string{\n return self.Object.Call(\"_resolveURL\", url).String()\n}", "title": "" }, { "docid": "a5b7b144f4abd982574df12a56ffe60c", "score": "0.48391393", "text": "func (f *fetcher) resolveDeps(ctx context.Context) error {\n\tdepsMap, err := f.depsToExternalIDs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif depsCnt := len(depsMap); depsCnt > 500 {\n\t\tlogging.Warningf(ctx, \"CL has high number of dependency CLs. Deps count: %d\", depsCnt)\n\t}\n\tresolved, err := f.resolveAndScheduleDepsUpdate(ctx, f.project, depsMap, f.requester)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.toUpdate.Snapshot.Deps = resolved\n\treturn nil\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "7c473b3749afdb4d28e4a10e86c55528", "score": "0.0", "text": "func (in *TmSource) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "7bebf7be819b0242fe40d6281451d628", "score": "0.73019236", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "3731ef6c796be4e5c99d053c608a6298", "score": "0.7086793", "text": "func (in *Qperf) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af539fa8d6c27fbcded493dff9d265e1", "score": "0.7072484", "text": "func (m *Managed) DeepCopyObject() runtime.Object {\n\tout := &Managed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "af539fa8d6c27fbcded493dff9d265e1", "score": "0.7072484", "text": "func (m *Managed) DeepCopyObject() runtime.Object {\n\tout := &Managed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "91461b983030f0600f48767a420dbd3a", "score": "0.70597655", "text": "func (in *ChaosEngine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "370e19f727cdb108c4722dcd3eff65ed", "score": "0.70522064", "text": "func (in *Podbuggertool) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92acbf67a626e8434272d49dfed37898", "score": "0.7002493", "text": "func (in *Clock) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8990dba588b3ca4c14772f9f2e57cf35", "score": "0.69888204", "text": "func (in *RedisVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48d796d4a8734a130c47f8b2fc0e5ebb", "score": "0.698144", "text": "func (in *VirtualApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16e522877692202190f36b46bc0cb7db", "score": "0.6967686", "text": "func (in *Invocation) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abc6291036dcf8172e7d96fe92c908b6", "score": "0.69675666", "text": "func (in *DashbuilderObject) DeepCopy() *DashbuilderObject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DashbuilderObject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b13b2703e1976f046ef0241cba49e4ae", "score": "0.69635123", "text": "func (in *FluentBit) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3270fbfab195a44ba3d6f5d875e7088c", "score": "0.69598067", "text": "func (in *Kvm) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2edc16f30f0a7e90ae4feb4002b91259", "score": "0.6947026", "text": "func (m *Target) DeepCopyObject() runtime.Object {\n\tout := &Target{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "9dca188be47fd63d651d0d7eb59e0546", "score": "0.6926596", "text": "func (m *Composed) DeepCopyObject() runtime.Object {\n\tout := &Composed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "9dca188be47fd63d651d0d7eb59e0546", "score": "0.6926596", "text": "func (m *Composed) DeepCopyObject() runtime.Object {\n\tout := &Composed{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "7acb3346a026b58df2d3ddb142188b07", "score": "0.6919967", "text": "func (in *Kubefate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aad13608341837dff05b17c368fc263", "score": "0.69192076", "text": "func (in *Core) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "765ae27369f5dec5e37255b20b4320c9", "score": "0.69175684", "text": "func (in *Qserv) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d08a6a9c4276be7cd5f8b96c2f1e504f", "score": "0.69152355", "text": "func (in *HookRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91ba39651c6b20544fcbe73d43cb3517", "score": "0.6910952", "text": "func (in *DiscoveryService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de000006c15e28fc38d2ab175ad073e", "score": "0.6910469", "text": "func (in *HookRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c91a138bb2882634b79249185177cbfa", "score": "0.6907827", "text": "func (in *CDI) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e7ee69df6bdc2e1188b91b72425e7db", "score": "0.68922085", "text": "func (in *JointInferenceService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95238cc6bff859d5534920426cc89875", "score": "0.6889418", "text": "func (in *CinderAPI) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e9dbfcf5f541768d497fa1c4994289d6", "score": "0.688825", "text": "func (in *QperfList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90b39b231f6650132bdd1cc4005e649c", "score": "0.6875429", "text": "func (in *PortBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b301f9dcc87c7b3eeeb31dc7ec3f7932", "score": "0.6872715", "text": "func (in *RayWorker) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c488269affc1272c12030827cc44ed5", "score": "0.68713975", "text": "func (in *APIcast) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "936fe0a13d89a613491cc82df7e2694d", "score": "0.6870898", "text": "func (in *Busybox) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cc1db4bcd86e808735592fbd459cfcc", "score": "0.6863492", "text": "func (in *Kubemanager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "657831a1e0160184fdd5c11310b968d8", "score": "0.6859367", "text": "func (in *MemcachedVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b37474055e4562788804f11897126a0d", "score": "0.6853908", "text": "func (in *AppEngineStandardAppVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b440cb829b3900423549539de3a36fb", "score": "0.68497205", "text": "func (in *VirtualAppList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de10c3fd4d74e04ad823a886fd5a87c", "score": "0.68457294", "text": "func (in *Space) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df69e69f0d32cb87f29b135174faf952", "score": "0.68310434", "text": "func (in *SrlTunnelinterface) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ce4494bcf223366cae1a86094020740", "score": "0.68298864", "text": "func (in *TestRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55b0be98d753baa0848b3c2786a21f8c", "score": "0.68287045", "text": "func (m *Composite) DeepCopyObject() runtime.Object {\n\tout := &Composite{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "55b0be98d753baa0848b3c2786a21f8c", "score": "0.68287045", "text": "func (m *Composite) DeepCopyObject() runtime.Object {\n\tout := &Composite{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6828011", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.6821241", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.6821241", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.6821241", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "662cc69dc31cab4e7bde2e440db71c6a", "score": "0.6821241", "text": "func (in *ServiceBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a32deaf3eeed41b501876f09b27cbade", "score": "0.682061", "text": "func (in *HTTPProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "386de5718c4919430f59b24f37523f3f", "score": "0.6816005", "text": "func (in *Cinder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6aac3adb91ece013f35c1b2d5785ef80", "score": "0.68157506", "text": "func (in *JobRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e19be244329785493997bdedfcdbc87", "score": "0.6815615", "text": "func (in *CRD1) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00dc9ca6acc8104377f2fd22fcf2c58b", "score": "0.68151563", "text": "func (in *Box) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62f7c802c833a12f16a4c20738ecd523", "score": "0.68121284", "text": "func (in *Test) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab41fd9685a9c62079773d420702d98c", "score": "0.68030405", "text": "func (in *KvmList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2468d8cbc090ed4c61d614995ef2f67", "score": "0.6795447", "text": "func (in *WorkflowRuntime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41915907554c764bf0478ab82cf6f069", "score": "0.6794115", "text": "func (in *Relay) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e4a069c05507bf2e8c0c3796b61e2141", "score": "0.6793585", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08851f577beff8b9a55605234a10b571", "score": "0.6790508", "text": "func (in *Machine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69873677637e7096c79ebbc283e462e3", "score": "0.67904246", "text": "func (in *Tunnel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b3b9ea2bcdf7e9e1d9cfe1e83aad516", "score": "0.678376", "text": "func (in *ServiceMeshExtension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1a132b4af7f55528161a0f94f124617", "score": "0.6783512", "text": "func (in *FluentBitList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3ce689156816a6e4f72bfa8fd2103d1", "score": "0.67834425", "text": "func (in *Infinispan) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c61140d7443b23183d74a27e9f4c0de", "score": "0.6780178", "text": "func (m *Machine) DeepCopyObject() runtime.Object {\n\tm1 := &Machine{\n\t\tVersion: m.Version,\n\t\tMachineIP: m.MachineIP,\n\t\tName: m.Name,\n\t\tNamespace: m.Namespace,\n\t\tClusterName: m.ClusterName,\n\t\tDeleting: m.Deleting,\n\t}\n\treturn m1\n}", "title": "" }, { "docid": "cb3c9c9b5af3107b239a8f3255e23018", "score": "0.6777366", "text": "func (in *CurlTest) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2a5b69189aab3caa15c823d8b905504", "score": "0.6777141", "text": "func (in *PackageInstall) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dcc8fc7bfdea51655a0a04aeb0dddd67", "score": "0.67760444", "text": "func (in *Arcade) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6768069", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6768069", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9697ff49469d29543b6c1831b8e6ae26", "score": "0.67598706", "text": "func (in *DynaKube) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b6c851e0dab042b31ba17902a0a3466", "score": "0.6758472", "text": "func (in *Chaosmaster) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2773ff22f42e82387283ef238aab7d40", "score": "0.67517346", "text": "func (in *Pgbench) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "489ac2ef40f080225543e2e17c3bd783", "score": "0.67506355", "text": "func (in *EtcdVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c78f75caaa730c54594a38a4c529cf7f", "score": "0.67496175", "text": "func (in *Builder) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3f61c6bfb5b188c003f79a479c16861c", "score": "0.6747566", "text": "func (in *GitOps) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a32dbb0f0746f4d331d0770b2de710a3", "score": "0.6746096", "text": "func (in *KieApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ddf5bb930952de1e4d7a9f725acee2a", "score": "0.6742275", "text": "func (in *ChaosEngineList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9adc39ec63009d613c77d91f85c43d7", "score": "0.6738986", "text": "func (in *CDIList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67388374", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.67380244", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.67380244", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dce76d7c9f55603b041e9ed5af5500f", "score": "0.67380244", "text": "func (in *Memcached) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97d940e03b91ae8737af951f6807caba", "score": "0.6731772", "text": "func (in *KeptnService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5bc98c1ff2d063db4c0b73e98f862f1", "score": "0.6730725", "text": "func (in *Cassandra) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aac72bc31b665911d836b3801b632cb6", "score": "0.6730502", "text": "func (m *Class) DeepCopyObject() runtime.Object {\n\tout := &Class{}\n\tj, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_ = json.Unmarshal(j, out)\n\treturn out\n}", "title": "" }, { "docid": "c1472e180b8d5c85a37780678edd2257", "score": "0.67293936", "text": "func (in *Iperf3) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "372bfcf115165dda2d8039086eef76ca", "score": "0.6728877", "text": "func (in *BusyboxList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20986c2271614ac062e026acef32e687", "score": "0.6727781", "text": "func (in *Bundle) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0fd438407f33cd8e553c5d88d86825db", "score": "0.6725313", "text": "func (in *SyncBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a809d76469f721763cca39a9263a39de", "score": "0.67252475", "text": "func (in *InvocationList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae0b87daedfd6537351a4c85a34bd8ea", "score": "0.6724937", "text": "func (in *PortBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca15ecdf5db91acfa35f372a962726e2", "score": "0.67237186", "text": "func (in *RedisVersionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8cd1356e45661724614770c2b58e931", "score": "0.67223096", "text": "func (in *Panda) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3453d4c20c15e5a98700d5691c54ba94", "score": "0.67206407", "text": "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3453d4c20c15e5a98700d5691c54ba94", "score": "0.67206407", "text": "func (in *Registry) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b62e5a400839376f11c374961f0d593", "score": "0.6715211", "text": "func (in *Dask) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a7c07c33740ae6f05124798affd4cb16", "score": "0.6714369", "text": "func (in *Redactor) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "daf28bbf9c4b107d2a0b05318791131f", "score": "0.6713702", "text": "func (in *DiscoveryServiceCertificate) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0e3fba0a391303d0352cf2e51f29f5d", "score": "0.67133516", "text": "func (in *Webui) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "93f44f11b997403b028206c5cb9aa6b1", "score": "0.670936", "text": "func (in *YcsbBench) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be4cf0d77c97470e33b542733e7b5a8a", "score": "0.6708846", "text": "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "927d22b2d2f18b9de798d5b5a2465cca", "score": "0.67086655", "text": "func (in *CoredumpEndpoint) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
77fbe3383294cb275a71051eb6e1e97a
FromJsonString It is highly NOT recommended to use this function because it has no param check, nor strict type check
[ { "docid": "25d050f5c053e9dd49263a7c36f4825f", "score": "0.0", "text": "func (r *EditMediaRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"FileInfos\")\n\tdelete(f, \"OutputStorage\")\n\tdelete(f, \"OutputObjectPath\")\n\tdelete(f, \"OutputConfig\")\n\tdelete(f, \"TaskNotifyConfig\")\n\tdelete(f, \"TasksPriority\")\n\tdelete(f, \"SessionId\")\n\tdelete(f, \"SessionContext\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"EditMediaRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" } ]
[ { "docid": "8306eba4d917806c9ede2ab5f909625a", "score": "0.7010254", "text": "func JsonString(data string) (Typed, error) {\n\treturn JsonReader(strings.NewReader(data))\n}", "title": "" }, { "docid": "d8de0171b20f64bd611b3b4ba5fd8418", "score": "0.63512564", "text": "func FromString(data string) *JSON {\n\treturn FromBytes([]byte(data))\n}", "title": "" }, { "docid": "83d459ead04830abe40129cdc3054213", "score": "0.60926545", "text": "func JSONFromString(t testing.TB, body string, args ...interface{}) models.JSON {\n\treturn JSONFromBytes(t, []byte(fmt.Sprintf(body, args...)))\n}", "title": "" }, { "docid": "4cb05a83900dc5c274b699bb4b97edf0", "score": "0.6045991", "text": "func Parse(s string, o interface{}) interface{} {\n if e:=json.Unmarshal([]byte(s),o); e!=nil { panic(e) }\n return o\n}", "title": "" }, { "docid": "fe3f302a457ca07704c7a233da33f750", "score": "0.60229075", "text": "func (r *PermitOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2804be205f5fdb7bc78f2f92def71d84", "score": "0.60164917", "text": "func (r *MainlandPermitOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3e8c8745f29414986bdfacefe257a781", "score": "0.600276", "text": "func (r *ModifyDBParametersResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "23fe0c6df0899a8d96438006f9fcb6cc", "score": "0.6000278", "text": "func FromJSONString(buf string, o interface{}) error {\n\terr := json.Unmarshal([]byte(buf), &o)\n\treturn err\n}", "title": "" }, { "docid": "a52d9f606d399c91621bbac38864642e", "score": "0.59456515", "text": "func (r *CheckTransformationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2150cc3077133dff38ca68452bb4de32", "score": "0.59227514", "text": "func (r *SealOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "093b50eec5fe2fb891d883f56cb389cd", "score": "0.5909577", "text": "func (r *VinOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "174856d7f20886c3b5e46f56282b20e6", "score": "0.5894768", "text": "func (r *CreateTransformationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "9ab5adcd84a2f89b9721debce6052e8a", "score": "0.5894428", "text": "func (r *PurgeUrlsCacheResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4c3699949e1dab90f6fc570beaf8c82b", "score": "0.58725667", "text": "func (r *GetTransformationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "8d758c3f4cccc5a5945c289fcfc537a8", "score": "0.5872213", "text": "func (r *PurgePathCacheResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f08e25292e310d2e0fef0d3d7d2339df", "score": "0.5848152", "text": "func (r *CreateTagRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"TagKey\")\n\tdelete(f, \"TagValue\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateTagRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e9a740e4e2eee43c349e11cb865490ba", "score": "0.5833662", "text": "func (r *CreateRecordResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4bc62f71b1ad68b0bce250b942c39700", "score": "0.5823095", "text": "func (r *GeneralBasicOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "74c88ea462c3d2a200f7348f80cce35f", "score": "0.58172035", "text": "func (r *RewindQueueResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "96b1c3504aee45ddd0980b85e5291472", "score": "0.5813147", "text": "func TestCreateFromJson2(t *testing.T) {\n jsonText := `{\"created_at\":\"Sun Jan 20 11:26:29 +0800 2013\",\"id\":3536506801223177,\"mid\":\"3536506801223177\",\"idstr\":\"3536506801223177\",\n \"text\":\"缺了滚粗两字,没得手哥真传。//@土豆苗: 摹仿一下:男人女相,眼睛不大心眼不小,笑得灿烂,背后藏的都是刀。嘴上那颗痦子不详,有被刨坟的征兆。负分![偷笑]\",\"source\":\"<a href=\\\"http://app.weibo.com/t/feed/3Nrvbn\\\" rel=\\\"nofollow\\\">三星GalaxyNote</a>\",\"favorited\":false,\"truncated\":false,\"in_reply_to_status_id\":\"\",\"in_reply_to_user_id\":\"\",\"in_reply_to_screen_name\":\"\",\"geo\":null,\"user\":{\"id\":1497878455,\"idstr\":\"1497878455\",\"screen_name\":\"夏商\",\"name\":\"夏商\",\"province\":\"31\",\"city\":\"6\",\"location\":\"上海 静安区\",\"description\":\"小说家。著有四卷本文集《夏商自选集》。个人官微:@夏商读友会 // 普茶客创始人。中国高端普洱茶原创品牌。企业官微:@普茶客官方微博\",\"url\":\"http://blog.sina.com.cn/xiashang1969\",\"profile_image_url\":\"http://tp4.sinaimg.cn/1497878455/50/40011372724/1\",\"cover_image\":\"http://ww1.sinaimg.cn/crop.0.0.980.300/5947cfb7gw1e0wontrm8dj.jpg\",\"profile_url\":\"xiashang1969\",\"domain\":\"xiashang1969\",\"weihao\":\"\",\"gender\":\"m\",\"followers_count\":109953,\"friends_count\":209,\"statuses_count\":854,\"favourites_count\":25,\"created_at\":\"Sat Apr 03 14:28:32 +0800 2010\",\"following\":true,\"allow_all_act_msg\":false,\"geo_enabled\":false,\"verified\":true,\"verified_type\":0,\"remark\":\"\",\"allow_all_comment\":true,\"avatar_large\":\"http://tp4.sinaimg.cn/1497878455/180/40011372724/1\",\"verified_reason\":\"小说家,代表作有《东岸纪事》《乞儿流浪记》\",\"follow_me\":false,\"online_status\":0,\"bi_followers_count\":208,\"lang\":\"zh-tw\",\"star\":0,\"mbtype\":12,\"mbrank\":1,\"block_word\":0},\"retweeted_status\":{\"created_at\":\"Sun Jan 20 04:40:41 +0800 2013\",\"id\":3536404678606628,\"mid\":\"3536404678606628\",\"idstr\":\"3536404678606628\",\"text\":\"手哥,您看这位帅哥能给几分? @留几手\",\"source\":\"<a href=\\\"http://app.weibo.com/t/feed/3Nrvbn\\\" rel=\\\"nofollow\\\">三星GalaxyNote</a>\",\"favorited\":false,\"truncated\":false,\"in_reply_to_status_id\":\"\",\"in_reply_to_user_id\":\"\",\"in_reply_to_screen_name\":\"\",\"thumbnail_pic\":\"http://ww4.sinaimg.cn/thumbnail/5947cfb7jw1e0zjktmfqfj.jpg\",\n \"bmiddle_pic\":\"http://ww4.sinaimg.cn/bmiddle/5947cfb7jw1e0zjktmfqfj.jpg\",\"original_pic\":\"http://ww4.sinaimg.cn/large/5947cfb7jw1e0zjktmfqfj.jpg\",\"geo\":null,\"user\":{\"id\":1497878455,\"idstr\":\"1497878455\",\"screen_name\":\"夏商\",\"name\":\"夏商\",\"province\":\"31\",\"city\":\"6\",\"location\":\"上海 静安区\",\"description\":\"小说家。著有四卷本文集《夏商自选集》。个人官微:@夏商读友会 // 普茶客创始人。中国高端普洱茶原创品牌。企业官微:@普茶客官方微博\",\"url\":\"http://blog.sina.com.cn/xiashang1969\",\"profile_image_url\":\"http://tp4.sinaimg.cn/1497878455/50/40011372724/1\",\"cover_image\":\"http://ww1.sinaimg.cn/crop.0.0.980.300/5947cfb7gw1e0wontrm8dj.jpg\",\"profile_url\":\"xiashang1969\",\"domain\":\"xiashang1969\",\"weihao\":\"\",\"gender\":\"m\",\"followers_count\":109953,\"friends_count\":209,\"statuses_count\":854,\"favourites_count\":25,\"created_at\":\"Sat Apr 03 14:28:32 +0800 2010\",\"following\":true,\"allow_all_act_msg\":false,\"geo_enabled\":false,\"verified\":true,\"verified_type\":0,\"remark\":\"\",\"allow_all_comment\":true,\"avatar_large\":\"http://tp4.sinaimg.cn/1497878455/180/40011372724/1\",\"verified_reason\":\"小说家,代表作有《东岸纪事》《乞儿流浪记》\",\"follow_me\":false,\"online_status\":0,\"bi_followers_count\":208,\"lang\":\"zh-tw\",\"star\":0,\"mbtype\":12,\"mbrank\":1,\"block_word\":0},\"reposts_count\":134,\"comments_count\":82,\"attitudes_count\":3,\"mlevel\":0,\"visible\":{\"type\":0,\"list_id\":0}},\"reposts_count\":12,\"comments_count\":8,\"attitudes_count\":0,\"mlevel\":0,\"visible\":{\"type\":0,\"list_id\":0}}\n `\n msg := NewWeiboStatusFromJson(jsonText)\n if msg.Text() != \"缺了滚粗两字,没得手哥真传。//@土豆苗: 摹仿一下:男人女相,眼睛不大心眼不小,笑得灿烂,背后藏的都是刀。嘴上那颗痦子不详,有被刨坟的征兆。负分![偷笑] //@夏商: 手哥,您看这位帅哥能给几分? @留几手\" {\n t.Errorf(\"msg.text: %s\", msg.Text())\n }\n if msg.ImageUrl() != \"http://ww4.sinaimg.cn/bmiddle/5947cfb7jw1e0zjktmfqfj.jpg\" {\n t.Errorf(\"msg.imageUrl: %s\", msg.ImageUrl())\n }\n}", "title": "" }, { "docid": "caf39bf4d0e5c70d52c355d48b8aef29", "score": "0.5812043", "text": "func (r *GeneralAccurateOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "03154b480a78557ed577e8b452aebd15", "score": "0.58069927", "text": "func (r *CreateTagResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5d48578e46e3457136779e6ebd8f17bf", "score": "0.57983094", "text": "func FromJson(jsonString []byte, v interface{}) {\n\terr := json.Unmarshal(jsonString, v)\n\tPanicError(err)\n}", "title": "" }, { "docid": "23206bc516145eda6ae9f5918238bfbf", "score": "0.57937384", "text": "func (r *HmtResidentPermitOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2a386fcdbdc1e3ac4bdee913e6a41c82", "score": "0.579042", "text": "func (r *GetRuleRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"EventBusId\")\n\tdelete(f, \"RuleId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetRuleRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5fe5ce23278d78a2d486b0cf9de854d0", "score": "0.57901925", "text": "func (r *MainlandPermitOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tdelete(f, \"RetProfile\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"MainlandPermitOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "fcf51065923624296041bade9de15ccf", "score": "0.57810074", "text": "func (r *GetEventBusResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "23bea8af68f7ed39b04bc23fbb5dcfa8", "score": "0.57758003", "text": "func (r *GetTransformationRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"EventBusId\")\n\tdelete(f, \"RuleId\")\n\tdelete(f, \"TransformationId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetTransformationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b86d709e23bf89c516e636ada284832a", "score": "0.57757807", "text": "func (r *DescribeDBParametersResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "1962513f9ab3edd8626aa956d748db22", "score": "0.57748026", "text": "func (r *ModifyRecordResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "eb6631fbc77892984af3ddf9f5cc4324", "score": "0.5770216", "text": "func NewFromString(sjson string) *JSON {\n\tpt := make([]string, 0)\n\tvar entity map[string]interface{}\n\terr := json.Unmarshal([]byte(sjson), &entity)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn internalNew(&entity, pt, false)\n}", "title": "" }, { "docid": "35111588743b32f08b26610aa6f25d89", "score": "0.57668036", "text": "func (r *SmartStructuralOCRV2Request) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageUrl\")\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"IsPdf\")\n\tdelete(f, \"PdfPageNumber\")\n\tdelete(f, \"ItemNames\")\n\tdelete(f, \"ReturnFullText\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"SmartStructuralOCRV2Request has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b2450d203ff2941f7f6ce386335eafc1", "score": "0.575622", "text": "func (r *CheckRuleResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f7050b2b0324505fbc3ef6c9d4433d52", "score": "0.575144", "text": "func (r *CreateEventBusResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5586c264faad05508ac1360a8d868979", "score": "0.5745345", "text": "func (r *ModifyDBParametersRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"InstanceId\")\n\tdelete(f, \"Params\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyDBParametersRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "deb53226a0099b05f492502d16293ec5", "score": "0.5741693", "text": "func toJsonStr(in interface{}) (string, error) {\n\tj, err := json.Marshal(in)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(j), nil\n}", "title": "" }, { "docid": "fca7a8b134e8431efb7729f82e60a325", "score": "0.5734356", "text": "func (r *RecognizeGeneralInvoiceResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "726a61319b549078fb2da9c1af3d0421", "score": "0.5727028", "text": "func (r *BankCardOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "24cacf7c8c16145bd6c7410ac6594236", "score": "0.57173103", "text": "func (r *PurgeUrlsCacheRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Urls\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"PurgeUrlsCacheRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c60228204e74443fa745891a3ac0793b", "score": "0.57168245", "text": "func (r *MLIDPassportOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e9899bd7da3614fa89256a2f03bb37c1", "score": "0.57126486", "text": "func (r *DeleteTransformationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "6f1bebdcff1d5a012046060a7b9081ba", "score": "0.57124436", "text": "func (r *CheckRuleRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\t\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CheckRuleRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "eb1ab5a67770a197fe9efe5b9768c567", "score": "0.5710293", "text": "func (r *GetEventBusRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"EventBusId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetEventBusRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "769e14858173ac74c8ba99d3304d12f5", "score": "0.5707849", "text": "func (r *UpdateTransformationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d7fba1e5a18c4713f5913d3864868cab", "score": "0.5707608", "text": "func (r *ModifyResourcesTagValueRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ServiceType\")\n\tdelete(f, \"ResourceIds\")\n\tdelete(f, \"TagKey\")\n\tdelete(f, \"TagValue\")\n\tdelete(f, \"ResourceRegion\")\n\tdelete(f, \"ResourcePrefix\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyResourcesTagValueRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "9c65edda4ec361805695811e2eda54da", "score": "0.5701196", "text": "func (r *ModifyDomainLockResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a9142197e6c71c523635cb239dfce557", "score": "0.5695967", "text": "func (r *GetRuleResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "6f35544bb4e29ac10499bc817ab3a1ff", "score": "0.5690125", "text": "func (r *PermitOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"PermitOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "02340225dd6c365c0e2902896d82f15c", "score": "0.5687368", "text": "func (r *AddResourceTagRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"TagKey\")\n\tdelete(f, \"TagValue\")\n\tdelete(f, \"Resource\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"AddResourceTagRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "bdcd83d1ca12b0d545fa25a99350e212", "score": "0.56650317", "text": "func (r *CreateAIRecognitionTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b9e2de0dc3403680b4a452bf5cfc4e65", "score": "0.5662383", "text": "func (r *VinOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"VinOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "ca4d42b010bab5672cf83238570c4d4c", "score": "0.5656966", "text": "func (r *CreateRuleResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "73c4fed1baee2c96915e543d9d207b1c", "score": "0.5656794", "text": "func TestFromJson(t *testing.T) {\n\t// create a JSON string\n\tjsonData := `[\"apple\",\"banana\",\"cherry\"]`\n\n\t// create a new empty Collection\n\tcoll := NewCollection([]string{})\n\n\t// populate the collection from the JSON data\n\terr := coll.FromJson([]byte(jsonData))\n\n\t// check if the population was successful\n\tif err != nil {\n\t\tt.Errorf(\"FromJson returned an error: %v\", err)\n\t}\n\n\t// check if the collection contains the correct elements\n\tif len(coll.value) != 3 || coll.value[0] != \"apple\" || coll.value[1] != \"banana\" || coll.value[2] != \"cherry\" {\n\t\tt.Errorf(\"FromJson did not populate the collection correctly\")\n\t}\n}", "title": "" }, { "docid": "19fc06b9bd7f8055f520fd7c86ccc797", "score": "0.56541306", "text": "func (r *IDCardOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "59ce48aa432344441a80888f5d3d5cb2", "score": "0.565335", "text": "func (r *HmtResidentPermitOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tdelete(f, \"CardSide\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"HmtResidentPermitOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "59fc03eedbeb7c0f60bb541ad4e19bd5", "score": "0.56526226", "text": "func (r *CreateDBInstanceResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "efbced120198b5daeba641fb3b49dde2", "score": "0.5646589", "text": "func (r *SealOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"SealOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "ccbf0516b99b9dbe2df429641bb69a59", "score": "0.5646303", "text": "func (r *CreateHourDBInstanceResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3f364c6d26a0f79ca96111e4f4cc62cb", "score": "0.5637712", "text": "func (r *CreateWatermarkTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e0e5729643ce024f3ee5f85f66087a0a", "score": "0.5635255", "text": "func (r *AddSmsSignResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "bc516f374e3ec59a192b712ca319d8c3", "score": "0.56340677", "text": "func (r *ExecuteFunctionResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e4c8c8769cee7cbf0a90d74d342663f6", "score": "0.56299424", "text": "func (r *DescribeRecordLineListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5247d84cf844757965a4e241d3346da7", "score": "0.56258434", "text": "func (r *ModifyWatermarkTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "31e2159057df940668271b737a9d4b18", "score": "0.5619135", "text": "func (r *CreateAccountResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "59ef5d28868920ff364df0c1ebb37531", "score": "0.56165975", "text": "func (r *GeneralBasicOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"ImageUrl\")\n\tdelete(f, \"Scene\")\n\tdelete(f, \"LanguageType\")\n\tdelete(f, \"IsPdf\")\n\tdelete(f, \"PdfPageNumber\")\n\tdelete(f, \"IsWords\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GeneralBasicOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "1f5b8d4f2dc9da275eaa165fafd6228e", "score": "0.5612949", "text": "func (r *DescribeDBParametersRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"InstanceId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeDBParametersRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b0569dc8098692cc0fc8308864da440f", "score": "0.561119", "text": "func (r *LicensePlateOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4622e33063df568f8d4f7748469d35a5", "score": "0.56078124", "text": "func (r *DescribeRecordTypeRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"DomainGrade\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeRecordTypeRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2517ef25e50f088b8959cc99e65cfdba", "score": "0.5604192", "text": "func (r *CheckTransformationRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Input\")\n\tdelete(f, \"Transformations\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CheckTransformationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "6cb15c9b2f554a8086a084cf3affcbd6", "score": "0.5602402", "text": "func (r *CreateBackupStorageLocationRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"StorageRegion\")\n\tdelete(f, \"Bucket\")\n\tdelete(f, \"Name\")\n\tdelete(f, \"Provider\")\n\tdelete(f, \"Path\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateBackupStorageLocationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "042a4c0e83dc50bcb6b46f5da897c86c", "score": "0.5602215", "text": "func (r *ModifyAIRecognitionTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a000fa16e617a483d56526c315581eac", "score": "0.5597516", "text": "func (r *ModifyRecordRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Domain\")\n\tdelete(f, \"RecordType\")\n\tdelete(f, \"RecordLine\")\n\tdelete(f, \"Value\")\n\tdelete(f, \"RecordId\")\n\tdelete(f, \"DomainId\")\n\tdelete(f, \"SubDomain\")\n\tdelete(f, \"RecordLineId\")\n\tdelete(f, \"MX\")\n\tdelete(f, \"TTL\")\n\tdelete(f, \"Weight\")\n\tdelete(f, \"Status\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyRecordRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c3841fc41a064ab5f83199fbeaa771a6", "score": "0.5593098", "text": "func (r *ModifyRecordStatusResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f73555c4e806433006c7b379f1008162", "score": "0.5591079", "text": "func (r *UpdateResourceTagValueRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"TagKey\")\n\tdelete(f, \"TagValue\")\n\tdelete(f, \"Resource\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"UpdateResourceTagValueRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "714a9b6d99d6a38c637fcea4c12afba5", "score": "0.55874807", "text": "func (r *CreateTransformationRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"EventBusId\")\n\tdelete(f, \"RuleId\")\n\tdelete(f, \"Transformations\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateTransformationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "269e18acf5c31334de8898a1777a8187", "score": "0.55844545", "text": "func (r *CreateTranscodeTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4d22e8a1f4c3816e3d9b2edb7a09a8f7", "score": "0.5584098", "text": "func (r *ModifyDBEncryptAttributesResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c76fa8cd7ae6dd2048e73067e4e59ee0", "score": "0.5582864", "text": "func (r *HKIDCardOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4f67a1286c336c6de672ca0427ad822d", "score": "0.557848", "text": "func (r *PurgePathCacheRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Paths\")\n\tdelete(f, \"FlushType\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"PurgePathCacheRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "84e663bf5959230518bc7ad32b15d68c", "score": "0.55778515", "text": "func (r *SendSmsResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "a3ff4ecbdec77542d0e5597338ecd41a", "score": "0.5573323", "text": "func (r *ModifySmsSignResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "256b72378b182ae0a9183a01d558d512", "score": "0.55723757", "text": "func (r *RecognizeKoreanIDCardOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "eba3d1f239169891fe15c66a078966f3", "score": "0.55701035", "text": "func (r *CreatePersonSampleRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Name\")\n\tdelete(f, \"Usages\")\n\tdelete(f, \"Description\")\n\tdelete(f, \"FaceContents\")\n\tdelete(f, \"Tags\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreatePersonSampleRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "7d0c17bc127c0efe00f686ca89db5c35", "score": "0.5566336", "text": "func (r *ModifyDBSyncModeResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "9b844bd603fd07063975ea09acfc6be5", "score": "0.5566329", "text": "func (r *DescribeRecordListResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e1b7cc27fc5bdf25201ccb325df79d57", "score": "0.55652374", "text": "func (r *DeleteEventBusResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f3193dfc9cb3082809966ee469803109", "score": "0.556264", "text": "func (r *CreateBackupStorageLocationResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5a54056bd384e1dd19f0a7b9233fc016", "score": "0.55570644", "text": "func (r *RewindQueueRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"QueueName\")\n\tdelete(f, \"StartConsumeTime\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"RewindQueueRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "86156c780d4e2aeb4a5ceeb53d485eb2", "score": "0.5557058", "text": "func (r *ModifyWordSampleResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "eaea072927ccdcc118a8c44f5969446f", "score": "0.5555594", "text": "func (r *GetClusterLevelPriceRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ClusterLevel\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"GetClusterLevelPriceRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "2f137c19fce6a31e8ca504a9868af5fa", "score": "0.5555337", "text": "func (r *RecognizeThaiIDCardOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "235352493958980a5a41bee7a90bcdab", "score": "0.55545986", "text": "func (r *AddNodeToNodePoolResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "7d1149c0417ecfd7c6979210ac2c5d82", "score": "0.55529493", "text": "func (r *DeleteTagRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"TagKey\")\n\tdelete(f, \"TagValue\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DeleteTagRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b3f030acae164ec58f76c63d25f74293", "score": "0.55511934", "text": "func (r *MLIDPassportOCRRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"ImageBase64\")\n\tdelete(f, \"RetImage\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"MLIDPassportOCRRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "701c6674838ab18b23464fad9df2af8a", "score": "0.5547616", "text": "func (r *DescribeRecordResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f985e861a2c7c0df6272b0163498fb61", "score": "0.5545066", "text": "func (r *DescribePriceResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e14e087eb7c3a10f526b1d3607f490a5", "score": "0.5538316", "text": "func (r *RecognizeKoreanDrivingLicenseOCRResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e99208eed8f41ff3b4bb169da6790455", "score": "0.5536314", "text": "func (r *DescribeRecordLineListRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Domain\")\n\tdelete(f, \"DomainGrade\")\n\tdelete(f, \"DomainId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeRecordLineListRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "371902a7b0b8cfd770f067f87efa511d", "score": "0.55360335", "text": "func (r *SmartStructuralOCRV2Response) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "0dc8cbb5d919f6a9faf0f2977b98174a", "score": "0.5535877", "text": "func (r *ListRulesRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"EventBusId\")\n\tdelete(f, \"OrderBy\")\n\tdelete(f, \"Limit\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Order\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ListRulesRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d7c298e46546bf9cfd9c52614fad8e73", "score": "0.55327064", "text": "func (r *AddSmsTemplateResponse) FromJsonString(s string) error {\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" } ]
4265f15148d6b37cab0a314318eccfd5
GetPeeringToken gets an existing PeeringToken resource's state with the given name, ID, and optional state properties that are used to uniquely qualify the lookup (nil if not required).
[ { "docid": "1c8296001e3e5136212d0e5fcbe4c3d8", "score": "0.81273866", "text": "func GetPeeringToken(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *PeeringTokenState, opts ...pulumi.ResourceOption) (*PeeringToken, error) {\n\tvar resource PeeringToken\n\terr := ctx.ReadResource(\"consul:index/peeringToken:PeeringToken\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" } ]
[ { "docid": "81324ee39c5f25052d4493fbb4d94299", "score": "0.60845697", "text": "func NewPeeringToken(ctx *pulumi.Context,\n\tname string, args *PeeringTokenArgs, opts ...pulumi.ResourceOption) (*PeeringToken, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.PeerName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'PeerName'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"peeringToken\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource PeeringToken\n\terr := ctx.RegisterResource(\"consul:index/peeringToken:PeeringToken\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "494f1d9d810ccf44239775aa9c5047df", "score": "0.57129127", "text": "func getPeerToken(peer_id string) (string, error) {\n\tvar peer Peer\n\tdb.Where(\"guid = ?\", peer_id).First(&peer)\n\tif peer.Id < 1 {\n\t\ttoken := generateSHA1()\n\t\tdb.Create(&Peer{Guid: peer_id, Token: token})\n\t\tpl(\"Creating new peer entry for:\", shortSHA(peer_id))\n\t\tdb.Where(\"guid = ?\", peer_id).First(&peer) // read it back\n\t\tif peer.Id < 1 {\n\t\t\treturn \"\", errors.New(\"Could not create peer entry\")\n\t\t} else {\n\t\t\treturn token, nil\n\t\t}\n\t\t// Peer already exists - make sure it has an auth token\n\t} else if len(peer.Token) == 0 {\n\t\ttoken := generateSHA1()\n\t\tpeer.Token = token\n\t\tdb.Save(&peer)\n\t\treturn token, nil\n\t} else {\n\t\treturn peer.Token, nil\n\t}\n}", "title": "" }, { "docid": "5bf6f824eddcb2e453f7d2ecf68ae53c", "score": "0.53942394", "text": "func (o PeeringTokenOutput) PeeringToken() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PeeringToken) pulumi.StringOutput { return v.PeeringToken }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e79c581a9b7beaaee18036e9363f2629", "score": "0.5344113", "text": "func GetToken(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *TokenState, opts ...pulumi.ResourceOption) (*Token, error) {\n\tvar resource Token\n\terr := ctx.ReadResource(\"rancher2:index/token:Token\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "3226e022d1d4625e94c0f398079bcf90", "score": "0.510865", "text": "func (s *BaseShoppersClient) GetWalletToken(shopperID string) (*types.WalletToken, error) {\n\troute := fmt.Sprintf(consts.RouteGetWalletToken, shopperID)\n\n\twalletToken := &types.WalletToken{}\n\n\terr := s.ExecuteRequest(consts.HTTPGet, route, nil, walletToken)\n\n\treturn walletToken, err\n}", "title": "" }, { "docid": "711d1442efaddb3f0837af13c38c6853", "score": "0.490096", "text": "func (a *Authenticator) GetToken(state string, code string) (*oauth2.Token, error) {\n\tif state != a.state {\n\t\treturn nil, errors.New(\"Invalid state\")\n\t}\n\n\t// Construct a custom http client that forces the user-agent and attach it\n\t// to the oauth2 context. https://github.com/golang/oauth2/issues/179\n\tclient := &http.Client{\n\t\tTransport: &oauth2.Transport{\n\t\t\tSource: a.config.TokenSource(oauth2.NoContext, &oauth2.Token{\n\t\t\t\tAccessToken: code,\n\t\t\t}),\n\t\t\tBase: &uaSetterTransport{\n\t\t\t\tconfig: a.config,\n\t\t\t\tuserAgent: a.userAgent,\n\t\t\t},\n\t\t},\n\t}\n\tctx := context.WithValue(oauth2.NoContext, oauth2.HTTPClient, client)\n\n\treturn a.config.Exchange(ctx, code)\n}", "title": "" }, { "docid": "c227a381e4402fb5bd518dd6d1a4c367", "score": "0.48290813", "text": "func (a *PeerTransfersApiService) GetPeertransfersToken(ctx context.Context, token string) (PeerTransferResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue PeerTransferResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/peertransfers/{token}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"token\"+\"}\", fmt.Sprintf(\"%v\", token), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v PeerTransferResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "15220042e8d3e2c377c3bc380908e126", "score": "0.48281026", "text": "func (t *Template) GetNetworkManagerTransitGatewayPeeringWithName(name string) (*networkmanager.TransitGatewayPeering, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *networkmanager.TransitGatewayPeering:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type networkmanager.TransitGatewayPeering not found\", name)\n}", "title": "" }, { "docid": "4242216e97aec2fa4df4eec83e042323", "score": "0.4726742", "text": "func (c *TokenClient) Get(ctx context.Context, id string) (*Token, error) {\n\treturn c.Query().Where(token.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "f226ae2fb8caf8887eb5f0f8f096030e", "score": "0.46656173", "text": "func (o *InlineObject11) GetStateToken() string {\n\tif o == nil || o.StateToken == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.StateToken\n}", "title": "" }, { "docid": "e7d90552c76f346c9870990ed7184fd6", "score": "0.46317998", "text": "func (a *Client) GetLocalPeeringGateway(params *GetLocalPeeringGatewayParams) (*GetLocalPeeringGatewayOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLocalPeeringGatewayParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetLocalPeeringGateway\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/localPeeringGateways/{localPeeringGatewayId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetLocalPeeringGatewayReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetLocalPeeringGatewayOK), nil\n\n}", "title": "" }, { "docid": "32ce2273efa7c576ed82730f830bda53", "score": "0.46036267", "text": "func (s *SwarmSvc) GetJoinToken(ctx context.Context) (managerToken string, workerToken string, err error) {\n\tcli, err := s.cli.NewClient()\n\tif err != nil {\n\t\tglog.Errorln(\"GetJoinToken newClient error\", err)\n\t\treturn \"\", \"\", err\n\t}\n\n\tswarm, err := cli.SwarmInspect(ctx)\n\tif err != nil {\n\t\tglog.Errorln(\"SwarmInspect error\", err)\n\t\treturn \"\", \"\", err\n\t}\n\n\tglog.Infoln(\"SwarmInspect\", swarm.ClusterInfo, swarm.JoinTokens)\n\treturn swarm.JoinTokens.Manager, swarm.JoinTokens.Worker, nil\n}", "title": "" }, { "docid": "f2b4f8c3d6fb0ecf8b9cf4140cb19d02", "score": "0.45930576", "text": "func (k Keeper) GetToken(ctx sdk.Context, symbol string) (*types.Token, error) {\n\tstore := ctx.KVStore(k.storeKey)\n\tif !k.IsSymbolPresent(ctx, symbol) {\n\t\treturn nil, fmt.Errorf(\"could not find Token for symbol '%s'\", symbol)\n\t}\n\tbz := store.Get([]byte(symbol))\n\tvar token types.Token\n\tk.cdc.MustUnmarshalBinaryBare(bz, &token)\n\treturn &token, nil\n}", "title": "" }, { "docid": "c202c6c1f94efb38b0212f0c870e3565", "score": "0.45834413", "text": "func (o *Response) GetStateToken() string {\n\tif o == nil || o.StateToken == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.StateToken\n}", "title": "" }, { "docid": "10c31042b57234f239ff7979e6f6c81d", "score": "0.45586467", "text": "func (o LookupTransitGatewayPeeringResultOutput) PeeringId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupTransitGatewayPeeringResult) *string { return v.PeeringId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7812fb155b5fba6695bd44c7acf6f9b1", "score": "0.4554643", "text": "func (c *redisClient) GetToken(ctx context.Context, resourceID string) (string, error) {\n\tid, err := arm.ParseResourceID(resourceID)\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\tresp, err := c.api.ListKeys(ctx, id.ResourceGroupName, id.Name, &armredis.ClientListKeysOptions{})\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(ConvertResponseError(err))\n\t}\n\n\t// There are two keys. Pick first one available.\n\tif resp.PrimaryKey != nil {\n\t\treturn *resp.PrimaryKey, nil\n\t}\n\tif resp.SecondaryKey != nil {\n\t\treturn *resp.SecondaryKey, nil\n\t}\n\treturn \"\", trace.NotFound(\"missing keys\")\n}", "title": "" }, { "docid": "dd62c1b686b38a1d005936eb36ab3a25", "score": "0.4545118", "text": "func (c *Client) Token(ctx context.Context, cfg *config.MountConfig) (*oauth2.Token, error) {\n\n\tidPool, idProvider, err := c.gkeWorkloadIdentity(ctx, cfg)\n\tif err != nil {\n\t\tidPool, idProvider, err = c.fleetWorkloadIdentity(ctx, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tklog.V(5).InfoS(\"workload id configured\", \"pool\", idPool, \"provider\", idProvider)\n\n\t// Get iam.gke.io/gcp-service-account annotation to see if the\n\t// identitybindingtoken token should be traded for a GCP SA token.\n\t// See https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#creating_a_relationship_between_ksas_and_gsas\n\tsaResp, err := c.KubeClient.\n\t\tCoreV1().\n\t\tServiceAccounts(cfg.PodInfo.Namespace).\n\t\tGet(ctx, cfg.PodInfo.ServiceAccount, v1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to fetch SA info: %w\", err)\n\t}\n\tgcpSA := saResp.Annotations[\"iam.gke.io/gcp-service-account\"]\n\tklog.V(5).InfoS(\"matched service account\", \"service_account\", gcpSA)\n\n\t// Obtain a serviceaccount token for the pod.\n\tvar saTokenVal string\n\tif cfg.PodInfo.ServiceAccountTokens != \"\" {\n\t\tsaToken, err := c.extractSAToken(cfg, idPool) // calling function to extract token received from driver.\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to fetch SA token from driver: %w\", err)\n\t\t}\n\t\tsaTokenVal = saToken.Token\n\t} else {\n\t\tsaToken, err := c.generatePodSAToken(ctx, cfg, idPool) // if no token received, provider generates its own token.\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to fetch pod token: %w\", err)\n\t\t}\n\t\tsaTokenVal = saToken.Token\n\t}\n\n\t// Trade the kubernetes token for an identitybindingtoken token.\n\tidBindToken, err := tradeIDBindToken(ctx, c.HTTPClient, saTokenVal, idPool, idProvider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to fetch identitybindingtoken: %w\", err)\n\t}\n\n\t// If no `iam.gke.io/gcp-service-account` annotation is present the\n\t// identitybindingtoken will be used directly, allowing bindings on secrets\n\t// of the form \"serviceAccount:<project>.svc.id.goog[<namespace>/<sa>]\".\n\tif gcpSA == \"\" {\n\t\treturn idBindToken, nil\n\t}\n\n\tgcpSAResp, err := c.IAMClient.GenerateAccessToken(ctx, &credentialspb.GenerateAccessTokenRequest{\n\t\tName: fmt.Sprintf(\"projects/-/serviceAccounts/%s\", gcpSA),\n\t\tScope: secretmanager.DefaultAuthScopes(),\n\t}, gax.WithGRPCOptions(grpc.PerRPCCredentials(oauth.TokenSource{TokenSource: oauth2.StaticTokenSource(idBindToken)})))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to fetch gcp service account token: %w\", err)\n\t}\n\treturn &oauth2.Token{AccessToken: gcpSAResp.GetAccessToken()}, nil\n}", "title": "" }, { "docid": "13917b3e756cbcb2579908a456e62f42", "score": "0.45420542", "text": "func (k Keeper) GetToken(ctx sdk.Context, symbol string) types.Token {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.TokenKeyPrefix)\n\tvar token types.Token\n\tk.cdc.MustUnmarshalBinaryBare(store.Get(GetSymbolBytes(symbol)), &token)\n\treturn token\n}", "title": "" }, { "docid": "b1d9bf3ec6d07420b17378d8eee5e766", "score": "0.4532817", "text": "func (o PeeringTokenOutput) PeerName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PeeringToken) pulumi.StringOutput { return v.PeerName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f60361d8a12d0128bd9ae8271015ccfc", "score": "0.4518456", "text": "func (s *DynamoDBTokenStorer) Get(ctx context.Context, id string) (*Token, error) {\n\n\tgetItemInput := &dynamodb.GetItemInput{\n\t\tKey: map[string]types.AttributeValue{\n\t\t\t\"id\": &types.AttributeValueMemberS{Value: id},\n\t\t},\n\t\tTableName: &s.tableName,\n\t\tConsistentRead: aws.Bool(true),\n\t}\n\n\tgetItemResponse, err := s.client.GetItem(ctx, getItemInput)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif getItemResponse.Item == nil {\n\t\treturn nil, ErrTokenNotFound\n\t}\n\n\tvar token Token\n\n\terr = attributevalue.UnmarshalMap(getItemResponse.Item, &token)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unmarshalling item\")\n\t}\n\n\treturn &token, nil\n}", "title": "" }, { "docid": "1eee2a86f63e3ae809a15bbcd51456e9", "score": "0.4500104", "text": "func VersionedNetworkToken(assetID uint32, contractVer uint32, net dex.Network) (token *Token,\n\ttokenAddr, contractAddr common.Address, err error) {\n\n\ttoken, found := Tokens[assetID]\n\tif !found {\n\t\treturn nil, common.Address{}, common.Address{}, fmt.Errorf(\"token %d not found\", assetID)\n\t}\n\taddrs, found := token.NetTokens[net]\n\tif !found {\n\t\treturn nil, common.Address{}, common.Address{}, fmt.Errorf(\"token %d has no network %s\", assetID, net)\n\t}\n\tcontract, found := addrs.SwapContracts[contractVer]\n\tif !found {\n\t\treturn nil, common.Address{}, common.Address{}, fmt.Errorf(\"token %d version %d has no network %s token info\", assetID, contractVer, net)\n\t}\n\treturn token, addrs.Address, contract.Address, nil\n}", "title": "" }, { "docid": "bdd6e724178a009e4e10e8475400513a", "score": "0.44749016", "text": "func (s *TokenStore) GetToken(remote net.UDPAddr) string {\n\tid := remote.String()\n\tif token, ok := s.tokens[id]; ok {\n\t\treturn token\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "b5740ad97f7942eb54e45d2d518cfbed", "score": "0.44733933", "text": "func (a *Client) GetRemotePeeringConnection(params *GetRemotePeeringConnectionParams) (*GetRemotePeeringConnectionOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRemotePeeringConnectionParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetRemotePeeringConnection\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/remotePeeringConnections/{remotePeeringConnectionId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetRemotePeeringConnectionReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetRemotePeeringConnectionOK), nil\n\n}", "title": "" }, { "docid": "74a42f9272a2dfd1fa4757cd42683c6d", "score": "0.4430329", "text": "func getToken(c edge.EdgeClient, keyId string) (string, error) {\n\n\tauthRequest := &edge.AuthRequest{\n\t\tVersion: version,\n\t\tKeyId: keyId,\n\t}\n\n\tauthResponse, err := c.Authenticate(context.Background(), authRequest)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error authenticating\")\n\t}\n\n\tif authResponse.Code == http.StatusUnauthorized {\n\t\tl.conf.apiError = true\n\t\treturn \"\", errors.New(\"unauthorized request\")\n\t}\n\n\tif authResponse.Code != http.StatusOK {\n\t\treturn \"\", errors.New(\"unexpected response\")\n\t}\n\n\treturn authResponse.GetTokenId(), nil\n}", "title": "" }, { "docid": "fb75dfaebe77cab159a65d12170311d9", "score": "0.44282818", "text": "func (w *ETHWallet) OpenTokenWallet(tokenID uint32, settings map[string]string, tipChange func(error)) (asset.Wallet, error) {\n\ttoken, found := dexeth.Tokens[tokenID]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"token %d not found\", tokenID)\n\t}\n\n\tcfg, err := parseTokenWalletConfig(settings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taw := &assetWallet{\n\t\tbaseWallet: w.baseWallet,\n\t\tlog: w.baseWallet.log.SubLogger(strings.ToUpper(dex.BipIDSymbol(tokenID))),\n\t\tassetID: tokenID,\n\t\ttipChange: tipChange,\n\t\tfindRedemptionReqs: make(map[[32]byte]*findRedemptionRequest),\n\t\tcontractors: make(map[uint32]contractor),\n\t\tevmify: token.AtomicToEVM,\n\t\tatomize: token.EVMToAtomic,\n\t}\n\terr = aw.loadContractors(w.ctx, tokenID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tw.baseWallet.walletsMtx.Lock()\n\tw.baseWallet.wallets[tokenID] = aw\n\tw.baseWallet.walletsMtx.Unlock()\n\n\treturn &TokenWallet{\n\t\tassetWallet: aw,\n\t\tcfg: cfg,\n\t\tparent: w.assetWallet,\n\t\ttoken: token,\n\t}, nil\n}", "title": "" }, { "docid": "0b57adda510074d4c284f5d68135800e", "score": "0.44265208", "text": "func (s *TSTokenStore) GetToken(remote net.UDPAddr) string {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.store.GetToken(remote)\n}", "title": "" }, { "docid": "b71bfb0372d6cf50f5fcfb690e74c709", "score": "0.44194946", "text": "func (_AllowanceCrowdsale *AllowanceCrowdsaleCaller) TokenWallet(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _AllowanceCrowdsale.contract.Call(opts, out, \"tokenWallet\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "547e5e9e1724165eddd9cde7b91b50c5", "score": "0.4417927", "text": "func (c *Client) GetToken(ctx context.Context, id int) (*Token, error) {\n\te, err := c.Tokens.Endpoint()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te = fmt.Sprintf(\"%s/%d\", e, id)\n\tr, err := coupleAPIErrors(c.R(ctx).SetResult(&Token{}).Get(e))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Result().(*Token), nil\n}", "title": "" }, { "docid": "6469254bd3a0d7afe5307412417ade00", "score": "0.44065744", "text": "func (_AllowanceCrowdsale *AllowanceCrowdsaleSession) TokenWallet() (common.Address, error) {\n\treturn _AllowanceCrowdsale.Contract.TokenWallet(&_AllowanceCrowdsale.CallOpts)\n}", "title": "" }, { "docid": "471f01c15322c6faa492984be156fb86", "score": "0.43663493", "text": "func GetDebugToken(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *DebugTokenState, opts ...pulumi.ResourceOption) (*DebugToken, error) {\n\tvar resource DebugToken\n\terr := ctx.ReadResource(\"google-native:firebaseappcheck/v1beta:DebugToken\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "589b2fb27a41b4248eda2762f8335e6b", "score": "0.43504366", "text": "func GetToken(ctx context.Context, address string) (string, error) {\n\tid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate token: %s\", err)\n\t}\n\n\tdata := fmt.Sprintf(\"<gip><version>1</version><email>%s</email><password>%s</password></gip>\", id, id)\n\n\tresp, err := postData(ctx, address, \"GWRLogin\", data)\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error fetching token: %s\", err)\n\t}\n\n\t// example responses\n\t// OK - <gip><version>1</version><rc>200</rc><token>xyzaqlifpzoo7lao56xoy3m0pu3wsy1n4dnzobkj</token></gip>\n\t// Not synced - <gip><version>1</version><rc>404</rc></gip>\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading token response: %s\", err)\n\t}\n\n\trBody := string(b)\n\tif strings.Contains(rBody, \"<rc>401</rc>\") ||\n\t\tstrings.Contains(rBody, \"<rc>404</rc>\") {\n\t\treturn \"\", ErrUnauthorized\n\t}\n\n\ttype response struct {\n\t\tToken string `xml:\"token\"`\n\t}\n\tvar r response\n\terr = xml.Unmarshal([]byte(rBody), &r)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error reading xml response: %s\", err)\n\t}\n\n\tif r.Token == \"\" {\n\t\treturn \"\", fmt.Errorf(\"token not found, empty\")\n\t}\n\treturn r.Token, nil\n}", "title": "" }, { "docid": "28e224f592c070f057e7065cf8c57178", "score": "0.4327001", "text": "func (r *ReceiverReconciler) token(ctx context.Context, receiver v1beta1.Receiver) (string, error) {\n\ttoken := \"\"\n\tsecretName := types.NamespacedName{\n\t\tNamespace: receiver.GetNamespace(),\n\t\tName: receiver.Spec.SecretRef.Name,\n\t}\n\n\tvar secret corev1.Secret\n\terr := r.Client.Get(ctx, secretName, &secret)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to read token from secret '%s' error: %w\", secretName, err)\n\t}\n\n\tif val, ok := secret.Data[\"token\"]; ok {\n\t\ttoken = string(val)\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"invalid '%s' secret data: required fields 'token'\", secretName)\n\t}\n\n\treturn token, nil\n}", "title": "" }, { "docid": "d54964b263bd29e3db3b4c344801edbc", "score": "0.4320703", "text": "func (_AllowanceCrowdsale *AllowanceCrowdsaleCallerSession) TokenWallet() (common.Address, error) {\n\treturn _AllowanceCrowdsale.Contract.TokenWallet(&_AllowanceCrowdsale.CallOpts)\n}", "title": "" }, { "docid": "50ddb18b23a17a765ff523f53be16e28", "score": "0.43203074", "text": "func (m *manager) GetToken(opts *auth.Options) (string, error) {\n\tsignature, err := auth.NewSignatureSharedSecret(m.config.SharedSecret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn auth.Token(m.claims, signature, opts)\n}", "title": "" }, { "docid": "7d26c5f127c3dfdae64e268dc111d701", "score": "0.43189827", "text": "func LookupPeering(ctx *pulumi.Context, args *LookupPeeringArgs, opts ...pulumi.InvokeOption) (*LookupPeeringResult, error) {\n\tvar rv LookupPeeringResult\n\terr := ctx.Invoke(\"azure-native:peering/v20200401:getPeering\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "4c0ed5e9a072d05ab2038f81cec29eb1", "score": "0.42827696", "text": "func (g *GetStatisticalGraphRequest) GetToken() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Token\n}", "title": "" }, { "docid": "b717169fe8e83d2d4f9f1506d5360db2", "score": "0.42807314", "text": "func (n *Node) GetToken() (string, error) {\n\tif n.Type != NodeTypeMaster {\n\t\treturn \"\", fmt.Errorf(\"could not get token from a non-master node\")\n\t}\n\tvar outPipe bytes.Buffer\n\tif err := n.sshClient.RunCommand(infra.Scripts[\"get_k3s_token\"].(string), ssh.CommandOptions{Stdout: bufio.NewWriter(&outPipe)}); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn outPipe.String(), nil\n}", "title": "" }, { "docid": "3ad26ecd231046a6b0fe354cfe8e8147", "score": "0.42694572", "text": "func (r *ManagedDeviceEncryptionStateRequest) Get(ctx context.Context) (resObj *ManagedDeviceEncryptionState, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" }, { "docid": "a13f7887417dbdef27316d3672fd2aed", "score": "0.4251984", "text": "func (x *SDSConfig) GetToken() *structpb.Struct {\n\tif x != nil {\n\t\treturn x.Token\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6d4766c98968c84ed1c51bfa4e24939", "score": "0.42405584", "text": "func (k Keeper) GetTokenAlias(ctx sdk.Context, symbol string) *types.TokenAlias {\n\tprefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), PrefixKeyTokenAlias)\n\tbz := prefixStore.Get([]byte(symbol))\n\tif bz == nil {\n\t\treturn nil\n\t}\n\n\talias := new(types.TokenAlias)\n\tk.cdc.MustUnmarshal(bz, alias)\n\n\treturn alias\n}", "title": "" }, { "docid": "56a5b12ea4dde391afcd86d69963e766", "score": "0.42197153", "text": "func (l *StatsLoadAsyncGraphRequest) GetToken() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Token\n}", "title": "" }, { "docid": "98d903dc40a21a2fe6834524e3e2f6b4", "score": "0.4212634", "text": "func (m Member) GetWallet() (*insolar.Reference, error) {\n\treturn &m.Wallet, nil\n}", "title": "" }, { "docid": "0466742dffaf33639f86a2c5494ab097", "score": "0.42067984", "text": "func (r *TokenRepositoryImpl) Get(id int) (*domain.Token, error) {\n\trow, err := r.queryRow(\"select id, value from tokens where id=?\", id)\n\tif err != nil {\n\n\t\treturn nil, err\n\t}\n\td, err := r.mapToEntity(row)\n\tif err != nil && err == sql.ErrNoRows {\n\t\treturn nil, domain.ErrNotFoundToken\n\t}\n\treturn d, err\n}", "title": "" }, { "docid": "5355c4fa775f847066f65e1551f1eb6a", "score": "0.41997567", "text": "func (o *Response) GetStateTokenOk() (*string, bool) {\n\tif o == nil || o.StateToken == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StateToken, true\n}", "title": "" }, { "docid": "735bdae757584c31b499913706137d4a", "score": "0.41794112", "text": "func GetToken(remoteFilename string, ts int, secretKey string) (string, error) {\n\tbsFilename,err := ConvertUTF8ToBytes([]byte(remoteFilename), GCharset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbsKey,err := ConvertUTF8ToBytes([]byte(secretKey), GCharset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbsTimestamp,err := ConvertUTF8ToBytes([]byte(strconv.Itoa(ts)), GCharset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buff = make([]byte, len(bsFilename) + len(bsKey) + len(bsTimestamp))\n\tcopy(buff, bsFilename)\n\tcopy(buff[len(bsFilename):], bsKey)\n\tcopy(buff[len(bsFilename) + len(bsKey):], bsTimestamp)\n\n\treturn Md5(buff), nil\n}", "title": "" }, { "docid": "5a5381cd50fd14cf92908f2efee1b3af", "score": "0.4178373", "text": "func (a Authenticator) Token(state string, r *http.Request) (*oauth2.Token, error) {\n\tvalues := r.URL.Query()\n\tif e := values.Get(\"error\"); e != \"\" {\n\t\treturn nil, errors.New(\"rakuten: auth failed - \" + e)\n\t}\n\tcode := values.Get(\"code\")\n\tif code == \"\" {\n\t\treturn nil, errors.New(\"rakuten: didn't get access code\")\n\t}\n\tactualState := values.Get(\"state\")\n\tif actualState != state {\n\t\treturn nil, errors.New(\"rakuten: redirect state parameter doesn't match\")\n\t}\n\treturn a.config.Exchange(a.context, code)\n}", "title": "" }, { "docid": "218f107c02a3c53ae1b88ea51c3550e7", "score": "0.41763595", "text": "func (w *ETHWallet) OpenTokenWallet(tokenCfg *asset.TokenConfig) (asset.Wallet, error) {\n\ttoken, found := dexeth.Tokens[tokenCfg.AssetID]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"token %d not found\", tokenCfg.AssetID)\n\t}\n\n\tcfg, err := parseTokenWalletConfig(tokenCfg.Settings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetToken := token.NetTokens[w.net]\n\tif netToken == nil || len(netToken.SwapContracts) == 0 {\n\t\treturn nil, fmt.Errorf(\"could not find token with ID %d on network %s\", w.assetID, w.net)\n\t}\n\n\tvar maxSwapGas, maxRedeemGas uint64\n\tfor _, contract := range netToken.SwapContracts {\n\t\tif contract.Gas.Swap > maxSwapGas {\n\t\t\tmaxSwapGas = contract.Gas.Swap\n\t\t}\n\t\tif contract.Gas.Redeem > maxRedeemGas {\n\t\t\tmaxRedeemGas = contract.Gas.Redeem\n\t\t}\n\t}\n\n\tif maxSwapGas == 0 || perTxGasLimit < maxSwapGas {\n\t\treturn nil, errors.New(\"max swaps cannot be zero or undefined\")\n\t}\n\tif maxRedeemGas == 0 || perTxGasLimit < maxRedeemGas {\n\t\treturn nil, errors.New(\"max redeems cannot be zero or undefined\")\n\t}\n\n\taw := &assetWallet{\n\t\tbaseWallet: w.baseWallet,\n\t\tlog: w.baseWallet.log.SubLogger(strings.ToUpper(dex.BipIDSymbol(tokenCfg.AssetID))),\n\t\tassetID: tokenCfg.AssetID,\n\t\ttipChange: tokenCfg.TipChange,\n\t\tpeersChange: tokenCfg.PeersChange,\n\t\tfindRedemptionReqs: make(map[[32]byte]*findRedemptionRequest),\n\t\tpendingApprovals: make(map[uint32]*pendingApproval),\n\t\tapprovalCache: make(map[uint32]bool),\n\t\tcontractors: make(map[uint32]contractor),\n\t\tevmify: token.AtomicToEVM,\n\t\tatomize: token.EVMToAtomic,\n\t\tui: token.UnitInfo,\n\t\tmaxSwapsInTx: perTxGasLimit / maxSwapGas,\n\t\tmaxRedeemsInTx: perTxGasLimit / maxRedeemGas,\n\t\tpendingTxCheckBal: new(big.Int),\n\t}\n\n\tw.baseWallet.walletsMtx.Lock()\n\tw.baseWallet.wallets[tokenCfg.AssetID] = aw\n\tw.baseWallet.walletsMtx.Unlock()\n\n\treturn &TokenWallet{\n\t\tassetWallet: aw,\n\t\tcfg: cfg,\n\t\tparent: w.assetWallet,\n\t\ttoken: token,\n\t\tnetToken: netToken,\n\t}, nil\n}", "title": "" }, { "docid": "67049a7c059aab72b33e1c0683506ae9", "score": "0.4166873", "text": "func getServicePrincipalToken(config *authConfig, env *azure.Environment, resource string) (adal.OAuthTokenProvider, error) {\n\toauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, config.tenantID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create OAuth config, error: %v\", err)\n\t}\n\n\tif config.useManagedIdentity {\n\t\tmsiEndpoint, err := adal.GetMSIVMEndpoint()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get managed service identity endpoint, error: %v\", err)\n\t\t}\n\t\t// using user-assigned managed identity to access keyvault\n\t\tif len(config.userAssignedIdentityID) > 0 {\n\t\t\treturn adal.NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, env.ServiceManagementEndpoint, config.userAssignedIdentityID)\n\t\t}\n\t\t// using system-assigned managed identity to access keyvault\n\t\treturn adal.NewServicePrincipalTokenFromMSI(msiEndpoint, resource)\n\t}\n\t// using service-principal to access the keyvault instance\n\tif len(config.aadClientID) > 0 && len(config.aadClientSecret) > 0 {\n\t\treturn adal.NewServicePrincipalToken(*oauthConfig, config.aadClientID, config.aadClientSecret, resource)\n\t}\n\treturn nil, fmt.Errorf(\"no credentials provided for accessing keyvault\")\n}", "title": "" }, { "docid": "54595b506d3275d00e85431f5fa4f123", "score": "0.41607508", "text": "func (_EthereumPaymentObligationContract *EthereumPaymentObligationContractCaller) GetTokenDetails(opts *bind.CallOpts, tokenId *big.Int) (struct {\n\tGrossAmount []byte\n\tCurrency []byte\n\tDueDate []byte\n\tAnchorId *big.Int\n\tDocumentRoot [32]byte\n}, error) {\n\tret := new(struct {\n\t\tGrossAmount []byte\n\t\tCurrency []byte\n\t\tDueDate []byte\n\t\tAnchorId *big.Int\n\t\tDocumentRoot [32]byte\n\t})\n\tout := ret\n\terr := _EthereumPaymentObligationContract.contract.Call(opts, out, \"getTokenDetails\", tokenId)\n\treturn *ret, err\n}", "title": "" }, { "docid": "67f28d2caf8cccc0f1991f461e00f17b", "score": "0.4153047", "text": "func GetToken(name string, m configmap.Mapper) (*oauth2.Token, error) {\n\ttokenString, ok := m.Get(config.ConfigToken)\n\tif !ok || tokenString == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty token found - please run \\\"rclone config reconnect %s:\\\"\", name)\n\t}\n\ttoken := new(oauth2.Token)\n\terr := json.Unmarshal([]byte(tokenString), token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// if has data then return it\n\tif token.AccessToken != \"\" {\n\t\treturn token, nil\n\t}\n\t// otherwise try parsing as oldToken\n\toldtoken := new(oldToken)\n\terr = json.Unmarshal([]byte(tokenString), oldtoken)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Fill in result into new token\n\ttoken.AccessToken = oldtoken.AccessToken\n\ttoken.RefreshToken = oldtoken.RefreshToken\n\ttoken.Expiry = oldtoken.Expiry\n\t// Save new format in config file\n\terr = PutToken(name, m, token, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn token, nil\n}", "title": "" }, { "docid": "a60b23d9c58cce5771b7f17fe703d0ff", "score": "0.41450596", "text": "func (noCache) GetToken(ctx context.Context, registry string, scheme Scheme, key string) (string, error) {\n\treturn \"\", errdef.ErrNotFound\n}", "title": "" }, { "docid": "f0be3eb35c6b293fb8167d752337e6d6", "score": "0.41425186", "text": "func (o *InlineObject11) GetStateTokenOk() (*string, bool) {\n\tif o == nil || o.StateToken == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StateToken, true\n}", "title": "" }, { "docid": "f8bff26e4449e8711824129edaea6c14", "score": "0.41315353", "text": "func (a *PlaidApiService) LinkTokenGet(ctx _context.Context) ApiLinkTokenGetRequest {\n\treturn ApiLinkTokenGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "15777c00d40f7c30a4ac0dfbaa60df3f", "score": "0.41266808", "text": "func (o *PeeringNodeIdentityResponse) GetPeeringURLOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PeeringURL, true\n}", "title": "" }, { "docid": "3adcea39a7b22424496942530ee6c4f2", "score": "0.41195053", "text": "func (wiTokenProvider *ADWorkloadIdentityTokenProvider) GetToken(_ string) (*amqpAuth.Token, error) {\n\terr := wiTokenProvider.Refresh()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn amqpAuth.NewToken(amqpAuth.CBSTokenTypeJWT, wiTokenProvider.aadToken.AccessToken,\n\t\twiTokenProvider.aadToken.ExpiresOn), nil\n}", "title": "" }, { "docid": "5a4b9c5ec2fd2a85658940eb966f50b7", "score": "0.4110768", "text": "func (g generator) Get(clusterID string) (Token, error) {\n\treturn g.GetWithRole(clusterID, \"\")\n}", "title": "" }, { "docid": "34cbf6e2576653418bae68f92b4c0e7b", "score": "0.4099615", "text": "func (_TokenLockup *TokenLockupCaller) GetStakerStruct(opts *bind.CallOpts, _staker common.Address, _id *big.Int) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, bool, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new(*big.Int)\n\t\tret2 = new(*big.Int)\n\t\tret3 = new(*big.Int)\n\t\tret4 = new(*big.Int)\n\t\tret5 = new(bool)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t\tret2,\n\t\tret3,\n\t\tret4,\n\t\tret5,\n\t}\n\terr := _TokenLockup.contract.Call(opts, out, \"getStakerStruct\", _staker, _id)\n\treturn *ret0, *ret1, *ret2, *ret3, *ret4, *ret5, err\n}", "title": "" }, { "docid": "085f4e53aa280626f7b79c88fef1bbc4", "score": "0.40803897", "text": "func (a *resourceTracker) GetResourceToken(ctx context.Context, call *call) <-chan ResourceToken {\n\n\tmemory := call.Memory * 1024 * 1024\n\n\tc := a.cond\n\tch := make(chan ResourceToken)\n\n\tgo func() {\n\t\tc.L.Lock()\n\t\tfor (a.ramUsed + memory) > a.ramTotal {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tc.L.Unlock()\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tc.Wait()\n\t\t}\n\n\t\ta.ramUsed += memory\n\t\tc.L.Unlock()\n\n\t\tt := &resourceToken{decrement: func() {\n\t\t\tc.L.Lock()\n\t\t\ta.ramUsed -= memory\n\t\t\tc.L.Unlock()\n\t\t\tc.Broadcast()\n\t\t}}\n\n\t\tselect {\n\t\tcase ch <- t:\n\t\tcase <-ctx.Done():\n\t\t\t// if we can't send b/c nobody is waiting anymore, need to decrement here\n\t\t\tt.Close()\n\t\t}\n\t}()\n\n\treturn ch\n}", "title": "" }, { "docid": "883fe5d262fe07e3ed7c304fde43f1fd", "score": "0.40788507", "text": "func (s MonitoringSpec) GetTokenSecretName() string {\n\treturn util.TypeOrDefault[string](s.TokenSecretName)\n}", "title": "" }, { "docid": "791bde0e79a8d1e783c0e366f1af52d4", "score": "0.40736145", "text": "func (g *GRPCServer) GetToken(ctx context.Context, req *types.ResourceRequest) (*types.ProvisionTokenV2, error) {\n\tauth, err := g.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tt, err := auth.ServerWithRoles.GetToken(ctx, req.Name)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tprovisionTokenV2, ok := t.(*types.ProvisionTokenV2)\n\tif !ok {\n\t\treturn nil, trace.Errorf(\"encountered unexpected token type: %T\", t)\n\t}\n\treturn provisionTokenV2, nil\n}", "title": "" }, { "docid": "c6d588234b6b03c8c0134c9a288d2257", "score": "0.40695915", "text": "func GetToken(tokenSecretContext *api.TokenSecretContext) (string, error) {\n\tvar inputSecretKey string\n\tvar outputSecretKey string\n\tsecretName := tokenSecretContext.SecretName\n\tsecretsInst := lsecrets.Instance()\n\n\tif secretsInst == nil {\n\t\treturn \"\", fmt.Errorf(\"Unable to get token from secret since it is not initialized\")\n\t}\n\n\t// Handle edge cases for different providers.\n\tswitch secretsInst.String() {\n\tcase lsecrets.TypeDCOS:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\tnamespace := tokenSecretContext.SecretNamespace\n\t\tif namespace != \"\" {\n\t\t\tinputSecretKey = namespace + \"/\" + secretName\n\t\t}\n\t\toutputSecretKey = inputSecretKey\n\n\tcase lsecrets.TypeK8s:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretTokenKey\n\n\tdefault:\n\t\tinputSecretKey = tokenSecretContext.SecretName\n\t\toutputSecretKey = SecretNameKey\n\t}\n\n\t// Get secret value with standardized interface\n\tsecretValue, err := secretsInst.GetSecret(inputSecretKey, requestToContext(tokenSecretContext))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Retrieve auth token\n\tauthToken, exists := secretValue[outputSecretKey]\n\tif !exists {\n\t\treturn \"\", ErrAuthTokenNotFound\n\t}\n\treturn authToken.(string), nil\n\n}", "title": "" }, { "docid": "55127821d9c8f34d9d259edd4b921933", "score": "0.4069357", "text": "func GetToken(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"aws-native:token\")\n}", "title": "" }, { "docid": "67747b379c2cd968549ac88980fae66b", "score": "0.405975", "text": "func (w *timeoutWrapper) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\tvar tk azcore.AccessToken\n\tvar err error\n\tif w.timeout > 0 {\n\t\tc, cancel := context.WithTimeout(ctx, w.timeout)\n\t\tdefer cancel()\n\t\ttk, err = w.cred.GetToken(c, opts)\n\t\tif ce := c.Err(); errors.Is(ce, context.DeadlineExceeded) {\n\t\t\t// The Context reached its deadline, probably because no managed identity is available.\n\t\t\t// A credential unavailable error signals the chain to try its next credential, if any.\n\t\t\terr = azidentity.NewCredentialUnavailableError(\"managed identity timed out\")\n\t\t} else {\n\t\t\t// some managed identity implementation is available, so don't apply the timeout to future calls\n\t\t\tw.timeout = 0\n\t\t}\n\t} else {\n\t\ttk, err = w.cred.GetToken(ctx, opts)\n\t}\n\treturn tk, err\n}", "title": "" }, { "docid": "bb28728ef95deda9b7125d00ecbbb657", "score": "0.4056869", "text": "func GetGuest(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GuestState, opts ...pulumi.ResourceOption) (*Guest, error) {\n\tvar resource Guest\n\terr := ctx.ReadResource(\"f5bigip:vcmp/guest:Guest\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "742de3275e835b5208df78f6467b0e53", "score": "0.40568432", "text": "func ExamplePeeringsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armpeering.NewPeeringsClient(\"subId\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.Get(ctx,\n\t\t\"rgName\",\n\t\t\"peeringName\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "title": "" }, { "docid": "176cf517464ae9a827e2f2bb139b61b8", "score": "0.40418366", "text": "func (p *LinkedServicesCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "400a8c8758b6552046456f431d500c6d", "score": "0.40395725", "text": "func (m *IosVppEBook) GetVppTokenId()(*string) {\n return m.vppTokenId\n}", "title": "" }, { "docid": "1e3d03ddbb9fc020e89785677cb731e8", "score": "0.40341848", "text": "func (p *VirtualNetworkLinksCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "a44b8f95ed611469725b9fffd8075c0f", "score": "0.40165743", "text": "func (p *Protocol) GetVerifiedPeer(id identity.ID) *peer.Peer {\n\tfor _, verified := range p.mgr.verifiedPeers() {\n\t\tif verified.ID() == id {\n\t\t\treturn unwrapPeer(verified)\n\t\t}\n\t}\n\t// if the sender is not managed, try to load it from DB\n\tfrom, err := p.local().Database().Peer(id)\n\tif err != nil {\n\t\t// this should not happen as this is checked in validation\n\t\tp.log.Warnw(\"invalid stored peer\",\n\t\t\t\"id\", id,\n\t\t\t\"err\", err,\n\t\t)\n\n\t\treturn nil\n\t}\n\t// send ping to restored peer to ensure that it will be verified\n\tp.sendPing(from.Address(), from.ID())\n\n\treturn from\n}", "title": "" }, { "docid": "423dede9a0d83af778377ba0e490135c", "score": "0.40130404", "text": "func (p *EnvironmentsClientDeletePrivateEndpointConnectionPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "0c8e4b9d9ad7d754ce81dc5fa297475f", "score": "0.4012106", "text": "func (ctx *Context) Whisper_full_get_token_id(segment int, token int) Token {\n\treturn Token(C.whisper_full_get_token_id((*C.struct_whisper_context)(ctx), C.int(segment), C.int(token)))\n}", "title": "" }, { "docid": "8e77ffcaf8f099dd4730346a096b072a", "score": "0.40112814", "text": "func (o *RegistryCredential) GetToken() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&128 != 0\n\tif ok {\n\t\tvalue = o.token\n\t}\n\treturn\n}", "title": "" }, { "docid": "9df0366f1103996889db95cce299f0e7", "score": "0.4009239", "text": "func (peering *VirtualNetworks_VirtualNetworkPeering_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif peering == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &VirtualNetworks_VirtualNetworkPeering_Spec_ARM{}\n\n\t// Set property \"Name\":\n\tresult.Name = resolved.Name\n\n\t// Set property \"Properties\":\n\tif peering.AllowForwardedTraffic != nil ||\n\t\tpeering.AllowGatewayTransit != nil ||\n\t\tpeering.AllowVirtualNetworkAccess != nil ||\n\t\tpeering.DoNotVerifyRemoteGateways != nil ||\n\t\tpeering.PeeringState != nil ||\n\t\tpeering.RemoteAddressSpace != nil ||\n\t\tpeering.RemoteBgpCommunities != nil ||\n\t\tpeering.RemoteVirtualNetwork != nil ||\n\t\tpeering.UseRemoteGateways != nil {\n\t\tresult.Properties = &VirtualNetworkPeeringPropertiesFormat_ARM{}\n\t}\n\tif peering.AllowForwardedTraffic != nil {\n\t\tallowForwardedTraffic := *peering.AllowForwardedTraffic\n\t\tresult.Properties.AllowForwardedTraffic = &allowForwardedTraffic\n\t}\n\tif peering.AllowGatewayTransit != nil {\n\t\tallowGatewayTransit := *peering.AllowGatewayTransit\n\t\tresult.Properties.AllowGatewayTransit = &allowGatewayTransit\n\t}\n\tif peering.AllowVirtualNetworkAccess != nil {\n\t\tallowVirtualNetworkAccess := *peering.AllowVirtualNetworkAccess\n\t\tresult.Properties.AllowVirtualNetworkAccess = &allowVirtualNetworkAccess\n\t}\n\tif peering.DoNotVerifyRemoteGateways != nil {\n\t\tdoNotVerifyRemoteGateways := *peering.DoNotVerifyRemoteGateways\n\t\tresult.Properties.DoNotVerifyRemoteGateways = &doNotVerifyRemoteGateways\n\t}\n\tif peering.PeeringState != nil {\n\t\tpeeringState := *peering.PeeringState\n\t\tresult.Properties.PeeringState = &peeringState\n\t}\n\tif peering.RemoteAddressSpace != nil {\n\t\tremoteAddressSpace_ARM, err := (*peering.RemoteAddressSpace).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tremoteAddressSpace := *remoteAddressSpace_ARM.(*AddressSpace_ARM)\n\t\tresult.Properties.RemoteAddressSpace = &remoteAddressSpace\n\t}\n\tif peering.RemoteBgpCommunities != nil {\n\t\tremoteBgpCommunities_ARM, err := (*peering.RemoteBgpCommunities).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tremoteBgpCommunities := *remoteBgpCommunities_ARM.(*VirtualNetworkBgpCommunities_ARM)\n\t\tresult.Properties.RemoteBgpCommunities = &remoteBgpCommunities\n\t}\n\tif peering.RemoteVirtualNetwork != nil {\n\t\tremoteVirtualNetwork_ARM, err := (*peering.RemoteVirtualNetwork).ConvertToARM(resolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tremoteVirtualNetwork := *remoteVirtualNetwork_ARM.(*SubResource_ARM)\n\t\tresult.Properties.RemoteVirtualNetwork = &remoteVirtualNetwork\n\t}\n\tif peering.UseRemoteGateways != nil {\n\t\tuseRemoteGateways := *peering.UseRemoteGateways\n\t\tresult.Properties.UseRemoteGateways = &useRemoteGateways\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "8eb989de7fc4bf96770ba4e308810f90", "score": "0.4000066", "text": "func (p *EnvironmentsClientApproveOrRejectPrivateEndpointConnectionPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "fa6fc4b3ee0fbae0526054204bc4b4b7", "score": "0.3998921", "text": "func GetPeeringAttachmentAccepter(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *PeeringAttachmentAccepterState, opts ...pulumi.ResourceOption) (*PeeringAttachmentAccepter, error) {\n\tvar resource PeeringAttachmentAccepter\n\terr := ctx.ReadResource(\"aws:ec2transitgateway/peeringAttachmentAccepter:PeeringAttachmentAccepter\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "110e39f64eefd8fd87f9eb429b47c7a0", "score": "0.39955163", "text": "func (_EthereumPaymentObligationContract *EthereumPaymentObligationContractCallerSession) GetTokenDetails(tokenId *big.Int) (struct {\n\tGrossAmount []byte\n\tCurrency []byte\n\tDueDate []byte\n\tAnchorId *big.Int\n\tDocumentRoot [32]byte\n}, error) {\n\treturn _EthereumPaymentObligationContract.Contract.GetTokenDetails(&_EthereumPaymentObligationContract.CallOpts, tokenId)\n}", "title": "" }, { "docid": "fc65bb65d164be42f73fed9b50d7040f", "score": "0.39930677", "text": "func (_TokenLockup *TokenLockupCallerSession) GetStakerStruct(_staker common.Address, _id *big.Int) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, bool, error) {\n\treturn _TokenLockup.Contract.GetStakerStruct(&_TokenLockup.CallOpts, _staker, _id)\n}", "title": "" }, { "docid": "6cdaa641d2a31db25ce4edf215c97352", "score": "0.39831248", "text": "func GetFreeToken(address common.Address) {\n\tfor i := 0; i < walletProfile.Shards; i++ {\n\t\t// use the 1st server (leader) to make the getFreeToken call\n\t\tserver := walletProfile.RPCServer[i][0]\n\t\tclient, err := clientService.NewClient(server.IP, server.Port)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Debug(\"GetFreeToken\", \"server\", server)\n\n\t\tfor retry := 0; retry < rpcRetry; retry++ {\n\t\t\tresponse, err := client.GetFreeToken(address)\n\t\t\tif err != nil {\n\t\t\t\tlog.Info(\"failed to get free token, retrying ...\")\n\t\t\t\ttime.Sleep(200 * time.Millisecond)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Debug(\"GetFreeToken\", \"response\", response)\n\t\t\ttxID := common.Hash{}\n\t\t\ttxID.SetBytes(response.TxId)\n\t\t\tfmt.Printf(\"Transaction Id requesting free token in shard %d: %s\\n\", i, txID.Hex())\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a3ff110050be619148172345f5a6a02e", "score": "0.39802036", "text": "func (n *node) GetPeerNode(id string) *node {\n\tn.RLock()\n\tdefer n.RUnlock()\n\n\t// get node topology up to MaxDepth\n\ttop := n.Topology(MaxDepth)\n\n\tuntilFoundPeer := func(n *node) bool {\n\t\treturn n.id == id\n\t}\n\tjustWalk := func(paent, node *node) {}\n\n\tvisited := top.walk(untilFoundPeer, justWalk)\n\n\tpeerNode, ok := visited[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn peerNode\n}", "title": "" }, { "docid": "89b074268e6548c3ff5fa30891aa0b63", "score": "0.39756882", "text": "func GetToken(code string, state string) {\n\tvar err error\n\tif state != hiveboard.OauthState {\n\t\tlog.Fatal(ErrorState)\n\t}\n\thiveboard.OauthToken, err = hiveboard.OauthConf.Exchange(oauth2.NoContext, code)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\thiveboard.Client = hiveboard.OauthConf.Client(oauth2.NoContext, hiveboard.OauthToken)\n\t// This should be saved somewhere. No need to get the full username and stuff...\n\tfmt.Println(hiveboard.OauthToken)\n\tres, err := hiveboard.Client.Get(\"https://api.intra.42.fr/oauth/token/info\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tbod, _ := ioutil.ReadAll(res.Body)\n\tfmt.Println(string(bod))\n\t// var tokendata TokenData\n\t// _ = json.Unmarshal(bod, &tokendata)\n\t// fmt.Println(tokendata)\n}", "title": "" }, { "docid": "2870b31ff4f4f9c5953ffa0698b662c8", "score": "0.3974928", "text": "func (o *OidcGenerator) GetToken(code string) (string, error) {\n\toauth2Token, err := o.config.Exchange(o.ctx, code)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trawIDToken, ok := oauth2Token.Extra(\"id_token\").(string)\n\tif !ok {\n\t\treturn \"\", errors.New(\"missing id_token from oauth2 token\")\n\t}\n\n\treturn rawIDToken, nil\n}", "title": "" }, { "docid": "475dd12b70e821222457c58d23c3e4f2", "score": "0.39719445", "text": "func (rpc *AergoRPCService) GetStateAndProof(ctx context.Context, in *types.AccountAndRoot) (*types.AccountProof, error) {\n\tif err := rpc.checkAuth(ctx, ReadBlockChain); err != nil {\n\t\treturn nil, err\n\t}\n\tresult, err := rpc.hub.RequestFuture(message.ChainSvc,\n\t\t&message.GetStateAndProof{Account: in.Account, Root: in.Root, Compressed: in.Compressed}, defaultActorTimeout, \"rpc.(*AergoRPCService).GetStateAndProof\").Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trsp, ok := result.(message.GetStateAndProofRsp)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.Internal, \"internal type (%v) error\", reflect.TypeOf(result))\n\t}\n\treturn rsp.StateProof, rsp.Err\n}", "title": "" }, { "docid": "ffe516be1fada34f182851826b33a1fc", "score": "0.39714018", "text": "func (o *PeeringNodeIdentityResponse) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "title": "" }, { "docid": "1a4bca8f4160c3511028c626bfc0686c", "score": "0.39683378", "text": "func (d *TemplateData) GetViewerToken() (string, error) {\n\tviewerTokenSecret := &corev1.Secret{}\n\tif err := d.client.Get(d.ctx, ctrlruntimeclient.ObjectKey{Name: ViewerTokenSecretName, Namespace: d.cluster.Status.NamespaceName}, viewerTokenSecret); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(viewerTokenSecret.Data[ViewerTokenSecretKey]), nil\n}", "title": "" }, { "docid": "8589b39c320bbf73ed08d255acda696d", "score": "0.3963838", "text": "func GetVethPair(name1 string, name2 string) (link1 netlink.Link,\n\tlink2 netlink.Link, err error) {\n\tlink1, err = MakeVethPair(name1, name2, 1500)\n\tif err != nil {\n\t\tswitch {\n\t\tcase os.IsExist(err):\n\t\t\terr = fmt.Errorf(\n\t\t\t\t\"container veth name provided (%v) \"+\n\t\t\t\t\t\"already exists\", name1)\n\t\t\treturn\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"failed to make veth pair: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlink2, err = netlink.LinkByName(name2)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to lookup %q: %v\\n\", name2, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "da5a2d72b4de56200028cbc3a1445916", "score": "0.3963514", "text": "func (_BikeCoinCrowdsale *BikeCoinCrowdsaleCaller) Token(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BikeCoinCrowdsale.contract.Call(opts, out, \"token\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f1e4f3526a752cd289aa8a45e75d9ac5", "score": "0.3962304", "text": "func (p *ResourcesCreateOrUpdateByIDPoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "45eca9d83aa97f67e5456278abf552d3", "score": "0.39585477", "text": "func savePeerToken(compound string) {\n\tarr := strings.Split(strings.TrimSpace(compound), \"-\")\n\tpeer_id, token := arr[0], arr[1]\n\tpf(\"Peer: %s, Auth Token: %s\\n\", peer_id, token)\n\terr := setPeerToken(peer_id, token) // todo pull the error msg out of the err object\n\tif err != nil {\n\t\tpl(err)\n\t}\n}", "title": "" }, { "docid": "0516c368cc3dbb7703dbe29a2f4c627b", "score": "0.39580932", "text": "func (service *ClusterService) GetMemberWithEdgeKeySet() *agent.ClusterMember {\n\tmembers := service.Members()\n\tfor _, member := range members {\n\t\tif member.EdgeKeySet {\n\t\t\treturn &member\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8e5062cdc132cd0520f124181812e6ee", "score": "0.395671", "text": "func (s *SecureChannel) getTokenId() int32 {\n\treturn s.tokenId.Load()\n}", "title": "" }, { "docid": "fd98bd31c4f417a572ca76780ae4d80c", "score": "0.39520904", "text": "func (v *ScanRequest) GetToken() (o string) {\n\tif v.Token != nil {\n\t\treturn *v.Token\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2af5aa88b9b4a60f27d6c478cabe07b9", "score": "0.39497915", "text": "func (p *AdaptiveNetworkHardeningsClientEnforcePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "f9dd70fd4e60ef6ae488ec5f28112cee", "score": "0.39493203", "text": "func ExamplePeeringsClient_CreateOrUpdate() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armpeering.NewPeeringsClient(\"subId\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.CreateOrUpdate(ctx,\n\t\t\"rgName\",\n\t\t\"peeringName\",\n\t\tarmpeering.Peering{\n\t\t\tKind: to.Ptr(armpeering.KindDirect),\n\t\t\tLocation: to.Ptr(\"eastus\"),\n\t\t\tProperties: &armpeering.Properties{\n\t\t\t\tDirect: &armpeering.PropertiesDirect{\n\t\t\t\t\tConnections: []*armpeering.DirectConnection{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tBandwidthInMbps: to.Ptr[int32](10000),\n\t\t\t\t\t\t\tBgpSession: &armpeering.BgpSession{\n\t\t\t\t\t\t\t\tMaxPrefixesAdvertisedV4: to.Ptr[int32](1000),\n\t\t\t\t\t\t\t\tMaxPrefixesAdvertisedV6: to.Ptr[int32](100),\n\t\t\t\t\t\t\t\tMD5AuthenticationKey: to.Ptr(\"test-md5-auth-key\"),\n\t\t\t\t\t\t\t\tSessionPrefixV4: to.Ptr(\"192.168.0.0/31\"),\n\t\t\t\t\t\t\t\tSessionPrefixV6: to.Ptr(\"fd00::0/127\"),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tConnectionIdentifier: to.Ptr(\"5F4CB5C7-6B43-4444-9338-9ABC72606C16\"),\n\t\t\t\t\t\t\tPeeringDBFacilityID: to.Ptr[int32](99999),\n\t\t\t\t\t\t\tSessionAddressProvider: to.Ptr(armpeering.SessionAddressProviderPeer),\n\t\t\t\t\t\t\tUseForPeeringService: to.Ptr(false),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tBandwidthInMbps: to.Ptr[int32](10000),\n\t\t\t\t\t\t\tConnectionIdentifier: to.Ptr(\"8AB00818-D533-4504-A25A-03A17F61201C\"),\n\t\t\t\t\t\t\tPeeringDBFacilityID: to.Ptr[int32](99999),\n\t\t\t\t\t\t\tSessionAddressProvider: to.Ptr(armpeering.SessionAddressProviderMicrosoft),\n\t\t\t\t\t\t\tUseForPeeringService: to.Ptr(true),\n\t\t\t\t\t\t}},\n\t\t\t\t\tDirectPeeringType: to.Ptr(armpeering.DirectPeeringTypeEdge),\n\t\t\t\t\tPeerAsn: &armpeering.SubResource{\n\t\t\t\t\t\tID: to.Ptr(\"/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tPeeringLocation: to.Ptr(\"peeringLocation0\"),\n\t\t\t},\n\t\t\tSKU: &armpeering.SKU{\n\t\t\t\tName: to.Ptr(\"Basic_Direct_Free\"),\n\t\t\t},\n\t\t},\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "title": "" }, { "docid": "1cf7819e548e16bfbecee17ca1e45af0", "score": "0.3948801", "text": "func getOrCreateChainKey(sessionState *record.State, theirEphemeral ecc.ECPublicKeyable) (*chain.Key, error) {\n\n\t// If our session state already has a receiver chain, use their\n\t// ephemeral key in the existing chain.\n\tif sessionState.HasReceiverChain(theirEphemeral) {\n\t\treturn sessionState.ReceiverChainKey(theirEphemeral), nil\n\t}\n\n\t// If we don't have a chain key, create one with ephemeral keys.\n\trootKey := sessionState.RootKey()\n\tourEphemeral := sessionState.SenderRatchetKeyPair()\n\treceiverChain, rErr := rootKey.CreateChain(theirEphemeral, ourEphemeral)\n\tif rErr != nil {\n\t\treturn nil, rErr\n\t}\n\n\t// Generate a new ephemeral key pair.\n\tourNewEphemeral, gErr := ecc.GenerateKeyPair()\n\tif gErr != nil {\n\t\treturn nil, gErr\n\t}\n\n\t// Create a new chain using our new ephemeral key.\n\tsenderChain, cErr := receiverChain.RootKey.CreateChain(theirEphemeral, ourNewEphemeral)\n\tif cErr != nil {\n\t\treturn nil, cErr\n\t}\n\n\t// Set our session state parameters.\n\tsessionState.SetRootKey(senderChain.RootKey)\n\tsessionState.AddReceiverChain(theirEphemeral, receiverChain.ChainKey)\n\tpreviousCounter := max(sessionState.SenderChainKey().Index()-1, 0)\n\tsessionState.SetPreviousCounter(previousCounter)\n\tsessionState.SetSenderChain(ourNewEphemeral, senderChain.ChainKey)\n\n\treturn receiverChain.ChainKey.(*chain.Key), nil\n}", "title": "" }, { "docid": "d6d357e47c8a03938198610f89f890b0", "score": "0.39441368", "text": "func (v *SearchRequest) GetToken() (o string) {\n\tif v.Token != nil {\n\t\treturn *v.Token\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0bb2a6868a4fb2b5e8c653524a3f2935", "score": "0.3938549", "text": "func GetToken(endpoint, id, secret string) string {\n app := MakeApplication(endpoint, id, secret)\n return GetOAuthResponse(app).Access_token\n}", "title": "" }, { "docid": "0f2a499502fd0bac642ed12f4efe55b7", "score": "0.39350772", "text": "func (_TokenLockup *TokenLockupSession) GetStakerStruct(_staker common.Address, _id *big.Int) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, bool, error) {\n\treturn _TokenLockup.Contract.GetStakerStruct(&_TokenLockup.CallOpts, _staker, _id)\n}", "title": "" }, { "docid": "e3ffd339c7e703b4be8ca34b13858352", "score": "0.3931777", "text": "func (p *PrivateZonesCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "269cbcc79541d8cddba6305ddfd1fc33", "score": "0.39308432", "text": "func (p *GatewaysClientCreateOrUpdatePoller) ResumeToken() (string, error) {\n\treturn p.pt.ResumeToken()\n}", "title": "" }, { "docid": "4ec2252fd7372e337c1aab4b685391a9", "score": "0.39304927", "text": "func GetVethPair(name1 string, name2 string) (link1 netlink.Link,\n\tlink2 netlink.Link, err error) {\n\tlink1, err = makeVethPair(name1, name2, 1500)\n\tif err != nil {\n\t\tswitch {\n\t\tcase os.IsExist(err):\n\t\t\terr = fmt.Errorf(\n\t\t\t\t\"container veth name provided (%v) \"+\n\t\t\t\t\t\"already exists\", name1)\n\t\t\treturn\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"failed to make veth pair: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif link2, err = netlink.LinkByName(name2); err != nil {\n\t\terr = fmt.Errorf(\"failed to lookup %q: %v\", name2, err)\n\t}\n\n\treturn\n}", "title": "" } ]
686a7eefac0100d0d0bedb56326f3461
SetUsername gets a reference to the given string and assigns it to the Username field.
[ { "docid": "b9ad9ed3758f17ccfd80252b1d92b00e", "score": "0.5864984", "text": "func (o *UserCore) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" } ]
[ { "docid": "a7ff6143f8d098f25f08c52e9857458e", "score": "0.737033", "text": "func (k Keeper) SetUsername(ctx sdk.Context, address sdk.AccAddress, username string) error {\n\tstore := ctx.KVStore(k.storeKey)\n\n\tif address.Empty() {\n\t\treturn types.ErrInvalidAddress\n\t}\n\n\tif !types.CheckUsername(username) {\n\t\treturn types.ErrInvalidUsername\n\t}\n\n\tstore.Set(types.GetUsernameKey(address), []byte(username))\n\n\treturn nil\n}", "title": "" }, { "docid": "b7658d916f971c01653df82410b1412d", "score": "0.72526026", "text": "func (session *Session) SetUsername(str string) error {\r\n\tsession.login.setUsername(str)\r\n\treturn nil\r\n}", "title": "" }, { "docid": "e5560455d8c66d80da2a5055ef28ed0a", "score": "0.72274053", "text": "func (recv *MountOperation) SetUsername(username string) {\n\tc_username := C.CString(username)\n\tdefer C.free(unsafe.Pointer(c_username))\n\n\tC.g_mount_operation_set_username((*C.GMountOperation)(recv.native), c_username)\n\n\treturn\n}", "title": "" }, { "docid": "883566a738ee0bbb40cf2fb12736be21", "score": "0.70715636", "text": "func (u *URI) SetUsername(username string) {\n\tu.username = append(u.username[:0], username...)\n}", "title": "" }, { "docid": "6f66dcf4d716fc6421cc61bae7abcc33", "score": "0.68375814", "text": "func (this *ConnectMessage) SetUsername(v []byte) {\n\tthis.username = v\n\n\tif len(v) > 0 {\n\t\tthis.SetUsernameFlag(true)\n\t} else {\n\t\tthis.SetUsernameFlag(false)\n\t}\n\n\tthis.dirty = true\n}", "title": "" }, { "docid": "8e20edb4135818bdd0bc9275c8b1ec25", "score": "0.6789135", "text": "func (rds *AmazonRDS) SetUsername(newUsername string) {\n\trds.username = newUsername\n}", "title": "" }, { "docid": "34f501d64831593cc0f14567b0a6d6e4", "score": "0.6754105", "text": "func (a *LocalKeyAgent) UpdateUsername(username string) {\n\ta.username = username\n}", "title": "" }, { "docid": "c13ea940f7d3e35fb942ef4b44a39066", "score": "0.66095185", "text": "func (o *MQTTPOSTBody) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "1e63cef94e2e405e4ad754f6531047cf", "score": "0.6565538", "text": "func (o *ThingCreateResponseCredentialsMqttData) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "ea77b4a5b6e42fcac9c0c74a08cb529e", "score": "0.6553372", "text": "func (s *AdminListUserAuthEventsInput) SetUsername(v string) *AdminListUserAuthEventsInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "6a72b232476d3777353347e6fe6b02dc", "score": "0.6548662", "text": "func (o *UpdateMonitorRequestPatchHttpConfigurationDigestAuth) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "bb19c029ce288ede079c47a7f5a230d6", "score": "0.65272963", "text": "func CmdSetUsername() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"set-username [name]\",\n\t\tShort: \"Set a new username\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx := client.GetClientContextFromCmd(cmd)\n\t\t\tclientCtx, err := client.ReadTxCommandFlags(clientCtx, cmd.Flags())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmsg, err := types.NewMsgSetUsername(clientCtx.GetFromAddress(), args[0])\n\t\t\tif err := msg.ValidateBasic(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)\n\t\t},\n\t}\n\n\tflags.AddTxFlagsToCmd(cmd)\n\n\treturn cmd\n}", "title": "" }, { "docid": "7e78d8e3c5b95457d64ae5645f8c866b", "score": "0.651228", "text": "func (s *AdminUpdateAuthEventFeedbackInput) SetUsername(v string) *AdminUpdateAuthEventFeedbackInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "2fb091d3975abe194e021b2659e53e8f", "score": "0.6456515", "text": "func (s *UpdateAuthEventFeedbackInput) SetUsername(v string) *UpdateAuthEventFeedbackInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "acf39abce863caf37602723553440be5", "score": "0.64337295", "text": "func (o *GetPasswordParams) SetUsername(username *string) {\n\to.Username = username\n}", "title": "" }, { "docid": "c5b3b1521118d1e02ce53a1662613bfe", "score": "0.6426833", "text": "func (s *AdminSetUserMFAPreferenceInput) SetUsername(v string) *AdminSetUserMFAPreferenceInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "fdee2cedf1016245d07cd0d2bf5f3e94", "score": "0.64237607", "text": "func (s *ConfirmForgotPasswordInput) SetUsername(v string) *ConfirmForgotPasswordInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "cdf4a5ad70832081e7f2f2f4a18c6bdc", "score": "0.64219326", "text": "func (s *ForgotPasswordInput) SetUsername(v string) *ForgotPasswordInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "ec18eb9270eb853dd4427933e3dda32f", "score": "0.6412841", "text": "func (o *StandardAccountCreateSpec) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "5c46d6d0fc11d36c4fa0dbc36e975579", "score": "0.63642967", "text": "func (o *ApplianceDeviceClaim) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "2ef60cddd8b8fabd3ae37c832ce3719b", "score": "0.6363599", "text": "func (s *AdminResetUserPasswordInput) SetUsername(v string) *AdminResetUserPasswordInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "981c7c3423b1c435d96ccaae2ce21a61", "score": "0.6356574", "text": "func (o *PrincipalOut) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "7f7fc5454d743d262c78334201f5edeb", "score": "0.6348688", "text": "func (s *AdminConfirmSignUpInput) SetUsername(v string) *AdminConfirmSignUpInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "50a00bc258103961ef162894c7af5ea1", "score": "0.63232046", "text": "func (m *WindowsDeviceADAccount) SetUserName(value *string)() {\n m.userName = value\n}", "title": "" }, { "docid": "6c60895bd1712770e4363cfd2746d7b8", "score": "0.63184774", "text": "func (s *AdminUserGlobalSignOutInput) SetUsername(v string) *AdminUserGlobalSignOutInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "6b94531d3561f66b83d765bbe875c75b", "score": "0.6274661", "text": "func (s *AdminAddUserToGroupInput) SetUsername(v string) *AdminAddUserToGroupInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "3bb0f756f3ad36b04b797916088f2b7c", "score": "0.62695074", "text": "func (s *AdminUpdateDeviceStatusInput) SetUsername(v string) *AdminUpdateDeviceStatusInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "f085a5017cc5b6682e946392136661f2", "score": "0.6253643", "text": "func (o *ServiceNowNotificationConfig) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "6433cee62da4c00882fd5642d65de491", "score": "0.6250049", "text": "func (s *AdminGetDeviceInput) SetUsername(v string) *AdminGetDeviceInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "8781fc26b7021312ef36e3344acb15b8", "score": "0.6249595", "text": "func (o *LoginSpec) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "6645c2282986440c97687bfca7ae0bc8", "score": "0.62460583", "text": "func (s *AdminSetUserSettingsInput) SetUsername(v string) *AdminSetUserSettingsInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "8f7565103f34148862feacffe69232f5", "score": "0.62345284", "text": "func (t *JiraUser) SetUsername(v string) {\n\tt.Username = v\n}", "title": "" }, { "docid": "f334f8851264295fe956511dbc350242", "score": "0.62291604", "text": "func (o *UserAdminResponse) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "d3c0016b52326757f4480e87b8ef778e", "score": "0.6225948", "text": "func (s *AdminUpdateUserAttributesInput) SetUsername(v string) *AdminUpdateUserAttributesInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "96dc5519dff20c14c036d97d0b27056b", "score": "0.62226903", "text": "func (o *AddUserRequest) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "eabadd13363158f462638362d2675c19", "score": "0.621598", "text": "func (o *SetPreferredEmailParams) SetUsername(username string) {\n\to.Username = username\n}", "title": "" }, { "docid": "8fe09eb6153d3cbafcabe19f3c26e4e4", "score": "0.62149364", "text": "func (s *AdminRemoveUserFromGroupInput) SetUsername(v string) *AdminRemoveUserFromGroupInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "ccc8e2e9d856a3eca4d18271e4d78f4f", "score": "0.6214078", "text": "func (u *URI) SetUsernameBytes(username []byte) {\n\tu.username = append(u.username[:0], username...)\n}", "title": "" }, { "docid": "bafd8f311e7dbaca4df2dd257e9fc453", "score": "0.62066025", "text": "func (s *ConfirmSignUpInput) SetUsername(v string) *ConfirmSignUpInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "34e10559226e7166fd15753642cb1a4d", "score": "0.61909306", "text": "func (s *AdminDeleteUserAttributesInput) SetUsername(v string) *AdminDeleteUserAttributesInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "804ca58382061176b4a808b1b337f12a", "score": "0.6185732", "text": "func (s *AdminForgetDeviceInput) SetUsername(v string) *AdminForgetDeviceInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "f20a67e6351618125e70a2921adc7d8e", "score": "0.6156851", "text": "func (s *SignUpInput) SetUsername(v string) *SignUpInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "174f4a55fc26ce7ba14dbb9cd8ce1259", "score": "0.6144083", "text": "func (s *AdminDeleteUserInput) SetUsername(v string) *AdminDeleteUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "d167643ac9e62ef76add2e02fdb9c2c3", "score": "0.6133116", "text": "func (s *ResendConfirmationCodeInput) SetUsername(v string) *ResendConfirmationCodeInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "731309cd8e482c6a75d9f48593981d0c", "score": "0.6111589", "text": "func (o *AnsibleTowerNotificationConfigAllOf) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "f8cd4aad9147306f439063defa766fd6", "score": "0.61107624", "text": "func (state *UserState) SetUsernameCookie(w http.ResponseWriter, username string) error {\n\tif username == \"\" {\n\t\treturn errors.New(\"Can't set cookie for empty username\")\n\t}\n\tif !state.HasUser(username) {\n\t\treturn errors.New(\"Can't store cookie for non-existsing user\")\n\t}\n\t// Create a cookie that lasts for a while (\"timeout\" seconds),\n\t// this is the equivivalent of a session for a given username.\n\tSetSecureCookiePath(w, \"user\", username, state.cookieTime, \"/\", state.cookieSecret)\n\treturn nil\n}", "title": "" }, { "docid": "11e0488166a984f7cf7df39f8dc2bad4", "score": "0.60991365", "text": "func (s *AdminCreateUserInput) SetUsername(v string) *AdminCreateUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "4002e6d64f98c4463a10f48633775c76", "score": "0.6067711", "text": "func (s *RedshiftDestinationDescription) SetUsername(v string) *RedshiftDestinationDescription {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "bf5515d171b6a615a04d2114708b1882", "score": "0.6062086", "text": "func (o *ConnectUserRequest) SetUsername(v string) {\n\to.Username = v\n}", "title": "" }, { "docid": "85fbcdaadd71a1761e6dd9b0a0804633", "score": "0.60580134", "text": "func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {\n\tr0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)\n\tm.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "2ed9b71a5020c61273eaf3e11343a79a", "score": "0.6054139", "text": "func (s *AdminListGroupsForUserInput) SetUsername(v string) *AdminListGroupsForUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "5df61ee3c14ab3eb985221aed93e192c", "score": "0.6046358", "text": "func (s *AdminDisableUserInput) SetUsername(v string) *AdminDisableUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "193644963980387fd3b5ad378d35bd0a", "score": "0.6042579", "text": "func (c Config) Username(username string) Config {\n\tc.username = username\n\treturn c\n}", "title": "" }, { "docid": "f007a0314f1c9ae867dc670f2f409568", "score": "0.6041542", "text": "func (s *AdminEnableUserInput) SetUsername(v string) *AdminEnableUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "0dcc082e23f8612505919747b047a927", "score": "0.6040278", "text": "func (s *AdminSetUserPasswordInput) SetUsername(v string) *AdminSetUserPasswordInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "5991e986aece9ec05e457507be74aa34", "score": "0.60385793", "text": "func (s *AdminGetUserInput) SetUsername(v string) *AdminGetUserInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "28b189d157a16de8fc5dab987fe80a42", "score": "0.60327196", "text": "func (connBuilder *ConnectionBuilder) Username(username string) *ConnectionBuilder {\n\t// If already has errors, just return\n\tif connBuilder.err != nil {\n\t\treturn connBuilder\n\t}\n\n\tconnBuilder.conn.username = username\n\treturn connBuilder\n}", "title": "" }, { "docid": "d8cbace04e8b7f60400d98a0d30d26e6", "score": "0.6030943", "text": "func (m *DeviceComplianceSettingState) SetUserName(value *string)() {\n m.userName = value\n}", "title": "" }, { "docid": "7826ad45760ac24e3956d11129cfa2fc", "score": "0.60283595", "text": "func (o *OrgIsPublicMemberParams) SetUsername(username string) {\n\to.Username = username\n}", "title": "" }, { "docid": "e4643c5c7de5bd4afd516419a8d07c7b", "score": "0.60268384", "text": "func (v *Client) StreamingSetUsername(stream string) error {\n\tparams := make(map[string]string)\n\tparams[\"Value\"] = stream\n\treturn v.SendFunction(\"StreamingSetUsername\", params)\n}", "title": "" }, { "docid": "42164446e5e47edc9e485eddda4a1d37", "score": "0.6016576", "text": "func (thisFactory *Factory) SetAlternateUsername(alternateUsername string) error {\n\tif alternateUsername != \"\" {\n\t\tthisFactory.alternates[\"username\"] = strings.ToLower(alternateUsername)\n\t\tthisFactory.Log.Trace().Str(\"username\", thisFactory.alternates[\"username\"]).Msg(\"Alternate set.\")\n\t\treturn nil\n\t} else {\n\t\tthisFactory.Log.Error().Msg(ERR_ALTERNATE_USERNAME_CANNOT_BE_BLANK)\n\t\treturn errors.New(ERR_ALTERNATE_USERNAME_CANNOT_BE_BLANK)\n\t}\n}", "title": "" }, { "docid": "0713143a9c59fee627d75d50a49da8fd", "score": "0.6016299", "text": "func SetUser(ctx context.Context, username string) context.Context{\n\treturn context.WithValue(ctx, ContextUsernameKey, username)\n}", "title": "" }, { "docid": "bf4f3e53b23daf11abb83c90945edbe4", "score": "0.5993252", "text": "func (us *UserStorage) ResetUsername(id, username string) error {\n\thexID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), us.timeout)\n\tdefer cancel()\n\n\tupdate := bson.M{\"$set\": bson.M{\"username\": username}}\n\topts := options.FindOneAndUpdate().SetReturnDocument(options.After)\n\n\tvar ud userData\n\terr = us.coll.FindOneAndUpdate(ctx, bson.M{\"_id\": hexID}, update, opts).Decode(&ud)\n\treturn err\n}", "title": "" }, { "docid": "ff8f86130be67771f80a8dd1f7e65040", "score": "0.5989711", "text": "func (this *EntryView) WriteUsername(username string) error {\n if this.getUser().Can(\"w\", this) {\n data, err := this.getUser().Encrypt([]byte(username))\n if err != nil {\n return err\n }\n this.Username = data\n return nil\n }\n return NewError(\"Username write permission denied\", this.getUser())\n}", "title": "" }, { "docid": "a98cd90920cf1b9b13f5bb54330677bd", "score": "0.59487647", "text": "func (s *AdminListDevicesInput) SetUsername(v string) *AdminListDevicesInput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "caee5a349938300ed578d1163ac85fc7", "score": "0.59463596", "text": "func (m *UserMutation) SetUsername(s string) {\n\tm.username = &s\n}", "title": "" }, { "docid": "caee5a349938300ed578d1163ac85fc7", "score": "0.59463596", "text": "func (m *UserMutation) SetUsername(s string) {\n\tm.username = &s\n}", "title": "" }, { "docid": "caee5a349938300ed578d1163ac85fc7", "score": "0.59463596", "text": "func (m *UserMutation) SetUsername(s string) {\n\tm.username = &s\n}", "title": "" }, { "docid": "caee5a349938300ed578d1163ac85fc7", "score": "0.59463596", "text": "func (m *UserMutation) SetUsername(s string) {\n\tm.username = &s\n}", "title": "" }, { "docid": "caee5a349938300ed578d1163ac85fc7", "score": "0.59463596", "text": "func (m *UserMutation) SetUsername(s string) {\n\tm.username = &s\n}", "title": "" }, { "docid": "089fe2697f55b2aed2c06e06f6aa77b4", "score": "0.59146506", "text": "func SetFederationUsername(w http.ResponseWriter, r *http.Request) {\n\tif !requirePOST(w, r) {\n\t\treturn\n\t}\n\n\tconfigValue, success := getValueFromRequest(w, r)\n\tif !success {\n\t\treturn\n\t}\n\n\tif err := data.SetFederationUsername(configValue.Value.(string)); err != nil {\n\t\tcontrollers.WriteSimpleResponse(w, false, err.Error())\n\t\treturn\n\t}\n\n\tcontrollers.WriteSimpleResponse(w, true, \"username saved\")\n}", "title": "" }, { "docid": "21637e99c14786ed3b526be7e3f3d9ba", "score": "0.5912313", "text": "func (o *ApplianceRemoteFileImport) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "35bed065164daf1b392c01acc36c917d", "score": "0.5896879", "text": "func (s *RedshiftDestinationUpdate) SetUsername(v string) *RedshiftDestinationUpdate {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "0562d2b307e6151c6ec50d45ec273ee9", "score": "0.58935034", "text": "func (_m *MockInterface) SetUsername(u string) *VSlack {\n\tret := _m.Called(u)\n\n\tvar r0 *VSlack\n\tif rf, ok := ret.Get(0).(func(string) *VSlack); ok {\n\t\tr0 = rf(u)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*VSlack)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "e2d4bcb7f0a52cf7054b9a8b59139301", "score": "0.5892723", "text": "func (this *ConnectMessage) SetUsernameFlag(v bool) {\n\tif v {\n\t\tthis.connectFlags |= 128 // 10000000\n\t} else {\n\t\tthis.connectFlags &= 127 // 01111111\n\t}\n\n\tthis.dirty = true\n}", "title": "" }, { "docid": "c1052e319ec5e11e8de48c2befe2f1af", "score": "0.58903867", "text": "func (s *RedshiftDestinationConfiguration) SetUsername(v string) *RedshiftDestinationConfiguration {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "5bd5ec9390a8ecb4bfe4b0e3ad6d707a", "score": "0.58812267", "text": "func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne {\n\tuuo.username = &s\n\treturn uuo\n}", "title": "" }, { "docid": "f354fe5e4fc7b27099793fc2104f925f", "score": "0.5877184", "text": "func (s *AdminGetUserOutput) SetUsername(v string) *AdminGetUserOutput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "bcaa75a037eafcd8994949259ffabdc8", "score": "0.58500564", "text": "func (s *Socket) SetPlainUsername(value string) error {\n\treturn s.SetSockOptString(PLAIN_USERNAME, value)\n}", "title": "" }, { "docid": "c9f740dda2b93801198e8d2088dfe2f6", "score": "0.56953055", "text": "func Username(v string) predicate.User {\n\treturn predicate.User(sql.FieldEQ(FieldUsername, v))\n}", "title": "" }, { "docid": "1ef5e9db9e6718ccfe2050a28458ad49", "score": "0.56869733", "text": "func (o *JiraNotificationConfigAllOf) SetUsername(v string) {\n\to.Username = &v\n}", "title": "" }, { "docid": "0ab80741f2638b7001448a3c962cbe31", "score": "0.56845844", "text": "func (s *GetUserOutput) SetUsername(v string) *GetUserOutput {\n\ts.Username = &v\n\treturn s\n}", "title": "" }, { "docid": "f6e7cc410387aec0a2ec8089411262e6", "score": "0.5672923", "text": "func (o GoogleCloudDialogflowCxV3beta1WebhookGenericWebServiceOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3beta1WebhookGenericWebService) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3fc73cf1087728493d230e666915a08f", "score": "0.56689745", "text": "func (n *NodeManager) RecordUsername(username string, node OsqueryNode) error {\n\tif username == \"\" {\n\t\treturn nil\n\t}\n\tif !n.SeenUsername(node.UUID, username) {\n\t\te := NodeHistoryUsername{\n\t\t\tUUID: node.UUID,\n\t\t\tUsername: username,\n\t\t\tCount: 1,\n\t\t}\n\t\tif err := n.NewHistoryUsername(e); err != nil {\n\t\t\treturn fmt.Errorf(\"newNodeHistoryUsername %v\", err)\n\t\t}\n\t} else {\n\t\tif err := n.IncHistoryUsername(node.UUID, username); err != nil {\n\t\t\treturn fmt.Errorf(\"newNodeHistoryUsername %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c7f76a6cfc8b20cc8266bb3807a598d", "score": "0.5657868", "text": "func (o SlotSiteCredentialOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SlotSiteCredential) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ef4c57fc72c4053da8d64965ddc88633", "score": "0.5651777", "text": "func (m *UserInstallStateSummary) SetUserName(value *string)() {\n err := m.GetBackingStore().Set(\"userName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1132dbbc17b67b8f614ae9d02c32b244", "score": "0.56434834", "text": "func (auth *Mock) Username(request *http.Request) string {\n\treturn \"lyonj4\"\n}", "title": "" }, { "docid": "70020dd1c59bac8c43169241f5257be5", "score": "0.5636654", "text": "func (o AppServiceSiteCredentialOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AppServiceSiteCredential) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9418b8397ad7d11b56fd3e38180b0a49", "score": "0.5607802", "text": "func (uu *UserUpdate) SetUsername(s string) *UserUpdate {\n\tuu.username = &s\n\treturn uu\n}", "title": "" }, { "docid": "09039a01c49509c0c94db4c49204e3b1", "score": "0.5585319", "text": "func SetAuthUsername(key, value string) error {\n\treturn os.Setenv(key, value)\n}", "title": "" }, { "docid": "ece012c30e1ec5227e047d073be3e28d", "score": "0.5571402", "text": "func (o ProviderOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ece012c30e1ec5227e047d073be3e28d", "score": "0.5571402", "text": "func (o ProviderOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "08d27b9af6462472768e5695c56ca7d3", "score": "0.55644804", "text": "func (o StackScriptOutput) Username() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StackScript) pulumi.StringOutput { return v.Username }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9a53e81cc81926e501ce53b4ec748d5a", "score": "0.5560531", "text": "func (o SourceRepresentationInstanceOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SourceRepresentationInstance) pulumi.StringPtrOutput { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "73b28c47be523f6ab9f1e677dac369cb", "score": "0.5552636", "text": "func (o GoogleCloudDialogflowCxV3beta1WebhookGenericWebServiceResponseOutput) Username() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3beta1WebhookGenericWebServiceResponse) string { return v.Username }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0e9ac1d0d58e2feb2280d631609ef18b", "score": "0.55509186", "text": "func (o InputSourceOutput) Username() pulumi.StringOutput {\n\treturn o.ApplyT(func(v InputSource) string { return v.Username }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7689e18de234304e78e73b57176aa345", "score": "0.55483055", "text": "func Username(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUsername), v))\n\t})\n}", "title": "" }, { "docid": "623131fe5b7705d06c7db1fda1d87775", "score": "0.552897", "text": "func (o FunctionAppSiteCredentialOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FunctionAppSiteCredential) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8e7b74987c9207baccf3d627bbd2ad88", "score": "0.55228966", "text": "func (u *URL) Username() string {\n\treturn u.User.Username()\n}", "title": "" }, { "docid": "9485fad92919949d33f93cea8300c512", "score": "0.55010206", "text": "func (o FunctionAppSlotSiteCredentialOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FunctionAppSlotSiteCredential) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
1b7ab37b89388d09c9f6c4809f6e0446
GetAppVersionPackageFiles mocks base method.
[ { "docid": "cf9a4cd36d89a88db3a8d49f55846c77", "score": "0.7440733", "text": "func (m *MockClient) GetAppVersionPackageFiles(ctx context.Context, in *pb.GetAppVersionPackageFilesRequest, opts ...grpc.CallOption) (*pb.GetAppVersionPackageFilesResponse, 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, \"GetAppVersionPackageFiles\", varargs...)\n\tret0, _ := ret[0].(*pb.GetAppVersionPackageFilesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "18f8fac1a8da3e50a77806dcbe5285be", "score": "0.6487865", "text": "func GetMockAppVersionList() []models.Version {\n\tversions := []models.Version{\n\t\tmodels.Version{\n\t\t\tID: \"55ebd387-9c68-4137-a367-a12025cc2cdb\",\n\t\t\tVersion: \"1.0\",\n\t\t\tAppID: \"com.aerogear.mobile_app_one\",\n\t\t\tDisabledMessage: \"Please contact an administrator\",\n\t\t\tDisabled: false,\n\t\t\tNumOfCurrentInstalls: 1,\n\t\t\tNumOfAppLaunches: 2,\n\t\t},\n\t\tmodels.Version{\n\t\t\tID: \"59ebd387-9c68-4137-a367-a12025cc1cdb\",\n\t\t\tVersion: \"1.1\",\n\t\t\tAppID: \"com.aerogear.mobile_app_one\",\n\t\t\tDisabled: false,\n\t\t\tNumOfCurrentInstalls: 0,\n\t\t\tNumOfAppLaunches: 0,\n\t\t},\n\t\tmodels.Version{\n\t\t\tID: \"59dbd387-9c68-4137-a367-a12025cc2cdb\",\n\t\t\tVersion: \"1.0\",\n\t\t\tAppID: \"com.aerogear.mobile_app_two\",\n\t\t\tDisabled: false,\n\t\t\tNumOfCurrentInstalls: 0,\n\t\t\tNumOfAppLaunches: 0,\n\t\t},\n\t}\n\n\treturn versions\n}", "title": "" }, { "docid": "b244a2084f29fcb789fd73fca6402b11", "score": "0.59366643", "text": "func (a *Client) GetAppVersionPackageFiles(params *GetAppVersionPackageFilesParams) (*GetAppVersionPackageFilesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAppVersionPackageFilesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetAppVersionPackageFiles\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/app_version/package/files\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetAppVersionPackageFilesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetAppVersionPackageFilesOK), nil\n\n}", "title": "" }, { "docid": "04eff7def3db22ad322bc94b6830c357", "score": "0.5923572", "text": "func TestGetFileVersions(t *testing.T) {\n testpath, _ := createTestParamValue(\"GetFileVersions\", \"path\", \"string\").(string)\n teststorageName, _ := createTestParamValue(\"GetFileVersions\", \"storageName\", \"string\").(string)\n e := InitializeTest(\"GetFileVersions\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.GetFileVersions(testpath, teststorageName)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "dec9f83b74f50b452dd23553d0f58251", "score": "0.5754429", "text": "func (mr *MockClientMockRecorder) GetAppVersionPackageFiles(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, \"GetAppVersionPackageFiles\", reflect.TypeOf((*MockClient)(nil).GetAppVersionPackageFiles), varargs...)\n}", "title": "" }, { "docid": "d2036d4c305540bdafa9b24bdd002dc3", "score": "0.55624974", "text": "func TestGetFilesList(t *testing.T) {\n testpath, _ := createTestParamValue(\"GetFilesList\", \"path\", \"string\").(string)\n teststorageName, _ := createTestParamValue(\"GetFilesList\", \"storageName\", \"string\").(string)\n e := InitializeTest(\"GetFilesList\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n _, _, e = c.SlidesApi.GetFilesList(testpath, teststorageName)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n}", "title": "" }, { "docid": "856a5ba8b61a86416faa21fad9a7be5a", "score": "0.55609393", "text": "func (m *MockClient) GetAppVersionPackage(ctx context.Context, in *pb.GetAppVersionPackageRequest, opts ...grpc.CallOption) (*pb.GetAppVersionPackageResponse, 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, \"GetAppVersionPackage\", varargs...)\n\tret0, _ := ret[0].(*pb.GetAppVersionPackageResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7bf6d4c0060c011d41a5e376ee73f7e2", "score": "0.55349845", "text": "func ListPackageVersions(ctx context.Context, basePath string) []string {\n\tfilesOnFs, err := filepath.Glob(path.Join(basePath, \"*\"))\n\tutil.Check(err)\n\n\tfilteredFilesOnFs := make([]string, 0)\n\n\t// filter out package.json\n\tfor _, file := range filesOnFs {\n\t\tif !strings.HasSuffix(file, \".donotoptimizepng\") && !strings.HasSuffix(file, \"package.json\") && strings.Trim(file, \" \") != \"\" {\n\t\t\tfilteredFilesOnFs = append(filteredFilesOnFs, file)\n\t\t}\n\t}\n\n\t// no local version, no need to check what's in git\n\tif len(filteredFilesOnFs) == 0 {\n\t\treturn make([]string, 0)\n\t}\n\n\targs := []string{\n\t\t\"ls-tree\", \"--name-only\", \"origin/master\",\n\t}\n\targs = append(args, filteredFilesOnFs...)\n\n\tcmd := exec.Command(\"git\", args...)\n\tcmd.Dir = basePath\n\tlog.Printf(\"run %s from %s\\n\", cmd, basePath)\n\tout := util.CheckCmd(cmd.CombinedOutput())\n\n\toutFiles := strings.Split(out, \"\\n\")\n\n\tfilteredOutFiles := make([]string, 0)\n\t// remove basePath from the output\n\tfor _, v := range outFiles {\n\t\tif strings.Trim(v, \" \") != \"\" {\n\t\t\tfilteredOutFiles = append(\n\t\t\t\tfilteredOutFiles, strings.ReplaceAll(v, basePath+\"/\", \"\"))\n\t\t}\n\t}\n\n\tif util.IsDebug() {\n\t\tdiff := arrDiff(filteredFilesOnFs, outFiles)\n\t\tif len(diff) > 0 {\n\t\t\tutil.Printf(ctx, \"found %d staged versions\\n\", len(diff))\n\t\t}\n\t}\n\n\treturn filteredOutFiles\n}", "title": "" }, { "docid": "2df11d32065c37e394043bba2665873b", "score": "0.54512745", "text": "func TestBootstrapFiles(t *testing.T) {\n\tfor _, location := range []string{rhelLocation, centosLocation} {\n\t\t_, err := manifests.Asset(location)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error getting asset at: %s\", location)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "39264f96ef93492fc1e9c53b8e26e320", "score": "0.5450831", "text": "func TestGetFilesJSON(t *testing.T) {\n\tlog.Println(\"TestGetFilesJSON()\")\n\n\t// Generate mock fileRecord\n\tfile := fileRecord{\n\t\tInfoHash: \"deadbeef\",\n\t\tVerified: true,\n\t}\n\n\t// Save mock file\n\tif !file.Save() {\n\t\tt.Fatalf(\"Failed to save mock file\")\n\t}\n\n\t// Load mock file to fetch ID\n\tfile = file.Load(file.InfoHash, \"info_hash\")\n\tif file == (fileRecord{}) {\n\t\tt.Fatalf(\"Failed to load mock file\")\n\t}\n\n\t// Request output JSON from API for this file\n\tvar file2 fileRecord\n\terr := json.Unmarshal(getFilesJSON(file.ID), &file2)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to unmarshal result JSON for single file\")\n\t}\n\n\t// Verify objects are the same\n\tif file.ID != file2.ID {\n\t\tt.Fatalf(\"ID, expected %d, got %d\", file.ID, file2.ID)\n\t}\n\n\t// Request output JSON from API for all files\n\tvar allFiles []fileRecord\n\terr = json.Unmarshal(getFilesJSON(-1), &allFiles)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to unmarshal result JSON for all files\")\n\t}\n\n\t// Verify known file is in result set\n\tfound := false\n\tfor _, f := range allFiles {\n\t\tif f.ID == file.ID {\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\tt.Fatalf(\"Expected file not found in all files result set\")\n\t}\n\n\t// Delete mock file\n\tif !file.Delete() {\n\t\tt.Fatalf(\"Failed to delete mock file\")\n\t}\n}", "title": "" }, { "docid": "b4788d1ef0de2eed990631171ec0c60c", "score": "0.5427221", "text": "func (m *MockInstanceServer) GetInstanceTemplateFiles(instanceName string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInstanceTemplateFiles\", instanceName)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0b309aeea96dd1a1eefd0a38230bb976", "score": "0.53307015", "text": "func getTestFiles() ([]string, error) {\n\tfil, err := os.Open(\"test\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to open test folder: %s\", err)\n\t}\n\tdefer fil.Close()\n\n\tvar info []os.FileInfo\n\tresult := make([]string, 0)\n\n\tinfo, err = fil.Readdir(256)\n\n\tfor err == nil {\n\t\tfor i := range info {\n\t\t\tname := info[i].Name()\n\t\t\tif strings.HasSuffix(name, \".babel\") {\n\t\t\t\tresult = append(result, filepath.Join(\"test\", name))\n\t\t\t}\n\t\t}\n\t\tinfo, err = fil.Readdir(256)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "1eeeca25d4eb022f743f9791e326fcf4", "score": "0.5306078", "text": "func (m *ManifestLocator) GetPackageVersions(packageName string) []*PackageVersion {\n\tsearchPath := m.GetManifestSearchPath()\n\n\tversions := make([]*PackageVersion, 0)\n\n\tfor _, path := range searchPath {\n\t\tpackagePath := path + \"/\" + packageName\n\n\t\tinfo, err := ioutil.ReadDir(packagePath)\n\t\tif err != nil {\n\t\t\tlog.Debug(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, version := range info {\n\t\t\tif string(version.Name()[0]) == \".\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tversions = append(versions,\n\t\t\t\tNewPackageVersion(packageName, version.Name(), path))\n\t\t}\n\t}\n\treturn versions\n}", "title": "" }, { "docid": "20f1c5d986453dfaf081a196f5cb86e4", "score": "0.52972186", "text": "func (m *MockClient) BusinessReviewAppVersion(ctx context.Context, in *pb.ReviewAppVersionRequest, opts ...grpc.CallOption) (*pb.ReviewAppVersionResponse, 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, \"BusinessReviewAppVersion\", varargs...)\n\tret0, _ := ret[0].(*pb.ReviewAppVersionResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1e39966ba8074ff241e9ad959ef5e1ee", "score": "0.5218346", "text": "func appFiles(ctxt *build.Context) ([]string, error) {\n\tpkg, err := ctxt.ImportDir(\".\", 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !pkg.IsCommand() {\n\t\treturn nil, fmt.Errorf(`the root of your app needs to be package \"main\" (currently %q). Please see https://cloud.google.com/appengine/docs/flexible/go/ for more details on structuring your app.`, pkg.Name)\n\t}\n\tvar appFiles []string\n\tfor _, f := range pkg.GoFiles {\n\t\tn := filepath.Join(\".\", f)\n\t\tappFiles = append(appFiles, n)\n\t}\n\treturn appFiles, nil\n}", "title": "" }, { "docid": "a8abdaf15d3c4510f115391af707a1c8", "score": "0.5199343", "text": "func (m *MockWalhallAPIer) GetConfigsForModuleVersionInEnv(env walhallapi.Environment, mv walhallapi.ModuleVersion) ([]walhallapi.Config, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetConfigsForModuleVersionInEnv\", env, mv)\n\tret0, _ := ret[0].([]walhallapi.Config)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f5fb04fbbcbb3036ff383fa45ab50198", "score": "0.51929384", "text": "func testFilesImportTheirOwnPackage(packagePath string) bool {\n\tmeta, err := build.ImportDir(packagePath, build.AllowBinary)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tfor _, dependency := range meta.TestImports {\n\t\tif dependency == meta.ImportPath {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0d69353362fed6637fed3a618f56cbfa", "score": "0.5175894", "text": "func GetImportFiles(packageName string, database string) (files []*loader.File, err error) {\n\n\t// Get package list\n\tvar packageList loader.PackageList\n\tlistBytes, err := GetStructBytes(packageName, database)\n\tif err != nil {\n\t\treturn files, err\n\t}\n\tpackageList.UnmarshalBinary(listBytes)\n\n\tfor _, packageString := range packageList.Packages {\n\n\t\t// Get package struct\n\t\tvar packageStruct loader.Package\n\t\tpackageBytes, err := GetStructBytes(packageString, database)\n\t\tif err != nil {\n\t\t\treturn files, err\n\t\t}\n\t\tpackageStruct.UnmarshalBinary(packageBytes)\n\n\t\tfor _, fileString := range packageStruct.Files {\n\n\t\t\t// Get file struct\n\t\t\tvar fileStruct loader.File\n\t\t\tfileBytes, err := GetStructBytes(fileString, database)\n\t\t\tif err != nil {\n\t\t\t\treturn files, err\n\t\t\t}\n\t\t\tfileStruct.UnmarshalBinary(fileBytes)\n\n\t\t\t// Add file struct to array\n\t\t\tfiles = append(files, &fileStruct)\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "6a12ba7371fe21097aafea3bae646e5b", "score": "0.51568913", "text": "func (_m *Repos) GetFiles(ctx context.Context, repoURL string, revision string, pattern string) (map[string][]byte, error) {\n\tret := _m.Called(ctx, repoURL, revision, pattern)\n\n\tvar r0 map[string][]byte\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string) (map[string][]byte, error)); ok {\n\t\treturn rf(ctx, repoURL, revision, pattern)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string) map[string][]byte); ok {\n\t\tr0 = rf(ctx, repoURL, revision, pattern)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(map[string][]byte)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok {\n\t\tr1 = rf(ctx, repoURL, revision, pattern)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "4702e8e255e7560e62ba699c059a3585", "score": "0.5126455", "text": "func (mock *DatasetClientMock) GetVersionCalls() []struct {\n\tCtx context.Context\n\tUserAuthToken string\n\tServiceAuthToken string\n\tDownloadServiceAuthToken string\n\tCollectionID string\n\tDatasetID string\n\tEdition string\n\tVersion string\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t\tUserAuthToken string\n\t\tServiceAuthToken string\n\t\tDownloadServiceAuthToken string\n\t\tCollectionID string\n\t\tDatasetID string\n\t\tEdition string\n\t\tVersion string\n\t}\n\tmock.lockGetVersion.RLock()\n\tcalls = mock.calls.GetVersion\n\tmock.lockGetVersion.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ed44143dc5c1e859757fe459f12a8bd7", "score": "0.5121359", "text": "func (m *MockVirtualMachineExtensionImagesClientAPI) ListVersions(ctx context.Context, location, publisherName, typeParameter, filter string, top *int32, orderby string) (compute.ListVirtualMachineExtensionImage, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListVersions\", ctx, location, publisherName, typeParameter, filter, top, orderby)\n\tret0, _ := ret[0].(compute.ListVirtualMachineExtensionImage)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ffa199024a43bd497e36c11c32dc3c4e", "score": "0.5094799", "text": "func (m *Mockcmd) ExtraFiles(arg0 []*os.File) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"ExtraFiles\", arg0)\n}", "title": "" }, { "docid": "6c43d1f703880147d82ff7a98779a081", "score": "0.509449", "text": "func GetMockAppList() []models.App {\n\tapps := []models.App{\n\t\tmodels.App{\n\t\t\tID: \"7f89ce49-a736-459e-9110-e52d049fc025\",\n\t\t\tAppID: \"com.aerogear.mobile_app_one\",\n\t\t\tAppName: \"Mobile App One\",\n\t\t},\n\t\tmodels.App{\n\t\t\tID: \"7f89ce49-a736-459e-9110-e52d049fc026\",\n\t\t\tAppID: \"com.aerogear.mobile_app_three\",\n\t\t\tAppName: \"Mobile App Two\",\n\t\t},\n\t\tmodels.App{\n\t\t\tID: \"7f89ce49-a736-459e-9110-e52d049fc027\",\n\t\t\tAppID: \"com.aerogear.mobile_app_three\",\n\t\t\tAppName: \"Mobile App Three\",\n\t\t},\n\t}\n\treturn apps\n}", "title": "" }, { "docid": "aebabf1ad7f1061be0546b746f20ce39", "score": "0.5076647", "text": "func TestPackages(t *testing.T) {\n\tt.Parallel()\n\n\tfor _, testPkg := range testPackages {\n\t\t// Check that we can create a new Package with this import path.\n\t\tp, err := pkg.New(testPkg.importPath)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that the package name is correct. The package name is the last member in the import path.\n\t\tmembers := strings.Split(testPkg.name, \"/\")\n\t\twant := members[len(members)-1]\n\t\thave := p.Name()\n\t\tif want != have {\n\t\t\tt.Errorf(\"%s: incorrect package name\", testPkg.name)\n\t\t\tt.Log(\"\\twant:\", want)\n\t\t\tt.Log(\"\\thave:\", have)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that the package's import path is correct.\n\t\twant = testPkg.importPath\n\t\thave = p.ImportPath()\n\t\tif want != have {\n\t\t\tt.Errorf(\"%s: incorrect package import path\", testPkg.name)\n\t\t\tt.Log(\"\\twant:\", want)\n\t\t\tt.Log(\"\\thave:\", have)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that the general package overview comments are correct.\n\t\twant = testPkg.comments\n\t\thave = p.Comments(99999)\n\t\tif want != have {\n\t\t\tt.Errorf(\"%s: incorrect package comments\", testPkg.importPath)\n\t\t\tt.Log(\"\\twant:\\n\", want)\n\t\t\tt.Log(\"\\thave:\\n\", have)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct source files in the package's directory and that\n\t\t// everything is returned in order with no duplicates.\n\t\twantList := testPkg.files\n\t\thaveList := p.Files()\n\t\tif err := cmpStringLists(wantList, haveList); err != nil {\n\t\t\tt.Errorf(\"%s: source files: %s\", testPkg.importPath, err.Error())\n\t\t\tt.Log(\"\\twant:\\n\", wantList)\n\t\t\tt.Log(\"\\thave:\\n\", haveList)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct test files in the package's directory and that\n\t\t// everything is returned in order with no duplicates.\n\t\twantList = testPkg.testFiles\n\t\thaveList = p.TestFiles()\n\t\tif err := cmpStringLists(wantList, haveList); err != nil {\n\t\t\tt.Errorf(\"%s: test files: %s\", testPkg.importPath, err.Error())\n\t\t\tt.Log(\"\\twant:\\n\", wantList)\n\t\t\tt.Log(\"\\thave:\\n\", haveList)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct subdirectories in the package's directory and that\n\t\t// everything is returned in order with no duplicates.\n\t\twantList = testPkg.subdirectories\n\t\thaveList = p.Subdirectories()\n\t\tif err := cmpStringLists(wantList, haveList); err != nil {\n\t\t\tt.Errorf(\"%s: subdirectories: %s\", testPkg.importPath, err.Error())\n\t\t\tt.Log(\"\\twant:\\n\", wantList)\n\t\t\tt.Log(\"\\thave:\\n\", haveList)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct imports in the source files and that everything is\n\t\t// returned in order with no duplicates.\n\t\twantList = testPkg.imports\n\t\thaveList = p.Imports()\n\t\tif err := cmpStringLists(wantList, haveList); err != nil {\n\t\t\tt.Errorf(\"%s: source imports: %s\", testPkg.importPath, err.Error())\n\t\t\tt.Log(\"\\twant:\\n\", wantList)\n\t\t\tt.Log(\"\\thave:\\n\", haveList)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct imports in the test files and that everything is\n\t\t// returned in order with no duplicates.\n\t\twantList = testPkg.testImports\n\t\thaveList = p.TestImports()\n\t\tif err := cmpStringLists(wantList, haveList); err != nil {\n\t\t\tt.Errorf(\"%s: test imports: %s\", testPkg.importPath, err.Error())\n\t\t\tt.Log(\"\\twant:\\n\", wantList)\n\t\t\tt.Log(\"\\thave:\\n\", haveList)\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct blocks of exported constants in the source files.\n\t\tif err := cmpConstantBlockLists(testPkg.constantBlocks, p.ConstantBlocks()); err != nil {\n\t\t\tt.Errorf(\"%s: constant blocks: %s\", testPkg.importPath, err.Error())\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct blocks of exported variables and errors in the source files.\n\t\tif err := cmpVariableBlockLists(testPkg.variableBlocks, p.VariableBlocks()); err != nil {\n\t\t\tt.Errorf(\"%s: variable blocks: %s\", testPkg.importPath, err.Error())\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct functions in the source files and that everything is\n\t\t// returned in order with no duplicates.\n\t\tif err := cmpFunctionLists(testPkg.functions, p.Functions()); err != nil {\n\t\t\tt.Errorf(\"%s: functions: %s\", testPkg.importPath, err.Error())\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that pkg found the correct types in the source files and that everything is\n\t\t// returned in order with no duplicates.\n\t\tif err := cmpTypeLists(testPkg.types, p.Types()); err != nil {\n\t\t\tt.Errorf(\"%s: types: %s\", testPkg.importPath, err.Error())\n\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1afd6958aa4ae7e1a6bbd960ed83cd3f", "score": "0.5031045", "text": "func (m *MockWalhallAPIer) ListApps(orgName string) (map[string]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListApps\", orgName)\n\tret0, _ := ret[0].(map[string]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b0d55aac642e00aee3e1b1d87efd1e12", "score": "0.5030382", "text": "func (m *MockSync) SyncApps(infos []v1.AppInfo) (map[string]v1.Application, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SyncApps\", infos)\n\tret0, _ := ret[0].(map[string]v1.Application)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0a87461a4f132b5c18bb4b792ddb2295", "score": "0.5028745", "text": "func (m *MockInstanceServer) GetContainerTemplateFiles(containerName string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetContainerTemplateFiles\", containerName)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5898e8b8956e64d838dfb6fda2de69ba", "score": "0.5018011", "text": "func TestVmoduleGlob(t *testing.T) {\n\tfor glob, match := range vGlobs {\n\t\ttestVmoduleGlob(glob, match, t)\n\t}\n}", "title": "" }, { "docid": "62c193063ce3420d877e3b070ea08767", "score": "0.5017849", "text": "func (m *MockCSIProxyUtils) GetAPIVersions(arg0 context.Context) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAPIVersions\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "30e0130b05ad872713bacd7a03d06cea", "score": "0.49933475", "text": "func (mock *ServiceMock) UpdateAppVersionsCalls() []struct {\n\tID string\n\tVersions []models.Version\n} {\n\tvar calls []struct {\n\t\tID string\n\t\tVersions []models.Version\n\t}\n\tlockServiceMockUpdateAppVersions.RLock()\n\tcalls = mock.calls.UpdateAppVersions\n\tlockServiceMockUpdateAppVersions.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "10591a19a48271892d0c2db759f57545", "score": "0.4983172", "text": "func (_m *IReposGetter) Apps() ([]interfaces.Pkg, error) {\n\tret := _m.Called()\n\n\tvar r0 []interfaces.Pkg\n\tif rf, ok := ret.Get(0).(func() []interfaces.Pkg); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]interfaces.Pkg)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3ba44c74d441edcd77e5e4249c4a03c9", "score": "0.49768758", "text": "func (m *MockClient) BusinessPassAppVersion(ctx context.Context, in *pb.PassAppVersionRequest, opts ...grpc.CallOption) (*pb.PassAppVersionResponse, 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, \"BusinessPassAppVersion\", varargs...)\n\tret0, _ := ret[0].(*pb.PassAppVersionResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5524b5ead1c5474f60ab5967a3184183", "score": "0.49733165", "text": "func TestFindFiles(t *testing.T) {\n\tdir := []string{testdata2}\n\tfiles, err := findFiles(dir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfileSet := sliceToSet(files)\n\tif len(fileSet) != 2 {\n\t\tt.Fatalf(\"found %v files instead of 2\", len(fileSet))\n\t}\n\tfile1 := filepath.Join(testdata2, \"inter-diff\")\n\tfile2 := filepath.Join(testdata2, \"inter-same\")\n\tfor _, file := range []string{file1, file2} {\n\t\tif !fileSet[file] {\n\t\t\tt.Errorf(\"%v not found in %v\", file1, fileSet)\n\t\t}\n\t}\n\n\t_, err = findFiles([]string{\"bogus path\"})\n\tif err == nil {\n\t\tt.Fatal(\"error expected\")\n\t}\n}", "title": "" }, { "docid": "9fa6caa69491117eacc14bd5a0e2f1d1", "score": "0.4970326", "text": "func (m *HandlerMock) listPackages(connection net.Conn) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"listPackages\", connection)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "81108f0aba1175d93a1c1f8c5762a3d2", "score": "0.49610588", "text": "func allVendoredPackages(vendorDir string) (map[string]struct{}, error) {\n\tvendorDirAbsPath := vendorDir\n\tif !filepath.IsAbs(vendorDir) {\n\t\twd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to determine working directory\")\n\t\t}\n\t\tvendorDirAbsPath = path.Join(wd, vendorDir)\n\t}\n\n\tif path.Base(vendorDirAbsPath) != \"vendor\" {\n\t\treturn nil, errors.Errorf(\"provided path must be a directory named 'vendor', was %s\", vendorDirAbsPath)\n\t}\n\tif fi, err := os.Stat(vendorDirAbsPath); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to stat %s\", vendorDirAbsPath)\n\t} else if !fi.IsDir() {\n\t\treturn nil, errors.Errorf(\"path %s is not a directory\", vendorDirAbsPath)\n\t}\n\n\tpkgImportPaths := make(map[string]struct{})\n\tif err := filepath.Walk(vendorDirAbsPath, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tbuildPkgs, err := getPkgsInDir(\".\", path, make(map[string]struct{}))\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get packages in directory %s\", path)\n\t\t}\n\n\t\tdirContainsPkg := false\n\t\tfor _, pkg := range buildPkgs {\n\t\t\tif pkg.Name != \"\" {\n\t\t\t\tdirContainsPkg = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// latter can happen in directories like \"testdata\"\n\t\tif !dirContainsPkg || buildPkgs[0].ImportPath == \".\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tpkgImportPaths[buildPkgs[0].ImportPath] = struct{}{}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to walk directory\")\n\t}\n\treturn pkgImportPaths, nil\n}", "title": "" }, { "docid": "9d7f27106af11d1bbce446050ffa2e77", "score": "0.49472985", "text": "func xTestGetGSResultFileLocations(t *testing.T) {\n\ttestutils.SkipIfShort(t)\n\tstorage, err := storage.New(http.DefaultClient)\n\tassert.Nil(t, err)\n\n\tstartTS := time.Date(2014, time.December, 10, 0, 0, 0, 0, time.UTC).Unix()\n\tendTS := time.Date(2014, time.December, 10, 23, 59, 59, 0, time.UTC).Unix()\n\n\t// TODO(stephana): Switch this to a dedicated test bucket, so we are not\n\t// in danger of removing it.\n\tresultFiles, err := getGSResultsFileLocations(startTS, endTS, storage, \"chromium-skia-gm\", \"dm-json-v1\")\n\tassert.Nil(t, err)\n\n\t// Read the expected list of files and compare them.\n\tcontent, err := ioutil.ReadFile(\"./testdata/filelist_dec_10.txt\")\n\tassert.Nil(t, err)\n\tlines := strings.Split(strings.TrimSpace(string(content)), \"\\n\")\n\tsort.Strings(lines)\n\n\tresultNames := make([]string, len(resultFiles))\n\tfor idx, rf := range resultFiles {\n\t\tresultNames[idx] = rf.Name\n\t}\n\tsort.Strings(resultNames)\n\tassert.Equal(t, len(lines), len(resultNames))\n\tassert.Equal(t, lines, resultNames)\n}", "title": "" }, { "docid": "dfe21f9c9d956eef14d961894a208c11", "score": "0.49302432", "text": "func (m *MockClient) DescribeAppVersions(ctx context.Context, in *pb.DescribeAppVersionsRequest, opts ...grpc.CallOption) (*pb.DescribeAppVersionsResponse, 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, \"DescribeAppVersions\", varargs...)\n\tret0, _ := ret[0].(*pb.DescribeAppVersionsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7752068da632a13543329a305c8949ed", "score": "0.49273026", "text": "func (m *MockworkspaceService) ReadAddonsFile(appName, fileName string) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReadAddonsFile\", appName, fileName)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4f2850197e1e1c84b0287e6daf91e17f", "score": "0.49088535", "text": "func (m *MockInstanceServer) GetInstanceLogfiles(name string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetInstanceLogfiles\", name)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0bf480718a21045dcaf0defdd62b4962", "score": "0.4908031", "text": "func TestPackage(cfg *Config) {\n\tp, err := cfg.Package()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpkgPath := filepath.Join(filepath.Dir(cfg.ManifestPath), \"package\")\n\tif err := os.MkdirAll(filepath.Join(pkgPath, \"meta\"), os.ModePerm); err != nil {\n\t\tpanic(err)\n\t}\n\tpkgJSON := filepath.Join(pkgPath, \"meta\", \"package\")\n\tb, err := json.Marshal(&p)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := os.WriteFile(pkgJSON, b, os.ModePerm); err != nil {\n\t\tpanic(err)\n\t}\n\n\tmfst, err := os.Create(cfg.ManifestPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif _, err := fmt.Fprintf(mfst, \"meta/package=%s\\n\", pkgJSON); err != nil {\n\t\tpanic(err)\n\t}\n\t// Add additional test directory and file under meta/ for pkgfs meta/ tests.\n\tif _, err := fmt.Fprintf(mfst, \"meta/foo/one=%s\\n\", pkgJSON); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, name := range TestFiles {\n\t\tpath := filepath.Join(pkgPath, name)\n\n\t\terr = os.MkdirAll(filepath.Dir(path), os.ModePerm)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tf, err := os.Create(path)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif strings.HasPrefix(name, \"rand\") {\n\t\t\t_, err = io.Copy(f, io.LimitReader(rand.Reader, 100))\n\t\t} else {\n\t\t\t_, err = fmt.Fprintf(f, \"%s\\n\", name)\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\terr = f.Close()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif _, err := fmt.Fprintf(mfst, \"%s=%s\\n\", name, path); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tif err := mfst.Close(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "855d9cd251c6b1333783e8d72e7763b8", "score": "0.49058425", "text": "func (m *MockGitilesServer) ListFiles(arg0 context.Context, arg1 *gitiles.ListFilesRequest) (*gitiles.ListFilesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListFiles\", arg0, arg1)\n\tret0, _ := ret[0].(*gitiles.ListFilesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c55c62a85f372744097bf16ec4dd29a8", "score": "0.49057758", "text": "func (m *MockPackageScanner) Version() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Version\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "3165e47c8d497ed98cbb34483384bd8e", "score": "0.4900044", "text": "func (m *MockStore) PackagesByLayer(arg0 context.Context, arg1 string, arg2 VersionedScanners) ([]*claircore.Package, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PackagesByLayer\", arg0, arg1, arg2)\n\tret0, _ := ret[0].([]*claircore.Package)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "81032d6674a527674adcccb1d4cb0459", "score": "0.48980328", "text": "func TestArrays(t *testing.T) {\n\tfor _, json := range jsonPackages {\n\t\tt.Run(path.Join(\"Unmarshal/TooFew\", json.Version), func(t *testing.T) {\n\t\t\tvar got [2]int\n\t\t\terr := json.Unmarshal([]byte(`[1]`), &got)\n\t\t\tswitch {\n\t\t\tcase got != [2]int{1, 0}:\n\t\t\t\tt.Fatalf(`json.Unmarshal = %v, want [1 0]`, got)\n\t\t\tcase json.Version == \"v1\" && err != nil:\n\t\t\t\tt.Fatalf(\"json.Unmarshal error: %v\", err)\n\t\t\tcase json.Version == \"v2\" && err == nil:\n\t\t\t\tt.Fatal(\"json.Unmarshal error is nil, want non-nil\")\n\t\t\t}\n\t\t})\n\t}\n\n\tfor _, json := range jsonPackages {\n\t\tt.Run(path.Join(\"Unmarshal/TooMany\", json.Version), func(t *testing.T) {\n\t\t\tvar got [2]int\n\t\t\terr := json.Unmarshal([]byte(`[1,2,3]`), &got)\n\t\t\tswitch {\n\t\t\tcase got != [2]int{1, 2}:\n\t\t\t\tt.Fatalf(`json.Unmarshal = %v, want [1 2]`, got)\n\t\t\tcase json.Version == \"v1\" && err != nil:\n\t\t\t\tt.Fatalf(\"json.Unmarshal error: %v\", err)\n\t\t\tcase json.Version == \"v2\" && err == nil:\n\t\t\t\tt.Fatal(\"json.Unmarshal error is nil, want non-nil\")\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "93d672d7d6fec5c74cd3ca2283039afa", "score": "0.4882739", "text": "func TestGetImportPath(t *testing.T) {\n\tfor _, tt := range getImportPathTests {\n\t\timp, err := getImportPath(tt.ctx, tt.cwd, tt.path)\n\t\tif err != tt.err {\n\t\t\tt.Errorf(\"got %v, expected %v\", err, tt.err)\n\t\t}\n\t\tif imp != tt.imp {\n\t\t\tt.Errorf(\"got %v, expected %v\", imp, tt.imp)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eaf3504b4ad257a926b58cbb284aa0a3", "score": "0.4881619", "text": "func getMockApp(t *testing.T, numGenAccs int) (*mock.App, Keeper, stake.Keeper, []sdk.AccAddress, []crypto.PubKey, []crypto.PrivKey) {\n\n\tkeyStake := sdk.NewKVStoreKey(\"stake\")\n\tkeyGov := sdk.NewKVStoreKey(\"gov\")\n\n\tmapp, k, sk := CreateMockApp(numGenAccs, keyStake, keyGov)\n\trequire.NoError(t, mapp.CompleteSetup([]*sdk.KVStoreKey{keyStake, keyGov}))\n\n\tmapp.SetEndBlocker(NewEndBlocker(k))\n\tmapp.SetInitChainer(getInitChainer(mapp, k, sk))\n\n\tgenAccs, addrs, pubKeys, privKeys := mock.CreateGenAccounts(numGenAccs, sdk.Coins{sdk.NewCoin(\"steak\", 42)})\n\tmock.SetGenesis(mapp, genAccs)\n\n\treturn mapp, k, sk, addrs, pubKeys, privKeys\n}", "title": "" }, { "docid": "9a4ec50057500a25b677afb5a322e166", "score": "0.48813853", "text": "func (m *MockGitilesClient) ListFiles(ctx context.Context, in *gitiles.ListFilesRequest, opts ...grpc.CallOption) (*gitiles.ListFilesResponse, 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, \"ListFiles\", varargs...)\n\tret0, _ := ret[0].(*gitiles.ListFilesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "97d502ebdfb1edccb5c67fb57663dba1", "score": "0.48713928", "text": "func (mock *ServiceMock) GetAppsCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockServiceMockGetApps.RLock()\n\tcalls = mock.calls.GetApps\n\tlockServiceMockGetApps.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "694cbb8b402eb689108b8ac8cb4fd232", "score": "0.48677114", "text": "func checkAppFiles(t *testing.T, h ssh.Host, appLayer string) (string, error) {\n\tswitch appLayer {\n\tcase \"host\":\n\t\tpolkadotCustomCliArgs := fmt.Sprintf(\"grep CLOUDSTAKING-TEST /etc/default/polkadot\")\n\t\t_, err := ssh.CheckSshCommandE(t, h, polkadotCustomCliArgs)\n\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"It looks like %s doesn't have doesn't have the right content '%w'\", polkadotCustomCliArgs, err)\n\t\t}\n\n\t\tt.Logf(\"Validator has %s installed\", polkadotCustomCliArgs)\n\tcase \"docker\":\n\t\tappFilesExistCmd := fmt.Sprintf(\"ls /home/polkadot/docker-compose.yml /home/polkadot/nginx.conf\")\n\t\t_, err := ssh.CheckSshCommandE(t, h, appFilesExistCmd)\n\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Files /home/polkadot/docker-compose.yml and /home/polkadot/nginx.conf doesn't exist: '%w'\", err)\n\t\t}\n\n\t\tt.Log(\"Validator has /home/polkadot/{docker-compose.yml,nginx.conf} files\")\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "c55a3cc3c252fe09018448f3827e12a9", "score": "0.48635778", "text": "func (_m *GatewayAPIClient) ListFileVersions(ctx context.Context, in *providerv1beta1.ListFileVersionsRequest, opts ...grpc.CallOption) (*providerv1beta1.ListFileVersionsResponse, error) {\n\t_va := make([]interface{}, len(opts))\n\tfor _i := range opts {\n\t\t_va[_i] = opts[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, ctx, in)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *providerv1beta1.ListFileVersionsResponse\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListFileVersionsRequest, ...grpc.CallOption) (*providerv1beta1.ListFileVersionsResponse, error)); ok {\n\t\treturn rf(ctx, in, opts...)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListFileVersionsRequest, ...grpc.CallOption) *providerv1beta1.ListFileVersionsResponse); ok {\n\t\tr0 = rf(ctx, in, opts...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*providerv1beta1.ListFileVersionsResponse)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ListFileVersionsRequest, ...grpc.CallOption) error); ok {\n\t\tr1 = rf(ctx, in, opts...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "0a3527354e91cf353fa5537c8c4a5ba4", "score": "0.48591265", "text": "func (_m *DBHandler) GetFiles(ctx context.Context, query map[string]interface{}) ([]models.FileResponse, error) {\n\tret := _m.Called(ctx, query)\n\n\tvar r0 []models.FileResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) []models.FileResponse); ok {\n\t\tr0 = rf(ctx, query)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]models.FileResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, map[string]interface{}) error); ok {\n\t\tr1 = rf(ctx, query)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "e7ae1a085a910b2e55885d7d56687994", "score": "0.48539254", "text": "func (m *MockqueueTask) GetVersion() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetVersion\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "title": "" }, { "docid": "dd6cdcf583c1e9a3c3a38a2dcc534b93", "score": "0.4852724", "text": "func (m *MockAppsService) AppsList() ([]*go_scalingo.App, error) {\n\tret := m.ctrl.Call(m, \"AppsList\")\n\tret0, _ := ret[0].([]*go_scalingo.App)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9004e072bf4f3a73bcdbaa6f840977fb", "score": "0.4851666", "text": "func (suite *BaseHandlerTestSuite) TestFilesToClose() []*runtime.File {\n\treturn suite.filesToClose\n}", "title": "" }, { "docid": "e1ac55e3c271e46de35c871f7ba3cab2", "score": "0.48236758", "text": "func (_m *FileManager) GetFileContent() ([]bucket.Bundle, error) {\n\tret := _m.Called()\n\n\tvar r0 []bucket.Bundle\n\tif rf, ok := ret.Get(0).(func() []bucket.Bundle); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]bucket.Bundle)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3eb62865b4431b4a6618b2947462686f", "score": "0.48175502", "text": "func checkBundleFiles(t *testing.T, bundle *bundle.Bundle, prefix string, expectFiles []string, empty bool) {\n\tif got, want := len(bundle.Files), len(expectFiles); got != want {\n\t\tt.Errorf(\"Expected %d files in bundle, got %d\", want, got)\n\t\tprintBundleFiles(t, bundle)\n\t\tprintExpectFiles(t, expectFiles)\n\t\treturn\n\t}\n\tfor i, file := range bundle.Files {\n\t\tif got, want := file.Name, expectFiles[i]; got != want {\n\t\t\tt.Errorf(\"Bundle file mismatch at position %d: expected %s, got %s\", i, want, got)\n\t\t\tprintBundleFiles(t, bundle)\n\t\t\tprintExpectFiles(t, expectFiles)\n\t\t\treturn\n\t\t}\n\t\tif empty {\n\t\t\tif len(file.Body) > 0 {\n\t\t\t\tt.Errorf(\"Expected bundle file %s to be empty\", file.Name)\n\t\t\t}\n\t\t} else {\n\t\t\texpectFileDesc, ok := testFiles[filepath.Join(prefix, expectFiles[i])]\n\t\t\tif !ok {\n\t\t\t\tt.Fatalf(\"Unknown expected bundle file %s for prefix %s\", expectFiles[i], prefix)\n\t\t\t} else if got, want := file.Body, expectFileDesc.getContents(t, true); got != want {\n\t\t\t\tt.Errorf(\"Expected bundle file %s contents %q, got %q\", want, got)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "44acccd278897c8b24a369a0903bb6d4", "score": "0.48169163", "text": "func (s *VersionConnectorSuite) TestGetVersionsAndVariants() {\n\ts.NoError(db.ClearCollections(model.ProjectRefCollection))\n\n\tprojRef := model.ProjectRef{\n\t\tId: \"proj\",\n\t}\n\ts.NoError(projRef.Insert())\n\tproj := model.Project{\n\t\tIdentifier: projRef.Id,\n\t\tBuildVariants: model.BuildVariants{\n\t\t\t{\n\t\t\t\tName: \"bv1\",\n\t\t\t\tDisplayName: \"bv1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tName: \"bv2\",\n\t\t\t\tDisplayName: \"bv2\",\n\t\t\t},\n\t\t},\n\t}\n\tv1 := model.Version{\n\t\tId: \"v1\",\n\t\tRevision: \"abcd1\",\n\t\tRevisionOrderNumber: 1,\n\t\tIdentifier: proj.Identifier,\n\t\tStatus: evergreen.VersionFailed,\n\t\tRequester: evergreen.RepotrackerVersionRequester,\n\t\tMessage: \"I am v1\",\n\t}\n\tv2 := model.Version{\n\t\tId: \"v2\",\n\t\tRevision: \"abcd2\",\n\t\tRevisionOrderNumber: 2,\n\t\tIdentifier: proj.Identifier,\n\t\tStatus: evergreen.VersionCreated,\n\t\tRequester: evergreen.RepotrackerVersionRequester,\n\t\tMessage: \"I am v2\",\n\t}\n\ts.NoError(v2.Insert())\n\ts.NoError(v1.Insert())\n\tb11 := build.Build{\n\t\tId: \"b11\",\n\t\tActivated: true,\n\t\tVersion: v1.Id,\n\t\tProject: proj.Identifier,\n\t\tRevision: v1.Revision,\n\t\tBuildVariant: \"bv1\",\n\t\tTasks: []build.TaskCache{\n\t\t\t{Id: \"t111\"},\n\t\t\t{Id: \"t112\"},\n\t\t},\n\t}\n\ts.NoError(b11.Insert())\n\tb12 := build.Build{\n\t\tId: \"b12\",\n\t\tActivated: true,\n\t\tVersion: v1.Id,\n\t\tProject: proj.Identifier,\n\t\tRevision: v1.Revision,\n\t\tBuildVariant: \"bv2\",\n\t\tTasks: []build.TaskCache{\n\t\t\t{Id: \"t121\"},\n\t\t\t{Id: \"t122\"},\n\t\t},\n\t}\n\ts.NoError(b12.Insert())\n\tb21 := build.Build{\n\t\tId: \"b21\",\n\t\tVersion: v2.Id,\n\t\tProject: proj.Identifier,\n\t\tRevision: v2.Revision,\n\t\tBuildVariant: \"bv1\",\n\t\tTasks: []build.TaskCache{\n\t\t\t{Id: \"t211\"},\n\t\t\t{Id: \"t212\"},\n\t\t},\n\t}\n\ts.NoError(b21.Insert())\n\tb22 := build.Build{\n\t\tId: \"b22\",\n\t\tVersion: v2.Id,\n\t\tProject: proj.Identifier,\n\t\tRevision: v2.Revision,\n\t\tBuildVariant: \"bv2\",\n\t\tTasks: []build.TaskCache{\n\t\t\t{Id: \"t221\"},\n\t\t\t{Id: \"t222\"},\n\t\t},\n\t}\n\ts.NoError(b22.Insert())\n\ttasks := []task.Task{\n\t\t{\n\t\t\tId: \"t111\",\n\t\t\tVersion: v1.Id,\n\t\t\tActivated: true,\n\t\t\tStatus: evergreen.TaskFailed,\n\t\t\tDetails: apimodels.TaskEndDetail{\n\t\t\t\tStatus: evergreen.TaskFailed,\n\t\t\t\tType: evergreen.CommandTypeSystem,\n\t\t\t\tTimedOut: true,\n\t\t\t\tDescription: evergreen.TaskDescriptionHeartbeat,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tId: \"t112\",\n\t\t\tVersion: v1.Id,\n\t\t\tActivated: true,\n\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\tDetails: apimodels.TaskEndDetail{\n\t\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\t\tType: \"test\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tId: \"t121\",\n\t\t\tVersion: v1.Id,\n\t\t\tActivated: true,\n\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\tDetails: apimodels.TaskEndDetail{\n\t\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\t\tType: \"test\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tId: \"t122\",\n\t\t\tVersion: v1.Id,\n\t\t\tActivated: true,\n\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\tDetails: apimodels.TaskEndDetail{\n\t\t\t\tStatus: evergreen.TaskSucceeded,\n\t\t\t\tType: \"test\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tId: \"t211\",\n\t\t\tVersion: v2.Id,\n\t\t\tStatus: evergreen.TaskUnscheduled,\n\t\t},\n\t\t{\n\t\t\tId: \"t212\",\n\t\t\tVersion: v2.Id,\n\t\t\tStatus: evergreen.TaskUnscheduled,\n\t\t},\n\t\t{\n\t\t\tId: \"t221\",\n\t\t\tVersion: v2.Id,\n\t\t\tStatus: evergreen.TaskUnscheduled,\n\t\t},\n\t\t{\n\t\t\tId: \"t222\",\n\t\t\tVersion: v2.Id,\n\t\t\tStatus: evergreen.TaskUnscheduled,\n\t\t},\n\t}\n\tfor _, t := range tasks {\n\t\ts.NoError(t.Insert())\n\t}\n\tresults, err := GetVersionsAndVariants(0, 10, &proj)\n\ts.NoError(err)\n\n\tbv1 := results.Rows[\"bv1\"]\n\ts.Equal(\"bv1\", bv1.BuildVariant)\n\tresultb11 := bv1.Builds[\"v1\"]\n\ts.EqualValues(utility.ToStringPtr(\"b11\"), resultb11.Id)\n\ts.Len(resultb11.Tasks, 2)\n\ts.Equal(1, resultb11.StatusCounts.Succeeded)\n\ts.Equal(1, resultb11.StatusCounts.TimedOut)\n\n\tbv2 := results.Rows[\"bv2\"]\n\ts.Equal(\"bv2\", bv2.BuildVariant)\n\tresultb12 := bv2.Builds[\"v1\"]\n\ts.EqualValues(utility.ToStringPtr(\"b12\"), resultb12.Id)\n\ts.Len(resultb12.Tasks, 2)\n\ts.Equal(2, resultb12.StatusCounts.Succeeded)\n\n\tinactiveVersions := results.Versions[0]\n\ts.True(inactiveVersions.RolledUp)\n\ts.EqualValues(utility.ToStringPtr(\"v2\"), inactiveVersions.Versions[0].Id)\n\ts.EqualValues(utility.ToStringPtr(\"I am v2\"), inactiveVersions.Versions[0].Message)\n\n\tactiveVersions := results.Versions[1]\n\ts.False(activeVersions.RolledUp)\n\ts.EqualValues(utility.ToStringPtr(\"v1\"), activeVersions.Versions[0].Id)\n\ts.EqualValues(utility.ToStringPtr(\"I am v1\"), activeVersions.Versions[0].Message)\n}", "title": "" }, { "docid": "594d5fd656ac3b4c8c709adb0dc80af4", "score": "0.48000002", "text": "func filterAndExtractFileInfo(pkg Package, files []os.FileInfo, isFull bool) []FSFile {\n\tvar outputFiles []FSFile\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tlog.WithFields(log.Fields{\"fs_product\": pkg.Product}).Debugf(\"File %s is a directory, skipping\", file.Name())\n\t\t\tcontinue\n\t\t}\n\n\t\t// filter the package to only the given bundle and version\n\t\tif removeBundleMetadata(file.Name()) != removeBundleMetadata(pkg.Bundle) || !strings.HasPrefix(file.Name(), fmt.Sprintf(\"%s_v%d\", pkg.Bundle, pkg.FeedVersion)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar outFile FSFile\n\n\t\t// Get the filename from the path and then take off the bundle name so we've got a clean start point\n\t\tname := file.Name()[strings.LastIndex(file.Name(), \"/\")+1:]\n\t\toutFile.Name = name // Grab the name now before we chop it up.\n\t\tname = name[:strings.LastIndex(file.Name(), \".\")]\n\t\tname = name[len(removeBundleMetadata(pkg.Bundle))+1:]\n\n\t\t// Split the name for our parts to iterate.\n\t\tsplitName := strings.Split(name, \"_\")\n\n\t\t// There are three possible bits remaining, sequence, feedVersion and full.\n\t\tfor _, v := range splitName {\n\t\t\tif v == \"full\" {\n\t\t\t\toutFile.IsFull = true\n\t\t\t}\n\t\t\tif len(v) > 0 && v[0] == 'v' {\n\t\t\t\tif i, err := strconv.Atoi(v[1:]); err == nil {\n\t\t\t\t\toutFile.Version.FeedVersion = i\n\t\t\t\t}\n\t\t\t}\n\t\t\tif i, err := strconv.Atoi(v); err == nil {\n\t\t\t\toutFile.Version.Sequence = i\n\t\t\t}\n\t\t}\n\t\tif isFull == outFile.IsFull {\n\t\t\toutputFiles = append(outputFiles, outFile)\n\t\t}\n\n\t}\n\treturn outputFiles\n}", "title": "" }, { "docid": "323caa8932525471e7f9a589fe5e5488", "score": "0.47948524", "text": "func (c *lspServiceClient) GetImplementationFiles(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ImplementationFileListResponse, error) {\n\tout := new(ImplementationFileListResponse)\n\terr := c.cc.Invoke(ctx, \"/gauge.messages.lspService/GetImplementationFiles\", in, out, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "f7fb92e0b39b880c4b8d30d01e60d985", "score": "0.4790275", "text": "func (c *config) mockFileSystem(bp string, fs map[string][]byte) {\n\tmockFS := map[string][]byte{}\n\n\tif _, exists := mockFS[\"Android.bp\"]; !exists {\n\t\tmockFS[\"Android.bp\"] = []byte(bp)\n\t}\n\n\tfor k, v := range fs {\n\t\tmockFS[k] = v\n\t}\n\n\t// no module list file specified; find every file named Blueprints or Android.bp\n\tpathsToParse := []string{}\n\tfor candidate := range mockFS {\n\t\tbase := filepath.Base(candidate)\n\t\tif base == \"Blueprints\" || base == \"Android.bp\" {\n\t\t\tpathsToParse = append(pathsToParse, candidate)\n\t\t}\n\t}\n\tif len(pathsToParse) < 1 {\n\t\tpanic(fmt.Sprintf(\"No Blueprint or Android.bp files found in mock filesystem: %v\\n\", mockFS))\n\t}\n\tmockFS[blueprint.MockModuleListFile] = []byte(strings.Join(pathsToParse, \"\\n\"))\n\n\tc.fs = pathtools.MockFs(mockFS)\n\tc.mockBpList = blueprint.MockModuleListFile\n}", "title": "" }, { "docid": "764a04411c38c58493f2b553d06e3360", "score": "0.4781087", "text": "func (m *MockqueueTaskInfo) GetVersion() int64 {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetVersion\")\n\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "title": "" }, { "docid": "e4ca05a542cf13da6ba6d95bd89d7151", "score": "0.47748402", "text": "func (m *MockGalleryApplicationVersionsClientAPI) ListByGalleryApplication(ctx context.Context, resourceGroupName, galleryName, galleryApplicationName string) (compute.GalleryApplicationVersionListPage, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListByGalleryApplication\", ctx, resourceGroupName, galleryName, galleryApplicationName)\n\tret0, _ := ret[0].(compute.GalleryApplicationVersionListPage)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6d0812fb3b4a4b939de589713f1e442e", "score": "0.4770939", "text": "func (m *MockworkspaceService) ReadAddonsDir(appName string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ReadAddonsDir\", appName)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2ffc43ea1b44144bb8b9faf2bfd3e52d", "score": "0.47681844", "text": "func testPkgs(t *testing.T) []string {\n\t// Packages which do not contain tests (or do not contain tests for the\n\t// build target) will still compile a test binary which vacuously pass.\n\tcmd := exec.Command(\"go\", \"list\",\n\t\t\"github.com/u-root/u-root/cmds/...\",\n\t\t// TODO: only running tests in cmds because tests in pkg have\n\t\t// duplicate names which confuses the test runner. This should\n\t\t// get fixed.\n\t\t// \"github.com/u-root/u-root/xcmds/...\",\n\t\t// \"github.com/u-root/u-root/pkg/...\",\n\t)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tpkgs := strings.Fields(strings.TrimSpace(string(out)))\n\n\t// TODO: Some tests do not run properly in QEMU at the moment. They are\n\t// blacklisted. These tests fail for mostly two reasons:\n\t// 1. either it requires networking (not enabled in the kernel)\n\t// 2. or it depends on some test files (for example /bin/sleep)\n\tblacklist := []string{\n\t\t\"github.com/u-root/u-root/cmds/bzimage\",\n\t\t\"github.com/u-root/u-root/cmds/cmp\",\n\t\t\"github.com/u-root/u-root/cmds/dd\",\n\t\t\"github.com/u-root/u-root/cmds/dhclient\",\n\t\t\"github.com/u-root/u-root/cmds/elvish/eval\",\n\t\t\"github.com/u-root/u-root/cmds/fmap\",\n\t\t\"github.com/u-root/u-root/cmds/gpt\",\n\t\t\"github.com/u-root/u-root/cmds/kill\",\n\t\t\"github.com/u-root/u-root/cmds/mount\",\n\t\t\"github.com/u-root/u-root/cmds/tail\",\n\t\t\"github.com/u-root/u-root/cmds/wget\",\n\t\t\"github.com/u-root/u-root/cmds/which\",\n\t\t\"github.com/u-root/u-root/cmds/wifi\",\n\t}\n\tfor i := 0; i < len(pkgs); i++ {\n\t\tfor _, b := range blacklist {\n\t\t\tif pkgs[i] == b {\n\t\t\t\tpkgs = append(pkgs[:i], pkgs[i+1:]...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn pkgs\n}", "title": "" }, { "docid": "d5de49713cf400d61296aa5cc75e2d78", "score": "0.47596636", "text": "func (conf *config) testFiles(outdir string) error {\n\tfor _, i := range conf.Integrations {\n\t\tfor tn, tmpl := range i.testFilesTemplate {\n\t\t\tfor _, arch := range i.Archs {\n\t\t\t\tpathBuf := &bytes.Buffer{}\n\t\t\t\tif err := tmpl.Execute(pathBuf, &i); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"evaluating testFiles[%d] for integration %q: %w\", tn, i.Name, err)\n\t\t\t\t}\n\n\t\t\t\t_, err := os.Stat(filepath.Join(outdir, arch, pathBuf.String()))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"existence chech for %q for integration %q failed: %w\", pathBuf.String(), i.Name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4bbccf7c721e1399d66306abee78ae9b", "score": "0.47463623", "text": "func TestGetUpdatePackage(t *testing.T) {\n\t// Get the update package URL\n\tversionHash := \"deb3e700df1e6b29df98c26cc388417072b0bb5eeda3de7d035e186c315f161c\"\n\tupdateURL, err := updater.getUpdatePackageURL(versionHash)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\tif updateURL == \"\" {\n\t\tt.Error(\"UpdateURL must not be blank\")\n\t}\n\n\t// Download the update package\n\toutputPath := \"./test-resources/test\"\n\tos.RemoveAll(outputPath)\n\terr = os.MkdirAll(outputPath, 0755)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\tpackageFile := filepath.Join(outputPath, \"update-package.tar.gz\")\n\tcancelChan := make(chan bool)\n\tfeedbackChan := make(chan DownloadProgressEvent)\n\tgo updater.downloadUpdate(\n\t\tupdateURL,\n\t\tpackageFile,\n\t\tcancelChan,\n\t\tfeedbackChan)\n\tfor feedback := range feedbackChan {\n\t\tif feedback.Completed {\n\t\t\tclose(feedbackChan)\n\t\t}\n\t}\n\n\t// Create the new version\n\tversion := \"004\"\n\tnewPath, err := updater.cloneLatestVersionTo(version, true)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\tif newPath == \"\" {\n\t\tt.Errorf(\"New path for version '%s' must not be blank\", version)\n\t}\n\n\t// Apply the update\n\terr = updater.applyUpdate(packageFile, newPath)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n}", "title": "" }, { "docid": "154cad79ac1af4d6d68d6222678aaf98", "score": "0.47367972", "text": "func TestGetFileVersionsInvalidPath(t *testing.T) {\n testpath, _ := createTestParamValue(\"GetFileVersions\", \"path\", \"string\").(string)\n teststorageName, _ := createTestParamValue(\"GetFileVersions\", \"storageName\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpath, \"GetFileVersions\", \"path\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpath = nullValue\n } else {\n testpath, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"GetFileVersions\", \"path\", testpath)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.GetFileVersions(testpath, teststorageName)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"GetFileVersions\", \"path\", \"string\", testpath, int32(statusCode), e)\n}", "title": "" }, { "docid": "6556bc83c0f42e0e3bb61d659cfbb5e9", "score": "0.47239015", "text": "func (l *Landscaper) pickReleaseFiles(ns string) []string {\n\tvar files []string\n\tvar releases []Release\n\tvar found bool\n\n\tfor _, ctx := range l.ctxs {\n\t\t// checking releases for configured namespace only\n\t\tif releases, found = ctx.Releases[ns]; !found {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, release := range releases {\n\t\t\tl.logger.Infof(\"Inspecting release '%s'\", release.Component.Name)\n\t\t\tfiles = append(files, release.File)\n\t\t}\n\t}\n\n\treturn files\n}", "title": "" }, { "docid": "0360f6809639dc0d517a162b14858761", "score": "0.4719054", "text": "func TestGetAppContainers(t *testing.T) {\n\tassert := asrt.New(t)\n\tcontainers, err := GetAppContainers(testContainerName)\n\tassert.NoError(err)\n\tassert.Contains(containers[0].Image, versionconstants.WebImg)\n}", "title": "" }, { "docid": "d5f0ad32f8af740d5168d6ee7019dd1d", "score": "0.4710316", "text": "func (m *MockAppEngineAPI) GetVersion() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetVersion\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "0532a026fe65c3b540fb19abc9f6bc98", "score": "0.4709936", "text": "func MergePackageFiles(pkg *Package, mode MergeMode) *File {}", "title": "" }, { "docid": "1c0b6dab935b380915818214da743357", "score": "0.47033295", "text": "func TestGet(t *testing.T) {\n\tcurrTestCaseDir := fmt.Sprintf(\"testdata/testproject_with_bingo_%s\", strings.ReplaceAll(version.Version, \".\", \"_\"))\n\tt.Run(\"Empty project\", func(t *testing.T) {\n\t\tfor _, isGoProject := range []bool{false, true} {\n\t\t\tt.Run(fmt.Sprintf(\"isGoProject=%v\", isGoProject), func(t *testing.T) {\n\t\t\t\tg := newTmpGoEnv(t)\n\t\t\t\tdefer g.Close(t)\n\n\t\t\t\t// We manually build bingo binary to make sure GOCACHE will not hit us.\n\t\t\t\tgoBinPath := filepath.Join(g.tmpDir, bingoBin)\n\t\t\t\tbuildInitialGobin(t, goBinPath)\n\n\t\t\t\ttestutil.Ok(t, os.MkdirAll(filepath.Join(g.tmpDir, \"newproject\"), os.ModePerm))\n\t\t\t\tp := newTestProject(t, filepath.Join(g.tmpDir, \"newproject\"), filepath.Join(g.tmpDir, \"testproject\"), isGoProject)\n\t\t\t\tp.assertNotChanged(t)\n\n\t\t\t\tfor _, tcase := range []struct {\n\t\t\t\t\tname string\n\t\t\t\t\tdo func(t *testing.T)\n\n\t\t\t\t\texistingBinaries []string\n\t\t\t\t}{\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get faillint v1.4.0 and pin for our module; clean module\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"github.com/fatih/faillint@v1.4.0\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\tBinary Name\\t\\tPackage @ Version\\t\\n----\\t\\t-----------\\t\\t-----------------\\t\\nfaillint\\tfaillint-v1.4.0\\tgithub.com/fatih/faillint@v1.4.0\", g.ExecOutput(t, p.root, goBinPath, \"list\", \"faillint\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, g.ExecOutput(t, p.root, goBinPath, \"list\", \"faillint\"), g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.4.0\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get goimports from commit\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"golang.org/x/tools/cmd/goimports@2b542361a4fc4b018c0770324a3b65d0393db1e0\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\n----\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\nfaillint\\tfaillint-v1.4.0\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\ngoimports\\tgoimports-v0.0.0-20200521211927-2b542361a4fc\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200521211927-2b542361a4fc\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.4.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get goimports from same commit should be noop\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\t// TODO(bwplotka): Assert if actually noop.\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"golang.org/x/tools/cmd/goimports@2b542361a4fc4b018c0770324a3b65d0393db1e0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.4.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Update goimports by path\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"golang.org/x/tools/cmd/goimports@cb1345f3a375367f8439bba882e90348348288d9\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\n----\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\nfaillint\\tfaillint-v1.4.0\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\ngoimports\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.4.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Update faillint by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint@v1.5.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.4.0\", \"faillint-v1.5.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Downgrade faillint by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint@v1.3.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get another goimports from commit, name it goimports2\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"-n=goimports2\", \"golang.org/x/tools/cmd/goimports@7d3b6ebf133df879df3e448a8625b7029daa8954\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200515010526-7d3b6ebf133d\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200515010526-7d3b6ebf133d\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Upgrade goimports2 from commit\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports2@7521f6f4253398df2cb300c64dd7fba383ccdfa6\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get go bindata (non Go Module project).\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"github.com/go-bindata/go-bindata/go-bindata@v3.1.1\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Installing package with `cmd` name fails - different name is suggested.\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"github.com/bwplotka/promeval@v0.3.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get array of 4 versions of faillint under f2 name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"-n\", \"f2\", \"github.com/fatih/faillint@v1.5.0,v1.1.0,v1.2.0,v1.0.0\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\tBinary Name\\tPackage @ Version\\t\\t\\t\\t\\n----\\t-----------\\t-----------------\\t\\t\\t\\t\\nf2\\tf2-v1.5.0\\t\\tgithub.com/fatih/faillint@v1.5.0\\t\\nf2\\tf2-v1.1.0\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\nf2\\tf2-v1.2.0\\t\\tgithub.com/fatih/faillint@v1.2.0\\t\\nf2\\tf2-v1.0.0\\t\\tgithub.com/fatih/faillint@v1.0.0\", g.ExecOutput(t, p.root, goBinPath, \"list\", \"f2\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Install package with go name should fail.\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"github.com/something/go\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"<Special> Persist current state, to use for compatibility testing. \",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tif isGoProject {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Generate current Version test case for further tests. This should be committed as well if changed.\n\t\t\t\t\t\t\ttestutil.Ok(t, os.RemoveAll(currTestCaseDir))\n\t\t\t\t\t\t\ttestutil.Ok(t, os.MkdirAll(filepath.Join(currTestCaseDir, \".bingo\"), os.ModePerm))\n\t\t\t\t\t\t\t_, err := execCmd(\"\", nil, \"cp\", \"-r\", filepath.Join(p.root, \".bingo\"), currTestCaseDir)\n\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Get array of 2 versions of normal faillint, despite being non array before, should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint@v1.1.0,v1.0.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Updating f2 to different version should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f2@v1.3.0,v1.4.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Updating f2 to same multiple versions should fail\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"f2@v1.1.0,v1.4.0,v1.1.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Creating not existing foo to f3 should fail\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"-n\", \"f3\", \"x\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Renaming not existing foo to f3 should fail\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"-r\", \"f3\", \"x\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Cloning f2 to f2-clone should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"-n\", \"f2-clone\", \"f2\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2-clone\\t\\tf2-clone-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2-clone\\t\\tf2-clone-v1.4.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.1.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.0.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Deleting f2-clone\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f2-clone@none\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.1.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.0.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Renaming f2 to f3 should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"-r\", \"f3\", \"f2\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf3\\t\\t\\tf3-v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf3\\t\\t\\tf3-v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.4.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.1.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.0.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Renaming f3 to f4 with certain version should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"-r\", \"f4\", \"f3@v1.1.0,v1.0.0\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf4\\t\\t\\tf4-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf4\\t\\t\\tf4-v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.1.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.0.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Updating f4 to multiple versions with none should fail\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\ttestutil.NotOk(t, g.ExectErr(p.root, goBinPath, \"get\", \"f2@v1.4.0,v1.1.0,none\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Updating f4 back to non array version should work\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f4@v1.1.0\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Remove goimports2 by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports2@none\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf4\\t\\t\\tf4-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.1.0\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.0.0\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Remove goimports by path\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"golang.org/x/tools/cmd/goimports@none\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Remove faillint by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint@none\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Remove f4 by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f4@none\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"Remove go-bindata by name\",\n\t\t\t\t\t\tdo: func(t *testing.T) {\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"go-bindata@none\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\tBinary Name\\tPackage @ Version\\t\\n----\\t-----------\\t-----------------\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t},\n\t\t\t\t\t\texistingBinaries: []string{\"f2-clone-v1.3.0\", \"f2-clone-v1.4.0\", \"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.3.0\", \"f2-v1.4.0\", \"f2-v1.5.0\", \"f3-v1.3.0\", \"f3-v1.4.0\", \"f4-v1.0.0\", \"f4-v1.1.0\", \"faillint-v1.0.0\", \"faillint-v1.1.0\", \"faillint-v1.3.0\", \"faillint-v1.4.0\", \"faillint-v1.5.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200521211927-2b542361a4fc\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200515010526-7d3b6ebf133d\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"},\n\t\t\t\t\t},\n\t\t\t\t} {\n\t\t\t\t\tif ok := t.Run(tcase.name, func(t *testing.T) {\n\t\t\t\t\t\tdefer p.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\ttcase.do(t)\n\t\t\t\t\t\ttestutil.Equals(t, tcase.existingBinaries, g.existingBinaries(t))\n\t\t\t\t\t}); !ok {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n\tt.Run(\"Compatibility test\", func(t *testing.T) {\n\t\tdirs, err := filepath.Glob(\"testdata/testproject*\")\n\t\ttestutil.Ok(t, err)\n\t\tfor _, dir := range dirs {\n\t\t\tt.Run(dir, func(t *testing.T) {\n\t\t\t\tfor _, isGoProject := range []bool{false, true} {\n\t\t\t\t\tt.Run(fmt.Sprintf(\"isGoProject=%v\", isGoProject), func(t *testing.T) {\n\t\t\t\t\t\tt.Run(\"Via bingo get all\", func(t *testing.T) {\n\t\t\t\t\t\t\tg := newTmpGoEnv(t)\n\t\t\t\t\t\t\tdefer g.Close(t)\n\n\t\t\t\t\t\t\t// We manually build bingo binary to make sure GOCACHE will not hit us.\n\t\t\t\t\t\t\tgoBinPath := filepath.Join(g.tmpDir, bingoBin)\n\t\t\t\t\t\t\tbuildInitialGobin(t, goBinPath)\n\n\t\t\t\t\t\t\t// Copy testproject at the beginning to temp dir.\n\t\t\t\t\t\t\tp := newTestProject(t, dir, filepath.Join(g.tmpDir, \"testproject1\"), isGoProject)\n\t\t\t\t\t\t\tp.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{}, g.existingBinaries(t))\n\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t\tdefer p.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\t// Get all binaries by doing 'bingo get'.\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.3.0\", \"go-bindata-v3.1.1+incompatible\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\n\t\t\t\t\t\t})\n\t\t\t\t\t\tt.Run(\"Via bingo get one by one\", func(t *testing.T) {\n\t\t\t\t\t\t\tg := newTmpGoEnv(t)\n\t\t\t\t\t\t\tdefer g.Close(t)\n\n\t\t\t\t\t\t\t// We manually build bingo binary to make sure GOCACHE will not hit us.\n\t\t\t\t\t\t\tgoBinPath := filepath.Join(g.tmpDir, bingoBin)\n\t\t\t\t\t\t\tbuildInitialGobin(t, goBinPath)\n\n\t\t\t\t\t\t\t// Copy testproject at the beginning to temp dir.\n\t\t\t\t\t\t\tp := newTestProject(t, dir, filepath.Join(g.tmpDir, \"testproject1\"), isGoProject)\n\t\t\t\t\t\t\tp.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{}, g.existingBinaries(t))\n\t\t\t\t\t\t\tdefer p.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports2\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\t// Get array version with one go.\n\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f2\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"f2-v1.0.0\", \"f2-v1.1.0\", \"f2-v1.2.0\", \"f2-v1.5.0\", \"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\t\\t\\tBinary Name\\t\\t\\t\\t\\t\\t\\t\\tPackage @ Version\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\n----\\t\\t\\t-----------\\t\\t\\t\\t\\t\\t\\t\\t-----------------\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.5.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.1.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.2.0\\t\\t\\t\\t\\t\\t\\t\\t\\nf2\\t\\t\\tf2-v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\nfaillint\\t\\tfaillint-v1.3.0\\t\\t\\t\\t\\t\\t\\tgithub.com/fatih/faillint@v1.3.0\\t\\t\\t\\t\\t\\t\\t\\t\\ngo-bindata\\tgo-bindata-v3.1.1+incompatible\\t\\t\\t\\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\\t\\t\\ngoimports\\t\\tgoimports-v0.0.0-20200522201501-cb1345f3a375\\t\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375\\t\\ngoimports2\\tgoimports2-v0.0.0-20200519175826-7521f6f42533\\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200519175826-7521f6f42533\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\t\t\t\t\t\t})\n\t\t\t\t\t\tt.Run(\"Via go\", func(t *testing.T) {\n\t\t\t\t\t\t\tg := newTmpGoEnv(t)\n\t\t\t\t\t\t\tdefer g.Close(t)\n\n\t\t\t\t\t\t\t// Copy testproject at the beginning to temp dir.\n\t\t\t\t\t\t\t// NOTE: No bingo binary is required here.\n\t\t\t\t\t\t\tp := newTestProject(t, dir, filepath.Join(g.tmpDir, \"testproject2\"), isGoProject)\n\t\t\t\t\t\t\tp.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{}, g.existingBinaries(t))\n\t\t\t\t\t\t\tdefer p.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\t// Get all binaries by doing native go build.\n\t\t\t\t\t\t\tif isGoProject {\n\t\t\t\t\t\t\t\t// This should work without cd even.\n\t\t\t\t\t\t\t\t_, err := execCmd(p.root, nil, \"go\", \"build\", \"-modfile=\"+filepath.Join(defaultModDir, \"goimports.mod\"), \"-o=\"+filepath.Join(g.gobin, \"goimports-v0.0.0-20200522201501-cb1345f3a375\"), \"golang.org/x/tools/cmd/goimports\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t\t_, err = execCmd(p.root, nil, \"go\", \"build\", \"-modfile=\"+filepath.Join(defaultModDir, \"faillint.mod\"), \"-o=\"+filepath.Join(g.gobin, \"faillint-v1.3.0\"), \"github.com/fatih/faillint\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t\t_, err = execCmd(p.root, nil, \"go\", \"build\", \"-modfile=\"+filepath.Join(defaultModDir, \"goimports2.mod\"), \"-o=\"+filepath.Join(g.gobin, \"goimports2-v0.0.0-20200519175826-7521f6f42533\"), \"golang.org/x/tools/cmd/goimports\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// For no go projects we have this \"bug\" that requires go.mod to be present.\n\t\t\t\t\t\t\t\t_, err := execCmd(filepath.Join(p.root, defaultModDir), nil, \"go\", \"build\", \"-modfile=goimports.mod\", \"-o=\"+filepath.Join(g.gobin, \"goimports-v0.0.0-20200522201501-cb1345f3a375\"), \"golang.org/x/tools/cmd/goimports\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t\t_, err = execCmd(filepath.Join(p.root, defaultModDir), nil, \"go\", \"build\", \"-modfile=faillint.mod\", \"-o=\"+filepath.Join(g.gobin, \"faillint-v1.3.0\"), \"github.com/fatih/faillint\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t\t_, err = execCmd(filepath.Join(p.root, defaultModDir), nil, \"go\", \"build\", \"-modfile=goimports2.mod\", \"-o=\"+filepath.Join(g.gobin, \"goimports2-v0.0.0-20200519175826-7521f6f42533\"), \"golang.org/x/tools/cmd/goimports\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t})\n\t\t\t\t\t\t// TODO(bwplotka): Test variables.env as well.\n\t\t\t\t\t\tt.Run(\"Makefile\", func(t *testing.T) {\n\t\t\t\t\t\t\t// Make is one of test requirement.\n\t\t\t\t\t\t\tmakePath := makePath(t)\n\n\t\t\t\t\t\t\tg := newTmpGoEnv(t)\n\t\t\t\t\t\t\tdefer g.Close(t)\n\n\t\t\t\t\t\t\t// We manually build bingo binary to make sure GOCACHE will not hit us.\n\t\t\t\t\t\t\tgoBinPath := filepath.Join(g.tmpDir, bingoBin)\n\t\t\t\t\t\t\tbuildInitialGobin(t, goBinPath)\n\n\t\t\t\t\t\t\t// Copy testproject at the beginning to temp dir.\n\t\t\t\t\t\t\tprjRoot := filepath.Join(g.tmpDir, \"testproject\")\n\t\t\t\t\t\t\tp := newTestProject(t, dir, prjRoot, isGoProject)\n\t\t\t\t\t\t\tp.assertNotChanged(t, defaultModDir)\n\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{}, g.existingBinaries(t))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"(re)installing \"+g.gobin+\"/faillint-v1.3.0\\ngo: downloading github.com/fatih/faillint v1.3.0\\ngo: downloading golang.org/x/tools v0.0.0-20200207224406-61798d64f025\\nchecking faillint\\n\", g.ExecOutput(t, p.root, makePath, \"faillint-exists\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"(re)installing \"+g.gobin+\"/goimports-v0.0.0-20200522201501-cb1345f3a375\\ngo: downloading golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375\\ngo: downloading golang.org/x/mod v0.2.0\\ngo: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543\\nchecking goimports\\n\", g.ExecOutput(t, p.root, makePath, \"goimports-exists\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"(re)installing \"+g.gobin+\"/goimports2-v0.0.0-20200519175826-7521f6f42533\\ngo: downloading golang.org/x/tools v0.0.0-20200519175826-7521f6f42533\\nchecking goimports2\\n\", g.ExecOutput(t, p.root, makePath, \"goimports2-exists\"))\n\n\t\t\t\t\t\t\ttestutil.Equals(t, \"checking faillint\\n\", g.ExecOutput(t, p.root, makePath, \"faillint-exists\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"checking goimports\\n\", g.ExecOutput(t, p.root, makePath, \"goimports-exists\"))\n\t\t\t\t\t\t\ttestutil.Equals(t, \"checking goimports2\\n\", g.ExecOutput(t, p.root, makePath, \"goimports2-exists\"))\n\n\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\tt.Run(\"Delete binary file, expect reinstall\", func(t *testing.T) {\n\t\t\t\t\t\t\t\t_, err := execCmd(g.gobin, nil, \"rm\", \"faillint-v1.3.0\")\n\t\t\t\t\t\t\t\ttestutil.Ok(t, err)\n\t\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\n\t\t\t\t\t\t\t\ttestutil.Equals(t, \"(re)installing \"+g.gobin+\"/faillint-v1.3.0\\nchecking faillint\\n\", g.ExecOutput(t, p.root, makePath, \"faillint-exists\"))\n\t\t\t\t\t\t\t\ttestutil.Equals(t, \"checking faillint\\n\", g.ExecOutput(t, p.root, makePath, \"faillint-exists\"))\n\t\t\t\t\t\t\t\ttestutil.Equals(t, \"checking goimports\\n\", g.ExecOutput(t, p.root, makePath, \"goimports-exists\"))\n\t\t\t\t\t\t\t\ttestutil.Equals(t, \"checking goimports2\\n\", g.ExecOutput(t, p.root, makePath, \"goimports2-exists\"))\n\t\t\t\t\t\t\t\ttestutil.Equals(t, []string{\"faillint-v1.3.0\", \"goimports-v0.0.0-20200522201501-cb1345f3a375\", \"goimports2-v0.0.0-20200519175826-7521f6f42533\"}, g.existingBinaries(t))\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tt.Run(\"Delete makefile\", func(t *testing.T) {\n\t\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"f2@none\"))\n\t\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"faillint@none\"))\n\t\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports@none\"))\n\t\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"goimports2@none\"))\n\t\t\t\t\t\t\t\tfmt.Println(g.ExecOutput(t, p.root, goBinPath, \"get\", \"go-bindata@none\"))\n\n\t\t\t\t\t\t\t\ttestutil.Equals(t, \"Name\\tBinary Name\\tPackage @ Version\\t\\n----\\t-----------\\t-----------------\", g.ExecOutput(t, p.root, goBinPath, \"list\"))\n\n\t\t\t\t\t\t\t\t_, err := os.Stat(filepath.Join(p.root, \".bingo\", \"Variables.mk\"))\n\t\t\t\t\t\t\t\ttestutil.NotOk(t, err)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n}", "title": "" }, { "docid": "e975fcdea2c6cf209c431a4846c952e6", "score": "0.47013134", "text": "func PrepareFakeApps(baseDir string, num int) ([]string, error) {\n\t// The manifest.json data for the fake hosted app; it just opens google.com\n\t// page on launch.\n\tconst manifestTmpl = `{\n\t\t\"description\": \"fake\",\n\t\t\"name\": \"fake app %d\",\n\t\t\"manifest_version\": 2,\n\t\t\"version\": \"0\",\n\t\t\"app\": {\n\t\t\t\"launch\": {\n\t\t\t\t\"web_url\": \"https://www.google.com/\"\n\t\t\t}\n\t\t}\n\t}`\n\tif err := chrome.ChownContentsToChrome(baseDir); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to change ownership of %s\", baseDir)\n\t}\n\textDirs := make([]string, 0, num)\n\tfor i := 0; i < num; i++ {\n\t\textDir := filepath.Join(baseDir, fmt.Sprintf(\"fake_%d\", i))\n\t\tif err := os.Mkdir(extDir, 0755); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to create the directory for %d-th extension\", i)\n\t\t}\n\t\tif err := ioutil.WriteFile(filepath.Join(extDir, \"manifest.json\"), []byte(fmt.Sprintf(manifestTmpl, i)), 0644); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to prepare manifest.json for %d-th extension\", i)\n\t\t}\n\t\textDirs = append(extDirs, extDir)\n\t}\n\treturn extDirs, nil\n}", "title": "" }, { "docid": "e63fe0400fc0ce48d42d93b2f72e3f5a", "score": "0.46961644", "text": "func TestDownloadImages(t *testing.T) {\n testname, _ := createTestParamValue(\"DownloadImages\", \"name\", \"string\").(string)\n testformat, _ := createTestParamValue(\"DownloadImages\", \"format\", \"string\").(string)\n testpassword, _ := createTestParamValue(\"DownloadImages\", \"password\", \"string\").(string)\n testfolder, _ := createTestParamValue(\"DownloadImages\", \"folder\", \"string\").(string)\n teststorage, _ := createTestParamValue(\"DownloadImages\", \"storage\", \"string\").(string)\n e := InitializeTest(\"DownloadImages\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadImages(testname, testformat, testpassword, testfolder, teststorage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "911fd7d489c59ab5fb9adb1697783986", "score": "0.46952495", "text": "func (m *FakeKfAlpha1Interface) Apps(arg0 string) v1alpha10.AppInterface {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Apps\", arg0)\n\tret0, _ := ret[0].(v1alpha10.AppInterface)\n\treturn ret0\n}", "title": "" }, { "docid": "1f47ba299223c21e66796fc7d93714ae", "score": "0.4694514", "text": "func (mock *DefaultApiMock) VersionMetadataCalls() []struct {\n\tCtx _context.Context\n} {\n\tvar calls []struct {\n\t\tCtx _context.Context\n\t}\n\tmock.lockVersionMetadata.RLock()\n\tcalls = mock.calls.VersionMetadata\n\tmock.lockVersionMetadata.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "232be8a9439bbb12519f0766321c24c9", "score": "0.46922773", "text": "func getFilePaths(log log.T, folder string, fileSuffix string) (fileFullPathList []string, err error) {\n\n\tvar totalSize int64\n\n\t// Read all files that ended with json\n\tfiles, readDirError := readDirFunc(folder)\n\tif readDirError != nil {\n\t\tLogError(\n\t\t\tlog,\n\t\t\tfmt.Errorf(\"Read directory %v failed, error: %v\", folder, readDirError))\n\t\t// In case of directory not found error, ignore\n\t\treturn []string{}, nil\n\t}\n\n\tfor _, f := range files {\n\n\t\tif filepath.Ext(f.Name()) == fileSuffix {\n\n\t\t\tfileFullPath := filepath.Join(folder, f.Name())\n\t\t\tfileFullPath = filepath.Clean(fileFullPath)\n\t\t\tfileFullPathList = append(fileFullPathList, fileFullPath)\n\t\t\ttotalSize += f.Size()\n\t\t}\n\t}\n\n\t// Check custom inventory file count\n\tif len(fileFullPathList) > CustomInventoryCountLimit {\n\t\terr = fmt.Errorf(\"Total custom inventory file count (%v) exceed limit (%v)\",\n\t\t\tlen(fileFullPathList), CustomInventoryCountLimit)\n\t\tLogError(log, err)\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"Total custom (%v) inventory file, total bytes: %v\",\n\t\tlen(fileFullPathList), totalSize)\n\treturn\n}", "title": "" }, { "docid": "a43fdabe0f89f17e2cd93cb1da5dceb8", "score": "0.4691868", "text": "func TestZipFixtureUnpack(t *testing.T) {\n\tConvey(\"Zip transmat: unpacking of fixtures\", t,\n\t\ttestutil.Requires(testutil.RequiresCanManageOwnership, func() {\n\t\t\ttestutil.WithTmpdir(func(tmpDir fs.AbsolutePath) {\n\t\t\t\t/*\n\t\t\t\t\tConvey(\"Unpack a fixture from gnu zip which includes a base dir\", func() {\n\t\t\t\t\t\twareID := api.WareID{\"zip\", \"5y6NvK6GBPQ6CcuNyJyWtSrMAJQ4LVrAcZSoCRAzMSk5o53pkTYiieWyRivfvhZwhZ\"}\n\t\t\t\t\t\tgotWareID, err := Unpack(\n\t\t\t\t\t\t\tcontext.Background(),\n\t\t\t\t\t\t\twareID,\n\t\t\t\t\t\t\ttmpDir.String(),\n\t\t\t\t\t\t\tapi.FilesetUnpackFilter_Lossless,\n\t\t\t\t\t\t\trio.Placement_Direct,\n\t\t\t\t\t\t\t[]api.WarehouseLocation{\"file://./fixtures/withbase.zip\"},\n\t\t\t\t\t\t\trio.Monitor{},\n\t\t\t\t\t\t)\n\t\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\t\tSo(gotWareID, ShouldResemble, wareID)\n\n\t\t\t\t\t\tfmeta, reader, err := fsOp.ScanFile(osfs.New(tmpDir), fs.MustRelPath(\"ab\"))\n\t\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\t\tSo(fmeta.Name, ShouldResemble, fs.MustRelPath(\"ab\"))\n\t\t\t\t\t\tSo(fmeta.Type, ShouldResemble, fs.Type_File)\n\t\t\t\t\t\tSo(fmeta.Uid, ShouldEqual, 7000)\n\t\t\t\t\t\tSo(fmeta.Gid, ShouldEqual, 7000)\n\t\t\t\t\t\tSo(fmeta.Mtime.UTC(), ShouldResemble, time.Date(2015, 05, 30, 19, 53, 35, 0, time.UTC))\n\t\t\t\t\t\tbody, err := ioutil.ReadAll(reader)\n\t\t\t\t\t\tSo(string(body), ShouldResemble, \"\")\n\n\t\t\t\t\t\tfmeta, reader, err = fsOp.ScanFile(osfs.New(tmpDir), fs.MustRelPath(\"bc\"))\n\t\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\t\tSo(fmeta.Name, ShouldResemble, fs.MustRelPath(\"bc\"))\n\t\t\t\t\t\tSo(fmeta.Type, ShouldResemble, fs.Type_Dir)\n\t\t\t\t\t\tSo(fmeta.Mtime.UTC(), ShouldResemble, time.Date(2015, 05, 30, 19, 53, 35, 0, time.UTC))\n\t\t\t\t\t\tSo(reader, ShouldBeNil)\n\n\t\t\t\t\t\tfmeta, reader, err = fsOp.ScanFile(osfs.New(tmpDir), fs.MustRelPath(\".\"))\n\t\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\t\tSo(fmeta.Name, ShouldResemble, fs.MustRelPath(\".\"))\n\t\t\t\t\t\tSo(fmeta.Type, ShouldResemble, fs.Type_Dir)\n\t\t\t\t\t\tSo(fmeta.Mtime.UTC(), ShouldResemble, time.Date(2015, 05, 30, 19, 53, 35, 0, time.UTC))\n\t\t\t\t\t\tSo(reader, ShouldBeNil)\n\t\t\t\t\t})\n\t\t\t\t*/\n\t\t\t\tConvey(\"Unpack a fixture from zip3.0 which lacks a base dir\", func() {\n\t\t\t\t\twareID := api.WareID{\"zip\", \"6c1eVnQ9NutqZSMD5gimy72u3gZMcp4mFAVbQhAkpwTvTH1CCnGgL6yvBJ6MNkWUYZ\"}\n\t\t\t\t\tgotWareID, err := Unpack(\n\t\t\t\t\t\tcontext.Background(),\n\t\t\t\t\t\twareID,\n\t\t\t\t\t\ttmpDir.String(),\n\t\t\t\t\t\tapi.FilesetUnpackFilter_Lossless,\n\t\t\t\t\t\trio.Placement_Direct,\n\t\t\t\t\t\t[]api.WarehouseLocation{\"file://./fixtures/withbase.zip\"},\n\t\t\t\t\t\trio.Monitor{},\n\t\t\t\t\t)\n\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\tSo(gotWareID, ShouldResemble, wareID)\n\n\t\t\t\t\tfmeta, reader, err := fsOp.ScanFile(osfs.New(tmpDir), fs.MustRelPath(\"ab\"))\n\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\tSo(fmeta.Name, ShouldResemble, fs.MustRelPath(\"ab\"))\n\t\t\t\t\tSo(fmeta.Type, ShouldResemble, fs.Type_File)\n\t\t\t\t\tSo(fmeta.Uid, ShouldEqual, 501)\n\t\t\t\t\tSo(fmeta.Gid, ShouldEqual, 20)\n\t\t\t\t\tSo(fmeta.Mtime.UTC(), ShouldResemble, time.Date(2015, 05, 30, 19, 11, 23, 0, time.UTC))\n\t\t\t\t\tbody, err := ioutil.ReadAll(reader)\n\t\t\t\t\tSo(string(body), ShouldResemble, \"\")\n\n\t\t\t\t\tfmeta, reader, err = fsOp.ScanFile(osfs.New(tmpDir), fs.MustRelPath(\".\"))\n\t\t\t\t\tSo(err, ShouldBeNil)\n\t\t\t\t\tSo(fmeta.Name, ShouldResemble, fs.MustRelPath(\".\"))\n\t\t\t\t\tSo(fmeta.Type, ShouldResemble, fs.Type_Dir)\n\t\t\t\t\tSo(fmeta.Mtime.UTC(), ShouldResemble, fs.DefaultTime)\n\t\t\t\t\tSo(reader, ShouldBeNil)\n\t\t\t\t})\n\t\t\t})\n\t\t}),\n\t)\n}", "title": "" }, { "docid": "d115332d037539fe62661cd2f81bc777", "score": "0.4689", "text": "func TestRemoveDuplicateVersions(t *testing.T) {\n\n\ttest_array := []string{\"0.0.1\", \"0.0.2\", \"0.0.3\", \"0.0.1\", \"0.12.0-beta1\", \"0.12.0-beta1\"}\n\n\tlist := lib.RemoveDuplicateVersions(test_array)\n\n\tif len(list) == len(test_array) {\n\t\tlog.Fatalf(\"Not able to remove duplicate: %s\\n\", test_array)\n\t} else {\n\t\tt.Log(\"Write versions exist (expected)\")\n\t}\n}", "title": "" }, { "docid": "d9278dfa6f9c69218610157bfd9d1162", "score": "0.4677498", "text": "func Test_Content_createFilesList(t *testing.T) {\n\tinput := [][]interface{}{\n\t\t{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"ctime\": float64(1671032208),\n\t\t\t\t\"format\": \"txz\",\n\t\t\t\t\"volid\": \"local:vztmpl/alpine-3.16-default_20220622_amd64.tar.xz\",\n\t\t\t\t\"size\": float64(2540360),\n\t\t\t},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"ctime\": float64(1671032191),\n\t\t\t\t\"format\": \"txz\",\n\t\t\t\t\"volid\": \"local:vztmpl/centos-8-default_20201210_amd64.tar.xz\",\n\t\t\t\t\"size\": float64(99098368),\n\t\t\t},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"ctime\": float64(1671032200),\n\t\t\t\t\"format\": \"tgz\",\n\t\t\t\t\"volid\": \"local:vztmpl/debian-10-standard_10.7-1_amd64.tar.gz\",\n\t\t\t\t\"size\": float64(231060971),\n\t\t\t},\n\t\t}, {\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"ctime\": float64(1665838226),\n\t\t\t\t\"format\": \"txz\",\n\t\t\t\t\"volid\": \"local:vztmpl/root-fs.tar.xz\",\n\t\t\t\t\"size\": float64(77551540),\n\t\t\t},\n\t\t},\n\t}\n\toutput := []*[]Content_FileProperties{\n\t\t{\n\t\t\t{\n\t\t\t\tName: \"alpine-3.16-default_20220622_amd64.tar.xz\",\n\t\t\t\tCreationTime: time.UnixMilli(1671032208 * 1000),\n\t\t\t\tFormat: \"txz\",\n\t\t\t\tSize: 2540360,\n\t\t\t}, {\n\t\t\t\tName: \"centos-8-default_20201210_amd64.tar.xz\",\n\t\t\t\tCreationTime: time.UnixMilli(1671032191 * 1000),\n\t\t\t\tFormat: \"txz\",\n\t\t\t\tSize: 99098368,\n\t\t\t}, {\n\t\t\t\tName: \"debian-10-standard_10.7-1_amd64.tar.gz\",\n\t\t\t\tCreationTime: time.UnixMilli(1671032200 * 1000),\n\t\t\t\tFormat: \"tgz\",\n\t\t\t\tSize: 231060971,\n\t\t\t}}, {{\n\t\t\tName: \"root-fs.tar.xz\",\n\t\t\tCreationTime: time.UnixMilli(1665838226 * 1000),\n\t\t\tFormat: \"txz\",\n\t\t\tSize: 77551540,\n\t\t}}}\n\tfor i := range input {\n\t\trequire.Equal(t, output[i], createFilesList(input[i]))\n\t}\n}", "title": "" }, { "docid": "89f927de661973c620cf8fbdea7e0d2f", "score": "0.4669138", "text": "func TestCopyFiles(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", \"\")\n\trequire.NoError(t, err)\n\tdefer os.RemoveAll(dir)\n\n\tf, err := os.Create(filepath.Join(dir, \"from\"))\n\trequire.NoError(t, err)\n\terr = f.Close()\n\trequire.NoError(t, err)\n\n\tfixture := hermittest.NewEnvTestFixture(t, nil)\n\tdefer fixture.Clean()\n\n\tpkg := manifesttest.NewPkgBuilder(fixture.RootDir()).\n\t\tWithSource(\"archive/testdata/archive.tar.gz\").\n\t\tWithVersion(\"1\").\n\t\tWithFile(\"from\", filepath.Join(dir, \"to\"), os.DirFS(dir)).\n\t\tResult()\n\t_, err = fixture.Env.Install(fixture.P, pkg)\n\trequire.NoError(t, err)\n\n\t_, err = os.Stat(filepath.Join(dir, \"to\"))\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "49908260d5151a304303ebac3266bc2b", "score": "0.4653995", "text": "func TestDownloadFile(t *testing.T) {\n testpath, _ := createTestParamValue(\"DownloadFile\", \"path\", \"string\").(string)\n teststorageName, _ := createTestParamValue(\"DownloadFile\", \"storageName\", \"string\").(string)\n testversionId, _ := createTestParamValue(\"DownloadFile\", \"versionId\", \"string\").(string)\n e := InitializeTest(\"DownloadFile\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := GetTestApiClient()\n r, _, e := c.SlidesApi.DownloadFile(testpath, teststorageName, testversionId)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "0fce867af61eda25ce258a21dcb45009", "score": "0.4651035", "text": "func (s *Service) PullAppFileMeta(ctx context.Context, req *pbfs.PullAppFileMetaReq) (\n\t*pbfs.PullAppFileMetaResp, error) {\n\n\t// check if the sidecar's version can be accepted.\n\tif !sfs.IsAPIVersionMatch(req.ApiVersion) {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"sdk's api version is too low, should be upgraded\")\n\t}\n\n\tim, err := sfs.ParseFeedIncomingContext(ctx)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\n\tra := &meta.ResourceAttribute{Basic: &meta.Basic{Type: meta.Sidecar, Action: meta.Access}, BizID: im.Meta.BizID}\n\tauthorized, err := s.bll.Auth().Authorize(im.Kit, ra)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Aborted, \"do authorization failed, %s\", err.Error())\n\t}\n\n\tif !authorized {\n\t\treturn nil, status.Error(codes.PermissionDenied, \"no permission to access bscp server\")\n\t}\n\n\tif req.AppMeta == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"app meta is empty\")\n\t}\n\n\tappID, err := s.bll.AppCache().GetAppID(im.Kit, req.BizId, req.AppMeta.App)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Aborted, \"get app id failed, %s\", err.Error())\n\t}\n\tmeta := &types.AppInstanceMeta{\n\t\tBizID: req.BizId,\n\t\tApp: req.AppMeta.App,\n\t\tAppID: appID,\n\t\tUid: req.AppMeta.Uid,\n\t\tLabels: req.AppMeta.Labels,\n\t}\n\n\tcancel := im.Kit.CtxWithTimeoutMS(1500)\n\tdefer cancel()\n\n\tmetas, err := s.bll.Release().ListAppLatestReleaseMeta(im.Kit, meta)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfileMetas := make([]*pbfs.FileMeta, 0, len(metas.ConfigItems))\n\tfor _, ci := range metas.ConfigItems {\n\t\tif req.Key != \"\" && !tools.MatchConfigItem(req.Key, ci.ConfigItemSpec.Path, ci.ConfigItemSpec.Name) {\n\t\t\tcontinue\n\t\t}\n\t\tapp, err := s.bll.AppCache().GetMeta(im.Kit, req.BizId, ci.ConfigItemAttachment.AppId)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Aborted, \"get app meta failed, %s\", err.Error())\n\t\t}\n\t\tif match, err := s.bll.Auth().CanMatchCI(im.Kit, req.BizId, app.Name, req.Token, ci.ConfigItemSpec); err != nil || !match {\n\t\t\tlogs.Errorf(\"no permission to access config item %d, err: %v\", ci.RciId, err)\n\t\t\treturn nil, status.Errorf(codes.PermissionDenied, \"no permission to access config item %d\", ci.RciId)\n\t\t}\n\t\tfileMetas = append(fileMetas, &pbfs.FileMeta{\n\t\t\tId: ci.RciId,\n\t\t\tCommitId: ci.CommitID,\n\t\t\tCommitSpec: ci.CommitSpec,\n\t\t\tConfigItemSpec: ci.ConfigItemSpec,\n\t\t\tConfigItemAttachment: ci.ConfigItemAttachment,\n\t\t\tRepositorySpec: &pbfs.RepositorySpec{\n\t\t\t\tPath: ci.RepositorySpec.Path,\n\t\t\t},\n\t\t})\n\t}\n\tresp := &pbfs.PullAppFileMetaResp{\n\t\tReleaseId: metas.ReleaseId,\n\t\tRepository: &pbfs.Repository{\n\t\t\tRoot: metas.Repository.Root,\n\t\t},\n\t\tFileMetas: fileMetas,\n\t\tPreHook: metas.PreHook,\n\t\tPostHook: metas.PostHook,\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "0f967008d7acc45f64edbe42a7fad8dc", "score": "0.4646098", "text": "func (m *MockStore) IndexPackages(arg0 context.Context, arg1 []*claircore.Package, arg2 *claircore.Layer, arg3 VersionedScanner) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IndexPackages\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "828fe98227b93a8f0991082a9a5ca544", "score": "0.46425402", "text": "func (m *MockCachedDiscoveryInterface) ServerResourcesForGroupVersion(groupVersion string) (*v1.APIResourceList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServerResourcesForGroupVersion\", groupVersion)\n\tret0, _ := ret[0].(*v1.APIResourceList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c466c0799950f366c60620b8ad81f57f", "score": "0.46410492", "text": "func (m *MockServerResourcesInterface) ServerResourcesForGroupVersion(groupVersion string) (*v1.APIResourceList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServerResourcesForGroupVersion\", groupVersion)\n\tret0, _ := ret[0].(*v1.APIResourceList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "73043c1fda4792927a444fd7f5c444d4", "score": "0.46363372", "text": "func (m *MockInstanceServer) GetStoragePoolVolumeBackupNames(pool, volName string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetStoragePoolVolumeBackupNames\", pool, volName)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "427b4aa69f69c0b360f31fd59d974ba4", "score": "0.46276435", "text": "func getFiles(client *http.Client, otp, clusteraddress, jsName string) ([]types.FileInfo, error) {\n\trequest := fmt.Sprintf(\"%s/jsession/%s/staging/files\", clusteraddress, jsName)\n\tlog.Println(\"Requesting:\" + request)\n\tresp, err := http_helper.UberGet(client, otp, request)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tos.Exit(1)\n\t}\n\tdefer resp.Body.Close()\n\n\tdecoder := json.NewDecoder(resp.Body)\n\tvar fileinfo []types.FileInfo\n\tif err := decoder.Decode(&fileinfo); err != nil {\n\t\treturn fileinfo, err\n\t}\n\treturn fileinfo, nil\n}", "title": "" }, { "docid": "5997f6411fe1797f489a5900613beb6e", "score": "0.46242347", "text": "func GenAppBootstrapFile(basePackage string) error {\n\n\tvar start = time.Now()\n\n\tlib.EnsureDir(lib.AppServicesDir)\n\tlib.EnsureDir(lib.CoreServicesDir)\n\n\tvar files []os.FileInfo\n\tvar e error\n\tfiles, _ = ioutil.ReadDir(lib.CoreServicesDir)\n\tpackages := []string{}\n\tfor k := range files {\n\t\tif files[k].IsDir() {\n\t\t\tpackages = append(packages, path.Join(lib.CoreServicesDir, files[k].Name()))\n\t\t}\n\t}\n\n\tfiles, _ = ioutil.ReadDir(lib.AppServicesDir)\n\tfor k := range files {\n\t\tif files[k].IsDir() {\n\t\t\tpackages = append(packages, path.Join(lib.AppServicesDir, files[k].Name()))\n\t\t}\n\t}\n\n\t// Write Definitions file\n\tvar sb strings.Builder\n\n\tsb.WriteString(`// DO NOT EDIT; Auto generated\npackage services\n\nimport (\n\t\"log\"\n\t\"` + path.Join(basePackage, \"core/app\") + `\" \n`)\n\n\tfor k := range packages {\n\t\tsb.WriteString(\"\\t\\\"\" + path.Join(basePackage, packages[k]) + \"\\\"\\n\")\n\t}\n\n\tsb.WriteString(`)\n\n// App is a container for the services layer down\ntype App struct { \n\t*app.BaseApp \n\tServices *Services \n}\n\n// Services is a container for all services \ntype Services struct {\n`)\n\tfor k := range packages {\n\t\tpackageName := path.Base(packages[k])\n\t\tsb.WriteString(\"\\t\" + strings.ToUpper(packageName[0:1]) + packageName[1:] + \" *\" + packageName + \".Services\\n\")\n\t}\n\tsb.WriteString(`}\n\n// InitAppFromCLI initializes the application (presumably from the command line)\nfunc InitAppFromCLI(\n\tconfigFilePath, \n\tappName, \n\tversion, \n\tcommitHash, \n\tbuildDate, \n\tclientVersion string,\n) *App { \n\t\n\tif len(appName) == 0 { \n\t\tlog.Fatal(\"App name cannot be empty\") \n\t}\n\n\tbaseApp, coreRepos, authLog := app.NewBaseApp(configFilePath, appName, version, commitHash, buildDate, clientVersion) \n\n\tapp := &App { \n\t\tBaseApp: baseApp, \n\t}\n\n\tapp.Services = &Services {`)\n\tfor k := range packages {\n\t\tpackageName := path.Base(packages[k])\n\t\tsb.WriteString(\"\\n\\t\\t\" + strings.ToUpper(packageName[0:1]) + packageName[1:] + \": \" + packageName + \".NewServices(app.DAL, app.Config, app.Integrations, authLog, coreRepos, app.Cache),\")\n\t}\n\tsb.WriteString(`\n\t}\n\n\treturn app\n} \n\n// Finish cleans up any connections from the app\nfunc (a *App) Finish() {\n\tfor schemaName := range a.Integrations.DB {\n\t\tfor k := range a.Integrations.DB[schemaName] {\n\t\t\ta.Integrations.DB[schemaName][k].Close()\n\t\t}\n\t}\n}\n`)\n\tvar bootstrapDir = filepath.Dir(lib.AppBootstrapFile)\n\tlib.EnsureDir(bootstrapDir)\n\n\tioutil.WriteFile(lib.AppBootstrapFile, []byte(sb.String()), 0777)\n\n\tfmt.Printf(\"Generated app bootstrap file to %s in %f seconds\\n\", lib.AppBootstrapFile, time.Since(start).Seconds())\n\n\treturn e\n}", "title": "" }, { "docid": "63a9e86512a9d1fb6d7fe99865792747", "score": "0.46222407", "text": "func TestGetFilesListInvalidPath(t *testing.T) {\n testpath, _ := createTestParamValue(\"GetFilesList\", \"path\", \"string\").(string)\n teststorageName, _ := createTestParamValue(\"GetFilesList\", \"storageName\", \"string\").(string)\n\n invalidValue := invalidizeTestParamValue(testpath, \"GetFilesList\", \"path\", \"string\")\n if (invalidValue == nil) {\n var nullValue string\n testpath = nullValue\n } else {\n testpath, _ = invalidValue.(string)\n }\n\n e := InitializeTest(\"GetFilesList\", \"path\", testpath)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n _, r, e := GetTestApiClient().SlidesApi.GetFilesList(testpath, teststorageName)\n statusCode := 400\n if r != nil {\n statusCode = r.StatusCode\n }\n assertError(t, \"GetFilesList\", \"path\", \"string\", testpath, int32(statusCode), e)\n}", "title": "" }, { "docid": "b6f0eea87114eb49537f2db30c43e1f2", "score": "0.46170166", "text": "func (i *Inventory) Files(version string) ([]File, error) {\n\tvar files []File\n\tv, ok := i.Versions[version]\n\tif !ok {\n\t\treturn files, fmt.Errorf(\"no version present named %s in %s\", version, i.ID)\n\t}\n\n\tfor digest, state := range v.State {\n\t\tfor _, lpath := range state {\n\n\t\t\tppaths, ok := i.Manifest[digest]\n\t\t\tif !ok {\n\t\t\t\treturn files, fmt.Errorf(\"no manifest entry for file %s (%s: %s) in %s of %s\",\n\t\t\t\t\tlpath, i.DigestAlgorithm, digest, version, i.ID)\n\t\t\t}\n\t\t\tif len(ppaths) == 0 {\n\t\t\t\treturn files, fmt.Errorf(\"no physical files for %s (%s: %s) in %s of %s\",\n\t\t\t\t\tlpath, i.DigestAlgorithm, digest, version, i.ID)\n\t\t\t}\n\n\t\t\tppath := ppaths[0]\n\n\t\t\t// If there is more than one path, then return the\n\t\t\t// lexically greatest one that starts with the current version\n\t\t\t// prefix, or an earlier version prefix\n\t\t\tif len(ppaths) > 1 {\n\t\t\t\tspaths := make([]string, len(ppaths))\n\t\t\t\tprefix := version + \"/\"\n\t\t\t\tfor _, p := range ppaths {\n\t\t\t\t\tif version > p || strings.HasPrefix(p, prefix) {\n\t\t\t\t\t\tspaths = append(spaths, p)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsort.Strings(spaths)\n\n\t\t\t\tif len(spaths) > 0 {\n\t\t\t\t\tppath = spaths[len(spaths)-1]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfiles = append(files, File{\n\t\t\t\tVersion: &v,\n\t\t\t\tInventory: i,\n\t\t\t\tLogicalPath: lpath,\n\t\t\t\tPhysicalPath: ppath,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "a969f5228a42e0598aced03842ca1db8", "score": "0.4613571", "text": "func (m *MockClient) TechnicalReviewAppVersion(ctx context.Context, in *pb.ReviewAppVersionRequest, opts ...grpc.CallOption) (*pb.ReviewAppVersionResponse, 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, \"TechnicalReviewAppVersion\", varargs...)\n\tret0, _ := ret[0].(*pb.ReviewAppVersionResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ef4df6fbbfac633b0afcefc3682be165", "score": "0.46118835", "text": "func (_m *FilesService) ListFiles(userId *int, isPublic *bool, page int, limit int) ([]dto.FilePublic, error) {\n\tret := _m.Called(userId, isPublic, page, limit)\n\n\tvar r0 []dto.FilePublic\n\tif rf, ok := ret.Get(0).(func(*int, *bool, int, int) []dto.FilePublic); ok {\n\t\tr0 = rf(userId, isPublic, page, limit)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]dto.FilePublic)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*int, *bool, int, int) error); ok {\n\t\tr1 = rf(userId, isPublic, page, limit)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a90a495183b5d510a2d2c46acdc83232", "score": "0.46103504", "text": "func revendorPackages(a app.App, pm registry.PackageManager, e *app.EnvironmentConfig) (path string, cleanup func() error, err error) {\n\tlog := log.WithField(\"action\", \"env.revendorPackages\")\n\n\tnoop := func() error { return nil }\n\n\tif a == nil {\n\t\treturn \"\", noop, errors.Errorf(\"nil app\")\n\t}\n\tif pm == nil {\n\t\treturn \"\", nil, errors.Errorf(\"nil package manager\")\n\t}\n\tif e == nil {\n\t\treturn \"\", noop, errors.Errorf(\"nil environment\")\n\t}\n\tfs := a.Fs()\n\tif fs == nil {\n\t\treturn \"\", noop, errors.Errorf(\"nil filesystem interface\")\n\t}\n\n\t// Enumerate packages\n\tpathByPkg, err := buildPackagePaths(pm, e)\n\tif err != nil {\n\t\treturn \"\", noop, err\n\t}\n\n\t// Build our temporary space\n\ttmpDir, err := afero.TempDir(fs, \"\", \"ksvendor\")\n\tif err != nil {\n\t\treturn \"\", noop, errors.Wrap(err, \"creating temporary vendor path\")\n\t}\n\tshouldCleanup := true // Used to decide whether we should cleanup in our defer or handoff responsibility to our callers\n\tinternalCleanFunc := func() error {\n\t\tif !shouldCleanup {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fs.RemoveAll(tmpDir)\n\t}\n\tdefer internalCleanFunc()\n\n\t// Copy each package to our temp directory destined for import,\n\t// removing version information from the path.\n\t// This allows our consumers to import the package with a version-agnostic import specifier.\n\tfor k, srcPath := range pathByPkg {\n\t\tif srcPath == \"\" {\n\t\t\tlog.Warnf(\"skipping package %v\", k)\n\t\t\tcontinue\n\t\t}\n\t\t// Check for missing package.\n\t\t// There are two common causes:\n\t\t// 1. It is installed but in an unversioned path - the app hasn't been upgraded.\n\t\t// 2. It is actually missing - the vendor cache needs to be refreshed.\n\t\t// Currently we assume #1 and skip revendoring - it can be imported from the legacy path.\n\t\tok, err := afero.Exists(fs, srcPath)\n\t\tif err != nil {\n\t\t\treturn \"\", noop, err\n\t\t}\n\t\tif !ok {\n\t\t\t// TODO differentiate between above cases #1 and #2.\n\t\t\tlog.Warnf(\"skipping missing path %v. Please run `ks upgrade`.\", srcPath)\n\t\t\tcontinue\n\t\t}\n\n\t\tdstPath := filepath.Join(tmpDir, filepath.FromSlash(k))\n\t\tlog.Debugf(\"preparing package %v->%v\", srcPath, dstPath)\n\t\tif err := utilio.CopyRecursive(fs, dstPath, srcPath, app.DefaultFilePermissions, app.DefaultFolderPermissions); err != nil {\n\t\t\treturn \"\", noop, errors.Wrapf(err, \"copying package %v->%v\", srcPath, dstPath)\n\t\t}\n\t}\n\n\t// Signal to our deferred cleanup function that our caller is now\n\t// the responsible party for cleaning up the temp directory.\n\tshouldCleanup = false\n\tcallerCleanFunc := func() error {\n\t\treturn fs.RemoveAll(tmpDir)\n\t}\n\treturn tmpDir, callerCleanFunc, nil\n}", "title": "" }, { "docid": "274cb631c25cccebe170f34b3cd1d55a", "score": "0.46076733", "text": "func expandVersionDeploymentFilesSlice(c *Client, f []VersionDeploymentFiles) ([]map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := []map[string]interface{}{}\n\tfor _, item := range f {\n\t\ti, err := expandVersionDeploymentFiles(c, &item)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titems = append(items, i)\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "d4a6916800efb2f4c907d096b3803c29", "score": "0.46030074", "text": "func GetAppInfoForAppPath(appPath string) (files *utils.VulhubAppDBStruct) {\n\tfor _, datum := range utils.VulhubDBs {\n\t\tif datum.Path == appPath {\n\t\t\treturn &datum\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a4e140ff7f223033c4a7a28972e6f508", "score": "0.46005142", "text": "func (c *MockConfig) GetServerCertFiles() []string {\n\treturn nil\n}", "title": "" }, { "docid": "ae637bdb7a8672ba8d6b07e7dc646a6f", "score": "0.45957366", "text": "func extractPackageNameFromEggBase(eggBase string) ([]byte, error) {\n\tfiles, err := os.ReadDir(eggBase)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, file := range files {\n\t\tif strings.HasSuffix(file.Name(), \".egg-info\") {\n\t\t\tpkginfoPath := filepath.Join(eggBase, file.Name(), \"PKG-INFO\")\n\t\t\t// Read PKG-INFO file.\n\t\t\tpkginfoFileExists, err := utils.IsFileExists(pkginfoPath, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !pkginfoFileExists {\n\t\t\t\treturn nil, errors.New(\"file 'PKG-INFO' couldn't be found in its designated location: \" + pkginfoPath)\n\t\t\t}\n\n\t\t\treturn os.ReadFile(pkginfoPath)\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"couldn't find pkg info files\")\n}", "title": "" }, { "docid": "c0eb7797776fa4e4112f7680e4b68a5c", "score": "0.45946825", "text": "func (m *customModule) OutputFiles(tag string) (android.Paths, error) {\n\treturn android.PathsForTesting(\"path\" + tag), nil\n}", "title": "" }, { "docid": "3063b546c993473098764a9d88c5d995", "score": "0.4591611", "text": "func BuildRepositoryFiles(ctx context.Context, ownerID int64) error {\n\tpv, err := GetOrCreateRepositoryVersion(ownerID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpfs, _, err := packages_model.SearchFiles(ctx, &packages_model.PackageFileSearchOptions{\n\t\tOwnerID: ownerID,\n\t\tPackageType: packages_model.TypeRpm,\n\t\tQuery: \"%.rpm\",\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Delete the repository files if there are no packages\n\tif len(pfs) == 0 {\n\t\tpfs, err := packages_model.GetFilesByVersionID(ctx, pv.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, pf := range pfs {\n\t\t\tif err := packages_model.DeleteAllProperties(ctx, packages_model.PropertyTypeFile, pf.ID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := packages_model.DeleteFileByID(ctx, pf.ID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Cache data needed for all repository files\n\tcache := make(packageCache)\n\tfor _, pf := range pfs {\n\t\tpv, err := packages_model.GetVersionByID(ctx, pf.VersionID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp, err := packages_model.GetPackageByID(ctx, pv.PackageID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpb, err := packages_model.GetBlobByID(ctx, pf.BlobID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpps, err := packages_model.GetPropertiesByName(ctx, packages_model.PropertyTypeFile, pf.ID, rpm_module.PropertyMetadata)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpd := &packageData{\n\t\t\tPackage: p,\n\t\t\tVersion: pv,\n\t\t\tBlob: pb,\n\t\t}\n\n\t\tif err := json.Unmarshal([]byte(pv.MetadataJSON), &pd.VersionMetadata); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(pps) > 0 {\n\t\t\tif err := json.Unmarshal([]byte(pps[0].Value), &pd.FileMetadata); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tcache[pf] = pd\n\t}\n\n\tprimary, err := buildPrimary(pv, pfs, cache)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilelists, err := buildFilelists(pv, pfs, cache)\n\tif err != nil {\n\t\treturn err\n\t}\n\tother, err := buildOther(pv, pfs, cache)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn buildRepomd(\n\t\tpv,\n\t\townerID,\n\t\t[]*repoData{\n\t\t\tprimary,\n\t\t\tfilelists,\n\t\t\tother,\n\t\t},\n\t)\n}", "title": "" }, { "docid": "447c0e8aa11f61de8aba13f69ff3f8a3", "score": "0.45903897", "text": "func getAllPackages_test1() delivery.Packages {\n\n\tallPackages := make(delivery.Packages, 0)\n\tallPackages = append(allPackages, delivery.NewPackage(\"PKG1\", 100, 30, 50, delivery.MockAllDiscounts().GetDiscountByCoupon([]string{\"OFR001\"})))\n\tallPackages = append(allPackages, delivery.NewPackage(\"PKG2\", 100, 125, 75, delivery.MockAllDiscounts().GetDiscountByCoupon([]string{\"OFR008\"})))\n\tallPackages = append(allPackages, delivery.NewPackage(\"PKG3\", 100, 100, 175, delivery.MockAllDiscounts().GetDiscountByCoupon([]string{\"OFR003\"})))\n\tallPackages = append(allPackages, delivery.NewPackage(\"PKG4\", 100, 60, 110, delivery.MockAllDiscounts().GetDiscountByCoupon([]string{\"OFR002\"})))\n\tallPackages = append(allPackages, delivery.NewPackage(\"PKG5\", 100, 95, 155, delivery.MockAllDiscounts().GetDiscountByCoupon([]string{\"NA\"})))\n\n\treturn allPackages\n}", "title": "" } ]
2fa04046b93f73b834d9b19b81e45832
Add a new compute node and return it as well.
[ { "docid": "b00f546eeaf40c00726d0db573ab49e9", "score": "0.5404433", "text": "func AddNode(name string, ssh ...string) error {\n\tnode := &Node{name, nil, ssh, []*Device{}}\n\tnodes = append(nodes, node)\n\tnode.Autoconf()\n\treturn node.err\n}", "title": "" } ]
[ { "docid": "8d0df299b38c2e78f4cfa6b800e85cf1", "score": "0.64409053", "text": "func (o *Operator) AddNode(n *v2.CiliumNode) error {\n\to.Lock()\n\tdefer o.Unlock()\n\n\tif option.Config.EnableIPv4 {\n\t\tif err := o.allocateIP(n, types.IPv4); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif option.Config.EnableIPv6 {\n\t\tif err := o.allocateIP(n, types.IPv6); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "14f6e47a9634b10dedd87636d63c4963", "score": "0.62358886", "text": "func (hr *CONSISTENT_HASH) ADD_NEW_NODE(node *Node) bool { \r\n \r\n if _, ok := hr.IsPresent[node.Id]; ok { \r\n return false \r\n } \r\n str := hr.RETURN_IP(node) \r\n hr.Nodes[hr.GET_HV(str)] = *(node)\r\n hr.IsPresent[node.Id] = true \r\n hr.SORT_HASH_CIRCLE() \r\n return true \r\n}", "title": "" }, { "docid": "9643373e5336248d5dd8e449fc1adf34", "score": "0.61975586", "text": "func (c *Cluster) Add(n Node) (string, bool) {\n c.C <- struct{}{}\n defer func() {\n <- c.C\n }()\n\n name := fmt.Sprintf(\"%s:%d\", n.Ip, n.Port)\n\n if _, ok := c.Nodes[name]; ok {\n return name, false\n }\n\n c.Nodes[name] = n\n\n // Formula to compute majority\n c.Majority = uint((len(c.Nodes) / 2) + 1)\n\n return name, true\n}", "title": "" }, { "docid": "4c986ea0beb8d9c80e1d138bc1989a22", "score": "0.6194781", "text": "func (cluster *Cluster) AddNode(nd *node.Node) {\n cluster.nodes[nd.GetName()] = nd\n}", "title": "" }, { "docid": "1b4e16ad8c539befdecd9226834c3134", "score": "0.61439836", "text": "func (s *server) ComputeAdd(ctx context.Context, request *proto.Request) (*proto.Response, error) {\n\ta, b := request.GetA(), request.GetB()\n\tlog.Println(\"Got the Request for sum of \", a, b)\n\tresult := a + b\n\treturn &proto.Response{Result: result}, nil\n}", "title": "" }, { "docid": "5a1100d9f48dfaf329997b861d7cfebf", "score": "0.5886986", "text": "func (c *Cluster) addNewNodeWithStore() {\n\tnodeID := proto.NodeID(len(c.nodes))\n\tc.nodes[nodeID] = newNode(nodeID, c.gossip)\n\tc.addStore(nodeID)\n}", "title": "" }, { "docid": "1111ed29a65a133f433243f99d536c78", "score": "0.58295465", "text": "func (v *vibranium) AddNode(ctx context.Context, opts *pb.AddNodeOptions) (*pb.Node, error) {\n\tn, err := v.cluster.AddNode(\n\t\topts.Nodename,\n\t\topts.Endpoint,\n\t\topts.Podname,\n\t\topts.Ca,\n\t\topts.Cert,\n\t\topts.Key,\n\t\tint(opts.Cpu),\n\t\topts.Share,\n\t\topts.Memory,\n\t\topts.Labels,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn toRPCNode(n), nil\n}", "title": "" }, { "docid": "7380b40df9cb41162b201f625d37f2e9", "score": "0.5801593", "text": "func (c *Cluster) AddNode(public bool, req *pb.HostDefinition) (string, error) {\n\thosts, err := c.AddNodes(1, public, req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hosts[0], nil\n}", "title": "" }, { "docid": "95fa575f896dd8465bf05eda859c4543", "score": "0.57835895", "text": "func (c *ConsistentHash) AddNode(nodeName string) {\n newNodes := make([]INode, c.VNodeCount)\n for i := 0; i < c.VNodeCount; i++ {\n newNodes[i] = NewVNode(nodeName, i)\n }\n\n c.mtx.Lock()\n defer c.mtx.Unlock()\n\n for _, node := range newNodes {\n hash := c.HashF([]byte(node.Name()))\n bRet := c.nodes.Exist(hash)\n if !bRet {\n c.nodes.Set(hash, node)\n }\n }\n}", "title": "" }, { "docid": "fa32367d134d2eee360d0c5fc492327b", "score": "0.5762334", "text": "func (store *store) AddNode(hostPort, serverPub, clientCert string, walletID int) (int64, error) {\n\tstmt, err := store.db.Prepare(\"INSERT INTO nodes(host_port, server_pub, client_cert, wallet_id, enabled) values(?,?,?,?,?)\")\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tres, err := stmt.Exec(hostPort, serverPub, clientCert, walletID, \"1\")\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "7fc33877da104a14e5c8b5118eaa0ffd", "score": "0.5760623", "text": "func (con *Consistent) Add(node string) {\n\tkey := con.hash(node) % con.maxSlot\n\n\tcon.nodes[key] = node\n\tcon.keys = append(con.keys, key)\n\n\t// sort keys so we can use binary search for clockwise closest node\n\tsort.Ints(con.keys)\n}", "title": "" }, { "docid": "78dc0ba89af7e0616d629cb661db6200", "score": "0.5728582", "text": "func (g *Graph) Add(node string) {\n\tg.nodes[node] = true\n}", "title": "" }, { "docid": "77b4bc6100968fdd32579f8c17900f8d", "score": "0.571752", "text": "func (r *Service) AddNode(addr string) error {\n\tif r.GetClusterID() == 0 {\n\t\treturn fmt.Errorf(\"Cluster mode must be initialized first\")\n\t}\n\tcm := r.GetMembershipChangeMode()\n\tif cm != Stable {\n\t\treturn fmt.Errorf(\"Prior membership change not complete. Mode = %s\", cm)\n\t}\n\n\tglog.V(2).Infof(\"Discovering node at %s\", addr)\n\tnodeID, err := r.comm.Discover(addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error discovering new node at %s: %s\", addr, err)\n\t}\n\n\tif r.GetNodeConfig().GetNode(nodeID) != nil {\n\t\treturn fmt.Errorf(\"Node %s is already part of cluster %s\", nodeID, r.GetClusterID())\n\t}\n\n\tglog.V(2).Infof(\"Catching node %s up with existing data\", nodeID)\n\terr = r.catchUpNode(addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error catching up node %s: %s\", nodeID, err)\n\t}\n\n\tglog.V(2).Infof(\"Proposing node %s as a new member\", nodeID)\n\n\tcfg := r.GetNodeConfig()\n\tnewCfg := &NodeList{\n\t\tCurrent: cfg.Current,\n\t\tNext: cfg.Current,\n\t}\n\tnewNode := Node{\n\t\tAddress: addr,\n\t\tNodeID: nodeID,\n\t}\n\tnewCfg.Next = append(newCfg.Next, newNode)\n\n\tproposedEntry := common.Entry{\n\t\tType: MembershipChange,\n\t\tData: newCfg.encode(),\n\t}\n\n\tglog.V(2).Infof(\"Proposing joint configuration: %s\", newCfg)\n\tix, err := r.Propose(&proposedEntry)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = r.WaitForCommit(ix)\n\tif err != nil {\n\t\t// TODO recovery?\n\t\treturn err\n\t}\n\n\tfinalCfg := &NodeList{\n\t\tCurrent: newCfg.Next,\n\t}\n\n\tproposedEntry = common.Entry{\n\t\tType: MembershipChange,\n\t\tData: finalCfg.encode(),\n\t}\n\n\tglog.V(2).Infof(\"Proposing final configuration: %s\", newCfg)\n\tix, err = r.Propose(&proposedEntry)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = r.WaitForCommit(ix)\n\tif err != nil {\n\t\t// TODO recovery?\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c3df62ce9372efeb967bbebea7a2bfc", "score": "0.56857747", "text": "func (c *Cluster) AddNode(n *Node) error {\n\tif n == nil {\n\t\treturn ErrClusterNodeMustBeNonNil\n\t}\n\tc.Lock()\n\tdefer c.Unlock()\n\tfor _, node := range c.nodes {\n\t\tif n == node {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif c.isCurrentState(clusterRunning) {\n\t\tif err := n.start(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tc.nodes = append(c.nodes, n)\n\treturn nil\n}", "title": "" }, { "docid": "69c32bcfe125413cb2f0b249449b6bc3", "score": "0.56576306", "text": "func (env Env) AddNode(c *cli.Context) error {\n\tproject, err := env.GetProject()\n\tutil.CheckErrFatal(err)\n\tmaster := GetMaster(env.API)\n\tutil.CheckErrFatal(err)\n\tnode := GetNewNode(project)\n\tenv.SendToAPI(\"add-node\", &node)\n\tcmd := sctl.MinionCommand{\n\t\tMinion: node,\n\t\tCommand: JoinSwarmCommand(project, master),\n\t}\n\tenv.SetupNode(node)\n\tfmt.Println(env.SendToAPI(\"init-minion\", cmd))\n\treturn nil\n}", "title": "" }, { "docid": "c7fad4e2ac8a7b15958216c5ad840b83", "score": "0.5646748", "text": "func (s *Solution) addNewNode(nodeId string) {\n\n\tnode := newIndexerNode(nodeId, s.sizing)\n\ts.Placement = append(s.Placement, node)\n\ts.estimationOn()\n}", "title": "" }, { "docid": "4356d1b9e91542a41732daeff4bbdf04", "score": "0.5634523", "text": "func (g *Builder) Add(node rnode.Builder) { g.nodes[node.ID().MapKey()] = node }", "title": "" }, { "docid": "f49af4bdb5ae5b9bf2ce5453551ce01c", "score": "0.56265044", "text": "func AddNode(node *Node) (*Node, error) {\n\tif !knownNodes.contains(node) {\n\t\tif node.status == StatusUnknown {\n\t\t\tlogWarn(node.Address(),\n\t\t\t\t\"does not have a status! Setting to\",\n\t\t\t\tStatusAlive)\n\n\t\t\tUpdateNodeStatus(node, StatusAlive, thisHost)\n\t\t} else if node.status == StatusForwardTo {\n\t\t\tpanic(\"invalid status: \" + StatusForwardTo.String())\n\t\t}\n\n\t\tnode.Touch()\n\n\t\t_, n, err := knownNodes.add(node)\n\n\t\tlogfInfo(\"Adding host: %s (total=%d live=%d dead=%d)\",\n\t\t\tnode.Address(),\n\t\t\tknownNodes.length(),\n\t\t\tknownNodes.lengthWithStatus(StatusAlive),\n\t\t\tknownNodes.lengthWithStatus(StatusDead))\n\n\t\tknownNodesModifiedFlag = true\n\n\t\treturn n, err\n\t}\n\n\treturn node, nil\n}", "title": "" }, { "docid": "391d028bbcd5e3bde20968d1a006eafc", "score": "0.5611961", "text": "func (c *Client) AddNode(nodeAddress string) int {\n\tvar count int\n\terr := c.client.Call(\"NodeRegistery.AddNode\", nodeAddress, &count)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn count\n}", "title": "" }, { "docid": "cc53febf64e2df2d0bf28d2c622bc97b", "score": "0.5591155", "text": "func (v *Vibranium) AddNode(ctx context.Context, opts *pb.AddNodeOptions) (*pb.Node, error) {\n\taddNodeOpts := toCoreAddNodeOptions(opts)\n\tn, err := v.cluster.AddNode(ctx, addNodeOpts)\n\tif err != nil {\n\t\treturn nil, grpcstatus.Error(AddNode, err.Error())\n\t}\n\n\treturn toRPCNode(n), nil\n}", "title": "" }, { "docid": "ca15e56d330b063b36daa802b68888fa", "score": "0.5582771", "text": "func (sp *ScyllaClusterProvider) AddNode(clusterID string, nodeID string) derrors.Error {\n\n\tsp.Lock()\n\tdefer sp.Unlock()\n\n\tif err := sp.checkAndConnect(); err != nil {\n\t\treturn err\n\t}\n\n\texists, err := sp.unsafeExists(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn derrors.NewNotFoundError(\"node\").WithParams(clusterID)\n\t}\n\n\t// check if the node exists in the cluster\n\texists, err = sp.unsafeNodeExists(clusterID, nodeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn derrors.NewAlreadyExistsError(\"node\").WithParams(clusterID, nodeID)\n\t}\n\n\t// insert the node instance\n\tstmt, names := qb.Insert(clusterNodeTable).Columns(\"cluster_id\", \"node_id\").ToCql()\n\tq := gocqlx.Query(sp.Session.Query(stmt), names).BindMap(qb.M{\n\t\t\"cluster_id\": clusterID,\n\t\t\"node_id\": nodeID})\n\n\tcqlErr := q.ExecRelease()\n\n\tif cqlErr != nil {\n\t\treturn derrors.AsError(cqlErr, \"cannot add node\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a25a29efe472fa68ddd22b482bf90f6", "score": "0.55642605", "text": "func (ctx *Context) AddNode(node string) {\n\tctx.mu.Lock()\n\tdefer ctx.mu.Unlock()\n\tctx.nodes[node] = true\n\tctx.workLoad[node] = make(chan bool, 2)\n}", "title": "" }, { "docid": "fd423630a33c79e782220fe8b7dd1979", "score": "0.55411553", "text": "func ComputeNode(seed []byte, path Path) (*Node, error) {\n\t// Check Path Size\n\tif len(path) != pathSize {\n\t\treturn nil, errors.New(\"ComputeNode: path has wrong length\")\n\t}\n\n\t// Create Master node\n\tn, err := NewMasterNode(seed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Iterate path and Compute children\n\tfor _, idx := range path {\n\t\terr := n.ComputeHardenedChild(idx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn n, nil\n}", "title": "" }, { "docid": "9dfa05b0c9520ff1a43f24b43ad4a612", "score": "0.5526398", "text": "func (client *Client) AddNode(ctx context.Context, memberAddress PeerAddress, newMemberConfig NodeConfig) error {\n encodedNodeConfig, _ := json.Marshal(newMemberConfig)\n _, err := client.sendRequest(ctx, \"POST\", memberAddress.ToHTTPURL(\"/cluster/nodes\"), encodedNodeConfig)\n\n if _, ok := err.(*ErrorStatusCode); ok {\n var dbError DBerror\n\n parseErr := json.Unmarshal([]byte(err.(*ErrorStatusCode).Message), &dbError)\n\n if parseErr == nil {\n return dbError\n }\n }\n\n return err\n}", "title": "" }, { "docid": "e123e17ea2a1c081a1fd9bb43dbc2090", "score": "0.55064726", "text": "func (m *ociManagerImpl) GetExistingNodePoolSizeViaCompute(np NodePool) (int, error) {\n\tklog.V(4).Infof(\"getting nodes for node pool: %q\", np.Id())\n\tnodePoolDetails, err := m.nodePoolCache.get(np.Id())\n\tif err != nil {\n\t\tklog.V(4).Error(err, \"error fetching detailed nodepool from cache\")\n\t\treturn math.MaxInt32, err\n\t}\n\trequest := core.ListInstancesRequest{\n\t\tCompartmentId: nodePoolDetails.CompartmentId,\n\t\tLimit: common.Int(500),\n\t}\n\n\tdisplayNamePrefix := getDisplayNamePrefix(*nodePoolDetails.ClusterId, *nodePoolDetails.Id)\n\tklog.V(5).Infof(\"Filter used is prefix %q\", displayNamePrefix)\n\n\tlistInstancesFunc := func(request core.ListInstancesRequest) (core.ListInstancesResponse, error) {\n\t\treturn m.computeClient.ListInstances(context.Background(), request)\n\t}\n\n\tvar instances []cloudprovider.Instance\n\n\tfor r, err := listInstancesFunc(request); ; r, err = listInstancesFunc(request) {\n\t\tif err != nil {\n\t\t\tklog.V(5).Error(err, \"error while performing listInstancesFunc call\")\n\t\t\treturn math.MaxInt32, err\n\t\t}\n\t\tfor _, item := range r.Items {\n\t\t\tklog.V(6).Infof(\"checking instance %q (instance ocid: %q) in state %q\", *item.DisplayName, *item.Id, item.LifecycleState)\n\t\t\tif !strings.HasPrefix(*item.DisplayName, displayNamePrefix) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch item.LifecycleState {\n\t\t\tcase core.InstanceLifecycleStateStopped, core.InstanceLifecycleStateTerminated:\n\t\t\t\tklog.V(4).Infof(\"skipping instance is in stopped/terminated state: %q\", *item.Id)\n\t\t\tcase core.InstanceLifecycleStateCreatingImage, core.InstanceLifecycleStateStarting, core.InstanceLifecycleStateProvisioning, core.InstanceLifecycleStateMoving:\n\t\t\t\tinstances = append(instances, cloudprovider.Instance{\n\t\t\t\t\tId: *item.Id,\n\t\t\t\t\tStatus: &cloudprovider.InstanceStatus{\n\t\t\t\t\t\tState: cloudprovider.InstanceCreating,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t// in case an instance is running, it could either be installing OKE software or become a Ready node.\n\t\t\t// we do not know, but as we only need info if a node is stopped / terminated, we do not care\n\t\t\tcase core.InstanceLifecycleStateRunning:\n\t\t\t\tinstances = append(instances, cloudprovider.Instance{\n\t\t\t\t\tId: *item.Id,\n\t\t\t\t\tStatus: &cloudprovider.InstanceStatus{\n\t\t\t\t\t\tState: cloudprovider.InstanceRunning,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\tcase core.InstanceLifecycleStateStopping, core.InstanceLifecycleStateTerminating:\n\t\t\t\tinstances = append(instances, cloudprovider.Instance{\n\t\t\t\t\tId: *item.Id,\n\t\t\t\t\tStatus: &cloudprovider.InstanceStatus{\n\t\t\t\t\t\tState: cloudprovider.InstanceDeleting,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\tdefault:\n\t\t\t\tklog.Warningf(\"instance found in unhandled state: (%q = %v)\", *item.Id, item.LifecycleState)\n\t\t\t}\n\t\t}\n\n\t\t// pagination logic\n\t\tif r.OpcNextPage != nil {\n\t\t\t// if there are more items in next page, fetch items from next page\n\t\t\trequest.Page = r.OpcNextPage\n\t\t} else {\n\t\t\t// no more result, break the loop\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn len(instances), nil\n}", "title": "" }, { "docid": "3e365da242b72a960bc43a8a285f6b16", "score": "0.5503447", "text": "func (s *Solution) addNewNode(nodeId string) {\n\n\tnode := newIndexerNode(nodeId, s.sizing)\n\ts.Placement = append(s.Placement, node)\n}", "title": "" }, { "docid": "16f9c0882c847000dfe4743c5005b8c3", "score": "0.5497053", "text": "func (c *Cluster) add(n *Node) {\n\tc.members.Add(n.id, n)\n\tn.cluster = c\n}", "title": "" }, { "docid": "dfeb90e0755c6de748f57decee3e6758", "score": "0.5488638", "text": "func (c *Client) AddNode(host string, command AddNodeCommand) error {\n\treturn c.AddNodeAsync(host, command).Receive()\n}", "title": "" }, { "docid": "37c3b01830d7fc28ae94fa94f35f64b7", "score": "0.54847306", "text": "func (n *Network) AddNode(node Node) {\n\n\t// Ensure the network has a nodes list\n\tif n.nodes == nil {\n\t\tn.nodes = make([]Node, 0, 10)\n\t}\n\n\t// Add the node to the slice\n\tn.nodes = append(n.nodes, node)\n\tsort.Sort(n.nodes)\n\n\t// Update the internal counts\n\tswitch node.NodeType() {\n\tcase BIAS:\n\t\tn.biasCount++\n\tcase INPUT:\n\t\tn.inputCount++\n\tcase OUTPUT:\n\t\tn.outputCount++\n\tcase HIDDEN:\n\t\tn.hiddenCount++\n\t}\n}", "title": "" }, { "docid": "6e86a10f9e9e0ea817ad497cb7e1d221", "score": "0.5466364", "text": "func (d *Driver) AddNode(id uint64) {\n\tif _, ok := d.clusterInfo.Nodes[id]; ok {\n\t\tsimutil.Logger.Infof(\"Node %d already existed\", id)\n\t\treturn\n\t}\n\tn, err := NewNode(id, fmt.Sprintf(\"mock://tikv-%d\", id), d.addr)\n\tif err != nil {\n\t\tsimutil.Logger.Debug(\"Add node failed:\", err)\n\t\treturn\n\t}\n\terr = n.Start()\n\tif err != nil {\n\t\tsimutil.Logger.Debug(\"Start node failed:\", err)\n\t\treturn\n\t}\n\tn.clusterInfo = d.clusterInfo\n\td.clusterInfo.Nodes[n.Id] = n\n}", "title": "" }, { "docid": "f56785fb0cdcf34be9a9c991cd0f8624", "score": "0.54433113", "text": "func (na *NodeAdded) Execute(app *config.App) error {\n\tlogger.LogInfo(\"Adding node with NID \" + na.Node.NID)\n\n\tif na.Node.NID == app.Self.NID {\n\t\tlogger.LogInfo(\"NodeAdded.Execute tried to add self, skipping...\")\n\t\treturn nil\n\t}\n\n\tpubKey, err := acrypto.KeyPairFromPubKeyJSON(na.Node.PubKey)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"NodeAdded.Execute failed to KeyPairFromPubKeyJSON\")\n\t}\n\n\tapp.KeySet.AddKeyPair(pubKey)\n\n\t// worker nodes only need to know about the master and their verifier, so skip the rest\n\tif app.Self.Type == model.NodeTypeWorker {\n\t\treturn nil\n\t}\n\n\tif na.Node.Type == model.NodeTypeVerifier {\n\t\tapp.NodeList.AddVerifier(na.Node)\n\t} else if na.Node.Type == model.NodeTypeWorker {\n\t\tapp.NodeList.AddWorker(na.Node)\n\t} else if na.Node.Type == model.NodeTypeMaster {\n\t\tif app.NodeList.Master == nil {\n\t\t\tapp.NodeList.Master = na.Node\n\t\t} else {\n\t\t\tlogger.LogWarn(\"NodeAdded.Execute tried to set a master node when one already exists, skipping...\")\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"NodeAdded.Execute tried to add node with unknown type %q\", na.Node.Type)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9aa0193767e0e3bc0ab5ee9470f79d26", "score": "0.54371446", "text": "func (h *Handler) addNode(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tkname := vars[\"kname\"]\n\tk, err := h.svc.Get(r.Context(), kname)\n\n\t// TODO(stgleb): This method contains a lot of specific stuff, implement provision node\n\t// method for nodeProvisioner to do all things related to provisioning and saving cluster state\n\tif sgerrors.IsNotFound(err) {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tnodeProfiles := make([]profile.NodeProfile, 0)\n\terr = json.NewDecoder(r.Body).Decode(&nodeProfiles)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tacc, err := h.accountService.Get(r.Context(), k.AccountName)\n\n\tif sgerrors.IsNotFound(err) {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tkubeProfile := profile.Profile{\n\t\tProvider: acc.Provider,\n\t\tRegion: k.Region,\n\t\tArch: k.Arch,\n\t\tOperatingSystem: k.OperatingSystem,\n\t\tUbuntuVersion: k.OperatingSystemVersion,\n\t\tDockerVersion: k.DockerVersion,\n\t\tK8SVersion: k.K8SVersion,\n\t\tHelmVersion: k.HelmVersion,\n\n\t\tNetworkType: k.Networking.Type,\n\t\tCIDR: k.Networking.CIDR,\n\t\tFlannelVersion: k.Networking.Version,\n\n\t\tNodesProfiles: []profile.NodeProfile{\n\t\t\t{},\n\t\t},\n\n\t\tRBACEnabled: k.RBACEnabled,\n\t}\n\n\tconfig := steps.NewConfig(k.Name, \"\", k.AccountName, kubeProfile)\n\n\tif len(k.Masters) != 0 {\n\t\tconfig.AddMaster(util.GetRandomNode(k.Masters))\n\t} else {\n\t\thttp.Error(w, \"no master found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Get cloud account fill appropriate config structure with cloud account credentials\n\terr = util.FillCloudAccountCredentials(r.Context(), acc, config)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tctx, _ := context.WithTimeout(context.Background(), time.Minute*10)\n\ttasks, err := h.nodeProvisioner.ProvisionNodes(ctx, nodeProfiles, k, config)\n\n\tif err != nil && sgerrors.IsNotFound(err) {\n\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Respond to client side that request has been accepted\n\tw.WriteHeader(http.StatusAccepted)\n\terr = json.NewEncoder(w).Encode(tasks)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\tlogrus.Error(errors.Wrap(err, \"marshal json\"))\n\t}\n}", "title": "" }, { "docid": "22359f734f1572153f3c8925f79a64aa", "score": "0.54370636", "text": "func (m *Manager) AddNode(addr string) error {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "22359f734f1572153f3c8925f79a64aa", "score": "0.54370636", "text": "func (m *Manager) AddNode(addr string) error {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "809502d284f0df66be963d9418731e2b", "score": "0.54093367", "text": "func (c *Cache) Add(n *Node) {\n\tc.Nodes[n.ID] = n\n\tif _, ok := c.Edges[n.ID]; !ok {\n\t\tc.Edges[n.ID] = make([]int64, 0)\n\t}\n}", "title": "" }, { "docid": "ff98920180f337b9a2cbba685040ea2b", "score": "0.5401248", "text": "func (dW *dotWriter) addNode(graph *dot.Graph, id string, nT nodeType) error {\n\tnode := dot.NewVertexDescription(\"\")\n\tnode.Group = id\n\tnode.ColorScheme = \"x11\"\n\tnode.FontName = \"Arial\"\n\tnode.Style = \"filled\"\n\tnode.FontColor = \"black\"\n\tswitch nT {\n\tcase tSelfCluster:\n\t\tnode.ID = fmt.Sprintf(\"C%d\", len(dW.clusterNodes))\n\t\tnode.Shape = \"box3d\"\n\t\tnode.Label = label(dW.idToPeername[id], shorten(id))\n\t\tnode.Color = \"orange\"\n\t\tnode.Peripheries = 2\n\t\tdW.clusterNodes[id] = &node\n\tcase tTrustedCluster:\n\t\tnode.ID = fmt.Sprintf(\"T%d\", len(dW.clusterNodes))\n\t\tnode.Shape = \"box3d\"\n\t\tnode.Label = label(dW.idToPeername[id], shorten(id))\n\t\tnode.Color = \"orange\"\n\t\tdW.clusterNodes[id] = &node\n\tcase tCluster:\n\t\tnode.Shape = \"box3d\"\n\t\tnode.Label = label(dW.idToPeername[id], shorten(id))\n\t\tnode.ID = fmt.Sprintf(\"C%d\", len(dW.clusterNodes))\n\t\tnode.Color = \"darkorange3\"\n\t\tdW.clusterNodes[id] = &node\n\tcase tIPFS:\n\t\tnode.ID = fmt.Sprintf(\"I%d\", len(dW.ipfsNodes))\n\t\tnode.Shape = \"cylinder\"\n\t\tnode.Label = label(\"IPFS\", shorten(id))\n\t\tnode.Color = \"turquoise3\"\n\t\tdW.ipfsNodes[id] = &node\n\tcase tIPFSMissing:\n\t\tnode.ID = fmt.Sprintf(\"I%d\", len(dW.ipfsNodes))\n\t\tnode.Shape = \"cylinder\"\n\t\tnode.Label = label(\"IPFS\", \"Errored\")\n\t\tnode.Color = \"firebrick1\"\n\t\tdW.ipfsNodes[id] = &node\n\tdefault:\n\t\treturn errUnknownNodeType\n\t}\n\n\tgraph.AddVertex(&node)\n\treturn nil\n}", "title": "" }, { "docid": "def7a3788f92146c7aba58ecd7429647", "score": "0.5400532", "text": "func (this *DefaultCluster) AddNode(nodeInfo *node.NodeInfo) {\n\tthis.mutex.Lock()\n\tdefer this.mutex.Unlock()\n\tfor _, node := range this.clusterInfo.NodeList {\n\t\tif node.Name == nodeInfo.Name {\n\t\t\treturn\n\t\t}\n\t}\n\tthis.clusterInfo.NodeList = append(this.clusterInfo.NodeList, nodeInfo)\n}", "title": "" }, { "docid": "89ca9fc14d94bddf9694f3c347a837d8", "score": "0.53710634", "text": "func (tab *Table) add(new *Node) {\n\ttab.localLogger.Trace(\"add(node)\", \"NodeType\", new.NType, \"node\", new, \"sha\", new.sha)\n\ttab.storagesMu.RLock()\n\tdefer tab.storagesMu.RUnlock()\n\tif new.NType == NodeTypeBN {\n\t\tfor _, ds := range tab.storages {\n\t\t\tds.add(new)\n\t\t}\n\t} else {\n\t\tif tab.storages[new.NType] == nil {\n\t\t\ttab.localLogger.Warn(\"add(): Not Supported NodeType\", \"NodeType\", new.NType)\n\t\t\treturn\n\t\t}\n\t\ttab.storages[new.NType].add(new)\n\t}\n}", "title": "" }, { "docid": "b5c281b101ab0738b7caa97b66673cd0", "score": "0.5369438", "text": "func (l *LB) AddNode(ctx context.Context, nodeName string, localASN, peerASN int, password, srcIP string, peers ...string) error {\n\treturn nil\n}", "title": "" }, { "docid": "d9fac29ee97ebebe3b1bb94f1ce8c580", "score": "0.53412193", "text": "func (g *Graph) Add(target *Node) {\n\tg.nodes = append(g.nodes, target)\n}", "title": "" }, { "docid": "255272344f10924165509a15e64aa55e", "score": "0.5318108", "text": "func (g *Graph) Add(x1 Node, x2 Node) Node {\n\tif x1 != nil {\n\t\treturn g.NewOperator(fn.NewAdd(x1, x2), x1, x2)\n\t} else {\n\t\tfake := g.NewVariable(nil, false)\n\t\treturn g.NewOperator(fn.NewAdd(fake, x2), fake, x2)\n\t}\n}", "title": "" }, { "docid": "41aebe9e70a76d5d73d995ed197cff6f", "score": "0.5304211", "text": "func (nm *NodeManager) AddNode(nodeID UniqueID, address string) error {\n\n\tlog.Debug(\"IndexCoord addNode\", zap.Any(\"nodeID\", nodeID), zap.Any(\"node address\", address))\n\tif nm.pq.CheckExist(nodeID) {\n\t\tlog.Warn(\"IndexCoord\", zap.Any(\"Node client already exist with ID:\", nodeID))\n\t\treturn nil\n\t}\n\tvar (\n\t\tnodeClient types.IndexNode\n\t\terr error\n\t)\n\n\tnodeClient, err = grpcindexnodeclient.NewClient(context.TODO(), address, Params.IndexCoordCfg.WithCredential.GetAsBool())\n\tif err != nil {\n\t\tlog.Error(\"IndexCoord NodeManager\", zap.Any(\"Add node err\", err))\n\t\treturn err\n\t}\n\n\terr = nodeClient.Init()\n\tif err != nil {\n\t\tlog.Error(\"IndexCoord NodeManager\", zap.Any(\"Add node err\", err))\n\t\treturn err\n\t}\n\tmetrics.IndexCoordIndexNodeNum.WithLabelValues().Inc()\n\tnm.setClient(nodeID, nodeClient)\n\treturn nil\n}", "title": "" }, { "docid": "b53c75a5457e7b0828d1338abd6aea8f", "score": "0.5285471", "text": "func AddNode(c web.C, w http.ResponseWriter, r *http.Request) {\n\ttarget := c.URLParams[\"nodeName\"]\n\tnode := NodeMaster.GetNode(target)\n\tcontext, err := NewPageContext()\n\tcheckContextError(err, &w)\n\tcontext.Title = fmt.Sprintf(\"Add Node %s\", target)\n\tcontext.ViewTemplate = \"add-node-form\"\n\tcontext.NodeMaster = NodeMaster\n\tcontext.Data = node\n\trender(w, context)\n}", "title": "" }, { "docid": "bcba34af81da40f6d0ba76ae2818019c", "score": "0.5284529", "text": "func (f *Function) AddNode(n Node) {\n\tf.Nodes = append(f.Nodes, n)\n}", "title": "" }, { "docid": "58543f811574bfa7fd54345a86f5d539", "score": "0.5279646", "text": "func (pc *Connector) CreateCompute(id string, name string, subType string, position string) (err error) {\n\t// Validate input\n\tif id == \"\" {\n\t\treturn errors.New(\"Missing ID\")\n\t}\n\tif name == \"\" {\n\t\treturn errors.New(\"Missing Name\")\n\t}\n\tif subType == \"\" {\n\t\treturn errors.New(\"Missing Type\")\n\t}\n\tif position == \"\" {\n\t\treturn errors.New(\"Missing Position\")\n\t}\n\n\t// Create Compute entry\n\tquery := `INSERT INTO ` + ComputeTable + ` (id, name, type, position)\n\t\tVALUES ($1, $2, $3, ST_GeomFromGeoJSON('` + position + `'))`\n\t_, err = pc.db.Exec(query, id, name, subType)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn err\n\t}\n\n\t// Notify listener\n\tpc.notifyListener(TypeCompute, name)\n\n\treturn nil\n}", "title": "" }, { "docid": "3a22e46da61b296d9f4d400d386410bf", "score": "0.5276581", "text": "func (cluster *Cluster) addMetaNode(nodeAddr string) (uint64, error) {\n\tcluster.metaMutex.Lock()\n\tdefer cluster.metaMutex.Unlock()\n\n\tif metaNode, ok := cluster.metaNodes[nodeAddr]; ok {\n\t\treturn metaNode.ID, nil\n\t}\n\n\tvar metaNode *MetaNode\n\tmetaNode = newMetaNode(nodeAddr, cluster.Name)\n\tnode := cluster.nodeSets.getAvailNodeSetForMetaNode()\n\tif node == nil {\n\t\t// create node set\n\t\tid, err := cluster.idAlloc.allocateMetaNodeID()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tnode = newNodeSet(id, cluster.nodeSetCapacity)\n\t\tif err = cluster.submitNodeSet(opSyncAddNodeSet, node); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tcluster.nodeSets.putNodeSet(node)\n\t}\n\n\tid, err := cluster.idAlloc.allocateMetaNodeID()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tmetaNode.ID = id\n\tmetaNode.NodeSetID = node.ID\n\tif err = cluster.submitMetaNode(opSyncAddMetaNode, metaNode); err != nil {\n\t\treturn 0, err\n\t}\n\n\tnode.increaseMetaNodeLen()\n\tif err = cluster.submitNodeSet(opSyncUpdateNodeSet, node); err != nil {\n\t\tnode.decreaseMetaNodeLen()\n\t\treturn 0, err\n\t}\n\n\t// store metaNode\n\tcluster.metaNodes[nodeAddr] = metaNode\n\tklog.Infof(fmt.Sprintf(\"add meta node %s succefully\", nodeAddr))\n\treturn metaNode.ID, nil\n}", "title": "" }, { "docid": "c34978ebd6b897fd166a4b065e828923", "score": "0.5275826", "text": "func (g *Graph) AddNode(name string, n *Node) *Node {\n\tg.lock.Lock()\n\tif g.nodes == nil {\n\t\tg.nodes = make(map[string]*Node)\n\t}\n\n\tg.nodes[name] = n\n\tg.lock.Unlock()\n\treturn n\n}", "title": "" }, { "docid": "661a2a4e7037226e80a3868b20539a64", "score": "0.5267077", "text": "func Add(a, b *Node) (*Node, error) { return binOpNode(newElemBinOp(addOpType, a, b), a, b) }", "title": "" }, { "docid": "159e69410c1e75a85f97ac5cf1ef2b9e", "score": "0.5262599", "text": "func (s *Simulation) AddNode(opts ...AddNodeOption) (id enode.ID, err error) {\n\tconf := adapters.RandomNodeConfig()\n\tfor _, o := range opts {\n\t\to(conf)\n\t}\n\tif len(conf.Services) == 0 {\n\t\tconf.Services = s.serviceNames\n\t}\n\tnode, err := s.Net.NewNodeWithConfig(conf)\n\tif err != nil {\n\t\treturn id, err\n\t}\n\treturn node.ID(), s.Net.Start(node.ID())\n}", "title": "" }, { "docid": "3ab395a4c80dce5dcbe1d6420475a79f", "score": "0.52584773", "text": "func (g *Graph) AddNode(node Node) {\n\tg.nodes = append(g.nodes, node)\n\tg.cacheNode(node, len(g.nodes)-1)\n}", "title": "" }, { "docid": "e3037fbd8aec9222f07e87b2c31b9aec", "score": "0.5257713", "text": "func (c *Cluster) AddNode(name string, dsn string) error {\n\tif c.nodeExists(name) {\n\t\treturn fmt.Errorf(\"%w: %s\", ErrDuplicateNodeName, name)\n\t}\n\tnode, err := newNode(name, dsn, c.limitRPS, c.maxIdleConn, c.maxOpenConn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to add a node: %w\", err)\n\t}\n\tc.mu.Lock()\n\tc.nodeLen++\n\tc.nodes.Store(name, node)\n\tc.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "67d00ea11b028164c826385528207483", "score": "0.52540773", "text": "func (nodes NodeSet) Add(n *Node) { nodes[n.ID] = true }", "title": "" }, { "docid": "1a75d3e951fc13b7b7dd2a3ec690f7e8", "score": "0.5251424", "text": "func newAdd() *cobra.Command {\n\tvar address string\n\tvar cluster *[]string\n\n\tcmd := &cobra.Command{\n\t\tUse: \"add <id>\",\n\t\tShort: \"Add a node to the dqlite-demo cluster.\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tid, err := strconv.Atoi(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"%s is not a number\", args[0])\n\t\t\t}\n\t\t\tif id == 0 {\n\t\t\t\treturn fmt.Errorf(\"ID must be greater than zero\")\n\t\t\t}\n\t\t\tif address == \"\" {\n\t\t\t\taddress = fmt.Sprintf(\"127.0.0.1:918%d\", id)\n\t\t\t}\n\t\t\tinfo := client.NodeInfo{\n\t\t\t\tID: uint64(id),\n\t\t\t\tAddress: address,\n\t\t\t}\n\n\t\t\tclient, err := getLeader(*cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"can't connect to cluster leader\")\n\t\t\t}\n\t\t\tdefer client.Close()\n\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\t\t\tdefer cancel()\n\n\t\t\tif err := client.Add(ctx, info); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"can't add node\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tflags := cmd.Flags()\n\tflags.StringVarP(&address, \"address\", \"a\", \"\", \"address of the node to add (default is 127.0.0.1:918<ID>)\")\n\tcluster = flags.StringSliceP(\"cluster\", \"c\", defaultCluster, \"addresses of existing cluster nodes\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "1bb8a67c5c09773a6bd5750986485ca3", "score": "0.524867", "text": "func (g *Graph) AddNode() *Node {\n\tnd := &Node{}\n\tg.nodes = append(g.nodes, nd)\n\treturn nd\n}", "title": "" }, { "docid": "28f5ef10fc050701e1a9c3d6e7c42157", "score": "0.52472955", "text": "func NewCompute(ctx *pulumi.Context,\n\tname string, args *ComputeArgs, opts ...pulumi.ResourceOption) (*Compute, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.WorkspaceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'WorkspaceName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20210301preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20180301preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20180301preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20181119:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20181119:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20190501:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20190501:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20190601:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20190601:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20191101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20191101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200218preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200218preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200301:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200301:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200401:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200401:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200501preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200501preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200515preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200515preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200601:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200601:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200801:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200801:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20200901preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20200901preview:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20210101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20210101:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:machinelearningservices/v20210401:Compute\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:machinelearningservices/v20210401:Compute\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource Compute\n\terr := ctx.RegisterResource(\"azure-native:machinelearningservices/v20210301preview:Compute\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "4115ecff82c98f40a3d9aa725b8d76b1", "score": "0.5246135", "text": "func (n *Node) Add(directive string, args ...string) *Node {\n\tif nodes := n.Get(directive, args...); len(nodes) > 0 {\n\t\treturn nodes[0]\n\t}\n\n\tnode := &Node{Directive: directive, Args: args}\n\tn.appendChild(node)\n\treturn node\n}", "title": "" }, { "docid": "7ab7c824d4cc6df6bda68bf3c8c50847", "score": "0.52439296", "text": "func (s *BaseSHARCParserListener) EnterCompute(ctx *ComputeContext) {}", "title": "" }, { "docid": "8674d761645499f2a8bc41c1ea3f7670", "score": "0.5242277", "text": "func (p *plugin) AddNode(swarmID, csiID string) {\n\tp.swarmToCSI[swarmID] = csiID\n\tp.csiToSwarm[csiID] = swarmID\n}", "title": "" }, { "docid": "f55d5e796d8fe5df6c6b8319876f8fb4", "score": "0.5227177", "text": "func (c *MemoryCondensor) AddNode(node *vertex) error {\n\tec := &errorcompounder.ErrorCompounder{}\n\tec.Add(c.writeCommitType(c.newLog, AddNode))\n\tec.Add(c.writeUint64(c.newLog, node.id))\n\tec.Add(c.writeUint16(c.newLog, uint16(node.level)))\n\n\treturn ec.ToError()\n}", "title": "" }, { "docid": "af0b34b14238be76ffedc8887c78010a", "score": "0.5222401", "text": "func (c *consistent) Add(name string) error {\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\tif _, ok := c.member[name]; ok {\n\t\treturn fmt.Errorf(\"%s already existed\", name)\n\t}\n\tc.member[name] = true\n\tfor i := 0; i < c.virtulReplicas; i++ {\n\t\trplKey, err := c.replicaKey(name, i)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\thashKey, err := c.hashKey(rplKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.circle[hashKey] = name\n\t\tc.sortedHashKeys = append(c.sortedHashKeys, hashKey)\n\t}\n\tc.sortHashKeySlice()\n\treturn nil\n}", "title": "" }, { "docid": "3ea4f758b766f31a8cde9fcf0e5e14b4", "score": "0.5215472", "text": "func (m *CacheStore) Add(node Node) error {\n\tif err := m.Back.Add(node); err != nil {\n\t\treturn err\n\t}\n\tif err := m.Cache.Add(node); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51b4e78a5524f4a3caf3e6b136db529d", "score": "0.51821464", "text": "func (k *Ketama) Add(nodes ...string) {\n\tk.locker.Lock()\n\tdefer k.locker.Unlock()\n\n\tfor _, node := range nodes {\n\t\thashs := hash.GenHashInts([]byte(salt+node), k.replicas)\n\t\tfor i := 0; i < k.replicas; i++ {\n\t\t\tkey := hashs[i]\n\t\t\tif !k.m.Contains(key) {\n\t\t\t\tk.m.Insert(key, node)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31551707249bb89478912ce8497d782d", "score": "0.516661", "text": "func (i *node) Add(n pkg.Composer, b bool) error {\n\ti.nm[i.version][n.(*node).id] = b\n\ti.children[n.(*node).id] = n\n\tn.(*node).parent = i\n\tif i.max < n.(*node).id&0xFFFFFFFF {\n\t\ti.max = n.(*node).id & 0xFFFFFFFF\n\t}\n\tif i.index != nil {\n\t\treturn i.addIndex(n)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d248ca897a538b7fb0b28e9864842e5", "score": "0.51631546", "text": "func (s *Server) AddNodeToPool(node *NodeMessage) error {\n\t// need to think on this, it feels wrong\n\tif !s.CheckPoolForNode(node) {\n\t\tlog.Printf(\"[%s@%s:%d] is new to me. Adding to my phonebook.\\n\", node.Name, node.Host, node.Port)\n\n\t\ts.Me.Pool.nodes = append(s.Me.Pool.nodes, s.MessageToNode(node))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4648208fc9c578b4d89dbc33161de884", "score": "0.5158079", "text": "func (ns nodeSet) Add(n Node) { ns[n] = struct{}{} }", "title": "" }, { "docid": "5967bb8b66e54857291978613042c6ef", "score": "0.51453465", "text": "func (m *LocalResourceMonitor) onNodeAdd(obj interface{}) {\n\tnode := obj.(*corev1.Node)\n\tif utils.IsNodeReady(node) {\n\t\tklog.V(4).Infof(\"Adding Node %s\", node.Name)\n\t\ttoAdd := &node.Status.Allocatable\n\t\tcurrentResources := m.readClusterResources()\n\t\taddResources(currentResources, *toAdd)\n\t\tm.writeClusterResources(currentResources)\n\t}\n}", "title": "" }, { "docid": "d6fed635b98b601cc9aff7cc0910efaf", "score": "0.5137025", "text": "func (n *Node) add(comp Comparator, val interface{}) *Node {\n\tif n == nil {\n\t\treturn &Node{val: val}\n\t}\n\n\tif comp(val, n.val) > 0 {\n\t\tn.right = n.right.add(comp, val)\n\t} else {\n\t\tn.left = n.left.add(comp, val)\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "751a9dd8b652aa13fd957ba45012489d", "score": "0.51361907", "text": "func (node *Node) Add(data interface{}) *Node {\n\treturn node.add(nil, data)\n}", "title": "" }, { "docid": "017ae5952837c49ea502ff4ffb7620a1", "score": "0.5132498", "text": "func (r *ResolveResult) Add(node *Node) bool {\n\t// check if its there first\n\tfor _, aNode := range r.nodes {\n\t\tif node.Id == (aNode.(*Node)).Id {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tr.nodes.Push(node)\n\n\treturn true\n}", "title": "" }, { "docid": "b303d235a693ff21cf0eec4ffd11606a", "score": "0.5130885", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to Nodes.\n\treturn c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{})\n}", "title": "" }, { "docid": "f0c7049ea90e5e03c45c1c828e7dfe8e", "score": "0.5118778", "text": "func TestAddNodeList(t *testing.T) {\n\tt.Parallel()\n\n\tstore := NewStore()\n\tnode := *NewNode(*service.NewConnectionInfo(\"yeet\", 42), &scenario.NodeResources{}, \"5\")\n\n\terr := store.AddNode(&node)\n\tassert.NoError(t, err)\n\n\tlist, err := store.GetNodes()\n\tassert.NoError(t, err)\n\tassert.Len(t, list, 1)\n\tassert.Equal(t, node, list[0])\n}", "title": "" }, { "docid": "5348405550fd9b8d55c2e228e6da3b0a", "score": "0.51181656", "text": "func (n *node) add(entry []string) {\n\t// Remove the first element if we're not the root node.\n\tif !n.isRoot() {\n\t\tif entry[0] != n.name {\n\t\t\tlog.Fatalf(\"Failed to compute compile CAS inputs; attempting to add entry %v to node %q\", entry, n.name)\n\t\t}\n\t\tentry = entry[1:]\n\n\t\t// If the entry is now empty, this node is a leaf.\n\t\tif len(entry) == 0 {\n\t\t\tn.isLeaf = true\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Add a child node.\n\tif !n.isLeaf {\n\t\tname := entry[0]\n\t\tchild, ok := n.children[name]\n\t\tif !ok {\n\t\t\tchild = newNode(name)\n\t\t\tn.children[name] = child\n\t\t}\n\t\tchild.add(entry)\n\n\t\t// If we have more than combinePathsThreshold immediate children,\n\t\t// combine them into this node.\n\t\timmediateChilden := 0\n\t\tfor _, child := range n.children {\n\t\t\tif child.isLeaf {\n\t\t\t\timmediateChilden++\n\t\t\t}\n\t\t\tif !n.isRoot() && immediateChilden >= combinePathsThreshold {\n\t\t\t\tn.isLeaf = true\n\t\t\t\tn.children = map[string]*node{}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "39cfdf022c03f2be9c1d0759fe213099", "score": "0.5115163", "text": "func (auo *AgentUpdateOne) AddNode(n ...*Node) *AgentUpdateOne {\n\tids := make([]uint, len(n))\n\tfor i := range n {\n\t\tids[i] = n[i].ID\n\t}\n\treturn auo.AddNodeIDs(ids...)\n}", "title": "" }, { "docid": "efd7e43cf8786c4db763511f4aee071e", "score": "0.51130044", "text": "func (sc *SchedulerCache) addNodeCache(nc *ncv1.NodeCache) error {\n\tfmt.Println(\"========================================\")\n\tfmt.Println(\"ADD NodeCache ... \")\n\treturn sc.setNodeCache(nc)\n\n}", "title": "" }, { "docid": "f37daa82ef67e48599cbb7b5e83da1bd", "score": "0.5112464", "text": "func (n *Network) AddNode(node *DuskNode) {\n\tn.nodes = append(n.nodes, node)\n}", "title": "" }, { "docid": "117135877c47c477d5236387763de773", "score": "0.5111415", "text": "func (np *nodePool) add(head int32, key, val []byte) (int32, error) {\n\t// get a bucket from freeNode List\n\tnode, err := np.getFreeNode()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tnp.array[node].next = head\n\n\t//set the node with key\n\tnp.keyPool.Set(node, key)\n\tnp.valPool.Set(node, val)\n\n\tnp.length += 1\n\treturn node, nil\n}", "title": "" }, { "docid": "df42df373a3aa732178f05cf004bd263", "score": "0.51083577", "text": "func (c *Cluster) PeerAdd(addr ma.Multiaddr) (api.ID, error) {\n\t// starting 10 nodes on the same box for testing\n\t// causes deadlock and a global lock here\n\t// seems to help.\n\tc.paMux.Lock()\n\tdefer c.paMux.Unlock()\n\tlogger.Debugf(\"peerAdd called with %s\", addr)\n\tpid, decapAddr, err := multiaddrSplit(addr)\n\tif err != nil {\n\t\tid := api.ID{\n\t\t\tError: err.Error(),\n\t\t}\n\t\treturn id, err\n\t}\n\n\t// Figure out its real address if we have one\n\tremoteAddr := getRemoteMultiaddr(c.host, pid, decapAddr)\n\n\terr = c.peerManager.addPeer(remoteAddr)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\tid := api.ID{ID: pid, Error: err.Error()}\n\t\treturn id, err\n\t}\n\n\t// Figure out our address to that peer. This also\n\t// ensures that it is reachable\n\tvar addrSerial api.MultiaddrSerial\n\terr = c.rpcClient.Call(pid, \"Cluster\",\n\t\t\"RemoteMultiaddrForPeer\", c.id, &addrSerial)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\tid := api.ID{ID: pid, Error: err.Error()}\n\t\tc.peerManager.rmPeer(pid, false)\n\t\treturn id, err\n\t}\n\n\t// Log the new peer in the log so everyone gets it.\n\terr = c.consensus.LogAddPeer(remoteAddr)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\tid := api.ID{ID: pid, Error: err.Error()}\n\t\tc.peerManager.rmPeer(pid, false)\n\t\treturn id, err\n\t}\n\n\t// Send cluster peers to the new peer.\n\tclusterPeers := append(c.peerManager.peersAddrs(),\n\t\taddrSerial.ToMultiaddr())\n\terr = c.rpcClient.Call(pid,\n\t\t\"Cluster\",\n\t\t\"PeerManagerAddFromMultiaddrs\",\n\t\tapi.MultiaddrsToSerial(clusterPeers),\n\t\t&struct{}{})\n\tif err != nil {\n\t\tlogger.Error(err)\n\t}\n\n\t// Ask the new peer to connect its IPFS daemon to the rest\n\terr = c.rpcClient.Call(pid,\n\t\t\"Cluster\",\n\t\t\"IPFSConnectSwarms\",\n\t\tstruct{}{},\n\t\t&struct{}{})\n\tif err != nil {\n\t\tlogger.Error(err)\n\t}\n\n\tid, err := c.getIDForPeer(pid)\n\treturn id, nil\n}", "title": "" }, { "docid": "ce466f5cdee1d48cea0e5cc5738195ec", "score": "0.50966644", "text": "func newNode() *node {\n\treturn &node{}\n}", "title": "" }, { "docid": "0cd76132b2f62f4d426f3913edb8780d", "score": "0.5088465", "text": "func AddNode(n Node) error {\n\tif n.uuid != \"\" {\n\t\treturn fmt.Errorf(\"UUID should not be set to add new node\")\n\t}\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tn.uuid = uuid.New()\n\tnodeRegistry[n.uuid] = n\n\treturn nil\n}", "title": "" }, { "docid": "db868ccd0fb62bfa84d0e75530ec4cbb", "score": "0.5086199", "text": "func (cli *Client) CreateNode(c *cli.Context) (err error) {\n\tname := c.String(\"name\")\n\tt := c.String(\"type\")\n\tws := c.String(\"ws-url\")\n\thttpURL := c.String(\"http-url\")\n\tchainID := c.Int64(\"chain-id\")\n\n\tif name == \"\" {\n\t\treturn cli.errorOut(errors.New(\"missing --name\"))\n\t}\n\tif chainID == 0 {\n\t\treturn cli.errorOut(errors.New(\"missing --chain-id\"))\n\t}\n\tif t != \"primary\" && t != \"sendonly\" {\n\t\treturn cli.errorOut(errors.New(\"invalid or unspecified --type, must be either primary or sendonly\"))\n\t}\n\tif t == \"primary\" && ws == \"\" {\n\t\treturn cli.errorOut(errors.New(\"missing --ws-url\"))\n\t}\n\tif httpURL == \"\" {\n\t\treturn cli.errorOut(errors.New(\"missing --http-url\"))\n\t}\n\n\tvar wsURL null.String\n\tif ws != \"\" {\n\t\twsURL = null.StringFrom(ws)\n\t}\n\n\tparams := evmtypes.NewNode{\n\t\tName: name,\n\t\tEVMChainID: *utils.NewBigI(chainID),\n\t\tWSURL: wsURL,\n\t\tHTTPURL: null.StringFrom(httpURL),\n\t\tSendOnly: t == \"sendonly\",\n\t}\n\n\tbody, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn cli.errorOut(err)\n\t}\n\n\tresp, err := cli.HTTP.Post(\"/v2/nodes\", bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn cli.errorOut(err)\n\t}\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); cerr != nil {\n\t\t\terr = multierr.Append(err, cerr)\n\t\t}\n\t}()\n\n\treturn cli.renderAPIResponse(resp, &NodePresenter{})\n}", "title": "" }, { "docid": "935f4d27c837b065b5dce4a43a1766bc", "score": "0.50854504", "text": "func (_MasterChef *MasterChefTransactor) Add(opts *bind.TransactOpts, _allocPoint *big.Int, _lpToken common.Address, _withUpdate bool) (*types.Transaction, error) {\n\treturn _MasterChef.contract.Transact(opts, \"add\", _allocPoint, _lpToken, _withUpdate)\n}", "title": "" }, { "docid": "a3fff1a755c870d4719f1fd0ada98d57", "score": "0.50775856", "text": "func (h *Hub) AddNode(n *node.Node) error {\n\treturn h.nodes.Store(n)\n}", "title": "" }, { "docid": "4c8825c6f118294e82f65a4da19a098b", "score": "0.5070917", "text": "func (nd *NodeDomain) RegisterNode(publicKey string, numberOfBootstrapNodes int, majorityRule int, role string, ip string) ([]byte, error) {\n\tconst majorityPercentage = 0.51\n\n\tif majorityRule != 0 {\n\t\tif float32(majorityRule) <= majorityPercentage*float32(numberOfBootstrapNodes) {\n\t\t\treturn nil, fmt.Errorf(\"majorityRule must be more than %.2f * numberOfBootstrapNodes\", majorityPercentage)\n\t\t}\n\t}\n\n\tresult, err := nd.makeCertificate(numberOfBootstrapNodes, publicKey, majorityRule, role)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[ RegisterNode ] : %s\", err.Error())\n\t}\n\n\t// TODO: what should be done when record already exists?\n\tnewRecord := noderecord.NewNodeRecord(publicKey, role, ip)\n\trecord, err := newRecord.AsChild(nd.GetReference())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[ RegisterNode ]: %s\", err.Error())\n\t}\n\n\tresult[\"reference\"] = record.GetReference().String()\n\n\trawCert, err := json.Marshal(result)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Can't marshal certificate: %s\", err.Error())\n\t}\n\n\treturn rawCert, nil\n}", "title": "" }, { "docid": "c1985a81b986a0dd35d16803c5c29768", "score": "0.50671804", "text": "func newNode() *Node {\n\treturn &Node{}\n}", "title": "" }, { "docid": "198e7bdc83fe1afc2b37e6034a832bb5", "score": "0.5066746", "text": "func (r *Raft) addNode(id uint64) {\n\t// Your Code Here (3A).\n}", "title": "" }, { "docid": "198e7bdc83fe1afc2b37e6034a832bb5", "score": "0.5066746", "text": "func (r *Raft) addNode(id uint64) {\n\t// Your Code Here (3A).\n}", "title": "" }, { "docid": "198e7bdc83fe1afc2b37e6034a832bb5", "score": "0.5066746", "text": "func (r *Raft) addNode(id uint64) {\n\t// Your Code Here (3A).\n}", "title": "" }, { "docid": "93616e8ef98f58339e67bc4a2ec45817", "score": "0.5065816", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"node-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Node\n\treturn c.Watch(&source.Kind{Type: &corev1.Node{}}, &handler.EnqueueRequestForObject{},\n\t\t&predicate.Funcs{\n\t\t\tCreateFunc: func(e event.CreateEvent) bool {\n\t\t\t\treturn false\n\t\t\t},\n\t\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\t\treturn false\n\t\t\t},\n\t\t\tDeleteFunc: func(e event.DeleteEvent) bool {\n\t\t\t\treturn true\n\t\t\t},\n\t\t},\n\t)\n}", "title": "" }, { "docid": "6237ceb90be06809ea01958666070e5b", "score": "0.5062094", "text": "func (c *NodeConnector) Add(data []byte) (string, error) {\n\tf := files.NewBytesFile(data)\n\tdefer f.Close()\n\tr, err := c.api.Unixfs().Add(c.ctx, f)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn r.Cid().String(), nil\n}", "title": "" }, { "docid": "843c4c3d933879b55ba365812b9b3469", "score": "0.50519717", "text": "func (r *reactor) CreateCompute2(c1, c2 Cell, f func(int, int) int) ComputeCell {\n\ttoReturn := &comCell{\n\t\tf: f,\n\t\tval: f(c1.Value(), c2.Value()),\n\t\tcallbacks: make(map[CallbackHandle]func(int)),\n\t\tin1: c1,\n\t\tin2: c2,\n\t\tcallHandle: 0,\n\t\tre: r,\n\t}\n\t// Add c1 to the dependency map, and add toReturn to c1's dependents.\n\tif _, ok := r.dependencies[c1]; !ok {\n\t\tr.dependencies[c1] = []Cell{toReturn}\n\t} else {\n\t\tr.dependencies[c1] = append(r.dependencies[c1], toReturn)\n\t}\n\t// Add c2 to the dependency map, and add toReturn to c2's dependents.\n\tif _, ok := r.dependencies[c2]; !ok {\n\t\tr.dependencies[c2] = []Cell{toReturn}\n\t} else {\n\t\tr.dependencies[c2] = append(r.dependencies[c2], toReturn)\n\t}\n\n\treturn toReturn\n}", "title": "" }, { "docid": "0a986c3dd52ec5aab3bbc61fb02cb3b1", "score": "0.50478613", "text": "func createNode(parent *node, entry *hostEntry) *node {\n\treturn &node{\n\t\tparent: parent,\n\t\tweight: entry.weight,\n\t\tcount: 1,\n\n\t\ttaken: true,\n\t\tentry: entry,\n\t}\n}", "title": "" }, { "docid": "1f7c35772b50cb974007ba32ceeab1ee", "score": "0.5047724", "text": "func (au *AgentUpdate) AddNode(n ...*Node) *AgentUpdate {\n\tids := make([]uint, len(n))\n\tfor i := range n {\n\t\tids[i] = n[i].ID\n\t}\n\treturn au.AddNodeIDs(ids...)\n}", "title": "" }, { "docid": "50fbb59d76c7a70730b23db01fcbab5a", "score": "0.504712", "text": "func (g *Graph) AddOperationNode(opString string) *Node {\n\tname := \"OPR\" + strconv.Itoa(len(g.operationNodes))\n\n\tif _, exist := NodeOpLUT[opString]; !exist {\n\t\tfmt.Println(\"graph error - unsupported operation\", opString)\n\t\treturn nil\n\t}\n\n\tnewNode := CreateNode(name, NodeKind_Operation, NodeOpLUT[opString])\n\n\tg.allNodes[name] = newNode\n\tg.operationNodes[name] = newNode\n\n\tg.isLevelized = false\n\n\treturn newNode\n}", "title": "" }, { "docid": "1e36c074d53b11920b9d03863b73334d", "score": "0.5043711", "text": "func (s *Space) AddNode(n Node) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif err := s.addNode(n); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "683a8b8d8e3cf1e77756b6d790d96eeb", "score": "0.50381297", "text": "func (s *Service) Apply(ctx context.Context, nac *v1.NodeApplyConfiguration) (*corev1.Node, error) {\n\tnac.WithAPIVersion(\"v1\")\n\tnac.WithKind(\"Node\")\n\n\tnewnode, err := s.client.CoreV1().Nodes().Apply(ctx, nac, metav1.ApplyOptions{Force: true, FieldManager: \"simulator\"})\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"apply node: %w\", err)\n\t}\n\n\treturn newnode, nil\n}", "title": "" }, { "docid": "b7840b472fad8c11a0e22ed9655eba9e", "score": "0.5034803", "text": "func nodeCreate() *node {\n\tnd := node{id: nodeID}\n\tnodeID++\n\treturn &nd\n}", "title": "" }, { "docid": "ddbd3d61911cb8b6e9feb5711adcbaf5", "score": "0.503206", "text": "func (r *router) addnode(p *node, nodes []*node, i int) *node {\n\tif len(p.edges) == 0 {\n\t\tp.edges = make([]*node, 0)\n\t}\n\n\tfor _, pc := range p.edges {\n\t\tif pc.equal(nodes[i]) {\n\t\t\tif i == len(nodes)-1 {\n\t\t\t\tpc.handle = nodes[i].handle\n\t\t\t}\n\t\t\treturn pc\n\t\t}\n\t}\n\n\tp.edges = append(p.edges, nodes[i])\n\tsort.Sort(p.edges)\n\treturn nodes[i]\n}", "title": "" }, { "docid": "cd7f4003a4010481fd9005f83a3348f7", "score": "0.5031386", "text": "func (h *StathatHash) Add(node string) {\n\th.c.Add(node)\n}", "title": "" }, { "docid": "a07369760fe37fa1a5a501e32a533bce", "score": "0.502263", "text": "func (a *NodeAPI) Create(ctx context.Context, req *pb.CreateNodeRequest) (*pb.CreateNodeResponse, error) {\n\tvar appEUI, devEUI lorawan.EUI64\n\tvar appKey lorawan.AES128Key\n\n\tif err := appEUI.UnmarshalText([]byte(req.AppEUI)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\tif err := devEUI.UnmarshalText([]byte(req.DevEUI)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\tif err := appKey.UnmarshalText([]byte(req.AppKey)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateNodesAccess(req.ApplicationID, auth.Create)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\t// if Name is \"\", set it to the DevEUI\n\tif req.Name == \"\" {\n\t\treq.Name = req.DevEUI\n\t}\n\n\tnode := storage.Node{\n\t\tApplicationID: req.ApplicationID,\n\t\tUseApplicationSettings: req.UseApplicationSettings,\n\t\tName: req.Name,\n\t\tDescription: req.Description,\n\t\tDevEUI: devEUI,\n\t\tAppEUI: appEUI,\n\t\tAppKey: appKey,\n\t\tIsABP: req.IsABP,\n\t\tIsClassC: req.IsClassC,\n\t\tRelaxFCnt: req.RelaxFCnt,\n\n\t\tRXDelay: uint8(req.RxDelay),\n\t\tRX1DROffset: uint8(req.Rx1DROffset),\n\t\tRXWindow: storage.RXWindow(req.RxWindow),\n\t\tRX2DR: uint8(req.Rx2DR),\n\n\t\tADRInterval: req.AdrInterval,\n\t\tInstallationMargin: req.InstallationMargin,\n\t}\n\tif req.ChannelListID > 0 {\n\t\tnode.ChannelListID = &req.ChannelListID\n\t}\n\n\tif err := storage.CreateNode(a.ctx.DB, node); err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\treturn &pb.CreateNodeResponse{}, nil\n}", "title": "" }, { "docid": "7787590a08b5cc80386c2de3184ca5ab", "score": "0.5018164", "text": "func (r *RTR) CreateCompute1(cell Cell, compute func(int) int) ComputeCell {\n\tvar name uuid.UUID\n\tswitch cell.(type) {\n\tcase *InpCell:\n\t\tc := cell.(*InpCell)\n\t\tname = c.name\n\tcase *ComCell:\n\t\tc := cell.(*ComCell)\n\t\tname = c.name\n\tcase *Cel:\n\t\tc := cell.(*Cel)\n\t\tname = c.name\n\t}\n\tcomp := &ComCell{\n\t\tCel: Cel{},\n\t\tcompute: compute,\n\t\tparentName: []uuid.UUID{name},\n\t\tcallbacks: make(map[uuid.UUID]func(int), 0),\n\t}\n\tcomp.rtr = r\n\tcomp.name = uuid.New()\n\t// register to reactor\n\tr.cellDeps[name] = append(r.cellDeps[name], comp)\n\tr.cellVals[comp.name] = compute(r.cellVals[name])\n\treturn comp\n}", "title": "" } ]
9f3baa3d2f455982e53fcf43678fca4d
PushHook adds a function to the end of hook queue. Each invocation of the SetConfigurationSummary method of the parent MockStore instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.
[ { "docid": "b35c50512b4c6c4ff83a8a78c95cc660", "score": "0.7654265", "text": "func (f *StoreSetConfigurationSummaryFunc) PushHook(hook func(context.Context, int, int, map[string]shared2.AvailableIndexer) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" } ]
[ { "docid": "611fcfaaa49255a6338babcbe9d01112", "score": "0.7230116", "text": "func (f *StoreTruncateConfigurationSummaryFunc) PushHook(hook func(context.Context, int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b43cd8b92b99f85f7350bea877127d90", "score": "0.6890834", "text": "func (f *WorkerStoreResetStalledFunc[T]) PushHook(hook func(context.Context) (map[int]time.Duration, map[int]time.Duration, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "2aeaf32217fd2cbf9304f4b2778e044a", "score": "0.6886728", "text": "func (f *WorkerStoreHeartbeatFunc[T]) PushHook(hook func(context.Context, []int, store1.HeartbeatOptions) ([]int, []int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "37058ad496191047c680e8171f5a7cf7", "score": "0.6885033", "text": "func (f *DBStoreDefinitionDumpsFunc) PushHook(hook func(context.Context, []precise.QualifiedMonikerData) ([]dbstore.Dump, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "6348292518506c7fef7128a941cfc234", "score": "0.68806934", "text": "func (f *SavedSearchStoreListAllFunc) PushHook(hook func(context.Context) ([]api.SavedQuerySpecAndConfig, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9d8fc023f44c6bf826680dfce85f0eb6", "score": "0.6879258", "text": "func (f *DBStoreUpdateConfigurationPolicyFunc) PushHook(hook func(context.Context, dbstore.ConfigurationPolicy) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f3572510afd6998e98f870e26d0ffd7a", "score": "0.68466616", "text": "func (f *LSIFStoreDefinitionsFunc) PushHook(hook func(context.Context, int, string, int, int, int, int) ([]lsifstore.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "d201c326e51c713d80e5cb850688e454", "score": "0.678426", "text": "func (f *StoreTopRepositoriesToConfigureFunc) PushHook(hook func(context.Context, int) ([]shared2.RepositoryWithCount, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f178ef7e5dcc248e8ff59757a03092d1", "score": "0.67722857", "text": "func (f *WorkerStoreMarkCompleteFunc[T]) PushHook(hook func(context.Context, int, store1.MarkFinalOptions) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4e2d99be13d8d51fc9f404af2d9ada02", "score": "0.67575014", "text": "func (f *WorkerStoreUpdateExecutionLogEntryFunc[T]) PushHook(hook func(context.Context, int, int, executor.ExecutionLogEntry, store1.ExecutionLogEntryOptions) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a908cdc258eaf03b5d8975428e673ab4", "score": "0.6748108", "text": "func (f *LSIFStoreImplementationsFunc) PushHook(hook func(context.Context, int, string, int, int, int, int) ([]lsifstore.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a310b7dc7e4858327ba28d852be69ce6", "score": "0.6737681", "text": "func (f *WorkerStoreAddExecutionLogEntryFunc[T]) PushHook(hook func(context.Context, int, executor.ExecutionLogEntry, store1.ExecutionLogEntryOptions) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "024425a49e554d1eadf10f47ecb2e393", "score": "0.6706757", "text": "func (f *StoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "fd9f318c58c1121d59902b97eec36ef2", "score": "0.67038846", "text": "func (f *StoreRepositoryIDsWithConfigurationFunc) PushHook(hook func(context.Context, int, int) ([]shared2.RepositoryWithAvailableIndexers, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e369e4723d12ff73afcd67ec8d8004f4", "score": "0.66793704", "text": "func (f *StoreIsQueuedRootIndexerFunc) PushHook(hook func(context.Context, int, string, string, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "022eb40455c8652c4a940ea9f15475fd", "score": "0.6676955", "text": "func (f *StoreIsQueuedFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "92f89edf27a181816417b668272f2601", "score": "0.66491914", "text": "func (f *DBStoreCreateConfigurationPolicyFunc) PushHook(hook func(context.Context, dbstore.ConfigurationPolicy) (dbstore.ConfigurationPolicy, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "37cb5533bfedf7e4805baea1543dd902", "score": "0.66488373", "text": "func (f *StoreUpdateIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int, []byte) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1ba6f3bdf6d3d92dca560b6ab9618ea9", "score": "0.66433054", "text": "func (f *DBStoreOldestDumpForRepositoryFunc) PushHook(hook func(context.Context, int) (dbstore.Dump, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "344c2efb44cb8f27d944cbc0960bf59e", "score": "0.66032624", "text": "func (f *DBStoreCommitGraphMetadataFunc) PushHook(hook func(context.Context, int) (bool, *time.Time, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8ae941b24b9dab89c33641e211b34d6a", "score": "0.65970415", "text": "func (f *WorkerStoreRequeueFunc[T]) PushHook(hook func(context.Context, int, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "91079722598ba7a929707828fb9e817a", "score": "0.6586837", "text": "func (f *WorkerStoreDequeueFunc[T]) PushHook(hook func(context.Context, string, []*sqlf.Query) (T, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "3f5a2f8222ee961e8ec362d82a3dc13c", "score": "0.65831697", "text": "func (f *DBStoreIsQueuedFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "52da570971f44a5d7edd025cf7783162", "score": "0.65586", "text": "func (f *LSIFStoreDiagnosticsFunc) PushHook(hook func(context.Context, int, string, int, int) ([]lsifstore.Diagnostic, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8c844429cd21e85f992c0043203e59c2", "score": "0.65549606", "text": "func (f *EnqueuerDBStoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ba87a3eb232aa967b5695b77b794383f", "score": "0.6550696", "text": "func (f *DBStoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ba87a3eb232aa967b5695b77b794383f", "score": "0.6550696", "text": "func (f *DBStoreDoneFunc) PushHook(hook func(error) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "7b2fddaf1f4165361bf5698b1d1f393d", "score": "0.65464044", "text": "func (f *WorkerStoreQueuedCountFunc[T]) PushHook(hook func(context.Context, bool) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "25260dc4d90f336dc9a3579b98e0b020", "score": "0.653332", "text": "func (f *WorkerStoreHandleFunc[T]) PushHook(hook func() basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b6f804cde94ea16a47eb701d9171bcbe", "score": "0.6528263", "text": "func (f *IndexEnqueuerInferIndexConfigurationFunc) PushHook(hook func(context.Context, int, string, bool) (*config.IndexConfiguration, []config.IndexJobHint, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "7c1cd2725b21304a187f42d1222c6a40", "score": "0.6527386", "text": "func (f *DBStoreUpdateIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int, []byte) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "6e1dfa2e6ecebc9705afebc8dc730ff0", "score": "0.6503492", "text": "func (f *DBStoreGetConfigurationPoliciesFunc) PushHook(hook func(context.Context, dbstore.GetConfigurationPoliciesOptions) ([]dbstore.ConfigurationPolicy, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "3a12810303b6cd111a839e66b4ecc81f", "score": "0.64880276", "text": "func (f *DBStoreResetIndexableRepositoriesFunc) PushHook(hook func(context.Context, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "5a42ff010ebf16390233bb43634d147a", "score": "0.64817363", "text": "func (f *EnqueuerDBStoreIsQueuedFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "32606b2868f2dc9d67665be6a5618b9d", "score": "0.6481626", "text": "func (f *DBResetStalledFunc) PushHook(hook func(context.Context, time.Time) ([]int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8bd7d63a432a8e4a63d295b7763956ce", "score": "0.6480547", "text": "func (f *StoreGetIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int) (shared2.IndexConfiguration, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f17e09f7e8438fd93c51e3450072e581", "score": "0.64741635", "text": "func (f *DBStoreHandleFunc) PushHook(hook func() *basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8c741c8bdb94399ce4aa6e0488a79829", "score": "0.6467935", "text": "func (f *WorkerStoreMaxDurationInQueueFunc[T]) PushHook(hook func(context.Context) (time.Duration, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "3ff6550984a28b2d6d41e08317860063", "score": "0.6459432", "text": "func (f *EnqueuerDBStoreHandleFunc) PushHook(hook func() basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9427ae3b646a02e2dff75c0f201a9e45", "score": "0.6457267", "text": "func (f *DBStoreHandleFunc) PushHook(hook func() basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "02087840e9ed005703332d6e4e635892", "score": "0.6448763", "text": "func (f *CommitStoreUpsertMetadataStampFunc) PushHook(hook func(context.Context, api.RepoID) (CommitIndexMetadata, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "d5aaf83c23f54e26d4ace2d89f2cbff2", "score": "0.64417404", "text": "func (f *DBQueueSizeFunc) PushHook(hook func(context.Context) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c8c7d110138ecbb1b504f8499174b853", "score": "0.64410543", "text": "func (f *DBStoreRecentUploadsSummaryFunc) PushHook(hook func(context.Context, int) ([]dbstore.UploadsWithRepositoryNamespace, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1e5c29057e6eebb5fcbe3557e85ec5c6", "score": "0.64317596", "text": "func (f *DBStoreFindClosestDumpsFunc) PushHook(hook func(context.Context, int, string, string, bool, string) ([]dbstore.Dump, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9e7bdb1ab811e2ce4c380d2296589566", "score": "0.64218754", "text": "func (f *StoreTransactFunc) PushHook(hook func(context.Context) (store.Store, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ad6b6c7fe3bd3d9e3df710581a169cb1", "score": "0.6414823", "text": "func (f *DBIndexQueueSizeFunc) PushHook(hook func(context.Context) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "5ff1eef7a0572c954779593c3e2cb1f6", "score": "0.6409641", "text": "func (f *SavedSearchStoreHandleFunc) PushHook(hook func() *basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c9748861be8f683c52c840c547210dc9", "score": "0.6407524", "text": "func (f *StoreGetLastIndexScanForRepositoryFunc) PushHook(hook func(context.Context, int) (*time.Time, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a867bfb23bef229c201f133c09c93add", "score": "0.6389064", "text": "func (f *DBStoreLastIndexScanForRepositoryFunc) PushHook(hook func(context.Context, int) (*time.Time, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "16acaa14b2abaa1259e08d6c303e8536", "score": "0.63881874", "text": "func (f *DBMarkQueuedFunc) PushHook(hook func(context.Context, int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "7e60074eeac30b76f90461e2c932948d", "score": "0.638296", "text": "func (f *ScenarioRunnerFactoryNewFunc) PushHook(hook func(*config.Scenario, logging.Logger, logging.VerbosityLevel, *semaphore.Weighted) ScenarioRunner) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b695ccb7bd8e6cc86de6a084e5504e88", "score": "0.63794464", "text": "func (f *DBStoreLockFunc) PushHook(hook func(context.Context, int, bool) (bool, dbstore.UnlockFunc, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "2542c35f6c9f13e027edde2ff7a56649", "score": "0.6372884", "text": "func (f *DBStoreRepoUsageStatisticsFunc) PushHook(hook func(context.Context) ([]dbstore.RepoUsageStatistics, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "cc26731be73d9905917c600f6c51862a", "score": "0.63674176", "text": "func (f *WorkerStoreWithFunc[T]) PushHook(hook func(basestore.ShareableStore) store1.Store[T]) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "3d59bdc63d52d3e1806e3a71a7152c48", "score": "0.63521737", "text": "func (f *DBStoreLanguagesRequestedByFunc) PushHook(hook func(context.Context, int) ([]string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "fd5cf88078450c33d713523514b590ba", "score": "0.63490623", "text": "func (f *DBStoreSoftDeleteOldDumpsFunc) PushHook(hook func(context.Context, time.Duration, time.Time) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e29ad141ca81a567854b7b1ba1e22a6e", "score": "0.63370466", "text": "func (f *LSIFStoreMonikersByPositionFunc) PushHook(hook func(context.Context, int, string, int, int) ([][]precise.MonikerData, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4fea4e53644fb61f3d1cf5c570e8c459", "score": "0.63313746", "text": "func (f *StoreSetRequestLanguageSupportFunc) PushHook(hook func(context.Context, int, string) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "558a14eb1cc2c8c2ceb7762b46d46b40", "score": "0.62964636", "text": "func (f *DBStoreGetIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int) (dbstore.IndexConfiguration, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "558a14eb1cc2c8c2ceb7762b46d46b40", "score": "0.62964636", "text": "func (f *DBStoreGetIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int) (dbstore.IndexConfiguration, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1838872dbd2bdda3312c9640a2d4f23e", "score": "0.6296144", "text": "func (f *DBSavepointFunc) PushHook(hook func(context.Context) (string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "256893c063e6b5bd4c774405735c4fd6", "score": "0.6288198", "text": "func (f *DBStoreTransactFunc) PushHook(hook func(context.Context) (DBStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "256893c063e6b5bd4c774405735c4fd6", "score": "0.6288198", "text": "func (f *DBStoreTransactFunc) PushHook(hook func(context.Context) (DBStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8c9a22133b8efe98118c5ff2698c679e", "score": "0.62867904", "text": "func (f *DBStoreRequestLanguageSupportFunc) PushHook(hook func(context.Context, int, string) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "040fbc2989962d54d5cefe9e92e29422", "score": "0.62848085", "text": "func (f *LSIFStoreBulkMonikerResultsFunc) PushHook(hook func(context.Context, string, []int, []precise.MonikerData, int, int) ([]lsifstore.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f642b37987ddc56ef5ea8640de36f40f", "score": "0.6280598", "text": "func (f *DBIsQueuedFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "544a068c7e9e764f029c55d5440d05e5", "score": "0.6279604", "text": "func (f *SavedSearchStoreUpdateFunc) PushHook(hook func(context.Context, *types.SavedSearch) (*types.SavedSearch, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "49ad54b35103afcf5369f46cb030872b", "score": "0.62783706", "text": "func (f *StoreGetLanguagesRequestedByFunc) PushHook(hook func(context.Context, int) ([]string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8b1c8819f279404cdf3bae6c461f82bc", "score": "0.62720644", "text": "func (f *DBRepoUsageStatisticsFunc) PushHook(hook func(context.Context) ([]db.RepoUsageStatistics, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4f7c0eb5312cf8409d8accaba1e25fab", "score": "0.62706393", "text": "func (f *SavedSearchStoreTransactFunc) PushHook(hook func(context.Context) (database.SavedSearchStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4e28efc97345d72121f515a8274cc64a", "score": "0.6266417", "text": "func (f *CommitStoreGetMetadataFunc) PushHook(hook func(context.Context, api.RepoID) (CommitIndexMetadata, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "5face25a68d1938cafc3f5fd6dd8e004", "score": "0.6261402", "text": "func (f *EnqueuerDBStoreTransactFunc) PushHook(hook func(context.Context) (autoindexing.DBStore, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "d6a78004cb30c3f3a9aafd66cca96e86", "score": "0.625925", "text": "func (f *OrgMemberStoreHandleFunc) PushHook(hook func() *basestore.TransactableHandle) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "cad5a55d954a54515551bc51ca7714c6", "score": "0.6258739", "text": "func (f *EnqueuerDBStoreGetIndexConfigurationByRepositoryIDFunc) PushHook(hook func(context.Context, int) (dbstore.IndexConfiguration, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1f54d62f6988d539c6a4fbfa5ce607a1", "score": "0.62540936", "text": "func (f *LSIFStorePackageInformationFunc) PushHook(hook func(context.Context, int, string, string) (precise.PackageInformationData, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "f6beb40de2bdf83b3dec870b2520c371", "score": "0.6251438", "text": "func (f *LSIFStoreClearFunc) PushHook(hook func(context.Context, ...int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "cde4a46276ca4bc99c51933c5a0f85b7", "score": "0.62510264", "text": "func (f *WorkerStoreMarkFailedFunc[T]) PushHook(hook func(context.Context, int, string, store1.MarkFinalOptions) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "282a53224c35c346157179d51d2a7846", "score": "0.62508684", "text": "func (f *IndexEnqueuerQueueIndexesForPackageFunc) PushHook(hook func(context.Context, shared.MinimialVersionedPackageRepo, bool) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "8a8dd8c99dfdd42988911cd5309fc70c", "score": "0.624025", "text": "func (f *DBStoreSelectPoliciesForRepositoryMembershipUpdateFunc) PushHook(hook func(context.Context, int) ([]dbstore.ConfigurationPolicy, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "548d73d004e23e6c1e5020d3ab791606", "score": "0.62099504", "text": "func (f *DBGetStatesFunc) PushHook(hook func(context.Context, []int) (map[int]string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "03419976f68ae7e5c1075dd4050dfb9e", "score": "0.6204306", "text": "func (f *LSIFStoreExistsFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "84966bb22af3f68ec58b6d7ffa4bf377", "score": "0.6203517", "text": "func (f *EnqueuerDBStoreRepoNameFunc) PushHook(hook func(context.Context, int) (string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "faa574438e3ced9edbbb7d88cd628add", "score": "0.62026227", "text": "func (f *StoreQueueRepoRevFunc) PushHook(hook func(context.Context, int, string) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b6bf3035e602dbb6114bc6b9abdfe76a", "score": "0.6202497", "text": "func (f *StoreNumRepositoriesWithCodeIntelligenceFunc) PushHook(hook func(context.Context) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "107ab63756e16454f1810e06917aced6", "score": "0.6202453", "text": "func (f *StoreInsertDependencyIndexingJobFunc) PushHook(hook func(context.Context, int, string, time.Time) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "b44392b2352649ea21a07226f761763b", "score": "0.6201349", "text": "func (f *LSIFStoreReferencesFunc) PushHook(hook func(context.Context, int, string, int, int, int, int) ([]lsifstore.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "fa06ceecd5463ef7544028953f1ca62b", "score": "0.6197089", "text": "func (f *LSIFStoreHoverFunc) PushHook(hook func(context.Context, int, string, int, int) (string, lsifstore.Range, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "349efd6de37e30acfdf1c6e6727f7593", "score": "0.61909723", "text": "func (f *StoreSetInferenceScriptFunc) PushHook(hook func(context.Context, string) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "69618004a6fadbd038e012183bf91c40", "score": "0.6186078", "text": "func (f *DBStoreHasCommitFunc) PushHook(hook func(context.Context, int, string) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "65dea6f55a4e1c00f8197985be9d45ec", "score": "0.61769664", "text": "func (f *DBRollbackToSavepointFunc) PushHook(hook func(context.Context, string) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "bf1e3fe28f3e229da6e941c606a6e7fd", "score": "0.6173023", "text": "func (f *DBFindClosestDumpsFunc) PushHook(hook func(context.Context, int, string, string, string) ([]db.Dump, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "1bd92e07c91d61d4c966929f558fd04e", "score": "0.61729103", "text": "func (f *UploadServiceGetRecentUploadsSummaryFunc) PushHook(hook func(context.Context, int) ([]shared1.UploadsWithRepositoryNamespace, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "de795daede3b2d2f5af52ad893bd7536", "score": "0.61686265", "text": "func (f *DBStoreUpdateIndexableRepositoryFunc) PushHook(hook func(context.Context, dbstore.UpdateableIndexableRepository, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "cf85fa5b937c499f9a8589d06cb9564c", "score": "0.61641103", "text": "func (f *DBMarkIndexCompleteFunc) PushHook(hook func(context.Context, int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "21e68355df96ba85ab44641cf26e4e07", "score": "0.61637455", "text": "func (f *HandlerHandleFunc) PushHook(hook func(context.Context) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "12f7949f4f55121c24403926c680b553", "score": "0.6162015", "text": "func (f *DBStoreRepoNameFunc) PushHook(hook func(context.Context, int) (string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "12f7949f4f55121c24403926c680b553", "score": "0.6162015", "text": "func (f *DBStoreRepoNameFunc) PushHook(hook func(context.Context, int) (string, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "ec2803848cb6c0faf6c9c2eaf6a72d25", "score": "0.61516774", "text": "func (f *PolicyMatcherCommitsDescribedByPolicyFunc) PushHook(hook func(context.Context, int, []types1.ConfigurationPolicy, time.Time, ...string) (map[string][]enterprise.PolicyMatch, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e10ee2cc5edc3bd7431960e2712e6ed4", "score": "0.61333567", "text": "func (f *DBMarkCompleteFunc) PushHook(hook func(context.Context, int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "87833641bdc1caac4c0f47ce5056bf37", "score": "0.61279494", "text": "func (f *SavedSearchStoreIsEmptyFunc) PushHook(hook func(context.Context) (bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" } ]
c9a0f899622cb91e5e0f6d4abb43d9e9
FixedDiscount returns what the fixed discount amount is for a particular currency.
[ { "docid": "20fcc6d3984d0e00aa9bffc9f763bfb5", "score": "0.8445629", "text": "func (d *MemberDiscount) FixedDiscount(currency string) float64 {\n\tif d.FixedAmount != nil {\n\t\tfor _, discount := range d.FixedAmount {\n\t\t\tif discount.Currency == currency {\n\t\t\t\tamount, _ := strconv.ParseFloat(discount.Amount, 64)\n\t\t\t\treturn rint(amount * 100)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0\n}", "title": "" } ]
[ { "docid": "37ec23e9a6187fb31a880740891aba28", "score": "0.6133774", "text": "func (d *DLC) FixedDeal() (idx int, deal *Deal, err error) {\n\tif !d.HasDealFixed() {\n\t\terr = newNoFixedDealError()\n\t\treturn\n\t}\n\treturn d.DealByMsgs(d.Oracle.SignedMsgs)\n}", "title": "" }, { "docid": "005dad0f4467733f255288ad913087bf", "score": "0.60953856", "text": "func (l Loan) GetDiscountFactor() float64 {\n\tvar commonBracket = math.Pow((1 + l.loanInterest.GetMonthlyCompound()), float64(l.loanTime.months))\n\treturn (commonBracket - 1) / (l.loanInterest.GetMonthlyCompound() * commonBracket)\n}", "title": "" }, { "docid": "47288cfdc5ae5305e26a818719ce71a5", "score": "0.5734226", "text": "func (bfr *BlackFridayRule) CalculateDiscount() float32 {\n\tif bfr.isBlackFriday() {\n\t\treturn bfr.BlackFridayPct\n\t}\n\treturn bfr.DefaultPct\n}", "title": "" }, { "docid": "dfeb5fae615c4cce356547070f57d730", "score": "0.5558618", "text": "func (o *InvoicesIdJsonInvoice) SetFixedCost(v string) {\n\to.FixedCost = &v\n}", "title": "" }, { "docid": "87ddb9fc51478789dd0f0c2d6a5f8d18", "score": "0.5555151", "text": "func (gfud *GetFreeUnitDiscount) ApplyDiscount(n int, price float64) float64 {\n\tfree := int(n / gfud.Buy)\n\tdiscount := float64(free) * price\n\treturn discount\n}", "title": "" }, { "docid": "37f1dc55f84790f75c8dbfe037bfe7ce", "score": "0.5487916", "text": "func (o *InvoicesIdJsonInvoice) GetFixedCost() string {\n\tif o == nil || o.FixedCost == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FixedCost\n}", "title": "" }, { "docid": "0603c67fb83acc8085840ab8b1d4dd08", "score": "0.54828703", "text": "func DecayFixed(minuend int) DecayFn {\n\treturn connmgr.DecayFixed(minuend)\n}", "title": "" }, { "docid": "74aafd7110c092c2d7091d7e4223e7e5", "score": "0.5440299", "text": "func (o RatePlanOutput) FixedFeeFrequency() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *RatePlan) pulumi.IntOutput { return v.FixedFeeFrequency }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "67a1d71634ca221c9d2d98850ccdea08", "score": "0.5318541", "text": "func (o RatePlanOutput) FixedRecurringFee() GoogleTypeMoneyResponseOutput {\n\treturn o.ApplyT(func(v *RatePlan) GoogleTypeMoneyResponseOutput { return v.FixedRecurringFee }).(GoogleTypeMoneyResponseOutput)\n}", "title": "" }, { "docid": "e10220229e5c7b4d6d057d1c3202a126", "score": "0.52655965", "text": "func (fp *FlightPricing) Discount() float64 {\n\tres, _ := strconv.ParseFloat(fp.DiscountString, 64)\n\treturn float64(res)\n}", "title": "" }, { "docid": "f83695641d7a07a3379ea01343d05003", "score": "0.52461064", "text": "func (a *FactoidAddress) SecFixed() *[ed.PrivateKeySize]byte {\n\treturn a.Sec\n}", "title": "" }, { "docid": "005ffe9408799c5ccb52a0a8658496ef", "score": "0.5207367", "text": "func NewDiscount(db *sql.DB) Discount {\n\treturn &discountImpl{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "f7464cab3e4f99463c8ed49465e41247", "score": "0.5156451", "text": "func (c *Client) FindPosDiscount(criteria *Criteria) (*PosDiscount, error) {\n\tpds := &PosDiscounts{}\n\tif err := c.SearchRead(PosDiscountModel, criteria, NewOptions().Limit(1), pds); err != nil {\n\t\treturn nil, err\n\t}\n\tif pds != nil && len(*pds) > 0 {\n\t\treturn &((*pds)[0]), nil\n\t}\n\treturn nil, fmt.Errorf(\"pos.discount was not found\")\n}", "title": "" }, { "docid": "5931c7596baceb8b10e7caba2d176a56", "score": "0.51102173", "text": "func (l Loan) GetDiscountFactorWithPrecisionLevel(precision int) float64 {\n\treturn round(l.GetDiscountFactor(), precision)\n}", "title": "" }, { "docid": "d25bf85aabb9bdd9334c4e70fdffcb4d", "score": "0.50076896", "text": "func applyDiscount(itemChannel <-chan item) <- chan item {\n\tout := make(chan item)\n\n\tgo func() {\n\t\tdefer close(out)\n\t\tfor value := range itemChannel {\n\t\t\tif value.discount {\n\t\t\t\tvalue.price = value.price * 0.5\n\t\t\t}\n\t\t\tout <- value\n\t\t}\n\n\t}()\n\treturn out\n}", "title": "" }, { "docid": "301b8e5e50805f3d05b75e075ff6b030", "score": "0.4979079", "text": "func (o FixedOrPercentResponseOutput) Fixed() pulumi.IntOutput {\n\treturn o.ApplyT(func(v FixedOrPercentResponse) int { return v.Fixed }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "5b47f7b7825ff6012eecf22689dbf6b7", "score": "0.49373567", "text": "func (lpd *LessPriceDiscount) ApplyDiscount(n int, price float64) float64 {\n\tdiscount := 0.0\n\tif n >= lpd.Buy {\n\t\tdiscount = (price - lpd.Price) * float64(n)\n\t}\n\treturn discount\n}", "title": "" }, { "docid": "03d7bc60517d906b77e8b7639ced0cd4", "score": "0.49169537", "text": "func getInternationalBankDepositFee(amount float64) float64 {\n\tvar fee float64\n\tif amount <= 100 {\n\t\tfee = amount * 0.0025\n\t\tif fee < 3 {\n\t\t\treturn 3\n\t\t}\n\t}\n\treturn fee\n}", "title": "" }, { "docid": "c27d8a64fddb88052ddc44e612ce7155", "score": "0.49017373", "text": "func (c *Client) GetPosDiscount(id int64) (*PosDiscount, error) {\n\tpds, err := c.GetPosDiscounts([]int64{id})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif pds != nil && len(*pds) > 0 {\n\t\treturn &((*pds)[0]), nil\n\t}\n\treturn nil, fmt.Errorf(\"id %v of pos.discount not found\", id)\n}", "title": "" }, { "docid": "a2055c065527b23ff47a9b3c06b82605", "score": "0.48664525", "text": "func (c Controller) GetDiscount(db *sql.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//define the params, required params and headers\n\t\tdiscount, paramsReq, params, headers, vars := models.Discount{}, []string{}, []string{}, [2]string{\"token\", \"store_id\"}, mux.Vars(r)\n\t\tid, ok := vars[\"id\"]\n\n\t\t//get the token, make the header map and add the token to the header Map\n\t\ttoken, storeID, headerMap := r.Header.Get(\"token\"), r.Header.Get(\"store_id\"), make(map[string]string)\n\t\theaderMap[\"token\"] = token\n\t\theaderMap[\"store_id\"] = storeID\n\n\t\tr.ParseMultipartForm(0)\n\n\t\t//check required body params are sent, check token and expiration on token\n\t\tmissing, ok, auth, _ := utils.CheckTokenAndParams(headers, headerMap, paramsReq, params, r, db)\n\t\tif !auth {\n\t\t\terr := models.Error{\"Invalid session\"}\n\t\t\tutils.SendError(w, 401, err)\n\t\t\treturn\n\t\t} else if !ok {\n\t\t\terr := models.Error{\"Missing \" + missing + \" parameter\"}\n\t\t\tutils.SendError(w, 422, err)\n\t\t\treturn\n\t\t}\n\n\t\t//instantiate a new DiscountRepo struct to call the GetDiscountsRepo method on\n\t\trepo := repository.DiscountRepo{}\n\n\t\tres, err := repo.GetDiscountRepo(db, discount, headerMap, id)\n\t\tif err != nil {\n\t\t\terr := models.Error{\"Unable to get products\"}\n\t\t\tutils.SendError(w, 500, err)\n\t\t\treturn\n\t\t}\n\n\t\t//encode our res slice and send it back to the front end\n\t\tutils.SendSuccess(w, res)\n\t}\n}", "title": "" }, { "docid": "a0a1699eee1c272baa154ca9d41d117f", "score": "0.4838678", "text": "func (currency Currency) GetFee() (uint64, error) {\n\tswitch currency {\n\tcase Nothing:\n\t\treturn 0, nil\n\tcase Bitcoin:\n\t\treturn 10000, nil\n\tcase Litecoin:\n\t\treturn 100000, nil // as of 2017-07-28 Litecoin penalises any Vout < 100,000 Satoshi\n\tdefault:\n\t\treturn 0, fault.InvalidCurrency\n\t}\n}", "title": "" }, { "docid": "74a0caba476d196194313efdf7def592", "score": "0.48189077", "text": "func (d *DLC) HasDealFixed() bool {\n\treturn d.Oracle.SignedMsgs != nil && d.Oracle.Sig != nil\n}", "title": "" }, { "docid": "ef35fd0b9e494bb11bb81755bf195a7e", "score": "0.4775438", "text": "func getInternationalBankDepositFee(amount float64) float64 {\n\tfee := amount * 0.0005\n\n\tif fee < 7.5 {\n\t\treturn 7.5\n\t}\n\tif fee > 300 {\n\t\treturn 300\n\t}\n\treturn fee\n}", "title": "" }, { "docid": "0e2a221bc7ba9b7d4d70e0130c87f2fb", "score": "0.47071502", "text": "func (c *DiscountClient) DiscountAsk(ctx context.Context, userID, productID string) (float32, int32, error) {\n\tif c.conn == nil {\n\t\treturn 0, 0, errors.New(\"no connection, dial first\")\n\t}\n\trequestCtx, cancel := context.WithTimeout(ctx, c.timeout)\n\tdefer cancel()\n\tr, err := c.pbDiscountService.Discount(requestCtx, &pb.DiscountRequest{ProductId: productID, UserId: userID})\n\tif err != nil {\n\t\tlog.Printf(\"DicountClient could not ask discount: %v\", err)\n\t\treturn 0, 0, err\n\t}\n\n\treturn r.GetPct(), r.GetValueInCents(), nil\n}", "title": "" }, { "docid": "c96758491ded3c01c229fae39f07be28", "score": "0.46967646", "text": "func (o FixedOrPercentOutput) Fixed() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v FixedOrPercent) *int { return v.Fixed }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "14a3255261f24703d87288485612bd18", "score": "0.46941411", "text": "func processDiscount(discount Discount, basketQuantity map[string]int, inventory map[string]Product) []Line {\n\tvar lines []Line\n\tvar entry Line\n\tvar discountAppliedCount = 0\n\n\t// Unpack current discount.\n\tvar qualifyingItem = discount.qualifyingItem\n\tvar qualifyingItemQuantity = discount.qualifyingItemQuantity\n\tvar discountedItem = discount.discountedItem\n\tvar discountedItemQuantity = discount.discountedItemQuantity\n\tvar discountPerDiscountedItem = discount.discountPerDiscountedItem\n\tvar limit = discount.limit\n\n\t// Stop applying this discount when we reach our discount limit.\n\tfor discountAppliedCount = 0; discountAppliedCount <= limit; discountAppliedCount++ {\n\n\t\t// Check if enough qualifying items are found.\n\t\tif basketQuantity[qualifyingItem] >= qualifyingItemQuantity && basketQuantity[discountedItem] >= discountedItemQuantity {\n\t\t\tvar discountPrice float32\n\t\t\tvar discountItemBasePrice = inventory[discountedItem].basePrice\n\t\t\tvar qualifyingItemBasePrice = inventory[qualifyingItem].basePrice\n\n\t\t\t// When discountedItemQuantity is zero, all discountedItems receive the discount.\n\t\t\tif discountedItemQuantity == 0 {\n\n\t\t\t\t// Calculate discount to apply (Avoid divide by zero error).\n\t\t\t\tdiscountPrice = discountPerDiscountedItem * discountItemBasePrice\n\n\t\t\t\t// Consume all of the discounted items.\n\t\t\t\tfor i := basketQuantity[qualifyingItem]; i > 0; i-- {\n\t\t\t\t\tbasketQuantity[qualifyingItem]--\n\t\t\t\t\tentry = Line{discountedItem, discountItemBasePrice, discount.id, discountPrice * -1}\n\t\t\t\t\tlines = append(lines, entry)\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Calculate discount to apply (Avoid divide by zero error).\n\t\t\t\tdiscountPrice = discountPerDiscountedItem * float32(discountedItemQuantity) * discountItemBasePrice\n\n\t\t\t\t// Consume discounted items.\n\t\t\t\tbasketQuantity[discountedItem] = basketQuantity[discountedItem] - discountedItemQuantity\n\t\t\t\tentry = Line{discountedItem, discountItemBasePrice, discount.id, discountPrice * -1}\n\t\t\t\tlines = append(lines, entry)\n\n\t\t\t\t// Consume the qualifying items.\n\t\t\t\tbasketQuantity[qualifyingItem]--\n\t\t\t\tentry = Line{qualifyingItem, qualifyingItemBasePrice, \"\", 0}\n\t\t\t\tlines = append(lines, entry)\n\t\t\t}\n\n\t\t\t// Loop unlimited specials.\n\t\t\tif limit == 0 {\n\t\t\t\tdiscountAppliedCount--\n\t\t\t}\n\t\t}\n\t}\n\treturn lines\n}", "title": "" }, { "docid": "aedbd8826ebd84312ceb4d98d66ce7d4", "score": "0.466753", "text": "func (dsi *discountImpl) GetDiscount(discountID string) (config.GeneralSale, error) {\n\tsale := config.GeneralSale{}\n\tvar skills []byte\n\n\texists, err := dsi.isRowExist(discountID)\n\tif err != nil {\n\t\treturn sale, err\n\t}\n\tif !exists {\n\t\treturn sale, ErrNotFound\n\t}\n\n\terr = dsi.db.QueryRow(getDiscount, discountID).Scan(&sale.ID, &sale.Rule, &skills, &sale.Discount)\n\tif err != nil {\n\t\treturn sale, err\n\t}\n\t// TODO: add a new struct to unmarshal json\n\terr = json.Unmarshal(skills, &sale.Elements)\n\treturn sale, err\n}", "title": "" }, { "docid": "db1a7d032abb1796f066b68d1c6d71b2", "score": "0.46310702", "text": "func (c Controller) EditDiscount(db *sql.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//define the params, required params and headers\n\t\tparamsReq, params, headers := []string{\"discounts\"}, []string{}, [2]string{\"token\", \"store_id\"}\n\n\t\t//get the token, make the header map and add the token to the header Map\n\t\ttoken, storeID, headerMap := r.Header.Get(\"token\"), r.Header.Get(\"store_id\"), make(map[string]string)\n\t\theaderMap[\"token\"] = token\n\t\theaderMap[\"store_id\"] = storeID\n\n\t\t//parse the request body\n\t\tr.ParseMultipartForm(0)\n\n\t\t//check required body params are sent, check token and expiration on token\n\t\tmissing, ok, auth, paramsMap := utils.CheckTokenAndParams(headers, headerMap, paramsReq, params, r, db)\n\t\tif !auth {\n\t\t\terr := models.Error{\"Invalid session\"}\n\t\t\tutils.SendError(w, 401, err)\n\t\t\treturn\n\t\t} else if !ok {\n\t\t\terr := models.Error{\"Missing \" + missing + \" parameter\"}\n\t\t\tutils.SendError(w, 422, err)\n\t\t\treturn\n\t\t}\n\n\t\t//create the model for the response (just a simple successful message will do for now to show it was completed, will return custom error message if fails)\n\t\tres := \"Successfully updated discounts\"\n\n\t\t//instantiate a new DiscountRepo struct to call the GetDiscountsRepo method on\n\t\trepo := repository.DiscountRepo{}\n\n\t\t//run the EditDiscountRepo method on repo. check for errors, send back error and http status code\n\t\tmsg, err := repo.EditDiscountRepo(db, headerMap, paramsMap)\n\t\tif err != nil {\n\t\t\tutils.SendError(w, 500, msg)\n\t\t\treturn\n\t\t}\n\n\t\t//send back the response to\n\t\tutils.SendSuccess(w, res)\n\t}\n}", "title": "" }, { "docid": "315cc1982a6b7dd4dbba506dd06554fb", "score": "0.45601872", "text": "func (c *Client) FindPosDiscountId(criteria *Criteria, options *Options) (int64, error) {\n\tids, err := c.Search(PosDiscountModel, criteria, options)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tif len(ids) > 0 {\n\t\treturn ids[0], nil\n\t}\n\treturn -1, fmt.Errorf(\"pos.discount was not found\")\n}", "title": "" }, { "docid": "6a0769f06ae78b06fec0a09e2dc746b7", "score": "0.4560035", "text": "func (amount *Amount) ToFixed64() common.Fixed64 {\n\tif amount == nil {\n\t\treturn 0\n\t}\n\treturn amount.Fixed64\n}", "title": "" }, { "docid": "343b7445c54116d0c03168a9b11aaa7b", "score": "0.45600325", "text": "func fix(x float64, decs int) float64 {\n\ty := int64(math.Pow(10.0, float64(decs)))\n\tz := int64(x * float64(y))\n\tfmt.Printf(\"%d\\n\", z)\n\tx = float64(int64(x * float64(y))) / float64(y)\n\tfmt.Printf(\"%10.5f\\n\", x)\n\treturn x\n}", "title": "" }, { "docid": "d6f83c52d21bf80b84fa0e3460e4d8f3", "score": "0.45435157", "text": "func (a *ECAddress) SecFixed() *[ed.PrivateKeySize]byte {\n\treturn a.Sec\n}", "title": "" }, { "docid": "34e8234d77dfdaf7f65608ec186842e0", "score": "0.4531663", "text": "func (c *Collection) GetTotalDiscount() *ByTotalPrice {\n\treturn &c.ByTotalPrice\n}", "title": "" }, { "docid": "72d1d88151adde75aceaa7f28b7862a5", "score": "0.4478712", "text": "func discountPrices(sentence string, discount int) string {\n // Unicode-spacing / ask the char set type\n tokens := strings.Fields(sentence)\n newTokens := []string{}\n multiplier := (float64)(100-discount)/(float64)(100.0)\n for _, token := range tokens {\n // RE2 regex 2 regexp \n // + : 1 or unlimited ( vs * 0 or unlimited )\n // REGEXPs : begin and end of strings\n matchedPrice, _ := regexp.MatchString(`^\\$\\d+$`, token)\n if matchedPrice {\n priceStr := token[1:]\n // How wide is the returned type?\n // 32-bit and 64-bit floats\n priceNum, _ := strconv.ParseFloat(priceStr,64)\n newPriceNum := priceNum * multiplier\n newToken := \"$\" + strconv.FormatFloat(newPriceNum, 'f',2,64)\n newTokens = append(newTokens, newToken)\n } else {\n newTokens = append(newTokens, token)\n }\n }\n spaceStr := \" \"\n stringResult := strings.Join(newTokens[:], spaceStr)\n return stringResult\n}", "title": "" }, { "docid": "1dda58c2efc4467530f6f5e6869883ab", "score": "0.44473916", "text": "func (b Book) NetPrice() int {\n\treturn (b.PriceCents) * (1 - (b.DiscountPercent / 100))\n}", "title": "" }, { "docid": "837952821b572c9cb2e465a4bc2ee750", "score": "0.43853065", "text": "func NewFixed() (update FixedFunc, closeAll func()) {\n\tvar refresh func()\n\n\tvar laststyles Styles\n\tvar lastcells []Element\n\tvar lastresult Element\n\tvar initialized bool\n\teltFnMap := map[interface{}]eltFunc{}\n\teltCloseMap := map[interface{}]func(){}\n\teltUsedMap := map[interface{}]bool{}\n\n\tcLocal := &eltDep{\n\t\telt: func(key interface{}, props Props, children ...Element) (result Element) {\n\t\t\teltUsedMap[key] = true\n\t\t\tif eltFnMap[key] == nil {\n\t\t\t\teltFnMap[key], eltCloseMap[key] = newelt()\n\t\t\t}\n\t\t\treturn eltFnMap[key](key, props, children...)\n\t\t},\n\t}\n\n\tclose := func() {\n\t\tfor key := range eltCloseMap {\n\t\t\tif !eltUsedMap[key] {\n\t\t\t\teltCloseMap[key]()\n\t\t\t\tdelete(eltCloseMap, key)\n\t\t\t\tdelete(eltFnMap, key)\n\t\t\t}\n\t\t}\n\t\teltUsedMap = map[interface{}]bool{}\n\t}\n\n\tcloseAll = func() {\n\t\tclose()\n\n\t}\n\n\tupdate = func(c interface{}, styles Styles, cells ...Element) (result Element) {\n\t\trefresh = func() {\n\n\t\t\tlastresult = fixed(cLocal, styles, cells...)\n\n\t\t\tclose()\n\t\t}\n\n\t\tif initialized {\n\t\t\tswitch {\n\n\t\t\tcase laststyles != styles:\n\t\t\tdefault:\n\n\t\t\t\tif len(lastcells) != len(cells) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdiff := false\n\t\t\t\tfor kk := 0; !diff && kk < len(cells); kk++ {\n\n\t\t\t\t\tdiff = lastcells[kk] != cells[kk]\n\n\t\t\t\t}\n\t\t\t\tif diff {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\treturn lastresult\n\t\t\t}\n\t\t}\n\t\tinitialized = true\n\t\tlaststyles = styles\n\t\tlastcells = cells\n\t\trefresh()\n\t\treturn lastresult\n\t}\n\n\treturn update, closeAll\n}", "title": "" }, { "docid": "ed7d3f4e6c7cb4ad3b81a43ebd03eff3", "score": "0.4368536", "text": "func NewFIBeneficiaryFI() *FIBeneficiaryFI {\n\tfibfi := &FIBeneficiaryFI{\n\t\ttag: TagFIBeneficiaryFI,\n\t}\n\treturn fibfi\n}", "title": "" }, { "docid": "8bd03d4f98efc7432db397f30aa312d2", "score": "0.43610427", "text": "func NewFIBeneficiary() *FIBeneficiary {\n\tfib := &FIBeneficiary{\n\t\ttag: TagFIBeneficiary,\n\t}\n\treturn fib\n}", "title": "" }, { "docid": "d522dc076c5ac12dde515f8c3e47990f", "score": "0.4357376", "text": "func (o FixedOrPercentPtrOutput) Fixed() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *FixedOrPercent) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Fixed\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e914d388891764273c3326439ae7abd0", "score": "0.43501025", "text": "func (o *InvoicesIdJsonInvoice) GetFixedCostOk() (*string, bool) {\n\tif o == nil || o.FixedCost == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FixedCost, true\n}", "title": "" }, { "docid": "6b928696757d6905fc533cd96fc12906", "score": "0.4328368", "text": "func (d *MUD) CDF(util float64) (prob float64) {\n\t// Find the edge <= util\n\trighti := sort.Search(len(d.edges), func(n int) bool {\n\t\treturn util < d.edges[n].x\n\t})\n\tif righti == 0 {\n\t\treturn 0\n\t}\n\tlefti := righti - 1\n\tleft := d.edges[lefti]\n\n\t// Compute the cumulative value\n\treturn d.csums[lefti] + left.dirac + left.y*(util-left.x)\n}", "title": "" }, { "docid": "d80fdb122d33e38e27ba195b6f4e8d25", "score": "0.43121627", "text": "func (m *EstimateFeeResponse) GetFeerateSatPerByte() int64 {\n\tif m != nil {\n\t\treturn m.FeerateSatPerByte\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "be70478eee3345241ae0603225945f74", "score": "0.43113464", "text": "func (_Cozy *CozyCaller) FEEDIVIDER(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Cozy.contract.Call(opts, out, \"FEE_DIVIDER\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "494e262b4035ec78b0adc6afba9045ec", "score": "0.429846", "text": "func NewDiscountController(router gin.IRouter, client *ent.Client) *DiscountController {\n\tp := &DiscountController{\n\t\tclient: client,\n\t\trouter: router,\n\t}\n\tp.register()\n\treturn p\n}", "title": "" }, { "docid": "77f607469533d78d7f01eafb85ad525d", "score": "0.42962378", "text": "func FindDiscountAttribute(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*DiscountAttribute, error) {\n\tdiscountAttributeObj := &DiscountAttribute{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `discount_attributes` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, discountAttributeObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from discount_attributes\")\n\t}\n\n\treturn discountAttributeObj, nil\n}", "title": "" }, { "docid": "d0d8deec7af9854e00cb20c77d3fb911", "score": "0.4295841", "text": "func (o *Position) GetFxRateAccount() float64 {\n\tif o == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn o.FxRateAccount\n}", "title": "" }, { "docid": "4e8ebeb7b83722ed63e0f44814b8ca61", "score": "0.42769736", "text": "func (b *BetaBinom) Cdf(flips float64) float64 {\n\tresult := 0.0\n\tfor i := 0.0; i <= flips; i++ {\n\t\tresult += b.Pdf(i)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4b9c4e461cdce26f1df0969bf44d3a44", "score": "0.42762864", "text": "func (c *Collection) SetTotalDiscount(percent, treshold int) {\n\tc.ByTotalPrice = *NewByTotalPrice(percent, treshold)\n}", "title": "" }, { "docid": "df5d162f08995116a542fafe2b9efc97", "score": "0.42496336", "text": "func (c *Client) UpdatePosDiscount(pd *PosDiscount) error {\n\treturn c.UpdatePosDiscounts([]int64{pd.Id.Get()}, pd)\n}", "title": "" }, { "docid": "13738944ab9cad320c7ab5f6639ecde1", "score": "0.4245122", "text": "func (o *ServiceSpecificationCommercePropertiesDto) GetFixedPriceDate() time.Time {\n\tif o == nil || IsNil(o.FixedPriceDate) {\n\t\tvar ret time.Time\n\t\treturn ret\n\t}\n\treturn *o.FixedPriceDate\n}", "title": "" }, { "docid": "79b50795c520aefb3ebfdc06a0122ab5", "score": "0.4243381", "text": "func (m IndicationofInterest) GetCouponRate() (v decimal.Decimal, err quickfix.MessageRejectError) {\n\tvar f field.CouponRateField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "747c6e9e026b0f9352d0df82742940a3", "score": "0.42370173", "text": "func main() {\n\tvar price float64\n\tfmt.Print(\"Price of the product: $\")\n\tfmt.Scanf(\"%f\\n\", &price)\n\n\tdiscount := price - (price * 5 / 100)\n\tfmt.Printf(\"The product with discount is: $%.2f\", discount)\n}", "title": "" }, { "docid": "abadfbac2617013748b529c2c2522d3a", "score": "0.42236036", "text": "func (d FixedDof) AreFixed(dofs FixedDof) bool { return dofs&^d == 0 }", "title": "" }, { "docid": "f3c840cebfa41f67859fee8308a18c00", "score": "0.42178148", "text": "func floatToDollar(amount float64) int64 {\n\tamount = amount * 100\n\tval, _ := strconv.ParseInt(fmt.Sprintf(\"%0.0f\", amount), 10, 64)\n\treturn val\n}", "title": "" }, { "docid": "375fe799cd2e279c2f2d760605c52731", "score": "0.4212517", "text": "func (b *Bittrex) GetWithdrawalFee(ctx context.Context, c currency.Code) (float64, error) {\n\tvar fee float64\n\n\tcurrencies, err := b.GetCurrencies(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor i := range currencies {\n\t\tif currencies[i].Symbol == c.String() {\n\t\t\tfee = currencies[i].TxFee\n\t\t}\n\t}\n\treturn fee, nil\n}", "title": "" }, { "docid": "4fe7d4116615f03a984df8a6e2023498", "score": "0.42116484", "text": "func FactoryFixed(p Interface) Factory {\n\treturn func() (Interface, error) {\n\t\treturn p, nil\n\t}\n}", "title": "" }, { "docid": "4fe7d4116615f03a984df8a6e2023498", "score": "0.42116484", "text": "func FactoryFixed(p Interface) Factory {\n\treturn func() (Interface, error) {\n\t\treturn p, nil\n\t}\n}", "title": "" }, { "docid": "467ebd8a6948e7f42f2bcdf947cfac24", "score": "0.4209117", "text": "func NewDomainFIPAclTemplate() *DomainFIPAclTemplate {\n\n\treturn &DomainFIPAclTemplate{}\n}", "title": "" }, { "docid": "22bcb1ffd1f3d9064e5045a77af49571", "score": "0.4206327", "text": "func (o *LicenseIncLicenseCountAllOf) GetPremierD2OpsFixedCount() int64 {\n\tif o == nil || o.PremierD2OpsFixedCount == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.PremierD2OpsFixedCount\n}", "title": "" }, { "docid": "a5d0b9a7cd3fbb31b833cfe4fecadbd3", "score": "0.41993263", "text": "func (v randomizedVerifier) FixedBlind(message, metadata, salt, blind, blindInv []byte) ([]byte, VerifierState, error) {\n\tr := new(big.Int).SetBytes(blind)\n\trInv := new(big.Int).SetBytes(blindInv)\n\tmetadataKey := derivePublicKey(v.cryptoHash, v.pk, metadata)\n\tinputMsg := encodeMessageMetadata(message, metadata)\n\treturn fixedPartiallyBlind(inputMsg, salt, r, rInv, metadataKey, v.hash)\n}", "title": "" }, { "docid": "4d8c33dafa54004f4e671bf827b52e24", "score": "0.41850933", "text": "func (c *Collection) GetItemDiscount(sku gelato.SKU) *ByItem {\n\n\tloadedByItem, ok := c.ByItem.Load(sku)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// do not check error, because values are always discount.ByItem type\n\tdisc, ok := loadedByItem.(ByItem)\n\tif !ok {\n\t\t// strange, maybe log about it\n\t\treturn nil\n\t}\n\n\treturn &disc\n}", "title": "" }, { "docid": "64f2a463956f14ca905e2d2cb92fd28a", "score": "0.41779464", "text": "func (fee *CustomRoyaltyFee) GetFallbackFee() CustomFixedFee {\n\tif fee.FallbackFee != nil {\n\t\treturn *fee.FallbackFee\n\t}\n\n\treturn CustomFixedFee{}\n}", "title": "" }, { "docid": "9e32df08ed3308abea2d48dd7633e7df", "score": "0.41760254", "text": "func (m Message) GetCurrency(f *field.CurrencyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "ae6d43c98c4a6eab02d6aabc1a80107f", "score": "0.41584876", "text": "func (o FloatingIpOutput) FixedIp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.FixedIp }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bc1d07db9a2274c795ba1b00452aa139", "score": "0.415286", "text": "func (s *RuleAction) SetFixedResponse(v *FixedResponseAction) *RuleAction {\n\ts.FixedResponse = v\n\treturn s\n}", "title": "" }, { "docid": "caefbda17420419e8643b8469a660b8f", "score": "0.41524628", "text": "func (c *Client) DeletePosDiscount(id int64) error {\n\treturn c.DeletePosDiscounts([]int64{id})\n}", "title": "" }, { "docid": "1a219e910449217d31b1429a0ebd4fe9", "score": "0.41493237", "text": "func calcFeeRate(fee string, size int) *decimal.Decimal {\n\tfeeInt, _ := strconv.Atoi(fee)\n\tvalue := decimal.New(int64(feeInt), 0).\n\t\tDiv(decimal.New(int64(size), 0)).\n\t\tDiv(decimal.New(1e5, 0)).\n\t\tTruncate(8)\n\n\treturn &value\n}", "title": "" }, { "docid": "65484adb937d2e87922f74591b58c937", "score": "0.41388613", "text": "func (m Millicents) ToDollarFloat() float64 {\n\t// rounds to nearest cent\n\td := math.Round(float64(m) / 1000)\n\t// convert cents to dollars\n\td = d / 100\n\treturn d\n}", "title": "" }, { "docid": "14da3297902c71d02a55e934e6669d3f", "score": "0.41349524", "text": "func getInternationalBankWithdrawalFee(amount float64) float64 {\n\tfee := amount * 0.0009\n\n\tif fee < 15 {\n\t\treturn 15\n\t}\n\treturn fee\n}", "title": "" }, { "docid": "2b762d40dbe58cf65381cd64f5d37020", "score": "0.41194928", "text": "func (c *Client) FindPosDiscounts(criteria *Criteria, options *Options) (*PosDiscounts, error) {\n\tpds := &PosDiscounts{}\n\tif err := c.SearchRead(PosDiscountModel, criteria, options, pds); err != nil {\n\t\treturn nil, err\n\t}\n\treturn pds, nil\n}", "title": "" }, { "docid": "3c9323bbadb43252698e939644b33356", "score": "0.40991548", "text": "func (m Message) Currency() (*field.CurrencyField, quickfix.MessageRejectError) {\n\tf := &field.CurrencyField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "1ffd7b506667f3eba5b0896eac420f22", "score": "0.4092582", "text": "func GetFees(c *rpcd.Client, currency string) (useFee, relayFee diviutil.Amount, err error) {\n\tvar netInfoResp struct {\n\t\tRelayFee float64 `json:\"relayfee\"`\n\t}\n\tvar walletInfoResp struct {\n\t\tPayTxFee float64 `json:\"paytxfee\"`\n\t}\n\tvar estimateResp struct {\n\t\tFeeRate float64 `json:\"feerate\"`\n\t}\n\n\tnetInfoRawResp, err := c.RawRequest(\"getnetworkinfo\", nil)\n\tif err == nil {\n\t\terr = json.Unmarshal(netInfoRawResp, &netInfoResp)\n\t\tif err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t}\n\twalletInfoRawResp, err := c.RawRequest(\"getwalletinfo\", nil)\n\tif err == nil {\n\t\terr = json.Unmarshal(walletInfoRawResp, &walletInfoResp)\n\t\tif err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t}\n\n\trelayFee, err = diviutil.NewAmount(netInfoResp.RelayFee)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tpayTxFee, err := diviutil.NewAmount(walletInfoResp.PayTxFee)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\t// Use user-set wallet fee when set and not lower than the network relay\n\t// fee.\n\tif payTxFee != 0 {\n\t\tmaxFee := payTxFee\n\t\tif relayFee > maxFee {\n\t\t\tmaxFee = relayFee\n\t\t}\n\t\treturn maxFee, relayFee, nil\n\t}\n\n\tfeeRPCMethod := \"estimatesmartfee\"\n\n\tparams := []json.RawMessage{[]byte(\"6\")}\n\testimateRawResp, err := c.RawRequest(feeRPCMethod, params)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\terr = json.Unmarshal(estimateRawResp, &estimateResp)\n\tif err == nil && estimateResp.FeeRate > 0 {\n\t\tuseFee, err = diviutil.NewAmount(estimateResp.FeeRate)\n\t\tif relayFee > useFee {\n\t\t\tuseFee = relayFee\n\t\t}\n\t\treturn useFee, relayFee, err\n\t}\n\n\tfmt.Println(\"warning: falling back to mempool relay fee policy\")\n\treturn relayFee, relayFee, nil\n}", "title": "" }, { "docid": "b09a415dbc04576cd1b59d2300745590", "score": "0.4090203", "text": "func (o HttpFaultDelayResponseOutput) FixedDelay() DurationResponseOutput {\n\treturn o.ApplyT(func(v HttpFaultDelayResponse) DurationResponse { return v.FixedDelay }).(DurationResponseOutput)\n}", "title": "" }, { "docid": "6715ab5bfd2c5518755c222e43223cf2", "score": "0.40861824", "text": "func (f *Finance) Fake() {\n\tf.Accountʹ()\n\tf.AccountNameʹ()\n\tf.Maskʹ()\n\tf.Amountʹ()\n\tf.TransactionTypeʹ()\n\tf.CurrencyCodeʹ()\n\tf.CurrencyNameʹ()\n\tf.CurrencySymbolʹ()\n}", "title": "" }, { "docid": "6b089a14d174e8a0a68d528d83f3be17", "score": "0.4086134", "text": "func getInternationalBankWithdrawalFee(amount float64) float64 {\n\tfee := amount * 0.0009\n\n\tif fee < 25 {\n\t\treturn 25\n\t}\n\treturn fee\n}", "title": "" }, { "docid": "61b4138837bae547198ac6f886e4f967", "score": "0.40813127", "text": "func NewFraudAmount(isoCurrencyCode ISOCurrencyCode, value float64) *FraudAmount {\n\tthis := FraudAmount{}\n\tthis.IsoCurrencyCode = isoCurrencyCode\n\tthis.Value = value\n\treturn &this\n}", "title": "" }, { "docid": "2f5b5618afa24969bc97b588c27ec756", "score": "0.4075087", "text": "func (d Discount) ApplyTo(price float64) float64 {\n\tif d.Mode == None {\n\t\treturn price\n\t}\n\tif d.Mode == NewValue {\n\t\treturn d.Value\n\t}\n\tif d.Mode == Amount {\n\t\treturn price - d.Value\n\t}\n\treturn price * (100 - d.Value) / 100\n}", "title": "" }, { "docid": "25f58c78985097de0ce8e592b33a81fc", "score": "0.40687898", "text": "func (a *etherCopyRate) RateF() float64 {\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\treturn a.rate * float64(1e9)\n}", "title": "" }, { "docid": "dfe4cbaf7a552fe8061e5b344818d227", "score": "0.40663126", "text": "func (d Decimal) StringFixed(places int32) string {\n\t// The StringFixed method allows for negative precision, which\n\t// MySQL doesn't support, so we cannot round this using the string\n\t// based rounding in formatFast. We must round the old-fashioned way.\n\trounded := d.Round(places)\n\treturn string(rounded.formatFast(0, false, false))\n}", "title": "" }, { "docid": "55a0442c9d2818132ab91f9835f34237", "score": "0.4060112", "text": "func (m Millicents) ToDollarFloatNoRound() float64 {\n\treturn float64(m) / 100000.0\n}", "title": "" }, { "docid": "8f71ff52725de26c33b6afb4529d7c11", "score": "0.40498278", "text": "func (o *LicenseIncLicenseCountAllOf) SetPremierD2OpsFixedCount(v int64) {\n\to.PremierD2OpsFixedCount = &v\n}", "title": "" }, { "docid": "9de518bbcf57d92ef4152a4091f44fa4", "score": "0.4048561", "text": "func (c Controller) GetDiscounts(db *sql.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//define the params, required params and headers\n\t\tdiscount, paramsReq, params, headers := models.Discount{}, []string{}, []string{}, [2]string{\"token\", \"store_id\"}\n\n\t\t//get the token, make the header map and add the token to the header map\n\t\ttoken, storeID, headerMap := r.Header.Get(\"token\"), r.Header.Get(\"store_id\"), make(map[string]string)\n\n\t\t//store the values in the map\n\t\theaderMap[\"token\"] = token\n\t\theaderMap[\"store_id\"] = storeID\n\n\t\t//parse the form\n\t\tr.ParseMultipartForm(0)\n\n\t\t//check required body params are sent, check token and expiration on token\n\t\tmissing, ok, auth, paramsMap := utils.CheckTokenAndParams(headers, headerMap, paramsReq, params, r, db)\n\t\tif !auth {\n\t\t\t//if auth is false the token is expired, send back invalid session response\n\t\t\terr := models.Error{\"Invalid session\"}\n\t\t\tutils.SendError(w, 401, err)\n\t\t\treturn\n\t\t} else if !ok {\n\t\t\terr := models.Error{\"Missing \" + missing + \" parameter\"}\n\t\t\tutils.SendError(w, 422, err)\n\t\t\treturn\n\t\t}\n\n\t\t//make the response. should be a slice of slices based off the parent discount. Groups together the sub discounts (different prices and quantities)\n\t\tres := [][]models.Discount{}\n\n\t\t//instantiate a new DiscountRepo struct to call the GetDiscountsRepo method on\n\t\trepo := repository.DiscountRepo{}\n\n\t\t//call the method GetDiscountsRepo pass the db, the discount data model, the response model, header and params maps\n\t\tres, err := repo.GetDiscountsRepo(db, discount, res, headerMap, paramsMap)\n\t\tif err != nil {\n\t\t\terrorMsg := err.Error()\n\t\t\tutils.SendError(w, 500, errorMsg)\n\t\t\treturn\n\t\t}\n\n\t\t//encode our res slice and send it back to the front end\n\t\tutils.SendSuccess(w, res)\n\t}\n}", "title": "" }, { "docid": "bcb0d24fb2e852097d85ea70e492d5bc", "score": "0.40468812", "text": "func (fr *fixedRule) getName() string {\n return \"fixed\"\n}", "title": "" }, { "docid": "ffcc1f969a431cdb45eb013358038023", "score": "0.40458414", "text": "func (m Message) GetCouponRate(f *field.CouponRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "ffcc1f969a431cdb45eb013358038023", "score": "0.40458414", "text": "func (m Message) GetCouponRate(f *field.CouponRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "ffcc1f969a431cdb45eb013358038023", "score": "0.40458414", "text": "func (m Message) GetCouponRate(f *field.CouponRateField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "fcc893e92877e55dc689639de7cbaa22", "score": "0.40414998", "text": "func (n *TerminalDevice_Channel_Otn) FecCorrectedBytes() *TerminalDevice_Channel_Otn_FecCorrectedBytes {\n\treturn &TerminalDevice_Channel_Otn_FecCorrectedBytes{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"fec-corrected-bytes\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "fcc893e92877e55dc689639de7cbaa22", "score": "0.40414998", "text": "func (n *TerminalDevice_Channel_Otn) FecCorrectedBytes() *TerminalDevice_Channel_Otn_FecCorrectedBytes {\n\treturn &TerminalDevice_Channel_Otn_FecCorrectedBytes{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"fec-corrected-bytes\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "831f9ee3bf2e32f1be2bbf6501cdda28", "score": "0.40393206", "text": "func (w *Wrapper) CDF(x float64) float64 {\n\t// TODO(jeff): CDF actually works, but i think it's way slower and this is\n\t// basically just as accurate since we only have ~256 colors. essentially,\n\t// we only have to do ~8 calls to quantile, rather than ~samples calls to\n\t// CDF.\n\n\t// return w.td.CDF(x)\n\n\tmin, max := w.quan(0), w.quan(1)\n\tif x <= min {\n\t\treturn 0\n\t}\n\tif x >= max {\n\t\treturn 1\n\t}\n\n\tminq, maxq := 0.0, 1.0\n\tfor i := 0; i < 6; i++ {\n\t\tmedq := (minq + maxq) / 2\n\t\tval := w.quan(medq)\n\t\tif x >= val {\n\t\t\tminq = medq\n\t\t} else {\n\t\t\tmaxq = medq\n\t\t}\n\t}\n\treturn (minq + maxq) / 2\n}", "title": "" }, { "docid": "124900cd1bc027e465763a2711c2668e", "score": "0.40198532", "text": "func (client *Client) QuerySavingsPlansDiscountWithCallback(request *QuerySavingsPlansDiscountRequest, callback func(response *QuerySavingsPlansDiscountResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *QuerySavingsPlansDiscountResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.QuerySavingsPlansDiscount(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": "df6614a94337a91047928345fdd60127", "score": "0.40143844", "text": "func (c *Clui) Confidentialf(format string, a ...interface{}) {\n\tc.Confidential(fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "ea4a67bc0d4cbe4ad4880325fd2337b5", "score": "0.40129042", "text": "func (m NoMDEntries) GetCouponRate() (f field.CouponRateField, err quickfix.MessageRejectError) {\n\terr = m.Get(&f)\n\treturn\n}", "title": "" }, { "docid": "a617587a1563914bbcfe21b1f52401e7", "score": "0.40068597", "text": "func (m Message) GetStrikeCurrency(f *field.StrikeCurrencyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "a617587a1563914bbcfe21b1f52401e7", "score": "0.40068597", "text": "func (m Message) GetStrikeCurrency(f *field.StrikeCurrencyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "97cce6433b6daf3e86dcacad292d61ab", "score": "0.4002424", "text": "func NewFixedRateExtractor(rateByServiceAndName map[string]map[string]float64) Extractor {\n\t// lower-case keys for case insensitive matching (see #3113)\n\trbs := make(map[string]map[string]float64, len(rateByServiceAndName))\n\tfor service, opRates := range rateByServiceAndName {\n\t\tk := strings.ToLower(service)\n\t\trbs[k] = make(map[string]float64, len(opRates))\n\t\tfor op, rate := range opRates {\n\t\t\trbs[k][strings.ToLower(op)] = rate\n\t\t}\n\t}\n\treturn &fixedRateExtractor{rateByServiceAndName: rbs}\n}", "title": "" }, { "docid": "3e9b6bd3aef30aadcd292eb175d5b966", "score": "0.39928693", "text": "func (poisson Poisson) Cdf(k int) (p float64) {\n\treturn\n}", "title": "" }, { "docid": "cb66913dafe2e38b0fc2afc3218174c5", "score": "0.3989674", "text": "func (m NoMDEntries) GetCurrency() (f field.CurrencyField, err quickfix.MessageRejectError) {\n\terr = m.Get(&f)\n\treturn\n}", "title": "" }, { "docid": "3beca13119c07231e84110d02005290a", "score": "0.3985086", "text": "func MockAllDiscounts() Discounts {\n\tallDiscounts := Discounts{}\n\tallDiscounts = append(allDiscounts, NewDiscount(globals.Coupon1, 10, 0, 200, 70, 200))\n\tallDiscounts = append(allDiscounts, NewDiscount(globals.Coupon2, 7, 50, 150, 100, 250))\n\tallDiscounts = append(allDiscounts, NewDiscount(globals.Coupon3, 7, 50, 150, 100, 250))\n\tallDiscounts = append(allDiscounts, NewDiscount(globals.Coupon4, 5, 50, 250, 10, 150))\n\treturn allDiscounts\n}", "title": "" }, { "docid": "b9ee3a43d42e7efec81946c8e9256d46", "score": "0.3980881", "text": "func (d *MUD) InvCDF(pctile float64) (util float64) {\n\tif pctile <= 0 {\n\t\treturn d.edges[0].x\n\t} else if pctile >= 1 {\n\t\treturn d.edges[len(d.edges)-1].x\n\t}\n\n\t// Find the cumulative sum <= pctile\n\trighti := sort.Search(len(d.csums), func(n int) bool {\n\t\treturn pctile < d.csums[n]\n\t})\n\tif righti == 0 {\n\t\t// XXX I don't think this can happen\n\t\treturn 0\n\t}\n\tlefti := righti - 1\n\tleft := d.edges[lefti]\n\n\t// Compute the utilization\n\tif pctile < d.csums[lefti]+left.dirac {\n\t\t// pctile falls in the CDF discontinuity\n\t\treturn left.x\n\t}\n\treturn (pctile-d.csums[lefti]-left.dirac)/left.y + left.x\n}", "title": "" }, { "docid": "eef72f7e2c7582be196be70d9384dc13", "score": "0.3975502", "text": "func (api *orderAPI) Applydiscount(obj *bookstore.ApplyDiscountReq) (*bookstore.Order, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn apicl.BookstoreV1().Order().Applydiscount(context.Background(), obj)\n\t}\n\tif api.localApplydiscountHandler != nil {\n\t\treturn api.localApplydiscountHandler(obj)\n\t}\n\treturn nil, fmt.Errorf(\"Action not implemented for local operation\")\n}", "title": "" } ]
595b170bfc3b330d0bd4e58a6fcea0a3
CreateChallenges generate challenges based on the current team ranking and uploads it to Firestore.
[ { "docid": "adc9be0f2edc838789fc4e954bd5ae8e", "score": "0.8414787", "text": "func CreateChallenges(ctx context.Context, tournament *firestore.DocumentRef, round Round) {\n\t// Get ranking from current round.\n\tteams := make(map[int]string)\n\trankingdsnap, err := tournament.Collection(\"ranking\").Doc(round.String()).Get(ctx)\n\tif err != nil {\n\t\tlog.Fatalln(\"Error reading ranking from Firestore: \", err)\n\t}\n\trankingdata := rankingdsnap.Data()\n\n\tfor key, value := range rankingdata {\n\t\ti, err := strconv.Atoi(key)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"An error has occurred converting a to i: %s\", err)\n\t\t}\n\t\tteams[i] = value.(string)\n\t}\n\n\t// Figure out divisions. Assign map[string][]int which maps divisions to ranks.\n\t// Division have the followings names:\n\t// X, S+ Upper, S+ Lower, S Upper, S Middle, S Lower, A+ Upper, A+ Middle, A+ Lower,\n\t// A Upper, A Middle, A Lower, B Upper, B Middle, B Lower.\n\n\tdivisionToTeam := make(map[Division][]int)\n\n\tswitch len(teams) % 3 {\n\t// If len(teams) % 3 == 0, then all divisions have 3 teams.\n\tcase 0:\n\t\tfor i, j := 1, X; i < len(teams)+1; i++ {\n\t\t\tdivisionToTeam[j] = append(divisionToTeam[j], i)\n\t\t\tif i%3 == 0 {\n\t\t\t\tj++\n\t\t\t}\n\t\t}\n\t// If len(teams) % 3 == 1, then the top division and the last division have 2 teams.\n\t// If len(teams) % 3 == 2, then the top division has 2 teams.\n\tcase 1, 2:\n\t\tfor i, j := 1, X; i < len(teams)+1; i++ {\n\t\t\tdivisionToTeam[j] = append(divisionToTeam[j], i)\n\t\t\tif i%3 == 2 {\n\t\t\t\tj++\n\t\t\t}\n\t\t}\n\t}\n\n\tchallenges := make(map[string]Challenge)\n\n\t// Generate a challenge for each team within the division.\n\tfor division, code := X, 1; int(division) <= len(teams)/3; division++ {\n\t\tdivTeam := divisionToTeam[division]\n\t\tfmt.Println(division, divTeam)\n\t\tnumTeams := len(divTeam)\n\t\tfor key, teamRank := range divTeam {\n\t\t\tfmt.Println(division, key, teamRank, teams[teamRank])\n\t\t\tswitch key {\n\t\t\tcase 0:\n\t\t\t\tvar challenge Challenge\n\t\t\t\tchallenge.Division = division\n\t\t\t\tchallenge.Round = round\n\t\t\t\tchallenge.Defender = teams[teamRank]\n\t\t\t\tchallenge.DefenderRank = teamRank\n\t\t\t\tchallenge.Challenger = teams[teamRank+1]\n\t\t\t\tchallenge.ChallengerRank = teamRank + 1\n\t\t\t\tchallenge.Code = code\n\t\t\t\tchallenges[strconv.Itoa(challenge.Code)] = challenge\n\t\t\t\tcode++\n\n\t\t\t\tif numTeams == 3 {\n\t\t\t\t\tchallenge.Division = division\n\t\t\t\t\tchallenge.Round = round\n\t\t\t\t\tchallenge.Defender = teams[teamRank]\n\t\t\t\t\tchallenge.DefenderRank = teamRank\n\t\t\t\t\tchallenge.Challenger = teams[teamRank+2]\n\t\t\t\t\tchallenge.ChallengerRank = teamRank + 2\n\t\t\t\t\tchallenge.Code = code\n\t\t\t\t\tchallenges[strconv.Itoa(challenge.Code)] = challenge\n\t\t\t\t\tcode++\n\t\t\t\t}\n\t\t\tcase 1:\n\t\t\t\tif numTeams == 3 {\n\t\t\t\t\tvar challenge Challenge\n\t\t\t\t\tchallenge.Division = division\n\t\t\t\t\tchallenge.Round = round\n\t\t\t\t\tchallenge.Defender = teams[teamRank]\n\t\t\t\t\tchallenge.DefenderRank = teamRank\n\t\t\t\t\tchallenge.Challenger = teams[teamRank+1]\n\t\t\t\t\tchallenge.ChallengerRank = teamRank + 1\n\t\t\t\t\tchallenge.Code = code\n\t\t\t\t\tchallenges[strconv.Itoa(challenge.Code)] = challenge\n\t\t\t\t\tcode++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i := 1; i < len(teams)+1; i++ {\n\t\tchallenge := challenges[strconv.Itoa(i)]\n\t\tcode := i\n\t\tfmt.Printf(\"Spladder#8 Div %s [%d-%d] %d位 %s vs %d位 %s \\n\", challenge.Division.String(), challenge.Round, code,\n\t\t\tchallenge.ChallengerRank, challenge.Challenger, challenge.DefenderRank, challenge.Defender)\n\t}\n\n\t// Populate to Firestore.\n\tfor matchCode, challenge := range challenges {\n\t\tkey := challenge.Round.String() + \"-\" + matchCode\n\t\t_, err = tournament.Collection(\"challenges\").Doc(key).Set(ctx, challenge)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"An error has occurred: %s\", err)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "6ca0e0bdc45a63aa3699e9a8f8fef5b1", "score": "0.6758415", "text": "func GenerateRanking(ctx context.Context, tournament *firestore.DocumentRef, challenges firestore.Query) error {\n\tteamMetrics := make(map[string]*TeamMetadata)\n\tdivisionMetrics := make(map[Division]*DivisionMetadata)\n\tdivisionToTeam := make(map[Division][]string)\n\tlocalRank := []string{\"\"}\n\trankToUpload := make(map[string]string)\n\tranking := tournament.Collection((\"ranking\"))\n\tvar nextRound Round\n\n\t// Compute team level metrics for the round.\n\titer := challenges.Documents(ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar challenge Challenge\n\t\tif err = doc.DataTo(&challenge); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Populate challenger related metrics\n\t\tnextRound = challenge.Round + 1\n\t\tvar challenger, defender *TeamMetadata\n\t\tif val, ok := teamMetrics[challenge.Challenger]; ok {\n\t\t\tchallenger = val\n\t\t} else {\n\t\t\tvar c TeamMetadata\n\t\t\tchallenger = &c\n\t\t\tchallenger.Team = challenge.Challenger\n\t\t\tchallenger.Round = challenge.Round\n\t\t\tchallenger.Division = challenge.Division\n\t\t\tchallenger.Rank = challenge.ChallengerRank\n\t\t\tteamMetrics[challenge.Challenger] = challenger\n\t\t\tdivisionToTeam[challenger.Division] = append(divisionToTeam[challenger.Division], challenger.Team)\n\t\t}\n\t\tif val, ok := teamMetrics[challenge.Defender]; ok {\n\t\t\tdefender = val\n\t\t} else {\n\t\t\tvar d TeamMetadata\n\t\t\tdefender = &d\n\t\t\tdefender.Team = challenge.Defender\n\t\t\tdefender.Round = challenge.Round\n\t\t\tdefender.Division = challenge.Division\n\t\t\tdefender.Rank = challenge.DefenderRank\n\t\t\tteamMetrics[challenge.Defender] = defender\n\t\t\tdivisionToTeam[defender.Division] = append(divisionToTeam[defender.Division], defender.Team)\n\t\t}\n\n\t\tif challenge.ChallengerScore == 4 {\n\t\t\tfmt.Printf(\"%s won. %s lost.\\n\", challenger.Team, defender.Team)\n\t\t\tchallenger.NumWins++\n\t\t\tdefender.NumLosses++\n\t\t} else if challenge.DefenderScore == 4 {\n\t\t\tfmt.Printf(\"%s won. %s lost.\\n\", defender.Team, challenger.Team)\n\t\t\tdefender.NumWins++\n\t\t\tchallenger.NumLosses++\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"Invalid scores detected for %d-%d: %s vs %s\", challenge.Round, challenge.Code, challenger.Team, defender.Team)\n\t\t}\n\t\tchallenger.NumSetsGained += challenge.ChallengerScore\n\t\tchallenger.NumSetsLost += challenge.DefenderScore\n\t\tdefender.NumSetsGained += challenge.DefenderScore\n\t\tdefender.NumSetsLost += challenge.ChallengerScore\n\n\t\t_, err = tournament.Collection(\"teams\").Doc(challenger.Team).Collection(\"metrics\").Doc(challenge.Round.String()).Set(ctx, challenger)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Uploading to firestore successful:\", challenger.Team)\n\t\tfmt.Println(challenger)\n\t\t_, err = tournament.Collection(\"teams\").Doc(defender.Team).Collection(\"metrics\").Doc(challenge.Round.String()).Set(ctx, defender)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Uploading to firestore successful:\", defender.Team)\n\t\tfmt.Println(defender)\n\t}\n\n\t// Compute division metrics based on the team metrics.\n\tfor div := X; int(div) <= len(teamMetrics)/3; div++ {\n\t\tteamsInDiv := divisionToTeam[div]\n\t\tif len(teamsInDiv) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tvar divMetadata DivisionMetadata\n\t\tdivMetadata.Division = div\n\n\t\tteams := make([]*TeamMetadata, 0, len(teamsInDiv))\n\t\tfor _, team := range teamsInDiv {\n\t\t\tteamMetric := teamMetrics[team]\n\t\t\tteams = append(teams, teamMetric)\n\t\t}\n\t\tsort.Slice(teams, func(i, j int) bool {\n\t\t\tt1 := teams[i]\n\t\t\tt2 := teams[j]\n\t\t\tif t1.NumWins != t2.NumWins {\n\t\t\t\treturn t1.NumWins > t2.NumWins\n\t\t\t}\n\t\t\tt1Won := t1.NumSetsGained - t1.NumSetsLost\n\t\t\tt2Won := t2.NumSetsGained - t2.NumSetsLost\n\t\t\tif t1Won != t2Won {\n\t\t\t\treturn t1Won > t2Won\n\t\t\t}\n\t\t\treturn t1.Rank > t2.Rank\n\t\t})\n\t\tif len(teamsInDiv) < 3 {\n\t\t\tdivMetadata.Winner = teams[0].Team\n\t\t\tdivMetadata.Loser = teams[1].Team\n\t\t} else {\n\t\t\tdivMetadata.Winner = teams[0].Team\n\t\t\tdivMetadata.Neutral = teams[1].Team\n\t\t\tdivMetadata.Loser = teams[2].Team\n\t\t}\n\n\t\tfmt.Printf(\"Division %s Winner: %s Loser: %s Neutral: %s\\n\", div.String(), divMetadata.Winner, divMetadata.Loser, divMetadata.Neutral)\n\t\tlocalRank = append(localRank, divMetadata.Winner)\n\t\tif divMetadata.Neutral != \"\" {\n\t\t\tlocalRank = append(localRank, divMetadata.Neutral)\n\t\t}\n\t\tlocalRank = append(localRank, divMetadata.Loser)\n\t\tdivisionMetrics[div] = &divMetadata\n\t}\n\n\t// Swap ranking based on loser information.\n\tfor div := X; int(div) < len(divisionMetrics)-1; div++ {\n\t\tfor rank, team := range localRank {\n\t\t\tif team == divisionMetrics[div].Loser {\n\t\t\t\tfmt.Printf(\"Swapping %s at rank %d with %s at rank %d\\n\", team, rank, localRank[rank+1], rank+1)\n\t\t\t\tlocalRank[rank], localRank[rank+1] = localRank[rank+1], localRank[rank]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Create a map to upload to Firestore.\n\tfor rank, team := range localRank {\n\t\tif rank > 0 {\n\t\t\trankToUpload[strconv.Itoa(rank)] = team\n\t\t}\n\t}\n\n\t// Upload new ranking to Firestore.\n\t_, err := ranking.Doc(nextRound.String()).Set(ctx, rankToUpload)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1e66e411930a8b3a7bea3bc3461f776", "score": "0.6157813", "text": "func AddNewTeam(ctx context.Context, tournament *firestore.DocumentRef, currentRound Round) error {\n\tnextRound := currentRound + 1\n\tranking := tournament.Collection(\"ranking\").Doc(nextRound.String())\n\toldRanking := make(map[int]string)\n\tnewRanking := make(map[int]string)\n\trankToUpload := make(map[string]string)\n\tvar s string\n\tvar j int\n\tdoc, err := ranking.Get(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdata := doc.Data()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(currentRound)\n\tfmt.Println(\"Current ranking:\")\n\tfor i := 1; i < len(data)+1; i++ {\n\t\toldRanking[i] = fmt.Sprintf(\"%v\", data[strconv.Itoa(i)])\n\t\tfmt.Println(i, oldRanking[i])\n\t}\n\tfmt.Println(\"Type ranking to insert:\")\n\tfmt.Scanln(&j)\n\tfor i := 1; i < len(data)+2; i++ {\n\t\tif i < j {\n\t\t\tnewRanking[i] = oldRanking[i]\n\t\t} else if i == j {\n\t\t\tfmt.Println(\"Type team name:\")\n\t\t\tfmt.Scanln(&s)\n\t\t\tnewRanking[i] = s\n\t\t} else if i > j {\n\t\t\tnewRanking[i] = oldRanking[i-1]\n\t\t}\n\t}\n\tfmt.Println(\"New ranking:\")\n\tfor i := 1; i < len(newRanking)+1; i++ {\n\t\tfmt.Println(i, newRanking[i])\n\t}\n\t// Create a map to upload to Firestore.\n\tfor rank, team := range newRanking {\n\t\tif rank > 0 {\n\t\t\trankToUpload[strconv.Itoa(rank)] = team\n\t\t}\n\t}\n\t// Upload new ranking to Firestore.\n\tfmt.Println(\"Upload? y/n\")\n\tfmt.Scanln(&s)\n\tif s == \"y\" {\n\t\t_, err := tournament.Collection(\"ranking\").Doc(nextRound.String()).Set(ctx, rankToUpload)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bc14e9bf3b6db83a6143eb1934ed511", "score": "0.59467566", "text": "func CreateChampionsLeague(c appengine.Context, adminID int64) (*Tournament, error) {\n\t// create new tournament\n\tlog.Infof(c, \"Champions League: start\")\n\n\tmapTeamID := make(map[string]int64)\n\n\t// for date parsing\n\tconst shortForm = \"Jan/02/2006\"\n\n\t// mapMatches2ndRound is a map where the key is a string which represent the rounds\n\t// the key is a two dimensional string array. each element in the array represent a specific field in the match\n\t// mapMatches2ndRound is a map[string][][]string\n\t// example: \"1\", \"Apr/14/2014\", \"Paris Saint-Germain\", \"AS Monaco FC\", \"Parc des Princes, Paris\"}\n\tclt := ChampionsLeagueTournament{}\n\tclMatches2ndStage := clt.MapOf2ndRoundMatches()\n\tclMapTeamCodes := clt.MapOfTeamCodes()\n\n\t// matches 2nd stage\n\tvar matches2ndStageIds []int64\n\tvar userIds []int64\n\tvar teamIds []int64\n\n\tlog.Infof(c, \"Champions League: maps ready\")\n\n\t// build teams\n\tfor teamName, teamCode := range clMapTeamCodes {\n\n\t\tteamID, _, err1 := datastore.AllocateIDs(c, \"Tteam\", nil, 1)\n\t\tif err1 != nil {\n\t\t\treturn nil, err1\n\t\t}\n\t\tlog.Infof(c, \"Champions League: team: %v allocateIDs ok\", teamName)\n\n\t\tteamkey := datastore.NewKey(c, \"Tteam\", \"\", teamID, nil)\n\t\tlog.Infof(c, \"Champions League: team: %v NewKey ok\", teamName)\n\n\t\tteam := &Tteam{teamID, teamName, teamCode}\n\t\tlog.Infof(c, \"Champions League: team: %v instance of team ok\", teamName)\n\n\t\t_, err := datastore.Put(c, teamkey, team)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Infof(c, \"Champions League: team: %v put in datastore ok\", teamName)\n\t\tmapTeamID[teamName] = teamID\n\t}\n\n\t// build tmatches quarter finals\n\tlog.Infof(c, \"Champions League: building quarter finals matches\")\n\tfor _, matchData := range clMatches2ndStage[cQuarterFinals] {\n\t\tlog.Infof(c, \"Champions League: quarter finals match data: %v\", matchData)\n\n\t\tmatchID, _, err1 := datastore.AllocateIDs(c, \"Tmatch\", nil, 1)\n\t\tif err1 != nil {\n\t\t\treturn nil, err1\n\t\t}\n\n\t\tlog.Infof(c, \"Champions League: match: %v allocateIDs ok\", matchID)\n\n\t\tmatchkey := datastore.NewKey(c, \"Tmatch\", \"\", matchID, nil)\n\t\tlog.Infof(c, \"Champions League: match: new key ok\")\n\n\t\tmatchTime, _ := time.Parse(shortForm, matchData[cMatchDate])\n\t\tmatchInternalID, _ := strconv.Atoi(matchData[cMatchID])\n\n\t\temptyrule := \"\"\n\t\temptyresult := int64(0)\n\t\tmatch := &Tmatch{\n\t\t\tmatchID,\n\t\t\tint64(matchInternalID),\n\t\t\tmatchTime,\n\t\t\tmapTeamID[matchData[cMatchTeam1]],\n\t\t\tmapTeamID[matchData[cMatchTeam2]],\n\t\t\tmatchData[cMatchLocation],\n\t\t\temptyrule,\n\t\t\temptyresult,\n\t\t\temptyresult,\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t}\n\t\tlog.Infof(c, \"Champions League: match 2nd round: build match ok\")\n\n\t\t_, err := datastore.Put(c, matchkey, match)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Infof(c, \"Champions League: 2nd round match: %v put in datastore ok\", matchData)\n\t\t// save in an array of int64 all the allocate IDs to store them in the tournament for easy retreival later on.\n\t\tmatches2ndStageIds = append(matches2ndStageIds, matchID)\n\t}\n\n\t// build tmatches 2nd phase from semi finals\n\trestofMatches2ndStage := clMatches2ndStage\n\tdelete(restofMatches2ndStage, cQuarterFinals)\n\tfor roundNumber, roundMatches := range restofMatches2ndStage {\n\t\tlog.Infof(c, \"Champions League: building 2nd stage matches: round number %v\", roundNumber)\n\t\tfor _, matchData := range roundMatches {\n\t\t\tlog.Infof(c, \"Champions League: second stage match data: %v\", matchData)\n\n\t\t\tmatchID, _, err1 := datastore.AllocateIDs(c, \"Tmatch\", nil, 1)\n\t\t\tif err1 != nil {\n\t\t\t\treturn nil, err1\n\t\t\t}\n\n\t\t\tlog.Infof(c, \"Champions League: match: %v allocateIDs ok\", matchID)\n\n\t\t\tmatchkey := datastore.NewKey(c, \"Tmatch\", \"\", matchID, nil)\n\t\t\tlog.Infof(c, \"Champions League: match: new key ok\")\n\n\t\t\tmatchTime, _ := time.Parse(shortForm, matchData[cMatchDate])\n\t\t\tmatchInternalID, _ := strconv.Atoi(matchData[cMatchID])\n\n\t\t\trule := fmt.Sprintf(\"%s %s\", matchData[cMatchTeam1], matchData[cMatchTeam2])\n\t\t\temptyresult := int64(0)\n\t\t\tmatch := &Tmatch{\n\t\t\t\tmatchID,\n\t\t\t\tint64(matchInternalID),\n\t\t\t\tmatchTime,\n\t\t\t\t0, // second round matches start with ids at 0\n\t\t\t\t0, // second round matches start with ids at 0\n\t\t\t\tmatchData[cMatchLocation],\n\t\t\t\trule,\n\t\t\t\temptyresult,\n\t\t\t\temptyresult,\n\t\t\t\tfalse,\n\t\t\t\tfalse,\n\t\t\t\ttrue,\n\t\t\t}\n\t\t\tlog.Infof(c, \"Champions League: match 2nd round: build match ok\")\n\n\t\t\t_, err := datastore.Put(c, matchkey, match)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tlog.Infof(c, \"Champions League: 2nd round match: %v put in datastore ok\", matchData)\n\t\t\t// save in an array of int64 all the allocate IDs to store them in the tournament for easy retreival later on.\n\t\t\tmatches2ndStageIds = append(matches2ndStageIds, matchID)\n\t\t}\n\t}\n\n\ttstart, _ := time.Parse(shortForm, \"Apr/05/2016\")\n\ttend, _ := time.Parse(shortForm, \"May/28/2016\")\n\tadminIds := make([]int64, 1)\n\tadminIds[0] = adminID\n\tname := \"2015-2016 UEFA Champions League\"\n\tdescription := \"\"\n\tvar tournament *Tournament\n\tvar err error\n\tif tournament, err = CreateTournament(c, name, description, tstart, tend, adminID); err != nil {\n\t\tlog.Infof(c, \"Champions League: something went wrong when creating tournament.\")\n\t\treturn nil, err\n\t}\n\n\ttournament.GroupIds = make([]int64, 0)\n\ttournament.Matches1stStage = make([]int64, 0)\n\ttournament.Matches2ndStage = matches2ndStageIds\n\ttournament.UserIds = userIds\n\ttournament.TeamIds = teamIds\n\ttournament.TwoLegged = false\n\ttournament.IsFirstStageComplete = false\n\tif err1 := tournament.Update(c); err1 != nil {\n\t\tlog.Infof(c, \"Champions League: unable to udpate tournament.\")\n\t}\n\n\tlog.Infof(c, \"Champions League: instance of tournament ready\")\n\n\treturn tournament, nil\n}", "title": "" }, { "docid": "90211cecb82742aab7b9a81447833281", "score": "0.5334059", "text": "func CreateTeam(c *gin.Context) {\n\tvar cteam APICreateTeamInput\n\terr := c.Bind(&cteam)\n\tif err != nil {\n\t\th.JSONR(c, badstatus, err)\n\t\treturn\n\t}\n\tuser, err := h.GetUser(c)\n\tif err != nil {\n\t\th.JSONR(c, badstatus, err)\n\t\treturn\n\t}\n\tteam := uic.Team{\n\t\tName: cteam.Name,\n\t\tResume: cteam.Resume,\n\t\tCreator: user.ID,\n\t}\n\tdt := db.Uic.Table(\"team\").Create(&team)\n\tif dt.Error != nil {\n\t\th.JSONR(c, badstatus, dt.Error)\n\t\treturn\n\t}\n\tvar dt2 *gorm.DB\n\tif len(cteam.UserIDs) > 0 {\n\t\tfor i := 0; i < len(cteam.UserIDs); i++ {\n\t\t\tdt2 = db.Uic.Create(&uic.RelTeamUser{Tid: team.ID, Uid: cteam.UserIDs[i]})\n\t\t\tif dt2.Error != nil {\n\t\t\t\terr = dt2.Error\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\th.JSONR(c, badstatus, err)\n\t\t\treturn\n\t\t}\n\t}\n\th.JSONR(c, fmt.Sprintf(\"team created! Afftect row: %d, Affect refer: %d\", dt.RowsAffected, len(cteam.UserIDs)))\n\treturn\n}", "title": "" }, { "docid": "3dc850b30680148225d1276b1cda1f6f", "score": "0.5240987", "text": "func NewChallenges(db *bolt.DB) (Challenges, error) {\n\terr := db.Update(initBucket(bktChallenges))\n\treturn Challenges{db}, err\n}", "title": "" }, { "docid": "05d019aaf7b8baeeb228172ff27270f3", "score": "0.52039003", "text": "func (a *App) CreateTeam(w http.ResponseWriter, r *http.Request) {\n\thandlers.CreateTeam(a.DB, w, r)\n}", "title": "" }, { "docid": "fa5ee92f2844bdc3b71cc60874528785", "score": "0.51983863", "text": "func (a *App) CreateTournament(w http.ResponseWriter, r *http.Request) {\n\thandlers.CreateTournament(a.DB, w, r)\n}", "title": "" }, { "docid": "b36fafa34223f60affc07b022a17bc3b", "score": "0.5173366", "text": "func createGame(writer http.ResponseWriter, request *http.Request) {\n\tvar err error\n\tvar newGame Game\n\n\t// grabbing gameID\n\terr = json.NewDecoder(request.Body).Decode(&newGame)\n\tif err != nil {\n\t\tmessage := \"Failure to decode client JSON: \" + err.Error()\n\t\tencodeAndSendError(writer, request, http.StatusBadRequest, message)\n\t\treturn\n\t}\n\tlog.Println(\"Attempting game creation for ID:\", newGame.GameID)\n\t//set game name for new game and add it to map of all active games\n\tif activeGames[newGame.GameID] == nil {\n\t\tactiveGames[newGame.GameID] = &newGame\n\t} else {\n\t\tmessage := \"FAILURE: Game ID: \" + newGame.GameID + \" already exists\"\n\t\tencodeAndSendError(writer, request, http.StatusBadRequest, message)\n\t\treturn\n\t}\n\t// generate words and place them into database object ---------------------\n\n\t// draw n number or random cards\n\twords := drawCards()\n\n\t// select who goes first\n\t// who goes first determines how many cards a team needs to guess\n\tturns := [2]string{\"red\", \"blue\"}\n\tturn := turns[rand.Intn(2)]\n\n\tredScore := 9\n\tblueScore := 9\n\n\tif turn == \"blue\" {\n\t\tredScore--\n\t} else {\n\t\tblueScore--\n\t}\n\n\t// create strings for vals interface\n\tredCards := words[:redScore]\n\tblueCards := words[redScore : redScore+blueScore]\n\tcivCards := words[redScore+blueScore : len(words)-1]\n\tassassin := words[len(words)-1]\n\n\tvals := map[string]interface{}{\n\t\t\"blueScore\": blueScore,\n\t\t\"redScore\": redScore,\n\t\t\"turn\": turn,\n\t\t\"red\": strings.Join(redCards, \" \"),\n\t\t\"blue\": strings.Join(blueCards, \" \"),\n\t\t\"assassin\": assassin,\n\t\t\"civilian\": strings.Join(civCards, \" \"),\n\t\t\"gameover\": \"false\",\n\t}\n\tdatabase.HSet(ctx, newGame.GameID, vals)\n\n\tget := database.HGetAll(ctx, newGame.GameID)\n\tif err := get.Err(); err != nil {\n\t\tif err == redis.Nil {\n\t\t\tlog.Println(\"key does not exists\")\n\t\t}\n\t\tpanic(err)\n\t}\n\tlog.Println(\"SUCCESS: created game:\", newGame.GameID)\n}", "title": "" }, { "docid": "442e0581ac08a72019dda6e5ad28f808", "score": "0.51476085", "text": "func CreateTeam(w http.ResponseWriter, r *http.Request) {\n\tvar t models.Team\n\n\tu := GetUserSession(r)\n\tif u == nil || !u.IsAdmin {\n\t\tw.WriteHeader(403)\n\t\tw.Write(apiError(\"you must be logged in as a system administrator to create a project\"))\n\t\treturn\n\t}\n\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&t)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\tw.Write(apiError(\"malformed json\"))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\terr = Store.Teams().New(&t)\n\tif err != nil {\n\t\tw.WriteHeader(400)\n\t\tw.Write(apiError(err.Error()))\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tsendJSON(w, t)\n}", "title": "" }, { "docid": "06f20dfd4e2034b280fab26c8c7d3405", "score": "0.5107017", "text": "func (c *Controller) CreateTournament(name string, deposit int) (uint64, error) {\n\tid, err := c.InsertTournament(name, deposit, defaultPrize)\n\treturn id, err\n}", "title": "" }, { "docid": "2d715e8d0af8dea6b81179c7ab5a7b4e", "score": "0.50073534", "text": "func (r *RoundRobin) createTournament(antagonists []Individual, protagonists []Individual) ([]RRCompetition, error) {\n\tif antagonists == nil {\n\t\treturn nil, fmt.Errorf(\"antagonists cannot be nil in Generation\")\n\t}\n\tif protagonists == nil {\n\t\treturn nil, fmt.Errorf(\"protagonists cannot be nil in Generation\")\n\t}\n\n\tlenAntagonists := len(antagonists)\n\tif lenAntagonists < 1 {\n\t\treturn nil, fmt.Errorf(\"antagonists cannot be empty\")\n\t}\n\n\tlenProtagonists := len(protagonists)\n\tif lenProtagonists < 1 {\n\t\treturn nil, fmt.Errorf(\"protagonists cannot be empty\")\n\t}\n\n\tcompetitionSize := lenAntagonists * lenProtagonists\n\tcompetitions := make([]RRCompetition, competitionSize)\n\tcount := 0\n\n\tfor i := 0; i < lenAntagonists; i++ {\n\t\tfor j := 0; j < len(protagonists); j++ {\n\n\t\t\tcompetition := RRCompetition{\n\t\t\t\tid: uint32(count),\n\t\t\t\tprotagonist: &protagonists[j],\n\t\t\t\tantagonist: &antagonists[i],\n\t\t\t}\n\n\t\t\tcompetitions[count] = competition\n\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn competitions, nil\n}", "title": "" }, { "docid": "05b124ea15581b8dd8982dad30e7df4c", "score": "0.49781284", "text": "func (account *Account) CreateTeam(name string, displayName string, text string) (*just.Status, error) {\n\tvar changes = struct {\n\t\tAuthToken string `json:\"authToken\"`\n\t\tGroupUserName string `json:\"group_user_name\"`\n\t\tGroupName string `json:\"group_name\"`\n\t\tGroupText string `json:\"group_text\"`\n\t\tGroupDisplayName string `json:\"group_display_name\"`\n\t}{account.AuthToken, account.UserName, name, text, displayName}\n\n\tdst, err := json.Marshal(changes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar args f.Args\n\targs.Add(\"authToken\", account.AuthToken)\n\n\turl := fmt.Sprintf(APIEndpoint, \"team\")\n\tresp, err := just.POST(dst, url, &args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn just.FixStatus(resp), nil\n}", "title": "" }, { "docid": "6a945d4d025bf2224b9e673b67ae66ee", "score": "0.49152282", "text": "func createRandomChallenges(m, n, pi int) (alpha []*operation.Scalar, r [][]*operation.Scalar) {\n\t// alpha = make([]*operation.Scalar, m)\n\t// for i := 0; i < m; i += 1 {\n\t// \talpha[i] = operation.RandomScalar()\n\t// }\n\tr = make([][]*operation.Scalar, n)\n\tfor i := 0; i < n; i += 1 {\n\t\tr[i] = make([]*operation.Scalar, m)\n\t\tif i == pi {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := 0; j < m; j += 1 {\n\t\t\tr[i][j] = operation.RandomScalar()\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9e9d35dc39119264433ea96a25413bfe", "score": "0.48981318", "text": "func InitRanking(ctx context.Context, teams *firestore.CollectionRef, ranking *firestore.DocumentRef) error {\n\t// Read from the teams document.\n\tvar rank string\n\n\titer := teams.Documents(ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := doc.Data()\n\t\tfmt.Println(\"Enter the ranking for: \", data[\"name\"])\n\t\tfmt.Scanln(&rank)\n\t\t_, err = ranking.Set(ctx, map[string]interface{}{\n\t\t\trank: data[\"name\"],\n\t\t}, firestore.MergeAll)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6bb909073fd382008afaf34f458aec38", "score": "0.48862007", "text": "func InputScores(ctx context.Context, challenges firestore.Query) {\n\t// Read challenges for the current round and input the scores.\n\titer := challenges.Documents(ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tvar challenge Challenge\n\t\tif err = doc.DataTo(&challenge); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\tfor {\n\t\t\tfmt.Printf(\"[%d-%d] Div %s: %s (%d位) vs %s (%d位)\\n\", challenge.Round, challenge.Code,\n\t\t\t\tchallenge.Division.String(), challenge.Challenger, challenge.ChallengerRank,\n\t\t\t\tchallenge.Defender, challenge.DefenderRank)\n\t\t\tfmt.Printf(\"Input score for challenger %s: \", challenge.Challenger)\n\t\t\tvar cs, ds int\n\t\t\tfmt.Scanf(\"%d\", &cs)\n\t\t\tfmt.Printf(\"Input score for defender %s: \", challenge.Defender)\n\t\t\tfmt.Scanf(\"%d\", &ds)\n\t\t\tif cs+ds >= 4 && cs+ds <= 7 && (cs == 4 || ds == 4) {\n\t\t\t\tchallenge.ChallengerScore = cs\n\t\t\t\tchallenge.DefenderScore = ds\n\t\t\t\t_, err = doc.Ref.Set(ctx, challenge)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error occurred writing to Firestore: %s\", err)\n\t\t\t\t}\n\t\t\t\tfmt.Println(\"Written to firebase.\")\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tvar s string\n\t\t\t\tfmt.Println(\"Invalid score. Try again? y/n\")\n\t\t\t\tfmt.Scanln(&s)\n\t\t\t\tif s != \"y\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "81bc478832ab8ef83c42cde7a4c7e7d5", "score": "0.48618457", "text": "func CreateChannel(rw http.ResponseWriter, request *http.Request, params httprouter.Params) {\n // user := context.Get(request, \"user\").(models.User)\n rw.Header().Set(\"Content-Type\", \"application/json\")\n channelRequest := &ChannelRequest{}\n channel := &models.Channel{}\n decoder := json.NewDecoder(request.Body)\n decodeErr := decoder.Decode(channelRequest)\n\n users := &[]models.User{}\n usersQuery := bson.M{\n \"_id\": bson.M{\n \"$in\": channelRequest.Participants,\n },\n }\n\n results := stores.MongoDB.Collection(\"users\").Find(usersQuery)\n results.Query.All(users)\n\n if decodeErr != nil {\n rw.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(rw, decodeErr.Error())\n } else {\n query := bson.M{\n \"participants\": users,\n }\n\n mongoErr := stores.MongoDB.Collection(\"channels\").FindOne(query, channel)\n if _, ok := mongoErr.(*bongo.DocumentNotFoundError); ok {\n //channel.Creator = user\n channel.Participants = *users\n saveErr := stores.MongoDB.Collection(\"channels\").Save(channel)\n if saveErr != nil {\n rw.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(rw, saveErr.Error())\n } else {\n rw.WriteHeader(http.StatusCreated)\n }\n } else {\n rw.WriteHeader(http.StatusOK)\n }\n response, _ := json.Marshal(channel)\n fmt.Fprint(rw, string(response))\n }\n\n}", "title": "" }, { "docid": "195a2c8d076e23b58754480b8f93ebeb", "score": "0.4851725", "text": "func NewTeams(c *gin.Context) (int, interface{}) {\n\ttype InputForm struct {\n\t\tName string `binding:\"required\"`\n\t\tLogo string `binding:\"required\"`\n\t}\n\tvar inputForm []InputForm\n\terr := c.BindJSON(&inputForm)\n\tif err != nil {\n\t\treturn utils.MakeErrJSON(400, 40001,\n\t\t\tlocales.I18n.T(c.GetString(\"lang\"), \"general.error_payload\"),\n\t\t)\n\t}\n\n\t// Check if the team name repeat in the form.\n\ttmpTeamName := make(map[string]int)\n\tfor _, item := range inputForm {\n\t\ttmpTeamName[item.Name] = 0\n\n\t\t// Check if the team name repeat in the database.\n\t\tvar count int\n\t\tdb.MySQL.Model(db.Team{}).Where(&db.Team{Name: item.Name}).Count(&count)\n\t\tif count != 0 {\n\t\t\treturn utils.MakeErrJSON(400, 40002,\n\t\t\t\tlocales.I18n.T(c.GetString(\"lang\"), \"team.repeat\"),\n\t\t\t)\n\t\t}\n\t\t// Team name can't be empty.\n\t\tif item.Name == \"\" {\n\t\t\treturn utils.MakeErrJSON(400, 40003,\n\t\t\t\tlocales.I18n.T(c.GetString(\"lang\"), \"team.team_name_empty\"),\n\t\t\t)\n\t\t}\n\t}\n\tif len(tmpTeamName) != len(inputForm) {\n\t\treturn utils.MakeErrJSON(400, 40004,\n\t\t\tlocales.I18n.T(c.GetString(\"lang\"), \"team.repeat\"),\n\t\t)\n\t}\n\n\ttype resultItem struct {\n\t\tName string\n\t\tPassword string\n\t}\n\tvar resultData []resultItem\n\n\ttx := db.MySQL.Begin()\n\tteamName := \"\" // Log\n\tfor _, item := range inputForm {\n\t\tpassword := randstr.String(16)\n\t\tnewTeam := &db.Team{\n\t\t\tName: item.Name,\n\t\t\tPassword: utils.AddSalt(password),\n\t\t\tLogo: item.Logo,\n\t\t\tSecretKey: randstr.Hex(16),\n\t\t}\n\t\tif tx.Create(newTeam).RowsAffected != 1 {\n\t\t\ttx.Rollback()\n\t\t\treturn utils.MakeErrJSON(500, 50002,\n\t\t\t\tlocales.I18n.T(c.GetString(\"lang\"), \"team.post_error\"),\n\t\t\t)\n\t\t}\n\t\tresultData = append(resultData, resultItem{\n\t\t\tName: item.Name,\n\t\t\tPassword: password,\n\t\t})\n\t\tteamName += item.Name + \", \"\n\t}\n\ttx.Commit()\n\n\tlogger.New(logger.NORMAL, \"manager_operate\",\n\t\tstring(locales.I18n.T(c.GetString(\"lang\"), \"log.new_team\", gin.H{\n\t\t\t\"count\": len(inputForm),\n\t\t\t\"teamName\": teamName,\n\t\t})),\n\t)\n\treturn utils.MakeSuccessJSON(resultData)\n}", "title": "" }, { "docid": "9265db3310b7947bc46b4a14023d8f0f", "score": "0.48413983", "text": "func CreateTournament(w http.ResponseWriter, r *http.Request) {\n\t//----------------------------------------------------------------------------\n\t// Initialize an empty Tournament model\n\t//----------------------------------------------------------------------------\n\tdata := model.Tournament{}\n\t\n\t//----------------------------------------------------------------------------\n\t// Parse the body into a Tournament model structure\n\t//----------------------------------------------------------------------------\n\tutils.ParseBody(r, data)\n\n\t//----------------------------------------------------------------------------\n\t// Delegate to the Tournament data access object to create\n\t//----------------------------------------------------------------------------\n\trequestResult := TournamentDAO.CreateTournament( data )\n\t\n\t//----------------------------------------------------------------------------\n\t// Marshal the model into a JSON object\n\t//----------------------------------------------------------------------------\n\tres,_ := json.Marshal(requestResult)\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(res)\n}", "title": "" }, { "docid": "2bb8ef802c16961e41ece998493128c4", "score": "0.4804076", "text": "func CandidateTeams(w http.ResponseWriter, r *http.Request, u *mdl.User) error {\n\tif r.Method != \"GET\" {\n\t\treturn &helpers.BadRequest{Err: errors.New(helpers.ErrorCodeNotSupported)}\n\t}\n\n\tc := appengine.NewContext(r)\n\tdesc := \"Tournament Candidate Teams handler:\"\n\textract := extract.NewContext(c, desc, r)\n\n\tvar tournament *mdl.Tournament\n\tvar err error\n\ttournament, err = extract.Tournament()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// query teams\n\tvar teams []*mdl.Team\n\tfor _, teamID := range u.TeamIds {\n\t\tif team, err1 := mdl.TeamByID(c, teamID); err1 == nil {\n\t\t\tfor _, aID := range team.AdminIds {\n\t\t\t\tif aID == u.Id {\n\t\t\t\t\tteams = append(teams, team)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Errorf(c, \"%v\", err1)\n\t\t}\n\t}\n\n\ttype canditateType struct {\n\t\tTeam mdl.TeamJSON\n\t\tJoined bool\n\t}\n\n\tfieldsToKeep := []string{\"Id\", \"Name\"}\n\tcandidatesData := make([]canditateType, len(teams))\n\n\tfor counterCandidate, team := range teams {\n\t\tvar tJSON mdl.TeamJSON\n\t\thelpers.InitPointerStructure(team, &tJSON, fieldsToKeep)\n\t\tvar canditate canditateType\n\t\tcanditate.Team = tJSON\n\t\tcanditate.Joined = tournament.TeamJoined(c, team)\n\t\tcandidatesData[counterCandidate] = canditate\n\t}\n\n\t// we should not directly return an array. so we add an extra layer.\n\tdata := struct {\n\t\tCandidates []canditateType `json:\",omitempty\"`\n\t}{\n\t\tcandidatesData,\n\t}\n\treturn templateshlp.RenderJSON(w, c, data)\n}", "title": "" }, { "docid": "ecd435de0f38236aab4dc48a6fec94d5", "score": "0.47014788", "text": "func (c *APIClient) CreateTeam(ctx context.Context, req CreateTeamRequest) (*TeamResponse, error) {\n\tres := &TeamResponse{}\n\n\tif _, err := c.client().Post(\"teams\").BodyJSON(&req).Receive(res, nil); err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create team\")\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "e35e90ec94f6d8667f94efd592b55126", "score": "0.46463102", "text": "func CreateTournament(c appengine.Context, name string, description string, start time.Time, end time.Time, adminId int64) (*Tournament, error) {\n\n\ttournamentID, _, err := datastore.AllocateIDs(c, \"Tournament\", nil, 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := datastore.NewKey(c, \"Tournament\", \"\", tournamentID, nil)\n\n\t// empty groups and tournaments for now\n\temptyArray := make([]int64, 0)\n\tadmins := make([]int64, 1)\n\tadmins[0] = adminId\n\ttwoLegged := false\n\tofficial := false\n\n\ttournament := &Tournament{tournamentID, helpers.TrimLower(name), name, description, start, end, admins, time.Now(), emptyArray, emptyArray, emptyArray, emptyArray, emptyArray, twoLegged, false, official}\n\n\t_, err = datastore.Put(c, key, tournament)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tAddToTournamentInvertedIndex(c, helpers.TrimLower(name), tournamentID)\n\treturn tournament, nil\n}", "title": "" }, { "docid": "ec6a99adf2c7ed67c32b9efc285b9f0f", "score": "0.46422642", "text": "func CreateScore(c appengine.Context, userId int64, tournamentId int64) (*Score, error) {\n\tsId, _, err := datastore.AllocateIDs(c, \"Score\", nil, 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkey := datastore.NewKey(c, \"Score\", \"\", sId, nil)\n\tscores := make([]int64, 0)\n\ts := &Score{sId, userId, tournamentId, scores}\n\tif _, err = datastore.Put(c, key, s); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "a83104a9e9b0a96bf39b17a4f7788654", "score": "0.46287042", "text": "func (s *Service) Create(ctstInfo CtstInfo) (*bson.ObjectId, error) {\n\t// Convert string to integer for check\n\tid, err := strconv.Atoi(ctstInfo.VID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get contest info from vjudge with vjudge response.\n\tctstResponse, err := s.getCtstInfo(ctstInfo.VID)\n\tif ctstResponse.ID != id {\n\t\treturn nil, err\n\t}\n\n\tsubmissions := s.refineSubmissions(ctstResponse)\n\n\tsession := s.DB.Clone()\n\tdefer session.Close()\n\tsession.SetSafe(&mgo.Safe{})\n\tcollection := session.DB(\"\").C(contestCollection)\n\n\tcontestData := Ctst{Name: ctstResponse.Title,\n\t\tID: bson.NewObjectId(),\n\t\tBegin: ctstResponse.Begin,\n\t\tLength: ctstResponse.Length,\n\t\tSubmissions: *submissions,\n\t\tCtstInfo: ctstInfo,\n\t}\n\n\treturn &contestData.ID, collection.Insert(contestData)\n}", "title": "" }, { "docid": "fc82a90445b5f4dba6fdc27d8e53f27c", "score": "0.46282873", "text": "func (a *Client) TeamCreate(params *TeamCreateParams, authInfo runtime.ClientAuthInfoWriter) (*TeamCreateOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewTeamCreateParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"TeamCreate\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/teams\",\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: &TeamCreateReader{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.(*TeamCreateOK), nil\n\n}", "title": "" }, { "docid": "c62a63383a7dfec4b9d656d4cb3fa0a5", "score": "0.46129602", "text": "func (q *teamStore) Create(team *schema.Team) error {\n\trows, err := sqlx.NamedQuery(\n\t\tq,\n\t\t`with i as (\n\t\t\tinsert into subscriptions (quantity, status, plan) values (:subscription_quantity, :subscription_status, :subscription_plan) returning *\n\t\t)\n\t\tinsert into customers (name, active, subscription_id)\n\t\tvalues (:name, true, (select id from i))\n\t\treturning id, (select quantity from i) as subscription_quantity, (select status from i) as subscription_status, (select plan from i) as subscription_plan`,\n\t\tteam,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr = rows.StructScan(team)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a159bc00f51bc8ccf39f9defbf2ce1ac", "score": "0.45759752", "text": "func (c *ProjectIterationsController) Create(ctx *app.CreateProjectIterationsContext) error {\n\t_, err := login.ContextIdentity(ctx)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))\n\t}\n\tprojectID, err := uuid.FromString(ctx.ID)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))\n\t}\n\n\t// Validate Request\n\tif ctx.Payload.Data == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError(\"data\", nil).Expected(\"not nil\"))\n\t}\n\treqIter := ctx.Payload.Data\n\tif reqIter.Attributes.Name == nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError(\"data.attributes.name\", nil).Expected(\"not nil\"))\n\t}\n\n\treturn application.Transactional(c.db, func(appl application.Application) error {\n\t\t_, err = appl.Projects().Load(ctx, projectID)\n\t\tif err != nil {\n\t\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))\n\t\t}\n\n\t\tnewItr := iteration.Iteration{\n\t\t\tProjectID: projectID,\n\t\t\tName: *reqIter.Attributes.Name,\n\t\t\tStartAt: reqIter.Attributes.StartAt,\n\t\t\tEndAt: reqIter.Attributes.EndAt,\n\t\t}\n\n\t\terr = appl.Iterations().Create(ctx, &newItr)\n\t\tif err != nil {\n\t\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t\t}\n\n\t\tres := &app.IterationSingle{\n\t\t\tData: ConvertIteration(ctx.RequestData, &newItr),\n\t\t}\n\t\tctx.ResponseData.Header().Set(\"Location\", AbsoluteURL(ctx.RequestData, app.IterationHref(res.Data.ID)))\n\t\treturn ctx.Created(res)\n\t})\n}", "title": "" }, { "docid": "154b2b38af83cee0a08feb6d021a2e11", "score": "0.4538631", "text": "func Create(app *nais.Application, resourceOptions ResourceOptions) (ResourceOperations, error) {\n\tvar operation Operation\n\n\tteam, ok := app.Labels[\"team\"]\n\tif !ok || len(team) == 0 {\n\t\treturn nil, fmt.Errorf(\"the 'team' label needs to be set in the application metadata\")\n\t}\n\n\tops := ResourceOperations{\n\t\t{Service(app), OperationCreateOrUpdate},\n\t\t{ServiceAccount(app, resourceOptions), OperationCreateIfNotExists},\n\t\t{HorizontalPodAutoscaler(app), OperationCreateOrUpdate},\n\t}\n\n\tleRole := LeaderElectionRole(app)\n\tleRoleBinding := LeaderElectionRoleBinding(app)\n\n\tif app.Spec.LeaderElection {\n\t\tops = append(ops, ResourceOperation{leRole, OperationCreateOrUpdate})\n\t\tops = append(ops, ResourceOperation{leRoleBinding, OperationCreateOrRecreate})\n\t} else {\n\t\tops = append(ops, ResourceOperation{leRole, OperationDeleteIfExists})\n\t\tops = append(ops, ResourceOperation{leRoleBinding, OperationDeleteIfExists})\n\t}\n\n\tif len(resourceOptions.GoogleProjectId) > 0 && app.Spec.GCP != nil {\n\t\t// TODO: A service account will be required for all GCP related resources.\n\t\t// TODO: If implementing more features, move these two outside of the cloud storage check.\n\t\tgoogleServiceAccount := GoogleIAMServiceAccount(app, resourceOptions.GoogleProjectId)\n\t\tgoogleServiceAccountBinding := GoogleIAMPolicy(app, &googleServiceAccount, resourceOptions.GoogleProjectId)\n\t\tops = append(ops, ResourceOperation{&googleServiceAccount, OperationCreateOrUpdate})\n\t\tops = append(ops, ResourceOperation{&googleServiceAccountBinding, OperationCreateOrUpdate})\n\n\t\tif app.Spec.GCP.Buckets != nil && len(app.Spec.GCP.Buckets) > 0 {\n\t\t\tfor _, b := range app.Spec.GCP.Buckets {\n\t\t\t\tbucket := GoogleStorageBucket(app, b)\n\t\t\t\tops = append(ops, ResourceOperation{bucket, OperationCreateIfNotExists})\n\n\t\t\t\tbucketAccessControl := GoogleStorageBucketAccessControl(app, bucket.Name, resourceOptions.GoogleProjectId, googleServiceAccount.Name)\n\t\t\t\tops = append(ops, ResourceOperation{bucketAccessControl, OperationCreateOrUpdate})\n\t\t\t}\n\t\t}\n\n\t\tif app.Spec.GCP.SqlInstances != nil {\n\t\t\tfor i, sqlInstance := range app.Spec.GCP.SqlInstances {\n\t\t\t\tif i > 0 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"only one sql instance is supported\")\n\t\t\t\t}\n\n\t\t\t\t// TODO: name defaulting will break with more than one instance\n\t\t\t\tsqlInstance, err := CloudSqlInstanceWithDefaults(sqlInstance, app.Name)\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\tinstance := GoogleSqlInstance(app, sqlInstance, resourceOptions.GoogleTeamProjectId)\n\t\t\t\tops = append(ops, ResourceOperation{instance, OperationCreateOrUpdate})\n\n\t\t\t\tiamPolicyMember := SqlInstanceIamPolicyMember(app, sqlInstance.Name, resourceOptions.GoogleProjectId, resourceOptions.GoogleTeamProjectId)\n\t\t\t\tops = append(ops, ResourceOperation{iamPolicyMember, OperationCreateIfNotExists})\n\n\t\t\t\tfor _, db := range GoogleSqlDatabases(app, sqlInstance, resourceOptions.GoogleTeamProjectId) {\n\t\t\t\t\tops = append(ops, ResourceOperation{db, OperationCreateIfNotExists})\n\t\t\t\t}\n\n\t\t\t\tkey, err := util.Keygen(32)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to generate secret for sql user: %s\", err)\n\t\t\t\t}\n\t\t\t\tpassword := base64.URLEncoding.WithPadding(base64.NoPadding).EncodeToString(key)\n\n\t\t\t\tsecret := OpaqueSecret(app, GCPSqlInstanceSecretName(instance.Name), GoogleSqlUserEnvVars(instance.Name, password))\n\t\t\t\tops = append(ops, ResourceOperation{secret, OperationCreateIfNotExists})\n\n\t\t\t\tsqlUser := GoogleSqlUser(app, instance.Name, sqlInstance.CascadingDelete, resourceOptions.GoogleTeamProjectId)\n\t\t\t\tops = append(ops, ResourceOperation{sqlUser, OperationCreateIfNotExists})\n\n\t\t\t\t// FIXME: take into account when refactoring default values\n\t\t\t\tapp.Spec.GCP.SqlInstances[i].Name = sqlInstance.Name\n\t\t\t}\n\t\t}\n\t} else if len(resourceOptions.GoogleProjectId) > 0 && app.Spec.GCP == nil {\n\t\tgoogleServiceAccount := GoogleIAMServiceAccount(app, resourceOptions.GoogleProjectId)\n\t\tgoogleServiceAccountBinding := GoogleIAMPolicy(app, &googleServiceAccount, resourceOptions.GoogleProjectId)\n\t\tops = append(ops, ResourceOperation{&googleServiceAccount, OperationDeleteIfExists})\n\t\tops = append(ops, ResourceOperation{&googleServiceAccountBinding, OperationDeleteIfExists})\n\t}\n\n\tif resourceOptions.AccessPolicy {\n\t\tops = append(ops, ResourceOperation{NetworkPolicy(app, resourceOptions.AccessPolicyNotAllowedCIDRs), OperationCreateOrUpdate})\n\t\tvses, err := VirtualServices(app)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to create VirtualServices: %s\", err)\n\t\t}\n\n\t\toperation = OperationCreateOrUpdate\n\t\tif len(app.Spec.Ingresses) == 0 {\n\t\t\toperation = OperationDeleteIfExists\n\t\t}\n\n\t\tfor _, vs := range vses {\n\t\t\tops = append(ops, ResourceOperation{vs, operation})\n\t\t}\n\n\t\t// Applies to Authorization policies\n\t\toperation = OperationCreateOrUpdate\n\t\tif len(app.Spec.AccessPolicy.Inbound.Rules) == 0 && len(app.Spec.Ingresses) == 0 {\n\t\t\toperation = OperationDeleteIfExists\n\t\t}\n\t\tauthorizationPolicy := AuthorizationPolicy(app)\n\t\tif authorizationPolicy != nil {\n\t\t\tops = append(ops, ResourceOperation{authorizationPolicy, operation})\n\t\t}\n\n\t\tserviceEntry := ServiceEntry(app)\n\t\toperation = OperationCreateOrUpdate\n\t\tif len(app.Spec.AccessPolicy.Outbound.External) == 0 {\n\t\t\toperation = OperationDeleteIfExists\n\t\t}\n\t\tif serviceEntry != nil {\n\t\t\tops = append(ops, ResourceOperation{serviceEntry, operation})\n\t\t}\n\n\t} else {\n\n\t\tingress, err := Ingress(app)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"while creating ingress: %s\", err)\n\t\t}\n\n\t\t// Kubernetes doesn't support ingress resources without any rules. This means we must\n\t\t// delete the old resource if it exists.\n\t\toperation = OperationCreateOrUpdate\n\t\tif len(app.Spec.Ingresses) == 0 {\n\t\t\toperation = OperationDeleteIfExists\n\t\t}\n\n\t\tops = append(ops, ResourceOperation{ingress, operation})\n\t}\n\n\tdeployment, err := Deployment(app, resourceOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"while creating deployment: %s\", err)\n\t}\n\tops = append(ops, ResourceOperation{deployment, OperationCreateOrUpdate})\n\n\treturn ops, nil\n}", "title": "" }, { "docid": "08b84ff2eeb9f9496588fde556650e9b", "score": "0.45366067", "text": "func NewTeamPost(ctx *context.Context) {\n\tform := web.GetForm(ctx).(*forms.CreateTeamForm)\n\tincludesAllRepositories := form.RepoAccess == \"all\"\n\tp := perm.ParseAccessMode(form.Permission)\n\tunitPerms := getUnitPerms(ctx.Req.Form, p)\n\tif p < perm.AccessModeAdmin {\n\t\t// if p is less than admin accessmode, then it should be general accessmode,\n\t\t// so we should calculate the minial accessmode from units accessmodes.\n\t\tp = unit_model.MinUnitAccessMode(unitPerms)\n\t}\n\n\tt := &org_model.Team{\n\t\tOrgID: ctx.Org.Organization.ID,\n\t\tName: form.TeamName,\n\t\tDescription: form.Description,\n\t\tAccessMode: p,\n\t\tIncludesAllRepositories: includesAllRepositories,\n\t\tCanCreateOrgRepo: form.CanCreateOrgRepo,\n\t}\n\n\tunits := make([]*org_model.TeamUnit, 0, len(unitPerms))\n\tfor tp, perm := range unitPerms {\n\t\tunits = append(units, &org_model.TeamUnit{\n\t\t\tOrgID: ctx.Org.Organization.ID,\n\t\t\tType: tp,\n\t\t\tAccessMode: perm,\n\t\t})\n\t}\n\tt.Units = units\n\n\tctx.Data[\"Title\"] = ctx.Org.Organization.FullName\n\tctx.Data[\"PageIsOrgTeams\"] = true\n\tctx.Data[\"PageIsOrgTeamsNew\"] = true\n\tctx.Data[\"Units\"] = unit_model.Units\n\tctx.Data[\"Team\"] = t\n\n\tif ctx.HasError() {\n\t\tctx.HTML(http.StatusOK, tplTeamNew)\n\t\treturn\n\t}\n\n\tif t.AccessMode < perm.AccessModeAdmin && len(unitPerms) == 0 {\n\t\tctx.RenderWithErr(ctx.Tr(\"form.team_no_units_error\"), tplTeamNew, &form)\n\t\treturn\n\t}\n\n\tif err := models.NewTeam(t); err != nil {\n\t\tctx.Data[\"Err_TeamName\"] = true\n\t\tswitch {\n\t\tcase org_model.IsErrTeamAlreadyExist(err):\n\t\t\tctx.RenderWithErr(ctx.Tr(\"form.team_name_been_taken\"), tplTeamNew, &form)\n\t\tdefault:\n\t\t\tctx.ServerError(\"NewTeam\", err)\n\t\t}\n\t\treturn\n\t}\n\tlog.Trace(\"Team created: %s/%s\", ctx.Org.Organization.Name, t.Name)\n\tctx.Redirect(ctx.Org.OrgLink + \"/teams/\" + url.PathEscape(t.LowerName))\n}", "title": "" }, { "docid": "7f841e9339f6c67b85224a91ff0f0baf", "score": "0.45359895", "text": "func CreateScores(c appengine.Context, userIds []int64, tournamentId int64) ([]*Score, []*datastore.Key, error) {\n\tkeys := make([]*datastore.Key, 0)\n\tscoreEntities := make([]*Score, 0)\n\tfor _, id := range userIds {\n\t\tsId, _, err := datastore.AllocateIDs(c, \"Score\", nil, 1)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tk := datastore.NewKey(c, \"Score\", \"\", sId, nil)\n\t\tkeys = append(keys, k)\n\n\t\tscores := make([]int64, 0)\n\t\ts := &Score{sId, id, tournamentId, scores}\n\t\tscoreEntities = append(scoreEntities, s)\n\t}\n\n\t// if _, err := datastore.PutMulti(c, keys, scoreEntities); err != nil {\n\t// \treturn nil, err\n\t// }\n\n\treturn scoreEntities, keys, nil\n}", "title": "" }, { "docid": "5483d7ce79387ba72cb2aa051e5d62ed", "score": "0.45056203", "text": "func CreateTeamAction(c *gcli.Context) {\n\t// Create users first\n\tprintVerboseMessage(\"Create team users first\")\n\tCreateTeamUsersAction(c)\n\t// Create team for the users\n\tprintVerboseMessage(\"Create team\")\n\tcli, err := NewTeamClient(c)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\treq := team.CreateTeamRequest{}\n\tif val, success := getVal(\"name\", c); success {\n\t\treq.Name = val\n\t}\n\tif c.IsSet(\"M\") {\n\t\treq.Members = extractMembersFromCommand(c)\n\t}\n\tresp, err := cli.Create(req)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tprintVerboseMessage(\"Team created successfully:\"+resp.Id)\n\t// Update team schedule\n\tprintVerboseMessage(\"Enabling and updating the default team schedule\")\n\tUpdateTeamScheduleAction(c)\n\t// Update team escalation\n\tif _, success := getVal(\"escalation\", c); success {\n\t\tprintVerboseMessage(\"Updating the default team escalation\")\n\t\tUpdateTeamEscalationAction(c)\n\t}\n}", "title": "" }, { "docid": "3cc9ba39cae41686d372070fc642e5e4", "score": "0.44989076", "text": "func ProjectCreatePOST(w http.ResponseWriter, r *http.Request) {\n\t// Get session\n\tsess := session.Instance(r)\n\n\t// Validate with required fields\n\tif validate, missingField := view.Validate(r, []string{\"project_name\",\n\t\t\"customer_company\", \"employee_company\", \"supervisor\", \"priority\",\n\t\t\"start_date\", \"end_date\"}); !validate {\n\t\tsess.AddFlash(view.Flash{\"Field missing: \" + missingField, view.FlashError})\n\t\tsess.Save(r, w)\n\t\tProjectCreateGET(w, r)\n\t\treturn\n\t}\n\n\t// Validate with Google reCAPTCHA\n\tif !recaptcha.Verified(r) {\n\t\tsess.AddFlash(view.Flash{\"reCAPTCHA invalid!\", view.FlashError})\n\t\tsess.Save(r, w)\n\t\tProjectCreateGET(w, r)\n\t\treturn\n\t}\n\n\t// Get form values\n\tprojectName := r.FormValue(\"project_name\")\n\tcustomerCompany := r.FormValue(\"customer_company\")\n\temployeeCompany := r.FormValue(\"employee_company\")\n\tsupervisor := r.FormValue(\"supervisor\")\n\tpriority := r.FormValue(\"priority\")\n\tstartDate := r.FormValue(\"start_date\")\n\tendDate := r.FormValue(\"end_date\")\n\tdone := r.FormValue(\"done\")\n\n\tpriorityInt, _ := strconv.ParseInt(priority, 10, 64)\n\tboolDone, _ := strconv.ParseBool(done)\n\tfmt.Println(\"PriotiryInt: \", priorityInt)\n\tfmt.Println(\"boolDone: \", boolDone)\n\n\t// Get database result\n\t_, err := model.ProjectByName(projectName)\n\n\tif err == model.ErrNoResult { // If success (no user exists with that email)\n\t\tex := model.ProjectCreate(projectName, customerCompany, employeeCompany,\n\t\t\tsupervisor, priorityInt, startDate, endDate, boolDone)\n\t\t// Will only error if there is a problem with the query\n\t\tif ex != nil {\n\t\t\tlog.Println(ex)\n\t\t\tsess.AddFlash(view.Flash{\"An error occurred on the server. Please try again later.\", view.FlashError})\n\t\t\tsess.Save(r, w)\n\t\t} else {\n\t\t\tsess.AddFlash(view.Flash{\"Account created successfully for: \" + projectName, view.FlashSuccess})\n\t\t\tsess.Save(r, w)\n\t\t\thttp.Redirect(w, r, \"/project\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\t} else if err != nil { // Catch all other errors\n\t\tlog.Println(err)\n\t\tsess.AddFlash(view.Flash{\"An error occurred on the server. Please try again later.\", view.FlashError})\n\t\tsess.Save(r, w)\n\t} else { // Else the user already exists\n\t\tsess.AddFlash(view.Flash{\"Project already exists for: \" + projectName, view.FlashError})\n\t\tsess.Save(r, w)\n\t}\n\n\t// Display the page\n\tProjectCreateGET(w, r)\n}", "title": "" }, { "docid": "a52f34b672b0462f20154e50300957f3", "score": "0.44807342", "text": "func (a *TeamsServer) CreateTeam(ctx context.Context, r *gwreq.CreateTeamReq) (*gwres.CreateTeamResp, error) {\n\treq := &teams.CreateTeamReq{\n\t\tName: r.Name,\n\t\tDescription: r.Description,\n\t}\n\tres, err := a.client.CreateTeam(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &gwres.CreateTeamResp{\n\t\tTeam: fromUpstreamTeam(res.Team),\n\t}, nil\n}", "title": "" }, { "docid": "deb1fd383c3b10ebe134183843280a78", "score": "0.4462115", "text": "func InitTeams(ctx context.Context, teams *firestore.CollectionRef, path string) (int, error) {\n\tteamCount := 0\n\t// Load team CSV file.\n\tcsvfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn teamCount, err\n\t}\n\n\tteamsDoc := make([]map[string]string, 0)\n\n\tr := csv.NewReader(csvfile)\n\tlocalTeams, err := r.ReadAll()\n\tif err != nil {\n\t\treturn teamCount, err\n\t}\n\tfor _, team := range localTeams {\n\t\tdoc := make(map[string]string)\n\t\tfor column, name := range team {\n\t\t\tswitch column {\n\t\t\tcase 0:\n\t\t\t\tdoc[\"name\"] = name\n\t\t\tcase 1:\n\t\t\t\tdoc[\"player1\"] = name\n\t\t\tcase 2:\n\t\t\t\tdoc[\"player2\"] = name\n\t\t\tcase 3:\n\t\t\t\tdoc[\"player3\"] = name\n\t\t\tcase 4:\n\t\t\t\tdoc[\"player4\"] = name\n\t\t\tcase 5:\n\t\t\t\tif name != \"\" {\n\t\t\t\t\tdoc[\"player5\"] = name\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tteamCount++\n\t\tteamsDoc = append(teamsDoc, doc)\n\t}\n\n\tfor _, doc := range teamsDoc {\n\t\tname := doc[\"name\"]\n\t\t_, err := teams.Doc(name).Set(ctx, doc)\n\t\tif err != nil {\n\t\t\treturn teamCount, err\n\t\t}\n\t}\n\treturn teamCount, nil\n}", "title": "" }, { "docid": "8acc7b3aaff1f1a0d4e75b66ec5081ae", "score": "0.44533634", "text": "func (ca Controller) CreateCase(c *gin.Context) {\n\n\t// Create empty request body\n\tvar req requests.CaseRequest\n\n\t// Parse Request Body\n\tif err := c.BindJSON(&req); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"code\": http.StatusBadRequest,\n\t\t\t\"message\": \"Wrong Request Body. Please try again\",\n\t\t})\n\t\treturn\n\t}\n\n\t// Validate if all the required fields are present\n\tif req.User.Name == \"\" ||\n\t\treq.User.Email == \"\" ||\n\t\treq.User.Phone == \"\" ||\n\t\treq.Car.Color == \"\" ||\n\t\treq.Car.RegNo == \"\" ||\n\t\treq.Car.Model == \"\" ||\n\t\treq.Car.LastSeen == \"\" ||\n\t\treq.Car.Location == \"\" ||\n\t\treq.Car.Description == \"\"{\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"code\": http.StatusBadRequest,\n\t\t\t\"message\": \"Please ensure that all the fields are filled\",\n\t\t})\n\t\treturn\n\t}\n\n\t// TODO: Check if the User's case is already present in the DB\n\n\t// Check DB for unassigned Officer\n\tofficers, err := ca.M.GetUnassignedOfficers()\n\n\tvar officer models.Officer\n\tvar assigned bool\n\n\tif err != nil {\n\t\tofficer = models.Officer{}\n\t\tassigned = false\n\t} else {\n\t\tofficer = officers[0]\n\t\tassigned = true\n\t}\n\n\t// Change officer status to assigned\n\terr = ca.M.MakeOfficerAssigned(officer.ID)\n\n\tif err != nil {\n\t\tofficer = models.Officer{}\n\t\tassigned = false\n\t}\n\n\t// Convert the request body to newCase Model\n\tnewCase := models.Case{\n\t\tUserInfo: models.UserInfo{\n\t\t\tName: req.User.Name,\n\t\t\tEmail: req.User.Email,\n\t\t\tPhone: req.User.Phone,\n\t\t},\n\t\tCar: models.Car{\n\t\t\tColor: req.Car.Color,\n\t\t\tRegNo: req.Car.RegNo,\n\t\t\tModel: req.Car.Model,\n\t\t\tLastSeen: req.Car.LastSeen,\n\t\t\tLocation: req.Car.Location,\n\t\t\tImage: req.Car.Image,\n\t\t\tDescription: req.Car.Description,\n\t\t},\n\t\tActive: true,\n\t\tAssigned: assigned,\n\t\tOfficer: officer.ID,\n\t}\n\n\tinsertedId, err := ca.M.CreateNewCase(newCase)\n\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"code\": http.StatusInternalServerError,\n\t\t\t\"message\": \"Error while inserting case to DB. Please try again.\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"code\": http.StatusOK,\n\t\t\"message\": \"Successfully Added Case to DB\",\n\t\t\"id\": insertedId,\n\t\t\"officer\": officer,\n\t\t\"assigned\": assigned,\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "ed5e547296f5116e64c5fa612e2c7b41", "score": "0.44192424", "text": "func createContestParticipantsGroup(store *database.DataStore, itemID int64) int64 {\n\tvar participantsGroupID int64\n\tservice.MustNotBeError(store.RetryOnDuplicatePrimaryKeyError(func(s *database.DataStore) error {\n\t\tparticipantsGroupID = s.NewID()\n\t\treturn s.Groups().InsertMap(map[string]interface{}{\n\t\t\t\"id\": participantsGroupID, \"type\": \"ContestParticipants\",\n\t\t\t\"name\": fmt.Sprintf(\"%d-participants\", itemID),\n\t\t})\n\t}))\n\tservice.MustNotBeError(store.PermissionsGranted().InsertMap(map[string]interface{}{\n\t\t\"group_id\": participantsGroupID,\n\t\t\"item_id\": itemID,\n\t\t\"source_group_id\": participantsGroupID,\n\t\t\"origin\": \"group_membership\",\n\t\t\"can_view\": \"content\",\n\t}))\n\treturn participantsGroupID\n}", "title": "" }, { "docid": "2102a79b2364c5665c5cbecb57022fda", "score": "0.4398401", "text": "func (w Workout) GenerateRank(userHabits behavior.Habits, primaryGoal, secondaryGoal Goal.Enum, obesityCategory ObesityCategory.Enum) float64 {\n\n\tscore := 0.0\n\n\tgoalsFactor := 0.40\n\tpreferencesFactor := 0.20\n\tworkoutsFactor := 0.20\n\tobesityFactor := 0.20\n\n\t/*\n\t * Goals\n\t */\n\tgoalsScore := 0.0\n\tif w.suitableForGoal(primaryGoal) {\n\t\t// its way more important the primary goal , so it receives 80% of the goal score\n\t\tgoalsScore += 0.8\n\t}\n\n\tif w.suitableForGoal(secondaryGoal) {\n\t\tgoalsScore += 0.2\n\t}\n\n\tscore += goalsScore * goalsFactor\n\n\t/*\n\t * Workouts experience\n\t */\n\tlengthScore := 1.0\n\t// The difference between the workout duration and the requested duration\n\t// people will prefer shorted workouts so same or less gets the best score (1.0), more\n\t// than that will decrease the score by .1 by every 3 (180 sec) minutes that its length increases\n\t// until it gets to 0 to lose the score\n\tdifference := w.Duration - userHabits.WorkoutsDuration\n\n\tif difference > 0 {\n\t\t// this means that the workout is longer that desired\n\t\tlengthScore = 1 - (0.1 * (difference.Minutes() / 3))\n\t\tif lengthScore < 0 {\n\t\t\tlengthScore = 0\n\t\t}\n\t}\n\n\trequiresGymScore := 0.0\n\t// If the workout requires a gym but the user doesnt attend one, no score , if attends, full score\n\t// If the workout doesnt require a gym then full score because home workouts\n\t// can be done at the gym too\n\tif w.RequiresGym && userHabits.AttendsGym {\n\t\trequiresGymScore = 1\n\t}\n\texperienceScore := 1.0\n\n\t// the farther the workout required experience and the users experience are\n\t// the less likely the user will want to do this workout, account for that\n\texperienceScore = 1 - math.Abs(float64(w.TargetExperience.Compare(userHabits.GymExperience))*0.5)\n\tif experienceScore < 0 {\n\t\texperienceScore = 0\n\t}\n\n\tworkoutScore := (lengthScore + requiresGymScore + experienceScore) / 3\n\tscore += workoutScore * workoutsFactor\n\n\t//fmt.Println(\"sum\", (lengthScore + requiresGymScore + experienceScore), \"workoutScore\", workoutScore, \"score\", score)\n\n\t/*\n\t * Preferred Cardio Exercises factor\n\t */\n\n\tcardioScore := 0.0\n\tif len(w.CardioOptions) != 0 {\n\t\tfor _, preferred := range userHabits.PreferredCardio {\n\t\t\tfor _, option := range w.CardioOptions {\n\t\t\t\tif option == preferred {\n\t\t\t\t\tcardioScore += 0.5\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tscore += cardioScore * preferencesFactor\n\n\tobesityScore := 1.0\n\t/* obesity factor */\n\tif obesityCategory.Compare(w.BMIRestriction) > 0 {\n\t\t// Negative result means that the user can do the exercise\n\t\t// workout receives the full score (1.0), but if he user is not\n\t\t// too far from the recommended obesity restriction then the\n\t\t// workout will receive some score\n\t\tobesityScore = 1 - (0.5 * float64(obesityCategory.Compare(w.BMIRestriction)))\n\t\tif obesityScore < 0 {\n\t\t\tobesityScore = 0\n\t\t}\n\t}\n\n\tscore += obesityScore * obesityFactor\n\n\treturn score\n\n}", "title": "" }, { "docid": "5193f78ad4ff03d1c5c07f2780e63089", "score": "0.43936822", "text": "func (db *DB) CreateTournament(tournamentID string, deposit int) error {\n\tif _, err := db.Exec(\"INSERT INTO tournament (id, deposit) VALUES ($1, $2);\", tournamentID, deposit); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "798518108ce9e8623e601dd9bd5c6b45", "score": "0.4388487", "text": "func (a *IncidentTeamsApi) CreateIncidentTeam(ctx _context.Context, body IncidentTeamCreateRequest) (IncidentTeamResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue IncidentTeamResponse\n\t)\n\n\toperationId := \"v2.CreateIncidentTeam\"\n\tif a.Client.Cfg.IsUnstableOperationEnabled(operationId) {\n\t\t_log.Printf(\"WARNING: Using unstable operation '%s'\", operationId)\n\t} else {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf(\"Unstable operation '%s' is disabled\", operationId)}\n\t}\n\n\tlocalBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, \"v2.IncidentTeamsApi.CreateIncidentTeam\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v2/teams\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tlocalVarHeaderParams[\"Content-Type\"] = \"application/json\"\n\tlocalVarHeaderParams[\"Accept\"] = \"application/json\"\n\n\t// body params\n\tlocalVarPostBody = &body\n\tdatadog.SetAuthKeys(\n\t\tctx,\n\t\t&localVarHeaderParams,\n\t\t[2]string{\"apiKeyAuth\", \"DD-API-KEY\"},\n\t\t[2]string{\"appKeyAuth\", \"DD-APPLICATION-KEY\"},\n\t)\n\treq, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)\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 := datadog.ReadBody(localVarHTTPResponse)\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.ErrorModel = 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 := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e66d4380ef335dde9a7e625e692a7385", "score": "0.43803626", "text": "func CreateDataFromSpreadFiles(Sport string) {\n\tYearToStart := 2015\n\tYearToStop := 2015\n\tFileToWrite, _ := os.Create(Sport + \"WPData.txt\")\n\tdefer FileToWrite.Close()\n\tfor YearToStart <= YearToStop {\n\t\tfmt.Printf(\"Now compiling stats for %v year...\\n\", YearToStart)\n\t\tvar TeamData AllTeamData = NewAllTeamData()\n\t\tif strings.Compare(Sport, \"Football\") == 0 {\n\t\t\tTeamData[\"BYE\"] = NewTeamData()\n\t\t}\n\t\tfile, err := os.Open(strconv.Itoa(YearToStart) + Sport + \"OddsAndScores.txt\")\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"ERROR: error reading file for year %v and sport %v\\n\", YearToStart, Sport)\n\t\t\tfile.Close()\n\t\t\treturn\n\t\t}\n\t\tscan := bufio.NewScanner(file)\n\t\tfor scan.Scan() {\n\t\t\tGames := strings.Split(scan.Text(), \",\")\n\t\t\tDateString := Games[0]\n\t\t\tGames = Games[1 : len(Games)-1]\n\t\t\tfor _, val := range Games {\n\t\t\t\tGameData := strings.Split(val, \" \")\n\t\t\t\tif len(GameData) < 7 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tHomeTeam := GetPFRTeamAbbr(GameData[3])\n\t\t\t\tVisitingScore, _ := strconv.ParseFloat(GameData[2], 64)\n\t\t\t\tHomeScore, _ := strconv.ParseFloat(GameData[5], 64)\n\t\t\t\tSpread, _ := strconv.ParseFloat(GameData[1], 64)\n\t\t\t\tif Spread < 0 {\n\t\t\t\t\tSpread = -Spread\n\t\t\t\t}\n\t\t\t\tif Spread < -60 || Spread > 60 {\n\t\t\t\t\tSpread, _ = strconv.ParseFloat(GameData[4], 64)\n\t\t\t\t\tif Spread > 0 {\n\t\t\t\t\t\tSpread = -Spread\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//StartingWP := WinProbability(0, Spread, STDDEV)\n\t\t\t\tThisGame, VisitingTeam, _ := GetDataForGameLink(\"/boxscores/\" + DateString + \"0\" + strings.ToLower(HomeTeam) + \".htm\")\n\t\t\t\tif ThisGame == nil {\n\t\t\t\t\tfmt.Println(\"Error getting game data for link\", DateString+strings.ToLower(HomeTeam)+\".htm\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif _, ok := TeamData[HomeTeam]; ok {\n\t\t\t\t\tif TeamData[HomeTeam][GAMESPLAYED] > 2 {\n\t\t\t\t\t\tGuessSpread := TeamData[HomeTeam][STRAIGHTWPADJUST]/TeamData[HomeTeam][GAMESPLAYED] - TeamData[VisitingTeam][STRAIGHTWPADJUST]/TeamData[VisitingTeam][GAMESPLAYED]\n\t\t\t\t\t\tGuessOP := (-TeamData[HomeTeam][OPPWPADJUST]/(TeamData[HomeTeam][GAMESPLAYED]-1) + TeamData[VisitingTeam][OPPWPADJUST]/(TeamData[VisitingTeam][GAMESPLAYED]-1)) / 2\n\t\t\t\t\t\tGuessWP := (-TeamData[VisitingTeam][WPADJUST]/TeamData[VisitingTeam][GAMESPLAYED] + TeamData[HomeTeam][WPADJUST]/TeamData[HomeTeam][GAMESPLAYED]) / 2\n\t\t\t\t\t\tGuessBoth := (GuessWP + GuessOP) / 2.0\n\t\t\t\t\t\tGuessWP = NewSpread(0.5+GuessWP+GuessSpread, 0.0, STDDEV)\n\t\t\t\t\t\tGuessOP = NewSpread(0.5+GuessOP+GuessSpread, 0.0, STDDEV)\n\t\t\t\t\t\tGuessBoth = NewSpread(0.5+GuessBoth+GuessSpread, 0.0, STDDEV)\n\t\t\t\t\t\tGuessSpread = NewSpread(0.5+GuessSpread, 0.0, STDDEV)\n\t\t\t\t\t\tNewProb := WinProbability(0, TeamData[HomeTeam][SPREAD], STDDEV) + ((TeamData[HomeTeam][WPADJUST]/TeamData[HomeTeam][GAMESPLAYED])-(TeamData[VisitingTeam][WPADJUST]/TeamData[VisitingTeam][GAMESPLAYED]))/2\n\t\t\t\t\t\tEstSpread := NewSpread(NewProb, TeamData[HomeTeam][SPREAD], STDDEV)\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(GuessSpread, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(GuessWP, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(GuessOP, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(GuessBoth, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(EstSpread, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat((GuessSpread+GuessWP+GuessOP+GuessBoth+EstSpread)/5, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tFileToWrite.Write([]byte(strconv.FormatFloat(Spread, 'f', -1, 64)))\n\t\t\t\t\t\tFileToWrite.Write([]byte(\",\"))\n\t\t\t\t\t\tif HomeScore-VisitingScore+Spread > 0 {\n\t\t\t\t\t\t\tFileToWrite.Write([]byte(\"1\"))\n\t\t\t\t\t\t} else if HomeScore-VisitingScore+Spread < 0 {\n\t\t\t\t\t\t\tFileToWrite.Write([]byte(\"0\"))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tFileToWrite.Write([]byte(\"2\"))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tFileToWrite.Write([]byte(\"\\n\"))\n\t\t\t\t\t}\n\t\t\t\t\tThisGame[VisitingTeam][OPPWPADJUST] += TeamData[HomeTeam][WPADJUST] / TeamData[HomeTeam][GAMESPLAYED]\n\t\t\t\t\tThisGame[HomeTeam][OPPWPADJUST] += TeamData[VisitingTeam][WPADJUST] / TeamData[VisitingTeam][GAMESPLAYED]\n\t\t\t\t}\n\t\t\t\tTeamData.AddData(ThisGame)\n\t\t\t}\n\t\t}\n\t\tfile.Close()\n\t\tYearToStart++\n\t}\n}", "title": "" }, { "docid": "215e8dc447a4b9c1f0c67e3b35f6a9cc", "score": "0.4370103", "text": "func (e *Experience) CreateExperience(db *pg.DB) error {\n\treturn errors.New(\"Not Implemented\")\n\n}", "title": "" }, { "docid": "6a049b488be692b1da280cdd3454a14b", "score": "0.43622398", "text": "func CreateMultipleChoiceQuestion(data types.MutltipleChoiceQuestion) (int, error) {\n\tsql := `SELECT now()`\n\n\t_, err := Database.Exec(sql)\n\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "d9f19e562b68bb3a4d5c854bd9f8f4fd", "score": "0.43404582", "text": "func NewCreateTeamDefault(code int) *CreateTeamDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &CreateTeamDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "fffcf8b99c094fe1ec73e55ffbe84a76", "score": "0.43341833", "text": "func createFiles(pNum int) error {\n\n\tpString := fmt.Sprintf(\"p%03d\", pNum)\n\n\t// create problem file\n\tpfName := fmt.Sprintf(\"%s/%s.go\", ProblemDir, pString)\n\tif e, err := fileExists(pfName); e || err != nil {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn os.ErrExist\n\t}\n\tpf, err := os.Create(pfName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pf.Close()\n\n\t// create test file\n\ttfName := fmt.Sprintf(\"%s/%s_test.go\", ProblemDir, pString)\n\tif e, err := fileExists(tfName); e || err != nil {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn os.ErrExist\n\t}\n\ttf, err := os.Create(tfName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer tf.Close()\n\n\t// populate files\n\t_, err = pf.WriteString(problemFileText(pNum))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = tf.WriteString(testFileText(pNum))\n\treturn err\n}", "title": "" }, { "docid": "d26e25f18f8add584adc1bbfc6ebf85d", "score": "0.43290848", "text": "func Create(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusCreated\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\t// Set Content-Type response Header value\n\tcontentType := r.Header.Get(\"Accept\")\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab Tenant DB configuration from context\n\ttenantDbConfig := context.Get(r, \"tenant_conf\").(config.MongoConfig)\n\n\t//Reading the json input from the request body\n\treqBody, err := ioutil.ReadAll(io.LimitReader(r.Body, cfg.Server.ReqSizeLimit))\n\n\tif err != nil {\n\t\treturn code, h, output, err\n\t}\n\tinput := MongoInterface{}\n\t//Unmarshalling the json input into byte form\n\n\terr = json.Unmarshal(reqBody, &input)\n\n\t// check if user declared any thresholds or else provide defaults\n\tif input.Thresholds == nil {\n\t\tt := defaultThresholds()\n\t\tinput.Thresholds = &t\n\t}\n\n\t// check if user declared what needs to be computed or else provide defaults\n\tif input.Computations == nil {\n\t\tc := genDefaultComp()\n\t\tinput.Computations = c\n\t}\n\n\t// Check if json body is malformed\n\tif err != nil {\n\t\toutput, _ = respond.MarshalContent(respond.BadRequestInvalidJSON, contentType, \"\", \" \")\n\t\tcode = 400\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\t// Try to open the mongo session\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer session.Close()\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Validate profiles given in report\n\tvalidationErrors := input.ValidateProfiles(session.DB(tenantDbConfig.Db))\n\tvalidationErrors = append(validationErrors, input.ValidateTrends()...)\n\n\tif len(validationErrors) > 0 {\n\t\tcode = 422\n\t\tout := respond.UnprocessableEntity\n\t\tout.Errors = validationErrors\n\t\toutput = out.MarshalTo(contentType)\n\t\treturn code, h, output, err\n\t}\n\n\t// Prepare structure for storing query results\n\tresults := []MongoInterface{}\n\n\t// Check if report with the same name exists in datastore\n\tquery := searchName(input.Info.Name)\n\terr = mongo.Find(session, tenantDbConfig.Db, reportsColl, query, \"name\", &results)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// If results are returned for the specific name\n\t// then we already have an existing report and we must\n\t// abort creation notifing the user\n\tif len(results) > 0 {\n\t\toutput, _ = respond.MarshalContent(respond.ErrConflict(\"Report with the same name already exists\"), contentType, \"\", \" \")\n\t\tcode = http.StatusConflict\n\t\treturn code, h, output, err\n\t}\n\n\tinput.Info.Created = time.Now().Format(\"2006-01-02 15:04:05\")\n\tinput.Info.Updated = input.Info.Created\n\tinput.ID = mongo.NewUUID()\n\t// If no report exists with this name create a new one\n\n\terr = mongo.Insert(session, tenantDbConfig.Db, reportsColl, input)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Notify user that the report has been created. In xml style\n\tselfLink := \"https://\" + r.Host + r.URL.Path + \"/\" + input.ID\n\toutput, err = SubmitSuccesful(input, contentType, selfLink)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\treturn code, h, output, err\n\n}", "title": "" }, { "docid": "2c4736f9a90529725a0bc157bdf41bc7", "score": "0.43258017", "text": "func (s *GithubSCM) CreateTeam(ctx context.Context, opt *TeamOptions) (*Team, error) {\n\tif !opt.validWithOrg() {\n\t\treturn nil, ErrMissingFields{\n\t\t\tMethod: \"CreateTeam\",\n\t\t\tMessage: fmt.Sprintf(\"%+v\", opt),\n\t\t}\n\t}\n\tt, _, err := s.client.Teams.CreateTeam(ctx, opt.Organization.Path, github.NewTeam{\n\t\tName: opt.TeamName,\n\t})\n\tif err != nil {\n\t\tif opt.TeamName != TeachersTeam && opt.TeamName != StudentsTeam {\n\t\t\treturn nil, ErrFailedSCM{\n\t\t\t\tMethod: \"CreateTeam\",\n\t\t\t\tMessage: fmt.Sprintf(\"failed to create GitHub team %s, make sure it does not already exist\", opt.TeamName),\n\t\t\t\tGitError: fmt.Errorf(\"failed to create GitHub team %s: %w\", opt.TeamName, err),\n\t\t\t}\n\t\t}\n\t\t// continue if it is one of standard teacher/student teams. Such teams can be safely reused\n\t\ts.logger.Infof(\"Team %s already exists on organization %s\", opt.TeamName, opt.Organization.Path)\n\t}\n\n\tfor _, user := range opt.Users {\n\t\t_, _, err = s.client.Teams.AddTeamMembership(ctx, t.GetID(), user, nil)\n\t\tif err != nil {\n\t\t\treturn nil, ErrFailedSCM{\n\t\t\t\tMethod: \"CreateTeam\",\n\t\t\t\tMessage: fmt.Sprintf(\"failed to add user '%s' to GitHub team '%s'\", user, t.GetName()),\n\t\t\t\tGitError: fmt.Errorf(\"failed to add '%s' to GitHub team '%s': %w\", user, t.GetName(), err),\n\t\t\t}\n\t\t}\n\t}\n\treturn &Team{\n\t\tID: uint64(t.GetID()),\n\t\tName: t.GetName(),\n\t\tURL: t.GetURL(),\n\t}, nil\n}", "title": "" }, { "docid": "03ccb52e6d7b53e6ae15691da376d1f2", "score": "0.4314487", "text": "func (*Handler) GetChallenges(ctx context.Context) error {\n\ttype challenge struct {\n\t\tID uint `json:\"ID\"`\n\t\tCreatedAt time.Time `json:\"CreatedAt\"`\n\t\tTitle string `json:\"Title\"`\n\t\tVisible bool `json:\"Visible\"`\n\t\tBaseScore float64 `json:\"BaseScore\"`\n\t\tAutoRenewFlag bool `json:\"AutoRenewFlag\"`\n\t\tRenewFlagCommand string `json:\"RenewFlagCommand\"`\n\t}\n\n\tchallenges, err := db.Challenges.Get(ctx.Request().Context())\n\tif err != nil {\n\t\tlog.Error(\"Failed to get challenges: %v\", err)\n\t\treturn ctx.ServerError()\n\t}\n\n\tchallengeList := make([]*challenge, 0, len(challenges))\n\tfor _, c := range challenges {\n\t\t// The challenge visible value depends on the challenge's game boxes' visible.\n\t\t// So we get one of the game box of the challenge and use its visible data.\n\t\tgameBoxes, err := db.GameBoxes.Get(ctx.Request().Context(), db.GetGameBoxesOption{\n\t\t\tChallengeID: c.ID,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Error(\"Failed to get game boxes list: %v\", err)\n\t\t\treturn ctx.ServerError()\n\t\t}\n\t\tvar challengeVisible bool\n\t\tif len(gameBoxes) != 0 {\n\t\t\tchallengeVisible = gameBoxes[0].Visible\n\t\t}\n\n\t\tchallengeList = append(challengeList, &challenge{\n\t\t\tID: c.ID,\n\t\t\tCreatedAt: c.CreatedAt,\n\t\t\tTitle: c.Title,\n\t\t\tVisible: challengeVisible,\n\t\t\tBaseScore: c.BaseScore,\n\t\t\tAutoRenewFlag: c.AutoRenewFlag,\n\t\t\tRenewFlagCommand: c.RenewFlagCommand,\n\t\t})\n\t}\n\n\treturn ctx.Success(challengeList)\n}", "title": "" }, { "docid": "a5a40b45081a234edb5553a9db66ca42", "score": "0.43132383", "text": "func (d *Database) DepartmentTeamCreate(DepartmentID string, TeamName string) (string, error) {\n\tvar TeamID string\n\terr := d.db.QueryRow(`\n\t\tSELECT teamId FROM department_team_create($1, $2);`,\n\t\tDepartmentID,\n\t\tTeamName,\n\t).Scan(&TeamID)\n\n\tif err != nil {\n\t\tlog.Println(\"Unable to create department team: \", err)\n\t\treturn \"\", err\n\t}\n\n\treturn TeamID, nil\n}", "title": "" }, { "docid": "b58bbea2ea8693dd66cc202c69475623", "score": "0.42981657", "text": "func (c *MatchController) Create(ctx *app.CreateMatchContext) error {\n\tdata := ctx.Payload\n\tm, err := repositories.CreateMatch(data.HomeTeam, data.AwayTeam, data.HomeUser, data.AwayUser, data.HomeGoals, data.AwayGoals)\n\tif err != nil {\n\t\treturn ctx.InternalServerError()\n\t}\n\tres := &app.FtMatch{\n\t\tHomeTeam: m.HomeTeam,\n\t\tAwayTeam: m.AwayTeam,\n\t\tHomeUser: m.HomeUserID,\n\t\tAwayUser: m.AwayUserID,\n\t\tHomeGoals: m.HomePoints,\n\t\tAwayGoals: m.AwayPoints,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4746c2142ca4073b28d6f205eca78e9c", "score": "0.42937487", "text": "func (*Handler) NewChallenge(ctx context.Context, f form.NewChallenge) error {\n\t_, err := db.Challenges.Create(ctx.Request().Context(), db.CreateChallengeOptions{\n\t\tTitle: f.Title,\n\t\tBaseScore: f.BaseScore,\n\t\tAutoRenewFlag: f.AutoRenewFlag,\n\t\tRenewFlagCommand: f.RenewFlagCommand,\n\t})\n\tif err != nil {\n\t\tlog.Error(\"Failed to create new challenge: %v\", err)\n\t\treturn ctx.ServerError()\n\t}\n\n\t// TODO send log to panel\n\n\t// TODO i18n\n\treturn ctx.Success(\"Success\")\n}", "title": "" }, { "docid": "68d798f418a54644ccd4c9d8c0e7e7cd", "score": "0.4281456", "text": "func (env Env) CreateTeam(t admin.Team) error {\n\t_, err := env.DBs.Write.NamedExec(admin.StmtCreateTeam, t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fd975aec66f7f1f19f4fdeac3142360c", "score": "0.42697737", "text": "func (s *TeamsServiceOp) Create(ctx context.Context, orgID string, createRequest *Team) (*Team, *Response, error) {\n\tif orgID == \"\" {\n\t\treturn nil, nil, NewArgError(\"orgID\", \"must be set\")\n\t}\n\tif createRequest == nil {\n\t\treturn nil, nil, NewArgError(\"createRequest\", \"cannot be nil\")\n\t}\n\n\treq, err := s.Client.NewRequest(ctx, http.MethodPost, fmt.Sprintf(teamsOrgBasePath, orgID), createRequest)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\troot := new(Team)\n\tresp, err := s.Client.Do(ctx, req, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn root, resp, err\n}", "title": "" }, { "docid": "6d02a68f6c03a3c867ae9ab1f468193d", "score": "0.42677507", "text": "func (c *Client) TeamsPost(falcopayload types.FalcoPayload) {\r\n\terr := c.Post(newTeamsPayload(falcopayload, c.Config))\r\n\tif err != nil {\r\n\t\tc.Stats.Teams.Add(\"error\", 1)\r\n\t} else {\r\n\t\tc.Stats.Teams.Add(\"ok\", 1)\r\n\t}\r\n\tc.Stats.Teams.Add(\"total\", 1)\r\n}", "title": "" }, { "docid": "308678288e06598ae893e641ac8ceedb", "score": "0.42590716", "text": "func (c *Client) CreateTeamContext(ctx context.Context, input *CreateTeamInput) (*Team, error) {\n\tu := \"/api/v2/teams\"\n\n\treq, err := c.NewRequest(\"POST\", u, input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tteam := new(Team)\n\tif err := c.Do(ctx, req, &team); err != nil {\n\t\treturn nil, err\n\t}\n\treturn team, nil\n}", "title": "" }, { "docid": "2cb841abf0c56a77403e4363e0d41102", "score": "0.42489767", "text": "func CreateSubmitSolutionRequest() (request *SubmitSolutionRequest) {\n\trequest = &SubmitSolutionRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2020-03-06\", \"SubmitSolution\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "092ef89e57bb9ddca3c1af86a70d737d", "score": "0.42422098", "text": "func CreateScores(c *gin.Context) {\n\tvar scores Scores\n\tc.BindJSON(&scores)\n\n\tdb.Create(&scores)\n\n\tc.JSON(http.StatusOK, \"Done\")\n}", "title": "" }, { "docid": "52c606e6a78660798615f63d979b6f71", "score": "0.42375144", "text": "func (server *Server) CreateProposal(c *gin.Context) {\n\n\t//clear previous error if any\n\terrList = map[string]string{}\n\n\tbody, err := ioutil.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\terrList[\"Invalid_body\"] = \"Unable to get request\"\n\t\tc.JSON(http.StatusUnprocessableEntity, gin.H{\n\t\t\t\"status\": http.StatusUnprocessableEntity,\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\trequestBody := map[string]string{}\n\terr = json.Unmarshal(body, &requestBody)\n\tif err != nil {\n\t\terrList[\"Unmarshal_error\"] = \"Cannot unmarshal body\"\n\t\tc.JSON(http.StatusUnprocessableEntity, gin.H{\n\t\t\t\"status\": http.StatusUnprocessableEntity,\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\tfmt.Println(\"BODY\")\n\tfmt.Println(requestBody[\"firstname\"])\n\n\tuid, err := auth.ExtractTokenID(c.Request)\n\tif err != nil {\n\t\terrList[\"Unauthorized\"] = \"Unauthorized\"\n\t\tc.JSON(http.StatusUnauthorized, gin.H{\n\t\t\t\"status\": http.StatusUnauthorized,\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\t// check if the user exist:\n\tuser := models.User{}\n\terr = server.DB.Debug().Model(models.User{}).Where(\"id = ?\", uid).Take(&user).Error\n\tif err != nil {\n\t\terrList[\"Unauthorized\"] = \"Unauthorized\"\n\t\tc.JSON(http.StatusUnauthorized, gin.H{\n\t\t\t\"status\": http.StatusUnauthorized,\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\t\n\n\tfmt.Println(\"SEND EMAIL OCCURED\")\n\t//Send the mail to the user\n\tresponseMail, err := mailer.SendMail.SendTravelProposal(user.Firstname, user.Email, requestBody[\"firstname\"], requestBody[\"email\"], requestBody[\"message\"], os.Getenv(\"SENDGRID_FROM\"), os.Getenv(\"SENDGRID_API_KEY\"))\n\tif err != nil {\n\t\tc.JSON(http.StatusUnprocessableEntity, gin.H{\n\t\t\t\"status\": http.StatusUnprocessableEntity,\n\t\t\t\"error\": err,\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, gin.H{\n\t\t\"responseMail\": responseMail.RespBody,\n\t})\n}", "title": "" }, { "docid": "ad71c44ccb31133b746cb2d3dd306100", "score": "0.42123002", "text": "func (state TournamentManager) Create(t *Tournament) error {\n\treturn state.db.Create(t).Error\n}", "title": "" }, { "docid": "66ce93bca11d6d3727e3c4507c5978f6", "score": "0.4201832", "text": "func (c *Client) CreateSprint(name string, goal string, startDate, endDate *time.Time) (*jiralib.Sprint, error) {\n\tvar sprintRequest struct {\n\t\tName string `json:\"name\"`\n\t\tStartDate *time.Time `json:\"startDate,omitempty\"`\n\t\tEndDate *time.Time `json:\"endDate,omitempty\"`\n\t\tBoardID int `json:\"originBoardId\"`\n\t\tGoal string `json:\"goal,omitempty\"`\n\t}\n\n\tsprintRequest.Name = name\n\tsprintRequest.StartDate = startDate\n\tsprintRequest.EndDate = endDate\n\tsprintRequest.BoardID = c.BoardID\n\tsprintRequest.Goal = goal\n\n\treq, err := c.JiraClient.NewRequest(\"POST\", \"/rest/agile/1.0/sprint\", &sprintRequest)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create sprint %q\", name)\n\t}\n\n\tsprint := new(jiralib.Sprint)\n\tresp, err := c.JiraClient.Do(req, sprint)\n\tif err != nil {\n\t\terr = jiralib.NewJiraError(resp, err)\n\t\treturn nil, errors.Wrapf(err, \"failed to create sprint %q\", sprint.Name)\n\t}\n\treturn sprint, nil\n}", "title": "" }, { "docid": "37fd3518e1b10f140744e0c80c441530", "score": "0.41800937", "text": "func createGame() (gameRecord database.GameRecord) {\n\tvar playerRecords [4]database.Player\n\tvar turn uint8\n\n\t// db represents whatever the db is that we're using. For v1, the database is actually just a\n\t// simple in map in memory. It is standing in for a real databse in v2.\n\tdb := database.Connection()\n\tgameState := engine.New()\n\tgameState.Deal()\n\n\t// loop over the game players...\n\tfor i := 0; i < len(gameState.Players); i++ {\n\t\tplayer := gameState.Players[i]\n\t\tplayerRecord, has2Cbs := recordPlayer(&player, initialScore)\n\t\tplayerRecords[i] = playerRecord\n\n\t\t// has2Cbs indicates that the player has the two of clubs, and goes first.\n\t\tif has2Cbs {\n\t\t\tturn = uint8(i) // make it that player's turn\n\t\t}\n\t}\n\n\tgameData := database.GameData{\n\t\tPlayers: playerRecords,\n\t\tPassDirection: initialDirection,\n\t\tPhase: database.PhasePass,\n\t\tTurn: turn,\n\t}\n\n\tgameRecord = db.AddGame(gameData)\n\n\treturn\n}", "title": "" }, { "docid": "dae567527227791b6e86676c61f41a93", "score": "0.4178486", "text": "func CreatePuzzle(n int) string {\n\tvalues := make(map[string]string)\n\tfor _, square := range squares {\n\t\tvalues[square] = digits\n\t}\n\n\tfor _, square := range shuffle(squares) {\n\t\tif _, err := assign(values, square, randomChoice(values[square])); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tds := make([]string, 0)\n\t\tfor _, s := range squares {\n\t\t\tif len(values[s]) == 1 {\n\t\t\t\tds = append(ds, values[s])\n\t\t\t}\n\t\t}\n\t\tif (len(ds) >= n) && (len(uniqueArray(ds)) >= 8) {\n\t\t\tvar buffer bytes.Buffer\n\t\t\tfor _, s := range squares {\n\t\t\t\tif len(values[s]) == 1 {\n\t\t\t\t\tbuffer.WriteString(values[s])\n\t\t\t\t} else {\n\t\t\t\t\tbuffer.WriteString(\"0\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tpuzzle := buffer.String()\n\t\t\t_, err := Solve(buffer.String()) // Test if solution can be found.\n\t\t\tif err != nil {\n\t\t\t\treturn CreatePuzzle(n)\n\t\t\t} else {\n\t\t\t\treturn puzzle\n\t\t\t}\n\t\t}\n\t}\n\treturn CreatePuzzle(n)\n}", "title": "" }, { "docid": "8cdada08bc75ae6cba8e3b232b1c00b6", "score": "0.41705692", "text": "func CreateQuestion(q iohandlers.SubmitRequest, c chan iohandlers.AdminResponse) {\n\tobj := Question{\n\t\tText: q.Text,\n\t\tAnswer: q.Answer,\n\t\tImage: q.Image,\n\t\tSolvedBy: 0,\n\t}\n\n\tinsertRes, err := db.Collection(\"questions\").InsertOne(context.TODO(), obj)\n\tif err != nil {\n\t\tlog.Println(\"Failed to insert new question :\", err.Error())\n\t\tc <- iohandlers.AdminResponse{\n\t\t\tStatus: false,\n\t\t\tMessage: \"Failed to insert new question : \" + err.Error(),\n\t\t}\n\t\treturn\n\t}\n\tlog.Println(\"Successfully inserted question : \", insertRes.InsertedID)\n\tc <- iohandlers.AdminResponse{\n\t\tStatus: true,\n\t\tMessage: \"Successfully inserted question!\",\n\t}\n}", "title": "" }, { "docid": "8b0b382a3a5d8f8bb3ec2736d4cd2f50", "score": "0.41670057", "text": "func Submit(c *cli.Context) {\n\tconfig, err := readConfigFile()\n\tif err != nil || config.APIKey == \"\" {\n\t\tfmt.Println(\"Please configure\")\n\t\treturn\n\t}\n\n\tchal, err := readChallengeFile()\n\tif err != nil {\n\t\tfmt.Println(\"Challenge not found. Please run fetch\")\n\t\treturn\n\t}\n\tif chal.Status != \"open\" {\n\t\tfmt.Printf(\"Sorry, %s is no longer open\\n\", chal.Name)\n\t\treturn\n\t}\n\tfmt.Printf(\"Submitting %s\\n\", chal.Name)\n\n\tif out, err := testsPass(chal.directory()); err != nil {\n\t\tfmt.Println(err)\n\t\tfmt.Println(out)\n\t\treturn\n\t}\n\tfmt.Println(\"Tests pass\")\n\n\tarchive, err := createArchive(chal.directory())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Created %s\\n\", archive)\n\n\terr = uploadFile(archive, config.APIKey, &submissionInfo{Type: c.String(\"type\")}, chal.ID)\n\tif err != nil {\n\t\tfmt.Println(\"Upload failed - \", err)\n\t\treturn\n\t}\n\tfmt.Println(\"Successfully submitted\")\n}", "title": "" }, { "docid": "37525d6eeaf15ac23082bfaca5d78059", "score": "0.41603053", "text": "func New(w http.ResponseWriter, r *http.Request, u *mdl.User) error {\n\tif r.Method != \"POST\" {\n\t\treturn &helpers.BadRequest{Err: errors.New(helpers.ErrorCodeNotSupported)}\n\t}\n\tc := appengine.NewContext(r)\n\tdesc := \"Tournament New Handler:\"\n\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%s Error when decoding request body: %v\", desc, err)\n\t\treturn &helpers.InternalServerError{Err: errors.New(helpers.ErrorCodeTournamentCannotCreate)}\n\t}\n\n\tvar tData TournamentData\n\terr = json.Unmarshal(body, &tData)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%s Error when decoding request body: %v\", desc, err)\n\t\treturn &helpers.InternalServerError{Err: errors.New(helpers.ErrorCodeTournamentCannotCreate)}\n\t}\n\n\tif len(tData.Name) <= 0 {\n\t\tlog.Errorf(c, \"%s 'Name' field cannot be empty\", desc)\n\t\treturn &helpers.InternalServerError{Err: errors.New(helpers.ErrorCodeNameCannotBeEmpty)}\n\t}\n\n\tif t := mdl.FindTournaments(c, \"KeyName\", helpers.TrimLower(tData.Name)); t != nil {\n\t\tlog.Errorf(c, \"%s That tournament name already exists.\", desc)\n\t\treturn &helpers.InternalServerError{Err: errors.New(helpers.ErrorCodeTournamentAlreadyExists)}\n\t}\n\n\ttournament, err := mdl.CreateTournament(c, tData.Name, tData.Description, time.Now(), time.Now(), u.Id)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%s error when trying to create a tournament: %v\", desc, err)\n\t\treturn &helpers.InternalServerError{Err: errors.New(helpers.ErrorCodeTournamentCannotCreate)}\n\t}\n\t// return the newly created tournament\n\tfieldsToKeep := []string{\"Id\", \"Name\"}\n\tvar tJSON mdl.TournamentJSON\n\thelpers.InitPointerStructure(tournament, &tJSON, fieldsToKeep)\n\n\tu.Publish(c, \"tournament\", \"created a tournament\", tournament.Entity(), mdl.ActivityEntity{})\n\n\tmsg := fmt.Sprintf(\"The tournament %s was correctly created!\", tournament.Name)\n\tdata := struct {\n\t\tMessageInfo string `json:\",omitempty\"`\n\t\tTournament mdl.TournamentJSON\n\t}{\n\t\tmsg,\n\t\ttJSON,\n\t}\n\n\treturn templateshlp.RenderJSON(w, c, data)\n\n}", "title": "" }, { "docid": "03929b9cbaca370480a72f17f3239610", "score": "0.41507232", "text": "func (d *Dota2) CreateTeam(\n\tctx context.Context,\n\treq *protocol.CMsgDOTACreateTeam,\n) (*protocol.CMsgDOTACreateTeamResponse, error) {\n\tresp := &protocol.CMsgDOTACreateTeamResponse{}\n\n\treturn resp, d.MakeRequest(\n\t\tctx,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgGCCreateTeam),\n\t\treq,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgGCCreateTeamResponse),\n\t\tresp,\n\t)\n}", "title": "" }, { "docid": "6806f6920aae7feafe82d074f1e5d3da", "score": "0.41453308", "text": "func CreateAdvances(e echo.Context) error {\n\tadvances := db.Advances{}\n\te.Bind(&advances)\n\n\tif err := config.DB.Save(&advances).Error; err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error())\n\t}\n\treturn e.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"message\": \"success menambahkan merks\",\n\t\t\"advances\": advances,\n\t})\n}", "title": "" }, { "docid": "d16f8358f784f4446c5c0b4b5a55e2f0", "score": "0.4140326", "text": "func addTeams(workSpace *[][]string, teams *[]Scenario, players *map[string]Player, ppt int) {\n /** up and down **/\n row := []Team{}\n col := []Team{}\n for i := 0; i < ppt; i++ {\n teamRow := []Player{}\n teamCol := []Player{}\n for j := 0; j < ppt; j++ {\n teamRow = append(teamRow, (*players)[(*workSpace)[i][j]])\n teamCol = append(teamCol, (*players)[(*workSpace)[j][i]])\n }\n // create team, add team to row\n row = append(row, newTeam(teamRow))\n col = append(col, newTeam(teamCol))\n }\n // add the team row to the teams matrix\n *teams = append(*teams, newScenario(row))\n *teams = append(*teams, newScenario(col))\n\n /** Diagonals **/\n for i := 1; i < ppt; i++ {\n diag := []Team{}\n diag2 := []Team{}\n for j := 0; j < ppt; j++ {\n x := 0\n y := j\n teamDiag := []Player{}\n teamDiag2 := []Player{}\n for k := 0; k < ppt; k++ {\n teamDiag = append(teamDiag, (*players)[(*workSpace)[x][y]])\n teamDiag2 = append(teamDiag2, (*players)[(*workSpace)[x][ppt - 1 - y]])\n x = (x + 1) % ppt\n y = (y + i) % ppt\n }\n // create team, add team to row\n diag = append(diag, newTeam(teamDiag))\n diag2 = append(diag2, newTeam(teamDiag2))\n }\n // add the team row to the teams matrix\n *teams = append(*teams, newScenario(diag))\n *teams = append(*teams, newScenario(diag2))\n }\n}", "title": "" }, { "docid": "a62317a625b21ec2f49a398bb962bf0a", "score": "0.4139837", "text": "func createMatch(player ols.Player, game goriot.Game) {\n\tmatch, err := goriot.MatchByMatchID(\"na\", true, game.GameID)\n\tparticipants := map[int]*ols.Participant{} // championid -> participant\n\tparticipants[game.ChampionID] = &ols.Participant{Id: player.Id}\n\tif err != nil {\n\t\tlog.Println(\"Match with id: \", game.GameID, \" had an error:\", err.Error())\n\t\treturn\n\t}\n\n\t// Connect participants of an anonymous game to one of a recent game...\n\tfor _, fellowPlayer := range game.FellowPlayers {\n\t\tparticipants[fellowPlayer.ChampionID] = &ols.Participant{Id: fellowPlayer.SummonerID}\n\t}\n\n\t// All info is connected now!\n\tfor _, matchPlayer := range match.Participants {\n\t\tparticipant := participants[matchPlayer.ChampionID]\n\t\tparticipant.ParticipantId = matchPlayer.ParticipantID\n\t}\n\n\tvar matchParticipants []ols.Participant\n\tfor _, participant := range participants {\n\t\tmatchParticipants = append(matchParticipants, *participant)\n\t}\n\t///////////////////////\n\tblueTeam := getTeamName(game, BLUE_TEAM)\n\tredTeam := getTeamName(game, RED_TEAM)\n\twinnerTeam := blueTeam\n\n\tif game.Statistics.Win && game.TeamID == RED_TEAM {\n\t\twinnerTeam = redTeam\n\t}\n\tweek := ols.GetMatchesDAO().LoadWeekForMatch(blueTeam, redTeam)\n\tolsMatch := ols.Match{\n\t\tParticipants: matchParticipants,\n\t\tBlueTeam: blueTeam,\n\t\tRedTeam: redTeam,\n\t\tPlayed: true,\n\t\tWeek: week,\n\t\tWinner: winnerTeam,\n\t\tId: game.GameID,\n\t}\n\tlog.Println(\"Match found! \", olsMatch)\n\tols.GetMatchesDAO().Save(olsMatch)\n}", "title": "" }, { "docid": "b29481f98012854b58b47178a1215959", "score": "0.41312742", "text": "func CreateReview(c echo.Context) error {\n\t// Get user token authenticate\n\tuser := c.Get(\"user\").(*jwt.Token)\n\tclaims := user.Claims.(*utilities.Claim)\n\tcurrentUser := claims.User\n\n\t// Get data request\n\trequest := reviewRequest{}\n\tif err := c.Bind(&request); err != nil {\n\t\treturn err\n\t}\n\trequest.Review.CreatorID = currentUser.ID\n\n\t// get connection\n\tDB := provider.GetConnection()\n\tdefer DB.Close()\n\n\t// Query student program\n\tstudentProgram := models.StudentProgram{}\n\tif err := DB.First(&studentProgram, models.StudentProgram{StudentID: request.StudentID, ProgramID: request.ProgramID}).Error; err != nil {\n\t\treturn c.JSON(http.StatusOK, utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t}\n\n\t// Validate\n\trvw := make([]models.Review, 0)\n\tif DB.Where(\"student_program_id = ? and module_id = ?\", studentProgram.ID, request.Review.ModuleId).\n\t\tFind(&rvw).RowsAffected >= 1 {\n\t\treturn c.JSON(http.StatusOK, utilities.Response{\n\t\t\tMessage: \"Este alumno ya tiene una revision con este modulo\",\n\t\t})\n\t}\n\n\t// Set StudentProgramID\n\trequest.Review.StudentProgramID = studentProgram.ID\n\n\t// start transaction\n\tTX := DB.Begin()\n\n\t// Insert reviews in database\n\tif err := TX.Create(&request.Review).Error; err != nil {\n\t\tTX.Rollback()\n\t\treturn c.JSON(http.StatusOK, utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t}\n\n\t// Insert History student\n\tstudentHistory := models.StudentHistory{\n\t\tStudentID: request.StudentID,\n\t\tUserID: currentUser.ID,\n\t\tDescription: fmt.Sprintf(\"Revisón de prácticas del modulo %d\", request.Review.ModuleId),\n\t\tDate: time.Now(),\n\t\tType: 1,\n\t}\n\tif err := TX.Create(&studentHistory).Error; err != nil {\n\t\tTX.Rollback()\n\t\treturn c.JSON(http.StatusOK, utilities.Response{Message: fmt.Sprintf(\"%s\", err)})\n\t}\n\n\t// Commit transaction\n\tTX.Commit()\n\n\t// Return response\n\treturn c.JSON(http.StatusCreated, utilities.Response{\n\t\tSuccess: true,\n\t\tData: request.Review.ID,\n\t\tMessage: fmt.Sprintf(\"El revision del modulo se registro correctamente\"),\n\t})\n}", "title": "" }, { "docid": "3141aa4e5b9714f33f9b2408f2d05763", "score": "0.41255757", "text": "func CreateCoach(c *gin.Context) {\n\tvar coachTmp coach.Coach\n\tif err := c.ShouldBindJSON(&coachTmp); err != nil {\n\t\thandleErr(err, c)\n\t\treturn\n\t}\n\tif err := saveCoach(&coachTmp); err != nil {\n\t\thandleErr(err, c)\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"status\": \"success\",\n\t})\n}", "title": "" }, { "docid": "72c8f64b2ded878b3d112c5ef5fda05d", "score": "0.41253752", "text": "func (a *ApiApiService) CreateCase(ctx _context.Context) ApiCreateCaseRequest {\n\treturn ApiCreateCaseRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "c3d72e7b1c3230c09d98b276255a80e8", "score": "0.4118606", "text": "func CreateDepartmentFixtures() {\n for _, entity := range DepartmentFixtures {\n DB().Create(&entity)\n }\n}", "title": "" }, { "docid": "35fe304256e41990a6ba752123174084", "score": "0.41029915", "text": "func (turnController TurnController) Create(context *gin.Context) {\r\n\t// Validate input\r\n\tvar turn models.Turn\r\n\tif err := context.ShouldBindJSON(&turn); err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\t// Create turn\r\n\tturn.TurnID = 0\r\n\ttmpGameID, err := strconv.Atoi(context.Param(\"game_id\"))\r\n\tif err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tturn.GameID = uint(tmpGameID)\r\n\tif err := turnController.Database.Create(&turn).Error; err != nil {\r\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\r\n\t\treturn\r\n\t}\r\n\tcontext.JSON(http.StatusCreated, turn)\r\n}", "title": "" }, { "docid": "ecee97eb199c244515ffc7ea58bd6203", "score": "0.4099702", "text": "func (c *Client) TeamsPost(falcopayload types.FalcoPayload) {\n\terr := c.Post(newTeamsPayload(falcopayload, c.Config))\n\tif err != nil {\n\t\tc.Stats.Teams.Add(Error, 1)\n\t\tc.PromStats.Outputs.With(map[string]string{\"destination\": \"teams\", \"status\": Error}).Inc()\n\t} else {\n\t\tc.Stats.Teams.Add(OK, 1)\n\t\tc.PromStats.Outputs.With(map[string]string{\"destination\": \"teams\", \"status\": OK}).Inc()\n\t}\n\n\tc.Stats.Teams.Add(Total, 1)\n}", "title": "" }, { "docid": "646be51d979ce2e19de2c5c065494a88", "score": "0.40951806", "text": "func addTournament(db *gorm.DB, t addTournamentRequest) error {\n\treturn db.Create(&database.Tournament{\n\t\tName: t.Name,\n\t\tTableCount: t.TableCount,\n\t\tState: int(core.New),\n\t}).Error\n}", "title": "" }, { "docid": "e2761445930a3a12825a3f007ee4ee66", "score": "0.40895998", "text": "func createDB() {\n\t// Init the db\n\t// The challengeadmin user is created as the first admin (admin function isn't implemented yet)\n\t// Password is hard-coded for this exercise\n\tvar username string\n\tdb, _ := sql.Open(\"sqlite3\", dbName)\n\tdefer db.Close()\n\t// Check/create user table\n\tstatement, _ := db.Prepare(\"create table if not exists user (username text primary key, password text, other text, admin int)\")\n\t_, err := statement.Exec()\n\tif err != nil {\n\t\tlog.Fatal(\"Database table creation error \" + err.Error())\n\t\treturn\n\t}\n\terr = db.QueryRow(`select username from user where username = \"challengeadmin\"`).Scan(&username)\n\tif (err == sql.ErrNoRows) {\n\t\tstatement, _ = db.Prepare(\"insert into user (username, password, other, admin) values (?,?,?,?)\")\n\t\t_, err = statement.Exec(\"challengeadmin\", encryptPasswd(\"challengepass\"), `{\"other\":{\"email\":\"myemail@myemail.com\"}}`, 1)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Database insert error \" + err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\t// Create token table\n\tstatement, _ = db.Prepare(\"create table if not exists token (token text primary key, username text, valid int)\")\n\t_, err = statement.Exec()\n\tif err != nil {\n\t\tlog.Fatal(\"Database table creation error \" + err.Error())\n\t\treturn\n\t}\n\tlog.Println(\"Database created\")\n}", "title": "" }, { "docid": "32312888244487139cfca8c58728096d", "score": "0.40861526", "text": "func (s *grpcServer) BulkCreateQuestion(ctx context.Context, req *pb.BulkCreateQuestionRequest) (*pb.BulkCreateQuestionResponse, error) {\n\t_, rep, err := s.bulkCreateQuestion.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rep.(*pb.BulkCreateQuestionResponse), nil\n}", "title": "" }, { "docid": "21c6e9ceb6169fd7559ba4974fcd298f", "score": "0.40818918", "text": "func Create(s qst.SurveyT) (*qst.QuestionnaireT, error) {\n\n\tctr.Reset()\n\n\tq := qst.QuestionnaireT{}\n\tq.Survey = qst.NewSurvey(\"pat2\")\n\tq.Survey = s\n\tq.LangCodes = []string{\"de\"} // governs default language code\n\n\tq.Survey.Org = trl.S{\"de\": \"ZEW\"}\n\tq.Survey.Name = trl.S{\"de\": \"Entscheidungsprozesse in der Politik\"}\n\n\tq.VersionMax = 16\n\tq.AssignVersion = \"round-robin\"\n\n\tq.ShufflingVariations = 8 // for party affiliation and \"Entscheidung 7/8\"\n\tq.PostponeNavigationButtons = 6\n\n\tvar err error\n\n\terr = TitlePat23(&q)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding title pat2 page: %v\", err)\n\t}\n\n\terr = pat.PersonalQuestions2(&q, pat.VariableElements{NumberingQuestions: 1, AllMandatory: true, NonGermansOut: true})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding personal questions 2: %v\", err)\n\t}\n\n\terr = pat.PersonalQuestions1(&q, pat.VariableElements{NumberingQuestions: 14, AllMandatory: true, ZumSchlussOrNunOrNothing: 3})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding personal questions 1: %v\", err)\n\t}\n\n\terr = Part1Intro(&q)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part1Intro(): %v\", err)\n\t}\n\n\t// core\n\terr = pat.Part1Entscheidung1bis6(&q, pat.VariableElements{AllMandatory: true, ComprehensionCheck1: true})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part1(): %v\", err)\n\t}\n\n\t// core\n\terr = pat.Part1Frage1(&q, pat.VariableElements{NumberingQuestions: 0, AllMandatory: true})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part1Frage1(): %v\", err)\n\t}\n\n\terr = Part2IntroA(&q)\n\terr = Part2IntroBUndEntscheidung78(&q)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part1Entscheidung78(): %v\", err)\n\t}\n\n\terr = Part3Intro(&q)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part2Intro(): %v\", err)\n\t}\n\n\terr = Part3Block12(&q, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part2Block1(0): %v\", err)\n\t}\n\n\terr = Part3Block12(&q, 3)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding Part2Block1(3): %v\", err)\n\t}\n\n\terr = pat.End(&q, pat.VariableElements{Pop2FinishParagraph: true})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error adding core pages: %v\", err)\n\t}\n\n\tq.AddFinishButtonNextToLast()\n\n\tq.VersionEffective = -2 // must be re-set at the end - after validate\n\n\tq.Hyphenize()\n\tq.ComputeMaxGroups()\n\tq.SetColspans()\n\n\tif err := q.TranslationCompleteness(); err != nil {\n\t\treturn &q, err\n\t}\n\tif err := q.Validate(); err != nil {\n\t\treturn &q, err\n\t}\n\n\tq.VersionEffective = -2 // re-set after validate\n\n\treturn &q, nil\n\n}", "title": "" }, { "docid": "304e2a8ee47592b80adb5316306890ae", "score": "0.40813845", "text": "func (c *chaosExperimentService) ProcessExperimentCreation(ctx context.Context, input *model.ChaosExperimentRequest, username string, projectID string, wfType *dbChaosExperiment.ChaosExperimentType, revisionID string, r *store.StateData) error {\n\tvar (\n\t\tweightages []*dbChaosExperiment.WeightagesInput\n\t\trevision []dbChaosExperiment.ExperimentRevision\n\t)\n\n\tprobes, err := probe.ParseProbesFromManifest(wfType, input.ExperimentManifest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif input.Weightages != nil {\n\t\t//TODO: Once we make the new chaos terminology change in APIs, then we can we the copier instead of for loop\n\t\tfor _, v := range input.Weightages {\n\t\t\tweightages = append(weightages, &dbChaosExperiment.WeightagesInput{\n\t\t\t\tFaultName: v.FaultName,\n\t\t\t\tWeightage: v.Weightage,\n\t\t\t})\n\t\t}\n\t}\n\n\ttimeNow := time.Now().UnixMilli()\n\n\trevision = append(revision, dbChaosExperiment.ExperimentRevision{\n\t\tRevisionID: revisionID,\n\t\tExperimentManifest: input.ExperimentManifest,\n\t\tUpdatedAt: timeNow,\n\t\tWeightages: weightages,\n\t\tProbes: probes,\n\t})\n\n\tnewChaosExperiment := dbChaosExperiment.ChaosExperimentRequest{\n\t\tExperimentID: *input.ExperimentID,\n\t\tCronSyntax: input.CronSyntax,\n\t\tExperimentType: *wfType,\n\t\tIsCustomExperiment: input.IsCustomExperiment,\n\t\tInfraID: input.InfraID,\n\t\tResourceDetails: mongodb.ResourceDetails{\n\t\t\tName: input.ExperimentName,\n\t\t\tDescription: input.ExperimentDescription,\n\t\t\tTags: input.Tags,\n\t\t},\n\t\tProjectID: projectID,\n\t\tAudit: mongodb.Audit{\n\t\t\tCreatedAt: timeNow,\n\t\t\tUpdatedAt: timeNow,\n\t\t\tIsRemoved: false,\n\t\t\tCreatedBy: username,\n\t\t\tUpdatedBy: username,\n\t\t},\n\t\tRevision: revision,\n\t\tRecentExperimentRunDetails: []dbChaosExperiment.ExperimentRunDetail{},\n\t}\n\n\terr = c.chaosExperimentOperator.InsertChaosExperiment(ctx, newChaosExperiment)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif r != nil {\n\t\tchaos_infrastructure.SendExperimentToSubscriber(projectID, input, &username, nil, \"create\", r)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "423067c5d00ec9235db6c4d89af11b9c", "score": "0.40795866", "text": "func CreatePlayersTable() {\n\t// Assumes a pg database exists named go-gameday, a role that can access it.\n\tdb, err := sql.Open(\"postgres\", \"user=go-gameday dbname=go-gameday sslmode=disable\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\tlog.Println(\"Creating players table\")\n\tdb.Exec(\"DROP INDEX IF EXISTS players_id\")\n\tdb.Exec(\"DROP TABLE IF EXISTS players\")\n\tdb.Exec(`CREATE TABLE players (playerid SERIAL PRIMARY KEY, year int, id int, first varchar(40), last varchar(40), num int,\n\t\tboxname varchar(40), rl varchar(1), bats varchar(1), position varchar(2), current_position varchar(2), status\n\t\tvarchar(1), team_abbrev varchar(3), team_id int, parent_team_abbrev varchar(3), parent_team_id int, bat_order int,\n\t\tgame_position varchar(2), avg DECIMAL(4, 3), hr int, rbi int, wins int, losses int, era DECIMAL(5, 2))`)\n\tlog.Println(\"Creating players index\")\n\tdb.Exec(\"CREATE UNIQUE INDEX players_year_id_team_abbrev ON players (year, id, team_abbrev)\")\n\tlog.Println(\"Done with players\")\n}", "title": "" }, { "docid": "6b876419fa744f4954fb4f7ade4c8c7a", "score": "0.40774778", "text": "func createCorpus() {\n\tgames := 0\n\n\tfor solved := 0; solved < 1000000; {\n\t\tgame := magnets.New(rand.Intn(15)+2, rand.Intn(15)+2)\n\t\tgames++\n\n\t\tsolver.Solve(game)\n\n\t\tserial, ok := game.Serialize()\n\t\tif !ok {\n\t\t\tfmt.Println(\"Could not serialize game\")\n\t\t\tgame.Print()\n\t\t\treturn\n\t\t}\n\n\t\tif game.Solved() {\n\t\t\tsolved++\n\t\t\tappend(\"solved\", serial)\n\t\t} else {\n\t\t\tappend(\"unsolved\", serial)\n\t\t}\n\n\t\tif games%10000 == 0 {\n\t\t\tpctSolved := 100.0 * float64(solved) / float64(games)\n\t\t\tfmt.Printf(\"Played: %d Solved: %d (%.3f%%)\\n\", games, solved, pctSolved)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c96dfd6384187cd8d2c48e5506e2e7f", "score": "0.40658116", "text": "func (c *Client) CreateTeam(team Team) (Team, error) {\n\terr := c.create(\"/teams\", &team)\n\treturn team, err\n}", "title": "" }, { "docid": "ab5aaa4efbdd39524de74027893a6404", "score": "0.40536225", "text": "func (g *GameManager) CreateGame(difficulty int, questionCt int, userId int) (*game.Game, error) {\n\t// Create game instance\n\tnewGame := game.Init()\n\tnewGame.GameDifficulty = difficulty\n\tnewGame.QuestionCt = questionCt\n\tnewGame.QuestionDeck = newGame.BuildQuestionDeck()\n\t// Start open the websocket to connect to the game\n\tnewGame.InitGameSocket()\n\n\tif len(newGame.QuestionDeck) > 0 {\n\t\tnewGame.CurrentQuestion = newGame.QuestionDeck[0]\n\t}\n\n\t// Find the user in the db, then add the user to the game\n\tusr, err := repo.FindUser(userId)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Add the new user to the game\n\tif err := newGame.AddUserToGame(usr); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Set the game host to the creator\n\tnewGame.Host = usr.Username\n\n\t// Add game to list of games\n\tg.Games = append(g.Games, newGame)\n\t// Return the games Id, and error if it exists\n\treturn newGame, nil\n}", "title": "" }, { "docid": "d613e60759a12f3102f2e710ee9d0edc", "score": "0.40483737", "text": "func CreateMany(list []Issue) error {\n\t//Map struct slice to interface slice as InsertMany accepts interface slice as parameter\n\tinsertableList := make([]interface{}, len(list))\n\tfor i, v := range list {\n\t\tinsertableList[i] = v\n\t}\n\t//Get MongoDB connection using connectionhelper.\n\tclient, err := connectionhelper.GetMongoClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t//Create a handle to the respective collection in the database.\n\tcollection := client.Database(connectionhelper.DB).Collection(connectionhelper.ISSUES)\n\t//Perform InsertMany operation & validate against the error.\n\t_, err = collection.InsertMany(context.TODO(), insertableList)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//Return success without any error.\n\treturn nil\n}", "title": "" }, { "docid": "3e5eacf05ceaf20193178674c2bb15c8", "score": "0.40454116", "text": "func createGameHandler(w http.ResponseWriter, req *http.Request, ss *ServerState) {\n\tgameRunner, gameErr := ss.tm.CreateGame(req.FormValue(\"player1\"), req.FormValue(\"player2\"))\n\n\tif gameErr != \"\" {\n\t\trenderErrorJSON(w, gameErr, 422)\n\t\treturn\n\t}\n\n\tjson, err := json.Marshal(gameStatus(gameRunner))\n\trenderJSON(w, json, err)\n}", "title": "" }, { "docid": "980819f55215706af5b98990e256f7b4", "score": "0.40302873", "text": "func createGroupChat(w http.ResponseWriter, r *http.Request) {\n\tcurrentUser, success := doSession(w, r)\n\tif !success {\n\t\treturn\n\t}\n\tif len(currentUser.Username) == 0 {\n\t\thttp.Redirect(w, r, \"/login\", 301)\n\t\treturn\n\t}\n\n\tvar users []int\n\tfor i := 1; i <= 10; i++ {\n\t\tusername := r.FormValue(\"user\" + strconv.Itoa(i))\n\t\tif len(username) > 0 {\n\t\t\tvar id int\n\t\t\tvar group_permissions int\n\t\t\tdb.QueryRow(\"SELECT id, group_permissions FROM users WHERE username = ?\", username).Scan(&id, &group_permissions)\n\t\t\tif id == 0 {\n\t\t\t\thttp.Error(w, \"The user \"+username+\" does not exist.\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif group_permissions == 1 {\n\t\t\t\tvar followCount int\n\t\t\t\tdb.QueryRow(\"SELECT COUNT(*) FROM follows WHERE follow_to = ? AND follow_by = ?\", currentUser.ID, id).Scan(&followCount)\n\t\t\t\tif followCount == 0 {\n\t\t\t\t\thttp.Error(w, \"The user \"+username+\" does not allow you to add them to chat groups.\", http.StatusBadRequest)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar friendCount int\n\t\t\tdb.QueryRow(\"SELECT COUNT(*) FROM friendships WHERE (source = ? AND target = ?) OR (source = ? AND target = ?)\", id, currentUser.ID, currentUser.ID, id).Scan(&friendCount)\n\t\t\tif friendCount == 0 {\n\t\t\t\thttp.Error(w, \"The user \"+username+\" is not on your friend list.\", http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tusers = append(users, id)\n\t\t}\n\t}\n\tusers = append(users, currentUser.ID)\n\n\tstmt, err := db.Prepare(\"INSERT INTO conversations (source, target) VALUES (?, 0)\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tstmt.Exec(&currentUser.ID)\n\tvar conversationID int\n\tdb.QueryRow(\"SELECT id FROM conversations WHERE source = ? AND target = 0 ORDER BY id DESC\", currentUser.ID).Scan(&conversationID)\n\tfor _, user := range users {\n\t\tstmt, err = db.Prepare(\"INSERT INTO group_members (user, conversation) VALUES (?, ?)\")\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tstmt.Exec(&user, &conversationID)\n\t}\n\n\thttp.Redirect(w, r, \"/conversations/\"+strconv.Itoa(conversationID), 301)\n}", "title": "" }, { "docid": "124262777b3c74fceb014e76dfd4c66d", "score": "0.40261564", "text": "func CreateQuiz(c *gin.Context) {\n\tvar quiz Quiz\n\tc.BindJSON(&quiz)\n\n\tdb.Create(&quiz)\n\n\tc.JSON(http.StatusOK, quiz)\n}", "title": "" }, { "docid": "7152348a44ef29aa253dd5f5d37b36db", "score": "0.40100065", "text": "func ProjectUserCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlUser := urlVars[\"user\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefUserUUID := gorillaContext.Get(r, \"auth_user_uuid\").(string)\n\trefProjUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Read POST JSON body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terr := APIErrorInvalidRequestBody()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Parse pull options\n\tpostBody, err := auth.GetUserFromJSON(body)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"User\")\n\t\trespondErr(w, err)\n\t\tlog.Error(string(body[:]))\n\t\treturn\n\t}\n\n\t// omit service wide roles\n\tpostBody.ServiceRoles = []string{}\n\n\t// allow the user to be created to only have reference to the project under which is being created\n\tprName := projects.GetNameByUUID(refProjUUID, refStr)\n\tif prName == \"\" {\n\t\terr := APIErrGenericInternal(\"Internal Error\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tprojectRoles := auth.ProjectRoles{}\n\n\tfor _, p := range postBody.Projects {\n\t\tif p.Project == prName {\n\t\t\tprojectRoles.Project = prName\n\t\t\tprojectRoles.Roles = p.Roles\n\t\t\tprojectRoles.Topics = p.Topics\n\t\t\tprojectRoles.Subs = p.Subs\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// if the project was not mentioned in the creation, add it\n\tif projectRoles.Project == \"\" {\n\t\tprojectRoles.Project = prName\n\t}\n\n\tpostBody.Projects = []auth.ProjectRoles{projectRoles}\n\n\tuuid := uuid.NewV4().String() // generate a new uuid to attach to the new project\n\ttoken, err := auth.GenToken() // generate a new user token\n\tcreated := time.Now().UTC()\n\n\t// Get Result Object\n\tres, err := auth.CreateUser(uuid, urlUser, \"\", \"\", \"\", \"\", postBody.Projects, token, postBody.Email, postBody.ServiceRoles, created, refUserUUID, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"User\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tif strings.HasPrefix(err.Error(), \"invalid\") {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tif strings.HasPrefix(err.Error(), \"duplicate\") {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n}", "title": "" }, { "docid": "35d3496ff6fba872d772afe0c3c55582", "score": "0.4008471", "text": "func (endpoint *Endpoint) CreateCase(ctx context.Context, data map[string]string, fields string) (*CreateCase, error) {\n\t// Prepare the URL\n\tvar reqURL *url.URL\n\treqURL, err := url.Parse(endpoint.client.BaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while parsing the URL : %s\", err)\n\t}\n\treqURL.Path += \"/forensics/case_management/cases\"\n\n\t// Create the data\n\td, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while marshalling the values : %s\", err)\n\t}\n\n\t// Create the request\n\treq, err := http.NewRequest(\"POST\", reqURL.String(), bytes.NewBuffer(d))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while creating the request : %s\", err)\n\t}\n\n\t// Set HTTP headers\n\treq.Header.Set(\"SEC\", endpoint.client.Token)\n\treq.Header.Set(\"Version\", endpoint.client.Version)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif fields != \"\" {\n\t\treq.Header.Set(\"fields\", fields)\n\t}\n\n\t// Do the request\n\tresp, err := endpoint.client.client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while doing the request : %s\", err)\n\t}\n\n\t// Read the respsonse\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while reading the request : %s\", err)\n\t}\n\n\t// Prepare the response\n\tvar response *CreateCase\n\n\t// Unmarshal the response\n\terr = json.Unmarshal([]byte(body), &response)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while unmarshalling the response : %s. HTTP response is : %s\", err, string(body))\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "19650beba39c74282db9ac4280a057c9", "score": "0.3991498", "text": "func (QAService) CreateQuestion(ctx context.Context, qa1 qa_db.QA) (qa_db.QA, error) {\n qa2, err := qa_db.CreateQA(qa1)\n if err != nil {\n return qa2, err\n } else {\n return qa2, nil\n }\n}", "title": "" }, { "docid": "44017027bdbb20606b1a9e868c78d163", "score": "0.39892876", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tvar person Person\n\tfmt.Println(\"Body:\", r.Body)\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tfmt.Println(\"parmeter\", person)\n\n\tif queuelist <= 5000 {\n\t\tfmt.Println(queuelist)\n\t\tqueuelist += 1\n\t\tperson.Queue = queuelist\n\t\t//q := len(people)\n\t\tqueue -= 1\n\n\t\tc := rand.Intn(1000)\n\t\ttime.Sleep(time.Duration(c) * time.Millisecond)\n\t\tpeople = append(people, person)\n\t\tjson.NewEncoder(w).Encode((person.Queue))\n\t} else {\n\t\tjson.NewEncoder(w).Encode(\"full\")\n\t}\n}", "title": "" }, { "docid": "b3b8a46e21b210ff7c6cc26c383684d9", "score": "0.39869127", "text": "func (ssc *StorageSmartContract) createChallengePool(t *transaction.Transaction,\n\talloc *StorageAllocation, balances cstate.StateContextI) (err error) {\n\n\t// create related challenge_pool expires with the allocation + challenge\n\t// completion time\n\tvar cp *challengePool\n\tcp, err = ssc.newChallengePool(alloc.ID, t.CreationDate, alloc.Until(),\n\t\tbalances)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create challenge pool: %v\", err)\n\t}\n\n\t// don't lock anything here\n\n\t// save the challenge pool\n\tif err = cp.save(ssc.ID, alloc.ID, balances); err != nil {\n\t\treturn fmt.Errorf(\"can't save challenge pool: %v\", err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "da486a31df053c3d900f32c3ec1db622", "score": "0.3986694", "text": "func (driver *Driver) CreateGame(teamSize int) error {\n\tdefer fmt.Printf(\"Created a game with two %d players teams.\\n\", teamSize)\n\tnewGameUUID, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewGame := &models.Game{\n\t\tID: newGameUUID.String(),\n\t\tTeamSize: teamSize,\n\t}\n\n\tblueTeam, err := driver.createTeam(teamSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\tredTeam, err := driver.createTeam(teamSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewGame.BlueTeam = *blueTeam\n\tnewGame.RedTeam = *redTeam\n\n\tdriver.Game = newGame\n\n\treturn nil\n}", "title": "" }, { "docid": "bd1aa53397da9b61bcf60870c01c43fa", "score": "0.39842322", "text": "func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {\n\n\t// Ignore all messages created by the bot itself\n\t// This isn't required in this specific example but it's a good practice.\n\tif m.Author.ID == s.State.User.ID {\n\t\treturn\n\t}\n\n\t// Delimiter of !ranked to lookup player statistics and return the data into the Discord server\n\tif strings.Contains(m.Content, \"!ranked \") {\n\t\tparts := strings.Split(m.Content, \"!ranked \")\n\t\tfmt.Println(parts[1])\n\n\t\trankedStats := gjson.Get(getPlayer(parts[1]), \"0\").String()\n\n\t\tif rankedStats != \"\" {\n\t\t\taccountLvl := gjson.Get(getPlayer(parts[1]), \"0.Level\").String()\n\t\t\thoursPlayed := gjson.Get(getPlayer(parts[1]), \"0.HoursPlayed\").String()\n\t\t\twins := gjson.Get(getPlayer(parts[1]), \"0.RankedConquest.Wins\").String()\n\t\t\tlosses := gjson.Get(getPlayer(parts[1]), \"0.RankedConquest.Losses\").String()\n\t\t\tmmr := gjson.Get(getPlayer(parts[1]), \"0.RankedConquest.Rank_Stat\").String()\n\t\t\trank := createRank(gjson.Get(getPlayer(parts[1]), \"0.RankedConquest.Tier\").String())\n\n\t\t\ts.ChannelMessageSend(m.ChannelID, parts[1]+\": Account Level \"+accountLvl+\" / \"+\"Hours Played \"+hoursPlayed)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\ts.ChannelMessageSend(m.ChannelID, parts[1]+\": Wins \"+wins+\" / \"+\"Losses \"+losses)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\ts.ChannelMessageSend(m.ChannelID, parts[1]+\": Rank \"+rank+\" / \"+\"MMR \"+mmr)\n\n\t\t} else {\n\t\t\ts.ChannelMessageSend(m.ChannelID, parts[1]+\": Error on lookup / hidden profile\")\n\t\t}\n\n\t\t//s.ChannelMessageSend(m.ChannelID, userInfo)\n\t}\n\n\t// Delimiter of !playerStatus to determine if the player is in a match or not\n\tif strings.Contains(m.Content, \"!playerStatus \") {\n\t\tparts := strings.Split(m.Content, \"!playerStatus \")\n\t\tfmt.Println(parts[1])\n\n\t\tuserInfo := getPlayerStatus(parts[1])\n\n\t\tstatusString := gjson.Get(userInfo, \"0.status_string\").String()\n\t\tmatchQueueID := gjson.Get(userInfo, \"0.match_queue_id\").String()\n\n\t\ts.ChannelMessageSend(m.ChannelID, parts[1]+\": Status \"+statusString+\" / \"+\"Match Queue ID \"+matchQueueID)\n\t}\n\n\t// Delimiter of !playerID which returns the requested players ID\n\tif strings.Contains(m.Content, \"!playerID \") {\n\t\tparts := strings.Split(m.Content, \"!playerID \")\n\t\tfmt.Println(parts[1])\n\n\t\tuserInfo := getPlayerIDName(parts[1])\n\t\ts.ChannelMessageSend(m.ChannelID, userInfo)\n\t}\n\n}", "title": "" }, { "docid": "601bb1c0f77f522643e9e6376e60dce2", "score": "0.3979472", "text": "func CreatePlayers(n uint) []pig.Player {\n\tplayers := make([]pig.Player, 0, n)\n\tfor i := 0; i < int(n); i++ {\n\t\tp := pig.NewPlayer(strconv.Itoa(i), pig.StayAtK(uint(i+1)))\n\t\tplayers = append(players, p)\n\t}\n\treturn players\n}", "title": "" }, { "docid": "d0cc8828d090816083a06af837966538", "score": "0.39793357", "text": "func CreateGroup(w http.ResponseWriter, r *http.Request) {\n\n\tdata := &GroupRequest{}\n\tif err := render.Bind(r, data); err != nil {\n\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\tg, err := NewGroup(*data)\n\tif err != nil {\n\t\trender.Render(w, r, ErrNotFound(err))\n\t\treturn\n\t}\n\n\tms, err := NewMasterSchedule(data.Schedule, primitive.NilObjectID)\n\tif err != nil {\n\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\treturn\n\t}\n\n\t// get users already in system\n\texistingUsers := make([]*User, 0)\n\tnewUsers := make([]*User, 0)\n\trr := RegisterRequest{\"\", \"\", \"\", \"mehpwd\", primitive.NilObjectID} //TODO randomize\n\tfor _, addr := range data.MemberEmails {\n\t\t// TODO: verify email\n\t\trr.Email = addr\n\t\tu, err := NewUser(rr)\n\t\tif err != nil {\n\t\t\tif u != nil {\n\t\t\t\t// user exists\n\t\t\t\texistingUsers = append(existingUsers, u)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t// user not in system, so we create\n\t\tnewUsers = append(newUsers, u)\n\t}\n\n\tresult, err := mh.InsertGroup(g, ms, newUsers, existingUsers)\n\tif err != nil {\n\t\trender.Render(w, r, ErrServer(err))\n\t\treturn\n\t}\n\n\tgroup := &Group{}\n\tmh.GetGroup(group, bson.M{\"_id\": result})\n\n\t// send out invites\n\tfor _, u := range existingUsers {\n\t\tgo jdchaimailer.SendGroupInvite(group.Name, u.FirstName, u.Email)\n\t}\n\tfor _, u := range newUsers {\n\t\terr := mh.GetUser(u, bson.M{\"email\": u.Email})\n\t\tif err == nil {\n\t\t\tjwt := createTokenString(u.ID.Hex(), 30*24*time.Hour) // expires in 30 days for \"activate\"\n\t\t\tlink := clientBaseURL + \"register?token=\" + jwt + \"&group=\" + group.Name + \"&groupID=\" + group.ID.Hex()\n\t\t\tgo jdchaimailer.SendWelcomRegistration(group.Name, u.Email, link)\n\t\t}\n\t}\n\trender.Status(r, http.StatusCreated)\n\trender.Render(w, r, NewGroupResponse(*group))\n}", "title": "" }, { "docid": "88497d39857bff402e5f2c63f528eeb4", "score": "0.3978088", "text": "func createRG(cmd *cobra.Command, args []string) {\n\n\tdefer resources.Cleanup(context.Background())\n\n\tlogFields := log.Fields{\n\t\t\"prefix\": prefix,\n\t\t\"count\": number,\n\t\t\"location\": location,\n\t}\n\tlog.WithFields(logFields).Debug(\n\t\t\"provision rg cmd called\",\n\t)\n\n\tfor index := 101; index <= number+100; index++ {\n\t\tdone := make(chan bool)\n\t\tgo func() {\n\t\t\ttags := map[string]*string{\n\t\t\t\t\"openhack\": to.StringPtr(\"devops\"),\n\t\t\t\t\"team\": to.StringPtr(strconv.Itoa(index)),\n\t\t\t}\n\t\t\t_, err := resources.CreateGroup(context.Background(), prefix+strconv.Itoa(index), location, tags)\n\t\t\tif err != nil {\n\t\t\t\thelpers.PrintAndLog(err.Error())\n\t\t\t}\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"name\": prefix + strconv.Itoa(index),\n\t\t\t\t\"number\": index - 100,\n\t\t\t\t\"location\": location,\n\t\t\t}).Debug(\"RG Created / Updated\")\n\t\t\tdone <- true\n\t\t}()\n\t\t<-done\n\t}\n}", "title": "" }, { "docid": "222c8c417a41cf105be59977ef251fae", "score": "0.39761794", "text": "func GetChallenges(s *db.Dispatch) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tss := s.MongoDB.Copy()\n\t\tdefer ss.Close()\n\n\t\tu := []model.BasicChallenge{}\n\t\tif err := ss.DB(\"gorest\").C(\"challenges\").Find(nil).All(&u); err != nil {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tuj, _ := json.Marshal(u)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, \"%s\", uj)\n\t}\n}", "title": "" }, { "docid": "38478db9c0b761d6b039bdf9cdbdcd86", "score": "0.39740103", "text": "func PopulateFaculty(p int) {\n\tif Tiukudb == nil {\n\t\tConnectToDB()\n\t}\n\ti := 0\n\tfor i < p {\n\t\ti = i + 1\n\t\t//if err := db.Table(schoolShortName + \"_StudentUsers\").Create(&StudentUser{\n\t\tif err := Tiukudb.Create(&FacultyUser{\n\t\t\tID: 0,\n\t\t\tFacultyID: \"ope\" + strconv.Itoa(i),\n\t\t\tFacultyName: \"opettaja\" + strconv.Itoa(i),\n\t\t\tFacultyEmail: \"opettaja\" + strconv.Itoa(i) + \"@oppilaitos.fi\",\n\t\t\tApartment: 1,\n\t\t\tActive: true,\n\t\t\tTeacher: true,\n\t\t\tAdmin: true,\n\t\t}).Error; err != nil {\n\t\t\tlog.Println(\"Problems populating table of StudentUsers. <database/populate.go->populateStudents>\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "51632874481235faf4c275d362319893", "score": "0.3966062", "text": "func (i *Issue) CreateIssue() {\n}", "title": "" }, { "docid": "fcec8ce7b56bbc15cd11c15cea5c18c6", "score": "0.3956155", "text": "func TeacherCreation(w http.ResponseWriter, r *http.Request) {\n\n\tbody, readErr := ioutil.ReadAll(r.Body)\n\tif readErr != nil {\n\t\tlog.Fatal(readErr)\n\t}\n\n\tparameter := string(body)\n\n\tteacherStruct := School.AddTeacher(parameter)\n\n\tw.Header().Set(\"Content-type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\n\tif err := json.NewEncoder(w).Encode(teacherStruct); err != nil {\n\t\tpanic(err)\n\t}\n\n}", "title": "" } ]
2ed71676adb1ab5d7e906f49711ccd76
RRreportInvoices generates a report of all rlib.GLAccount accounts
[ { "docid": "f5aca4c036f44526f0425a19ca3a1f78", "score": "0.67948735", "text": "func RRreportInvoices(ri *rrpt.ReporterInfo) string {\n\tvar t gotable.Table\n\tt.Init()\n\tt.SetTitle(rrpt.ReportHeaderBlock(\"Invoices\", \"RRreportInvoices\", ri))\n\tt.AddColumn(\"Date\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"InvoiceNo\", 12, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"BID\", 12, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"Due Date\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"Amount\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT)\n\tt.AddColumn(\"DeliveredBy\", 10, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\n\tm := rlib.GetAllInvoicesInRange(ri.Bid, &Rcsv.DtStart, &Rcsv.DtStop)\n\tfor i := 0; i < len(m); i++ {\n\t\tt.AddRow()\n\t\tt.Putd(-1, 0, m[i].Dt)\n\t\tt.Puts(-1, 1, m[i].IDtoString())\n\t\tt.Puts(-1, 2, rlib.IDtoString(\"B\", m[i].BID))\n\t\tt.Putd(-1, 3, m[i].DtDue)\n\t\tt.Putf(-1, 4, m[i].Amount)\n\t\tt.Puts(-1, 5, m[i].DeliveredBy)\n\t}\n\tt.TightenColumns()\n\treturn rrpt.ReportToString(&t, ri)\n}", "title": "" } ]
[ { "docid": "52fc6740d7ddfea541326b3165a6e852", "score": "0.55345505", "text": "func RRreportRentalAgreementTemplates(ri *ReporterInfo) string {\n\ttbl := RRreportRentalAgreementTemplatesTable(ri)\n\treturn ReportToString(&tbl, ri)\n}", "title": "" }, { "docid": "f8d10aab2dcb433f4f6ea07c1d67fccd", "score": "0.53843296", "text": "func (d Data) Accounts(fraudType string, startDate time.Time, endDate time.Time, FilterObjects ...FilterObject) (interface{}, error) {\n\n\tendpoint := d.BaseURL + fraudEndpointMap[fraudType] + `/data`\n\n\treturn sendRequest(d.AccountID, d.View, startDate.Format(\"2006-1-2\"), endDate.Format(\"2006-1-2\"), \"json\", fraudType, endpoint, d.APIKey, FilterObjects)\n\n}", "title": "" }, { "docid": "b35c622a703e6c07a7d0970a1e893c6f", "score": "0.52952564", "text": "func GenerateISRPrintReports() {\n\n\tschools, err := getSchoolsList()\n\tif err != nil {\n\t\tlog.Fatalln(\"Cannot connect to naprrql server: \", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runISRPrintReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating isr printing reports: \", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "7a1603800b16132f37451d03903485ee", "score": "0.5283019", "text": "func createIncrementalAccounts(accNum int) []sdk.AccAddress {\n\tvar addresses []sdk.AccAddress\n\tvar buffer bytes.Buffer\n\n\t// start at 100 so we can make up to 999 test addresses with valid test addresses\n\tfor i := 100; i < (accNum + 100); i++ {\n\t\tnumString := strconv.Itoa(i)\n\t\tbuffer.WriteString(\"A58856F0FD53BF058B4909A21AEC019107BA6\") //base address string\n\n\t\tbuffer.WriteString(numString) //adding on final two digits to make addresses unique\n\t\tres, _ := sdk.AccAddressFromHex(buffer.String())\n\t\tbech := res.String()\n\t\taddr, _ := TestAddr(buffer.String(), bech)\n\n\t\taddresses = append(addresses, addr)\n\t\tbuffer.Reset()\n\t}\n\n\treturn addresses\n}", "title": "" }, { "docid": "66f2038ec0e014416d4968baa79c432c", "score": "0.52618325", "text": "func (l List) Accounts(fraudType string, startDate time.Time, endDate time.Time, FilterObjects ...FilterObject) (interface{}, error) {\n\n\tendpoint := l.BaseURL + fraudEndpointMap[fraudType] + `/list/accounts`\n\n\treturn sendRequest(l.AccountID, l.View, startDate.Format(\"2006-1-2\"), endDate.Format(\"2006-1-2\"), \"json\", fraudType, endpoint, l.APIKey, FilterObjects)\n\n}", "title": "" }, { "docid": "ad52184af7be4461a33cadd0ddc7745e", "score": "0.5244529", "text": "func (s *SmartContract) addrLReport(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n \n\t recordID := args[0]\n\t report := args[1]\n\t links := args[2]\n\t addedby := args[3]\n \n\t RecordAsBytes, _ := APIstub.GetState(recordID)\n \n\t var record RecordStruct\n \n\t err := json.Unmarshal(RecordAsBytes, &record)\n\t if err != nil {\n\t\t return shim.Error(\"Issue with Record json unmarshaling\")\n\t }\n \n \n\t Record := RecordStruct{RecordID: record.RecordID,\n\t\t Name: record.Name,\n\t\t Dob: \t\t\trecord.Dob,\n\t\t Address: \t\t\t \trecord.Address,\n\t\t Report: report,\n\t\t Links:\t\t\t\t \tlinks,\n\t\t Prescription:\t\t\t\"\",\n\t\t AddedBy:\t\t\t\taddedby}\n\t\t \n \n\t RecordBytes, err := json.Marshal(Record)\n\t if err != nil {\n\t\t return shim.Error(\"Issue with Record json marshaling\")\n\t }\n \n\t APIstub.PutState(Record.RecordID, RecordBytes)\n\t fmt.Println(\"New Report has been added -> \", Record)\n \n\t return shim.Success(nil)\n }", "title": "" }, { "docid": "ab9f62ee8b3d5644dd3a528d60878f32", "score": "0.51913553", "text": "func RptLedger(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tRptLedgerHandler(w, r, xbiz, ui, 0)\n}", "title": "" }, { "docid": "ab9f62ee8b3d5644dd3a528d60878f32", "score": "0.51913553", "text": "func RptLedger(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tRptLedgerHandler(w, r, xbiz, ui, 0)\n}", "title": "" }, { "docid": "6b4b814b2871f30b98c5e84592c5ad6a", "score": "0.51380634", "text": "func RentRollReportTable(ri *ReporterInfo) gotable.Table {\n\tfuncname := \"RentRollReportTable\"\n\n\t// init and prepare some value before table init\n\tvar d1, d2 *time.Time\n\td1 = &ri.D1\n\td2 = &ri.D2\n\n\tcustom := \"Square Feet\"\n\tri.RptHeaderD1 = true\n\tri.RptHeaderD2 = true\n\tri.BlankLineAfterRptName = true\n\n\ttotalErrs := 0\n\n\t// table init\n\ttbl := getRRTable()\n\n\ttbl.AddColumn(\"Rentable\", 20, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // column for the Rentable name\n\ttbl.AddColumn(\"Rentable Type\", 15, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // RentableType name\n\ttbl.AddColumn(custom, 5, gotable.CELLINT, gotable.COLJUSTIFYRIGHT) // the Custom Attribute \"Square Feet\"\n\ttbl.AddColumn(\"Rentable Users\", 30, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // Users of this rentable\n\ttbl.AddColumn(\"Rentable Payors\", 30, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // Users of this rentable\n\ttbl.AddColumn(\"Rental Agreement\", 10, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // the Rental Agreement id\n\ttbl.AddColumn(\"Use Start\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the possession start date\n\ttbl.AddColumn(\"Use Stop\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the possession start date\n\ttbl.AddColumn(\"Rental Start\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the rental start date\n\ttbl.AddColumn(\"Rental Stop\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the rental start date\n\ttbl.AddColumn(\"Rental Agreement Start\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the possession start date\n\ttbl.AddColumn(\"Rental Agreement Stop\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT) // the possession start date\n\ttbl.AddColumn(\"Rent Cycle\", 12, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT) // the rent cycle\n\ttbl.AddColumn(\"GSR Rate\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // gross scheduled rent\n\ttbl.AddColumn(\"GSR This Period\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // gross scheduled rent\n\ttbl.AddColumn(IncomeOffsetGLAccountName, 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // GL Account\n\ttbl.AddColumn(\"Contract Rent\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // contract rent amounts\n\ttbl.AddColumn(OtherIncomeGLAccountName, 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // GL Account\n\ttbl.AddColumn(\"Payments Received\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // contract rent amounts\n\ttbl.AddColumn(\"Beginning Receivable\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\ttbl.AddColumn(\"Change In Receivable\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\ttbl.AddColumn(\"Ending Receivable\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\ttbl.AddColumn(\"Beginning Security Deposit\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\ttbl.AddColumn(\"Change In Security Deposit\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\ttbl.AddColumn(\"Ending Security Deposit\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT) // account for the associated RentalAgreement\n\n\t// set table title, sections\n\terr := TableReportHeaderBlock(&tbl, \"Rentroll\", funcname, ri)\n\tif err != nil {\n\t\trlib.LogAndPrintError(funcname, err)\n\t\treturn tbl\n\t}\n\n\tconst (\n\t\tRName = 0\n\t\tRType = iota\n\t\tRTSqFt = iota\n\t\tRUsers = iota\n\t\tRPayors = iota\n\t\tRAgr = iota\n\t\tUseStart = iota\n\t\tUseStop = iota\n\t\tRentStart = iota\n\t\tRentStop = iota\n\t\tRAgrStart = iota\n\t\tRAgrStop = iota\n\t\tRCycle = iota\n\t\tGSRRate = iota\n\t\tGSRAmt = iota\n\t\tIncOff = iota\n\t\tContractRent = iota\n\t\tOtherInc = iota\n\t\tPmtRcvd = iota\n\t\tBeginRcv = iota\n\t\tChgRcv = iota\n\t\tEndRcv = iota\n\t\tBeginSecDep = iota\n\t\tChgSecDep = iota\n\t\tEndSecDep = iota\n\t)\n\n\t// loop through the Rentables...\n\trows, err := rlib.RRdb.Prepstmt.GetAllRentablesByBusiness.Query(ri.Xbiz.P.BID)\n\trlib.Errcheck(err)\n\tif rlib.IsSQLNoResultsError(err) {\n\t\t// set errors in section3 and return\n\t\ttbl.SetSection3(NoRecordsFoundMsg)\n\t\treturn tbl\n\t}\n\tdefer rows.Close()\n\n\ttotalsRSet := tbl.CreateRowset() // a rowset to sum for totals\n\n\tfor rows.Next() {\n\t\tvar p rlib.Rentable\n\t\trlib.Errcheck(rlib.ReadRentables(rows, &p))\n\t\tp.RT = rlib.GetRentableTypeRefsByRange(p.RID, d1, d2) // its RentableType is time sensitive\n\t\tif len(p.RT) < 1 {\n\t\t\ttotalErrs++\n\t\t\trlib.Ulog(\"%s Error: rentable %s (%d) type could not be found during range %s - %s\\n\", funcname, p.RentableName, p.RID, d1.Format(rlib.RRDATEREPORTFMT), d2.Format(rlib.RRDATEREPORTFMT))\n\t\t\tcontinue\n\t\t}\n\t\trtid := p.RT[0].RTID // select its value at the beginning of this period\n\t\tsqft := int64(0) // assume no custom attribute\n\t\tvar usernames string // this will be the list of renters\n\t\tvar payornames string // this will be the list of Payors\n\t\tvar rentCycle string\n\n\t\tif len(ri.Xbiz.RT[rtid].CA) > 0 { // if there are custom attributes\n\t\t\tc, ok := ri.Xbiz.RT[rtid].CA[custom] // see if Square Feet is among them\n\t\t\tif ok { // if it is...\n\t\t\t\tsqft, _ = rlib.IntFromString(c.Value, \"invalid sqft of custom attribute\")\n\t\t\t}\n\t\t}\n\n\t\trentableTblRowStart := len(tbl.Row) // starting row for this rentable\n\n\t\t//------------------------------------------------------------------------------\n\t\t// Get the RentalAgreement IDs for this rentable over the time range d1,d2.\n\t\t// Note that this could result in multiple rental agreements.\n\t\t//------------------------------------------------------------------------------\n\t\trra := rlib.GetAgreementsForRentable(p.RID, d1, d2) // get all rental agreements for this period\n\t\tfor i := 0; i < len(rra); i++ { // for each rental agreement id\n\t\t\tra, err := rlib.GetRentalAgreement(rra[i].RAID) // load the agreement\n\t\t\tif err != nil {\n\t\t\t\ttotalErrs++\n\t\t\t\trlib.Ulog(\"Error loading rental agreement %d: err = %s\\n\", rra[i].RAID, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tna := p.GetUserNameList(&ra.PossessionStart, &ra.PossessionStop) // get the list of user names for this time period\n\t\t\tusernames = strings.Join(na, \",\") // concatenate with a comma separator\n\t\t\tpa := ra.GetPayorNameList(&ra.RentStart, &ra.RentStop) // get the payors for this time period\n\t\t\tpayornames = strings.Join(pa, \", \") // concatenate with comma\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Get the rent cycle. If there's an override in the RentableTypeRef, use the override. Otherwise the\n\t\t\t// rent cycle comes from the RentableType.\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\trcl := rlib.GetRentCycleRefList(&p, d1, d2, ri.Xbiz) // this sets r.RT to the RentableTypeRef list for d1-d2\n\t\t\tcycleval := rcl[len(rcl)-1].RentCycle // save for proration use below\n\t\t\tprorateval := rcl[len(rcl)-1].ProrationCycle // save for proration use below\n\t\t\trentCycle = rlib.RentalPeriodToString(cycleval) // use the rentCycle for the last day of the month\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Adjust the period as needed. The request is to cover d1 - d2. We start by setting dtstart and dtstop\n\t\t\t// to this range. If the renter moves in after d1, then adjust dtstart accordingly. If the renter moves\n\t\t\t// out prior to d2 then adjust dtstop accordingly\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\tdtstart := *d1\n\t\t\tif ra.RentStart.After(dtstart) {\n\t\t\t\tdtstart = ra.RentStart\n\t\t\t}\n\t\t\tdtstop := *d2\n\t\t\tif ra.RentStop.Before(dtstop) {\n\t\t\t\tdtstop = ra.RentStop\n\t\t\t}\n\t\t\tgsr, gsrRate := ComputeGSRandGSRRate(&p, &dtstart, &dtstop, ri.Xbiz)\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Get the contract rent\n\t\t\t// Remember that we're looping through all the rental all the rental agreements for Rentable p during the\n\t\t\t// period d1 - d2. We just need to look at the RentalAgreementRentable for ra.RAID during d1-d2 and\n\t\t\t// adjust the start or stop if the rental agreement started after d1 or ended before d2.\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\trar, err := rlib.FindAgreementByRentable(p.RID, &dtstart, &dtstop)\n\t\t\tif err != nil {\n\t\t\t\ttotalErrs++\n\t\t\t\trlib.Ulog(\"Error getting RentalAgreementRentable for RID = %d, period = %s - %s: err = %s\\n\",\n\t\t\t\t\tp.RID, dtstart.Format(rlib.RRDATEFMT3), dtstop.Format(rlib.RRDATEFMT3), err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Make any proration necessary to the gsr based on the date range d1-d2\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\tpf, _, _, dt1, _ := rlib.CalcProrationInfo(&dtstart, &dtstop, d1, d2, cycleval, prorateval)\n\t\t\tnumCycles := dtstop.Sub(dtstart) / rlib.CycleDuration(cycleval, dt1)\n\t\t\tcontractRentVal := float64(0)\n\t\t\tif dtstop.After(dtstart) {\n\t\t\t\tcontractRentVal = pf * rar.ContractRent\n\t\t\t\tif numCycles > 1 {\n\t\t\t\t\tcontractRentVal += float64(numCycles-1) * rar.ContractRent\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Determine the LID of \"Income Offsets\" and \"Other Income\" accounts and their totals...\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\ticos := float64(0)\n\t\t\tincOffsetAcct := rlib.GetLIDFromGLAccountName(ri.Xbiz.P.BID, IncomeOffsetGLAccountName)\n\t\t\tif incOffsetAcct == 0 {\n\t\t\t\trlib.Ulog(\"RentRollTextReport: WARNING. IncomeOffsetGLAccountName = %q was not found in the GLAccounts\\n\", IncomeOffsetGLAccountName)\n\t\t\t}\n\t\t\tif incOffsetAcct > 0 {\n\t\t\t\ticosd1 := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, incOffsetAcct, ra.RAID, &dtstart)\n\t\t\t\ticosd2 := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, incOffsetAcct, ra.RAID, &dtstop)\n\t\t\t\ticos = icosd2 - icosd1\n\t\t\t}\n\t\t\toic := float64(0)\n\t\t\totherIncomeAcct := rlib.GetLIDFromGLAccountName(ri.Xbiz.P.BID, OtherIncomeGLAccountName)\n\t\t\tif otherIncomeAcct == 0 {\n\t\t\t\trlib.Ulog(\"RentRollTextReport: WARNING. OtherIncomeGLAccountName = %q was not found in the GLAccounts\\n\", OtherIncomeGLAccountName)\n\t\t\t}\n\t\t\tif otherIncomeAcct > 0 {\n\t\t\t\toicd1 := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, otherIncomeAcct, ra.RAID, &dtstart)\n\t\t\t\toicd2 := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, otherIncomeAcct, ra.RAID, &dtstop)\n\t\t\t\toic = oicd1 - oicd2 // I know this looks backwards. But in the report we want this number to show up as positive (normally), so we want -1 * (oicd2-oicd1)\n\t\t\t}\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Payments received... or more precisely that portion of a Receipt that went to pay an Assessment on\n\t\t\t// on this Rentable during this period d1 - d2. We expand the search range to the entire report range\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// fmt.Printf(\"GetASMReceiptAllocationsInRAIDDateRange: RAID = %d, d1-d2 = %s - %s\\n\", ra.RAID, d1.Format(rlib.RRDATEFMT4), d2.Format(rlib.RRDATEFMT4))\n\t\t\tm := rlib.GetASMReceiptAllocationsInRAIDDateRange(ra.RAID, d1, d2) // receipts for ra.RAID during d1-d2, ReceiptAllocations are also loaded\n\t\t\ttotpmt := float64(0)\n\t\t\tfor k := 0; k < len(m); k++ { // for each ReceiptAllocation read the Assessment\n\t\t\t\ta, err := rlib.GetAssessment(m[k].ASMID) // if Rentable == p.RID, we found the PaymentReceived value\n\t\t\t\tif err != nil {\n\t\t\t\t\ttotalErrs++\n\t\t\t\t\tfmt.Printf(\"%s: Error from GetAssessment(%d): err = %s\\n\", funcname, m[k].ASMID, err.Error())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif a.RID == p.RID {\n\t\t\t\t\ttotpmt += m[k].Amount\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\t// Compute account balances... begin, delta, and end for RAbalance and Security Deposit\n\t\t\t//-------------------------------------------------------------------------------------------------------\n\t\t\trcvble := rlib.GetReceivableAccounts(ri.Xbiz.P.BID)\n\t\t\tif len(rcvble) < 1 {\n\t\t\t\trlib.LogAndPrint(\"Could not find Receivables account for business %d\\n\", ri.Xbiz.P.BID)\n\t\t\t\treturn tbl\n\t\t\t}\n\t\t\tsecdep := rlib.GetSecurityDepositsAccounts(ri.Xbiz.P.BID)\n\t\t\tif len(secdep) < 1 {\n\t\t\t\trlib.LogAndPrint(\"Could not find Security Deposits account for business %d\\n\", ri.Xbiz.P.BID)\n\t\t\t\treturn tbl\n\t\t\t}\n\t\t\t// fmt.Printf(\"Found Receivables: %d\\n\", rcvble[0])\n\t\t\t// fmt.Printf(\"Found Security Deposis: %d\\n\", secdep[0])\n\t\t\traStartBal := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, rcvble[0], ra.RAID, d1)\n\t\t\traEndBal := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, rcvble[0], ra.RAID, d2)\n\t\t\tsecdepStartBal := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, secdep[0], ra.RAID, d1)\n\t\t\tsecdepEndBal := rlib.GetRAAccountBalance(ri.Xbiz.P.BID, secdep[0], ra.RAID, d2)\n\n\t\t\ttbl.AddRow()\n\t\t\ttbl.Puts(-1, RName, p.RentableName)\n\t\t\ttbl.Puts(-1, RType, ri.Xbiz.RT[rtid].Style)\n\t\t\ttbl.Puti(-1, RTSqFt, sqft)\n\t\t\ttbl.Puts(-1, RUsers, usernames)\n\t\t\ttbl.Puts(-1, RPayors, payornames)\n\t\t\ttbl.Puts(-1, RAgr, ra.IDtoString())\n\t\t\ttbl.Putd(-1, UseStart, ra.PossessionStart)\n\t\t\ttbl.Putd(-1, UseStop, ra.PossessionStop)\n\t\t\ttbl.Putd(-1, RentStart, ra.RentStart)\n\t\t\ttbl.Putd(-1, RentStop, ra.RentStop)\n\t\t\ttbl.Putd(-1, RAgrStart, ra.AgreementStart)\n\t\t\ttbl.Putd(-1, RAgrStop, ra.AgreementStop)\n\t\t\ttbl.Puts(-1, RCycle, rentCycle)\n\t\t\ttbl.Putf(-1, GSRRate, gsrRate)\n\t\t\ttbl.Putf(-1, GSRAmt, gsr)\n\t\t\ttbl.Putf(-1, IncOff, icos)\n\t\t\ttbl.Putf(-1, ContractRent, contractRentVal)\n\t\t\ttbl.Putf(-1, OtherInc, oic)\n\t\t\ttbl.Putf(-1, PmtRcvd, totpmt)\n\t\t\ttbl.Putf(-1, BeginRcv, raStartBal)\n\t\t\ttbl.Putf(-1, ChgRcv, raEndBal-raStartBal)\n\t\t\ttbl.Putf(-1, EndRcv, raEndBal)\n\t\t\ttbl.Putf(-1, BeginSecDep, -secdepStartBal)\n\t\t\ttbl.Putf(-1, ChgSecDep, secdepStartBal-secdepEndBal)\n\t\t\ttbl.Putf(-1, EndSecDep, -secdepEndBal)\n\t\t\t// fmt.Printf(\"secdepEndBal = %8.2f, secdepStartBal = %8.2f, diff = %8.2f\\n\", secdepEndBal, secdepStartBal, secdepEndBal-secdepStartBal)\n\t\t}\n\n\t\t//-------------------------------------------------------------------------------------------------------\n\t\t// All rental agreements have been process. Look for vacancies\n\t\t//-------------------------------------------------------------------------------------------------------\n\t\tv := rlib.VacancyDetect(ri.Xbiz, d1, d2, p.RID)\n\t\tfor i := 0; i < len(v); i++ {\n\t\t\tgsr, gsrRate := ComputeGSRandGSRRate(&p, &v[i].DtStart, &v[i].DtStop, ri.Xbiz)\n\n\t\t\ticos := float64(0)\n\t\t\tincOffsetAcct := rlib.GetLIDFromGLAccountName(p.BID, IncomeOffsetGLAccountName)\n\t\t\tif incOffsetAcct == 0 {\n\t\t\t\trlib.Ulog(\"RentRollTextReport: WARNING. IncomeOffsetGLAccountName = %q was not found in the GLAccounts\\n\", IncomeOffsetGLAccountName)\n\t\t\t} else {\n\t\t\t\ticosd1 := rlib.GetRentableAccountBalance(ri.Xbiz.P.BID, incOffsetAcct, p.RID, d1)\n\t\t\t\ticosd2 := rlib.GetRentableAccountBalance(ri.Xbiz.P.BID, incOffsetAcct, p.RID, d2)\n\t\t\t\ticos = icosd2 - icosd1\n\t\t\t}\n\n\t\t\tm := rlib.GetRentableStatusByRange(p.RID, d1, d2)\n\t\t\tlastRStat := m[len(m)-1].UseStatus\n\t\t\ttbl.AddRow()\n\t\t\ttbl.Puts(-1, RName, p.RentableName)\n\t\t\ttbl.Puts(-1, RType, ri.Xbiz.RT[rtid].Style)\n\t\t\ttbl.Puti(-1, RTSqFt, sqft)\n\t\t\ttbl.Puts(-1, RUsers, rlib.RentableStatusToString(lastRStat))\n\t\t\ttbl.Puts(-1, RPayors, \"vacant\")\n\t\t\ttbl.Puts(-1, RAgr, \"n/a\")\n\t\t\t// tbl.Putd(-1, UseStart, ra.PossessionStart)\n\t\t\t// tbl.Putd(-1, UseStop, ra.PossessionStop)\n\t\t\ttbl.Putd(-1, RentStart, v[i].DtStart)\n\t\t\ttbl.Putd(-1, RentStop, v[i].DtStop)\n\t\t\t// tbl.Putd(-1, RAgrStart, ra.AgreementStart)\n\t\t\t// tbl.Putd(-1, RAgrStop, ra.AgreementStop)\n\t\t\ttbl.Putf(-1, GSRRate, gsrRate)\n\t\t\ttbl.Putf(-1, GSRAmt, gsr)\n\t\t\ttbl.Putf(-1, IncOff, icos)\n\t\t\t// tbl.Putf(-1, ContractRent, contractRentVal)\n\t\t\t// tbl.Putf(-1, OtherInc, oic)\n\t\t\t// tbl.Putf(-1, PmtRcvd, oic)\n\t\t\t// tbl.Putf(-1, BeginRcv, raStartBal)\n\t\t\t// tbl.Putf(-1, ChgRcv, raEndBal-raStartBal)\n\t\t\t// tbl.Putf(-1, EndRcv, raEndBal)\n\t\t\t// tbl.Putf(-1, BeginSecDep, secdepStartBal)\n\t\t\t// tbl.Putf(-1, ChgSecDep, secdepEndBal-raStartBal)\n\t\t\t// tbl.Putf(-1, EndSecDep, secdepEndBal)\n\t\t}\n\n\t\trentableTblRowStop := len(tbl.Row) - 1 // ending row for this rentable\n\t\ttbl.Sort(rentableTblRowStart, rentableTblRowStop, RentStart) // chronologically sort these rows\n\n\t\t// if there are multiple rows for this rentable, add a line and give a subtotal\n\t\tif rentableTblRowStop-rentableTblRowStart > 0 {\n\t\t\ttbl.AddLineAfter(rentableTblRowStop)\n\t\t\ttbl.InsertSumRow(rentableTblRowStop+1, rentableTblRowStart, rentableTblRowStop,\n\t\t\t\t[]int{GSRAmt, IncOff, ContractRent, OtherInc, PmtRcvd, BeginRcv, ChgRcv, EndRcv, BeginSecDep, ChgSecDep, EndSecDep})\n\t\t\ttbl.AppendToRowset(totalsRSet, rentableTblRowStop+1) // in this case, add the sum row to the totalsRSet\n\t\t} else {\n\t\t\ttbl.AppendToRowset(totalsRSet, rentableTblRowStart) // add this row to the totalsRSET\n\t\t}\n\t\ttbl.AddRow() // Can't look ahead with rows.Next, so always add a blank line, remove the last one after loop ends. See note on DeleteRow below.\n\t}\n\trlib.Errcheck(rows.Err())\n\tif len(tbl.Row) > 0 {\n\t\ttbl.DeleteRow(len(tbl.Row) - 1) // removes the last blank line. Can't check rows.Next twice, so no other way I can see to do this\n\t\ttbl.AddLineAfter(len(tbl.Row) - 1) // a line after the last row in the table\n\t\ttbl.InsertSumRowsetCols(totalsRSet, len(tbl.Row),\n\t\t\t[]int{GSRAmt, IncOff, ContractRent, OtherInc, PmtRcvd, BeginRcv, ChgRcv, EndRcv, BeginSecDep, ChgSecDep, EndSecDep})\n\n\t\ttbl.TightenColumns()\n\t}\n\tif totalErrs > 0 {\n\t\terrMsg := fmt.Sprintf(\"Encountered %d errors while creating this report. See log.\", totalErrs)\n\t\ttbl.SetSection3(errMsg)\n\n\t\t// use section3 for errors and apply red color\n\t\tcssListSection3 := []*gotable.CSSProperty{\n\t\t\t{Name: \"color\", Value: \"red\"},\n\t\t\t{Name: \"font-family\", Value: \"monospace\"},\n\t\t}\n\t\ttbl.SetSection3CSS(cssListSection3)\n\t}\n\treturn tbl\n}", "title": "" }, { "docid": "e791bf67220100d5fec1629714bb120f", "score": "0.50969285", "text": "func RRreportRatePlanRefRTRates(rpr *rlib.RatePlanRef, xbiz *rlib.XBusiness) string {\n\tvar sporder []int64\n\ts := fmt.Sprintf(\"\\n\\t%-10s %-10s %-20s %-8s \", \"RTID\", \"Style\", \"Name\", \"Rate\")\n\tfor _, v := range xbiz.US {\n\t\ts += fmt.Sprintf(\" %-10.10s\", v.Name)\n\t\tsporder = append(sporder, v.RSPID)\n\t}\n\ts += fmt.Sprintf(\"\\n\\t%-10s %-10s %-20s %-8s \", \"----------\", \"----------\", \"--------------------\", \"----------\")\n\tfor range xbiz.US {\n\t\ts += fmt.Sprintf(\" ----------\")\n\t}\n\ts += \"\\n\"\n\n\t// To perform the opertion you want\n\tfor i := 0; i < len(rpr.RT); i++ {\n\t\tp := rpr.RT[i]\n\t\ts += fmt.Sprintf(\"\\tRT%08d %-10s %-20s \", p.RTID, xbiz.RT[p.RTID].Style, xbiz.RT[p.RTID].Name)\n\t\tif (p.FLAGS & rlib.FlRTRna) != 0 { // ...make sure it's not telling us to ignore this rentable type\n\t\t\ts += \"n/a\"\n\t\t\tcontinue // this RentableType is not affected\n\t\t}\n\t\ts1 := \" \" // assume p.Val is absolute\n\t\tif (p.FLAGS & rlib.FlRTRpct) != 0 { // if it's actually a percentage then...\n\t\t\tp.Val *= 100 // make the percentage more presentable\n\t\t\ts1 = \"%\" // and add a % character\n\t\t}\n\t\ts += fmt.Sprintf(\"%8.2f %s \", p.Val, s1)\n\t\t// Now add the Specialties\n\t\tm := rlib.GetAllRatePlanRefSPRates(p.RPRID, p.RTID) // almost certainly not in the order we want them\n\t\tfor j := 0; j < len(m)-1; j++ { // we order them just to be sure\n\t\t\tif m[j].RSPID == sporder[j] { // if it's already in the right index for the column heading\n\t\t\t\tcontinue // then just continue\n\t\t\t}\n\t\t\tfor k := j + 1; k < len(m); k++ { // need to find sporder[j] and put it in m[j]\n\t\t\t\tif m[k].RSPID == sporder[j] { // is this the one we're after?\n\t\t\t\t\tm[j], m[k] = m[k], m[j] // yes: swap m[j] and m[k]\n\t\t\t\t\tbreak // we're done with position j; break out of this loop and continue the j loop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// now m is ordered just like the column headings. Print out each amount\n\t\tfor j := 0; j < len(m); j++ {\n\t\t\ts1 = \" \"\n\t\t\tfmt.Printf(\"m[%d]: RPRID=%d, RTID=%d, RSPID=%d, Val=%f\\n\", j, m[j].RPRID, m[j].RTID, m[j].RSPID, m[j].Val)\n\t\t\tv := m[j].Val\n\t\t\tif (m[j].FLAGS & rlib.FlSPRpct) != 0 { // if it's actually a percentage then...\n\t\t\t\tv *= 100 // make the percentage more presentable\n\t\t\t\ts1 = \"%\" // and add a % character\n\t\t\t}\n\t\t\ts += fmt.Sprintf(\"%8.2f %s \", v, s1)\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5dba4d9cd154b1003d69a21b0f1f0ca2", "score": "0.50818056", "text": "func RRreportRatePlanRefs(ri *rrpt.ReporterInfo) string {\n\tfuncname := \"RRreportRatePlanRefs\"\n\tvar rp rlib.RatePlan\n\tvar xbiz rlib.XBusiness\n\trlib.GetXBusiness(ri.Bid, &xbiz)\n\n\tm := rlib.GetAllRatePlanRefsInRange(&ri.D1, &ri.D2)\n\tif len(m) == 0 {\n\t\tfmt.Printf(\"%s: could not load RatePlanRefs for timerange %s - %s\\n\", funcname, ri.D1.Format(rlib.RRDATEFMT4), ri.D2.Format(rlib.RRDATEFMT4))\n\t\treturn \"\"\n\t}\n\n\ts := fmt.Sprintf(\"%-15s %-11s %-10s %-10s %-8s %-6s %-9s %-9s %-20s\\n\", \"RatePlan\", \"RPRID\", \"DtStart\", \"DtStop\", \"MaxNoFee\", \"FeeAge\", \"Fee\", \"CancelFee\", \"PromoCode\")\n\ts += fmt.Sprintf(\"%-15s %-11s %-10s %-10s %-8s %-6s %-9s %-9s %-20s\\n\", \"--------\", \"-----\", \"----------\", \"----------\", \"--------\", \"------\", \"---------\", \"---------\", \"---------\")\n\n\tfor i := 0; i < len(m); i++ {\n\t\tp := m[i]\n\t\trlib.GetRatePlan(p.RPID, &rp)\n\t\trlib.GetRatePlanRefFull(p.RPRID, &p)\n\t\tswitch ri.OutputFormat {\n\t\tcase gotable.TABLEOUTTEXT:\n\t\t\ts += fmt.Sprintf(\"%-15.15s RPR%08d %10s %10s %8d %6d %9.2f %9.2f %s\\n\",\n\t\t\t\trp.Name, p.RPRID, p.DtStart.Format(rlib.RRDATEFMT4), p.DtStop.Format(rlib.RRDATEFMT4),\n\t\t\t\tp.MaxNoFeeUsers, p.FeeAppliesAge, p.AdditionalUserFee, p.CancellationFee, p.PromoCode)\n\t\t\ts += RRreportRatePlanRefRTRates(&p, &xbiz)\n\t\t\ts += \"\\n\"\n\t\tcase gotable.TABLEOUTHTML:\n\t\t\tfmt.Printf(\"UNIMPLEMENTED\\n\")\n\t\tdefault:\n\t\t\tfmt.Printf(\"RRreportRatePlans: unrecognized print format: %d\\n\", ri.OutputFormat)\n\t\t\treturn \"\"\n\t\t}\n\t}\n\treturn s\n}", "title": "" }, { "docid": "cec1eec2d642a629ad52895e549b1949", "score": "0.5079248", "text": "func RRreportDeposits(ctx context.Context, ri *ReporterInfo) string {\n\tconst funcname = \"RRreportDeposits\"\n\tvar (\n\t\terr error\n\t)\n\n\tvar t gotable.Table\n\tt.Init()\n\n\tm, err := rlib.GetAllDepositsInRange(ctx, ri.Bid, &ri.D1, &ri.D2)\n\tif err != nil {\n\t\tt.SetSection3(err.Error())\n\t\treturn t.String()\n\t}\n\n\terr = TableReportHeaderBlock(ctx, &t, \"Deposit\", funcname, ri)\n\tif err != nil {\n\t\trlib.LogAndPrintError(funcname, err)\n\t\tt.SetSection3(err.Error())\n\t\treturn t.String()\n\t}\n\n\tt.AddColumn(\"Date\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"DEPID\", 11, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"BID\", 9, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"Amount\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT)\n\tt.AddColumn(\"Receipts\", 60, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\n\tfor i := 0; i < len(m); i++ {\n\t\ts := \"\"\n\t\tfor j := 0; j < len(m[i].DP); j++ {\n\t\t\ts += rlib.IDtoString(\"RCPT\", m[i].DP[j].RCPTID)\n\t\t\tif j+1 < len(m[i].DP) {\n\t\t\t\ts += \", \"\n\t\t\t}\n\t\t}\n\t\tt.AddRow()\n\t\tt.Putd(-1, 0, m[i].Dt)\n\t\tt.Puts(-1, 1, m[i].IDtoString())\n\t\tt.Puts(-1, 2, rlib.IDtoString(\"B\", m[i].BID))\n\t\tt.Putf(-1, 3, m[i].Amount)\n\t\tt.Puts(-1, 4, s)\n\t}\n\n\tt.TightenColumns()\n\ts, err := t.SprintTable()\n\tif nil != err {\n\t\trlib.Ulog(\"RRreportDeposits: error = %s\", err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "db86059e66ee572572d05cd10053dc93", "score": "0.5044915", "text": "func RRreportRentalAgreementTemplatesTable(ri *ReporterInfo) gotable.Table {\n\tfuncname := \"RRreportRentalAgreementTemplatesTable\"\n\n\t// table init\n\ttbl := getRRTable()\n\n\ttbl.AddColumn(\"BID\", 9, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\ttbl.AddColumn(\"RA Template ID\", 11, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\ttbl.AddColumn(\"RA Template Name\", 25, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\n\t// set table title, sections\n\terr := TableReportHeaderBlock(&tbl, \"Rental Agreement Templates\", funcname, ri)\n\tif err != nil {\n\t\trlib.LogAndPrintError(funcname, err)\n\t\treturn tbl\n\t}\n\n\t// get records from db\n\trows, err := rlib.RRdb.Prepstmt.GetAllRentalAgreementTemplates.Query()\n\trlib.Errcheck(err)\n\tif rlib.IsSQLNoResultsError(err) {\n\t\t// set errors in section3 and return\n\t\ttbl.SetSection3(NoRecordsFoundMsg)\n\t\treturn tbl\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar p rlib.RentalAgreementTemplate\n\t\trlib.ReadRentalAgreementTemplates(rows, &p)\n\t\ttbl.AddRow()\n\t\ttbl.Puts(-1, 0, fmt.Sprintf(\"B%08d\", p.BID))\n\t\ttbl.Puts(-1, 1, p.IDtoString())\n\t\ttbl.Puts(-1, 2, p.RATemplateName)\n\t}\n\trlib.Errcheck(rows.Err())\n\ttbl.TightenColumns()\n\treturn tbl\n}", "title": "" }, { "docid": "da539cf9de3151f37c2131229ae71409", "score": "0.5003787", "text": "func RptTrialBalance(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tvar err error\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tif xbiz.P.BID > 0 {\n\t\ttbl := rrpt.LedgerBalanceReportTable(&ri)\n\t\tif err == nil {\n\t\t\ts, err := tbl.SprintTable()\n\t\t\tif err != nil {\n\t\t\t\ts += err.Error()\n\t\t\t}\n\t\t\tui.ReportContent = s\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e9beb9cadd0131ff8379177ed43c4bb2", "score": "0.49952713", "text": "func RptRentRoll(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tif xbiz.P.BID > 0 {\n\t\ttbl := rrpt.RRReportTable(&ri)\n\n\t\ttout, err := tbl.SprintTable()\n\t\tif err != nil {\n\t\t\trlib.Ulog(\"RptRentRoll: error = %s\", err)\n\t\t\tui.ReportContent = err.Error()\n\t\t} else {\n\t\t\tui.ReportContent = tout\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0cc83a2492e618ff302712abab7f8288", "score": "0.49929544", "text": "func RptTrialBalance(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tvar err error\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tif xbiz.P.BID > 0 {\n\t\ttbl := rrpt.LedgerBalanceReport(&ri)\n\t\tif err == nil {\n\t\t\tui.ReportContent = tbl.SprintTable(rlib.TABLEOUTTEXT)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "617f45ee33b23dbfc0214e25103eb1d7", "score": "0.49884173", "text": "func RptGSR(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tif xbiz.P.BID > 0 {\n\t\tvar ri rrpt.ReporterInfo\n\t\tri.Xbiz = xbiz\n\t\tri.D1 = ui.D2 // set both dates to the range end\n\t\tri.D2 = ui.D2\n\t\ttbl := rrpt.GSRReportTable(&ri)\n\t\ts, err := tbl.SprintTable()\n\t\tif nil != err {\n\t\t\ts += err.Error()\n\t\t}\n\t\tui.ReportContent = s\n\t}\n}", "title": "" }, { "docid": "d5f0d9e96bf6e003a4402ce0405aeebb", "score": "0.49738368", "text": "func RptRentRoll(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tif xbiz.P.BID > 0 {\n\t\ttbl, err := rrpt.RentRollReport(&ri)\n\t\tif err == nil {\n\t\t\tui.ReportContent = tbl.Title + tbl.SprintRowText(len(tbl.Row)-1) + tbl.SprintLineText() + tbl.SprintTable(rlib.TABLEOUTTEXT)\n\t\t} else {\n\t\t\tui.ReportContent = fmt.Sprintf(\"Error generating RentRoll report: %s\\n\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4d9503d354bd9ebc399bee7ab039a6d6", "score": "0.4963808", "text": "func RptGSR(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tif xbiz.P.BID > 0 {\n\t\tvar ri rrpt.ReporterInfo\n\t\tri.Xbiz = xbiz\n\t\tri.D1 = ui.D2 // set both dates to the range end\n\t\tri.D2 = ui.D2\n\t\ttbl, err := rrpt.GSRReport(&ri)\n\t\tif err == nil {\n\t\t\tui.ReportContent = tbl.SprintTable(rlib.TABLEOUTTEXT)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6f34a37e3f9b3142224eb4c02332d335", "score": "0.4954508", "text": "func GenerateReportSales(c *gin.Context) {\n\tcategories := map[string]string{\"A10\": \"ID Pesanan\", \"B10\": \"Waktu\", \"C10\": \"SKU\", \"D10\": \"Nama Barang\", \"E10\": \"Jumlah\", \"F10\": \"Harga Jual\", \"G10\": \"Total\", \"H10\": \"Harga Beli\", \"I10\": \"Laba\"}\n\tvalues := map[string]string{\"A10\": \"ID Pesanan\", \"B10\": \"Waktu\", \"C10\": \"SKU\", \"D10\": \"Nama Barang\", \"E10\": \"Jumlah\", \"F10\": \"Harga Jual\", \"G10\": \"Total\", \"H10\": \"Harga Beli\", \"I10\": \"Laba\"}\n\txlsx := excelize.NewFile()\n\tfor k, v := range categories {\n\t\txlsx.SetCellValue(\"Laporan Penjualan\", k, v)\n\t}\n\tfor k, v := range values {\n\t\txlsx.SetCellValue(\"Laporan Penjualan\", k, v)\n\t}\n\t// Save xlsx file by the given path.\n\terr := xlsx.SaveAs(\"./ReportSales.xlsx\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tvar b bytes.Buffer\n\twritr := bufio.NewWriter(&b)\n\txlsx.Write(writr)\n\twritr.Flush()\n\n\tfileContents := b.Bytes()\n\tfileSize := strconv.Itoa(len(fileContents))\n\n\tc.Writer.Header().Set(\"Content-Disposition\", \"attachment; filename=report.xlsx\")\n\tc.Writer.Header().Set(\"Content-Type\", \"application/octet-stream\")\n\tc.Writer.Header().Set(\"Content-Length\", fileSize)\n}", "title": "" }, { "docid": "bd9a5db6b9e1fe76db9356852aa49efd", "score": "0.49170953", "text": "func NewReport() {\n\n\tconnectionString := os.Getenv(\"DBHOST\")\n\tif connectionString == \"\" {\n\t\tconnectionString = \"localhost\"\n\t}\n\n\tdatabase := os.Getenv(\"DBNAME\")\n\tif database == \"\" {\n\t\tdatabase = \"openbankingcrawlerlocal\"\n\t}\n\n\tconfig := &bongo.Config{\n\t\tConnectionString: connectionString,\n\t\tDatabase: database,\n\t}\n\n\tfmt.Printf(\"Connect to database %s %s\", database, \"\\n\")\n\tconnection, dbErr := bongo.Connect(config)\n\n\tif dbErr != nil {\n\t\tpanic(dbErr)\n\t}\n\n\tinstitutionService,\n\t\t_,\n\t\t_ := CreateBasicServices(connection)\n\n\t_,\n\t\tpersonalLoanService,\n\t\t_,\n\t\t_,\n\t\tpersonalCreditCardService,\n\t\t_,\n\t\t_,\n\t\t_,\n\t\t_,\n\t\t_,\n\t\t_,\n\t\t_ := CreateProductsServicesServices(connection)\n\n\tpath := \"./outputs/\"\n\tfilename := \"report\"\n\n\treportType := os.Getenv(\"TYPE\")\n\n\twriteErr := errors.New(\"No report type defined\")\n\n\tif reportType == \"PERSONAL_CC\" {\n\t\tpersonalCreditCardReportInterface := report.NewPersonalCreditCard(institutionService, personalCreditCardService)\n\t\tfilename = \"report_personalcreditcard\"\n\t\toutput := *personalCreditCardReportInterface.Fees()\n\n\t\twriteErr = write(output, path, filename)\n\t}\n\tif reportType == \"PERSONAL_LOAN\" {\n\t\tpersonalLoanReportInterface := report.NewPersonalLoan(institutionService, personalLoanService)\n\t\tfilename = \"report_personaloan\"\n\t\toutput := *personalLoanReportInterface.PersonalLoanFees()\n\n\t\twriteErr = write(output, path, filename)\n\t}\n\n\tif writeErr != nil {\n\t\tpanic(writeErr)\n\t}\n\n\tfmt.Println(\"Report done\")\n}", "title": "" }, { "docid": "c75f660d18884777422c2816a6335ebb", "score": "0.48784524", "text": "func RRreportDeposits(ri *rrpt.ReporterInfo) string {\n\tfuncname := \"RRreportDeposits\"\n\tm := rlib.GetAllDepositsInRange(ri.Bid, &Rcsv.DtStart, &Rcsv.DtStop)\n\tvar t gotable.Table\n\tt.Init()\n\n\terr := rrpt.TableReportHeaderBlock(&t, \"Deposit\", funcname, ri)\n\tif err != nil {\n\t\trlib.LogAndPrintError(funcname, err)\n\t}\n\n\tt.AddColumn(\"Date\", 10, gotable.CELLDATE, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"DEPID\", 11, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"BID\", 9, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\tt.AddColumn(\"Amount\", 10, gotable.CELLFLOAT, gotable.COLJUSTIFYRIGHT)\n\tt.AddColumn(\"Receipts\", 60, gotable.CELLSTRING, gotable.COLJUSTIFYLEFT)\n\n\tfor i := 0; i < len(m); i++ {\n\t\ts := \"\"\n\t\tfor j := 0; j < len(m[i].DP); j++ {\n\t\t\ts += rlib.IDtoString(\"RCPT\", m[i].DP[j].RCPTID)\n\t\t\tif j+1 < len(m[i].DP) {\n\t\t\t\ts += \", \"\n\t\t\t}\n\t\t}\n\t\tt.AddRow()\n\t\tt.Putd(-1, 0, m[i].Dt)\n\t\tt.Puts(-1, 1, m[i].IDtoString())\n\t\tt.Puts(-1, 2, rlib.IDtoString(\"B\", m[i].BID))\n\t\tt.Putf(-1, 3, m[i].Amount)\n\t\tt.Puts(-1, 4, s)\n\t}\n\tt.TightenColumns()\n\ts, err := t.SprintTable()\n\tif nil != err {\n\t\trlib.Ulog(\"RRreportDeposits: error = %s\", err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "46e11f7b94afeec47d0bff827c32beba", "score": "0.48381594", "text": "func (a AuditAccount) Render() cadf.Resource {\n\tres := cadf.Resource{\n\t\tTypeURI: \"docker-registry/account\",\n\t\tID: a.Account.Name,\n\t\tProjectID: a.Account.AuthTenantID,\n\t}\n\n\tgcPoliciesJSON := a.Account.GCPoliciesJSON\n\tif gcPoliciesJSON != \"\" && gcPoliciesJSON != \"[]\" {\n\t\tres.Attachments = append(res.Attachments, cadf.Attachment{\n\t\t\tName: \"gc-policies\",\n\t\t\tTypeURI: \"mime:application/json\",\n\t\t\tContent: a.Account.GCPoliciesJSON,\n\t\t})\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "e270b4a242f23b26eb3364c34d8a229b", "score": "0.48375195", "text": "func (op ParticipantOperations) GetAccounts(w http.ResponseWriter, req *http.Request) {\n\n\tLOGGER.Infof(\"api-service:ParticipantOperations:GetAccounts....\")\n\tvar accounts []model.Account\n\tparticipantObj, err := op.RestPRServiceClient.GetParticipantForDomain(os.Getenv(global_environment.ENV_KEY_HOME_DOMAIN_NAME))\n\tif err != nil {\n\t\tLOGGER.Errorf(\" Error GetParticipantForDomain failed: %v\", err)\n\t\tresponse.NotifyWWError(w, req, http.StatusNotFound, \"API-1256\", err)\n\t\treturn\n\t}\n\n\t//add issuing account to list of accounts\n\tif participantObj.IssuingAccount != \"\" {\n\t\tissueAccount := model.Account{}\n\t\tissueAccount.Name = comn.ISSUING\n\t\tissueAccount.Address = &participantObj.IssuingAccount\n\t\taccounts = append(accounts, issueAccount)\n\t}\n\n\tfor _, account := range participantObj.OperatingAccounts {\n\t\taccounts = append(accounts, *account)\n\t}\n\n\tif len(accounts) == 0 {\n\t\terr = errors.New(\" no issuing or operating created for participant\")\n\t\tLOGGER.Error(err)\n\t\tresponse.NotifyWWError(w, req, http.StatusNotFound, \"API-1070\", err)\n\t\treturn\n\t}\n\n\tacrJSON, _ := json.Marshal(accounts)\n\tresponse.Respond(w, http.StatusOK, acrJSON)\n\n}", "title": "" }, { "docid": "59b3551d51fcba8bf6437460632fd391", "score": "0.48232442", "text": "func (c *Client) CreateReportAccountReportPartnerledgers(rars []*ReportAccountReportPartnerledger) ([]int64, error) {\n\tvar vv []interface{}\n\tfor _, v := range rars {\n\t\tvv = append(vv, v)\n\t}\n\treturn c.Create(ReportAccountReportPartnerledgerModel, vv)\n}", "title": "" }, { "docid": "132f5dea8c12365bc55c1c8bcc8df60c", "score": "0.47658706", "text": "func (h *handler) ListAccounts(ctx context.Context, req *pb.Request, res *pb.Response) error {\n // grab accounts\n if accounts, err := h.repo.ListAccounts(req); err != nil {\n return err\n }\n\n // set response\n res.Accounts = accounts\n //return\n return nil\n}", "title": "" }, { "docid": "db6e5b09156fab4d806262c8e82303c6", "score": "0.47617638", "text": "func NewReport(exportResults models.ExportResults, environment string) (Report, error) {\n\t// Random (Version 4) UUID. NB: `uuid.New()` might panic hence we using this function instead.\n\tuuid, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn Report{}, err\n\t}\n\n\tcreated := time.Now().Format(internal_time.Layout)\n\texpiration := time.Now().AddDate(0, 3, 0).Format(internal_time.Layout) // Expires three (3) months from now\n\tcertifiedBy := CertifiedBy{\n\t\tEnvironment: certifiedByEnvironmentToID()[environment],\n\t\tBrand: exportResults.ExportRequest.Implementer,\n\t\tAuthorisedBy: exportResults.ExportRequest.AuthorisedBy,\n\t\tJobTitle: exportResults.ExportRequest.JobTitle,\n\t}\n\tsignatureChain := []SignatureChain{}\n\n\tfails := GetFails(exportResults.Results)\n\tapiSpecs := []APISpecification{}\n\tapiVersions := make(APIVersionList, 0, len(exportResults.Results))\n\tfor k, results := range exportResults.Results {\n\t\ttlsVersionResult := exportResults.TLSVersionResult[strings.ReplaceAll(k.APIName, \" \", \"-\")]\n\t\tif tlsVersionResult == nil {\n\t\t\ttlsVersionResult = &discovery.TLSValidationResult{Valid: false, TLSVersion: \"unknown\"}\n\t\t}\n\n\t\tapiVersions = append(apiVersions, &apiVersion{\n\t\t\tName: k.APIName,\n\t\t\tVersion: k.APIVersion,\n\t\t})\n\n\t\tapiSpec := APISpecification{\n\t\t\tName: k.APIName,\n\t\t\tVersion: k.APIVersion,\n\t\t\tResults: results,\n\t\t\tTLSVersion: tlsVersionResult.TLSVersion,\n\t\t\tTLSVersionValid: tlsVersionResult.Valid,\n\t\t}\n\t\tapiSpecs = append(apiSpecs, apiSpec)\n\t}\n\n\tsort.Sort(apiVersions)\n\treturn Report{\n\t\tID: uuid.String(),\n\t\tCreated: created,\n\t\tExpiration: &expiration,\n\t\tFails: fails,\n\t\tVersion: Version,\n\t\tStatus: StatusComplete,\n\t\tCertifiedBy: certifiedBy,\n\t\tAPIVersions: apiVersions,\n\t\tSignatureChain: &signatureChain,\n\t\tDiscovery: exportResults.DiscoveryModel,\n\t\tResponseFields: exportResults.ResponseFields,\n\t\tAPISpecification: apiSpecs,\n\t\tFCSVersion: version.FullVersion,\n\t\tProducts: exportResults.ExportRequest.Products,\n\t\tJWSStatus: exportResults.JWSStatus,\n\t\tAgreedTC: exportResults.ExportRequest.HasAgreed,\n\t}, nil\n}", "title": "" }, { "docid": "e02f0fac1521e45683e5849ef1d0137b", "score": "0.47573376", "text": "func RentRollReport(ri *ReporterInfo) string {\n\ttbl := RentRollReportTable(ri)\n\treturn ReportToString(&tbl, ri)\n}", "title": "" }, { "docid": "d1659548e255e3ae243b6652a8ae6b0c", "score": "0.4749638", "text": "func (t *Invoices) getAllFilInvoiceByDateRange(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\r\n\tif len(args) != 2 {\r\n\t\treturn shim.Error(\"2 arguements required\")\r\n }\r\n D1 := args[0]\r\n D2 := args[1]\r\n\r\n Date1, _err := strconv.Atoi(D1) //Date 1\r\n if _err != nil {\r\n\t\treturn shim.Error(_err.Error())\r\n\t}\r\n\tDate2, _err1 := strconv.Atoi(D2) //Date 2\r\n if _err1 != nil {\r\n\t\treturn shim.Error(_err1.Error())\r\n\t}\r\n\r\n\tvar jsonResp, errResp string\r\n\tvar err error\r\n\tvar InvoiceIndex []string\r\n\r\n\tfmt.Println(\"- start getAllFilInvoiceByDateRange\")\r\n\tInvoice_Bytes, err := stub.GetState(InvIndexStr)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get Fil Invoice Request index\")\r\n\t}\r\n\tfmt.Print(\"Invoice_Bytes : \")\r\n\tfmt.Println(Invoice_Bytes)\r\n\tjson.Unmarshal(Invoice_Bytes, &InvoiceIndex)\t\t//unstringify it aka JSON.parse()\r\n\tfmt.Print(\"InvoiceIndex : \")\r\n\tfmt.Println(InvoiceIndex)\r\n\tfmt.Println(\"len(InvoiceIndex) : \")\r\n\tfmt.Println(len(InvoiceIndex))\r\n\tjsonResp = \"[\"\r\n\tfor i,val := range InvoiceIndex{\r\n\t\t//fmt.Println(strconv.Itoa(i) + \" - looking at \" + val + \" for all Reg request\")\r\n\t\tvalueAsBytes, err := stub.GetState(val)\r\n\t\tif err != nil {\r\n\t\t\terrResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + val + \"\\\"}\"\r\n\t\t\treturn shim.Error(errResp)\r\n }\r\n \r\n invoice := Invoice{}\r\n json.Unmarshal(valueAsBytes, &invoice)\r\n \r\n\t\tfmt.Print(\"invoice : \")\r\n fmt.Println(invoice)\r\n \r\n if (invoice.Transaction_date >= Date1 && invoice.Transaction_date <= Date2) {\r\n // jsonResp = jsonResp + \"\\\"\"+ val + \"\\\":\" + string(valueAsBytes[:])\r\n // temp =\"{\\\"From_Currency\\\":\"+invoice.E1edk01_curcy+\",\\\"To_Currency:\\\"+\r\n temp := FilDetails{\r\n From_Currency: invoice.E1edk01_curcy,\r\n To_Currency: invoice.E1edk01_hwaer,\r\n Daily_Rate: invoice.E1edk01_wkurs,\r\n Invoice_Number: invoice.E1edk01_belnr,\r\n PO_Number: invoice.E1edp01_e1edp02_belnr,\r\n Transaction_Hash: invoice.Transaction_hash,\r\n }\r\n //var jsonData []byte\r\n jsonData, err := json.Marshal(temp)\r\n if err != nil {\r\n fmt.Println(err)\r\n }\r\n fmt.Println(string(jsonData))\r\n jsonResp = jsonResp + string(jsonData[:])\r\n if i < len(InvoiceIndex)-1 {\r\n jsonResp = jsonResp + \",\"\r\n }\r\n }\r\n\t}\r\n\tjsonResp = jsonResp + \"]\"\r\n\tfmt.Println(\"jsonResp : \" + jsonResp)\r\n\tfmt.Println(\"end getAllFilInvoice\")\r\n\ttosend := \"Event send\"\r\n err = stub.SetEvent(\"evtsender\", []byte(tosend))\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n\treturn shim.Success([]byte(jsonResp))\r\n}", "title": "" }, { "docid": "855088c41a655407d4badcd64fe0522f", "score": "0.47436133", "text": "func printStatisticsReport(sr *models.StatisticsReport) {\n\n\t// Filings for the first year, printed per month.\n\tlog.Traceln(fmt.Sprintf(\"--- Statistics Report Tool ---\"))\n\tlog.Traceln(fmt.Sprintf(\"--- Within 12 months Filings (Per Month) ---\"))\n\n\tfor month, total := range sr.FirstYearAcceptedMonthlyFilings {\n\t\tlog.Traceln(fmt.Sprintf(\"%v Filings: %d\", month.String(), total))\n\t}\n\n\tlog.Traceln(fmt.Sprintf(\"--- Total: %d ---\", sr.ClosedTransactions))\n\tlog.Traceln(fmt.Sprintf(\"-------------------\"))\n\n\t// Total filings printed per status.\n\tlog.Traceln(fmt.Sprintf(\"--- Filings grouped by status ---\"))\n\tlog.Traceln(fmt.Sprintf(\"Closed transactions: %d\", sr.ClosedTransactions))\n\tlog.Traceln(fmt.Sprintf(\"Accepted transactions: %d\", sr.AcceptedTransactions))\n\tlog.Traceln(fmt.Sprintf(\"Rejected transactions: %d\", sr.RejectedTransactions))\n\tlog.Traceln(fmt.Sprintf(\"-------------------\"))\n}", "title": "" }, { "docid": "c8f67a5024832be4dd2f2ceed5b31f9f", "score": "0.47356388", "text": "func (api *API) LevpayAvailableAccounts(domainID int) ([]levpay.BankAccount, error) {\n\tresponse, err := api.Config.Do(http.MethodGet, \"/instance/levpay/banks/\", nil)\n\tif err != nil {\n\t\tfmt.Println(\"[LEVPAY] GetLevpayAvailableAccounts e2\", domainID, err.Error())\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\n\tresponseBody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tfmt.Println(\"[LEVPAY] GetLevpayAvailableAccounts e3\", domainID, err.Error())\n\t\treturn nil, err\n\t}\n\n\tvar accounts []levpay.BankAccount\n\tvar banks []levpay.LevpayBank\n\terr = json.Unmarshal(responseBody, &banks)\n\tif err != nil {\n\t\tfmt.Println(\"[LEVPAY] GetLevpayAvailableAccounts e4\", domainID, err.Error(), string(responseBody))\n\t\treturn nil, err\n\t}\n\tfor index, bank := range banks {\n\t\tvar account levpay.BankAccount\n\t\taccount.ID = index + 1\n\t\taccount.DomainID = domainID\n\t\taccount.Name = bank.Name\n\t\taccount.IsPrimary = false\n\t\taccount.BankCode = bank.Slug\n\t\taccount.Agencia = bank.AccountAgency\n\t\taccount.AgenciaDv = \"\"\n\t\taccount.Conta = bank.AccountNumber\n\t\taccount.ContaDv = \"\"\n\t\taccount.DocumentType = \"cnpj\"\n\t\taccount.DocumentNumber = bank.AccountOwnerDocument\n\t\taccount.LegalName = bank.AccountOwner\n\n\t\taccounts = append(accounts, account)\n\t}\n\n\tfmt.Println(\"[LEVPAY] GetLevpayAvailableAccounts\", domainID, accounts)\n\n\treturn accounts, nil\n}", "title": "" }, { "docid": "8739eab4df24a28876f89ef5bdb5ea6e", "score": "0.47277722", "text": "func (rrc ReportRecordContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rrc.Name != nil {\n\t\tobjectMap[\"name\"] = rrc.Name\n\t}\n\tif rrc.Timestamp != nil {\n\t\tobjectMap[\"timestamp\"] = rrc.Timestamp\n\t}\n\tif rrc.Interval != nil {\n\t\tobjectMap[\"interval\"] = rrc.Interval\n\t}\n\tif rrc.Country != nil {\n\t\tobjectMap[\"country\"] = rrc.Country\n\t}\n\tif rrc.Region != nil {\n\t\tobjectMap[\"region\"] = rrc.Region\n\t}\n\tif rrc.Zip != nil {\n\t\tobjectMap[\"zip\"] = rrc.Zip\n\t}\n\tif rrc.APIID != nil {\n\t\tobjectMap[\"apiId\"] = rrc.APIID\n\t}\n\tif rrc.OperationID != nil {\n\t\tobjectMap[\"operationId\"] = rrc.OperationID\n\t}\n\tif rrc.APIRegion != nil {\n\t\tobjectMap[\"apiRegion\"] = rrc.APIRegion\n\t}\n\tif rrc.SubscriptionID != nil {\n\t\tobjectMap[\"subscriptionId\"] = rrc.SubscriptionID\n\t}\n\tif rrc.CallCountSuccess != nil {\n\t\tobjectMap[\"callCountSuccess\"] = rrc.CallCountSuccess\n\t}\n\tif rrc.CallCountBlocked != nil {\n\t\tobjectMap[\"callCountBlocked\"] = rrc.CallCountBlocked\n\t}\n\tif rrc.CallCountFailed != nil {\n\t\tobjectMap[\"callCountFailed\"] = rrc.CallCountFailed\n\t}\n\tif rrc.CallCountOther != nil {\n\t\tobjectMap[\"callCountOther\"] = rrc.CallCountOther\n\t}\n\tif rrc.CallCountTotal != nil {\n\t\tobjectMap[\"callCountTotal\"] = rrc.CallCountTotal\n\t}\n\tif rrc.Bandwidth != nil {\n\t\tobjectMap[\"bandwidth\"] = rrc.Bandwidth\n\t}\n\tif rrc.CacheHitCount != nil {\n\t\tobjectMap[\"cacheHitCount\"] = rrc.CacheHitCount\n\t}\n\tif rrc.CacheMissCount != nil {\n\t\tobjectMap[\"cacheMissCount\"] = rrc.CacheMissCount\n\t}\n\tif rrc.APITimeAvg != nil {\n\t\tobjectMap[\"apiTimeAvg\"] = rrc.APITimeAvg\n\t}\n\tif rrc.APITimeMin != nil {\n\t\tobjectMap[\"apiTimeMin\"] = rrc.APITimeMin\n\t}\n\tif rrc.APITimeMax != nil {\n\t\tobjectMap[\"apiTimeMax\"] = rrc.APITimeMax\n\t}\n\tif rrc.ServiceTimeAvg != nil {\n\t\tobjectMap[\"serviceTimeAvg\"] = rrc.ServiceTimeAvg\n\t}\n\tif rrc.ServiceTimeMin != nil {\n\t\tobjectMap[\"serviceTimeMin\"] = rrc.ServiceTimeMin\n\t}\n\tif rrc.ServiceTimeMax != nil {\n\t\tobjectMap[\"serviceTimeMax\"] = rrc.ServiceTimeMax\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5ffe3b1f5b00d5b1a08e92887b6c62bb", "score": "0.47225514", "text": "func RptLedgerActivity(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tRptLedgerHandler(w, r, xbiz, ui, 1)\n}", "title": "" }, { "docid": "5ffe3b1f5b00d5b1a08e92887b6c62bb", "score": "0.47225514", "text": "func RptLedgerActivity(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tRptLedgerHandler(w, r, xbiz, ui, 1)\n}", "title": "" }, { "docid": "0610916bcf6015f8361fabd74dac56b5", "score": "0.47179097", "text": "func createAccounts() {\n\tdb := helpers.ConnectDB().Debug()\n\n\tdefer db.Close()\n\n\tusers := &[2]interfaces.User{\n\t\t{Username: \"Anton\", Email: \"Anton@bank.app\"},\n\t\t{Username: \"Bayu\", Email: \"Bayu@bank.app\"},\n\t}\n\n\tfor i := 0; i < len(users); i++ {\n\t\tgeneratedPassword := helpers.HashAndSalt([]byte(users[i].Username))\n\t\tuser := &interfaces.User{Username: users[i].Username, Email: users[i].Email, Password: generatedPassword}\n\t\tdb.Create(&user)\n\n\t\taccount := &interfaces.Account{Type: \"daily account\", Name: string(users[i].Username + \"'s\" + \" account\"), Balance: uint(10000 * int(i+1)), UserID: user.ID}\n\t\tdb.Create(&account)\n\t}\n}", "title": "" }, { "docid": "ce278856214153b29cd15af4ea981fb4", "score": "0.47120833", "text": "func RentRollTextReport(ri *ReporterInfo) {\n\tfmt.Print(RentRollReport(ri))\n}", "title": "" }, { "docid": "d0e790c6436de6d1d7d1c3feb3083e0e", "score": "0.46995914", "text": "func Accounts(login string) {\n\tvar count, number int\n\tvar email, name string\n\tvar balance float32\n\tfmt.Printf(\"%-30v\", \"Login:\")\n\tfmt.Printf(\"%-20v\", \"Account Type:\")\n\tfmt.Printf(\"%-20v\", \"Balance:\")\n\tfmt.Printf(\"%-20v\", \" ID:\")\n\tfmt.Println()\n\tfmt.Print(\"================================================\")\n\tfmt.Println(\"==============================================\")\n\n\tsqlStatement := \"\"\n\tif login == \"\" {\n\t\tsqlStatement = `select * from account order by acc_id asc`\n\t\trows, _ := (database.DB).Query(sqlStatement)\n\t\tfor rows.Next() {\n\t\t\t// count variable used as empty table error checker\n\t\t\tcount++\n\t\t\trows.Scan(&email, &name, &balance, &number)\n\t\t\tfmt.Printf(\"%-30v\", email)\n\t\t\tfmt.Printf(\"%-20v$\", name)\n\t\t\ts := fmt.Sprintf(\"%.2f\", balance)\n\t\t\tfmt.Printf(\"%-20v\", s)\n\t\t\tfmt.Printf(\"%-20v\", number)\n\t\t\tfmt.Println()\n\t\t}\n\t} else {\n\t\tsqlStatement = `select * from account where email = $1`\n\t\trows, _ := (database.DB).Query(sqlStatement, login)\n\t\tfor rows.Next() {\n\t\t\t// count variable used as empty table error checker\n\t\t\tcount++\n\t\t\trows.Scan(&email, &name, &balance, &number)\n\t\t\tfmt.Printf(\"%-30v\", email)\n\t\t\tfmt.Printf(\"%-20v$\", name)\n\t\t\ts := fmt.Sprintf(\"%.2f\", balance)\n\t\t\tfmt.Printf(\"%-20v\", s)\n\t\t\tfmt.Printf(\"%-20v\", number)\n\t\t\tfmt.Println()\n\t\t}\n\t}\n\n\tif count == 0 {\n\t\tfmt.Println(\"No Data in Table\")\n\t}\n\n\tfmt.Print(\"================================================\")\n\tfmt.Println(\"==============================================\")\n\tfmt.Println()\n}", "title": "" }, { "docid": "ff02eece26aa54976cb17073150e5bd8", "score": "0.46971142", "text": "func UserReport(w http.ResponseWriter, r *http.Request) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tCheck(\"userreport\", \"POST\", w, r)\n\n\tvar res model.ResponseResult\n\tvar id model.UserReportId\n\tvar ur model.UserReport\n\tvar sd model.StockData\n\t//var user model.User2\n\tvar order model.Order\n\n\tbody, _ := ioutil.ReadAll(r.Body)\n\terr := json.Unmarshal(body, &id)\n\n\terr = query.FindoneID(\"orders\", id.Id, \"_id\").Decode(&order)\n\tif err != nil {\n\t\tres.Error = err.Error()\n\t\tjson.NewEncoder(w).Encode(res)\n\t\treturn\n\t}\n\n\terr = query.FindoneID(\"products\", order.P_id, \"_id\").Decode(&sd)\n\tif err != nil {\n\t\tres.Error = err.Error()\n\t\tjson.NewEncoder(w).Encode(res)\n\t\treturn\n\t}\n\n\tprice, rent, count, duration, totalPrice, profit, totalRent := 0, 0, 0, 0, 0, 0, 0\n\tprice = sd.Price\n\trent = order.Rent\n\tcount = order.Count\n\tduration = order.Duration\n\ttotalPrice = price * count\n\ttotalRent = rent * count * duration\n\tprofit = totalPrice - totalRent\n\n\tpaid := len(order.PayDates) * rent * count\n\tpayable := totalRent - paid\n\n\tdue := order.Due\n\n\tur.Name = sd.Name\n\tur.Paid = paid\n\tur.Payable = payable\n\n\tur.Profit = profit\n\tur.TotalRent = totalRent\n\tur.TotalPrice = totalPrice\n\tur.Due = due\n\n\tfmt.Println(\"len(order.PayDates)\", len(order.PayDates))\n\n\tur.LastPaymentDate = order.PayDates[len(order.PayDates)-1]\n\tur.NextPaymentDate = order.PayDates[len(order.PayDates)-1].AddDate(0, 1, 0)\n\n\tfmt.Println(\"\\npaid :\", paid, \" payable : \", payable, \" due :\", due)\n\tjson.NewEncoder(w).Encode(ur)\n\n\tfmt.Println(\"UR is \", ur)\n\n}", "title": "" }, { "docid": "d5899d85beafaeebde6278187e8a49f8", "score": "0.4666265", "text": "func (s *SmartContract) displayInvoices(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\tstartKey := \"IN0\"\n\tendKey := \"IN999\"\n\n\tresultsIterator, err := APIstub.GetStateByRange(startKey, endKey)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\n\t// buffer is a JSON array containing QueryResults\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tbArrayMemberAlreadyWritten := false\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t// Add a comma before array members, suppress it for the first array member\n\t\tif bArrayMemberAlreadyWritten == true {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\tbuffer.WriteString(\"{\\\"Invoice\\\":\")\n\t\tbuffer.WriteString(\"\\\"\")\n\t\tbuffer.WriteString(queryResponse.Key)\n\t\tbuffer.WriteString(\"\\\"\")\n\n\t\tbuffer.WriteString(\", \\\"Record\\\":\")\n\t\t// Record is a JSON object, so we write as-is\n\t\tbuffer.WriteString(string(queryResponse.Value))\n\t\tbuffer.WriteString(\"}\")\n\t\tbArrayMemberAlreadyWritten = true\n\t}\n\tbuffer.WriteString(\"]\")\n\n\tfmt.Printf(\"- displayInvoices:\\n%s\\n\", buffer.String())\n\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "59c88fbc202021c4b9ae18c12a59636a", "score": "0.4663979", "text": "func Report(rpt *rpc.Report) {\n\t//TODO\n}", "title": "" }, { "docid": "83a647a2e823bc3882f0c20e512e7111", "score": "0.4650524", "text": "func (_VipnodePool *VipnodePoolCallerSession) Accounts(arg0 common.Address) (struct {\n\tBalance *big.Int\n\tTimeLocked *big.Int\n}, error) {\n\treturn _VipnodePool.Contract.Accounts(&_VipnodePool.CallOpts, arg0)\n}", "title": "" }, { "docid": "cc975c181e5f8b4318eed8762d18b018", "score": "0.46369585", "text": "func GetAllInvoicesInRange(ctx context.Context, bid int64, d1, d2 *time.Time) ([]Invoice, error) {\n\n\tvar (\n\t\terr error\n\t\tt []Invoice\n\t)\n\n\t// session... context\n\tif !(RRdb.noAuth && AppConfig.Env != extres.APPENVPROD) {\n\t\t_, ok := SessionFromContext(ctx)\n\t\tif !ok {\n\t\t\treturn t, ErrSessionRequired\n\t\t}\n\t}\n\n\tvar rows *sql.Rows\n\tfields := []interface{}{bid, d1, d2}\n\tif tx, ok := DBTxFromContext(ctx); ok { // if transaction is supplied\n\t\tstmt := tx.Stmt(RRdb.Prepstmt.GetAllInvoicesInRange)\n\t\tdefer stmt.Close()\n\t\trows, err = stmt.Query(fields...)\n\t} else {\n\t\trows, err = RRdb.Prepstmt.GetAllInvoicesInRange.Query(fields...)\n\t}\n\n\tif err != nil {\n\t\treturn t, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar a Invoice\n\t\terr = ReadInvoices(rows, &a)\n\t\tif err != nil {\n\t\t\treturn t, err\n\t\t}\n\n\t\ta.A, err = GetInvoiceAssessments(ctx, a.InvoiceNo)\n\t\tif err != nil {\n\t\t\treturn t, err\n\t\t}\n\n\t\ta.P, err = GetInvoicePayors(ctx, a.InvoiceNo)\n\t\tt = append(t, a)\n\t\tif err != nil {\n\t\t\treturn t, err\n\t\t}\n\t}\n\n\treturn t, rows.Err()\n}", "title": "" }, { "docid": "3273fdc7573ed9ca39f1ae3991c402d2", "score": "0.4627549", "text": "func GetAllAccounts(c *gin.Context) {\n\tcollection := config.DB.Collection(\"accounts\")\n\n\tfindOptions := options.Find()\n\tvar results []*models.Account\n\n\tcur, err := collection.Find(config.CTX, bson.M{}, findOptions)\n\n\tif err != nil {\n\t\tc.JSON(404, gin.H{\n\t\t\t\"status\": \"error\",\n\t\t\t\"message\": err})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tfor cur.Next(config.CTX) {\n\t\t// create a value into which the single document can be decoded\n\t\tvar elem models.Account\n\t\terr := cur.Decode(&elem)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tresults = append(results, &elem)\n\t}\n\n\t// Return JSON\n\tc.JSON(200, gin.H{\n\t\t\"status\": \"success\",\n\t\t\"message\": \"Berhasil menampilkan semua data Bank Account\",\n\t\t\"data\": results,\n\t})\n}", "title": "" }, { "docid": "8a5274b150b36095cf8db76933da6e35", "score": "0.46191567", "text": "func GenerateItemPrintReports() {\n\n\tschools, err := getSchoolsList()\n\tif err != nil {\n\t\tlog.Fatalln(\"Cannot connect to naprrql server: \", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runItemPrintReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating item printing reports: \", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "05cd6d867c1b0e2461cf6c0e5359927b", "score": "0.46154508", "text": "func (vk *VK) UsersReport(params Params) (response int, err error) {\n\terr = vk.RequestUnmarshal(\"users.report\", &response, params)\n\treturn\n}", "title": "" }, { "docid": "8369235761c10a330dcded6e7d9b1279", "score": "0.46102178", "text": "func (o GetReportPlanReportSettingOutput) Accounts() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetReportPlanReportSetting) []string { return v.Accounts }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "6b20daed5ff5aaa01c3cdb1a24f90491", "score": "0.4606166", "text": "func GenerateReports() {\n\n\tschools, err := getSchoolsList()\n\tif err != nil {\n\t\tlog.Fatalln(\"Cannot connect to naprrql server: \", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runSchoolReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error creating school reports: \", err)\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runSystemReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error creating system reports: \", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "dfb7233c48e4a8120e7ad5256e7fab0c", "score": "0.45954093", "text": "func NewAccountCollector(client linodego.Client) *AccountCollector {\n\tlog.Println(\"[NewAccountCollector] Entered\")\n\tsubsystem := \"account\"\n\tlabelKeys := []string{\"company\", \"email\"}\n\treturn &AccountCollector{\n\t\tclient: client,\n\n\t\tBalance: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, subsystem, \"balance\"),\n\t\t\t\"Balance of account\",\n\t\t\tlabelKeys,\n\t\t\tnil,\n\t\t),\n\t\t// Uninvoiced: prometheus.NewDesc(\n\t\t// \tprometheus.BuildFQName(namespace, subsystem, \"uninvoiced\"),\n\t\t// \t\"Uninvoiced balance of account\",\n\t\t// \tlabelKeys,\n\t\t// \tnil,\n\t\t// ),\n\t}\n}", "title": "" }, { "docid": "c507d9130bb0a022b07fd9d2fce0839c", "score": "0.45906615", "text": "func (stat *generateStats) report() {\n\tstat.lock.RLock()\n\tdefer stat.lock.RUnlock()\n\n\tctx := []interface{}{\n\t\t\"accounts\", stat.accounts,\n\t\t\"slots\", stat.slots,\n\t\t\"elapsed\", common.PrettyDuration(time.Since(stat.start)),\n\t}\n\tif stat.accounts > 0 {\n\t\t// If there's progress on the account trie, estimate the time to finish crawling it\n\t\tif done := binary.BigEndian.Uint64(stat.head[:8]) / stat.accounts; done > 0 {\n\t\t\tvar (\n\t\t\t\tleft = (math.MaxUint64 - binary.BigEndian.Uint64(stat.head[:8])) / stat.accounts\n\t\t\t\tspeed = done/uint64(time.Since(stat.start)/time.Millisecond+1) + 1 // +1s to avoid division by zero\n\t\t\t\teta = time.Duration(left/speed) * time.Millisecond\n\t\t\t)\n\t\t\t// If there are large contract crawls in progress, estimate their finish time\n\t\t\tfor acc, head := range stat.slotsHead {\n\t\t\t\tstart := stat.slotsStart[acc]\n\t\t\t\tif done := binary.BigEndian.Uint64(head[:8]); done > 0 {\n\t\t\t\t\tvar (\n\t\t\t\t\t\tleft = math.MaxUint64 - binary.BigEndian.Uint64(head[:8])\n\t\t\t\t\t\tspeed = done/uint64(time.Since(start)/time.Millisecond+1) + 1 // +1s to avoid division by zero\n\t\t\t\t\t)\n\t\t\t\t\t// Override the ETA if larger than the largest until now\n\t\t\t\t\tif slotETA := time.Duration(left/speed) * time.Millisecond; eta < slotETA {\n\t\t\t\t\t\teta = slotETA\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tctx = append(ctx, []interface{}{\n\t\t\t\t\"eta\", common.PrettyDuration(eta),\n\t\t\t}...)\n\t\t}\n\t}\n\tlog.Info(\"Iterating state snapshot\", ctx...)\n}", "title": "" }, { "docid": "cfa0f4fab98fc115061aea9d07de2ca7", "score": "0.45702153", "text": "func (o ReportPlanReportSettingOutput) Accounts() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ReportPlanReportSetting) []string { return v.Accounts }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "497a90159690d1ba9036644b4ad48671", "score": "0.4560871", "text": "func GetReport(userID int, startDate string, endDate string) gin.H {\n\tdb, err := sql.Open(config.Mysql, config.Dbconnection)\n\n\tif err != nil {\n\t\treturn Response(DatabaseConnectionError, err.Error(), nil)\n\t}\n\tdefer db.Close()\n\n\tquery := \"SELECT id, user_id, date, description, debit, credit, balance, time FROM transaction WHERE user_id=?\"\n\tif startDate != \"\" {\n\t\tquery += \" AND date>='\" + startDate + \"'\"\n\t}\n\tif endDate != \"\" {\n\t\tquery += \" AND date<='\" + endDate + \"'\"\n\t}\n\tquery += \" ORDER BY id DESC\"\n\tresults, err := db.Query(query, userID)\n\t\n\tif err != nil {\n\t\treturn Response(DatabaseError, err.Error(), nil)\n\t}\n\n\tvar items []Transaction\n\n\tfor results.Next() {\n var item Transaction\n // for each row, scan the result into our tag composite object\n err = results.Scan(&item.ID, &item.UserID, &item.Date, &item.Description, &item.Debit, &item.Credit, &item.Balance, &item.Time)\n if err != nil {\n return Response(DatabaseError, err.Error(), nil)\n\t\t}\n\t\t\n\t\titems = append(items, item)\n\t}\n\t\n\treturn Response(Success, \"\", map[string]interface{}{\n\t\t\"count\" : len(items),\n\t\t\"entries\" : items,\n\t})\n}", "title": "" }, { "docid": "c6ae442d6559ad6a0f954b0305946a44", "score": "0.45607293", "text": "func (_VipnodePool *VipnodePoolSession) Accounts(arg0 common.Address) (struct {\n\tBalance *big.Int\n\tTimeLocked *big.Int\n}, error) {\n\treturn _VipnodePool.Contract.Accounts(&_VipnodePool.CallOpts, arg0)\n}", "title": "" }, { "docid": "0b7445c4826a369147049f847891e8d6", "score": "0.4556512", "text": "func SvcSearchHandlerGLAccounts(w http.ResponseWriter, r *http.Request, d *ServiceData) {\n\tfmt.Printf(\"Entered SvcSearchHandlerGLAccounts\\n\")\n\tvar p rlib.GLAccount\n\tvar err error\n\tvar g struct {\n\t\tStatus string `json:\"status\"`\n\t\tTotal int64 `json:\"total\"`\n\t\tRecords []rlib.GLAccount `json:\"records\"`\n\t}\n\n\tsrch := fmt.Sprintf(\"BID=%d\", d.BID) // default WHERE clause\n\torder := \"GLNumber ASC, Name ASC\" // default ORDER\n\tq, qw := gridBuildQuery(\"GLAccount\", srch, order, d, &p)\n\n\t// set g.Total to the total number of rows of this data...\n\tg.Total, err = GetRowCount(\"GLAccount\", qw)\n\tif err != nil {\n\t\tfmt.Printf(\"Error from GetRowCount: %s\\n\", err.Error())\n\t\tSvcGridErrorReturn(w, err)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"db query = %s\\n\", q)\n\n\trows, err := rlib.RRdb.Dbrr.Query(q)\n\trlib.Errcheck(err)\n\tdefer rows.Close()\n\n\ti := d.webreq.Offset\n\tcount := 0\n\tfor rows.Next() {\n\t\tvar p rlib.GLAccount\n\t\trlib.ReadGLAccounts(rows, &p)\n\t\tp.Recid = i\n\t\tg.Records = append(g.Records, p)\n\t\tcount++ // update the count only after adding the record\n\t\tif count >= d.webreq.Limit {\n\t\t\tbreak // if we've added the max number requested, then exit\n\t\t}\n\t\ti++ // update the index no matter what\n\t}\n\n\trlib.Errcheck(rows.Err())\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tg.Status = \"success\"\n\tSvcWriteResponse(&g, w)\n}", "title": "" }, { "docid": "565e184759a8f6d6886ed67e1b10f2bc", "score": "0.45456013", "text": "func getOrganizationAccounts(config config.Config) map[string]string {\n\t// Create organization service client\n\tvar c Clients\n\tsvc := c.Organization(config.Region, config.MasterAccountID, config.OrganizationRole)\n\t// Create variable for the list of accounts and initialize input\n\torganizationAccounts := make(map[string]string)\n\tinput := &organizations.ListAccountsInput{}\n\t// Start a do-while loop\n\tfor {\n\t\t// Retrieve the accounts with a limit of 20 per call\n\t\torganizationAccountsPaginated, err := svc.ListAccounts(input)\n\t\t// Append the accounts from the current call to the total list\n\t\tfor _, account := range organizationAccountsPaginated.Accounts {\n\t\t\torganizationAccounts[*account.Name] = *account.Id\n\t\t}\n\t\tcheckError(\"Could not retrieve account list\", err)\n\t\t// Check if more accounts need to be retrieved using api token, otherwise break the loop\n\t\tif organizationAccountsPaginated.NextToken == nil {\n\t\t\tbreak\n\t\t} else {\n\t\t\tinput = &organizations.ListAccountsInput{NextToken: organizationAccountsPaginated.NextToken}\n\t\t}\n\t}\n\treturn organizationAccounts\n}", "title": "" }, { "docid": "f32dd6faa54390b22f18327b54d50cc2", "score": "0.4513756", "text": "func generateExcelReport(timestamp, folder string) {\n\tvar (\n\t\tfile *xlsx.File\n\t\tsheet *xlsx.Sheet\n\t\trow *xlsx.Row\n\t\tcell *xlsx.Cell\n\t\theaderStyle *xlsx.Style\n\t\tdataStyle *xlsx.Style\n\t\terr error\n\t)\n\n\tfile = xlsx.NewFile()\n\n\t// create sheets\n\tsheet, err = file.AddSheet(\"links\")\n\tif err != nil {\n\t\tfmt.Printf(err.Error())\n\t}\n\tsheet.SetColWidth(0, 0, 15)\n\tsheet.SetColWidth(1, 1, 60)\n\tsheet.SetColWidth(2, 2, 60)\n\tsheet.SetColWidth(3, 3, 10)\n\tsheet.SetColWidth(4, 4, 50)\n\n\t// setup style\n\theaderStyle = xlsx.NewStyle()\n\theaderStyle.Font.Bold = true\n\theaderStyle.Font.Name = \"Calibri\"\n\theaderStyle.Font.Size = 11\n\theaderStyle.Alignment.Horizontal = \"center\"\n\theaderStyle.Border.Top = \"thin\"\n\theaderStyle.Border.Bottom = \"thin\"\n\theaderStyle.Border.Right = \"thin\"\n\theaderStyle.Border.Left = \"thin\"\n\n\tdataStyle = xlsx.NewStyle()\n\tdataStyle.Font.Name = \"Calibri\"\n\tdataStyle.Font.Size = 11\n\n\t// header internal sheet\n\trow = sheet.AddRow()\n\tcell = row.AddCell()\n\tcell.Value = \"index\"\n\tcell.SetStyle(headerStyle)\n\n\tcell = row.AddCell()\n\tcell.Value = \"cyberlocker_link\"\n\tcell.SetStyle(headerStyle)\n\n\tcell = row.AddCell()\n\tcell.Value = \"illegal_website_pagetitle\"\n\tcell.SetStyle(headerStyle)\n\n\tcell = row.AddCell()\n\tcell.Value = \"licensor\"\n\tcell.SetStyle(headerStyle)\n\n\tcell = row.AddCell()\n\tcell.Value = \"site_url\"\n\tcell.SetStyle(headerStyle)\n\n\tdata := readFileIntoList(folder + \"/debug\")\n\n\tfor i, v := range data {\n\t\t// [0] = cyberlockerLink; [1] = pageTitle; [2] = licensor; [3] = siteUrl\n\t\tvalues := strings.Split(v, \"\\t\")\n\t\tif len(values) < 4 {\n\t\t\tcontinue\n\t\t}\n\n\t\tpagetitle := values[1]\n\t\tlicensor := values[2]\n\t\tsiteUrl := values[0]\n\t\tcyberlockerLink := values[3]\n\n\t\tthisRow := sheet.AddRow()\n\n\t\t// index\n\t\tthisCell := thisRow.AddCell()\n\t\tthisCell.Value = strconv.Itoa(i)\n\t\tthisCell.SetStyle(headerStyle)\n\n\t\t// cyberlockerLink\n\t\tthisCell = thisRow.AddCell()\n\t\tthisCell.Value = cyberlockerLink\n\t\tthisCell.SetStyle(dataStyle)\n\n\t\t// pageTitle\n\t\tthisCell = thisRow.AddCell()\n\t\tthisCell.Value = pagetitle\n\t\tthisCell.SetStyle(dataStyle)\n\n\t\t// licensor\n\t\tthisCell = thisRow.AddCell()\n\t\tthisCell.Value = licensor\n\t\tthisCell.SetStyle(dataStyle)\n\n\t\t// siteUrl\n\t\tthisCell = thisRow.AddCell()\n\t\tthisCell.Value = siteUrl\n\t\tthisCell.SetStyle(dataStyle)\n\n\t}\n\n\terr = file.Save(fmt.Sprintf(folder+\"/report_%s.xlsx\", timestamp))\n\tif err != nil {\n\t\tfmt.Printf(err.Error())\n\t}\n}", "title": "" }, { "docid": "49e372fb4d4c0273fe4e01c62f616a89", "score": "0.45113948", "text": "func ListAccounts(p *requestParams) {\n\t// Unwrap requestParams for easy access.\n\tw, c, u := p.w, p.c, p.u\n\n\tq := datastore.NewQuery(\"Account\").Ancestor(userKey(c, u)).Order(\"Name\")\n\t// We make an empty slice so we can return [] if there are no accounts.\n\taccounts := make([]transaction.Account, 0)\n\tkeys, err := q.GetAll(c, &accounts)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresult := make([]DatastoreAccount, len(accounts))\n\tfor i := range keys {\n\t\tresult[i].Account = &accounts[i]\n\t\tresult[i].IntID = keys[i].IntID()\n\t}\n\n\te := json.NewEncoder(w)\n\terr = e.Encode(result)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "7a8d301cccf7a25e8af0a57ae1d79eba", "score": "0.4502385", "text": "func (a *Auditor) statsReport() {\n\tnow := time.Now()\n\ttotal := float64(now.Sub(a.passStart)) / float64(time.Second)\n\tsinceLast := float64(now.Sub(a.lastLog)) / float64(time.Second)\n\tfrate := float64(a.passes) / sinceLast\n\tbrate := float64(a.bytesProcessed) / sinceLast\n\taudit := 0.0 // TODO maybe\n\taudit_rate := 0.0 // TODO maybe\n\ta.logger.Info(\"statsReport\",\n\t\tzap.String(\"Object audit\", a.auditorType),\n\t\tzap.String(\"Since\", a.lastLog.Format(time.ANSIC)),\n\t\tzap.Int64(\"Locally passed\", a.passes),\n\t\tzap.Int64(\"Locally quarantied\", a.quarantines),\n\t\tzap.Int64(\"Locally errored\", a.errors),\n\t\tzap.Float64(\"files/sec\", frate),\n\t\tzap.Float64(\"bytes/sec\", brate),\n\t\tzap.Float64(\"Total time\", total),\n\t\tzap.Float64(\"Auditing Time\", audit),\n\t\tzap.Float64(\"Auditing Rate\", audit_rate))\n\n\tmiddleware.DumpReconCache(a.reconCachePath, \"object\",\n\t\tmap[string]interface{}{\"object_auditor_stats_\" + a.auditorType: map[string]interface{}{\n\t\t\t\"errors\": a.errors,\n\t\t\t\"passes\": a.passes,\n\t\t\t\"quarantined\": a.quarantines,\n\t\t\t\"bytes_processed\": a.bytesProcessed,\n\t\t\t\"start_time\": float64(a.passStart.UnixNano()) / float64(time.Second), //???\n\t\t\t\"audit_time\": audit,\n\t\t}})\n\ta.passes = 0\n\ta.quarantines = 0\n\ta.errors = 0\n\ta.bytesProcessed = 0\n\ta.lastLog = now\n}", "title": "" }, { "docid": "7b6f93781353622c7cf401dca34711b2", "score": "0.45015493", "text": "func (b *Builder) AccountList() ([]spn.Account, error) {\n\treturn b.spnclient.AccountList()\n}", "title": "" }, { "docid": "27ab84656df43a1d9f18c794c1976cfb", "score": "0.45009527", "text": "func (t *Invoices) getAllFilInvoice(stub shim.ChaincodeStubInterface, args []string) pb.Response {\r\n\r\n\tif len(args) != 0 {\r\n\t\treturn shim.Error(\"No arguements required\")\r\n }\r\n \r\n\tvar jsonResp, errResp string\r\n\tvar err error\r\n\tvar InvoiceIndex []string\r\n\r\n\tfmt.Println(\"- start getAllFilInvoice\")\r\n\tInvoice_Bytes, err := stub.GetState(InvIndexStr)\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Failed to get Fil Invoice Request index\")\r\n\t}\r\n\tfmt.Print(\"Invoice_Bytes : \")\r\n\tfmt.Println(Invoice_Bytes)\r\n\tjson.Unmarshal(Invoice_Bytes, &InvoiceIndex)\t\t//unstringify it aka JSON.parse()\r\n\tfmt.Print(\"InvoiceIndex : \")\r\n\tfmt.Println(InvoiceIndex)\r\n\tfmt.Println(\"len(InvoiceIndex) : \")\r\n\tfmt.Println(len(InvoiceIndex))\r\n\tjsonResp = \"[\"\r\n\tfor i,val := range InvoiceIndex{\r\n\t\t//fmt.Println(strconv.Itoa(i) + \" - looking at \" + val + \" for all Reg request\")\r\n\t\tvalueAsBytes, err := stub.GetState(val)\r\n\t\tif err != nil {\r\n\t\t\terrResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + val + \"\\\"}\"\r\n\t\t\treturn shim.Error(errResp)\r\n }\r\n \r\n invoice := Invoice{}\r\n json.Unmarshal(valueAsBytes, &invoice)\r\n \r\n\t\tfmt.Print(\"invoice : \")\r\n\t\tfmt.Println(invoice)\r\n // jsonResp = jsonResp + \"\\\"\"+ val + \"\\\":\" + string(valueAsBytes[:])\r\n // temp =\"{\\\"From_Currency\\\":\"+invoice.E1edk01_curcy+\",\\\"To_Currency:\\\"+\r\n temp := FilDetails{\r\n From_Currency: invoice.E1edk01_curcy,\r\n To_Currency: invoice.E1edk01_hwaer,\r\n Daily_Rate: invoice.E1edk01_wkurs,\r\n Invoice_Number: invoice.E1edk01_belnr,\r\n PO_Number: invoice.E1edp01_e1edp02_belnr,\r\n Transaction_Hash: invoice.Transaction_hash,\r\n }\r\n //var jsonData []byte\r\n jsonData, err := json.Marshal(temp)\r\n if err != nil {\r\n fmt.Println(err)\r\n }\r\n fmt.Println(string(jsonData))\r\n jsonResp = jsonResp + string(jsonData[:])\r\n\t\tif i < len(InvoiceIndex)-1 {\r\n\t\t\tjsonResp = jsonResp + \",\"\r\n\t\t}\r\n\t}\r\n\tjsonResp = jsonResp + \"]\"\r\n\tfmt.Println(\"jsonResp : \" + jsonResp)\r\n\tfmt.Println(\"end getAllFilInvoice\")\r\n\ttosend := \"Event send\"\r\n err = stub.SetEvent(\"evtsender\", []byte(tosend))\r\n if err != nil {\r\n return shim.Error(err.Error())\r\n }\r\n\treturn shim.Success([]byte(jsonResp))\r\n}", "title": "" }, { "docid": "3580bc7e6071c7d7020a2571b329d39a", "score": "0.4488768", "text": "func ListAccounts() string {\n\tlist := \"Accounts:\\n\"\n\tfor _, v := range accounts {\n\t\tlist += fmt.Sprintf(\"Account: %s, balance: %d\\n\", v.Name, v.Bal)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "dc4ba9d80aef2bc91a7806066546eae8", "score": "0.44832507", "text": "func (s *Service) ReportList(c context.Context, page, size int64, start, end, order, sort, keyword string, tid, rpID, state, upOp []int64, rt *model.Report) (rtList *model.ReportList, err error) {\n\tvar (\n\t\taidMap = make(map[int64]bool)\n\t\taids []int64\n\t\tcidDmids = make(map[int64][]int64)\n\t\tstateMap = make(map[int64]int64)\n\t)\n\trptSearch, err := s.dao.SearchReport(c, page, size, start, end, order, sort, keyword, tid, rpID, state, upOp, rt)\n\tif err != nil {\n\t\tlog.Error(\"s.dao.SearchReport() error(%v)\", err)\n\t\treturn\n\t}\n\tfor _, v := range rptSearch.Result {\n\t\taidMap[v.Aid] = true\n\t\tcidDmids[v.Cid] = append(cidDmids[v.Cid], v.Did)\n\t}\n\tfor aid := range aidMap {\n\t\taids = append(aids, aid)\n\t}\n\tarchives, err := s.archiveInfos(c, aids)\n\tif err != nil {\n\t\tlog.Error(\"s.archives(%v) error(%v)\", aids, err)\n\t\treturn\n\t}\n\tif stateMap, err = s.dmState(c, cidDmids); err != nil {\n\t\treturn\n\t}\n\tfor _, v := range rptSearch.Result {\n\t\tv.DidStr = strconv.FormatInt(v.Did, 10)\n\t\tif arc, ok := archives[v.Aid]; ok {\n\t\t\tv.Title = arc.Title\n\t\t}\n\t\tif state, ok := stateMap[v.Did]; ok {\n\t\t\tv.Deleted = state\n\t\t}\n\t}\n\trtList = &model.ReportList{\n\t\tCode: rptSearch.Code,\n\t\tOrder: rptSearch.Order,\n\t\tPage: rptSearch.Page.Num,\n\t\tPageSize: rptSearch.Page.Size,\n\t\tPageCount: (rptSearch.Page.Total-1)/rptSearch.Page.Size + 1,\n\t\tTotal: rptSearch.Page.Total,\n\t\tResult: rptSearch.Result,\n\t}\n\treturn\n}", "title": "" }, { "docid": "7ff0b265a68ca38a393ffbc0f668a2d5", "score": "0.44829854", "text": "func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\tpatients := []Patient{\n\t\tPatient{Id: \"1\", CPF: \"84532652098\", Name: \"Pedro Sousa Meireles\", Sex: \"M\", Phone: \"21933000494\", Email: \"psmeireles25@gmail.com\", Height: \"175\", Weight: \"61\", Age: \"22\", BloodType: \"A+\", Doctors: []string{}, Exams: []string{}, Enterprises: []string{}},\n\t\tPatient{Id: \"2\", CPF: \"29847293956\", Name: \"José da Silva\", Sex: \"M\", Phone: \"2112345678\", Email: \"josesilva@gmail.com\", Height: \"185\", Weight: \"91\", Age: \"65\", BloodType: \"A+\", Doctors: []string{}, Exams: []string{}, Enterprises: []string{}},\n\t\tPatient{Id: \"3\", CPF: \"23485292659\", Name: \"Rafael Cabral\", Sex: \"M\", Phone: \"2294874938\", Email: \"rafarubim@gmail.com\", Height: \"175\", Weight: \"71\", Age: \"21\", BloodType: \"A+\", Doctors: []string{}, Exams: []string{}, Enterprises: []string{}},\n\t\tPatient{Id: \"4\", CPF: \"98436939758\", Name: \"Luiza Lima\", Sex: \"F\", Phone: \"11938427583\", Email: \"lulima@gmail.com\", Height: \"160\", Weight: \"51\", Age: \"36\", BloodType: \"AB+\", Doctors: []string{}, Exams: []string{}, Enterprises: []string{}},\n\t\tPatient{Id: \"5\", CPF: \"64934875378\", Name: \"Antônia Meira\", Sex: \"F\", Phone: \"21929384938\", Email: \"tonya@gmail.com\", Height: \"165\", Weight: \"70\", Age: \"52\", BloodType: \"O-\", Doctors: []string{}, Exams: []string{}, Enterprises: []string{}},\n\t}\n\n\tdoctors := []Doctor{\n\t\tDoctor{Id: \"82029156787\", CRM: \"512974\", CPF: \"82029156787\", Name: \"Carla Eliane Carvalho de Sousa\", Phone: \"21999839210\", Email: \"carla.sousa@uol.com.br\", Patients: []string{}, Exams: []string{}},\n\t\tDoctor{Id: \"82029156788\", CRM: \"640816\", CPF: \"82029156788\", Name: \"Claudio Luiz Bastos Bragança\", Phone: \"21999839210\", Email: \"claudio.braganca@uol.com.br\", Patients: []string{}, Exams: []string{}},\n\t}\n\n\ti := 0\n\tfor i < len(patients) {\n\t\tfmt.Println(\"i is \", i)\n\t\tpatientAsBytes, _ := json.Marshal(patients[i])\n\t\tAPIstub.PutState(patients[i].Id, patientAsBytes)\n\t\tfmt.Println(\"Added\", patients[i])\n\t\ti = i + 1\n\t}\n\n\ti = 0\n\tfor i < len(doctors) {\n\t\tfmt.Println(\"i is \", i)\n\t\tdoctorAsBytes, _ := json.Marshal(doctors[i])\n\t\tAPIstub.PutState(doctors[i].Id, doctorAsBytes)\n\t\tfmt.Println(\"Added\", doctors[i])\n\t\ti = i + 1\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "d8a97d6ca5ab77bffe139dc28e31391f", "score": "0.4481994", "text": "func GenerateXMLReports() {\n\n\tschools, err := getSchoolsList()\n\tif err != nil {\n\t\tlog.Fatalln(\"Cannot connect to naprrql server: \", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runXMLReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating xml reports: \", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "2034b281ce2319a3f9ee3d80798efb05", "score": "0.44746548", "text": "func (yh *YnabHelper) ListAccounts(budgetName string) error {\n\tvar output []string\n\n\tbudget, err := yh.getBudgetByName(budgetName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc := ynab.NewClient(yh.BearerToken)\n\taccounts, err := c.Account().GetAccounts(budget.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutput = append(output, \"Name|ID\")\n\tfor _, account := range accounts {\n\t\toutput = append(output, fmt.Sprintf(\"%s|%s\", account.Name, account.ID))\n\t}\n\n\tresult := columnize.SimpleFormat(output)\n\tfmt.Printf(\"%s\\n\\n\", result)\n\treturn nil\n}", "title": "" }, { "docid": "1921ad8681ad58da3d03f07fef8ecd52", "score": "0.44575194", "text": "func ExampleAccountsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armpurview.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.NewAccountsClient().Get(ctx, \"SampleResourceGroup\", \"account1\", 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.Account = armpurview.Account{\n\t// \tName: to.Ptr(\"account1\"),\n\t// \tType: to.Ptr(\"Microsoft.Purview/accounts\"),\n\t// \tID: to.Ptr(\"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1\"),\n\t// \tLocation: to.Ptr(\"West US 2\"),\n\t// \tSystemData: &armpurview.TrackedResourceSystemData{\n\t// \t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-11-22T18:39:58.6929344Z\"); return t}()),\n\t// \t\tCreatedBy: to.Ptr(\"client-name\"),\n\t// \t\tCreatedByType: to.Ptr(armpurview.CreatedByTypeUser),\n\t// \t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2021-03-16T23:24:34.3430059Z\"); return t}()),\n\t// \t\tLastModifiedBy: to.Ptr(\"client-name\"),\n\t// \t\tLastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser),\n\t// \t},\n\t// \tProperties: &armpurview.AccountProperties{\n\t// \t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-11-22T18:39:58.6929344Z\"); return t}()),\n\t// \t\tCreatedBy: to.Ptr(\"client-name\"),\n\t// \t\tCreatedByObjectID: to.Ptr(\"client-objectId\"),\n\t// \t\tEndpoints: &armpurview.AccountPropertiesEndpoints{\n\t// \t\t\tCatalog: to.Ptr(\"https://account1.catalog.purview.azure-test.com\"),\n\t// \t\t\tGuardian: to.Ptr(\"https://account1.guardian.purview.azure-test.com\"),\n\t// \t\t\tScan: to.Ptr(\"https://account1.scan.purview.azure-test.com\"),\n\t// \t\t},\n\t// \t\tFriendlyName: to.Ptr(\"friendly-account1\"),\n\t// \t\tManagedResourceGroupName: to.Ptr(\"managed-rg-mwjotkl\"),\n\t// \t\tManagedResources: &armpurview.AccountPropertiesManagedResources{\n\t// \t\t\tEventHubNamespace: to.Ptr(\"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp\"),\n\t// \t\t\tResourceGroup: to.Ptr(\"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl\"),\n\t// \t\t\tStorageAccount: to.Ptr(\"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr\"),\n\t// \t\t},\n\t// \t\tPrivateEndpointConnections: []*armpurview.PrivateEndpointConnection{\n\t// \t\t\t{\n\t// \t\t\t\tName: to.Ptr(\"peName-8536c337-7b36-4d67-a7ce-081655baf59e\"),\n\t// \t\t\t\tType: to.Ptr(\"Microsoft.Purview/accounts/privateEndpointConnections\"),\n\t// \t\t\t\tID: to.Ptr(\"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/peName-8536c337-7b36-4d67-a7ce-081655baf59e\"),\n\t// \t\t\t\tProperties: &armpurview.PrivateEndpointConnectionProperties{\n\t// \t\t\t\t\tPrivateEndpoint: &armpurview.PrivateEndpoint{\n\t// \t\t\t\t\t\tID: to.Ptr(\"/subscriptions/baca8a88-4527-4c35-a13e-b2775ce0d7fc/resourceGroups/nrpResourceGroupName/providers/Microsoft.Network/privateEndpoints/peName\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tPrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{\n\t// \t\t\t\t\t\tDescription: to.Ptr(\"Please approve my connection, thanks.\"),\n\t// \t\t\t\t\t\tActionsRequired: to.Ptr(\"None\"),\n\t// \t\t\t\t\t\tStatus: to.Ptr(armpurview.StatusPending),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tProvisioningState: to.Ptr(\"Succeeded\"),\n\t// \t\t\t\t},\n\t// \t\t}},\n\t// \t\tProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded),\n\t// \t\tPublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled),\n\t// \t},\n\t// \tSKU: &armpurview.AccountSKU{\n\t// \t\tName: to.Ptr(armpurview.NameStandard),\n\t// \t\tCapacity: to.Ptr[int32](1),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "3915733f00087917bafc17186144fe5a", "score": "0.44538984", "text": "func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Response {\n\tinvoice := []Invoice{\n\t\tInvoice{invoiceNumber: \"IN01\",\n\t\t\tbilledTo: \"Brendan\",\n\t\t\tinvoiceDate: \"01JAN2019\",\n\t\t\tinvoiceAmount: \"5000\",\n\t\t\titemDescription: \"Smartphone\",\n\t\t\tGR: \"N\",\n\t\t\tisPaid: \"N\",\n\t\t\tpaidAmount: \"0\",\n\t\t\trepaid: \"N\",\n\t\t\trepaymentAmount: \"0\"},\n\t}\n\n\ti := 0\n\tfor i < len(invoice) {\n\t\tfmt.Println(\"i is \", i)\n\t\tinvoiceAsBytes, _ := json.Marshal(invoice[i])\n\t\tAPIstub.PutState(\"INVOICE\"+strconv.Itoa(i), invoiceAsBytes)\n\t\tfmt.Println(\"Added\", invoice[i])\n\t\ti = i + 1\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "b65907b15dd75ab910bbade98b440b84", "score": "0.44338015", "text": "func (rrrc RequestReportRecordContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rrrc.APIID != nil {\n\t\tobjectMap[\"apiId\"] = rrrc.APIID\n\t}\n\tif rrrc.OperationID != nil {\n\t\tobjectMap[\"operationId\"] = rrrc.OperationID\n\t}\n\tif rrrc.Method != nil {\n\t\tobjectMap[\"method\"] = rrrc.Method\n\t}\n\tif rrrc.URL != nil {\n\t\tobjectMap[\"url\"] = rrrc.URL\n\t}\n\tif rrrc.IPAddress != nil {\n\t\tobjectMap[\"ipAddress\"] = rrrc.IPAddress\n\t}\n\tif rrrc.BackendResponseCode != nil {\n\t\tobjectMap[\"backendResponseCode\"] = rrrc.BackendResponseCode\n\t}\n\tif rrrc.ResponseCode != nil {\n\t\tobjectMap[\"responseCode\"] = rrrc.ResponseCode\n\t}\n\tif rrrc.ResponseSize != nil {\n\t\tobjectMap[\"responseSize\"] = rrrc.ResponseSize\n\t}\n\tif rrrc.Timestamp != nil {\n\t\tobjectMap[\"timestamp\"] = rrrc.Timestamp\n\t}\n\tif rrrc.Cache != nil {\n\t\tobjectMap[\"cache\"] = rrrc.Cache\n\t}\n\tif rrrc.APITime != nil {\n\t\tobjectMap[\"apiTime\"] = rrrc.APITime\n\t}\n\tif rrrc.ServiceTime != nil {\n\t\tobjectMap[\"serviceTime\"] = rrrc.ServiceTime\n\t}\n\tif rrrc.APIRegion != nil {\n\t\tobjectMap[\"apiRegion\"] = rrrc.APIRegion\n\t}\n\tif rrrc.SubscriptionID != nil {\n\t\tobjectMap[\"subscriptionId\"] = rrrc.SubscriptionID\n\t}\n\tif rrrc.RequestID != nil {\n\t\tobjectMap[\"requestId\"] = rrrc.RequestID\n\t}\n\tif rrrc.RequestSize != nil {\n\t\tobjectMap[\"requestSize\"] = rrrc.RequestSize\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c2ce5521bd251464e3cc867b909bd2d9", "score": "0.4432497", "text": "func (ch *Chain) CheckAccountLedger() {\n\ttotal := ch.GetTotalAssets()\n\taccs := ch.GetAccounts()\n\tsum := colored.NewBalances()\n\tfor i := range accs {\n\t\tacc := accs[i]\n\t\tbals := ch.GetAccountBalance(acc)\n\t\tbals.ForEachRandomly(func(col colored.Color, bal uint64) bool {\n\t\t\tsum.Add(col, bal)\n\t\t\treturn true\n\t\t})\n\t}\n\trequire.True(ch.Env.T, total.Equals(sum))\n\tcoreacc := iscp.NewAgentID(ch.ChainID.AsAddress(), root.Contract.Hname())\n\trequire.Zero(ch.Env.T, len(ch.GetAccountBalance(coreacc)))\n\tcoreacc = iscp.NewAgentID(ch.ChainID.AsAddress(), blob.Contract.Hname())\n\trequire.Zero(ch.Env.T, len(ch.GetAccountBalance(coreacc)))\n\tcoreacc = iscp.NewAgentID(ch.ChainID.AsAddress(), accounts.Contract.Hname())\n\trequire.Zero(ch.Env.T, len(ch.GetAccountBalance(coreacc)))\n\trequire.Zero(ch.Env.T, len(ch.GetAccountBalance(coreacc)))\n}", "title": "" }, { "docid": "cafb9782c9f0c9adff39138297e08bdc", "score": "0.4431325", "text": "func getECALAccountQuery(instanceEnv string, userEmail string, isAdmin bool) (string, error) {\n\t// inject the correct schema name into the query\n\tif len(instanceEnv) < 1 {\n\t\tthisError := fmt.Sprintf(\"instanceEnvironment query parameter is invalid (%s, %s, %s)\", instanceEnv, userEmail, strconv.FormatBool(isAdmin))\n\t\treturn \"\", errors.New(thisError)\n\t}\n\n\t// set the core query\n\tvar template = `\n\tSELECT DISTINCT(a.id) as AccountID, \n\t\tl.lookupdescription AS LOB, \n\t\ta.accountname as AccountName, \n\t\ta.createdby AS SolutionEngineer,\n\t\t(SELECT count(*) FROM %SCHEMA%.Opportunity o WHERE o.account = a.id) AS NumOpportunities\n\tFROM %SCHEMA%.User1 u \n\tINNER JOIN %SCHEMA%.UserAccount ua ON ua.user1 = u.id\n\tINNER JOIN %SCHEMA%.Account a ON a.id = ua.account\n\tINNER JOIN %SCHEMA%.Lookup l ON l.id = a.accountlob AND l.lookuptype = 'LOB'\t\n\t`\n\t// if the user is not an admin (regular user or manager) then append the hierarchical query suffix\n\tif isAdmin == false {\n\t\ttemplate += `\n\t\tWHERE u.useremail = :1 OR u.manager in \n\t\t(\n\t\tSELECT useremail \n\t\tFROM %SCHEMA%.User1 u \n\t\tINNER JOIN %SCHEMA%.RoleType r \n\t\tON u.rolename = r.id WHERE r.rolename = 'Manager' \n\t\tSTART WITH useremail = :1 \n\t\tCONNECT BY PRIOR useremail = manager\n\t\t)\n\t\t`\n\t}\n\n\t// append the order by\n\ttemplate += \"ORDER BY AccountName ASC\"\n\n\t// replace the %SCHEMA% template with the correct schema name\n\tquery := strings.ReplaceAll(template, \"%SCHEMA%\", SchemaMap[instanceEnv])\n\n\t// run the query\n\tvar rows *sql.Rows\n\tvar err error\n\tif isAdmin {\n\t\trows, err = DBPool.Query(query)\n\t} else {\n\t\trows, err = DBPool.Query(query, userEmail)\n\t}\n\tif err != nil {\n\t\tthisError := fmt.Sprintf(\"Error running query (%s, %s, %s): %s\", instanceEnv, userEmail, strconv.FormatBool(isAdmin), err.Error())\n\t\treturn \"\", errors.New(thisError)\n\t}\n\tdefer rows.Close()\n\n\t// vars to hold row results\n\tvar accountID, LOB, accountName, solutionEngineer, numOpportunities string\n\n\t// step through each row returned and add to the query filter using the correct format\n\tresult := \"\"\n\tcount := 0\n\tfor rows.Next() {\n\t\terr := rows.Scan(&accountID, &LOB, &accountName, &solutionEngineer, &numOpportunities)\n\t\tif err != nil {\n\t\t\tthisError := fmt.Sprintf(\"Error scanning row (%s, %s, %s): %s\", instanceEnv, userEmail, strconv.FormatBool(isAdmin), err.Error())\n\t\t\treturn \"\", errors.New(thisError)\n\t\t}\n\t\tresult += fmt.Sprintf(\"{\\\"AccountID\\\": %s, \\\"LOB\\\": \\\"%s\\\", \\\"AccountName\\\": \\\"%s\\\", \\\"SolutionEngineer\\\": \\\"%s\\\", \\\"NumOpportunities\\\": %s},\",\n\t\t\taccountID, LOB, accountName, solutionEngineer, numOpportunities)\n\t\tcount++\n\t}\n\n\t// string the trailing 'or' field if it exists\n\tresult = strings.TrimSuffix(result, \",\")\n\treturn result, nil\n}", "title": "" }, { "docid": "0f786d34ee5fd47edeac3aa9aef40636", "score": "0.44242907", "text": "func GetAllAccounts(ks *keystore.KeyStore) (result string) {\n\taccs := ks.Accounts()\n\tresult = \"|Account Number|Address|Hash|URL|\\n|:---|:---:|:---:|---:|\"\n\tfor idx, e := range accs {\n\t\tresult += fmt.Sprintf(\"|%d|%s|%s|%s|\\n\", idx, e.Address.Hex(),e.Address.Hash().String(), e.URL.String())\n\t}\n\treturn\n}", "title": "" }, { "docid": "b16d2efd9a684fb040e1764a60f8ecf3", "score": "0.4423599", "text": "func accounts(w http.ResponseWriter, r *http.Request) {\n\trepos := repositories{}\n\n\terr := queryRepos(&repos)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tout, err := json.Marshal(repos)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tfmt.Fprintf(w, string(out))\n}", "title": "" }, { "docid": "df29eaa98842459f27152b5e09a8ab1a", "score": "0.4417512", "text": "func (s *SmartContract) getReport(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n \n\t recordID := args[0]\n\t RecordAsBytes, _ := APIstub.GetState(recordID)\n\t recordd := new(RecordStruct)\n\t _ = json.Unmarshal(RecordAsBytes, recordd)\n\t return shim.Success(RecordAsBytes)\n\t \n }", "title": "" }, { "docid": "11d27689837ea1fab409850cb95cfddd", "score": "0.44103286", "text": "func (l *LedgerForEvaluator) loadAccounts(addresses map[basics.Address]struct{}) (map[basics.Address]*basics.AccountData, error) {\n\tres, err := l.loadAccountTable(addresses)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loadAccounts() err: %w\", err)\n\t}\n\n\terr = l.loadCreatables(&res)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loadAccounts() err: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "1a193d296f166d931e61359aab34e8d9", "score": "0.4407621", "text": "func (c *Client) InitiateReport(user *slack.User) error {\n\t// TODO this\n\treturn nil\n}", "title": "" }, { "docid": "9020e2393121781e2ede9e35a6e8dd24", "score": "0.44067597", "text": "func NewAccountReceivable(group *gin.RouterGroup) {\n\tvar ginController = controller.NewGinController(&models.AccountReceivable{})\n\tvar api = group.Group(\"/accountReceivable\")\n\t{\n\t\tcontroller.NewGinControllerWrapper(api, ginController, true, controller.MethodsOptions{\n\t\t\tFindAll: []repository.Options{repository.WithPreloads(\"Client\", \"Company\")},\n\t\t\tFind: []repository.Options{repository.WithPreloads(\"Client\", \"Company\")},\n\t\t})\n\t}\n}", "title": "" }, { "docid": "d74378f091fadbe81c05fe0c7d87cb63", "score": "0.44032386", "text": "func (s *AccountsEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*Accounts, error) {\n\tvar entities []*Accounts\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/crm/Accounts\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "title": "" }, { "docid": "b8b1ce1c92ce7c994338107c9d1950d6", "score": "0.43900466", "text": "func (b *Builder) InitAccounts(ctx context.Context) error {\n\tlog.Debugf(\"start InitAccounts function\")\n\t// collect unique accounts/addresses\n\taddresses := make(util.StringList, 0)\n\n\t// guard against unknown deactivated delegates\n\tfor _, v := range b.block.TZ.Block.Metadata.BalanceUpdates {\n\t\tvar addr chain.Address\n\t\tswitch v.BalanceUpdateKind() {\n\t\tcase \"contract\":\n\t\t\taddr = v.(*rpc.ContractBalanceUpdate).Contract\n\n\t\tcase \"freezer\":\n\t\t\taddr = v.(*rpc.FreezerBalanceUpdate).Delegate\n\t\t}\n\t\tif _, ok := b.AccountByAddress(addr); !ok && addr.IsValid() {\n\t\t\taddresses.AddUnique(addr.String())\n\t\t}\n\t}\n\n\t// add unknown deactivated delegates (from parent block: we're deactivating\n\t// AFTER a block has been fully indexed at the start of the next block)\n\t// 添加父块中申请注销 delegate 的地址,注销操作在这个区块中才会正式生效\n\tif b.parent != nil {\n\t\tfor _, v := range b.parent.TZ.Block.Metadata.Deactivated {\n\t\t\tif _, ok := b.AccountByAddress(v); !ok {\n\t\t\t\taddresses.AddUnique(v.String())\n\t\t\t}\n\t\t}\n\t}\n\n\t// collect from ops\n\tvar op_n int\n\tfor _, oll := range b.block.TZ.Block.Operations {\n\t\tfor _, oh := range oll {\n\t\t\t// init branches\n\t\t\tbr := oh.Branch.String()\n\t\t\tif _, ok := b.branches[br]; !ok {\n\t\t\t\tbranch, err := b.idx.BlockByHash(ctx, oh.Branch)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"op [ ]: invalid branch %s: %v\", oh.Branch.String(), err)\n\t\t\t\t}\n\t\t\t\tb.branches[br] = branch\n\t\t\t}\n\t\t\t// parse operations\n\t\t\tfor op_c, op := range oh.Contents {\n\t\t\t\tswitch kind := op.OpKind(); kind {\n\t\t\t\tcase chain.OpTypeActivateAccount:\n\t\t\t\t\t// need to search for blinded key\n\t\t\t\t\taop := op.(*rpc.AccountActivationOp)\n\t\t\t\t\tbkey, err := chain.BlindAddress(aop.Pkh, aop.Secret)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"activation op [%d:%d]: blinded address creation failed: %v\",\n\t\t\t\t\t\t\top_n, op_c, err)\n\t\t\t\t\t}\n\t\t\t\t\taddresses.AddUnique(bkey.String())\n\n\t\t\t\tcase chain.OpTypeBallot:\n\t\t\t\t\t// deactivated delegates can still cast votes\n\t\t\t\t\taddr := op.(*rpc.BallotOp).Source\n\t\t\t\t\tif _, ok := b.AccountByAddress(addr); !ok {\n\t\t\t\t\t\taddresses.AddUnique(addr.String())\n\t\t\t\t\t}\n\n\t\t\t\tcase chain.OpTypeDelegation:\n\t\t\t\t\tdel := op.(*rpc.DelegationOp)\n\t\t\t\t\taddresses.AddUnique(del.Source.String())\n\n\t\t\t\t\t// deactive delegates may not be in map\n\t\t\t\t\tif del.Delegate.IsValid() {\n\t\t\t\t\t\tif _, ok := b.AccountByAddress(del.Delegate); !ok {\n\t\t\t\t\t\t\taddresses.AddUnique(del.Delegate.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\tcase chain.OpTypeDoubleBakingEvidence:\n\t\t\t\t\t// empty\n\n\t\t\t\tcase chain.OpTypeDoubleEndorsementEvidence:\n\t\t\t\t\t// empty\n\n\t\t\t\tcase chain.OpTypeEndorsement:\n\t\t\t\t\t// deactive delegates may not be in map\n\t\t\t\t\tend := op.(*rpc.EndorsementOp)\n\t\t\t\t\tif _, ok := b.AccountByAddress(end.Metadata.Delegate); !ok {\n\t\t\t\t\t\taddresses.AddUnique(end.Metadata.Delegate.String())\n\t\t\t\t\t}\n\n\t\t\t\tcase chain.OpTypeOrigination:\n\t\t\t\t\torig := op.(*rpc.OriginationOp)\n\t\t\t\t\taddresses.AddUnique(orig.Source.String())\n\t\t\t\t\tif orig.ManagerPubkey.IsValid() {\n\t\t\t\t\t\taddresses.AddUnique(orig.ManagerPubkey.String())\n\t\t\t\t\t}\n\t\t\t\t\tif orig.ManagerPubkey2.IsValid() {\n\t\t\t\t\t\taddresses.AddUnique(orig.ManagerPubkey2.String())\n\t\t\t\t\t}\n\t\t\t\t\tfor _, v := range orig.Metadata.Result.OriginatedContracts {\n\t\t\t\t\t\taddresses.AddUnique(v.String())\n\t\t\t\t\t}\n\t\t\t\t\tif orig.Delegate != nil {\n\t\t\t\t\t\tif _, ok := b.AccountByAddress(*orig.Delegate); !ok {\n\t\t\t\t\t\t\taddresses.AddUnique(orig.Delegate.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\tcase chain.OpTypeProposals:\n\t\t\t\t\t// deactivated delegates can still send proposals\n\t\t\t\t\taddr := op.(*rpc.ProposalsOp).Source\n\t\t\t\t\tif _, ok := b.AccountByAddress(addr); !ok {\n\t\t\t\t\t\taddresses.AddUnique(addr.String())\n\t\t\t\t\t}\n\n\t\t\t\tcase chain.OpTypeReveal:\n\t\t\t\t\taddresses.AddUnique(op.(*rpc.RevelationOp).Source.String())\n\n\t\t\t\tcase chain.OpTypeSeedNonceRevelation:\n\t\t\t\t\t// not necessary because this is done by the baker\n\n\t\t\t\tcase chain.OpTypeTransaction:\n\t\t\t\t\ttx := op.(*rpc.TransactionOp)\n\t\t\t\t\taddresses.AddUnique(tx.Source.String())\n\t\t\t\t\taddresses.AddUnique(tx.Destination.String())\n\t\t\t\t\tfor _, res := range tx.Metadata.InternalResults {\n\t\t\t\t\t\tif res.Destination != nil {\n\t\t\t\t\t\t\taddresses.AddUnique(res.Destination.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif res.Delegate != nil {\n\t\t\t\t\t\t\taddresses.AddUnique(res.Delegate.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor _, v := range res.Result.OriginatedContracts {\n\t\t\t\t\t\t\taddresses.AddUnique(v.String())\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\top_n++\n\t\t}\n\t}\n\n\t// collect unknown/unloaded delegates for lookup or creation\n\tunknownDelegateIds := make([]uint64, 0)\n\n\t// fetch baking and endorsing rights for this block\n\tvar rr []*models.Right\n\terr := b.idx.statedb.Where(\"height = ? and type = ?\", b.block.Height, int(chain.RightTypeBaking)).Find(&rr).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, right := range rr {\n\t\tb.baking = append(b.baking, *right)\n\t}\n\n\t// endorsements are for block-1\n\tvar rrs []*models.Right\n\terr = b.idx.statedb.Where(\"height = ? and type = ?\", b.block.Height-1, int64(chain.RightTypeEndorsing)).Find(&rrs).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, right := range rrs {\n\t\tb.endorsing = append(b.endorsing, *right)\n\t}\n\n\t// collect from rights: on genesis and when deactivated, delegates are not in map\n\tfor _, r := range b.baking {\n\t\tif _, ok := b.AccountById(r.AccountId); !ok {\n\t\t\tunknownDelegateIds = append(unknownDelegateIds, r.AccountId.Value())\n\t\t}\n\t}\n\tfor _, r := range b.endorsing {\n\t\tif _, ok := b.AccountById(r.AccountId); !ok {\n\t\t\tunknownDelegateIds = append(unknownDelegateIds, r.AccountId.Value())\n\t\t}\n\t}\n\n\t// collect from future cycle rights when available\n\tfor _, r := range b.block.TZ.Baking {\n\t\tif _, ok := b.AccountByAddress(r.Delegate); !ok {\n\t\t\taddresses.AddUnique(r.Delegate.String())\n\t\t}\n\t}\n\tfor _, r := range b.block.TZ.Endorsing {\n\t\tif _, ok := b.AccountByAddress(r.Delegate); !ok {\n\t\t\taddresses.AddUnique(r.Delegate.String())\n\t\t}\n\t}\n\n\t// collect from invoices\n\tif b.parent != nil {\n\t\tparentProtocol := b.parent.TZ.Block.Metadata.Protocol\n\t\tblockProtocol := b.block.TZ.Block.Metadata.Protocol\n\t\tif !parentProtocol.IsEqual(blockProtocol) {\n\t\t\tfor n, _ := range b.block.Params.Invoices {\n\t\t\t\taddresses.AddUnique(n)\n\t\t\t}\n\t\t}\n\t}\n\n\t// delegation to inactive delegates is not explicitly forbidden, so\n\t// we have to check if any inactive (or deactivated) delegate is still\n\t// referenced\n\n\t// search cached accounts and build map\n\thashes := make([][]byte, 0)\n\tfor _, v := range addresses {\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\taddr, err := chain.ParseAddress(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"addr decode for '%s' failed: %v\", v, err)\n\t\t}\n\n\t\t// skip delegates\n\t\thashKey := addressHashKey(addr)\n\t\tif _, ok := b.dlgHashMap[hashKey]; ok {\n\t\t\tcontinue\n\t\t}\n\t\t// skip duplicate addresses\n\t\tif _, ok := b.accHashMap[hashKey]; ok {\n\t\t\tcontinue\n\t\t}\n\t\t// create tentative new account and schedule for lookup\n\t\tacc := models.NewAccount(addr)\n\t\tacc.FirstSeen = b.block.Height\n\t\tacc.LastSeen = b.block.Height\n\t\thashes = append(hashes, addr.Hash)\n\n\t\t// store in map, will be overwritten when resolved from db\n\t\t// or kept as new address when this is the first time we see it\n\t\tb.accHashMap[hashKey] = acc\n\t}\n\n\t// lookup addr by hashes (non-existent addrs are expected to not resolve)\n\tif len(hashes) > 0 {\n\t\tvar accs []*models.Account\n\t\terr := b.idx.statedb.Where(\"hash in (?)\", hashes).Find(&accs).Error\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, acc := range accs {\n\t\t\t// skip delegates (should have not been looked up in the first place)\n\t\t\tif acc.IsDelegate {\n\t\t\t\tacc.Free()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// collect unknown delegates when referenced\n\t\t\tif acc.DelegateId > 0 {\n\t\t\t\tif _, ok := b.AccountById(acc.DelegateId); !ok {\n\t\t\t\t\t// if _, ok := b.dlgMap[acc.DelegateId]; !ok {\n\t\t\t\t\tunknownDelegateIds = append(unknownDelegateIds, acc.DelegateId.Value())\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thashKey := accountHashKey(acc)\n\n\t\t\t// sanity check for hash collisions (unlikely when we use type+hash)\n\t\t\tif a, ok := b.accHashMap[hashKey]; ok {\n\t\t\t\tif bytes.Compare(a.Hash, acc.Hash) != 0 {\n\t\t\t\t\treturn fmt.Errorf(\"Hash collision: account %s (%d) h=%x and %s (%d) h=%x have same hash %d\",\n\t\t\t\t\t\ta, a.RowId, a.Hash, acc, acc.RowId, acc.Hash, hashKey)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// return temp addrs to pool (Note: don't free addrs loaded from cache!)\n\t\t\tif tmp, ok := b.accHashMap[hashKey]; ok && tmp.RowId == 0 {\n\t\t\t\ttmp.Free()\n\t\t\t}\n\t\t\t// this overwrites temp address in map\n\t\t\tb.accHashMap[hashKey] = acc\n\t\t\tb.accMap[acc.RowId] = acc\n\t\t}\n\t}\n\n\t// lookup inactive delegates\n\tif len(unknownDelegateIds) > 0 {\n\t\t// creates a new slice\n\t\tunknownDelegateIds = util.UniqueUint64Slice(unknownDelegateIds)\n\t\tvar accs []*models.Account\n\t\terr := b.idx.statedb.Where(\"row_id in (?)\", unknownDelegateIds).Find(&accs).Error\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, acc := range accs {\n\t\t\t// ignore when its an active delegate (then it's in the delegate maps)\n\t\t\tif acc.IsActiveDelegate {\n\t\t\t\tacc.Free()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// handle like a regular account\n\t\t\thashKey := accountHashKey(acc)\n\t\t\tb.dlgHashMap[hashKey] = acc\n\t\t\tb.dlgMap[acc.RowId] = acc\n\t\t}\n\t}\n\n\t// collect new addrs and bulk insert to generate ids\n\t// Note: due to random map walk in Go, address id allocation will be\n\t// non-deterministic, also deletion of addresses on reorgs makes\n\t// it non-deterministic, so we assume this is OK here; however\n\t// address id's are not interchangable between two versions of the\n\t// accounts table. Keep this in mind for downstream use!\n\tnewacc := make([]*models.Account, 0)\n\tfor _, v := range b.accHashMap {\n\t\tif v.IsNew {\n\t\t\tnewacc = append(newacc, v)\n\t\t}\n\t}\n\n\t// bulk insert to generate ids\n\tif len(newacc) > 0 {\n\t\t// todo batch insert\n\t\ttx := b.idx.statedb.Begin()\n\t\tfor _, acc := range newacc {\n\t\t\tacc.RowId = models.AccountID(0)\n\t\t\tacc.Addr = acc.String()\n\t\t\tif err := tx.Create(acc).Error; err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\ttx.Commit()\n\t\t// and add new addresses under their new ids into the id map\n\t\tfor _, v := range newacc {\n\t\t\tacc := v\n\t\t\tb.accMap[acc.RowId] = acc\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "379413e98d5e2bbb88af4415b5059f1f", "score": "0.43870503", "text": "func (c *Client) DescribeAccounts(request *DescribeAccountsRequest) (response *DescribeAccountsResponse, err error) {\n if request == nil {\n request = NewDescribeAccountsRequest()\n }\n response = NewDescribeAccountsResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "1f519020d4ad1ff572b10c5780387fda", "score": "0.43749478", "text": "func RptLedgerHandler(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport, sel int) {\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tvar m []gotable.Table\n\tvar rn string\n\tif sel == 0 {\n\t\trn = \"Ledgers\"\n\t} else {\n\t\trn = \"Ledger Activity\"\n\t}\n\ts, err := rrpt.ReportHeader(rn, \"RptLedgerHandler\", &ri)\n\tif err != nil {\n\t\ts += \"\\n\" + err.Error()\n\t}\n\tui.ReportContent += s\n\n\tif xbiz.P.BID > 0 {\n\t\tswitch sel {\n\t\tcase 0: // all ledgers\n\t\t\tm = rrpt.LedgerReportTable(&ri)\n\t\tcase 1: // ledger activity\n\t\t\tm = rrpt.LedgerActivityReportTable(&ri)\n\t\t}\n\t\tui.ReportContent = \"\"\n\t\tfor i := 0; i < len(m); i++ {\n\t\t\ts, err := m[i].SprintTable()\n\t\t\tif err != nil {\n\t\t\t\ts += err.Error()\n\t\t\t}\n\t\t\tui.ReportContent += s + \"\\n\\n\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7426c8fe4ba738d07826e4a4754b92ff", "score": "0.4370128", "text": "func main() {\n\tattr := accounts.Attributes{\n\t\tCountry: \"GB\",\n\t\tName: []string{\"John Doe\"},\n\t}\n\n\tid := uuid.MustParse(\"ad27e266-9605-4b4b-a0e5-3003ea9cc4dc\")\n\toID := uuid.MustParse(\"eb0bd6f5-c3f5-44b2-b677-acd23cdde73c\")\n\n\taccCreate := accounts.AccountCreate{\n\t\tType: \"accounts\",\n\t\tID: &id,\n\t\tOrganisationID: &oID,\n\t\tAttributes: &attr,\n\t}\n\n\tclient, err := accounts.New()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed creating client: err=%v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tctx := context.Background()\n\tacc, err := client.Create(ctx, &accCreate)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed creating acc: err=%v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Created = %v\\n\", toJSON(acc))\n\n\tacc, err = client.Fetch(ctx, id)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed fetching acc: id=%s, err=%v\\n\", id, err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Fetch = %v\\n\", toJSON(acc))\n\n\terr = client.Delete(ctx, id, *acc.Version)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed deleting acc: id=%s, err=%v\\n\", id, err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"Delete = %v\\n\", id)\n}", "title": "" }, { "docid": "8c2043cb9bf883f802b6db2ee9aba2aa", "score": "0.4369804", "text": "func GenerateReport(certs CertificateInfoList, warningsOnly bool) string {\n\tsort.Sort(certs)\n\tpReader, pWriter := io.Pipe()\n\tvar buff bytes.Buffer\n\treportWriter := new(tabwriter.Writer)\n\treportWriter.Init(pWriter, 0, 8, 0, '\\t', 0)\n\tfmt.Fprintln(reportWriter, \"Site\\tCommon Name\\tStatus\\t \\tDays Left\\tExpire Date\")\n\texpiredCount := 0\n\tfor _, cert := range certs {\n\t\tif cert != nil {\n\t\t\teDate := cert.cert.NotAfter\n\t\t\tvar expired string\n\t\t\tif IsExpired(eDate) {\n\t\t\t\texpired = \"Expired\"\n\t\t\t\texpiredCount++\n\t\t\t} else {\n\t\t\t\texpired = \"Valid\"\n\t\t\t}\n\t\t\tdaysToExpire := GetExpireDays(eDate)\n\t\t\tcn := cert.cert.Subject.CommonName\n\t\t\tif (warningsOnly && IsExpired(eDate)) || !warningsOnly {\n\t\t\t\tfmt.Fprintf(reportWriter, \"%s\\t%s\\t%s\\t \\t%d\\t%s\\n\", cert.name, cn, expired, daysToExpire, eDate.Local())\n\t\t\t}\n\t\t}\n\t}\n\tif expiredCount == 0 && warningsOnly {\n\t\treturn \"\"\n\t}\n\tgo buff.ReadFrom(pReader)\n\treportWriter.Flush()\n\tpWriter.Close()\n\tpReader.Close()\n\treturn buff.String()\n}", "title": "" }, { "docid": "a617b28a76f2a366aeb16b59d1a0695e", "score": "0.43630713", "text": "func (a *Account) List(query *account.Account) (*account.Accounts, error) {\n\n\tvar outputs *queryScanOutput\n\tvar err error\n\n\tif query.Limit == nil {\n\t\tquery.Limit = &a.Limit\n\t}\n\n\tif query.Status != nil {\n\t\toutputs, err = a.queryAccounts(query, \"AccountStatus\", \"AccountStatus\")\n\t} else {\n\t\toutputs, err = a.scanAccounts(query)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif outputs.lastEvaluatedKey != nil {\n\t\tjsondata, err := json.Marshal(outputs.lastEvaluatedKey)\n\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewInternalServer(\"failed marshaling of last evaluated key\", err)\n\t\t}\n\n\t\tlastEvaluatedKey := account.LastEvaluatedKey{}\n\n\t\t// set last evaluated key to next id for next query/scan\n\t\tif err := json.Unmarshal(jsondata, &lastEvaluatedKey); err != nil {\n\t\t\treturn nil, errors.NewInternalServer(\"failed unmarshaling of last evaluated key to next ID\", err)\n\t\t}\n\n\t\tquery.NextID = lastEvaluatedKey.ID.S\n\t} else {\n\t\t// clear next id and account status if there is no more page\n\t\tquery.NextID = nil\n\t}\n\n\taccounts := &account.Accounts{}\n\terr = dynamodbattribute.UnmarshalListOfMaps(outputs.items, accounts)\n\tif err != nil {\n\t\treturn nil, errors.NewInternalServer(\"failed unmarshaling of accounts\", err)\n\t}\n\n\treturn accounts, nil\n}", "title": "" }, { "docid": "4a2d21e3a9f6c441ea8e33b7b3724287", "score": "0.4356617", "text": "func RptJournal(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tif xbiz.P.BID > 0 {\n\t\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2, OutputFormat: rlib.TABLEOUTTEXT}\n\t\tri.OutputFormat = rlib.TABLEOUTTEXT\n\t\ttbl := rrpt.JournalReport(&ri)\n\t\tri.RptHeader = true\n\t\tri.RptHeaderD1 = true\n\t\tri.RptHeaderD2 = true\n\t\t// ui.ReportContent = tbl.Title + tbl.SprintTable(rlib.TABLEOUTTEXT)\n\t\tui.ReportContent = rrpt.ReportToString(&tbl, &ri)\n\t}\n}", "title": "" }, { "docid": "63f7e92f40c0b4dbf43fd5846e5e3007", "score": "0.43527746", "text": "func AllAccounts(ctx context.Context, queryArgs *AccountQueryArguments) (*AccountConnectionResolver, error) { // nolint: gocyclo\n\tdb, ok := ctx.Value(DBCtx).(XODB)\n\tif !ok {\n\t\treturn nil, errors.New(\"db is not found in context\")\n\t}\n\n\tif queryArgs != nil && (queryArgs.After != nil || queryArgs.First != nil || queryArgs.Before != nil || queryArgs.Last != nil) {\n\t\treturn nil, errors.New(\"not implemented yet, use offset + limit for pagination\")\n\t}\n\n\tqueryArgs = ApplyAccountQueryArgsDefaults(queryArgs)\n\n\tfilterArgs, err := getAccountFilter(queryArgs.Where)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get Account filter\")\n\t}\n\tqueryArgs.filterArgs = filterArgs\n\n\tallAccount, err := GetAllAccount(db, queryArgs)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get Account\")\n\t}\n\n\tcount, err := CountAllAccount(db, queryArgs)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get count\")\n\t}\n\n\treturn &AccountConnectionResolver{\n\t\tdata: allAccount,\n\t\tcount: int32(count),\n\t}, nil\n}", "title": "" }, { "docid": "62c09a4f7a4c60898a4e999334bcb5fc", "score": "0.4349549", "text": "func PrintRegister(generalLedger []*ledger.Transaction, filterArr []string, columns int) {\n\t// Calculate widths for variable-length part of output\n\t// 3 10-width columns (date, account-change, running-total)\n\t// 4 spaces\n\tif columns < 35 {\n\t\tcolumns = 35\n\t\tfmt.Fprintf(os.Stderr, \"warning: `columns` too small, setting to %d\\n\", columns)\n\t}\n\tremainingWidth := columns - (10 * 3) - (4 * 1)\n\tcol1width := remainingWidth / 3\n\tcol2width := remainingWidth - col1width\n\tformatString := fmt.Sprintf(\"%%-10.10s %%-%[1]d.%[1]ds %%-%[2]d.%[2]ds %%10.10s %%10.10s\\n\", col1width, col2width)\n\n\tvar buf bytes.Buffer\n\trunningBalance := decimal.Zero\n\tfor _, trans := range generalLedger {\n\t\tfor _, accChange := range trans.AccountChanges {\n\t\t\tinFilter := len(filterArr) == 0\n\t\t\tfor _, filter := range filterArr {\n\t\t\t\tif strings.Contains(accChange.Name, filter) {\n\t\t\t\t\tinFilter = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif inFilter {\n\t\t\t\trunningBalance = runningBalance.Add(accChange.Balance)\n\t\t\t\toutBalanceString := accChange.Balance.StringFixedBank()\n\t\t\t\toutRunningBalanceString := runningBalance.StringFixedBank()\n\t\t\t\tfmt.Fprintf(&buf, formatString,\n\t\t\t\t\ttrans.Date.Format(transactionDateFormat),\n\t\t\t\t\ttrans.Payee,\n\t\t\t\t\taccChange.Name,\n\t\t\t\t\toutBalanceString,\n\t\t\t\t\toutRunningBalanceString)\n\t\t\t}\n\t\t}\n\t}\n\tio.Copy(os.Stdout, &buf)\n}", "title": "" }, { "docid": "685659e8227b0240210154b29cd8374b", "score": "0.4349076", "text": "func GenerateQAReports() {\n\n\tschools, err := getSchoolsList()\n\tif err != nil {\n\t\tlog.Fatalln(\"Cannot connect to naprrql server: \", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr = runQAReports(schools)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error creating QA reports: \", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "3b5e783ba653063145fbd34832bcf669", "score": "0.43484274", "text": "func (_VipnodePool *VipnodePoolCaller) Accounts(opts *bind.CallOpts, arg0 common.Address) (struct {\n\tBalance *big.Int\n\tTimeLocked *big.Int\n}, error) {\n\tret := new(struct {\n\t\tBalance *big.Int\n\t\tTimeLocked *big.Int\n\t})\n\tout := ret\n\terr := _VipnodePool.contract.Call(opts, out, \"accounts\", arg0)\n\treturn *ret, err\n}", "title": "" }, { "docid": "3e8ad35d1868eee56bbf874e224897d3", "score": "0.43464386", "text": "func (a Account) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) error {\n\taccountTpl := `\n\t{{ define \"account_sgl\" }}{{ .Name }}{{ if .Suspended }} (suspended){{ end}}{{ end }}\n{{ define \"account_medium\" }}{{ template \"account_sgl\" . }}{{ end }}\n{{ define \"account_full\" }}{{ .Name }}{{ if .Suspended }} (suspended){{ end}}{{ end }}\n\n{{ range .Groups -}}\n {{ template \"group_overview\" . -}}\n{{- end -}}\n{{ define \"group_overview\" }} • {{ .Name }} - {{ pluralize \"server\" \"servers\" ( len .VirtualMachines ) -}}\n{{- if len .VirtualMachines | gt 6 -}}\n{{- range .VirtualMachines }}\n {{ prettysprint . \"_sgl\" -}}\n{{- end -}}\n{{- end }}\n{{ end -}}\n`\n\treturn prettyprint.Run(wr, accountTpl, \"account\"+string(detail), a)\n}", "title": "" }, { "docid": "31de1eeb4eca110fa65486fa45a5be1e", "score": "0.43427914", "text": "func (s *Service) GitReport(c context.Context, projID int, mrID int, commitID string) (err error) {\n\tvar (\n\t\tpkgs = make([]*ut.PkgAnls, 0)\n\t\trow = `<tr><td colspan=\"2\"><a href=\"http://sven.bilibili.co/#/ut/detail?commit_id=%s&pkg=%s\">%s</a></td><td>%.2f</td><td>%.2f</td><td>%.2f</td><td style=\"text-align: center\">%s</td></tr>`\n\t\tmsg = fmt.Sprintf(`<pre><h4>单元测试速报</h4>(Commit:<a href=\"http://sven.bilibili.co/#/ut?merge_id=%d&pn=1&ps=20\">%s</a>)</pre>`, mrID, commitID) + `<table><thead><tr><th colspan=\"2\">包名</th><th>覆盖率(%%)</th><th>通过率(%%)</th><th>覆盖率较历史最高(%%)</th><th>是否合格</th></tr></thead><tbody>%s</tbody>%s</table>`\n\t\trows string\n\t\troot = \"\"\n\t\tfile = &ut.File{}\n\t)\n\tif err = s.DB.Where(\"commit_id=? AND (pkg!=substring_index(pkg, '/', 5) OR pkg like 'go-common/library/%')\", commitID).Find(&pkgs).Error; err != nil {\n\t\tlog.Error(\"apmSvc.GitReport query error(%v)\", err)\n\t\treturn\n\t}\n\tfor _, pkg := range pkgs {\n\t\tt, _ := s.tyrant(pkg)\n\t\tapp := pkg.PKG\n\t\tif !strings.Contains(pkg.PKG, \"/library\") && len(pkg.PKG) >= 5 {\n\t\t\tapp = strings.Join(strings.Split(pkg.PKG, \"/\")[:5], \"/\")\n\t\t}\n\t\trows += fmt.Sprintf(row, pkg.CommitID, app, pkg.PKG, pkg.Coverage/100, t.PassRate, t.Increase, \"%s\")\n\t\tif t.Tyrant {\n\t\t\trows = fmt.Sprintf(rows, \"❌\")\n\t\t} else {\n\t\t\trows = fmt.Sprintf(rows, \"✔️\")\n\t\t}\n\t}\n\tif err = s.DB.Select(`count(id) as id, commit_id, sum(statements) as statements, sum(covered_statements) as covered_statements`).\n\t\tWhere(`pkg!=substring_index(pkg, \"/\", 5) OR ut_pkganls.pkg like 'go-common/library/%'`).Group(`commit_id`).Having(\"commit_id=?\", commitID).First(file).Error; err != nil {\n\t\tif err != gorm.ErrRecordNotFound {\n\t\t\tlog.Error(\"apmSvc.GitReport query error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\terr = nil\n\t} else {\n\t\troot = fmt.Sprintf(`<tfoot><tr><td><b>总覆盖率: </b>%.2f%%<br><b>总检测文件数: </b>%d</br></td><td><b>Tracked语句数: </b>%d<br><b>覆盖的语句数: </b>%d</br></td><td colspan=\"4\" align=\"center\">总覆盖率 = 覆盖语句数 / Tracked语句数</td></tr></tfoot>`,\n\t\t\tfloat64(file.CoveredStatements)/float64(file.Statements)*100, file.ID, file.Statements, file.CoveredStatements)\n\t}\n\tif err = s.CommentOnMR(c, projID, mrID, fmt.Sprintf(msg, rows, root)); err != nil {\n\t\tlog.Error(\"apmSvc.GitReport call CommentOnMR error(%v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "fa0cd891dd63b2a73342491f7ab5e000", "score": "0.43408376", "text": "func PrintLedger(generalLedger []*ledger.Transaction, filterArr []string, columns int) {\n\t// Print transactions by date\n\tif len(generalLedger) > 1 {\n\t\tslices.SortStableFunc(generalLedger, func(a, b *ledger.Transaction) int {\n\t\t\treturn a.Date.Compare(b.Date)\n\t\t})\n\t}\n\n\tvar buf bytes.Buffer\n\tfor _, trans := range generalLedger {\n\t\tinFilter := len(filterArr) == 0\n\t\tfor _, accChange := range trans.AccountChanges {\n\t\t\tfor _, filter := range filterArr {\n\t\t\t\tif strings.Contains(accChange.Name, filter) {\n\t\t\t\t\tinFilter = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif inFilter {\n\t\t\tWriteTransaction(&buf, trans, columns)\n\t\t}\n\t}\n\tio.Copy(os.Stdout, &buf)\n}", "title": "" }, { "docid": "b5904d3a148de11763b79c8f97dbe2b2", "score": "0.43397045", "text": "func (bills Bills) Report(p Period) (string, error) {\n\tvar b strings.Builder\n\n\tperiod := fmt.Sprintf(\"Financial period: %s\\n\\nBills periods:\\n\", p.String())\n\tif _, err := b.WriteString(period); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, bill := range bills {\n\t\ts := fmt.Sprintf(\n\t\t\t\"%s\\t%10.3f (%d days x %6.3f per day)\\n\",\n\t\t\tbill.Period.String(),\n\t\t\tbill.PaidIn(p),\n\t\t\tbill.BilledDaysIn(p),\n\t\t\tbill.PaidDaily())\n\n\t\tif _, err := b.WriteString(s); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tif _, err := b.WriteString(\"===\\n\"); err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttotal := fmt.Sprintf(\"Total paid in financial period\\t$%.3f\\n\", bills.AmountPaidIn(p))\n\tif _, err := b.WriteString(total); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn b.String(), nil\n}", "title": "" }, { "docid": "bbaf7aacd4de292974aa0907435da838", "score": "0.43385935", "text": "func (c *MetricsCollector) collect() {\n\tc.accounts.Reset()\n\tc.ccsAccounts.Reset()\n\tc.accountClaims.Reset()\n\tc.accountPoolSize.Reset()\n\tc.accountReuseAvailable.Reset()\n\n\tctx := context.TODO()\n\tvar (\n\t\taccounts awsv1alpha1.AccountList\n\t\taccountClaims awsv1alpha1.AccountClaimList\n\t\taccountPool awsv1alpha1.AccountPoolList\n\t\tclaimed string\n\t\treused string\n\t)\n\tif err := c.store.List(ctx, &client.ListOptions{\n\t\tNamespace: awsv1alpha1.AccountCrNamespace}, &accounts); err != nil {\n\t\tlog.Error(err, \"failed to list accounts\")\n\t\treturn\n\t}\n\n\tif err := c.store.List(ctx, &client.ListOptions{}, &accountClaims); err != nil {\n\t\tlog.Error(err, \"failed to list account claims\")\n\t\treturn\n\t}\n\n\tif err := c.store.List(ctx, &client.ListOptions{}, &accountPool); err != nil {\n\t\tlog.Error(err, \"failed to list account pools\")\n\t\treturn\n\t}\n\n\tfor _, account := range accounts.Items {\n\t\tif account.Status.Claimed {\n\t\t\tclaimed = \"true\"\n\t\t} else {\n\t\t\tclaimed = \"false\"\n\t\t}\n\n\t\tif account.Status.Reused {\n\t\t\treused = \"true\"\n\t\t} else {\n\t\t\treused = \"false\"\n\t\t}\n\n\t\tif account.Status.Claimed == false && account.Status.Reused == true &&\n\t\t\taccount.Status.State == \"Ready\" {\n\t\t\tc.accountReuseAvailable.WithLabelValues(account.Spec.LegalEntity.ID).Inc()\n\t\t}\n\n\t\tif account.Spec.BYOC {\n\t\t\tc.ccsAccounts.WithLabelValues(claimed, reused, account.Status.State).Inc()\n\t\t} else {\n\t\t\tc.accounts.WithLabelValues(claimed, reused, account.Status.State).Inc()\n\t\t}\n\t}\n\n\tfor _, accountClaim := range accountClaims.Items {\n\t\tc.accountClaims.WithLabelValues(string(accountClaim.Status.State)).Inc()\n\t}\n\n\tfor _, pool := range accountPool.Items {\n\t\tc.accountPoolSize.WithLabelValues(pool.Namespace, pool.Name).Set(float64(pool.Spec.PoolSize))\n\t}\n}", "title": "" }, { "docid": "f1b42337d5afc0c38e76613f901bc7a5", "score": "0.4336353", "text": "func CSVReport(repos []*github.Repository) {\n\tcw := csv.NewWriter(os.Stdout)\n\tdefer cw.Flush()\n\n\twriteCSVHeader(cw)\n\tfor _, v := range repos {\n\t\tlang := \"\"\n\t\tif v.Language != nil {\n\t\t\tlang = *v.Language\n\t\t}\n\t\tcw.Write([]string{*v.Name, fmt.Sprintf(\"%v\", *v.ID), lang})\n\t}\n\n}", "title": "" }, { "docid": "41b82c629ea3421a3bcafed2a292e9ef", "score": "0.43311554", "text": "func BatchAccountGenerator() gopter.Gen {\n\tif batchAccountGenerator != nil {\n\t\treturn batchAccountGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddRelatedPropertyGeneratorsForBatchAccount(generators)\n\tbatchAccountGenerator = gen.Struct(reflect.TypeOf(BatchAccount{}), generators)\n\n\treturn batchAccountGenerator\n}", "title": "" }, { "docid": "0ca571975382feedee784791a3e92437", "score": "0.43235108", "text": "func RptJournal(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport) {\n\tif xbiz.P.BID > 0 {\n\t\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2, OutputFormat: gotable.TABLEOUTTEXT}\n\t\tri.OutputFormat = gotable.TABLEOUTTEXT\n\t\tri.RptHeaderD1 = true\n\t\tri.RptHeaderD2 = true\n\t\tui.ReportContent = rrpt.JournalReport(&ri)\n\t}\n}", "title": "" }, { "docid": "882c34065b039e92736340ecec40281f", "score": "0.43218967", "text": "func RptLedgerHandler(w http.ResponseWriter, r *http.Request, xbiz *rlib.XBusiness, ui *RRuiSupport, sel int) {\n\tvar ri = rrpt.ReporterInfo{Xbiz: xbiz, D1: ui.D1, D2: ui.D2}\n\tvar m []rlib.Table\n\tvar rn string\n\tif sel == 0 {\n\t\trn = \"Ledgers\"\n\t} else {\n\t\trn = \"Ledger Activity\"\n\t}\n\ts, err := rrpt.ReportHeader(rn, \"RptLedgerHandler\", &ri)\n\tif err != nil {\n\t\ts += \"\\n\" + err.Error()\n\t}\n\tui.ReportContent += s\n\n\tif xbiz.P.BID > 0 {\n\t\tswitch sel {\n\t\tcase 0: // all ledgers\n\t\t\tm = rrpt.LedgerReport(&ri)\n\t\tcase 1: // ledger activity\n\t\t\tm = rrpt.LedgerActivityReport(&ri)\n\t\t}\n\t\tui.ReportContent = \"\"\n\t\tfor i := 0; i < len(m); i++ {\n\t\t\tui.ReportContent += m[i].Title + m[i].SprintTable(rlib.TABLEOUTTEXT) + \"\\n\\n\"\n\t\t}\n\t}\n}", "title": "" }, { "docid": "de3f8dae141f756405828d51949d05cb", "score": "0.4321747", "text": "func createSalesReport(startDate string, endDate string) salesReport {\n\ttransaction := []transactionReport{}\n\trows, _ := DB.Query(`\n\t\tSELECT order_id, timestamp, i.sku, name, amount, price,\n\t\t\t\t\t(amount * price) AS omzet, purchase,\n\t\t\t\t\t((amount * price) - (purchase * amount)) AS profit\n\t\tFROM transactions t\n\t\t\tINNER JOIN OutgoingTransactions ot\n\t\t\tON t.id = ot.transaction_id\n\t\t\tINNER JOIN items i\n\t\t\tON t.transaction_sku = i.sku\n\t\t\tINNER JOIN (\n\t\t\t\tSELECT i.sku, (SUM(booking * price) * 1.0 / SUM(t.amount)) AS purchase\n\t\t\t\tFROM transactions t\n\t\t\t\t\tINNER JOIN IncomingTransactions it\n\t\t\t\t\tON t.id = it.transaction_id\n\t\t\t\tLEFT JOIN items i\n\t\t\t\tON t.transaction_sku = i.sku\n\t\t\t\tWHERE transaction_code = 'BM'\n\t\t\t\tGROUP BY i.sku\n\t\t\t) AS dt\n\t\t\tON dt.sku = t.transaction_sku\n\t\tWHERE transaction_code = 'BK'\n\t\t\tAND timestamp BETWEEN '` + startDate + ` 00:00:00' \n\t\t\t\tAND '` + endDate + ` 23:59:59'\n\t\tORDER BY timestamp;\n\t`)\n\n\tsummary := salesSummary{}\n\ti := 0\n\tfor rows.Next() {\n\t\t// TransactionReport\n\t\trow := transactionReport{}\n\t\trows.Scan(\n\t\t\t&row.OrderID, &row.TimeStamp, &row.SKU, &row.Name, &row.Amount,\n\t\t\t&row.Price, &row.Omzet, &row.Purchase, &row.Profit,\n\t\t)\n\t\trow.Omzet = row.Price * float64(row.Amount)\n\t\ttransaction = append(transaction, row)\n\n\t\t// Summary\n\t\tsummary.TotalAmount += row.Amount\n\t\tsummary.TotalOmzet += row.Omzet\n\t\tsummary.TotalProfit += row.Profit\n\n\t\tif i > 0 && transaction[i].OrderID != transaction[i-1].OrderID {\n\t\t\tsummary.TotalSales++\n\t\t} else if i == 0 {\n\t\t\tsummary.TotalSales = 1\n\t\t}\n\t\ti++\n\t}\n\tsummary.PrintDate = strftime.Format(\"%d %B %Y\", time.Now())\n\n\t// Report\n\treport := salesReport{\n\t\tItems: transaction,\n\t\tSummary: summary,\n\t}\n\trows.Close()\n\n\treturn report\n}", "title": "" }, { "docid": "3af6a8f9aa1fdf2fb19c7ddd4dad59ff", "score": "0.43141946", "text": "func (t *InsuranceChaincode) updateReport(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar err error\n\tvar reason string\n\n\t// simple data model arguments\n\t// 0=accidentId 1=respondingERS 2=description 3=other vehicle\n\t// 1534180781 NYPD 34th Precinct Nose to tail collision 1HTZR0007JH586991\n\n\tif len(args) < 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting minimum of 2\")\n\t}\n\n\t// === Check input variables ===\n\tif len(args[0]) <= 0 {\n\t\treturn shim.Error(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn shim.Error(\"2nd argument must be a non-empty string\")\n\t}\n\n\taccidentID := args[0]\n\trespondingERS := args[1]\n\tdescription := args[2]\n\totherVehicle := args[3]\n\n\t// === Check if AccidentReport asset exists\n\taccidentRef := fmt.Sprintf(\"%s#%s\", \"accident.AccidentReport\", accidentID)\n\treportAsBytes, err := stub.GetState(accidentRef)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get accident report: \" + err.Error())\n\t} else if reportAsBytes == nil {\n\t\treturn shim.Error(\"This accident report doesn't exists: \" + accidentRef)\n\t}\n\n\t// === Check if EmergencyServices asset exists\n\tersRef := fmt.Sprintf(\"%s#%s\", \"base.EmergencyServices\", respondingERS)\n\tersAsBytes, err := stub.GetState(ersRef)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get accident report: \" + err.Error())\n\t} else if ersAsBytes == nil {\n\t\treturn shim.Error(\"This accident report doesn't exists: \" + ersRef)\n\t}\n\n\t// === Unmarshal the report to an object\n\taccidentReport := AccidentReport{}\n\tif err = json.Unmarshal(reportAsBytes, accidentReport); err != nil {\n\t\treturn shim.Error(\"Failed to unmarshal accident report: \" + err.Error())\n\t}\n\n\t// === Update reponsing ERS if not yet assigned\n\tif accidentReport.RespondingERS == \"\" {\n\t\taccidentReport.RespondingERS = ersRef\n\t\treason = fmt.Sprintf(\"Emergencency Services (%s) responding to accident\", respondingERS)\n\t} else {\n\t\treturn shim.Error(\"Emergency Services already responding: \" + accidentReport.RespondingERS)\n\t}\n\n\t// === Check if description is given\n\tif len(description) > 0 {\n\t\taccidentReport.Description = description\n\t\treason = \"Description of accident updated\"\n\t}\n\n\t// === Check if other vehicle exists\n\tif len(otherVehicle) > 0 {\n\t\tvehicleRef := fmt.Sprintf(\"%s#%s\", \"base.Vehicle\", otherVehicle)\n\t\tvehicleAsBytes, err := stub.GetState(vehicleRef)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to get vehicle: \" + err.Error())\n\t\t} else if vehicleAsBytes == nil {\n\t\t\treturn shim.Error(\"Added vehicle doesn't exists: \" + vehicleRef)\n\t\t}\n\n\t\tvar vehicles []string\n\t\tvehicles = accidentReport.InvolvedGoods.Vehicles\n\t\tvehicles = append(vehicles, otherVehicle)\n\t\taccidentReport.InvolvedGoods.Vehicles = vehicles\n\t\treason = \"Another vehicle added to the report\"\n\t}\n\n\t// === Marshal the updated accident report\n\taccidentJSONasBytes, err := json.Marshal(accidentReport)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// === Save accident report to state ===\n\terr = stub.PutState(accidentRef, accidentJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// === Emit ReportUpdate event ===\n\treportUpdate := &ReportUpdateEvent{accidentID, reason}\n\teventJSONasBytes, err := json.Marshal(reportUpdate)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tstub.SetEvent(\"ReportUpdateEvent\", eventJSONasBytes)\n\n\tfmt.Println(\"- Accident report successfully updated\")\n\treturn shim.Success(eventJSONasBytes)\n}", "title": "" }, { "docid": "6fe755ed18b59efd295e39540c349a2e", "score": "0.4306599", "text": "func (t *InsuranceChaincode) reportAccident(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar err error\n\n\t// simple data model arguments\n\t// 0=longitude 1=latitude 2=occuredAt 3=reporting vehicle\n\t// 52.0920511 5.06641270 2018-08-03T10:20:20.325Z JN6ND01S3GX194659\n\n\tif len(args) < 2 {\n\t\treturn shim.Error(fmt.Sprintf(\"Incorrect number of arguments. Expecting minimum of 2, got %d\", len(args)))\n\t}\n\n\t// === Check input variables ===\n\tif len(args[0]) <= 0 {\n\t\treturn shim.Error(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn shim.Error(\"2nd argument must be a non-empty string\")\n\t}\n\n\tlongitude, err := strconv.ParseFloat(args[0], 64)\n\tif err != nil {\n\t\treturn shim.Error(\"1st argument must be a floating point string\")\n\t}\n\n\tlatitude, err := strconv.ParseFloat(args[1], 64)\n\tif err != nil {\n\t\treturn shim.Error(\"2nd argument must be a floating point string\")\n\t}\n\n\toccuredAt := time.Now()\n\n\t// === Parse occuredAt dateTime format ===\n\tif len(args[2]) > 0 {\n\t\toccuredAt, err = time.Parse(time.RFC3339, args[2])\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"3rd argument must be a RFC3339 dateTime string\")\n\t\t}\n\t}\n\n\t// === Check if optional vehicle exists ===\n\tvar vehicleRef string\n\tif len(args[3]) > 0 {\n\t\tvehicleRef = fmt.Sprintf(\"%s#%s\", \"base.Vehicle\", args[3])\n\t\tvehicleAsBytes, err := stub.GetState(vehicleRef)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to get vehicle: \" + err.Error())\n\t\t} else if vehicleAsBytes == nil {\n\t\t\treturn shim.Error(\"This vehicle doesn't exists: \" + vehicleRef)\n\t\t}\n\t}\n\n\t// === Create report object\n\taccidentObjClass := \"accident.AccidentReport\"\n\t//accidentID, err := strconv.ParseInt(\"1534180781\", 10, 64) //static id for testing\n\taccidentID := time.Now().Unix()\n\tlocation := LocationConcept{\"accident.Location\", longitude, latitude, \"\"}\n\taccidentReport := &AccidentReport{Class: accidentObjClass, OccuredAt: occuredAt, Status: \"NEW\", Location: location}\n\tif vehicleRef != \"\" {\n\t\tvar vehicles []string\n\t\tvehicles[0] = vehicleRef\n\t\tinvolvedGoods := GoodsConcept{\"accident.Goods\", vehicles}\n\t\taccidentReport.InvolvedGoods = involvedGoods\n\t}\n\n\t// === Marshal accident report\n\taccidentJSONasBytes, err := json.Marshal(accidentReport)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// === Save accident to state ===\n\taccidentRef := fmt.Sprintf(\"%s#%d\", accidentObjClass, accidentID)\n\terr = stub.PutState(accidentRef, accidentJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// === Emit NewAccident event ===\n\tlocationStr := fmt.Sprintf(\"%f, %f\", longitude, latitude)\n\tnewAccident := &NewAccidentEvent{strconv.FormatInt(accidentID, 10), locationStr}\n\teventJSONasBytes, err := json.Marshal(newAccident)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tstub.SetEvent(\"NewAccidentEvent\", eventJSONasBytes)\n\n\tfmt.Println(\"- Accident report successfully created\")\n\treturn shim.Success(eventJSONasBytes)\n\n}", "title": "" }, { "docid": "e6f4c14aa64053067db69481d75d14b8", "score": "0.42984885", "text": "func (as *ApiService) AccountLedgers(accountId string, startAt, endAt int64, options map[string]string, pagination *PaginationParam) (*ApiResponse, error) {\n\tp := map[string]string{}\n\tif startAt > 0 {\n\t\tp[\"startAt\"] = IntToString(startAt)\n\t}\n\tif endAt > 0 {\n\t\tp[\"endAt\"] = IntToString(endAt)\n\t}\n\tfor k, v := range options {\n\t\tp[k] = v\n\t}\n\tpagination.ReadParam(p)\n\treq := NewRequest(http.MethodGet, fmt.Sprintf(\"/api/v1/accounts/%s/ledgers\", accountId), p)\n\treturn as.Call(req)\n}", "title": "" } ]
bcd81918e3de9f3766c2822d119027d9
ProxyAuthRequired responds with a 407 Proxy Authentication Required error. Takes an optional message of either type string or type error, which will be returned in the response body.
[ { "docid": "603c9808636546df674ae6647c916975", "score": "0.712425", "text": "func TestProxyAuthRequired(t *testing.T) {\n\trr := httptest.NewRecorder()\n\n\tstatusCode := 407\n\terrorType := \"Proxy Authentication Required\"\n\tmessage := \"This is a custom messsage\"\n\n\tvar boomResponse Err\n\n\tRenderProxyAuthRequired(rr, message)\n\n\tif err := json.Unmarshal(rr.Body.Bytes(), &boomResponse); err != nil {\n\t\tt.Errorf(\"response body was not valid JSON: %v\", err)\n\t}\n\n\tif boomResponse.ErrorType != errorType || boomResponse.Message != message || boomResponse.StatusCode != statusCode {\n\t\tt.Fail()\n\t}\n\n\tif rr.Code != statusCode {\n\t\tt.Errorf(\"handler returned wrong status code: got %v want %v\", rr.Code, statusCode)\n\t}\n}", "title": "" } ]
[ { "docid": "d9a0676981c2f724c3c8fa4844d4539b", "score": "0.68004954", "text": "func ProxyAuthRequired(w http.ResponseWriter, response interface{}) {\n\tRespond(w, http.StatusProxyAuthRequired, response)\n}", "title": "" }, { "docid": "419bb7db6f3f77f401ee022577c35df6", "score": "0.6642971", "text": "func (r Writer) ProxyAuthenticationRequired(err string, data interface{}) {\n\tr.Error(err, http.StatusProxyAuthRequired, data)\n}", "title": "" }, { "docid": "c8a41260c4e02fbfd713ca20cd0342b6", "score": "0.5774419", "text": "func clientError(status int) (events.APIGatewayProxyResponse, error) {\n return events.APIGatewayProxyResponse{\n StatusCode: status,\n Body: http.StatusText(status),\n }, nil\n}", "title": "" }, { "docid": "ba0d273c39073a404f04e0bcfcac0c7f", "score": "0.56546515", "text": "func clientError(status int) (apiGatewayProxyResponse, error) {\n\treturn apiGatewayProxyResponse{\n\t\tStatusCode: status,\n\t\tBody: http.StatusText(status),\n\t}, nil\n}", "title": "" }, { "docid": "e4ec0ba20b2ece462c2e0908f4ab89b3", "score": "0.5473927", "text": "func clientError(status int) (events.APIGatewayProxyResponse, error) {\n\treturn events.APIGatewayProxyResponse{\n\t\tStatusCode: status,\n\t\tBody: http.StatusText(status),\n\t}, nil\n}", "title": "" }, { "docid": "077e2efde740c38db7916002154febf6", "score": "0.541871", "text": "func (c *CAS) HandleProxyValidate(w http.ResponseWriter, req *http.Request) {\n\tlog.Print(\"Attempt to use /proxyValidate, feature not supported yet\")\n\tc.render.JSON(w, UnsupportedFeatureError.HttpCode, map[string]string{\"error\": UnsupportedFeatureError.Msg})\n}", "title": "" }, { "docid": "004cbbc24a9936e755b40323fc4abe8d", "score": "0.5373568", "text": "func jsonAuthFail(w http.ResponseWriter) {\n\tw.Header().Add(\"WWW-Authenticate\", `Basic realm=\"qitmeer RPC\"`)\n\thttp.Error(w, \"401 Unauthorized.\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "bc08f091cb95b43ddd7fba0c282a5c01", "score": "0.5289691", "text": "func validateProxyResponseWithUpstream(t *testing.T, test *TestCase, resp *http.Response, err error, logs []*logrus.Entry) {\n\ta := assert.New(t)\n\tt.Logf(\"HTTP Response: %#v\", resp)\n\n\tif test.OverConnect {\n\t\ta.Contains(err.Error(), \"Failed to resolve remote hostname\")\n\t} else {\n\t\ta.Equal(http.StatusBadGateway, resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "1a99d8af6e25b2f36d6cd9e69e756731", "score": "0.5186686", "text": "func Proxy(r Response) (*events.APIGatewayProxyResponse, error) {\n\t// new response with a required status\n\tpxy := events.APIGatewayProxyResponse{StatusCode: r.StatusCode, Headers: make(Headers)}\n\n\t// copy headers\n\tif r.Headers != nil {\n\t\tfor key, value := range r.Headers {\n\t\t\tpxy.Headers[key] = value\n\t\t}\n\t}\n\n\tif r.Body != nil {\n\t\tif b, err := json.Marshal(r.Body); err == nil {\n\t\t\tpxy.Headers[\"Content-Type\"] = \"application/json\"\n\t\t\tpxy.Body = string(b)\n\t\t}\n\t}\n\treturn &pxy, nil\n}", "title": "" }, { "docid": "668331c332b588448ad34bcdb1666a0b", "score": "0.5184855", "text": "func Proxy(prefix, redirectURL string, w http.ResponseWriter, r *http.Request) error {\n\t// log.Printf(\"[proxy] parsing '%s' in '%s'\", prefix, r.URL)\n\trestURL := utils.ReplaceProxyURL(r.URL.String(), prefix, redirectURL)\n\tif restURL == \"\" {\n\t\tmsg := fmt.Sprintf(\"cannot match prefix '%s' in '%s'\", prefix, r.URL)\n\t\tlog.Printf(\"[proxy] err: %s\", msg)\n\t\thttp.Error(w, msg, http.StatusBadRequest)\n\t\treturn errors.New(msg)\n\t}\n\tlog.Printf(\"[proxy] %s (%s) => %+v\\n\", prefix, r.URL, restURL)\n\n\tproxyReq, err := http.NewRequest(r.Method, restURL, r.Body)\n\t// clone copying header, not just a shallow copy proxyReq.Header = req.Header\n\tproxyReq.Header = make(http.Header)\n\tfor key, val := range r.Header {\n\t\tproxyReq.Header[key] = val\n\t}\n\tproxyReq.Header.Set(\"Host\", r.Host)\n\t// set \"accept-encoding\" to prevent from g-zipped content by browser client\n\tproxyReq.Header.Set(\"Accept-Encoding\", \"gzip;q=0,deflate;q=0\")\n\tproxyReq.Header.Set(\"X-Forwarded-For\", r.RemoteAddr)\n\tproxyReq.Body = r.Body\n\n\tresp, err := proxyClient.Do(proxyReq)\n\tif err != nil {\n\t\tlog.Println(\"[proxy] err:\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadGateway)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tdata, err := bodyReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(\"[response] err:\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn err\n\t}\n\tlog.Println(\"[response] data:\", data)\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n\n\treturn nil\n}", "title": "" }, { "docid": "d13460850878ed1559d774bf2b885f90", "score": "0.51631826", "text": "func validateProxyResponse(t *testing.T, test *TestCase, resp *http.Response, err error, logs []*logrus.Entry) {\n\tt.Logf(\"HTTP Response: %#v\", resp)\n\n\ta := assert.New(t)\n\tif test.ExpectAllow {\n\t\t// In some cases we expect the proxy to allow the request but the upstream to return an error\n\t\tif test.ExpectStatus != 0 {\n\t\t\tif resp == nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\ta.Equal(test.ExpectStatus, resp.StatusCode, \"Expected HTTP response code did not match\")\n\t\t\treturn\n\t\t}\n\t\t// CONNECT requests which return a non-200 return an error and a nil response\n\t\tif resp == nil {\n\t\t\ta.Error(err)\n\t\t\treturn\n\t\t}\n\t\ta.Equal(test.ExpectStatus, resp.StatusCode, \"HTTP Response code should indicate success.\")\n\t} else {\n\t\t// CONNECT requests which return a non-200 return an error and a nil response\n\t\tif resp == nil {\n\t\t\ta.Error(err)\n\t\t\treturn\n\t\t}\n\t\t// If there is a response returned, it should contain smokescreen's error message\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\ta.Contains(string(body), \"denied\")\n\t\ta.Contains(string(body), \"additional_error_message_validation_key\")\n\t\ta.Equal(test.ExpectStatus, resp.StatusCode, \"Expected status did not match actual response code\")\n\t}\n\n\tvar entries []*logrus.Entry\n\tentries = append(entries, logs...)\n\n\tif len(entries) > 0 {\n\t\tentry := findLogEntry(entries, smokescreen.CanonicalProxyDecision)\n\t\ta.NotNil(entry)\n\t\ta.Equal(entry.Message, smokescreen.CanonicalProxyDecision)\n\n\t\ta.Contains(entry.Data, \"allow\")\n\t\ta.Equal(test.ExpectAllow, entry.Data[\"allow\"])\n\n\t\ta.Contains(entry.Data, \"proxy_type\")\n\t\tif test.OverConnect {\n\t\t\ta.Equal(\"connect\", entry.Data[\"proxy_type\"])\n\t\t} else {\n\t\t\ta.Equal(\"http\", entry.Data[\"proxy_type\"])\n\t\t}\n\n\t\ta.Contains(entry.Data, \"requested_host\")\n\t\tu, _ := url.Parse(test.TargetURL)\n\t\ta.Equal(fmt.Sprintf(\"%s:%s\", u.Hostname(), u.Port()), entry.Data[\"requested_host\"])\n\t}\n}", "title": "" }, { "docid": "4ddeb944ddc0a3c6f86d6563883b9e7e", "score": "0.51334983", "text": "func jsonAuthFail(w http.ResponseWriter) {\n\tw.Header().Add(\"WWW-Authenticate\", `Basic realm=\"btcd RPC\"`)\n\thttp.Error(w, \"401 Unauthorized.\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "fe97c131ef3bc49ee66c418951743056", "score": "0.5078519", "text": "func BadGateway(w http.ResponseWriter, response interface{}) {\n\tRespond(w, http.StatusBadGateway, response)\n}", "title": "" }, { "docid": "64cf212870c91177512bd1c19e0f2207", "score": "0.50562346", "text": "func (c *CAS) HandleProxy(w http.ResponseWriter, req *http.Request) {\n\tlog.Print(\"Attempt to use /proxy, feature not supported yet\")\n\tc.render.JSON(w, UnsupportedFeatureError.HttpCode, map[string]string{\"error\": UnsupportedFeatureError.Msg})\n}", "title": "" }, { "docid": "623db4e43d5e8827e3bac9809581bf3c", "score": "0.50405693", "text": "func Proxy(w http.ResponseWriter, req *http.Request) {\n\tif req.Method == \"OPTIONS\" {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\tif req.Body == nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"empty request body\"))\n\t\treturn\n\t}\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tlog.Panicf(\"error: %v\", err.Error())\n\t}\n\n\tlbrynetResponse, err := proxy.ForwardCall(body)\n\tif err != nil {\n\t\tresponse, _ := json.Marshal(jsonrpc.RPCResponse{Error: &jsonrpc.RPCError{Message: err.Error()}})\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write(response)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(lbrynetResponse)\n}", "title": "" }, { "docid": "329650fea8311bd746b0bb47249f0283", "score": "0.5029742", "text": "func (fp *FrameParser) ProxyResponse(w http.ResponseWriter) int {\n\theader := w.Header()\n\tstatusCode := fp.ReadLen()\n\thasCL := false\n\n\tfor {\n\t\theaderKey, isNull := fp.ReadString()\n\t\tif isNull {\n\t\t\tbreak\n\t\t}\n\t\tif !hasCL && headerKey == \"Content-Length\" {\n\t\t\thasCL = true\n\t\t}\n\t\tfor {\n\t\t\theaderValue, isNull := fp.ReadString()\n\t\t\tif isNull {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\theader.Add(headerKey, headerValue)\n\t\t}\n\t}\n\n\tif contentLength := fp.ReadInt64(); contentLength >= 0 && !hasCL {\n\t\tif contentLength == 0 {\n\t\t\theader[\"Content-Length\"] = zeroHeaderValue\n\t\t} else {\n\t\t\theader[\"Content-Length\"] = []string{strconv.FormatInt(contentLength, 10)}\n\t\t}\n\t}\n\n\tw.WriteHeader(statusCode)\n\treturn statusCode\n}", "title": "" }, { "docid": "4490b43431d573004feaf40e229d650f", "score": "0.4969125", "text": "func (request *CancelRequest) SetProxyMessage(value *base.ProxyMessage) {\n\trequest.ProxyMessage.SetProxyMessage(value)\n}", "title": "" }, { "docid": "ab6f57419116aa30540f9a62a14ab416", "score": "0.48759913", "text": "func (p *Proxy) Proxy(w http.ResponseWriter, r *http.Request) {\n\t// does a route exist for this request?\n\troute, ok := p.router(r)\n\tif !ok {\n\t\thttputil.ErrorResponse(w, r, httputil.Error(fmt.Sprintf(\"%s is not a managed route.\", r.Host), http.StatusNotFound, nil))\n\t\treturn\n\t}\n\n\tif p.shouldSkipAuthentication(r) {\n\t\tlog.FromRequest(r).Debug().Msg(\"proxy: access control skipped\")\n\t\troute.ServeHTTP(w, r)\n\t\treturn\n\t}\n\n\ts, err := p.restStore.LoadSession(r)\n\t// if authorization bearer token does not exist or fails, use cookie store\n\tif err != nil || s == nil {\n\t\ts, err = p.sessionStore.LoadSession(r)\n\t\tif err != nil {\n\t\t\tlog.FromRequest(r).Debug().Str(\"cause\", err.Error()).Msg(\"proxy: invalid session, re-authenticating\")\n\t\t\tp.sessionStore.ClearSession(w, r)\n\t\t\tp.OAuthStart(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif err = p.authenticate(w, r, s); err != nil {\n\t\tp.sessionStore.ClearSession(w, r)\n\t\thttputil.ErrorResponse(w, r, httputil.Error(\"User unauthenticated\", http.StatusUnauthorized, err))\n\t\treturn\n\t}\n\tauthorized, err := p.AuthorizeClient.Authorize(r.Context(), r.Host, s)\n\tif err != nil {\n\t\thttputil.ErrorResponse(w, r, err)\n\t\treturn\n\t}\n\n\tif !authorized {\n\t\thttputil.ErrorResponse(w, r, httputil.Error(fmt.Sprintf(\"%s is not authorized for this route\", s.Email), http.StatusForbidden, nil))\n\t\treturn\n\t}\n\tr.Header.Set(HeaderUserID, s.User)\n\tr.Header.Set(HeaderEmail, s.RequestEmail())\n\tr.Header.Set(HeaderGroups, s.RequestGroups())\n\n\troute.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "5438d0c03295250ad1c95132959d4e61", "score": "0.48721623", "text": "func (ps *ProxyService) Proxy(w http.ResponseWriter, r *http.Request) (*HTTPResponse, error) {\n\tdata, dataErr := util.JSONDecodeHTTPRequest(r)\n\tif dataErr != nil {\n\t\tlogger.Errorf(ps.Context, \"proxy service\", \"failed to decode body, error : %s\", dataErr.Error())\n\t}\n\tlogger.Debugf(ps.Context, \"proxy service\", \"firing off request, data:%v service:%s path:%s\", data, ps.Service, ps.Path)\n\treturn ps.Send(r.Method, data, \"\", \"\", false, map[string]string{\"Content-Type\": \"application/json; charset=utf-8\", \"X-Namespace\": r.Header.Get(\"Host\")})\n}", "title": "" }, { "docid": "21f8d52af2c441695ed319344da43f3c", "score": "0.48633364", "text": "func (p *Proxy) Proxy(w http.ResponseWriter, r *http.Request) {\n\troute, ok := p.router(r)\n\tif !ok {\n\t\thttputil.ErrorResponse(w, r, httputil.Error(\"\", http.StatusNotFound, nil))\n\t\treturn\n\t}\n\n\tif p.shouldSkipAuthentication(r) {\n\t\tlog.FromRequest(r).Debug().Msg(\"proxy: access control skipped\")\n\t\troute.ServeHTTP(w, r)\n\t\treturn\n\t}\n\ts, err := sessions.FromContext(r.Context())\n\tif err != nil || s == nil {\n\t\tlog.Debug().Err(err).Msg(\"proxy: couldn't get session from context\")\n\t\tp.authenticate(w, r)\n\t\treturn\n\t}\n\tauthorized, err := p.AuthorizeClient.Authorize(r.Context(), r.Host, s)\n\tif err != nil {\n\t\thttputil.ErrorResponse(w, r, err)\n\t\treturn\n\t} else if !authorized {\n\t\thttputil.ErrorResponse(w, r, httputil.Error(fmt.Sprintf(\"%s is not authorized for this route\", s.RequestEmail()), http.StatusForbidden, nil))\n\t\treturn\n\t}\n\tr.Header.Set(HeaderUserID, s.User)\n\tr.Header.Set(HeaderEmail, s.RequestEmail())\n\tr.Header.Set(HeaderGroups, s.RequestGroups())\n\n\troute.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "4482e98bbc75cf43b8e135fd9d54faa2", "score": "0.48575085", "text": "func (p *Proxy) Proxy(w http.ResponseWriter, r *http.Request) {\n\t// Attempts to validate the user and their cookie.\n\terr := p.Authenticate(w, r)\n\t// If the authentication is not successful we proceed to start the OAuth Flow with\n\t// OAuthStart. If successful, we proceed to proxy to the configured upstream.\n\tif err != nil {\n\t\tswitch err {\n\t\tcase http.ErrNoCookie:\n\t\t\t// No cookie is set, start the oauth flow\n\t\t\tp.OAuthStart(w, r)\n\t\t\treturn\n\t\tcase ErrUserNotAuthorized:\n\t\t\t// We know the user is not authorized for the request, we show them a forbidden page\n\t\t\tp.ErrorPage(w, r, http.StatusForbidden, \"Forbidden\", \"You're not authorized to view this page\")\n\t\t\treturn\n\t\tcase sessions.ErrLifetimeExpired:\n\t\t\t// User's lifetime expired, we trigger the start of the oauth flow\n\t\t\tp.OAuthStart(w, r)\n\t\t\treturn\n\t\tcase sessions.ErrInvalidSession:\n\t\t\t// The user session is invalid and we can't decode it.\n\t\t\t// This can happen for a variety of reasons but the most common non-malicious\n\t\t\t// case occurs when the session encoding schema changes. We manage this ux\n\t\t\t// by triggering the start of the oauth flow.\n\t\t\tp.OAuthStart(w, r)\n\t\t\treturn\n\t\tdefault:\n\t\t\tlog.FromRequest(r).Error().Err(err).Msg(\"unknown error\")\n\t\t\t// We don't know exactly what happened, but authenticating the user failed, show an error\n\t\t\tp.ErrorPage(w, r, http.StatusInternalServerError, \"Internal Error\", \"An unexpected error occurred\")\n\t\t\treturn\n\t\t}\n\t}\n\n\t// We have validated the users request and now proxy their request to the provided upstream.\n\troute, ok := p.router(r)\n\tif !ok {\n\t\thttputil.ErrorResponse(w, r, \"unknown route to proxy\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\troute.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "393eedb5d9bb20e04b76703d0e4e2e18", "score": "0.4853844", "text": "func (p *OAuthProxy) errorJSON(rw http.ResponseWriter, code int) {\n\trw.Header().Set(\"Content-Type\", applicationJSON)\n\trw.WriteHeader(code)\n\t// we need to send some JSON response because we set the Content-Type to\n\t// application/json\n\trw.Write([]byte(\"{}\"))\n}", "title": "" }, { "docid": "cb97723f660570e1a1a779fa42ce4efa", "score": "0.4845766", "text": "func Err(e error, status int) (events.APIGatewayProxyResponse, error) {\n\tlog.Println(e)\n\treturn events.APIGatewayProxyResponse{\n\t\tStatusCode: status,\n\t\tBody: e.Error(),\n\t}, nil\n}", "title": "" }, { "docid": "abf2441ec59222f67ed893e0b192a800", "score": "0.48162255", "text": "func OK(status int, body interface{}, headers headers.Headers) events.APIGatewayProxyResponse {\n\t// JSON encode body\n\tjsonBody, err := json.Marshal(body)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"failed to Marshal response body\")\n\t\t// return error instead\n\t\treturn Error(http.StatusInternalServerError, err, headers)\n\t}\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: string(jsonBody),\n\t\tHeaders: headers,\n\t\tStatusCode: status,\n\t}\n}", "title": "" }, { "docid": "d89e8a980aff10256d73142181904efe", "score": "0.48147854", "text": "func (request *ProxyRequest) GetProxyMessage() *ProxyMessage {\n\treturn request.ProxyMessage.GetProxyMessage()\n}", "title": "" }, { "docid": "1d6c44388582f3fcc738058066988b84", "score": "0.48045167", "text": "func (reply *DomainRegisterReply) SetProxyMessage(value *base.ProxyMessage) {\n\treply.ProxyMessage.SetProxyMessage(value)\n}", "title": "" }, { "docid": "7e2004fb10a896517c0af4af66f06dbe", "score": "0.47985196", "text": "func (reply *DomainRegisterReply) GetProxyMessage() *base.ProxyMessage {\n\treturn reply.ProxyMessage.GetProxyMessage()\n}", "title": "" }, { "docid": "62d5f3ca80faa80d72f61e8433529a7c", "score": "0.47978166", "text": "func parseProxyAuth(proxyAuth string) (user, password string, ok bool) {\n\tfakeHeader := make(http.Header)\n\tfakeHeader.Add(\"Authorization\", proxyAuth)\n\tfakeReq := &http.Request{\n\t\tHeader: fakeHeader,\n\t}\n\treturn fakeReq.BasicAuth()\n}", "title": "" }, { "docid": "de08b951e42addb15c84131be7cd3a6b", "score": "0.47695264", "text": "func ProxyBasic(proxy *goproxy.ProxyHttpServer, realm string, f func(user, passwd string) bool) {\n\tproxy.OnRequest().Do(Basic(realm, f))\n\tproxy.OnRequest().HandleConnect(BasicConnect(realm, f))\n}", "title": "" }, { "docid": "3c10692b590d4db166a2c6af4676a44b", "score": "0.47678956", "text": "func ProxyingNotSupportedMessage(messageId uint16) *Message {\n\treturn NewMessage(TYPE_NONCONFIRMABLE, COAPCODE_505_PROXYING_NOT_SUPPORTED, messageId)\n}", "title": "" }, { "docid": "de379314c60b6092251c5a575c15cbd5", "score": "0.4765287", "text": "func (p *OAuthProxy) Proxy(rw http.ResponseWriter, req *http.Request) {\n\tsession, err := p.getAuthenticatedSession(rw, req)\n\tswitch err {\n\tcase nil:\n\t\t// we are authenticated\n\t\tp.addHeadersForProxying(rw, session)\n\t\tp.headersChain.Then(p.upstreamProxy).ServeHTTP(rw, req)\n\tcase ErrNeedsLogin:\n\t\t// we need to send the user to a login screen\n\t\tif p.forceJSONErrors || isAjax(req) || p.isAPIPath(req) {\n\t\t\tlogger.Printf(\"No valid authentication in request. Access Denied.\")\n\t\t\t// no point redirecting an AJAX request\n\t\t\tp.errorJSON(rw, http.StatusUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\tlogger.Printf(\"No valid authentication in request. Initiating login.\")\n\t\tif p.SkipProviderButton {\n\t\t\t// start OAuth flow, but only with the default login URL params - do not\n\t\t\t// consider this request's query params as potential overrides, since\n\t\t\t// the user did not explicitly start the login flow\n\t\t\tp.doOAuthStart(rw, req, nil)\n\t\t} else {\n\t\t\tp.SignInPage(rw, req, http.StatusForbidden)\n\t\t}\n\n\tcase ErrAccessDenied:\n\t\tif p.forceJSONErrors {\n\t\t\tp.errorJSON(rw, http.StatusForbidden)\n\t\t} else {\n\t\t\tp.ErrorPage(rw, req, http.StatusForbidden, \"The session failed authorization checks\")\n\t\t}\n\n\tdefault:\n\t\t// unknown error\n\t\tlogger.Errorf(\"Unexpected internal error: %v\", err)\n\t\tp.ErrorPage(rw, req, http.StatusInternalServerError, err.Error())\n\t}\n}", "title": "" }, { "docid": "c8bff2459163e0a60c000403006e7c20", "score": "0.47523877", "text": "func (request *ProxyRequest) SetProxyMessage(value *ProxyMessage) {\n\trequest.ProxyMessage.SetProxyMessage(value)\n}", "title": "" }, { "docid": "27251067553362cff9e9d97eb1a6e0a2", "score": "0.47354546", "text": "func (r *ProxyResponseWriterV2) GetProxyResponse() (events.APIGatewayV2HTTPResponse, error) {\n\tr.notifyClosed()\n\n\tif r.status == defaultStatusCode {\n\t\treturn events.APIGatewayV2HTTPResponse{}, errors.New(\"Status code not set on response\")\n\t}\n\n\tvar output string\n\tisBase64 := false\n\n\tbb := (&r.body).Bytes()\n\n\tif utf8.Valid(bb) {\n\t\toutput = string(bb)\n\t} else {\n\t\toutput = base64.StdEncoding.EncodeToString(bb)\n\t\tisBase64 = true\n\t}\n\n\theaders := make(map[string]string)\n\tcookies := make([]string, 0)\n\n\tfor headerKey, headerValue := range http.Header(r.headers) {\n\t\tif strings.EqualFold(\"set-cookie\", headerKey) {\n\t\t\tcookies = append(cookies, headerValue...)\n\t\t\tcontinue\n\t\t}\n\t\theaders[headerKey] = strings.Join(headerValue, \",\")\n\t}\n\n\treturn events.APIGatewayV2HTTPResponse{\n\t\tStatusCode: r.status,\n\t\tHeaders: headers,\n\t\tBody: output,\n\t\tIsBase64Encoded: isBase64,\n\t\tCookies: cookies,\n\t}, nil\n}", "title": "" }, { "docid": "dbd6d0768869b8512ad8fc1fab8fdab7", "score": "0.47326618", "text": "func AuthHandler(w http.ResponseWriter, r *http.Request) {\n\n\tdefer func() {\n\t\terr := recover()\n\t\tif err != nil {\n\t\t\thttp.Error(w, utils.ToString(err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tif config.Config.Authentication {\n\t\tauthHeader := r.Header.Get(\"Proxy-Authorization\")\n\t\tif len(strings.TrimSpace(authHeader)) > 0 {\n\t\t\theaderStr := strings.Split(authHeader, \"Basic \")\n\t\t\tif len(headerStr) == 2 {\n\t\t\t\tcredentials, err := base64.StdEncoding.DecodeString(headerStr[1])\n\t\t\t\tif err == nil {\n\t\t\t\t\tdecodedCredentials := string(credentials)\n\t\t\t\t\tuserName := decodedCredentials\n\t\t\t\t\tif userName == config.Config.User {\n\t\t\t\t\t\tutils.GenerateResponse(nil, http.StatusOK, w)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tutils.GenerateResponse(nil, http.StatusUnauthorized, w)\n\t\treturn\n\t}\n\tutils.GenerateResponse(nil, http.StatusOK, w)\n}", "title": "" }, { "docid": "232d7f5f9d51501a052bdff7347dc1c6", "score": "0.47200438", "text": "func (request *CancelRequest) GetProxyMessage() *base.ProxyMessage {\n\treturn request.ProxyMessage.GetProxyMessage()\n}", "title": "" }, { "docid": "53646bc9192fa958258f4d58d9248e42", "score": "0.47158808", "text": "func (h API) daprProxy(resp http.ResponseWriter, req *http.Request) {\n\tvars := mux.Vars(req)\n\n\t// Proxy call via Dapr sidecar\n\t// In format invoke/{service}/method/{methodPath}\n\tinvokeURL := fmt.Sprintf(\n\t\t\"http://localhost:%d/v1.0/invoke/%s/method/%s\",\n\t\tdaprPort,\n\t\tvars[\"service\"],\n\t\tvars[\"restOfURL\"],\n\t)\n\tfmt.Println(\"### Making proxy invoke call to:\", invokeURL)\n\tproxyResp, err := http.Get(invokeURL)\n\n\t// Check major / network errors\n\tif err != nil {\n\t\tcommon.SendProblem(resp, \"\", \"Dapr network error\", 502, err.Error())\n\t\treturn\n\t}\n\n\t// HTTP errors could be downstream is dead/404 or a error returned\n\tif proxyResp.StatusCode < 200 || proxyResp.StatusCode > 299 {\n\t\tcommon.SendProblem(resp, \"\", \"Downstream service HTTP code not OK\", proxyResp.StatusCode, \"\")\n\t\treturn\n\t}\n\n\t// Read the body, we assume it's JSON\n\tdefer proxyResp.Body.Close()\n\tproxyBody, err := ioutil.ReadAll(proxyResp.Body)\n\n\t// Yet more chance for a error\n\tif err != nil {\n\t\tcommon.SendProblem(resp, \"\", \"Body IO error\", 502, err.Error())\n\t\treturn\n\t}\n\n\t// Done, mimic the content type, status and body\n\tresp.Header().Set(\"Content-Type\", proxyResp.Header.Get(\"Content-Type\"))\n\tresp.WriteHeader(proxyResp.StatusCode)\n\tresp.Write(proxyBody)\n}", "title": "" }, { "docid": "5be41a661b53c498f568dfb76ac2d99a", "score": "0.46935302", "text": "func proxy_auth_pipeline(message *HTTPMessage, loc *Location) {\n\n\tswitch loc.Auth.AuthType {\n\tcase \"basic\":\n\t\terr := loc.Auth.Authenticate(message.rheaders[\"Authorization\"])\n\n\t\tif err != nil {\n\t\t\tmessage.authenticated = false\n\t\t}\n\n\tdefault:\n\t\tmessage.authenticated = true\n\t}\n\n}", "title": "" }, { "docid": "a7dcd749053e1f9f8fa092b96940f4dd", "score": "0.46911976", "text": "func proxy(w http.ResponseWriter, req *http.Request) {\n\tc := appengine.NewContext(req)\n\n\t// Select destination based on URL\n\tvar serverURL string\n\tswitch req.URL.Path {\n\tcase \"/auth\":\n\t\tserverURL = config.AuthURL\n\tcase \"/token\":\n\t\tserverURL = config.TokenURL\n\tdefault:\n\t\thttp.Error(w, \"not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Read up to 16K of the body\n\tbody, err := ioutil.ReadAll(&io.LimitedReader{R: req.Body, N: 16384})\n\tif err != nil {\n\t\tlog.Errorf(c, \"Failed to read body: %v\", err)\n\t\thttp.Error(w, \"failed to read body\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Check and replace Authorization if present\n\tauthHeader := req.Header.Get(\"Authorization\")\n\tif authHeader != \"\" {\n\t\tauthHeader, err = updateAuthHeader(authHeader)\n\t\tif err != nil {\n\t\t\tlog.Errorf(c, \"Authorization failed: %v\", err)\n\t\t\thttp.Error(w, \"Authorization failed\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\t// Replace authorization header with a the new one\n\t\treq.Header.Set(\"Authorization\", authHeader)\n\t}\n\n\t// make outgoing URL\n\toutURL, err := url.Parse(serverURL)\n\tif err != nil {\n\t\thttp.Error(w, \"failed to parse URL\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// include incoming URL parameters, replacing client_id if present\n\tquery := req.URL.Query()\n\tif incomingClientID := query.Get(\"client_id\"); incomingClientID != \"\" {\n\t\tif incomingClientID != config.IncomingClientID {\n\t\t\tlog.Errorf(c, \"Authorization failed: Bad Incoming Client ID\")\n\t\t\thttp.Error(w, \"Authorization failed\", http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\tquery.Set(\"client_id\", config.ClientID)\n\t}\n\toutURL.RawQuery = query.Encode()\n\n\t// outgoing request\n\tvar r io.Reader\n\tif len(body) != 0 {\n\t\tr = bytes.NewReader(body)\n\t}\n\toutReq, err := http.NewRequest(req.Method, outURL.String(), r)\n\tif err != nil {\n\t\thttp.Error(w, \"failed to make NewRequest\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// use (modified) headers from incoming request\n\toutReq.Header = req.Header\n\tdelete(outReq.Header, \"Content-Length\")\n\n\t// Do the HTTP round trip\n\tclient := urlfetch.Client(c)\n\tresp, err := client.Do(outReq)\n\tif err != nil {\n\t\tlog.Errorf(c, \"fetch failed: %v\", err)\n\t\thttp.Error(w, \"fetch failed\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// copy the returned headers into the response\n\theader := w.Header()\n\tfor k, vs := range resp.Header {\n\t\tfor _, v := range vs {\n\t\t\theader.Add(k, v)\n\t\t}\n\t}\n\n\t// copy the response code\n\tw.WriteHeader(resp.StatusCode)\n\n\t// copy the returned body to the output\n\t_, err = io.Copy(w, resp.Body)\n\tif err != nil {\n\t\tlog.Errorf(c, \"Failed to write body: %v\", err)\n\t\thttp.Error(w, \"failed to write body\", http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "674e864bdafc3f64a747f94cfaab062c", "score": "0.4689086", "text": "func (s *healthCheckServer) proxyRequest(w http.ResponseWriter, forwardRequest *http.Request) {\n\thttpClient := s.httpClient()\n\n\tresp, err := httpClient.Do(forwardRequest)\n\tif err != nil {\n\t\tklog.Infof(\"error from %s: %v\", forwardRequest.URL, err)\n\t\thttp.Error(w, \"internal error\", http.StatusBadGateway)\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\n\tw.WriteHeader(resp.StatusCode)\n\tif _, err := io.Copy(w, resp.Body); err != nil {\n\t\tklog.Warningf(\"error writing response body: %v\", err)\n\t\treturn\n\t}\n\n\tswitch resp.StatusCode {\n\tcase 200:\n\t\tklog.V(2).Infof(\"proxied to %s %s: %s\", forwardRequest.Method, forwardRequest.URL, resp.Status)\n\tdefault:\n\t\tklog.Infof(\"proxied to %s %s: %s\", forwardRequest.Method, forwardRequest.URL, resp.Status)\n\t}\n}", "title": "" }, { "docid": "01dd400360e5a4a8b6ac0959ccec52d0", "score": "0.46773294", "text": "func (proxy *dooProxy) auth(conn net.Conn, credential string) bool {\n\tif proxy.isAuth() && proxy.validateCredential(credential) {\n\t\treturn true\n\t}\n\t_, err := conn.Write(\n\t\t[]byte(\"HTTP/1.1 407 Proxy Authentication Required\\r\\nProxy-Authenticate: Basic realm=\\\"*\\\"\\r\\n\\r\\n\"))\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b78a3493f9bec4ef3444a453735a1e92", "score": "0.46741283", "text": "func UnauthorizedWithMessage(c *gin.Context, msg string) {\n\tbody := gin.H{\n\t\t\"error\": msg,\n\t}\n\n\tc.AbortWithStatusJSON(http.StatusUnauthorized, body)\n}", "title": "" }, { "docid": "85a94e469977f677b0d3c6c84c622591", "score": "0.46636543", "text": "func TestBadGateway(t *testing.T) {\n\trr := httptest.NewRecorder()\n\n\tstatusCode := 502\n\terrorType := \"Bad Gateway\"\n\tmessage := \"This is a custom messsage\"\n\n\tvar boomResponse Err\n\n\tRenderBadGateway(rr, message)\n\n\tif err := json.Unmarshal(rr.Body.Bytes(), &boomResponse); err != nil {\n\t\tt.Errorf(\"response body was not valid JSON: %v\", err)\n\t}\n\n\tif boomResponse.ErrorType != errorType || boomResponse.Message != message || boomResponse.StatusCode != statusCode {\n\t\tt.Fail()\n\t}\n\n\tif rr.Code != statusCode {\n\t\tt.Errorf(\"handler returned wrong status code: got %v want %v\", rr.Code, statusCode)\n\t}\n}", "title": "" }, { "docid": "f506c3004691904cbd632109e38dffa5", "score": "0.4660891", "text": "func TestInvalidUpstreamProxyConfiguration(t *testing.T) {\n\tvar logHook logrustest.Hook\n\tservers := map[bool]*httptest.Server{}\n\n\t// Create TLS and non-TLS instances of Smokescreen\n\tfor _, useTLS := range []bool{true, false} {\n\t\t_, server, err := startSmokescreen(t, useTLS, &logHook)\n\t\trequire.NoError(t, err)\n\t\tdefer server.Close()\n\t\tservers[useTLS] = server\n\t}\n\n\t// Passing an illegal upstream proxy value is not designed to be an especially well\n\t// handled error so it would fail many of the checks in our other tests. We really\n\t// only care to ensure that these requests never succeed.\n\tfor _, overConnect := range []bool{true, false} {\n\t\tt.Run(fmt.Sprintf(\"illegal proxy with CONNECT %t\", overConnect), func(t *testing.T) {\n\t\t\tvar proxyTarget string\n\t\t\tvar upstreamProxy string\n\n\t\t\t// These proxy targets don't actually matter as the requests won't be sent.\n\t\t\t// because the resolution of the upstream proxy will fail.\n\t\t\tif overConnect {\n\t\t\t\tupstreamProxy = \"https://notaproxy.prxy.svc:443\"\n\t\t\t\tproxyTarget = \"https://api.stripe.com:443\"\n\t\t\t} else {\n\t\t\t\tupstreamProxy = \"http://notaproxy.prxy.svc:80\"\n\t\t\t\tproxyTarget = \"http://checkip.amazonaws.com:80\"\n\t\t\t}\n\n\t\t\ttestCase := &TestCase{\n\t\t\t\tOverConnect: overConnect,\n\t\t\t\tOverTLS: overConnect,\n\t\t\t\tProxyURL: servers[overConnect].URL,\n\t\t\t\tTargetURL: proxyTarget,\n\t\t\t\tUpstreamProxy: upstreamProxy,\n\t\t\t\tRoleName: generateRoleForPolicy(acl.Open),\n\t\t\t\tExpectStatus: http.StatusBadGateway,\n\t\t\t}\n\t\t\tos.Setenv(\"http_proxy\", testCase.UpstreamProxy)\n\t\t\tos.Setenv(\"https_proxy\", testCase.UpstreamProxy)\n\n\t\t\tresp, err := executeRequestForTest(t, testCase, &logHook)\n\t\t\tvalidateProxyResponseWithUpstream(t, testCase, resp, err, logHook.AllEntries())\n\n\t\t\tos.Unsetenv(\"http_proxy\")\n\t\t\tos.Unsetenv(\"https_proxy\")\n\t\t})\n\t}\n}", "title": "" }, { "docid": "751c2af1acdc659167b76af5af08f685", "score": "0.46528634", "text": "func jsonAuthFail(w http.ResponseWriter, r *http.Request, s *rpcServer) {\n\tfmt.Fprint(w, \"401 Unauthorized.\\n\")\n}", "title": "" }, { "docid": "d5cac6dc1d21bb0ed989554578c119eb", "score": "0.46466687", "text": "func (TimeoutError) HTTPCode() int { return http.StatusGatewayTimeout }", "title": "" }, { "docid": "b35f3abe3d88992fc6a8f3b5e5bd7a8c", "score": "0.462868", "text": "func BadGateway(format string, args ...interface{}) error {\n\treturn NewError(http.StatusBadGateway, \"\", format, args...)\n}", "title": "" }, { "docid": "1e0a1254feddd6229e7e0d7682577072", "score": "0.46240428", "text": "func (c *Client) handleForbidden(resp *http.Response) error {\n\tdefer resp.Body.Close()\n\n\ttype proxy struct {\n\t\tMessage string `json:\"message\"`\n\t\tError string `json:\"error\"`\n\t}\n\n\tdecoder := json.NewDecoder(resp.Body)\n\n\tvar errorMessage proxy\n\n\terr := decoder.Decode(&errorMessage)\n\tif err == nil && errorMessage.Message != \"\" {\n\t\treturn Error(errorMessage.Message)\n\t}\n\n\treturn ErrForbidden\n}", "title": "" }, { "docid": "5fe9f31ef165af129f1c05c89995ea7d", "score": "0.46123776", "text": "func Proxy(r *jsonrpc.RPCRequest, accountID string) ([]byte, error) {\n\tresp := preprocessRequest(r, accountID)\n\tif resp != nil {\n\t\treturn MarshalResponse(resp)\n\t}\n\treturn ForwardCall(*r)\n}", "title": "" }, { "docid": "4e92de80c9fa882f7d3585d5c80351a6", "score": "0.4607621", "text": "func AuthFail(w http.ResponseWriter) {\n\tw.Header().Add(\"WWW-Authenticate\", `Basic realm=\"RPC\"`)\n\thttp.Error(w, \"401 Unauthorized.\", http.StatusUnauthorized)\n}", "title": "" }, { "docid": "3da9a842c74ea9159ac982f251f4ebd7", "score": "0.46071547", "text": "func AuthFailed(res http.ResponseWriter) {\n\tres.Header().Set(\"Content-Type\", \"application/json\")\n\tres.Header().Add(\"Access-Control-Expose-Headers\", \"Response-Code, Response-Desc\")\n\tres.Header().Set(\"Response-Code\", \"Authentication failed\")\n\tres.Header().Set(\"Response-Desc\", \"04\")\n\tres.WriteHeader(400)\n}", "title": "" }, { "docid": "dbc40d6fd88931d5e39f36c3f39f0d41", "score": "0.4587358", "text": "func checkProxyConnectedState(stats string, deploymentName string, genericErrMessage string, connectedStateErrMessage string) error {\n\n\tif strings.TrimSpace(stats) == \"\" {\n\t\terr := fmt.Errorf(genericErrMessage+\": could not find any metrics at\", promStatsPath, \"endpoint of the \"+deploymentName+\" deployment\")\n\t\treturn err\n\t}\n\n\tif !strings.Contains(stats, \"envoy_control_plane_connected_state{} 1\") {\n\t\terr := fmt.Errorf(connectedStateErrMessage)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "956a895db49b03feb2cce31fe47c680e", "score": "0.45818818", "text": "func parseBasicProxyAuthorization(request *http.Request) string {\n\tvalue := request.Header.Get(\"Proxy-Authorization\")\n\tif !strings.HasPrefix(value, \"Basic \") {\n\t\treturn \"\"\n\t}\n\n\treturn value[6:] // value[len(\"Basic \"):]\n}", "title": "" }, { "docid": "ab048f7d9a63346332e27c65c56f7768", "score": "0.45668495", "text": "func Respond(status int, message string) (events.APIGatewayProxyResponse, error) {\n\treturn events.APIGatewayProxyResponse{Body: message, StatusCode: status}, nil\n}", "title": "" }, { "docid": "e1ab14f17c6ab6d2f33270bb21cfc836", "score": "0.45601285", "text": "func UseProxy(w http.ResponseWriter, response interface{}) {\n\tRespond(w, http.StatusUseProxy, response)\n}", "title": "" }, { "docid": "244219b9e33a136e6ec90a8725e14800", "score": "0.45432958", "text": "func IsProxyRequest(msg *Message) bool {\n\tif msg.GetOption(OPTION_PROXY_SCHEME) != nil || msg.GetOption(OPTION_PROXY_URI) != nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "955406c0c9cf8960cc68ab7759a3d518", "score": "0.45256093", "text": "func (s *UnitTestSuite) TestProxyMessage() {\n\n\t// empty buffer to create empty proxy message\n\tbuf := bytes.NewBuffer(make([]byte, 0))\n\tmessage, err := base.Deserialize(buf, true)\n\ts.NoError(err)\n\ts.NotNil(message)\n\n\tif v, ok := message.(*base.ProxyMessage); ok {\n\t\ts.Equal(messages.Unspecified, v.Type)\n\t\ts.Empty(v.Properties)\n\t\ts.Empty(v.Attachments)\n\t}\n\n\t// new proxy message to fill\n\tmessage = base.NewProxyMessage()\n\n\tif v, ok := message.(*base.ProxyMessage); ok {\n\n\t\t// fill the properties map\n\t\tp1 := \"1\"\n\t\tp2 := \"2\"\n\t\tp3 := \"\"\n\t\tv.Properties[\"One\"] = &p1\n\t\tv.Properties[\"Two\"] = &p2\n\t\tv.Properties[\"Empty\"] = &p3\n\t\tv.Properties[\"Nil\"] = nil\n\n\t\tv.SetJSONProperty(\"Error\", cadenceerrors.NewCadenceError(\"foo\", cadenceerrors.Custom))\n\n\t\tb, err := base64.StdEncoding.DecodeString(\"c29tZSBkYXRhIHdpdGggACBhbmQg77u/\")\n\t\ts.NoError(err)\n\t\tv.SetBytesProperty(\"Bytes\", b)\n\n\t\t// fill the attachments map\n\t\tv.Attachments = append(v.Attachments, []byte{0, 1, 2, 3, 4})\n\t\tv.Attachments = append(v.Attachments, make([]byte, 0))\n\t\tv.Attachments = append(v.Attachments, nil)\n\n\t\t// serialize the new message\n\t\tserializedMessage, err := v.Serialize(true)\n\t\ts.NoError(err)\n\n\t\t// byte buffer to deserialize\n\t\tbuf = bytes.NewBuffer(serializedMessage)\n\t}\n\n\t// deserialize\n\tmessage, err = base.Deserialize(buf, true)\n\ts.NoError(err)\n\n\t// check that the values are the same\n\tif v, ok := message.(*base.ProxyMessage); ok {\n\n\t\t// type and property values\n\t\ts.Equal(messages.Unspecified, v.Type)\n\t\ts.Equal(6, len(v.Properties))\n\t\ts.Equal(\"1\", *v.Properties[\"One\"])\n\t\ts.Equal(\"2\", *v.Properties[\"Two\"])\n\t\ts.Empty(v.Properties[\"Empty\"])\n\t\ts.Nil(v.Properties[\"Nil\"])\n\t\ts.Equal(\"c29tZSBkYXRhIHdpdGggACBhbmQg77u/\", *v.Properties[\"Bytes\"])\n\n\t\tcadenceError := v.GetJSONProperty(\"Error\", cadenceerrors.NewCadenceErrorEmpty())\n\t\tif v, ok := cadenceError.(*cadenceerrors.CadenceError); ok {\n\t\t\ts.Equal(\"foo\", *v.String)\n\t\t\ts.Equal(cadenceerrors.Custom, v.GetType())\n\t\t}\n\n\t\t// attachment values\n\t\ts.Equal(3, len(v.Attachments))\n\t\ts.Equal([]byte{0, 1, 2, 3, 4}, v.Attachments[0])\n\t\ts.Empty(v.Attachments[1])\n\t\ts.Nil(v.Attachments[2])\n\t}\n}", "title": "" }, { "docid": "6965d3121ff40701bfc945c520488a4e", "score": "0.45210087", "text": "func (o *ConnectCoreV1OptionsNamespacedPodProxyUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "title": "" }, { "docid": "311e73114d4725f9415ee3b66a54107f", "score": "0.4518783", "text": "func errorResponse(errorMessage string, errorStatusCode int) (APIResponse events.APIGatewayProxyResponse, APIError error) {\n\terrorMessage = strings.ReplaceAll(errorMessage, \"\\\"\", \"\\\\\\\"\")\n\treturn events.APIGatewayProxyResponse{\n\t\tHeaders: map[string]string{\"Content-Type\": \"application/json\"},\n\t\tBody: fmt.Sprintf(\"{\\\"error\\\": \\\"%s\\\"}\", errorMessage),\n\t\tStatusCode: errorStatusCode,\n\t}, nil\n}", "title": "" }, { "docid": "e7e788c9341e3a757ecbb64f039a3dd3", "score": "0.45101196", "text": "func proxyhdlr(w http.ResponseWriter, r *http.Request) {\n\n\tif glog.V(3) {\n\t\tglog.Infof(\"Proxy Request from %s: %s %q \\n\", r.RemoteAddr, r.Method, r.URL)\n\t}\n\tswitch r.Method {\n\tcase \"GET\":\n\t\t// Serve the resource.\n\t\t// TODO Give proper error if no server is registered and client is requesting data\n\t\t// or may be directly get from S3??\n\t\tif len(ctx.smap) < 1 {\n\t\t\t// No storage server is registered yet\n\t\t\tglog.Errorf(\"Storage Server count = %d Proxy Request from %s: %s %q \\n\",\n\t\t\t\tlen(ctx.smap), r.RemoteAddr, r.Method, r.URL)\n\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError),\n\t\t\t\thttp.StatusInternalServerError)\n\n\t\t} else {\n\n\t\t\tsid := doHashfindServer(html.EscapeString(r.URL.Path))\n\t\t\tif !ctx.config.Proxy.Passthru {\n\t\t\t\terr := proxyclientRequest(sid, w, r)\n\t\t\t\tif err != nil {\n\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t} else {\n\t\t\t\t\t// TODO HTTP redirect\n\t\t\t\t\tfmt.Fprintf(w, \"DFC-Daemon %q\", html.EscapeString(r.URL.Path))\n\t\t\t\t}\n\t\t\t} else { // passthrough\n\t\t\t\tif glog.V(3) {\n\t\t\t\t\tglog.Infof(\"Redirecting request %q\", html.EscapeString(r.URL.Path))\n\t\t\t\t}\n\t\t\t\tstorageurlurl := \"http://\" +\n\t\t\t\t\tctx.smap[sid].ip + \":\" +\n\t\t\t\t\tctx.smap[sid].port +\n\t\t\t\t\thtml.EscapeString(r.URL.Path)\n\t\t\t\thttp.Redirect(w, r, storageurlurl, http.StatusMovedPermanently)\n\t\t\t}\n\t\t}\n\n\tcase \"POST\":\n\t\t//Proxy server will get POST for Storage server registration only\n\t\terr := r.ParseForm()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to Parse Post Value err = %v \\n\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t\tif glog.V(2) {\n\t\t\tglog.Infof(\"request content %s \\n\", r.Form)\n\t\t}\n\t\tvar sinfo serverinfo\n\t\t// Parse POST values\n\t\tfor str, val := range r.Form {\n\t\t\tif str == IP {\n\t\t\t\tif glog.V(3) {\n\t\t\t\t\tglog.Infof(\"val : %s \\n\", strings.Join(val, \"\"))\n\t\t\t\t}\n\t\t\t\tsinfo.ip = strings.Join(val, \"\")\n\t\t\t}\n\t\t\tif str == PORT {\n\t\t\t\tif glog.V(3) {\n\t\t\t\t\tglog.Infof(\"val : %s \\n\", strings.Join(val, \"\"))\n\t\t\t\t}\n\t\t\t\tsinfo.port = strings.Join(val, \"\")\n\t\t\t}\n\t\t\tif str == ID {\n\t\t\t\tif glog.V(3) {\n\t\t\t\t\tglog.Infof(\"val : %s \\n\", strings.Join(val, \"\"))\n\t\t\t\t}\n\t\t\t\tsinfo.id = strings.Join(val, \"\")\n\t\t\t}\n\n\t\t}\n\n\t\t// Insert into Map based on ID and fail if duplicates.\n\t\t// TODO Fail if there already client registered with same ID\n\t\tctx.smap[sinfo.id] = sinfo\n\t\tif glog.V(3) {\n\t\t\tglog.Infof(\" IP = %s Port = %s Id = %s Curlen of map = %d \\n\",\n\t\t\t\tsinfo.ip, sinfo.port, sinfo.id, len(ctx.smap))\n\t\t}\n\t\tfmt.Fprintf(w, \"DFC-Daemon %q\", html.EscapeString(r.URL.Path))\n\n\tcase \"PUT\":\n\tcase \"DELETE\":\n\tdefault:\n\t\terrstr := fmt.Sprintf(\"Invalid Proxy Request from %s: %s %q \\n\", r.RemoteAddr, r.Method, r.URL)\n\t\tglog.Error(errstr)\n\t\terr := errors.New(errstr)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\n\t}\n\n}", "title": "" }, { "docid": "6f022a32d84173f07c7a1f0ab64478ff", "score": "0.44985887", "text": "func (w *authorizePaymentMethodResponseWriter) BadGateway(err error) {\n\truntime.WriteError(w, 502, err)\n}", "title": "" }, { "docid": "d23f7e5b01c1dbb96f692726b7c15f5d", "score": "0.44825697", "text": "func TestGatewayTimeout(t *testing.T) {\n\trr := httptest.NewRecorder()\n\n\tstatusCode := 504\n\terrorType := \"Gateway Time-out\"\n\tmessage := \"This is a custom messsage\"\n\n\tvar boomResponse Err\n\n\tRenderGatewayTimeout(rr, message)\n\n\tif err := json.Unmarshal(rr.Body.Bytes(), &boomResponse); err != nil {\n\t\tt.Errorf(\"response body was not valid JSON: %v\", err)\n\t}\n\n\tif boomResponse.ErrorType != errorType || boomResponse.Message != message || boomResponse.StatusCode != statusCode {\n\t\tt.Fail()\n\t}\n\n\tif rr.Code != statusCode {\n\t\tt.Errorf(\"handler returned wrong status code: got %v want %v\", rr.Code, statusCode)\n\t}\n}", "title": "" }, { "docid": "ee9a3a4ae8257fe3d848d079c4d54538", "score": "0.44788083", "text": "func Wrap(err error, code ErrorCode, message, detail string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &ProxyError{\n\t\tcode: code,\n\t\tmessage: message,\n\t\tcause: err,\n\t\tdetail: detail,\n\t\tstatusCode: http.StatusServiceUnavailable,\n\t}\n}", "title": "" }, { "docid": "bbeaf6b36b93ed6fa0d1648667de613f", "score": "0.44783565", "text": "func Unauthorized(msg string) ErrorResponse {\n\tif msg == \"\" {\n\t\tmsg = \"You are not authenticated to perform the requested action.\"\n\t}\n\treturn ErrorResponse{\n\t\tStatus: http.StatusUnauthorized,\n\t\tMessage: msg,\n\t}\n}", "title": "" }, { "docid": "ba9ab84dbcc6ad0e6453aada9ae1b6d5", "score": "0.44769487", "text": "func (o *ConnectCoreV1PostNamespacedPodProxyWithPathUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "title": "" }, { "docid": "5193f8efd0459644f671cdb34332e72c", "score": "0.44669095", "text": "func respondWithError(w http.ResponseWriter, message string) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Write([]byte(message))\n}", "title": "" }, { "docid": "54055b1a3671d8a0a8bc453b5d885521", "score": "0.44553486", "text": "func handleProxyCommand(server *Server, client *Client, session *Session, line string) (err error) {\n\tvar quitMsg string\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif quitMsg == \"\" {\n\t\t\t\tquitMsg = client.t(\"Bad or unauthorized PROXY command\")\n\t\t\t}\n\t\t\tclient.Quit(quitMsg, session)\n\t\t}\n\t}()\n\n\tip, err := utils.ParseProxyLineV1(line)\n\tif err != nil {\n\t\treturn err\n\t} else if ip == nil {\n\t\treturn nil\n\t}\n\n\tif utils.IPInNets(client.realIP, server.Config().Server.proxyAllowedFromNets) {\n\t\t// assume PROXY connections are always secure\n\t\terr, quitMsg = client.ApplyProxiedIP(session, ip, true)\n\t\treturn\n\t} else {\n\t\t// real source IP is not authorized to issue PROXY:\n\t\treturn errBadGatewayAddress\n\t}\n}", "title": "" }, { "docid": "c5edd34626756016eca46ac90fdaadca", "score": "0.44523272", "text": "func NewJsonResponse(status int, message string) (events.APIGatewayProxyResponse, error) {\n\tok := false\n\n\tif status > 199 && status < 400 {\n\t\tok = true\n\t}\n\n\treturn NewResponse(status, struct {\n\t\tMessage string `json:\"message\"`\n\t\tOk bool `json:\"ok\"`\n\t}{\n\t\tMessage: message,\n\t\tOk: ok,\n\t})\n}", "title": "" }, { "docid": "29492e053a46716e465581880e244d3a", "score": "0.44515446", "text": "func proxyHandler(w http.ResponseWriter, r *http.Request) {\n\tsession, _ := store.Get(r, \"auth\")\n log.WithFields(log.Fields{\n \"session\": session.Values,\n \"host\": r.Host,\n }).Debug(\"in proxyHandler\")\n\n\tproxy := proxies[r.Host]\n\tif _, ok := session.Values[\"user\"]; ok {\n\t\tr.Header[\"REMOTE_USER\"] = []string{session.Values[\"user\"].(user).Login}\n\t\tr.Header[\"REMOTE_USER_FULL_NAME\"] = []string{session.Values[\"user\"].(user).Name}\n\t\tr.Header[\"REMOTE_USER_EMAIL\"] = []string{session.Values[\"user\"].(user).Email}\n\t}\n\tproxy.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "6a0e4ebfa74272cd74648fa9484a74a7", "score": "0.44495362", "text": "func (p *proxyrunner) checkHTTPAuth(h http.HandlerFunc) http.HandlerFunc {\n\twrappedFunc := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\tauth *authRec\n\t\t\terr error\n\t\t)\n\n\t\tif cmn.GCO.Get().Auth.Enabled {\n\t\t\tif auth, err = p.validateToken(r); err != nil {\n\t\t\t\tglog.Error(err)\n\t\t\t\tp.invalmsghdlr(w, r, \"Not authorized\", http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif auth.isGuest && r.Method == http.MethodPost && strings.Contains(r.URL.Path, \"/\"+cmn.Buckets+\"/\") {\n\t\t\t\t// get bucket objects is POST request, it cannot check the action\n\t\t\t\t// here because it \"emties\" payload and httpbckpost gets nothing.\n\t\t\t\t// So, we just set flag 'Guest' for httpbckpost to use\n\t\t\t\tr.Header.Set(cmn.HeaderGuestAccess, \"1\")\n\t\t\t} else if auth.isGuest && r.Method != http.MethodGet && r.Method != http.MethodHead {\n\t\t\t\tp.invalmsghdlr(w, r, guestError, http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif glog.FastV(4, glog.SmoduleAIS) {\n\t\t\t\tif auth.isGuest {\n\t\t\t\t\tglog.Info(\"Guest access granted\")\n\t\t\t\t} else {\n\t\t\t\t\tglog.Infof(\"Logged as %s\", auth.userID)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\th.ServeHTTP(w, r)\n\t}\n\treturn wrappedFunc\n}", "title": "" }, { "docid": "7c80f38b4bda01891b2c6c56dc822e9c", "score": "0.44400504", "text": "func NewHTTPProxyCreateDefault(code int) *HTTPProxyCreateDefault {\n\treturn &HTTPProxyCreateDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "d40b4364a4aeaf0183468b8265ffdef4", "score": "0.4439545", "text": "func newProxy(config *Config) (*oauthProxy, error) {\n\tvar err error\n\t// step: set the logger\n\thttplog.SetOutput(ioutil.Discard)\n\n\t// step: set the logging level\n\tif config.LogJSONFormat {\n\t\tlog.SetFormatter(&log.JSONFormatter{})\n\t}\n\t// step: set the logging level\n\tgin.SetMode(gin.ReleaseMode)\n\tif config.Verbose {\n\t\tlog.SetLevel(log.DebugLevel)\n\t\tgin.SetMode(gin.DebugMode)\n\t\thttplog.SetOutput(os.Stderr)\n\t}\n\n\tlog.Infof(\"starting %s, author: %s, version: %s, \", prog, author, version)\n\n\tsvc := &oauthProxy{\n\t\tconfig: config,\n\t\tprometheusHandler: prometheus.Handler(),\n\t}\n\n\t// step: parse the upstream endpoint\n\tif svc.endpoint, err = url.Parse(config.Upstream); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// step: initialize the store if any\n\tif config.StoreURL != \"\" {\n\t\tif svc.store, err = createStorage(config.StoreURL); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// step: initialize the openid client\n\tif !config.SkipTokenVerification {\n\t\tif svc.client, svc.idp, svc.idpClient, err = newOpenIDClient(config); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tlog.Warnf(\"TESTING ONLY CONFIG - the verification of the token have been disabled\")\n\t}\n\n\tif config.ClientID == \"\" && config.ClientSecret == \"\" {\n\t\tlog.Warnf(\"Note: client credentials are not set, depending on provider (confidential|public) you might be unable to auth\")\n\t}\n\n\t// step: are we running in forwarding more?\n\tswitch config.EnableForwarding {\n\tcase true:\n\t\tif err := svc.createForwardingProxy(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tif err := svc.createReverseProxy(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn svc, nil\n}", "title": "" }, { "docid": "717805ceb6e31163d61f486374381342", "score": "0.44378927", "text": "func (handler *ProxyRouteHandler) updateProxy(context *gin.Context, req struct{ Body dto.UpdateProxyDto }) error {\n\tid := context.Param(\"id\")\n\tif !bson.IsObjectIdHex(id) {\n\t\t// context.JSON(http.StatusBadRequest, gin.H{\"status\": \"bad id\"})\n\t\treturn g.NewError(400, \"bad proxy id \")\n\t}\n\n\t// var proxy model.Proxy\n\t// err := context.BindJSON(&proxy)\n\t// if !bson.IsObjectIdHex(id) {\n\t// \tcontext.JSON(http.StatusBadRequest, gin.H{\"status\": \"bad proxy\"})\n\t// \treturn\n\t// }\n\n\tb := req.Body\n\terr := handler.validate.ValidateStruct(b)\n\tif err != nil {\n\t\treturn g.NewError(400, \"bad body format\")\n\t}\n\n\terr = handler.proxyService.UpdateProxy(id, b.ToProxyUpdate())\n\tif err != nil {\n\t\tfmt.Println(\"error reset secret:\", err.Error())\n\t\t// context.JSON(http.StatusInternalServerError, gin.H{\"status\": \"error\"})\n\t\treturn g.NewError(430, \"bad Update Proxy \")\n\t}\n\n\tcontext.JSON(http.StatusOK, gin.H{\"status\": \"success\"})\n\treturn nil\n}", "title": "" }, { "docid": "0777fc436923905f9b21cc34b217f4b0", "score": "0.4432484", "text": "func (p *Proxy) AuthenticateOnly(w http.ResponseWriter, r *http.Request) {\n\terr := p.Authenticate(w, r)\n\tif err != nil {\n\t\thttp.Error(w, \"unauthorized request\", http.StatusUnauthorized)\n\t}\n\tw.WriteHeader(http.StatusAccepted)\n}", "title": "" }, { "docid": "f2bbac29540f232275a0d9efd8cf9660", "score": "0.44237986", "text": "func Proxy(proxyAddr string, redirectSchemeAndHost string) func() error {\n\tproxyAddr = ParseHost(proxyAddr)\n\n\t// override the handler and redirect all requests to this addr\n\th := ProxyHandler(proxyAddr, redirectSchemeAndHost)\n\tprx := New(OptionDisableBanner(true))\n\tprx.Router = h\n\n\tgo prx.Listen(proxyAddr)\n\n\treturn prx.Close\n}", "title": "" }, { "docid": "ccb3a6ab6f8ba336bf67bab9979175f5", "score": "0.44171765", "text": "func (UnauthorizedError) HTTPCode() int { return http.StatusUnauthorized }", "title": "" }, { "docid": "98b302b66ba58c4a4cf2fc62f06951bb", "score": "0.43930072", "text": "func RespondWithError(w http.ResponseWriter, code int, msg string) {\n RespondWithJson(w, code, map[string]string{\"error\": msg})\n}", "title": "" }, { "docid": "d95b29c24f23c12f21db158ff8acf46a", "score": "0.4384815", "text": "func handleAuth(proxy *mist.Proxy, msg mist.Message) error {\n\treturn nil\n}", "title": "" }, { "docid": "d3cb884a96fcb48a37106877734e7658", "score": "0.4379057", "text": "func AuthFailed(w http.ResponseWriter, r *http.Request) {\n\tif !isXHR(w, r) {\n\t\thttp.Redirect(w, r, \"/?hai\", http.StatusFound)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusUnauthorized)\n}", "title": "" }, { "docid": "1d60511c88790899df857974c67dcab9", "score": "0.43757197", "text": "func forwardToProxy(proxy model.Proxy, path string, context *gin.Context) (string, error) {\n\t// we need to buffer the body if we want to read it here and send it\n\t// in the request.\n\tbody, err := ioutil.ReadAll(context.Request.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// you can reassign the body if you need to parse it as multipart\n\tcontext.Request.Body = ioutil.NopCloser(bytes.NewReader(body))\n\n\tproxyScheme := \"http\"\n\tproxyHost := proxy.IP + \":\" + fmt.Sprint(proxy.Port)\n\t// create a new url from the raw RequestURI sent by the client\n\turl := fmt.Sprintf(\"%s://%s%s\", proxyScheme, proxyHost, \"/api/v1/config/\"+path)\n\tlog.Println(url)\n\tproxyReq, err := http.NewRequest(context.Request.Method, url, bytes.NewReader(body))\n\tproxyReq.Header = make(http.Header)\n\tfor h, val := range context.Request.Header {\n\t\tproxyReq.Header[h] = val\n\t}\n\thttpClient := http.Client{}\n\tresp, err := httpClient.Do(proxyReq)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err = ioutil.ReadAll(resp.Body)\n\treturn string(body), nil\n}", "title": "" }, { "docid": "5a09071da5b2f059e9e063b5d4927c04", "score": "0.43717754", "text": "func BadAuthErr(err error) error { return HTTPErr(http.StatusForbidden, \"Forbidden\", err) }", "title": "" }, { "docid": "b5ac45e9dda1a4ed637f463508d463cd", "score": "0.43710878", "text": "func handleErrors(res *http.Response, req *http.Request) error {\n\tif res.StatusCode == 401 {\n\t\treturn fmt.Errorf(\"access to Hydrophone is not authorized\")\n\t} else {\n\t\treturn fmt.Errorf(\"unknown response code from service[%s], code %v\", req.URL, res.StatusCode)\n\t}\n}", "title": "" }, { "docid": "49c91ba8b1ffe44264c10ffd59092d93", "score": "0.43706128", "text": "func Failed(message string) []byte {\n\treturn createResponse(Response{\n\t\tStatusCode: 500,\n\t\tMessage: message,\n\t})\n}", "title": "" }, { "docid": "b1d93ed7414160e7ff2d6e4d0831ecbf", "score": "0.4361377", "text": "func ResponseUnauthorized(c *gin.Context, message string) {\n\tif message == \"\" {\n\t\tmessage = \"Unauthorized\"\n\t}\n\tc.JSON(http.StatusUnauthorized, gin.H{\"errors\": message})\n\treturn\n}", "title": "" }, { "docid": "474f5f0d99c20f7b619077a2d0fcd7c0", "score": "0.4351927", "text": "func Unauthorized(w http.ResponseWriter, message string) {\n\tJSONResponse(w, http.StatusUnauthorized, &ResponseError{\n\t\tCode: http.StatusUnauthorized,\n\t\tMessage: message,\n\t})\n}", "title": "" }, { "docid": "f7d333ab2d83b775543c51fa1b6ca164", "score": "0.4347665", "text": "func ErrInvalidProxyWithdrawTotal(codespace sdk.CodespaceType, addr string) sdk.Error {\n\treturn sdk.NewError(codespace, CodeInvalidProxy,\n\t\t\"failed. proxy %s has to unreg before withdrawing total tokens\", addr)\n}", "title": "" }, { "docid": "0f415540d511f9ecfe112a4ed1a3f265", "score": "0.43384138", "text": "func Forbidden(msg string) ErrorResponse {\n\tif msg == \"\" {\n\t\tmsg = \"You are not authorized to perform the requested action.\"\n\t}\n\treturn ErrorResponse{\n\t\tStatus: http.StatusForbidden,\n\t\tMessage: msg,\n\t}\n}", "title": "" }, { "docid": "4ec098c36104b82514a6c3c784801d25", "score": "0.43376598", "text": "func (r *Request) WriteProxy(w io.Writer) error {}", "title": "" }, { "docid": "5e07bec67cce1195002d64c03968f474", "score": "0.43366995", "text": "func (o *HTTPProxyCreateDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "b8b15b81670434de9d02102d844e0da1", "score": "0.43362877", "text": "func (handler *ProxyRouteHandler) createProxy(context *gin.Context, req struct{ Body dto.CreateProxyDto }) error {\n\t// var body model.Proxy\n\n\t// err := context.ShouldBindJSON(&body)\n\t// if err != nil || body.Name == \"\" {\n\t// \tfmt.Println(err)\n\t// \tcontext.JSON(http.StatusBadRequest, gin.H{\"status\": \"bad data\"})\n\t// \treturn\n\t// }\n\tb := req.Body\n\terr := handler.validate.ValidateStruct(b)\n\tif err != nil {\n\t\treturn g.NewError(400, \"bad body format\")\n\t}\n\n\tid, secret, err := handler.proxyService.NewProxy(b)\n\tif err != nil {\n\t\treturn g.NewError(403, \"bad Create Proxy \")\n\t}\n\tcontext.JSON(http.StatusOK, gin.H{\"proxyId\": id, \"proxySecret\": secret})\n\treturn nil\n}", "title": "" }, { "docid": "effc1bd46efc5284ec15e297bbfe821e", "score": "0.43335825", "text": "func WriteResponseMessage(w http.ResponseWriter, status int, message string) error {\n\tvar err error\n\n\tw.WriteHeader(status)\n\tfmt.Fprintf(w, message)\n\t//log.Println(message)\n\n\treturn err\n}", "title": "" }, { "docid": "3caf2434048cbb743f2758a3eb00ae4d", "score": "0.43335423", "text": "func (r *oauthProxy) createForwardingProxy() error {\n\tlog.Infof(\"enabling forward signing mode, listening on %s\", r.config.Listen)\n\n\tif r.config.SkipUpstreamTLSVerify {\n\t\tlog.Warnf(\"TLS verification switched off. In forward signing mode it's recommended you verify! (--skip-upstream-tls-verify=false)\")\n\t}\n\n\t// step: initialize the reverse http proxy\n\tif err := r.createUpstreamProxy(nil); err != nil {\n\t\treturn err\n\t}\n\n\t// step: setup and initialize the handler\n\tforwardingHandler := r.forwardProxyHandler()\n\n\t// step: set the http handler\n\tproxy := r.upstream.(*goproxy.ProxyHttpServer)\n\tr.router = proxy\n\n\t// step: setup the tls configuration\n\tif r.config.TLSCaCertificate != \"\" && r.config.TLSCaPrivateKey != \"\" {\n\t\tca, err := loadCA(r.config.TLSCaCertificate, r.config.TLSCaPrivateKey)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to load certificate authority, error: %s\", err)\n\t\t}\n\t\t// step: implement the goproxy connect method\n\t\tproxy.OnRequest().HandleConnectFunc(\n\t\t\tfunc(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string) {\n\t\t\t\treturn &goproxy.ConnectAction{\n\t\t\t\t\tAction: goproxy.ConnectMitm,\n\t\t\t\t\tTLSConfig: goproxy.TLSConfigFromCA(ca),\n\t\t\t\t}, host\n\t\t\t},\n\t\t)\n\t} else {\n\t\t// step: use the default certificate provided by goproxy\n\t\tproxy.OnRequest().HandleConnect(goproxy.AlwaysMitm)\n\t}\n\n\tproxy.OnResponse().DoFunc(func(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response {\n\t\t// @NOTES, somewhat annoying but goproxy hands back a nil response on proxy client errors\n\t\tif resp != nil && r.config.LogRequests {\n\t\t\tstart := ctx.UserData.(time.Time)\n\t\t\tlatency := time.Now().Sub(start)\n\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"method\": resp.Request.Method,\n\t\t\t\t\"status\": resp.StatusCode,\n\t\t\t\t\"bytes\": resp.ContentLength,\n\t\t\t\t\"host\": resp.Request.Host,\n\t\t\t\t\"path\": resp.Request.URL.Path,\n\t\t\t\t\"latency\": latency.String(),\n\t\t\t}).Infof(\"[%d] |%s| |%10v| %-5s %s\", resp.StatusCode, resp.Request.Host, latency, resp.Request.Method, resp.Request.URL.Path)\n\t\t}\n\n\t\treturn resp\n\t})\n\tproxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {\n\t\tctx.UserData = time.Now()\n\t\t// step: forward into the handler\n\t\tforwardingHandler(req, ctx.Resp)\n\n\t\treturn req, ctx.Resp\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "b75412ec48119b542eab94285696a906", "score": "0.43319535", "text": "func errorResponse(ctx filters.Context, req *http.Request, err error) (*http.Response, filters.Context, error) {\n\tresp, c, err := filters.Fail(ctx, req, errors.HttpStatusCode(err), err)\n\tresp.Header.Add(constants.HeaderProxyErrorCode, errors.Code(err).String())\n\tresp.Header.Add(constants.HeaderProxyError, errors.Message(err))\n\treturn resp, c, err\n}", "title": "" }, { "docid": "2cc363eae4169e691dd1a1f6aebfd022", "score": "0.432816", "text": "func Forbidden(w http.ResponseWriter, message string) {\n\tJSONResponse(w, http.StatusForbidden, &ResponseError{\n\t\tCode: http.StatusForbidden,\n\t\tMessage: message,\n\t})\n}", "title": "" }, { "docid": "0d1ba29dd61fbabb9959ea17696f7e7f", "score": "0.43243557", "text": "func (ps *ProxyService) ProxyHost(host string, w http.ResponseWriter, r *http.Request) (*HTTPResponse, error) {\n\tdata, dataErr := util.JSONDecodeHTTPRequest(r)\n\tif dataErr != nil {\n\t\tlogger.Errorf(ps.Context, \"proxy service\", \"failed to decode body, error : %s\", dataErr.Error())\n\t}\n\tlogger.Errorf(ps.Context, \"proxy service\", \"firing off request, data:%v service:%s path:%s\", data, ps.Service, ps.Path)\n\treturn ps.SendHost(host, r.Method, data, \"\", \"\", false, map[string]string{\"Content-Type\": \"application/json; charset=utf-8\", \"X-Namespace\": r.Header.Get(\"Host\")})\n}", "title": "" }, { "docid": "c5c6d64c49f5a54422a1f9dbd63b08be", "score": "0.4319368", "text": "func TestProxyHandler(t *testing.T) {\n\tproxyRoute := &ProxyRoute{\n\t\tPrefix: \"/prefix\", RedirectURL: \"http://redirect\",\n\t}\n\thandler := ProxyHandler(proxyRoute.Prefix, proxyRoute.RedirectURL)\n\tswitch v := handler.(type) {\n\tcase http.HandlerFunc:\n\t\tlog.Println(\"ProxyHandler is an http.HandlerFunc\")\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"%v is not http.HandlerFunc\", v)\n\t\tassert.Fail(t, msg)\n\t}\n\n\ttests := []struct {\n\t\trequestURL string\n\t\texpectedCode int\n\t}{\n\t\t{\"\", http.StatusBadRequest},\n\t\t{\"http://test/foo\", http.StatusBadGateway},\n\t}\n\n\tfor idx, test := range tests {\n\t\treq, _ := http.NewRequest(\"GET\", test.requestURL, nil)\n\t\trwr := httptest.NewRecorder()\n\n\t\tlog.Printf(\"Test %2d: %s\\n\", idx, test.requestURL)\n\t\tproxyRoute.ServeHTTP(rwr, req)\n\t\thandler.ServeHTTP(rwr, req)\n\n\t\t// log.Printf(\"Test %2d - request: %s - %#v\\n\", idx, req.URL, req)\n\t\t// log.Printf(\"Test %2d - response: %#v\\n\", idx, rwr)\n\t\tassert.Equal(t, test.expectedCode, rwr.Code)\n\t}\n}", "title": "" }, { "docid": "ed608eb5dd839784eb71bda1fe0274a4", "score": "0.43174323", "text": "func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tmessage := Message{}\n\tif request.Resource == \"/login\" {\n\t\tresp, err := LoginService(request.Body)\n\t\tif err != nil {\n\t\t\tfmt.Println(fmt.Sprintf(\"login err: %v\", err))\n\t\t\treturn events.APIGatewayProxyResponse{}, err\n\t\t}\n\n\t\tr, err := json.Marshal(resp)\n\t\tif err != nil {\n\t\t\treturn events.APIGatewayProxyResponse{}, err\n\t\t}\n\n\t\tmessage.Message = string(r)\n\t}\n\n\tif request.Resource == \"/verify\" {\n\t\tresp, err := VerifyService(request.Body)\n\t\tif err != nil {\n\t\t\tfmt.Println(fmt.Sprintf(\"verify err: %v\", err))\n\t\t\treturn events.APIGatewayProxyResponse{}, err\n\t\t}\n\t\tmessage.Message = resp\n\t}\n\n\tm, err := json.Marshal(message)\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprintf(\"message marshall err: %v\", err))\n\t\treturn events.APIGatewayProxyResponse{}, err\n\t}\n\n\treturn events.APIGatewayProxyResponse{\n\t\tBody: string(m),\n\t\tStatusCode: 200,\n\t}, nil\n}", "title": "" }, { "docid": "8e3e10dbac3c1b2f7d86071872587aad", "score": "0.43087056", "text": "func (o *ConnectCoreV1PostNamespacedServiceProxyWithPathUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "title": "" }, { "docid": "7f89f3ac5ae51d4ea264a110cffc0d0e", "score": "0.43013853", "text": "func ResponseMethodNotAllowed(c *gin.Context, message string) {\n\tif message == \"\" {\n\t\tmessage = \"Method Not Allowed\"\n\t}\n\n\tc.JSON(http.StatusMethodNotAllowed, gin.H{\"errors\": message})\n\treturn\n}", "title": "" }, { "docid": "c518c22e268a875f39e2a1b8e95e7ce5", "score": "0.4297656", "text": "func (h *Handlers) ProxyAuthentication(c *gin.Context, dc desmond.Context) {\n\t// construct inputs for test\n\ttest := constructProxyTest(c.Request.URL.RawQuery)\n\tcontrol := pullControlFromQuery(c.Request.URL)\n\n\t// test\n\tif testMatchesControl(test, control) {\n\t\tc.Next()\n\t\treturn\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"queryString\": c.Request.URL.RawQuery,\n\t\t\"test\": test,\n\t\t\"control\": control,\n\t}).Error(\"(ProxyAuth) failed\")\n\tc.AbortWithStatus(401)\n}", "title": "" }, { "docid": "86ca1c9cf29b182a6303d162cbd51717", "score": "0.42952502", "text": "func (p *SuperProxy) readHTTPProxyResp(c net.Conn, pool *bufiopool.Pool) error {\n\tr := pool.AcquireReader(c)\n\tdefer pool.ReleaseReader(r)\n\tn := 1\n\tisStartLine := true\n\theaderParsed := false\n\tfor {\n\t\tif b, err := r.Peek(n); err != nil {\n\t\t\treturn err\n\t\t} else if len(b) == 0 {\n\t\t\treturn io.EOF\n\t\t}\n\t\t// must read buffed bytes\n\t\tb := util.PeekBuffered(r)\n\t\t// read and discard every header line\n\t\tm := 0\n\t\tfor !headerParsed {\n\t\t\tb := b[m:]\n\t\t\tlineLen := bytes.IndexByte(b, '\\n')\n\t\t\tif lineLen < 0 {\n\t\t\t\t// need more\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlineLen++\n\t\t\tm += lineLen\n\t\t\tif isStartLine {\n\t\t\t\tisStartLine = false\n\t\t\t\tif !bytes.Contains(b[:lineLen], []byte(\" 200 \")) {\n\t\t\t\t\treturn fmt.Errorf(\"connected to proxy failed with start line %s\", b[:lineLen])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (lineLen == 2 && b[0] == '\\r') || lineLen == 1 {\n\t\t\t\t\t// single \\n or \\r\\n means end of the header\n\t\t\t\t\theaderParsed = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, err := r.Discard(lineLen); err != nil {\n\t\t\t\treturn util.ErrWrapper(err, \"fail to read proxy connect response\")\n\t\t\t}\n\t\t}\n\t\tif headerParsed {\n\t\t\t// TODO: discard http body also? Does the proxy connect response contains body?\n\t\t\treturn nil\n\t\t}\n\t\t// require one more byte\n\t\tn = r.Buffered() + 1\n\t}\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "eae24650b7d18d49a4ef02fd970a65c3", "score": "0.0", "text": "func (in *AntreaClusterNetworkPolicyStats) DeepCopyInto(out *AntreaClusterNetworkPolicyStats) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tout.TrafficStats = in.TrafficStats\n\tif in.RuleTrafficStats != nil {\n\t\tin, out := &in.RuleTrafficStats, &out.RuleTrafficStats\n\t\t*out = make([]RuleTrafficStats, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "854825ecc9cd3a0495a19df5509c3c2f", "score": "0.82257444", "text": "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n}", "title": "" }, { "docid": "760357bc14dbd63f0878759aca969b71", "score": "0.81376606", "text": "func (in *Output) DeepCopyInto(out *Output) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7301f5678de7282507f88cf56a8f5020", "score": "0.81188333", "text": "func (in *Version) DeepCopyInto(out *Version) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "477d12977ccedc720e9eeed2cceef4ad", "score": "0.8085144", "text": "func (in *Parser) DeepCopyInto(out *Parser) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9277508c6f4a9eb94b5bc53225b87fd6", "score": "0.8064722", "text": "func (in *Size) DeepCopyInto(out *Size) {\n\t*out = *in\n}", "title": "" }, { "docid": "71f7571eb16269b8ded7102013eb2fcb", "score": "0.8058729", "text": "func (in *TargetObj) DeepCopyInto(out *TargetObj) {\n\t*out = *in\n}", "title": "" }, { "docid": "bf7b4b522057ae01ab0d93d4522fe30a", "score": "0.80479336", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "bf7b4b522057ae01ab0d93d4522fe30a", "score": "0.80479336", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "30d5a6805fd4fa1a057ce4497fc7b0ff", "score": "0.80342454", "text": "func (in *Build) DeepCopyInto(out *Build) {\n\t*out = *in\n}", "title": "" }, { "docid": "bd31f739afee4d8ac0f25b43cee7cdf6", "score": "0.8032005", "text": "func (in *Jmx) DeepCopyInto(out *Jmx) {\n\t*out = *in\n}", "title": "" }, { "docid": "8e8acfb208833240003e7bd04991a6fd", "score": "0.8022911", "text": "func (in *Res) DeepCopyInto(out *Res) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "45607a53c4ae582710d113a58be4b5ca", "score": "0.80223733", "text": "func (in *BackupInvokerRef) DeepCopyInto(out *BackupInvokerRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cdb1b110aa6c8f15da6e580e063891b8", "score": "0.8006015", "text": "func (in *InputParser) DeepCopyInto(out *InputParser) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fe843f24d377bc345c3c2bafc6836e50", "score": "0.7999529", "text": "func (in *LDAPCheck) DeepCopyInto(out *LDAPCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "a79d310025d9bad0312cdb9615f67da0", "score": "0.7996956", "text": "func (in *InferenceTarget) DeepCopyInto(out *InferenceTarget) {\n\t*out = *in\n}", "title": "" }, { "docid": "32411e48b0c41369a3b37f1f34c69604", "score": "0.79760677", "text": "func (in *Heapster) DeepCopyInto(out *Heapster) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "15fc36816a874df726f7daacda88349f", "score": "0.79754645", "text": "func (in *DataPath) DeepCopyInto(out *DataPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "73b3e2ee8d0f1c30554fc6f775e42f09", "score": "0.79680604", "text": "func (in *Hazelcast) DeepCopyInto(out *Hazelcast) {\n\t*out = *in\n}", "title": "" }, { "docid": "acbc3f1efee5aaa8d03be05054421061", "score": "0.7967311", "text": "func (in *Backup) DeepCopyInto(out *Backup) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7b25b696e89f23360fd8f34af49816dc", "score": "0.7962411", "text": "func (in *RestoreTarget) DeepCopyInto(out *RestoreTarget) {\n\t*out = *in\n\tout.Ref = in.Ref\n\tif in.VolumeMounts != nil {\n\t\tin, out := &in.VolumeMounts, &out.VolumeMounts\n\t\t*out = make([]corev1.VolumeMount, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Replicas != nil {\n\t\tin, out := &in.Replicas, &out.Replicas\n\t\t*out = new(int32)\n\t\t**out = **in\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]offshootapiapiv1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Rules != nil {\n\t\tin, out := &in.Rules, &out.Rules\n\t\t*out = make([]Rule, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe55aea8bcbb4c5fb7ce8689ae5b50db", "score": "0.7958489", "text": "func (in *OTLP) DeepCopyInto(out *OTLP) {\n\t*out = *in\n}", "title": "" }, { "docid": "4cc4474c2a1333bf5f947b2294d0b027", "score": "0.7952579", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0919c719fbed6afefb28478852255757", "score": "0.79450506", "text": "func (in *VfInfo) DeepCopyInto(out *VfInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "ffd1a2a762b20e39ec3e229a7fa8c82d", "score": "0.79428315", "text": "func (in *Toleration) DeepCopyInto(out *Toleration) {\n\t*out = *in\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.7942668", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.7942668", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.7936731", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.7936731", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "01a4a6fa60275bc00731594653970844", "score": "0.793288", "text": "func (in *ObjectStorageTLSSpec) DeepCopyInto(out *ObjectStorageTLSSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "ae8320d666daf42f7b276f91c508dfdb", "score": "0.7930093", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n}", "title": "" }, { "docid": "5d6676976741906b273edf03cf097f8d", "score": "0.791365", "text": "func (in *Identity) DeepCopyInto(out *Identity) {\n\t*out = *in\n}", "title": "" }, { "docid": "e7824965b786de83e5edd7c40c1905bd", "score": "0.7911581", "text": "func (in *Cache) DeepCopyInto(out *Cache) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c06114d198782896449be1949d23d234", "score": "0.7907547", "text": "func (in *IoPerf) DeepCopyInto(out *IoPerf) {\n\t*out = *in\n}", "title": "" }, { "docid": "c615a020c64c11406e2c550e7ecaef60", "score": "0.7903731", "text": "func (in *DingTalk) DeepCopyInto(out *DingTalk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b7393f65fb4d2df141f42b8c195d3860", "score": "0.79024917", "text": "func (in *CanaryResult) DeepCopyInto(out *CanaryResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "af229d6e46b09920288a05ff27f2055f", "score": "0.7902033", "text": "func (in *Instance) DeepCopyInto(out *Instance) {\n\t*out = *in\n}", "title": "" }, { "docid": "d7c721157968f6bd706d0455330c4026", "score": "0.78964335", "text": "func (in *TCPCheck) DeepCopyInto(out *TCPCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "778b99573503a518fafd03683f65a07e", "score": "0.78956455", "text": "func (in *KMSEncryptionAlibaba) DeepCopyInto(out *KMSEncryptionAlibaba) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f2e09bb7e9a17cc1e32f0d15d54b1922", "score": "0.7894656", "text": "func (in *NodeResult) DeepCopyInto(out *NodeResult) {\n\t*out = *in\n\tif in.Observations != nil {\n\t\tin, out := &in.Observations, &out.Observations\n\t\t*out = make([]Observation, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f2e09bb7e9a17cc1e32f0d15d54b1922", "score": "0.7894656", "text": "func (in *NodeResult) DeepCopyInto(out *NodeResult) {\n\t*out = *in\n\tif in.Observations != nil {\n\t\tin, out := &in.Observations, &out.Observations\n\t\t*out = make([]Observation, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "06a3b3f38b6ff0617d4968300458ec9c", "score": "0.789431", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "86e6e9110b4e611d68a6016ced01967e", "score": "0.78888327", "text": "func (in *DNS) DeepCopyInto(out *DNS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2c0186ad474559dbf6791ceb1124b087", "score": "0.788602", "text": "func (in *Rule) DeepCopyInto(out *Rule) {\n\t*out = *in\n\tif in.TargetHosts != nil {\n\t\tin, out := &in.TargetHosts, &out.TargetHosts\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Snapshots != nil {\n\t\tin, out := &in.Snapshots, &out.Snapshots\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Paths != nil {\n\t\tin, out := &in.Paths, &out.Paths\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bf4475f50224fcbecdf3c494868d167b", "score": "0.78823894", "text": "func (in *Json6902) DeepCopyInto(out *Json6902) {\n\t*out = *in\n\tin.Target.DeepCopyInto(&out.Target)\n}", "title": "" }, { "docid": "91acd35f3d3dfc1f65af5ad610c93290", "score": "0.7875857", "text": "func (in *NIC) DeepCopyInto(out *NIC) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.78745943", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "4db8dae318248c89d5b1884921cf3f0c", "score": "0.78716767", "text": "func (in *TestOracle) DeepCopyInto(out *TestOracle) {\n\t*out = *in\n\tif in.Pass != nil {\n\t\tin, out := &in.Pass, &out.Pass\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Fail != nil {\n\t\tin, out := &in.Fail, &out.Fail\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "9b3266dd6bad29cf240af4b4fb444de3", "score": "0.7864322", "text": "func (in *Artifacts) DeepCopyInto(out *Artifacts) {\n\t*out = *in\n}", "title": "" }, { "docid": "77971dc0b377a52b9d2814eb5a6acc6f", "score": "0.7859761", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "29e02c97b127087f995d6b0457b82abc", "score": "0.785785", "text": "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "title": "" }, { "docid": "74741263fc8a9e2990e2e3a20b799143", "score": "0.78568625", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e85c49c1705dd0d0d0a0564220621e8f", "score": "0.78549266", "text": "func (in *Dependency) DeepCopyInto(out *Dependency) {\n\t*out = *in\n}", "title": "" }, { "docid": "370fd9524fb300cb6e294a6ecb9e8a2d", "score": "0.784762", "text": "func (in *SystemRule) DeepCopyInto(out *SystemRule) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3e013886e6bc1d59a365df69c5ee97c5", "score": "0.784401", "text": "func (in *ReferenceObject) DeepCopyInto(out *ReferenceObject) {\n\t*out = *in\n}", "title": "" }, { "docid": "a9062924f4e13bda7a07fc0c62640c37", "score": "0.7842727", "text": "func (in *BackupTarget) DeepCopyInto(out *BackupTarget) {\n\t*out = *in\n\tout.Ref = in.Ref\n\tif in.Paths != nil {\n\t\tin, out := &in.Paths, &out.Paths\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.VolumeMounts != nil {\n\t\tin, out := &in.VolumeMounts, &out.VolumeMounts\n\t\t*out = make([]corev1.VolumeMount, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Replicas != nil {\n\t\tin, out := &in.Replicas, &out.Replicas\n\t\t*out = new(int32)\n\t\t**out = **in\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "427593624e8f7c25b1f2d36902ae0730", "score": "0.784147", "text": "func (in *Compaction) DeepCopyInto(out *Compaction) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "647f1524647108952ee31ce014c689dc", "score": "0.7840965", "text": "func (in *HelmTiller) DeepCopyInto(out *HelmTiller) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "4b862c3b8921cf3f39b78a13d968c9fc", "score": "0.7839309", "text": "func (in *FinalInstallStep) DeepCopyInto(out *FinalInstallStep) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5ab614070f87d291c5c74f600b683d65", "score": "0.78360313", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "44de1c7a8498d83ec6f0a1339d4d328c", "score": "0.7831643", "text": "func (in *EnvSelector) DeepCopyInto(out *EnvSelector) {\n\t*out = *in\n}", "title": "" }, { "docid": "cb473a50a2c7608cb863df348afabf6c", "score": "0.78262097", "text": "func (in *State) DeepCopyInto(out *State) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "14fef7eecdd89f4797e05b4e11d16629", "score": "0.78246474", "text": "func (in *Addon) DeepCopyInto(out *Addon) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7e0d8d90d7ac662f33fdb4df6eec1caf", "score": "0.78212607", "text": "func (in *TolerateSpec) DeepCopyInto(out *TolerateSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "a748e1f42ee8ddc275bf9b43f3b35103", "score": "0.7817672", "text": "func (in *DockerPullCheck) DeepCopyInto(out *DockerPullCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "c16be5768cc974667aa6c224d746bcc4", "score": "0.7816364", "text": "func (in *LoggingSpec) DeepCopyInto(out *LoggingSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9b11c1572d023ac80a5aac9db170efbe", "score": "0.78160167", "text": "func (in *KubeLego) DeepCopyInto(out *KubeLego) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "0afdff87e84ca65710759d1337015963", "score": "0.7815362", "text": "func (in *SubSpec) DeepCopyInto(out *SubSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f0cd3fe33fab64d922a03529f83b943b", "score": "0.7814934", "text": "func (in *Resolve) DeepCopyInto(out *Resolve) {\n\t*out = *in\n\tif in.Services != nil {\n\t\tin, out := &in.Services, &out.Services\n\t\t*out = make([]ServiceResolveSpec, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "75953b773ee1b231c11039416db7c653", "score": "0.78111356", "text": "func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "288bba05c76ddb20c0924391cf5c17d4", "score": "0.7810174", "text": "func (in *NuxeoAccess) DeepCopyInto(out *NuxeoAccess) {\n\t*out = *in\n\tout.TargetPort = in.TargetPort\n}", "title": "" }, { "docid": "a66214db9e683346d01273bd3d212342", "score": "0.78097266", "text": "func (in *Watch) DeepCopyInto(out *Watch) {\n\t*out = *in\n\tif in.Deployments != nil {\n\t\tin, out := &in.Deployments, &out.Deployments\n\t\t*out = make([]Deployment, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Parsers != nil {\n\t\tin, out := &in.Parsers, &out.Parsers\n\t\t*out = make([]InputParser, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Outputs != nil {\n\t\tin, out := &in.Outputs, &out.Outputs\n\t\t*out = make([]Output, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c27c0b2fa28bc0c6fc2d2861feaa77bc", "score": "0.7804369", "text": "func (in *DataTransferProgress) DeepCopyInto(out *DataTransferProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "4f446099c62c3201f8a1f2caf7fd067f", "score": "0.7800825", "text": "func (in *Monocular) DeepCopyInto(out *Monocular) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.78005236", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.78005236", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7cbb1952216c7abee2fb9390c4172456", "score": "0.78003883", "text": "func (in *IdentityDb) DeepCopyInto(out *IdentityDb) {\n\t*out = *in\n\tout.PoolOptions = in.PoolOptions\n}", "title": "" }, { "docid": "3827c31220dfe680f394f9d1ebceab58", "score": "0.7799999", "text": "func (in *PoolOptions) DeepCopyInto(out *PoolOptions) {\n\t*out = *in\n}", "title": "" }, { "docid": "e6e62bc68e6768204636bf9495629843", "score": "0.77992624", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "32253f480abe83070a818b4213200b5d", "score": "0.77990234", "text": "func (in *Docker) DeepCopyInto(out *Docker) {\n\t*out = *in\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "546392e209b025332450b746e29a55a3", "score": "0.7796975", "text": "func (in *ServiceResolveSpec) DeepCopyInto(out *ServiceResolveSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7686bd51b571d5c60d19a80bba43f7c5", "score": "0.7796147", "text": "func (in *NameValue) DeepCopyInto(out *NameValue) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e94fbb469461cb85f65bdb5e3f8cff52", "score": "0.7794391", "text": "func (in *ContainerImage) DeepCopyInto(out *ContainerImage) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e777d7d159b2dbf5fb1d5346593c672b", "score": "0.77930963", "text": "func (in *TaskTestSpec) DeepCopyInto(out *TaskTestSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "460869f5d0b2d3581371f96eaab1c6c5", "score": "0.77929467", "text": "func (in *QueryParameterMatcher) DeepCopyInto(out *QueryParameterMatcher) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3fd37fa0a6e40b0c2c4b4779ff65d42b", "score": "0.7792485", "text": "func (in *Selector) DeepCopyInto(out *Selector) {\n\t*out = *in\n}", "title": "" }, { "docid": "c7e1d612f3613418287025d9beb75ebd", "score": "0.7791954", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n}", "title": "" }, { "docid": "c7e1d612f3613418287025d9beb75ebd", "score": "0.7791954", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n}", "title": "" }, { "docid": "68d5af65be2b3f9605eb56feb89abe23", "score": "0.7788198", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.IPV4Addresses != nil {\n\t\tin, out := &in.IPV4Addresses, &out.IPV4Addresses\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.IPV6Addresses != nil {\n\t\tin, out := &in.IPV6Addresses, &out.IPV6Addresses\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "2cb6d185c77c6fd513706bfc4ea5a80b", "score": "0.77881485", "text": "func (in *Level) DeepCopyInto(out *Level) {\n\t*out = *in\n}", "title": "" }, { "docid": "1b4cf9640bfcf7f7cdbcebab0c99d94e", "score": "0.778294", "text": "func (in *IdentityForCmk) DeepCopyInto(out *IdentityForCmk) {\n\t*out = *in\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.UserAssignedIdentity != nil {\n\t\tin, out := &in.UserAssignedIdentity, &out.UserAssignedIdentity\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "3a4aaf8e02ea48978e3b56c3f6792bad", "score": "0.77820444", "text": "func (in *EmptyDir) DeepCopyInto(out *EmptyDir) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b22a5d61be5d9d15da49361e15b66431", "score": "0.7778853", "text": "func (in *TaskRef) DeepCopyInto(out *TaskRef) {\n\t*out = *in\n\tif in.Params != nil {\n\t\tin, out := &in.Params, &out.Params\n\t\t*out = make([]Param, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f89bdac0ff7dc2948005dc666c01c5be", "score": "0.77746063", "text": "func (in *GitReference) DeepCopyInto(out *GitReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "a985014e9811aa9606eb760041b35dfa", "score": "0.7773715", "text": "func (in *ConfigurationInfo) DeepCopyInto(out *ConfigurationInfo) {\n\t*out = *in\n\tif in.ARN != nil {\n\t\tin, out := &in.ARN, &out.ARN\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Revision != nil {\n\t\tin, out := &in.Revision, &out.Revision\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "ee51e9942eff79d630765d320000db37", "score": "0.7772483", "text": "func (in *ImageRef) DeepCopyInto(out *ImageRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9b8a5d0e517ed18900f4997b7f4b1dd2", "score": "0.7771299", "text": "func (in *Properties) DeepCopyInto(out *Properties) {\n\t*out = *in\n}", "title": "" }, { "docid": "24680e96db252cb395af5d70d23d5666", "score": "0.77685183", "text": "func (in *PackagePath) DeepCopyInto(out *PackagePath) {\n\t*out = *in\n\treturn\n}", "title": "" } ]
5b37dfbe845f2305f82f3360ebff06c6
this function is used call the concrete function(fetchAllData) based on Type i.e csvreceiver or mock receiver
[ { "docid": "5e8e2dd256d4b8b2c1909eeacec0ccd1", "score": "0.50499696", "text": "func IfetchAllDataProxy(epgInterface EPGInterface) EPGDataList{\n\treturn epgInterface.fetchAllData()\n}", "title": "" } ]
[ { "docid": "917fe180a91bbb8a8d9fbde31b33b06c", "score": "0.5500761", "text": "func (ReporterModel) get_all_data_items(cnx *sql.DB) ([]string, [][]string) {\n var hdr_set [ ]string\n var row_set [][]string\n\n var class___ ReporterModel\n var __name__ string = reflect.TypeOf(class___).Name()\n\n var e error\n\n sql_select := \"select\" +\n \" x0.name as arch,\" +\n \" x1.name as repo,\" +\n \" items.name,\" +\n \" attr_x2 as version,\" +\n// \" items.description,\" +\n \" attr_x3 as last_updated,\" +\n \" attr_x4 as flag_date\" +\n \" from\" +\n \" data_items items,\" +\n \" attr_x0s x0,\" +\n \" attr_x1s x1\" +\n \" where\" +\n \" (attr_x0_id = x0.id) and\" +\n \" (attr_x1_id = x1.id)\"/*and\"*/ +\n// \" (attr_x4 is not null)\" +\n \" order by\" +\n \" items.name,\" +\n \" arch\"\n\n var stmt *sql.Stmt\n\n // Preparing the SQL statement.\n stmt, e = cnx.Prepare(sql_select)\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (stmt == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer stmt.Close()\n\n var res_set *sql.Rows\n\n // Executing the SQL statement.\n res_set, e = stmt.Query()\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (res_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer res_set.Close()\n\n // Retrieving the result set metadata -- table headers.\n hdr_set, e = res_set.Columns()\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (hdr_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n num_rows := uint(0); for (res_set.Next()) { num_rows++ }\n num_hdrs := uint(len(hdr_set))\n\n if (num_rows == 0) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n // Executing the SQL statement once again.\n res_set, e = stmt.Query()\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (res_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer res_set.Close()\n\n var row_ary []sql.NullString\n\n // Allocating the row_set array before populating it.\n row_set = make([][]string, num_rows)\n\n // Retrieving and processing the result set -- table rows.\n var i uint = 0; for (res_set.Next()) {\n row_ary = make([]sql.NullString, num_hdrs)\n\n e = res_set.Scan(&row_ary[0], // arch\n &row_ary[1], // repo\n &row_ary[2], // name\n &row_ary[3], // version\n &row_ary[4], // last_updated\n &row_ary[5]) // flag_date\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP+_ERROR_PREFIX +\n _COLON_SPACE_SEP+e.Error()+_NEW_LINE)\n\n hdr_set=[]string{}; row_set=[][]string{{}}; return hdr_set, row_set\n }\n\n row_set[i] = make([]string, num_hdrs)\n\n for j := uint(0); j < num_hdrs; j++ {\n if (row_ary[j].Valid) {\n row_set[i][j] = row_ary[j].String\n } else {\n row_set[i][j] = _EMPTY_STRING\n }\n\n if ((j == 4) || (j == 5)) {\n row_set[i][j] = strings.TrimSuffix(row_set[i][j], _TZ_PATTERN)\n }\n }\n\n i++\n }\n\n return hdr_set, row_set\n}", "title": "" }, { "docid": "36084d6eb34a52d8a87b2a610549cda3", "score": "0.54895574", "text": "func (ec *EventController) GetDataByType(c *router.MyContext) error {\n\tdata, _ := c.AppContext.Fetcher.GetRequestBody(*c)\n\trequest := model.FetchBy{}\n\n\tif err := json.Unmarshal(data, &request); err != nil {\n\t\treturn errors.Wrap(err, \"Unmarshalling error\")\n\t}\n\n\tvalidate := ec.getValidator()\n\n\tif err := validate.Struct(request); err != nil {\n\t\treturn errors.Wrap(err, \"Validation error\")\n\t}\n\n\tevents, err := c.AppContext.Storage.GetEvents(request.Type)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Data fetching error\")\n\t}\n\n\tdataFoundJson, err := json.Marshal(events)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Unmarshalling error\")\n\t}\n\t_, err = c.AppContext.Writer.WriteSuccess(c, dataFoundJson)\n\tif err != nil {\n\t\t//todo: move this out to constants\n\t\treturn errors.Wrap(err, \"Response error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e90cfb782863f6c1e31166df64fad25", "score": "0.5285296", "text": "func getDataRows(c echo.Context, dataType string) error {\n var data []string\n var rows string\n var head string = \"<table class=\\\"table table-striped\\\"> <thead><tr>\"\n switch dataType {\n case \"dept\":\n result := getDepts()\n data = append(data, \"Did\", \"Dept_name\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Did + \"</td>\"\n rows += \"<td>\" + result[i].Dept_name + \"</td>\"\n rows += \"</tr>\"\n }\n case \"emp\":\n result := getEmps()\n data = append(data, \"Eid\", \"Did\", \"Esid\", \"Employee_title\", \"Employee_fname\", \"Employee_lname\", \"Employee_salary\", \"Employee_dob\", \"Start_date\" , \"End_date\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Eid + \"</td>\"\n rows += \"<td>\" + result[i].Did + \"</td>\"\n rows += \"<td>\" + result[i].Esid + \"</td>\"\n rows += \"<td>\" + result[i].Employee_title + \"</td>\"\n rows += \"<td>\" + result[i].Employee_fname + \"</td>\"\n rows += \"<td>\" + result[i].Employee_lname + \"</td>\"\n rows += \"<td>\" + result[i].Employee_salary + \"</td>\"\n rows += \"<td>\" + result[i].Employee_dob + \"</td>\"\n rows += \"<td>\" + result[i].Start_date + \"</td>\"\n rows += \"<td>\" + result[i].End_date + \"</td>\"\n rows += \"</tr>\"\n }\n case \"pro\":\n result := getPros()\n data = append(data, \"Pid\", \"Did\", \"Eid\", \"Project_desc\", \"Start_date\", \"Due_date\", \"End_date\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Pid + \"</td>\"\n rows += \"<td>\" + result[i].Did + \"</td>\"\n rows += \"<td>\" + result[i].Eid + \"</td>\"\n rows += \"<td>\" + result[i].Project_desc + \"</td>\"\n rows += \"<td>\" + result[i].Start_date + \"</td>\"\n rows += \"<td>\" + result[i].Due_date + \"</td>\"\n rows += \"<td>\" + result[i].End_date + \"</td>\"\n rows += \"</tr>\"\n }\n case \"empsup\":\n result := getEmpSups()\n data = append(data, \"Esid\", \"Eid\", \"Start_date\", \"End_date\", \"Sid\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Esid + \"</td>\"\n rows += \"<td>\" + result[i].Eid + \"</td>\"\n rows += \"<td>\" + result[i].Start_date + \"</td>\"\n rows += \"<td>\" + result[i].End_date + \"</td>\"\n rows += \"<td>\" + result[i].Sid + \"</td>\"\n rows += \"</tr>\"\n }\n case \"emppro\":\n result := getEmpPros()\n data = append(data, \"Epid\", \"Eid\", \"Pid\", \"Project_role\", \"Est_hours\", \"Start_date\", \"Due_date\", \"End_date\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Epid + \"</td>\"\n rows += \"<td>\" + result[i].Eid + \"</td>\"\n rows += \"<td>\" + result[i].Pid + \"</td>\"\n rows += \"<td>\" + result[i].Project_role + \"</td>\"\n rows += \"<td>\" + result[i].Est_hours + \"</td>\"\n rows += \"<td>\" + result[i].Start_date + \"</td>\"\n rows += \"<td>\" + result[i].Due_date + \"</td>\"\n rows += \"<td>\" + result[i].End_date + \"</td>\"\n rows += \"</tr>\"\n }\n case \"empprowrk\":\n result := getEmpProWrks()\n data = append(data, \"Epwid\", \"Epid\", \"Start_time\", \"End_time\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Epwid + \"</td>\"\n rows += \"<td>\" + result[i].Epid + \"</td>\"\n rows += \"<td>\" + result[i].Start_time + \"</td>\"\n rows += \"<td>\" + result[i].End_time + \"</td>\"\n rows += \"</tr>\"\n }\n case \"deptman\":\n result := getDeptMans()\n data = append(data, \"Dmid\", \"Did\", \"Eid\", \"Start_date\", \"End_date\")\n for i := 0; i < len(result); i++ {\n rows += \"<tr>\"\n rows += \"<td>\" + result[i].Dmid + \"</td>\"\n rows += \"<td>\" + result[i].Did + \"</td>\"\n rows += \"<td>\" + result[i].Eid + \"</td>\"\n rows += \"<td>\" + result[i].Start_date + \"</td>\"\n rows += \"<td>\" + result[i].End_date + \"</td>\"\n rows += \"</tr>\"\n }\n }\n for j := 0; j < len(data); j++ {\n hrow := \"<th>\" + data[j] + \"</th>\"\n head += hrow\n }\n head += \"</tr></thead><tbody>\"\n table := head + rows + \"</tbody></table>\"\n return c.HTML(http.StatusOK, table)\n}", "title": "" }, { "docid": "e441ec9682f8c834f26489e841ad6945", "score": "0.50827867", "text": "func (t *MysqlTable) myFetchAll(rows sql.Rows) []db.Item {\n\n\titems := []db.Item{}\n\n\tcolumns, _ := rows.Columns()\n\n\tfor i, _ := range columns {\n\t\tcolumns[i] = strings.ToLower(columns[i])\n\t}\n\n\tres := map[string]*sql.RawBytes{}\n\n\tfargs := []reflect.Value{}\n\n\tfor _, name := range columns {\n\t\tres[name] = &sql.RawBytes{}\n\t\tfargs = append(fargs, reflect.ValueOf(res[name]))\n\t}\n\n\tsn := reflect.ValueOf(&rows)\n\tfn := sn.MethodByName(\"Scan\")\n\n\tfor rows.Next() {\n\t\titem := db.Item{}\n\n\t\tret := fn.Call(fargs)\n\n\t\tif ret[0].IsNil() != true {\n\t\t\tpanic(ret[0].Elem().Interface().(error))\n\t\t}\n\n\t\tfor _, name := range columns {\n\t\t\tstrval := fmt.Sprintf(\"%s\", *res[name])\n\n\t\t\tswitch t.types[name] {\n\t\t\tcase reflect.Uint64:\n\t\t\t\tintval, _ := strconv.Atoi(strval)\n\t\t\t\titem[name] = uint64(intval)\n\t\t\tcase reflect.Int64:\n\t\t\t\tintval, _ := strconv.Atoi(strval)\n\t\t\t\titem[name] = intval\n\t\t\tcase reflect.Float64:\n\t\t\t\tfloatval, _ := strconv.ParseFloat(strval, 10)\n\t\t\t\titem[name] = floatval\n\t\t\tdefault:\n\t\t\t\titem[name] = strval\n\t\t\t}\n\t\t}\n\n\t\titems = append(items, item)\n\t}\n\n\treturn items\n}", "title": "" }, { "docid": "fa302a43f5841657025d21cef91bec0a", "score": "0.50191855", "text": "func AsyncFetchAll() {}", "title": "" }, { "docid": "278e782939d9f6d7f58d28ef128b8d99", "score": "0.49028572", "text": "func (ms *MySQLStore) getByProvidedType(t GetByType, arg interface{}) (*Activity, error) {\r\n\tsel := string(\"SELECT ActivityID, VolumeID, InOutID, DistanceID, SelfMaskID, OtherMasksID, ActivityName, NumPeople, NumPeopleMasks, DurationHours, DurationMinutes FROM TblActivity WHERE \" + t + \" = ?\")\r\n\r\n\trows, err := ms.Database.Query(sel, arg)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tdefer rows.Close()\r\n\r\n\tactivity := &Activity{}\r\n\r\n\t// Should never have more than one row, so only grab one\r\n\trows.Next()\r\n\tif err := rows.Scan(\r\n\t\t&activity.ActivityID,\r\n\t\t&activity.VolumeID,\r\n\t\t&activity.InOutID,\r\n\t\t&activity.DistanceID,\r\n\t\t&activity.SelfMaskID,\r\n\t\t&activity.OtherMasksID,\r\n\t\t&activity.ActivityName,\r\n\t\t&activity.NumPeople,\r\n\t\t&activity.NumPeopleMasks,\r\n\t\t&activity.DurationHours,\r\n\t\t&activity.DurationMinutes); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn activity, nil\r\n}", "title": "" }, { "docid": "919f2e536d9dafd17b6324b9e56ff6af", "score": "0.48785046", "text": "func (r *rType) ReadAll() ([][]string, error) {\n\tdefer r.Close()\n\n\tif r.rClient == nil {\n\t\treturn nil, errors.New(\"No R connection\")\n\t}\n\n\taddScript := `\n\tif (exists(\"dataframe_output\")) {\n\t\ttempFileName <- tempfile()\n\t\twrite.csv(dataframe_output, tempFileName, row.names=FALSE)\n\t}\n\tif (exists(\"filename_output\")) {\n\t\ttempFileName <- filename_output\n\t}\n\n\t#read data\n\tt_out <- readLines(tempFileName)\n\tt_out\n\t`\n\trawData, err := r.rClient.Eval(addScript)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rawDataStr string\n\tswitch rawData.(type) {\n\tcase []string:\n\t\trawDataStr = strings.Join(rawData.([]string), \"\\n\")\n\tcase string:\n\t\trawDataStr = rawData.(string)\n\t}\n\tcsvReader := csv.NewReader(strings.NewReader(rawDataStr))\n\tallData, err := csvReader.ReadAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(allData) > 0 {\n\t\treturn allData[1:len(allData)], nil\n\t}\n\treturn allData, nil\n}", "title": "" }, { "docid": "deb326481c2ab7843afabbf8589210fa", "score": "0.48686236", "text": "func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (RecordSetsClientListByTypeResponse, error) {\n\tresult := RecordSetsClientListByTypeResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.RecordSetListResult); err != nil {\n\t\treturn RecordSetsClientListByTypeResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "4b59f19e0ac8af1cbdd36b8d8e0e4974", "score": "0.47905633", "text": "func readCSV(filename string) ([]interface{}, []interface{}) {\n\tvar studentdataarr, staffdataarr []interface{}\n\tstudent := studentdatabase.StudentData{}\n\tstaff := staffdatabase.StaffData{}\n\n\tfile, ferr := os.Open(filename)\n\tif ferr != nil {\n\t\tfmt.Println(\"Cannot open\")\n\t\tfmt.Println(ferr)\n\t\tpanic(ferr)\n\t}\n\tfmt.Println(\"file open sucess\")\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\titems := strings.Split(line, \",\")\n\t\tkey, _ := strconv.Atoi(items[0])\n\t\tif key == 1 {\n\t\t\tstudent.RNo, _ = strconv.Atoi(items[1])\n\t\t\tstudent.Name = items[2]\n\t\t\tstudentdataarr = append(studentdataarr, student)\n\t\t}\n\t\tif key == 2 {\n\t\t\tstaff.EmployeeID, _ = strconv.Atoi(items[1])\n\t\t\tstaff.Name = items[2]\n\t\t\tstaff.Designation = items[3]\n\t\t\tstaffdataarr = append(staffdataarr, staff)\n\t\t}\n\t}\n\treturn studentdataarr, staffdataarr\n}", "title": "" }, { "docid": "95e74c811e5d013dcdea63d4d7cb8d74", "score": "0.47427696", "text": "func (db *MockDB) GetAll(tableName, out interface{}) (err error) {\n\tvar temp []string\n\tfor _, v := range Datas {\n\t\ttemp = append(temp, fmt.Sprintf(\"%s\", string(v)))\n\t}\n\n\ttempStr := \"[\" + strings.Join(temp, \",\") + \"]\"\n\terr = json.Unmarshal([]byte(tempStr), out)\n\treturn\n}", "title": "" }, { "docid": "11a45b120051ff3bfa758c7928023695", "score": "0.47295028", "text": "func processCallDataODBC() {\n\tarrCallDetailsMaps, success, returnedCalls := queryDBCallDetails(mapGenericConf.ServiceManagerRequestType, mapGenericConf.AppRequestType, connStrAppDB)\n\tif success && returnedCalls == 0 {\n\t\tlogger(4, \"No Request records found for type: \"+mapGenericConf.ServiceManagerRequestType+\" [\"+mapGenericConf.AppRequestType+\"]\", true)\n\t\treturn\n\t}\n\tif success {\n\t\tbar := pb.StartNew(len(arrCallDetailsMaps))\n\t\tdefer bar.FinishPrint(mapGenericConf.ServiceManagerRequestType + \" Request Import Complete\")\n\t\tespXmlmc := NewEspXmlmcSession(importConf.HBConf.APIKeys[0])\n\n\t\tnewCallRef := \"\"\n\t\toldCallRef := \"\"\n\t\toldCallGUID := \"\"\n\t\tfor _, callRecord := range arrCallDetailsMaps {\n\t\t\tmutexBar.Lock()\n\t\t\tbar.Increment()\n\t\t\tmutexBar.Unlock()\n\n\t\t\tvar buffer bytes.Buffer\n\n\t\t\tif callRecord[mapGenericConf.RequestReferenceColumn] != nil {\n\t\t\t\tbuffer.WriteString(loggerGen(3, \" \"))\n\t\t\t\toldCallRef, newCallRef, oldCallGUID = logNewCall(RequestDetails{GenericImportConf: mapGenericConf, CallMap: callRecord}, espXmlmc, &buffer)\n\t\t\t}\n\t\t\t//Process Historic Updates\n\t\t\tif mapGenericConf.RequestHistoricUpdateQuery != \"\" {\n\t\t\t\tgetHistoricUpdates(&RequestDetails{GenericImportConf: mapGenericConf, CallMap: callRecord, AppRequestRef: oldCallRef, SMRequestRef: newCallRef, AppRequestGUID: oldCallGUID}, espXmlmc, &buffer)\n\t\t\t}\n\n\t\t\tbufferMutex.Lock()\n\t\t\tloggerWriteBuffer(buffer.String())\n\t\t\tbufferMutex.Unlock()\n\t\t\tbuffer.Reset()\n\t\t}\n\t} else {\n\t\tlogger(4, \"Request search failed for type: \"+mapGenericConf.ServiceManagerRequestType+\" [\"+mapGenericConf.AppRequestType+\"]\", true)\n\t}\n}", "title": "" }, { "docid": "1399eb8f3c9b9f1afaebfe3fbad97a3e", "score": "0.4727304", "text": "func (m AbstractManager) ReadAll(resultSlicePointer interface{}, query string, queryParameters []interface{}, mapper RecordMapper) error {\n\tconnection, err := m.Manager.ConnectionProvider().Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer connection.Close()\n\n\treturn m.Manager.ReadAllOnConnection(connection, resultSlicePointer, query, queryParameters, mapper)\n}", "title": "" }, { "docid": "0331a2510f483450ff15e45a68e1ea98", "score": "0.47029048", "text": "func (m *Model) Fetch(pag *Pagination, where WhereSelector, fieldsStrings ...string) ([]interface{}, error) {\n\tvar from FromSpecifier\n\tvar fields []*FieldMapping\n\t// If we did not supply and fields to be selected, select all fields\n\tif len(fieldsStrings) < 1 {\n\t\tfields, from = m.GetFields()\n\t} else {\n\t\tfrom = &FromClause{table: m.TableName}\n\t\tfor _, f := range fieldsStrings {\n\t\t\tfields = append(fields, &FieldMapping{Link: f})\n\t\t}\n\t}\n\n\t// Do the following tasks concurrently\n\tvar wg sync.WaitGroup\n\tvar dummyVariables []reflect.Value // Slice to hold the values scanned from the *sql.Rows result\n\tvar dummyVariablesAddresses []interface{}\n\tvar data []interface{}\n\n\t// Build and execute the Query\n\twg.Add(1)\n\tgo func() {\n\t\tq, a := m.Dialect.FetchFields(from, fields, pag, where)\n\t\t//log.Println(q)\n\t\tr, err := m.GetDatabase().Query(q, a...)\n\t\tif err != nil && err != sql.ErrNoRows {\n\t\t\tlog.Fatalf(\"dbmdl: Failed to fetch model.\\nQuery: %s\\nError: %s\", q, err.Error())\n\t\t}\n\t\tdefer r.Close()\n\t\tfor _, field := range fields {\n\t\t\tf, found := m.Type.FieldByName(field.Link)\n\t\t\tif !found {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar nwtyp = reflect.New(f.Type) // This returns a reflect value of a pointer to the type at f\n\n\t\t\tdummyVariables = append(dummyVariables, nwtyp.Elem()) // Store our newly made Value\n\t\t\tdummyVariablesAddresses = append(dummyVariablesAddresses, nwtyp.Interface()) // Store the address as well, so that we can supply this to the Scan function later down the road\n\t\t}\n\n\t\tfor r.Next() {\n\t\t\tvar s = reflect.New(m.Type) // Create a new pointer to an empty struct of type targetType\n\n\t\t\tr.Scan(dummyVariablesAddresses...) // Scan into the slice we populated with dummy variables earlier\n\n\t\t\tfor i, v := range dummyVariables {\n\t\t\t\ts.Elem().FieldByName(fields[i].Link).Set(v) // Set values in our new struct\n\t\t\t}\n\n\t\t\tdata = append(data, s.Interface()) // Append the interface value of the pointer to the previously created targetType type.\n\t\t}\n\n\t\twg.Done()\n\t}()\n\n\t// Pagination\n\twg.Add(1)\n\tgo func() {\n\t\tif err := pag.Load(m, where); err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\tpag.First = 1\n\t\t\t\tpag.Next = 1\n\t\t\t\tpag.Prev = 1\n\t\t\t\tpag.Last = 1\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// Wait\n\twg.Wait()\n\n\treturn data, nil\n}", "title": "" }, { "docid": "0021b2f74385635f9b52b3e192cc2fa6", "score": "0.4687523", "text": "func (m *DeviceHealthScriptRemediationHistoryData) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"date\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetDateOnlyValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDate(val)\n }\n return nil\n }\n res[\"detectFailedDeviceCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDetectFailedDeviceCount(val)\n }\n return nil\n }\n res[\"noIssueDeviceCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetNoIssueDeviceCount(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"remediatedDeviceCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetRemediatedDeviceCount(val)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "b33faa44f0dc0b796c5f6ad8863d723e", "score": "0.46513852", "text": "func (t *MetaDataChainCode) fetchElementsByType(stub shim.ChaincodeStubInterface, action string, payloadBytes []byte, scope string) peer.Response {\n\tmetadataType := string(payloadBytes)\n\n\tif metadataType != \"dataendpoint\" && metadataType != \"connector\" && metadataType != \"participant\" {\n\t\treturn shim.Error(\"No metadata exist : \" + metadataType)\n\t}\n\n\ttypedElementIterator, err := stub.GetStateByPartialCompositeKey(\"key~type\", []string{metadataType})\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer typedElementIterator.Close()\n\n\tvar i int\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"<elements>\")\n\tfor i = 0; typedElementIterator.HasNext(); i++ {\n\t\tresponseRange, err := typedElementIterator.Next()\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tobjectType, compositeKeyParts, err := stub.SplitCompositeKey(responseRange.Key)\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\treturnedType := compositeKeyParts[0]\n\t\treturnedKey := compositeKeyParts[1]\n\t\tfmt.Printf(\"- found a data from index:%s type:%s key:%s\\n\", objectType, returnedType, returnedKey)\n\n\t\telementBytes, err := stub.GetState(returnedKey)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Get state error\")\n\t\t} else if elementBytes == nil {\n\t\t\treturn shim.Error(\"Element does not exist : \" + returnedKey)\n\t\t}\n\t\tresponse := scopeHelper(stub, elementBytes, scope)\n\t\tif response.Status == shim.OK {\n\t\t\tbuffer.WriteString(\"<value>\")\n\t\t\tbuffer.Write(elementBytes)\n\t\t\tbuffer.WriteString(\"</value>\")\n\t\t}\n\t}\n\n\tbuffer.WriteString(\"</elements>\")\n\treturn shim.Success(buffer.Bytes())\n}", "title": "" }, { "docid": "86c4735b46e3432af9f21fdddb17228e", "score": "0.46131206", "text": "func (dh *DataHelper) GetData(preparedQuery string, arg ...interface{}) (*datatable.DataTable, error) {\n\n\tdt := datatable.NewDataTable(\"data\")\n\n\tvar rows *sql.Rows\n\tvar err error\n\tcolsadded := false\n\n\tquery := dh.replaceQueryParamMarker(preparedQuery)\n\n\t// replace table names marked with {table}\n\tquery = replaceCustomPlaceHolder(query, dh.CurrentDatabaseInfo.Schema)\n\n\tif dh.tx != nil {\n\t\trows, err = dh.tx.Query(query, arg...)\n\t} else {\n\t\t//If the query is not in a transaction, the following properties are always reset\n\t\tdh.AllQueryOK = true\n\t\tdh.Errors = make([]string, 0)\n\n\t\trows, err = dh.db.Query(query, arg...)\n\t}\n\n\tdefer func() {\n\t\tif rows != nil {\n\t\t\trows.Close()\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tdh.Errors = append(dh.Errors, err.Error())\n\t\tdh.AllQueryOK = false\n\t\treturn dt, err\n\t}\n\n\tcols, _ := rows.Columns()\n\tlencols := len(cols)\n\tvals := make([]interface{}, lencols)\n\tfor i := 0; i < lencols; i++ {\n\t\tvals[i] = new(interface{})\n\t}\n\n\tr := datatable.Row{}\n\n\tfor rows.Next() {\n\n\t\tif !colsadded {\n\t\t\t/* Column types for SQlite cannot be retrieved until .Next is called, so we need to retrieve it again */\n\t\t\tcolt, _ := rows.ColumnTypes()\n\t\t\tfor i := 0; i < len(colt); i++ {\n\t\t\t\tlength, _ := colt[i].Length()\n\t\t\t\tdt.AddColumn(colt[i].Name(), colt[i].ScanType(), length, colt[i].DatabaseTypeName())\n\t\t\t}\n\t\t\tcolsadded = true\n\t\t}\n\n\t\tif err = rows.Scan(vals...); err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tr = dt.NewRow()\n\t\tfor i := 0; i < lencols; i++ {\n\t\t\tv := vals[i].(*interface{})\n\t\t\tif *v != nil {\n\t\t\t\tr.Cells[i].Value = *v\n\t\t\t} else {\n\t\t\t\tr.Cells[i].Value = nil\n\t\t\t}\n\t\t}\n\t\tdt.AddRow(&r)\n\t}\n\n\t// Get possible error in the iteration\n\terr = rows.Err()\n\n\treturn dt, err\n}", "title": "" }, { "docid": "8bf5799888ac1953fd73cc3946317eaf", "score": "0.4612295", "text": "func GetTrDataAt(code string, qry TrDataQry, field TradeDataField, desc bool, val ...interface{}) (trdat *model.TradeData) {\n\tbatSize := 1000\n\ttotal := float64(len(val))\n\tnumGrp := int(math.Ceil(total / float64(batSize)))\n\targs := make([][]interface{}, numGrp)\n\tholders := make([][]string, numGrp)\n\tfor i := range args {\n\t\targs[i] = append(args[i], code)\n\t\tgrpSize := batSize\n\t\tif i == len(args)-1 {\n\t\t\tgrpSize = int(total) - batSize*(numGrp-1)\n\t\t}\n\t\tholders[i] = make([]string, grpSize)\n\t\tfor j := 0; j < grpSize; j++ {\n\t\t\tidx := i*batSize + j\n\t\t\targs[i] = append(args[i], val[idx])\n\t\t\tholders[i][j] = \"?\"\n\t\t}\n\t}\n\td := \"\"\n\tif desc {\n\t\td = \"desc\"\n\t}\n\n\ttables := resolveTables(qry)\n\tvar wg, wgr sync.WaitGroup\n\t//A slice of trading data of arbitrary kind\n\tochan := make(chan interface{}, 4)\n\n\ttrdat = &model.TradeData{\n\t\tCode: code,\n\t\tCycle: qry.Cycle,\n\t\tReinstatement: qry.Reinstate,\n\t}\n\n\t//Collect and merge query results\n\twgr.Add(1)\n\tgo func() {\n\t\tdefer wgr.Done()\n\t\tfor i := range ochan {\n\t\t\t//merge into model.TradeData slice\n\t\t\tswitch i.(type) {\n\t\t\tcase []*model.TradeDataBasic:\n\t\t\t\ttrdat.Base = i.([]*model.TradeDataBasic)\n\t\t\tcase []*model.TradeDataLogRtn:\n\t\t\t\ttrdat.LogRtn = i.([]*model.TradeDataLogRtn)\n\t\t\tcase []*model.TradeDataMovAvg:\n\t\t\t\ttrdat.MovAvg = i.([]*model.TradeDataMovAvg)\n\t\t\tcase []*model.TradeDataMovAvgLogRtn:\n\t\t\t\ttrdat.MovAvgLogRtn = i.([]*model.TradeDataMovAvgLogRtn)\n\t\t\tdefault:\n\t\t\t\tlog.Panicf(\"Unsupported type for query result consolidation: %v\", reflect.TypeOf(i).String())\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor table, typ := range tables {\n\t\twg.Add(1)\n\t\tgo func(table string, typ reflect.Type) {\n\t\t\tdefer wg.Done()\n\t\t\tcols, _ := getTableColumns(typ)\n\t\t\tintf := reflect.Zero(reflect.SliceOf(typ)).Interface()\n\t\t\tfor i := range args {\n\t\t\t\tcond := fmt.Sprintf(\"%s in (%s)\", field, strings.Join(holders[i], \",\"))\n\t\t\t\tss := reflect.New(reflect.SliceOf(typ)).Interface()\n\t\t\t\tsql := fmt.Sprintf(\"select %s from %s where code = ? and %s order by klid %s\",\n\t\t\t\t\tstrings.Join(cols, \",\"), table, cond, d)\n\t\t\t\t_, e := dbmap.Select(ss, sql, args[i]...)\n\t\t\t\tutil.CheckErr(e, \"failed to query \"+table+\" for \"+code)\n\t\t\t\tintf = reflect.AppendSlice(\n\t\t\t\t\treflect.ValueOf(intf),\n\t\t\t\t\treflect.Indirect(reflect.ValueOf(ss)),\n\t\t\t\t).Interface()\n\t\t\t}\n\t\t\tochan <- intf\n\t\t}(table, typ)\n\t}\n\twg.Wait()\n\tclose(ochan)\n\twgr.Wait()\n\n\treturn\n}", "title": "" }, { "docid": "a91920bbc2c899a89352aa52708971ca", "score": "0.4590743", "text": "func (ReporterModel) get_data_items_by_date(from string,\n to string,\n cnx *sql.DB,\n postgres bool) ([ ]string,\n [][]string) {\n\n var hdr_set [ ]string\n var row_set [][]string\n\n var class___ ReporterModel\n var __name__ string = reflect.TypeOf(class___).Name()\n\n var e error\n\n sql_select := \"select\" +\n \" x0.name as arch,\" +\n \" x1.name as repo,\" +\n \" items.name,\" +\n \" attr_x2 as version,\" +\n// \" items.description,\" +\n \" attr_x3 as last_updated,\" +\n \" attr_x4 as flag_date\" +\n \" from\" +\n \" data_items items,\" +\n \" attr_x0s x0,\" +\n \" attr_x1s x1\" +\n \" where\" +\n \" (attr_x0_id = x0.id) and\" +\n \" (attr_x1_id = x1.id) and\"\n// ----------------------------------------------------------------------------\n// Note: PostgreSQL driver (lib/pq) can handle only dollar-sign-prefixed\n// positional placeholders ($n), whilst MySQL driver(go-sql-driver/mysql)\n// can handle only question-mark-placeholders (?). And SQLite driver\n// (mattn/go-sqlite3)can do both. So that the use of dollar-sign-prefixed\n// placeholders is mandatory only for PostgreSQL ops.\n// ----------------------------------------------------------------------------\n if (postgres) { sql_select +=\n// \" (attr_x3 >= $1) and\" +\n// \" (attr_x3 <= $2)\"\n// ----------------------------------------------------------------------------\n \" (attr_x3 between $1 and $2)\"\n// ----------------------------------------------------------------------------\n } else { sql_select +=\n// \" (attr_x3 >= ?) and\" +\n// \" (attr_x3 <= ?)\"\n// ----------------------------------------------------------------------------\n \" (attr_x3 between ? and ?)\"\n// ----------------------------------------------------------------------------\n }; sql_select +=\n \" order by\" +\n \" items.name,\" +\n \" arch\"\n\n var stmt *sql.Stmt\n\n // Preparing the SQL statement.\n stmt, e = cnx.Prepare(sql_select)\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (stmt == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer stmt.Close()\n\n var res_set *sql.Rows\n\n // Executing the SQL statement.\n res_set, e = stmt.Query(from, to)\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (res_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer res_set.Close()\n\n // Retrieving the result set metadata -- table headers.\n hdr_set, e = res_set.Columns()\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (hdr_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n num_rows := uint(0); for (res_set.Next()) { num_rows++ }\n num_hdrs := uint(len(hdr_set))\n\n if (num_rows == 0) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n // Executing the SQL statement once again.\n res_set, e = stmt.Query(from, to)\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP + _ERROR_PREFIX +\n _COLON_SPACE_SEP + e.Error() + _NEW_LINE)\n }; if (res_set == nil) {\n hdr_set = []string{}; row_set = [][]string{{}}; return hdr_set, row_set\n }\n\n defer res_set.Close()\n\n var row_ary []sql.NullString\n\n // Allocating the row_set array before populating it.\n row_set = make([][]string, num_rows)\n\n // Retrieving and processing the result set -- table rows.\n var i uint = 0; for (res_set.Next()) {\n row_ary = make([]sql.NullString, num_hdrs)\n\n e = res_set.Scan(&row_ary[0], // arch\n &row_ary[1], // repo\n &row_ary[2], // name\n &row_ary[3], // version\n &row_ary[4], // last_updated\n &row_ary[5]) // flag_date\n\n if (e != nil) {\n fmt.Printf(_S_FMT, __name__ + _COLON_SPACE_SEP+_ERROR_PREFIX +\n _COLON_SPACE_SEP+e.Error()+_NEW_LINE)\n\n hdr_set=[]string{}; row_set=[][]string{{}}; return hdr_set, row_set\n }\n\n row_set[i] = make([]string, num_hdrs)\n\n for j := uint(0); j < num_hdrs; j++ {\n if (row_ary[j].Valid) {\n row_set[i][j] = row_ary[j].String\n } else {\n row_set[i][j] = _EMPTY_STRING\n }\n\n if ((j == 4) || (j == 5)) {\n row_set[i][j] = strings.TrimSuffix(row_set[i][j], _TZ_PATTERN)\n }\n }\n\n i++\n }\n\n return hdr_set, row_set\n}", "title": "" }, { "docid": "e41ea3fa2c43b656a49e53f53ea67543", "score": "0.45892537", "text": "func gather_data(obj AlertList) string {\n\n logfile.WriteString(\"Composing csv.\" + \"\\n\")\n var csv_data = \"\"\n var alertTinyID = \"\"\n\n\tfor _, alert := range obj.Data {\n created := alert.CreatedAt[0:19] // fist 19 chars contain the datetime info we want\n updated := alert.UpdatedAt[0:19]\n var createdTime, err = time.Parse(layout, created)\n handleError(err)\n var updatedTime, err2 = time.Parse(layout, updated)\n handleError(err2)\n\n // protect against empty Teams array\n var teamId string = \"\"\n if len(alert.Teams) != 0 {\n teamId = alert.Teams[0].ID\n }\n\n alertTinyID = alert.TinyID\n\t\tvar csv_line string = alert.ID + \",\\\"\" + alert.Alias + \"\\\",\" + alert.TinyID + \",\\\"\" + alert.Message + \"\\\",\" + alert.Status + \",\" + strconv.FormatBool(alert.IsSeen) + \",\" + strconv.FormatBool(alert.Acknowledged) + \",\" + strconv.FormatBool(alert.Snoozed) + \",\\\"\" + createdTime.In(loc).String() + \"\\\",\\\"\" + updatedTime.In(loc).String() + \"\\\",\" + strconv.FormatInt(alert.Count, 10) + \",\" + alert.Owner + \",\" + teamId + \",\" + alert.Priority + \",\" \n\t\tcsv_data = csv_data + csv_line\n\n\n // Grab alert-specific data here\n url = \"https://api.opsgenie.com/v2/alerts/\" + alertTinyID + \"?identifierType=tiny\"\n var body = get_url(url)\n var details = AlertDetails{}\n // unmarshall it\n err = json.Unmarshal([]byte(body), &details)\n handleError(err)\n\n //Details.Backend is what we want\n var backend = details.Data.Details.Backend\n var frontend = details.Data.Details.Frontend\n var host = details.Data.Details.Host\n var class = details.Data.Details.Class\n\n //append to csv line\n csv_data = csv_data + backend + \",\" + frontend + \",\" + host + \",\" + class + \"\\n\"\n }\n\n // sleep here as we call this function after almost all fetches\n time.Sleep(3 * time.Second)\n\n return csv_data\n\n}", "title": "" }, { "docid": "3e7fa2019abe3135fb5eec364cc37893", "score": "0.45836616", "text": "func getLtEventLogMethodType() ([]*Struct_EventLogSinkMethodType, error) {\n\n\tdb, err := pqx.Open()\n\tif err != nil {\n\t\treturn nil, errors.Repack(err)\n\t}\n\n\tq := getLtSinkMethodType\n\tp := []interface{}{}\n\trows, err := db.Query(q, p...)\n\tif err != nil {\n\t\treturn nil, pqx.GetRESTError(err)\n\t}\n\t\n\tdata := make([]*Struct_EventLogSinkMethodType,0)\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tid sql.NullInt64\n\t\t\tdescription sql.NullString\n\t\t)\n\t\tdataRow := &Struct_EventLogSinkMethodType{}\n\t\trows.Scan(&id, &description)\n\t\tdataRow.Id = id.Int64\n\t\tdataRow.Description = description.String \n\t\tdata = append(data,dataRow)\n\t}\n\t\n\treturn data,nil\n}", "title": "" }, { "docid": "31e2871a35ec59749ddee36f59dec5a7", "score": "0.4581504", "text": "func TestLateReadersGetAllData(t *testing.T) {\n\tb := newBroadcastBuffer()\n\n\t_, err := b.Write([]byte(itemOne))\n\trequire.Nil(t, err)\n\t_, err = b.Write([]byte(itemTwo))\n\trequire.Nil(t, err)\n\tb.Close()\n\n\tr := b.NewReader(context.Background())\n\tdata, err := ioutil.ReadAll(r)\n\trequire.Nil(t, err)\n\trequire.Equal(t, itemOne+itemTwo, string(data))\n}", "title": "" }, { "docid": "e77d591f710ca5cc3ad73b1955f115a8", "score": "0.4564053", "text": "func listData(data interface{}, query string) (interface{}, error) {\n\tvar d []interface{}\n\trows, err := conn.Query(context.Background(), query)\n\tif err != nil {\n\t\tfmt.Printf(\"Error getting data:\\t%s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\td = append(d, data)\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "919dddbd55e1b015d6018331c7c8efd2", "score": "0.45413578", "text": "func (m *AbstractManager) ReadAllOnConnection(connection Connection, resultSlicePointer interface{}, query string, queryParameters []interface{}, mapper RecordMapper) error {\n\ttoolbox.AssertPointerKind(resultSlicePointer, reflect.Slice, \"resultSlicePointer\")\n\tslice := reflect.ValueOf(resultSlicePointer).Elem()\n\tif mapper == nil {\n\t\tmapper = NewRecordMapperIfNeeded(mapper, reflect.TypeOf(resultSlicePointer).Elem().Elem())\n\t}\n\terr := m.Manager.ReadAllOnWithHandlerOnConnection(connection, query, queryParameters, func(scannalbe Scanner) (toContinue bool, err error) {\n\t\tmapped, providerError := mapper.Map(scannalbe)\n\t\tif providerError != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to map row sql: %v due to %v\", query, providerError.Error())\n\t\t}\n\t\tif mapped != nil {\n\t\t\t//only add to slice i\n\t\t\tmappedValue := reflect.ValueOf(mapped)\n\t\t\tif reflect.TypeOf(resultSlicePointer).Elem().Kind() == reflect.Slice && reflect.TypeOf(resultSlicePointer).Elem().Elem().Kind() != mappedValue.Kind() {\n\t\t\t\tif mappedValue.Kind() == reflect.Ptr {\n\t\t\t\t\tmappedValue = mappedValue.Elem()\n\t\t\t\t}\n\t\t\t}\n\t\t\tslice.Set(reflect.Append(slice, mappedValue))\n\t\t}\n\t\treturn true, nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "edecc23b8288b4728f6924ba6b6d15c1", "score": "0.4522719", "text": "func Type(ds DataSet) DataSetType {\n\tif ds == nil {\n\t\treturn Asset\n\t}\n\tswitch ds.(type) {\n\tcase *Model:\n\t\treturn ModelDataSet\n\tcase *Method:\n\t\treturn MethodDataSet\n\tcase *Process:\n\t\treturn ProcessDataSet\n\tcase *Flow:\n\t\treturn FlowDataSet\n\tcase *FlowProperty:\n\t\treturn FlowPropertyDataSet\n\tcase *UnitGroup:\n\t\treturn UnitGroupDataSet\n\tcase *Source:\n\t\treturn SourceDataSet\n\tcase *Contact:\n\t\treturn ContactDataSet\n\tdefault:\n\t\treturn Asset\n\t}\n}", "title": "" }, { "docid": "399687588d4edb94fff80545c3634fd6", "score": "0.4505055", "text": "func (m *DirectRoutingLogRow) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"calleeNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCalleeNumber(val)\n }\n return nil\n }\n res[\"callEndSubReason\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCallEndSubReason(val)\n }\n return nil\n }\n res[\"callerNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCallerNumber(val)\n }\n return nil\n }\n res[\"callType\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCallType(val)\n }\n return nil\n }\n res[\"correlationId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCorrelationId(val)\n }\n return nil\n }\n res[\"duration\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDuration(val)\n }\n return nil\n }\n res[\"endDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetEndDateTime(val)\n }\n return nil\n }\n res[\"failureDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetFailureDateTime(val)\n }\n return nil\n }\n res[\"finalSipCode\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetFinalSipCode(val)\n }\n return nil\n }\n res[\"finalSipCodePhrase\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetFinalSipCodePhrase(val)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"inviteDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetInviteDateTime(val)\n }\n return nil\n }\n res[\"mediaBypassEnabled\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMediaBypassEnabled(val)\n }\n return nil\n }\n res[\"mediaPathLocation\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMediaPathLocation(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"signalingLocation\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSignalingLocation(val)\n }\n return nil\n }\n res[\"startDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetStartDateTime(val)\n }\n return nil\n }\n res[\"successfulCall\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSuccessfulCall(val)\n }\n return nil\n }\n res[\"trunkFullyQualifiedDomainName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTrunkFullyQualifiedDomainName(val)\n }\n return nil\n }\n res[\"userDisplayName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetUserDisplayName(val)\n }\n return nil\n }\n res[\"userId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetUserId(val)\n }\n return nil\n }\n res[\"userPrincipalName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetUserPrincipalName(val)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "dbdb931942987211776c1544f9d65e47", "score": "0.45042816", "text": "func (e *Engine) fetchRow(rows *sql.Rows, args ...interface{}) (count int64, err error) {\n\n\tfetcher, _ := e.getFetcher(rows)\n\n\tfor _, arg := range args {\n\n\t\ttyp := reflect.TypeOf(arg)\n\t\tval := reflect.ValueOf(arg)\n\n\t\tif typ.Kind() == reflect.Ptr {\n\n\t\t\ttyp = typ.Elem()\n\t\t\tval = val.Elem()\n\t\t}\n\n\t\tswitch typ.Kind() {\n\t\tcase reflect.Map:\n\t\t\t{\n\t\t\t\terr = e.fetchToMap(fetcher, arg)\n\t\t\t\tcount++\n\t\t\t}\n\t\tcase reflect.Slice:\n\t\t\t{\n\t\t\t\tif val.IsNil() {\n\t\t\t\t\tval.Set(reflect.MakeSlice(val.Type(), 0, 0)) //make slice for storage\n\t\t\t\t}\n\t\t\t\tfor {\n\t\t\t\t\tfetcher, _ := e.getFetcher(rows)\n\t\t\t\t\tvar elemVal reflect.Value\n\t\t\t\t\tvar elemTyp reflect.Type\n\t\t\t\t\telemTyp = val.Type().Elem()\n\n\t\t\t\t\tif elemTyp.Kind() == reflect.Ptr {\n\t\t\t\t\t\telemVal = reflect.New(elemTyp.Elem())\n\t\t\t\t\t} else {\n\t\t\t\t\t\telemVal = reflect.New(elemTyp).Elem()\n\t\t\t\t\t}\n\n\t\t\t\t\tif elemTyp.Kind() == reflect.Struct || elemTyp.Kind() == reflect.Ptr {\n\t\t\t\t\t\terr = e.fetchToStruct(fetcher, elemTyp, elemVal) // assign to struct type variant\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = e.fetchToBaseType(fetcher, elemTyp, elemVal) // assign to base type variant\n\t\t\t\t\t}\n\n\t\t\t\t\tval.Set(reflect.Append(val, elemVal))\n\t\t\t\t\tcount++\n\t\t\t\t\tif !rows.Next() {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Struct:\n\t\t\t{\n\t\t\t\tif _, ok := val.Addr().Interface().(sql.Scanner); !ok {\n\t\t\t\t\terr = e.fetchToStruct(fetcher, typ, val)\n\t\t\t\t} else {\n\t\t\t\t\terr = e.fetchToBaseType(fetcher, typ, val)\n\t\t\t\t}\n\t\t\t\tcount++\n\t\t\t}\n\t\tdefault:\n\t\t\t{\n\t\t\t\terr = e.fetchToBaseType(fetcher, typ, val)\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d1d1ac65f9d54170fbc321bfa34737f6", "score": "0.44803646", "text": "func getAllVehicleDetails(stub shim.ChaincodeStubInterface, filter string, filterValue string) pb.Response {\t\n\t\n\tfmt.Println(\"getAllVehicles:Looking for All Vehicles\");\n\n\t//get the AllVehicles index\n\tallBAsBytes, err := stub.GetState(\"allVehicles\")\n\tif err != nil {\n\t\t//return nil, errors.New(\"Failed to get all Vehicles\")\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tvar res AllVehicles\n\terr = json.Unmarshal(allBAsBytes, &res)\n\t//fmt.Println(allBAsBytes);\n\tif err != nil {\n\t\tfmt.Println(\"Printing Unmarshal error:-\");\n\t\tfmt.Println(err);\n\t\t//return nil, errors.New(\"Failed to Unmarshal all Vehicles\")\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tvar rab AllVehicleDetails\n\n\tfor i := range res.Vehicles{\n\n\t\tsbAsBytes, err := stub.GetState(res.Vehicles[i])\n\t\tif err != nil {\n\t\t\t//return nil, errors.New(\"Failed to get Vehicle\")\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tvar sb Vehicle\n\t\tjson.Unmarshal(sbAsBytes, &sb)\n\t\t\t\n\t\tif strings.ToLower(filter) == \"vin\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with vin\n\t\t\tif strings.ToLower(sb.Vin) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"user\" && strings.ToLower(filterValue) == \"all\"{\n\t\t// all vehicles linked with customers\n\t\t\tif sb.Owner.Name != \"\" {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"user\" && strings.ToLower(filterValue) != \"all\"{\n\t\t// all vehicles linked with perticular customer\n\t\t\tif strings.ToLower(sb.Owner.Name) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"dealer\" && strings.ToLower(filterValue) == \"all\"{\n\t\t// all vehicles linked with dealer\n\t\t\tif sb.Dealer.Name != \"\" {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"dealer\" && strings.ToLower(filterValue) != \"all\"{\n\t\t// all vehicles linked with perticular dealer\n\t\t\tif strings.ToLower(sb.Dealer.Name) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"model\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular model\n\t\t\tif strings.ToLower(sb.Make) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"variant\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular variant\n\t\t\tif strings.ToLower(sb.Variant) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"engine\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular engine\n\t\t\tif strings.ToLower(sb.Engine) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"gearbox\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular gear box\n\t\t\tif strings.ToLower(sb.GearBox) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"color\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular color\n\t\t\tif strings.ToLower(sb.Color) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t} else if strings.ToLower(filter) == \"lpn\" && strings.ToLower(filterValue) != \"\"{\n\t\t// all vehicles linked with perticular LicensePlateNumber\n\t\t\tif strings.ToLower(sb.LicensePlateNumber) == strings.ToLower(filterValue) {\n\t\t\t\trab.Vehicles = append(rab.Vehicles, sb);\n\t\t\t}\n\t\t}\n\n\t}\n\n\trabAsBytes, _ := json.Marshal(rab)\n\n\t///return rabAsBytes, nil\n\treturn shim.Success(rabAsBytes)\n}", "title": "" }, { "docid": "adf90b0c6dcfe0b22fdfe902a4cc80af", "score": "0.44455647", "text": "func FindingRecordsByType(err error, domainName, recordType string) error {\n\treturn fmt.Errorf(\"ErrorCannotFindRecords : byType %s of %s\\n%s\", recordType, domainName, err.Error())\n}", "title": "" }, { "docid": "01f0d93c63aabc31bfecf789fb0984ab", "score": "0.44433615", "text": "func (m *EdiscoveryCustodian) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.DataSourceContainer.GetFieldDeserializers()\n res[\"acknowledgedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAcknowledgedDateTime(val)\n }\n return nil\n }\n res[\"email\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetEmail(val)\n }\n return nil\n }\n res[\"lastIndexOperation\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateEdiscoveryIndexOperationFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetLastIndexOperation(val.(EdiscoveryIndexOperationable))\n }\n return nil\n }\n res[\"siteSources\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateSiteSourceFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]SiteSourceable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(SiteSourceable)\n }\n }\n m.SetSiteSources(res)\n }\n return nil\n }\n res[\"unifiedGroupSources\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateUnifiedGroupSourceFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]UnifiedGroupSourceable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(UnifiedGroupSourceable)\n }\n }\n m.SetUnifiedGroupSources(res)\n }\n return nil\n }\n res[\"userSources\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateUserSourceFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]UserSourceable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(UserSourceable)\n }\n }\n m.SetUserSources(res)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "057cdbf02b189214271e4ff3479f4d07", "score": "0.44388142", "text": "func (srv *Service) FetchMethods(tx pgx.Tx, nsp *[]string) (map[string]Method, error) {\n\tconst SQL = \"select * from %s.%s(%s)\"\n\tschema := srv.config.FuncSchema\n\tif srv.schemaSuffix != \"\" {\n\t\tschema += \"_\" + srv.schemaSuffix\n\t}\n\tctx := context.Background()\n\trows, err := tx.Query(ctx, fmt.Sprintf(SQL, schema, srv.config.IndexFunc, positionalArgs(nsp)), nsp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\trvTemp := []Method{}\n\tfor rows.Next() {\n\t\tr := Method{}\n\t\terr := ScanStruct(rows, &r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trvTemp = append(rvTemp, r)\n\t}\n\trv := map[string]Method{}\n\tfor _, v := range rvTemp {\n\t\tk := v.Name\n\t\trows, err := tx.Query(ctx, fmt.Sprintf(SQL, schema, srv.config.InDefFunc, positionalArgs(k)), k)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer rows.Close()\n\t\tinArgs := map[string]InDef{}\n\t\tfor rows.Next() {\n\t\t\tr := InDef{}\n\t\t\terr := ScanStruct(rows, &r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tinArgs[strings.TrimPrefix(r.Name, srv.config.ArgTrimPrefix)] = r\n\t\t}\n\t\tv.In = inArgs\n\n\t\trows, err = tx.Query(ctx, fmt.Sprintf(SQL, schema, srv.config.OutDefFunc, positionalArgs(k)), k)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tr := OutDef{}\n\t\t\terr := ScanStruct(rows, &r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tv.Out = append(v.Out, r)\n\t\t}\n\t\trv[k] = v\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "ee677966c4b53ff65edd8025b405b7b2", "score": "0.44293767", "text": "func GetMealCardDataById(db *sql.DB, meal_id int64) (*Meal_read, error) {\n\tmeal, err := GetMealById(db, meal_id)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tmeal_data := new(Meal_read)\n\tmeal_data.Id = meal.Id\n\tmeal_data.Title = meal.Title\n\tmeal_data.Description = meal.Description\n\tmeal_data.Price, err = GetMealPrice(db, meal)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tmeal_data.Pics, err = GetAllPicsForMeal(db, meal.Id)\n\tif err != nil{ \n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\thost, err := GetHostById(db, meal.Host_id)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\thost_as_guest, err := GetGuestById(db, host.Guest_id)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tmeal_data.Host_name = host_as_guest.First_name\n\tif host_as_guest.Prof_pic != \"\" {\n\t\tmeal_data.Host_pic = \"https://yaychakula.com/img/\" + host_as_guest.Prof_pic\n\t} else {\n\t\tmeal_data.Host_pic = GetFacebookPic(host_as_guest.Facebook_id)\n\t}\n\tmeal_data.Host_id = host.Id\n\tmeal_data.Host_bio = host_as_guest.Bio\n\tmeal_data.Popups, err = GetPopupsForMeal(db, meal.Id)\n\tmeal_data.New_host, err = GetNewHostStatus(db, meal.Host_id)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn meal_data, nil\n}", "title": "" }, { "docid": "6f9ef29f3a1b8ede640c1f9c9f719752", "score": "0.4420243", "text": "func queryByDataAndOperationType(stub shim.ChaincodeStubInterface, operationType string, ownerId string, dataName string) ([]byte, error) {\n\tvar err error\n\tfmt.Println(\"starting queryByDataAndOperationType\")\n\n\tif len(operationType) == 0 {\n\t\treturn nil, errors.New(\"Incorrect operationType. Expecting non empty type.\")\n\t}\n\tif len(ownerId) != 32 {\n\t\treturn nil, errors.New(\"Incorrect ownerId. Expecting 16 bytes of md5 hash which has len == 32 of hex string.\")\n\t}\n\tif len(dataName) == 0 {\n\t\treturn nil, errors.New(\"Incorrect dataName. Expecting non empty dataName.\")\n\t}\n\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"operationType\\\":\\\"%s\\\",\\\"owner\\\":\\\"%s\\\",\\\"dataName\\\":\\\"%s\\\"}}\",\n\t\toperationType, ownerId, dataName)\n\tqueryResults, err := getQueryResultForQueryString(stub, queryString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn queryResults, nil\n}", "title": "" }, { "docid": "99dc661f9aee03e79d00e9885c1ce806", "score": "0.44189215", "text": "func GetAllData(session string, g *gocui.Gui, reader *bufio.Reader) ([10]message.ChannelInit, [10]message.Makeserver) {\n\n\tline, _ := reader.ReadBytes('\\n')\n\n\tvar msg message.BufferMsg\n\n\tif err := json.Unmarshal(line, &msg); err != nil {\n\t\tfmt.Println(\"I found the error here\")\n\t\tpanic(err)\n\t}\n\n\tvar servers [10]message.Makeserver\n\tvar channels [10]message.ChannelInit\n\n\tchannels, servers = processBacklog(msg.StreamID, session)\n\treturn channels, servers\n\n}", "title": "" }, { "docid": "ddcb52ff3c0bb77c0186c7b01370fb4f", "score": "0.44100362", "text": "func GetCommentFieldDatasViaCommentType(offset int, limit int, CommentType_ string, field string) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"comment_type = ?\", CommentType_).Limit(limit, offset).Desc(field).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" }, { "docid": "45ea7006394ec1a1b67d779f6180ec6b", "score": "0.4409091", "text": "func (l Leftovers) ListByType(filter, rtype string) {\n\tl.logger.NoConfirm()\n\n\tfor _, r := range l.resources {\n\t\tif r.Type() == rtype {\n\t\t\tl.list(r, filter)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "def4e57c4b0cfe51f5179f70116993ab", "score": "0.4408797", "text": "func (this *ReaderHandlerFixture) TestAllCSVRecordsSentToOutput() {\n\tthis.writeLine(\"A1,B1,C1,D1\")\n\tthis.writeLine(\"A2,B2,C2,D2\")\n\n\tthis.reader.Handle()\n\n\tthis.assertRecordsSent()\n\tthis.assertCleanUp()\n\n}", "title": "" }, { "docid": "48d8dac5639eef4df422a0849d2c1407", "score": "0.4407628", "text": "func loadInstructions() ([]Instruction, []Instruction, error) {\n var (\n incoming []Instruction\n outgoing []Instruction\n instruction Instruction\n )\n\n csvDecoders := map[string]interface{}{\n \"date\": func(date string) (time.Time, error) {\n return time.Parse(inputDateFormat, date)\n },\n }\n\n options := easycsv.Option{Decoders: csvDecoders}\n r := easycsv.NewReaderFile(instructionsFilename, options)\n\n for r.Read(&instruction) {\n instruction.processSettlementDate()\n if instruction.Type == \"B\" {\n outgoing = append(outgoing, instruction)\n } else if instruction.Type == \"S\" {\n incoming = append(incoming, instruction)\n } else {\n log.Printf(\"Invalid instruction type %s at line %d\", instruction.Type, r.LineNumber())\n }\n }\n\n return incoming, outgoing, r.Done()\n}", "title": "" }, { "docid": "b56c651c64eaf56fa3ae842cec128ee4", "score": "0.44051564", "text": "func GetData() []Data {\n\treturn allData\n}", "title": "" }, { "docid": "b4d4d999aec5d0ba776726efc58507e6", "score": "0.4394512", "text": "func (bds *BaseDataSource) Type() string {\n\treturn bds.SourceType\n}", "title": "" }, { "docid": "a614040d0d097ee6d1c5135e48879165", "score": "0.43879977", "text": "func (t *Repo) GetAllByType(ctx context.Context, typeTrigger string, partnerID string, fromCache bool) ([]e.ActiveTrigger, error) {\n\t// first try to get it from cache\n\tif fromCache {\n\t\tactiveTriggers, err := t.getFromCache(ctx, partnerID, typeTrigger)\n\t\tif err != nil {\n\t\t\treturn activeTriggers, err\n\t\t}\n\n\t\tif len(activeTriggers) != 0 {\n\t\t\treturn activeTriggers, nil\n\t\t}\n\t}\n\n\treturn t.getByTypeAndPartnerFromDB(partnerID, typeTrigger)\n}", "title": "" }, { "docid": "ac33598320d50d8e72013a24631630ee", "score": "0.43779078", "text": "func GenericGetQueryAll(w http.ResponseWriter, r *http.Request, data Validation, freq func(r *http.Request, req *gorm.DB) *gorm.DB) {\n\tdtype := reflect.TypeOf(data)\n\tpages := reflect.New(reflect.SliceOf(dtype)).Interface()\n\tspan, _ := opentracing.StartSpanFromContext(r.Context(), \"GenericGetQueryAll\") //opentracing.GlobalTracer().StartSpan(\"GenericGetQueryAll\")\n\tdefer span.Finish()\n\t//Limit and Pagination Part\n\n\toffset, pagesize, order := GetAllFromDb(r)\n\terr := error(nil)\n\tif offset <= 0 && pagesize <= 0 {\n\t\tspan.LogKV(\"warn\", \"error with elements size, can't define offset or pagesize\")\n\t}\n\t//Ordering Part\n\thasOrders := false //avoid sql injection on orders\n\tfor _, v := range data.OrderColumns() {\n\t\tval := strings.Split(order, \"_\")\n\t\torderDirection := val[len(val)-1]\n\t\tif len(val) >= 2 && strings.HasPrefix(order, v) && (orderDirection == \"asc\" || orderDirection == \"desc\") {\n\t\t\thasOrders = true\n\t\t\tif strings.Contains(v, \"date\") || strings.Contains(v, \"id_\") { // doesn't work on date :/\n\t\t\t\torder = v + \" \" + strings.ToUpper(orderDirection)\n\t\t\t} else {\n\t\t\t\torder = v + \"*1,\" + v + \" \" + strings.ToUpper(orderDirection)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tif !hasOrders {\n\t\torder = \"\"\n\t}\n\treq := data.QueryAllFromRequest(r, GetDB()).Model(data)\n\n\t//Get Default Query\n\treq = freq(r, req)\n\n\tif order != \"\" {\n\t\treq = req.Order(order)\n\t}\n\n\treq = GetQuery(r, req, data.FilterColumns())\n\n\t//Execution request Part\n\tcount, resp, err := DefaultCountFunc(r, req)\n\tif err != nil {\n\t\tutils.Respond(w, utils.Message(false, \"Error while retrieving data \"))\n\t\tspan.LogKV(\"warn\", \"reference splut error\"+err.Error())\n\t\tlog.Println(\"reference split error :\", err.Error())\n\t\treturn\n\t}\n\n\terr = req.Offset(offset).Limit(pagesize).Find(pages).Error\n\tif err != nil {\n\n\t\tspan.LogKV(\"warn\", \"error while retrieving date \"+err.Error())\n\t\tutils.Respond(w, utils.Message(false, \"Error while retrieving data\"))\n\t\treturn\n\t}\n\n\tresp[\"data\"] = pages\n\tresp[\"total_nb_values\"] = count\n\tresp[\"current_page\"] = offset/pagesize + 1\n\tresp[\"size_page\"] = pagesize\n\tutils.Respond(w, resp)\n}", "title": "" }, { "docid": "617f99ea17bfade05326971f9d382444", "score": "0.43688074", "text": "func (b *Bittrex) getBittrexData(currencyPair string) {\n\n\t//Get the base url\n\n\turl := bittrexBaseURL\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tq := req.URL.Query()\n\n\t//Append the user defined parameters to complete the url\n\n\tq.Add(\"market\", currencyPair)\n\n\treq.URL.RawQuery = q.Encode()\n\n\t//Sends the GET request to the API\n\n\trequest, err := http.NewRequest(\"GET\", req.URL.String(), nil)\n\n\tres, _ := b.client.Do(request)\n\n\t// To check the status code of response\n\tfmt.Println(res.StatusCode)\n\n\t//Store the response in body variable as a byte array\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t//Store the data in bittrexData struct\n\tvar data bittrexData\n\n\tjson.Unmarshal(body, &data)\n\tfmt.Printf(\"Results: %v\\n\", data.Result)\n\n\t//Loop over array of struct and store them in the table\n\n\tfor i := range data.Result {\n\t\tvar p1 models.HistoricDatum\n\n\t\tp1.Exchangeid = 1\n\t\tp1.Globaltradeid = data.Result[i].ID\n\t\tp1.Tradeid = \"nil\"\n\t\tp1.Timestamp = data.Result[i].Timestamp\n\t\tp1.Quantity = data.Result[i].Quantity\n\t\tp1.Price = data.Result[i].Price\n\t\tp1.Total = data.Result[i].Total\n\t\tp1.fill_type = data.Result[i].Filltype\n\t\tp1.order_type = data.Result[i].Ordertype\n\t\terr := p1.Insert(db)\n\t}\n\treturn\n\n}", "title": "" }, { "docid": "1a71891753078d17e7a1f7a7c0f73fa4", "score": "0.436832", "text": "func (mock *ColumnUsecaseMock) FetchCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tmock.lockFetch.RLock()\n\tcalls = mock.calls.Fetch\n\tmock.lockFetch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f9e08fc7d86d1019e0e27cd27fdc90e9", "score": "0.43587285", "text": "func (db DBObject) GetAll(saveTo interface{}) error {\n\tswitch saveTo.(type) {\n\tcase *[]types.User:\n\t\tjson.Unmarshal(FakeUsers, saveTo)\n\t\treturn nil\n\tcase *[]types.Message:\n\t\tjson.Unmarshal(FakeMessages2, saveTo)\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "441f652a430818ce7175a8d25e2df1c3", "score": "0.435857", "text": "func (f *FieldDefinition) getReadMethod(r Reader, dataType int32, innerTypes []*innerType) (readFn, []*innerType, error) {\n\tswitch dataType {\n\tcase GameDataTypeInt:\n\t\treturn f.readInt, innerTypes, nil\n\tcase GameDataTypeBoolean:\n\t\treturn f.readBoolean, innerTypes, nil\n\tcase GameDataTypeString:\n\t\treturn f.readString, innerTypes, nil\n\tcase GameDataTypeNumber:\n\t\treturn f.readNumber, innerTypes, nil\n\tcase GameDataTypeI18n:\n\t\treturn f.readI18n, innerTypes, nil\n\tcase GameDataTypeUint:\n\t\treturn f.readUint, innerTypes, nil\n\tcase GameDataTypeVector:\n\t\tvar err error\n\t\tinner := &innerType{}\n\t\tinner.name, err = r.ReadString()\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tinner.dataType, err = r.ReadInt32()\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tinnerTypes = append(innerTypes, inner)\n\t\tinner.fn, innerTypes, err = f.getReadMethod(r, inner.dataType, innerTypes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn f.readVector, innerTypes, nil\n\t}\n\tif dataType > 0 {\n\t\treturn f.readObject, innerTypes, nil\n\t}\n\treturn nil, nil, fmt.Errorf(\"invalid data type %v\", dataType)\n}", "title": "" }, { "docid": "b410ad32fc1dacdad5913592f0e006b5", "score": "0.43510225", "text": "func (d Dummy) GetData(url string) ([]byte, error) {\n\tfmt.Println(\"GetData method from foo3_test.Reader\")\n\treturn []byte(\"Testing\"), nil\n}", "title": "" }, { "docid": "66fd5f330d93a5f50ac5b12150ba31fd", "score": "0.434707", "text": "func GetTrDataDB(code string, qry TrDataQry, limit int, desc bool) (trdat *model.TradeData) {\n\ttables := resolveTables(qry)\n\tvar wg, wgr sync.WaitGroup\n\t//A slice of trading data of arbitrary kind\n\tochan := make(chan interface{}, 4)\n\n\t//Collect and merge query results\n\twgr.Add(1)\n\tgo func() {\n\t\tdefer wgr.Done()\n\t\tfor i := range ochan {\n\t\t\t//merge into model.TradeData slice\n\t\t\tswitch i.(type) {\n\t\t\tcase *[]*model.TradeDataBasic:\n\t\t\t\ttrdat.Base = *i.(*[]*model.TradeDataBasic)\n\t\t\tcase *[]*model.TradeDataLogRtn:\n\t\t\t\ttrdat.LogRtn = *i.(*[]*model.TradeDataLogRtn)\n\t\t\tcase *[]*model.TradeDataMovAvg:\n\t\t\t\ttrdat.MovAvg = *i.(*[]*model.TradeDataMovAvg)\n\t\t\tcase *[]*model.TradeDataMovAvgLogRtn:\n\t\t\t\ttrdat.MovAvgLogRtn = *i.(*[]*model.TradeDataMovAvgLogRtn)\n\t\t\tdefault:\n\t\t\t\tlog.Panicf(\"Unsupported type for query result consolidation: %v\", reflect.TypeOf(i).String())\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor table, typ := range tables {\n\t\twg.Add(1)\n\t\tgo func(tab string, typ reflect.Type) {\n\t\t\tdefer wg.Done()\n\t\t\tcols, _ := getTableColumns(typ)\n\t\t\tintf := reflect.New(reflect.SliceOf(typ)).Interface()\n\t\t\tif limit <= 0 {\n\t\t\t\tsql := fmt.Sprintf(\"select %s from %s where code = ? order by klid\",\n\t\t\t\t\tstrings.Join(cols, \",\"), tab)\n\t\t\t\tif desc {\n\t\t\t\t\tsql += \" desc\"\n\t\t\t\t}\n\t\t\t\t_, e := dbmap.Select(&intf, sql, code)\n\t\t\t\tutil.CheckErr(e, \"failed to query \"+tab+\" for \"+code)\n\t\t\t} else {\n\t\t\t\td := \"\"\n\t\t\t\tif desc {\n\t\t\t\t\td = \"desc\"\n\t\t\t\t}\n\t\t\t\tsql := fmt.Sprintf(\"select %[1]s from (select %[1]s from %[2]s where code = ? order by klid desc limit ?) t \"+\n\t\t\t\t\t\"order by t.klid %[3]s\", strings.Join(cols, \",\"), tab, d)\n\t\t\t\t_, e := dbmap.Select(&intf, sql, code, limit)\n\t\t\t\tutil.CheckErr(e, \"failed to query \"+tab+\" for \"+code)\n\t\t\t}\n\t\t\tochan <- intf\n\t\t}(table, typ)\n\t}\n\twg.Wait()\n\tclose(ochan)\n\twgr.Wait()\n\n\treturn\n}", "title": "" }, { "docid": "72499a74e7e4925c01d5eb5b889c12d8", "score": "0.43443292", "text": "func processCallData() {\n\tarrCallDetailsMaps, success, returnedCalls := queryDBCallDetails(mapGenericConf.ServiceManagerRequestType, mapGenericConf.AppRequestType, connStrAppDB)\n\tif success && returnedCalls > 0 {\n\n\t\tbar := pb.StartNew(len(arrCallDetailsMaps))\n\t\tdefer bar.FinishPrint(mapGenericConf.ServiceManagerRequestType + \" Request Import Complete\")\n\n\t\tjobs := make(chan RequestDetails, configMaxRoutines)\n\n\t\tfor w := 0; w < configMaxRoutines; w++ {\n\t\t\twg.Add(1)\n\t\t\tespXmlmc := NewEspXmlmcSession(importConf.HBConf.APIKeys[w])\n\t\t\tgo logNewCallJobs(jobs, &wg, espXmlmc)\n\t\t}\n\n\t\tfor _, callRecord := range arrCallDetailsMaps {\n\t\t\tmutexBar.Lock()\n\t\t\tbar.Increment()\n\t\t\tmutexBar.Unlock()\n\t\t\tjobs <- RequestDetails{GenericImportConf: mapGenericConf, CallMap: callRecord}\n\t\t}\n\n\t\tclose(jobs)\n\t\twg.Wait()\n\n\t} else {\n\t\tlogger(4, \"Request search failed for type: \"+mapGenericConf.ServiceManagerRequestType+\"[\"+mapGenericConf.AppRequestType+\"]\", true)\n\t}\n}", "title": "" }, { "docid": "a6caf52f27e5a050a5a106ea233459ac", "score": "0.43350014", "text": "func (dh *DataHelper) GetDataReader(preparedQuery string, arg ...interface{}) (datatable.Row, error) {\n\trow := datatable.Row{}\n\n\tvar rows *sql.Rows\n\tvar err error\n\n\tquery := dh.replaceQueryParamMarker(preparedQuery)\n\t// replace table names marked with {table}\n\tquery = replaceCustomPlaceHolder(query, dh.CurrentDatabaseInfo.Schema)\n\n\tif dh.tx != nil {\n\t\trows, err = dh.tx.Query(query, arg...)\n\t} else {\n\t\t//If the query is not in a transaction, the following properties are always reset\n\t\tdh.AllQueryOK = true\n\t\tdh.Errors = make([]string, 0)\n\n\t\trows, err = dh.db.Query(query, arg...)\n\t}\n\n\tif err != nil {\n\t\tdh.Errors = append(dh.Errors, err.Error())\n\t\tdh.AllQueryOK = false\n\t\treturn row, err\n\t}\n\n\t//Set the pointer to the returned rows\n\trow.SetSQLRow(rows)\n\trow.ResultRows = nil\n\n\treturn row, err\n}", "title": "" }, { "docid": "8c86e548756fbf45abdef2346c5f0fd0", "score": "0.4329006", "text": "func Test_getDbRecordsHandler(t *testing.T) {\n\tapiCalls_Runner(t, \"getDbRecordsHandler_Tab\", getDbRecordsHandler_Tab)\n}", "title": "" }, { "docid": "d2953bc452510ab21b55a8f6744fee38", "score": "0.43259254", "text": "func getOfferData(dbConn *db.DB, offerID int, specialsMap db.SpecialsMap, offersChan chan *xml.Offer) {\n\tvar (\n\t\terr error\n\t)\n\toffer := db.NewOffer(dbConn, offerID)\n\tutils.LogErrf(offer.Get(), \"Get offer (%d)\", offerID)\n\t// contact and owner data\n\tpersonID := offer.StringAt(db.IDWprowadzajacego)\n\tcontactID := offer.StringAt(db.IDWlasciciela)\n\n\tperson := db.NewPerson(dbConn)\n\tutils.LogErrf(person.Get(personID), \"Get person (%s) for offer (%d)\", personID, offerID)\n\tcontact := db.NewPerson(dbConn)\n\tutils.LogErrf(contact.Get(contactID), \"Get contact (%s) for offer (%d)\", personID, offerID)\n\t// additionals data\n\tadd := db.NewAdditional(dbConn)\n\tutils.LogErrf(add.Get(offerID), \"Get additional data for offer (%d)\", offerID)\n\t//\n\txmlOffer := fillOffer(offer, add, person, contact)\n\tsid := offer.StrID()\n\tvar imgIds []string\n\t// images and specials\n\timages := db.NewImages(dbConn, sid)\n\tif imgIds, err = images.FileNames(); err != nil {\n\t\tutils.LogErrf(err, \"Images ids for offer (%d)\", offerID)\n\t}\n\twg.Add(1)\n\tgo getImages(images, workDir)\n\txmlOffer.Pictures = xml.NewListElem(\"zdjecia\", \"zdjecie\")\n\txmlOffer.Pictures.AddMany(imgIds...)\n\txmlOffer.Specials = xml.NewListElem(\"wyroznienia\", \"wyroznienie\")\n\txmlOffer.Specials.AddMany(specialsMap[sid]...)\n\toffersChan <- xmlOffer\n}", "title": "" }, { "docid": "6951818fdce5c0997f0c9e63d5d8778b", "score": "0.43222463", "text": "func (_e *RetryHandler_Expecter) Data() *RetryHandler_Data_Call {\n\treturn &RetryHandler_Data_Call{Call: _e.mock.On(\"Data\")}\n}", "title": "" }, { "docid": "f0034d3333d3764c86fa132007da6993", "score": "0.4318094", "text": "func GetData(limit int8) []Job {\n\t//returns data from postgres db\n\treturnArray := make([]Job, limit)\n\tcount := 0\n\terr := godotenv.Load()\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading .env file\")\n\t}\n\tpassword := os.Getenv(\"USER_PASS\")\n\tuser := os.Getenv(\"USER_NAME\")\n\tdbname := \"career_bot\"\n\tpsqlInfo := fmt.Sprintf(\"host=52.188.71.209 port=5432 user=%s password=%s dbname=%s sslmode=disable\", user, password, dbname)\n\tfmt.Println(psqlInfo)\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\terr = db.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"Sucessfully connected\")\n\tuserSql := fmt.Sprintf(\"SELECT * FROM cs_bot.Jobs limit %d\", limit)\n\trows, err := db.Query(userSql)\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar myJob Job\n\t\terr := rows.Scan( &myJob.Id,&myJob.Companyname, &myJob.Companylocation, &myJob.Jobtitle, &myJob.Jobdescription, &myJob.Applylink, &myJob.Timestamps)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Couldn't execute for some odd reason\", err)\n\t\t}\n\t\treturnArray[count] = myJob\n\t\tcount++\n\n\t}\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't execute for some odd reason\", err)\n\t}\n\treturn returnArray\n}", "title": "" }, { "docid": "1818f9c2b2d6e112c9baba887dbcd312", "score": "0.43165475", "text": "func process_reader(data io.Reader) {\n\t// We are going to reflect on the Trip struct once to discover all it's fields\n\tt := reflect.TypeOf(Trip{})\n\t// track the type of the field as a string by position\n\tfieldType = make([]string, t.NumField())\n\t// track the field position to it's name\n\tfieldName = make([]string, t.NumField())\n\t// iterate struct fields\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfieldType[i] = t.Field(i).Type.String()\n\t\t// parse the tag and extract the json notation we have right there.\n\t\t// this is pretty dirty and prone to error if the tag changes\n\t\tparts := strings.Split(string(t.Field(i).Tag), \" \")\n\t\tsecondParts := strings.Split(parts[1], \"\\\"\")\n\t\tfieldName[i] = secondParts[1]\n\t}\n\tr := csv.NewReader(data)\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\ttrip := parseRecord(record)\n\t\tb, e := json.Marshal(trip)\n\t\tcheck(e)\n\n\t\tfmt.Println(string(b))\n\t}\n\n}", "title": "" }, { "docid": "d3130cafc481bc4e1ae56374b93cafb8", "score": "0.4305829", "text": "func (m *Financials) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"companies\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateCompanyFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]Companyable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(Companyable)\n }\n }\n m.SetCompanies(res)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "55a146a9d4ca9ffe9e5dd8b5fa904ff2", "score": "0.43004405", "text": "func (*SpeedData) Type() string { return \"SpeedData\" }", "title": "" }, { "docid": "0e75560abdc404ccc1443d32ce991cf3", "score": "0.42992264", "text": "func LoadURL() (resultList []ResultData) {\n\n\t// TODO: make this url configurable\n\tremoteURL := \"http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest\"\n\n\t// I'm trying to replace list with slice\n\t// as list has many problem I can't handle\n\tresultList = make([]ResultData, 0)\n\n\t// requesting url\n\tlog.Println(\"Download start, getting list from apnic......\")\n\tresp, err := http.Get(remoteURL)\n\tif err != nil {\n\t\tlog.Println(\"Error occurs while downloading...\")\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// use scanner to load it line by line\n\tscanner := bufio.NewScanner(resp.Body)\n\tvar line string\n\tfor scanner.Scan() {\n\t\tline = scanner.Text()\n\t\t// to print line data\n\t\t// uncomment the code below\n\t\t// log.Println(scanner.Text())\n\n\t\t// if this line start with \"apnic\"\n\t\t// then is a valied line\n\t\tif strings.HasPrefix(line, \"apnic\") {\n\t\t\tresult := ResultData{}\n\n\t\t\t// split line with \"|\" charactor\n\t\t\ts := strings.Split(line, \"|\")\n\t\t\tresult.CC, result.TheType = s[1], s[2]\n\t\t\t// TODO: deal with asn condition\n\t\t\tif result.TheType == \"ipv4\" {\n\t\t\t\tresult.IP = processIP4(s[3], s[4])\n\t\t\t} else if result.TheType == \"asn\" {\n\t\t\t\tresult.ASN = s[3]\n\t\t\t} else if result.TheType == \"ipv6\" {\n\t\t\t\tresult.IP = s[3] + \"/\" + s[4]\n\t\t\t}\n\n\t\t\t// convert date to golang's schema\n\t\t\tresult.AllocationDate = processDate(s[5])\n\n\t\t\t// finaly, creating a new slice\n\t\t\t// with the data just processed\n\t\t\tresultList = append(resultList, result)\n\t\t}\n\t}\n\n\t// check whether does it encounter an error\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4e207111a78a2b22a9d1eb50351f10ad", "score": "0.42954335", "text": "func (dp *ChDataProvider) FetchData(req *db.Request) (wrappers.ChDataWrapper, error) {\n\tif dp == nil || dp.data == nil {\n\t\treturn nil, errors.New(\"table pattern is not set\")\n\t}\n\n\tif err := dp.data.FetchData(db.CreateDataSelector(req)); err != nil {\n\t\treturn nil, errors.Wrap(err, \"SQL failed to execute while querying data: \"+req.Build())\n\t}\n\n\treturn dp.data, nil\n}", "title": "" }, { "docid": "b3a85957eddb33287b1825c636ed1a13", "score": "0.42952895", "text": "func (td *TradeResponse) GetData() []interface{} {\n\tvar data []interface{}\n\n\tfor _, d := range td.Data {\n\t\tdata = append(data, d)\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "e574890d8a7dfa39aa5bcef437b5dd47", "score": "0.42871708", "text": "func getStudentData(filter StudentFilter) ([]Measurement, error) {\n\n\tfromDate := filter.FromTime.Format(studentTimeLayout)\n\ttoDate := filter.ToTime.Format(studentTimeLayout)\n\twithin := filter.Within\n\tarea := filter.Area\n\n\tvar u string\n\t// if len(within) > 0 {\n\t// \tu = \"http://localhost:8080/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate + \"&within=\" + within\n\t// }\telse if len(area) > 0 {\n\t// \tu = \"http://localhost:8080/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate + \"&area=\" + url.QueryEscape(area)\n\t// }\telse {\n\t// \tu = \"http://localhost:8080/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate\n\t// }\n\tif len(within) > 0 {\n\t\tu = \"https://luft-184208.appspot.com/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate + \"&within=\" + within\n\t}\telse if len(area) > 0 {\n\t\tu = \"https://luft-184208.appspot.com/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate + \"&area=\" + url.QueryEscape(area)\n\t}\telse {\n\t\tu = \"https://luft-184208.appspot.com/api/data?totime=\" + toDate + \"&fromtime=\" + fromDate\n\t}\n\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\treturn []Measurement{}, errors.Wrap(err, \"Could not download data from luftprosjekttromso\")\n\t}\n\n\treader := csv.NewReader(resp.Body)\n\n\trecords, err := reader.ReadAll()\n\tif err != nil {\n\t\tif len(records) == 0 {\n\t\t\treturn []Measurement{}, nil\n\t\t}\n\t\treturn []Measurement{}, errors.Wrap(err, \"Could not read csv from \"+ u)\n\t}\n\n\t//fc := geojson.NewFeatureCollection()\n\tvar data []Measurement\n\n\tfor _, record := range records {\n\t\tif len(record) < 6 {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error prasing csv, not enough records\")\n\t\t}\n\n\n\t\tlong, err := strconv.ParseFloat(record[0], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (latitude)\")\n\t\t}\n\t\tlat, err := strconv.ParseFloat(record[1], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (longitude)\")\n\t\t}\n\n\t\thumid, err := strconv.ParseFloat(record[2], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (humidity)\")\n\t\t}\n\n\t\ttemp, err := strconv.ParseFloat(record[3], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (temperature)\")\n\t\t}\n\t\tpmTen, err := strconv.ParseFloat(record[4], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (pmTen)\")\n\t\t}\n\t\tpmTwoFive, err := strconv.ParseFloat(record[5], 64)\n\t\tif err != nil {\n\t\t\treturn []Measurement{}, errors.Wrap(err, \"error parsing float (pmTwoFive)\")\n\t\t}\n\n\t\tdate, err := time.Parse(studentResponseTimeLayout, record[6])\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tmsg := \"Could not parse date \" + record[6] + \" skipping measurement.\\n\"\n\t\t\tmsg += \"Url: \" + u\n\t\t\tfmt.Println(msg)\n\t\t\tfmt.Println(\"Full record: \", record)\n\t\t\tcontinue\n\t\t\t//return []Measurement{}, errors.Wrap(err, msg)\n\t\t}\n\n\n\t\tdata = append(data, Measurement{\n\t\t\tlat,\n\t\t\tlong,\n\t\t\tpmTen,\n\t\t\tpmTwoFive,\n\t\t\thumid,\n\t\t\ttemp,\n\t\t\tdate,\n\t\t})\n\t}\n\treturn data, nil\n\n}", "title": "" }, { "docid": "0d6c8b62a54373eec0c3a9d4089e49c3", "score": "0.42870536", "text": "func (m *BulkManagedDeviceActionResult) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"failedDeviceIds\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfPrimitiveValues(\"string\")\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]string, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = *(v.(*string))\n }\n }\n m.SetFailedDeviceIds(res)\n }\n return nil\n }\n res[\"notFoundDeviceIds\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfPrimitiveValues(\"string\")\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]string, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = *(v.(*string))\n }\n }\n m.SetNotFoundDeviceIds(res)\n }\n return nil\n }\n res[\"notSupportedDeviceIds\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfPrimitiveValues(\"string\")\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]string, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = *(v.(*string))\n }\n }\n m.SetNotSupportedDeviceIds(res)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"successfulDeviceIds\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfPrimitiveValues(\"string\")\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]string, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = *(v.(*string))\n }\n }\n m.SetSuccessfulDeviceIds(res)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "d71dcc4f7e83bb2d850418c5a99e1c74", "score": "0.42791018", "text": "func (service TransactionFetcherCSVService) FetchTransactionRecords(config CSVTransactionFetchOptions) (results []RawRecord, err error) {\n\trecords, err := service.csvFileReader.ReadAll(config.fileID)\n\tif err != nil {\n\t\treturn results, errors.Wrapf(err, \"cannot read csv file\")\n\t}\n\n\tfor _, record := range records {\n\t\terr = service.validateLine(record)\n\t\tif err != nil {\n\t\t\treturn results, errors.Wrap(err, \"record line is invalid\")\n\t\t}\n\n\t\tif service.getCardNumber(record) != config.cardNumber {\n\t\t\tcontinue\n\t\t}\n\n\t\trecordNotWithinLimit, err := service.recordIsNotWithinTimeLimit(record, config.startDate, config.endDate)\n\t\tif err != nil {\n\t\t\treturn results, errors.Wrapf(err, \"could not check if error is withing time limit\")\n\t\t}\n\t\tif recordNotWithinLimit {\n\t\t\tcontinue\n\t\t}\n\n\t\tfare, err := service.getFare(record)\n\t\tif err != nil {\n\t\t\treturn results, errors.Wrapf(err, \"cannot get fare as string\")\n\t\t}\n\n\t\ttimestamp, err := service.getTransactionDateTime(record)\n\t\tif err != nil {\n\t\t\treturn results, errors.Wrapf(err, \"cannot parse date into string\")\n\t\t}\n\n\t\tsource := rawRecordSourceCSV\n\t\ttransactionID := NewTransactionID()\n\t\tresults = append(results, RawRecord{\n\t\t\tCheckInInfo: service.getCheckInInfo(record),\n\t\t\tCheckInText: service.getCheckInText(record),\n\t\t\tFare: fare,\n\t\t\tProductInfo: service.getProductInfo(record),\n\t\t\tTransactionDateTime: timestamp,\n\t\t\tTransactionInfo: service.getTransactionInfo(record),\n\t\t\tTransactionName: service.getTransactionName(record),\n\t\t\tSource: &source,\n\t\t\tID: &transactionID,\n\t\t})\n\t}\n\n\treturn results, err\n}", "title": "" }, { "docid": "a60702eec2d0592a3ab5719a6980dce4", "score": "0.42778453", "text": "func DoRead() error {\n\tvar req xdrive.ReadRequest\n\terr := plugin.DelimRead(&req)\n\tif err != nil {\n\t\tplugin.DbgLogIfErr(err, \"Delim read req failed.\")\n\t\treturn err\n\t}\n\n\t// Check/validate frag info. Again, not necessary, as xdriver server should always\n\t// fill in good value.\n\tif req.FragCnt <= 0 || req.FragId < 0 || req.FragId >= req.FragCnt {\n\t\tplugin.DbgLog(\"Invalid read req %v\", req)\n\t\tplugin.ReplyError(-3, fmt.Sprintf(\"Read request frag (%d, %d) is not valid.\", req.FragId, req.FragCnt))\n\t\treturn fmt.Errorf(\"Invalid read request\")\n\t}\n\n\t//\n\t// Filter:\n\t// req may contains a list of Filters that got pushed down from XDrive server.\n\t// As per plugin protocol, plugin can ignore all of them if they choose to be\n\t// lazy. See comments in csvhandler.go.\n\t//\n\t// All filters are derived from SQL (where clause). There is a special kind of\n\t// filter called \"QUERY\", which allow users to send any query to plugin. Here as\n\t// an example, we implement a poorman's fault injection.\n\t//\n\tvar fault string\n\tfor _, f := range req.Filter {\n\t\t// f cannot be nil\n\t\tif f.Op == \"QUERY\" {\n\t\t\tfault = f.Args[0]\n\t\t}\n\t}\n\n\tif fault != \"\" {\n\t\terr = inject_fault(fault)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Glob:\n\trinfo := plugin.RInfo()\n\tflist, err := filepath.Glob(rinfo.Rpath)\n\tif err != nil {\n\t\tplugin.DbgLogIfErr(err, \"Glob failed. Rinfo %v\", *rinfo)\n\t\tplugin.ReplyError(-2, \"rmgr glob failed: \"+err.Error())\n\t\treturn err\n\t}\n\n\t// There are many different ways to implement FragId/FragCnt. Here we use filename.\n\t// All data within one file go to one fragid. We determine which files this call\n\t// should serve. Any deterministic scheme should work. We use hash mod.\n\t// One may, for example choos to impl fragid/fragcnt by hashing (or round robin) each\n\t// row. For CSV file, that is not really efficient because it will parse the file many\n\t// times in different plugin processes (but it does parallelize the task ...)\n\tmyflist := []string{}\n\tfor _, f := range flist {\n\t\th := fnv.New32a()\n\t\th.Write([]byte(f))\n\t\thv := int32(h.Sum32())\n\n\t\ttmp := hv % req.FragCnt\n\t\tif tmp < 0 {\n\t\t\ttmp += req.FragCnt\n\t\t}\n\n\t\tif req.FragId == tmp {\n\t\t\tplugin.DbgLog(\"Frag: file %s hash to %d, match frag (%d, %d)\", f, hv, req.FragId, req.FragCnt)\n\t\t\tmyflist = append(myflist, f)\n\t\t} else {\n\t\t\tplugin.DbgLog(\"Frag: file %s hash to %d, does not match frag (%d, %d)\", f, hv, req.FragId, req.FragCnt)\n\t\t}\n\t}\n\n\tplugin.DbgLog(\"fsplugin: path %s, frag (%d, %d) globed %v\", rinfo.Rpath, req.FragId, req.FragCnt, myflist)\n\n\t// Csv Handler.\n\tvar csvh csvhandler.CsvReader\n\tcsvh.Init(req.Filespec, req.Columndesc, req.Columnlist)\n\n\t// Now process each file.\n\tfor _, f := range myflist {\n\t\tfile, err := os.Open(f)\n\t\tif err != nil {\n\t\t\tplugin.DbgLogIfErr(err, \"Open csv file %s failed.\", f)\n\t\t\tplugin.ReplyError(-10, \"Cannot open file \"+f)\n\t\t\treturn err\n\t\t}\n\n\t\t// csvh will close.\n\t\terr = csvh.ProcessEachFile(file)\n\t\tif err != nil {\n\t\t\tplugin.DbgLogIfErr(err, \"Parse csv file %s failed.\", f)\n\t\t\tplugin.ReplyError(-20, \"CSV file \"+f+\" has invalid data\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Done! Fill in an empty reply, indicating end of stream.\n\tplugin.ReplyError(0, \"\")\n\treturn nil\n}", "title": "" }, { "docid": "74602004347489569a863276b2db018b", "score": "0.4269752", "text": "func (p *PaymentDemands) GetAll(db *sql.DB) error {\n\trows, err := db.Query(`SELECT p.id,p.import_date,p.iris_code,p.iris_name,\n\tp.beneficiary_id,b.name,p.demand_number,p.demand_date,p.receipt_date,\n\tp.demand_value,p.csf_date,p.csf_comment,p.demand_status,p.status_comment,\n\tp.excluded,p.excluded_comment,p.processed_date\n\tFROM payment_demands p\n\tJOIN beneficiary b on b.id=p.beneficiary_id`)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"select %v\", err)\n\t}\n\tvar l PaymentDemand\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&l.ID, &l.ImportDate, &l.IrisCode, &l.IrisName,\n\t\t\t&l.BeneficiaryID, &l.Beneficiary, &l.DemandNumber, &l.DemandDate,\n\t\t\t&l.ReceiptDate, &l.DemandValue, &l.CsfDate, &l.CsfComment, &l.DemandStatus,\n\t\t\t&l.StatusComment, &l.Excluded, &l.ExcludedComment, &l.ProcessedDate); err != nil {\n\t\t\treturn fmt.Errorf(\"scan %v\", err)\n\t\t}\n\t\tp.Lines = append(p.Lines, l)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rows err %v\", err)\n\t}\n\tif len(p.Lines) == 0 {\n\t\tp.Lines = []PaymentDemand{}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30bff547a64da23104b89f41cc10a74e", "score": "0.426666", "text": "func getTransactionListByType(acc_no int, tt string, db *pg.DB) ([]Transaction,error) {\n\n\tvar transactions []Transaction\n\tlog.Println(tt,acc_no)\n\terr := db.Model(&transactions).Where(\"account_number=?\",acc_no).Where(\"ttype=?\",tt).Select()\n\tif err != nil {\n\t\treturn transactions,err\n\t}\n\treturn transactions,nil\n}", "title": "" }, { "docid": "9d63449a8f1111bcc2b999395300fb4d", "score": "0.42633852", "text": "func (m *SalesOrder) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"billingPostalAddress\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreatePostalAddressTypeFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetBillingPostalAddress(val.(PostalAddressTypeable))\n }\n return nil\n }\n res[\"billToCustomerId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetBillToCustomerId(val)\n }\n return nil\n }\n res[\"billToCustomerNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetBillToCustomerNumber(val)\n }\n return nil\n }\n res[\"billToName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetBillToName(val)\n }\n return nil\n }\n res[\"currency\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateCurrencyFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCurrency(val.(Currencyable))\n }\n return nil\n }\n res[\"currencyCode\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCurrencyCode(val)\n }\n return nil\n }\n res[\"currencyId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCurrencyId(val)\n }\n return nil\n }\n res[\"customer\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateCustomerFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomer(val.(Customerable))\n }\n return nil\n }\n res[\"customerId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomerId(val)\n }\n return nil\n }\n res[\"customerName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomerName(val)\n }\n return nil\n }\n res[\"customerNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomerNumber(val)\n }\n return nil\n }\n res[\"discountAmount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetFloat64Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDiscountAmount(val)\n }\n return nil\n }\n res[\"discountAppliedBeforeTax\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDiscountAppliedBeforeTax(val)\n }\n return nil\n }\n res[\"email\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetEmail(val)\n }\n return nil\n }\n res[\"externalDocumentNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetExternalDocumentNumber(val)\n }\n return nil\n }\n res[\"fullyShipped\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetFullyShipped(val)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"lastModifiedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetLastModifiedDateTime(val)\n }\n return nil\n }\n res[\"number\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetNumber(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"orderDate\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetDateOnlyValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOrderDate(val)\n }\n return nil\n }\n res[\"partialShipping\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPartialShipping(val)\n }\n return nil\n }\n res[\"paymentTerm\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreatePaymentTermFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPaymentTerm(val.(PaymentTermable))\n }\n return nil\n }\n res[\"paymentTermsId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetUUIDValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPaymentTermsId(val)\n }\n return nil\n }\n res[\"phoneNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPhoneNumber(val)\n }\n return nil\n }\n res[\"pricesIncludeTax\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPricesIncludeTax(val)\n }\n return nil\n }\n res[\"requestedDeliveryDate\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetDateOnlyValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetRequestedDeliveryDate(val)\n }\n return nil\n }\n res[\"salesOrderLines\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateSalesOrderLineFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]SalesOrderLineable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(SalesOrderLineable)\n }\n }\n m.SetSalesOrderLines(res)\n }\n return nil\n }\n res[\"salesperson\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSalesperson(val)\n }\n return nil\n }\n res[\"sellingPostalAddress\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreatePostalAddressTypeFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSellingPostalAddress(val.(PostalAddressTypeable))\n }\n return nil\n }\n res[\"shippingPostalAddress\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreatePostalAddressTypeFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetShippingPostalAddress(val.(PostalAddressTypeable))\n }\n return nil\n }\n res[\"shipToContact\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetShipToContact(val)\n }\n return nil\n }\n res[\"shipToName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetShipToName(val)\n }\n return nil\n }\n res[\"status\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetStatus(val)\n }\n return nil\n }\n res[\"totalAmountExcludingTax\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetFloat64Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTotalAmountExcludingTax(val)\n }\n return nil\n }\n res[\"totalAmountIncludingTax\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetFloat64Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTotalAmountIncludingTax(val)\n }\n return nil\n }\n res[\"totalTaxAmount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetFloat64Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTotalTaxAmount(val)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "9b61966ff7c5c94e15c58d86115ca0e7", "score": "0.42590746", "text": "func (c *CsvCodec) Unmarshal(data []byte, obj interface{}) error {\n\n\t// check the value\n\trv := reflect.ValueOf(obj)\n\tif rv.Kind() != reflect.Ptr || rv.IsNil() {\n\t\treturn &InvalidUnmarshalError{reflect.TypeOf(obj)}\n\t}\n\n\treader := csv.NewReader(bytes.NewReader(data))\n\trecords, readErr := reader.ReadAll()\n\n\tif readErr != nil {\n\t\treturn readErr\n\t}\n\n\tlenRecords := len(records)\n\n\tif lenRecords == 0 {\n\n\t\t// no records\n\t\treturn nil\n\n\t} else if lenRecords == 1 {\n\n\t\t// no records (first line should be header)\n\t\treturn nil\n\n\t} else if lenRecords == 2 {\n\n\t\t// one record\n\n\t\t// get the object\n\t\tobject, err := mapFromFieldsAndRow(records[0], records[1])\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the obj value\n\t\trv.Elem().Set(reflect.ValueOf(object))\n\n\t} else {\n\n\t\t// multiple records\n\n\t\t// make a new array to hold the data\n\t\trows := make([]interface{}, lenRecords-1)\n\n\t\t// collect the fields\n\t\tfields := records[0]\n\n\t\t// add each row\n\t\tvar err error\n\t\tfor i := 1; i < lenRecords; i++ {\n\n\t\t\trows[i-1], err = mapFromFieldsAndRow(fields, records[i])\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\n\t\t// set the obj value\n\t\trv.Elem().Set(reflect.ValueOf(rows))\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6348d9de5abf8ac91128a3e8c1dd9a77", "score": "0.4253503", "text": "func (resultsTable *ResultsTable) Scan(data interface{}) error {\n\tswitch values := data.(type) {\n\tcase []byte:\n\t\treturn json.Unmarshal(values, resultsTable)\n\tcase string:\n\t\treturn resultsTable.Scan([]byte(values))\n\tdefault:\n\t\treturn errors.New(\"unsupported data type for Qor Job error table\")\n\t}\n}", "title": "" }, { "docid": "5ae7863ff25fec7e2edcc0cf7d204f29", "score": "0.4250009", "text": "func (t *SimpleChaincode) Query(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) {\n // asset CRUD API\n if function == \"readAssetAirline\" {\n return t.readAssetAirline(stub, args)\n } else if function == \"readAssetAircraft\" {\n return t.readAssetAircraft(stub, args)\n } else if function == \"readAssetAssembly\" {\n return t.readAssetAssembly(stub, args)\n } else if function == \"readAllAssetsAirline\" {\n return t.readAllAssetsAirline(stub, args)\n } else if function == \"readAllAssetsAircraft\" {\n return t.readAllAssetsAircraft(stub, args)\n } else if function == \"readAllAssetsAssembly\" {\n return t.readAllAssetsAssembly(stub, args)\n } else if function == \"readAssetAirlineHistory\" {\n return t.readAssetAirlineHistory(stub, args)\n } else if function == \"readAssetAircraftHistory\" {\n return t.readAssetAircraftHistory(stub, args)\n } else if function == \"readAssetAssemblyHistory\" {\n return t.readAssetAssemblyHistory(stub, args)\n } else if function == \"readAssetAircraftComplete\" {\n return t.readAssetAircraftComplete(stub, args)\n\n // contract dynamic config API\n } else if function == \"readContractConfig\" {\n return readContractConfig(stub, args)\n\n // contract state / behavior API\n } else if function == \"readRecentStates\" {\n return readRecentStates(stub)\n } else if function == \"readAssetSamples\" {\n return t.readAssetSamples(stub, args)\n } else if function == \"readAssetSchemas\" {\n return t.readAssetSchemas(stub, args)\n } else if function == \"readContractObjectModel\" {\n return t.readContractObjectModel(stub, args)\n } else if function == \"readContractState\" {\n return t.readContractState(stub, args)\n\n // debugging API\n } else if function == \"readWorldState\" {\n return t.readWorldState(stub)\n }\n err := fmt.Errorf(\"Query received unknown invocation: %s\", function)\n log.Warning(err)\n return nil, err\n}", "title": "" }, { "docid": "cad01690d51084212f2d4e91ec6fa06d", "score": "0.42349368", "text": "func SyncQueryAllData(value string, db *Sql, path string) (error, string) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tsugar.Log.Errorf(\"This is recover info:\", err)\n\t\t}\n\t}()\n\tsugar.Log.Info(\"~~~~ Start Query all data ~~~~ \")\n\t// var t vo.QueryAllData\n\twg := sync.WaitGroup{}\n\t// err := json.Unmarshal([]byte(value), &t)\n\t// if err != nil {\n\t// \tsugar.Log.Error(\"Marshal is failed.Err is \", err)\n\t// }\n\t// sugar.Log.Info(\"Marshal data is \", t)\n\t// //check token is vaild.\n\t// claim, b := jwt.JwtVeriyToken(t.Token)\n\t// userId := claim[\"UserId\"]\n\t// sugar.Log.Info(\"userId := \", userId)\n\t// if !b {\n\t// \treturn errors.New(\" Token is invaild. \"), \"\"\n\t// }\n\t// sugar.Log.Info(\"claim := \", claim)\n\n\tsugar.Log.Info(\"open file path:= \", path)\n\n\tf1, err := os.OpenFile(path+\"querydata\", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) //open file\n\tif err != nil {\n\t\tsugar.Log.Errorf(\" Open %s file is failed.Err:\", err)\n\t\treturn err, \"\"\n\t}\n\n\twg.Add(5)\n\t//query cloud_file table.\n\tgo func() {\n\t\trows, err := db.DB.Query(\"select id,IFNULL(user_id,'null'),IFNULL(file_name,'null'),IFNULL(parent_id,0),IFNULL(ptime,0),IFNULL(file_cid,'null'),IFNULL(file_size,0),IFNULL(file_type,0),IFNULL(is_folder,0),IFNULL(thumbnail,'null') from cloud_file\")\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\"Query data is failed.Err is \", err)\n\t\t\t// return arrfile, errors.New(\"查询下载列表信息失败\")\n\t\t\treturn\n\t\t}\n\t\t// 释放锁\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar dl File\n\t\t\terr = rows.Scan(&dl.Id, &dl.UserId, &dl.FileName, &dl.ParentId, &dl.Ptime, &dl.FileCid, &dl.FileSize, &dl.FileType, &dl.IsFolder, &dl.Thumbnail)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\"Query scan data is failed.The err is \", err)\n\t\t\t\t// return arrfile, err\n\t\t\t}\n\t\t\tsugar.Log.Info(\"Query a entire data is \", dl)\n\t\t\t//write to file.\n\t\t\tsql := fmt.Sprintf(\"INSERT OR REPLACE INTO cloud_file (id,user_id,file_name,parent_id,ptime,file_cid,file_size,file_type,is_folder,thumbnail) values('%s','%s','%s','%s',%d,'%s',%d,%d,%d,'%s')\\n\", dl.Id, dl.UserId, dl.FileName, dl.ParentId, dl.Ptime, dl.FileCid, dl.FileSize, dl.FileType, dl.IsFolder, dl.Thumbnail)\n\t\t\t_, err = f1.WriteString(sql)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\t\t}\n\t\t\t// arrfile = append(arrfile, dl)\n\t\t}\n\t\twg.Done()\n\t}()\n\t//query cloud_transfer table.\n\tgo func() {\n\t\trows, err := db.DB.Query(\"select id,IFNULL(user_id,'null'),IFNULL(file_name,'null'),IFNULL(ptime,0),IFNULL(file_cid,'null'),IFNULL(file_size,0),IFNULL(down_path,'null'),IFNULL(file_type,0),IFNULL(transfer_type,0),IFNULL(upload_parent_id,0),IFNULL(upload_file_id,0) from cloud_transfer\")\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\"Query data is failed.Err is \", err)\n\t\t}\n\t\t// 释放锁\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar dl TransferDownLoadParams\n\t\t\terr = rows.Scan(&dl.Id, &dl.UserId, &dl.FileName, &dl.Ptime, &dl.FileCid, &dl.FileSize, &dl.DownPath, &dl.FileType, &dl.TransferType, &dl.UploadParentId, &dl.UploadFileId)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\"Query scan data is failed.The err is \", err)\n\t\t\t\t// return arrfile, err\n\t\t\t}\n\t\t\tsugar.Log.Info(\"Query a entire data is \", dl)\n\t\t\tsql1 := fmt.Sprintf(\"INSERT OR REPLACE INTO cloud_transfer (id,user_id,file_name,ptime,file_cid,file_size,down_path,file_type,transfer_type,upload_parent_id,upload_file_id) values('%s','%s','%s',%d,'%s',%d,'%s',%d,%d,'%s','%s')\\n\", dl.Id, dl.UserId, dl.FileName, dl.Ptime, dl.FileCid, dl.FileSize, dl.DownPath, dl.FileType, dl.TransferType, dl.UploadParentId, dl.UploadFileId)\n\t\t\t_, err = f1.WriteString(sql1)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\t\t}\n\t\t\t// transfer = append(transfer, dl)\n\t\t}\n\n\t\twg.Done()\n\n\t}()\n\t//query chat_msg table.\n\tgo func() {\n\t\trows, err := db.DB.Query(\"SELECT * FROM chat_msg\")\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\"Query data is failed.Err is \", err)\n\t\t}\n\t\t// 释放锁\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar dl ChatMsg\n\t\t\terr = rows.Scan(&dl.Id, &dl.ContentType, &dl.Content, &dl.FromId, &dl.ToId, &dl.Ptime, &dl.IsWithdraw, &dl.IsRead, &dl.RecordId)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\"Query scan data is failed.The err is \", err)\n\t\t\t}\n\t\t\tsugar.Log.Info(\"Query a entire data is \", dl)\n\t\t\tsql := fmt.Sprintf(\"INSERT OR REPLACE INTO chat_msg (id, content_type, content, from_id, to_id, ptime, is_with_draw, is_read, record_id) VALUES ('%s', %d, '%s', '%s', '%s', %d, %d,%d, '%s')\\n\", dl.Id, dl.ContentType, dl.Content, dl.FromId, dl.ToId, dl.Ptime, dl.IsWithdraw, dl.IsRead, dl.RecordId)\n\n\t\t\t//write to file.\n\t\t\t_, err = f1.WriteString(sql)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\t\t}\n\t\t}\n\t\twg.Done()\n\n\t}()\n\t//query chat_record table.\n\tgo func() {\n\t\trows, err := db.DB.Query(\"SELECT id, name,from_id, to_id, ptime, last_msg FROM chat_record\")\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\"Query chat_record data is failed.Err is \", err)\n\t\t}\n\t\t// 释放锁\n\t\trows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar ri ChatRecord\n\t\t\terr := rows.Scan(&ri.Id, &ri.Name, &ri.FromId, &ri.Toid, &ri.Ptime, &ri.LastMsg)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\"Query chat_record data is failed.Err is \", err)\n\t\t\t}\n\t\t\t//\n\t\t\tsql := fmt.Sprintf(\"INSERT OR REPLACE INTO chat_record (id, name, from_id, to_id, ptime, last_msg) VALUES ('%s', '%s', '%s', '%s',%d,'%s')\\n\", ri.Id, ri.Name, ri.FromId, ri.Toid, ri.Ptime, ri.LastMsg)\n\t\t\t_, err = f1.WriteString(sql)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\t\t}\n\t\t}\n\t\twg.Done()\n\n\t}()\n\t// query sys_user table.\n\tgo func() {\n\t\trows, err := db.DB.Query(\"select id,IFNULL(peer_id,'null'),IFNULL(name,'null'),IFNULL(phone,'null'),IFNULL(sex,0),IFNULL(ptime,0),IFNULL(utime,0),IFNULL(nickname,'null'),IFNULL(img,'null') from sys_user\")\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\"Query data is failed.Err is \", err)\n\t\t}\n\t\t// 释放锁\n\t\tdefer rows.Close()\n\t\tvar user SysUser\n\n\t\tfor rows.Next() {\n\t\t\terr = rows.Scan(&user.Id, &user.PeerId, &user.Name, &user.Phone, &user.Sex, &user.Ptime, &user.Utime, &user.NickName, &user.Img)\n\t\t\tif err != nil {\n\t\t\t\tsugar.Log.Error(\"Query scan data is failed.The err is \", err)\n\t\t\t}\n\t\t\tsugar.Log.Info(\"Query a entire data is \", user)\n\t\t}\n\t\t//\n\t\tsql := fmt.Sprintf(\"INSERT OR REPLACE INTO sys_user (id, peer_id, name, phone, sex, ptime,utime,nickname) VALUES ('%s', '%s', '%s', '%s',%d,%d,%d,'%s')\\n\", user.Id, user.PeerId, user.Name, user.Phone, user.Sex, user.Ptime, user.Utime, user.NickName)\n\t\t_, err = f1.WriteString(sql)\n\t\tif err != nil {\n\t\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\t}\n\t\twg.Done()\n\n\t}()\n\n\twg.Wait()\n\t// upload file to remote IPFS Node.\n\n\tsugar.Log.Info(\"1111111111\")\n\n\tcid, err := PostFormDataPublicgatewayFile(path, \"querydata\")\n\tif err != nil {\n\t\tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t\treturn err, \"\"\n\t}\n\tsugar.Log.Info(\" Cid := \", cid)\n\t//delete querydata file.\n\t// err = RemoveCidPathFile(path)\n\t// if err != nil {\n\t// \tsugar.Log.Error(\" Write update file is failed.Err: \", err)\n\t// \treturn err, \"\"\n\t// }\n\tsugar.Log.Info(\"~~~~ Query all data End ~~~~ \")\n\treturn nil, cid\n}", "title": "" }, { "docid": "acc6e872c74fcfbe249b588393b1dd60", "score": "0.42329675", "text": "func (s *service) GetData(\n\tctx context.Context,\n\trequest *api.GetDataRequest,\n) (*api.GetDataResponse, error) {\n\tctx = logcontext.WithLogger(ctx, logcontext.FromContext(ctx).\n\t\tWithField(\"service_method\", \"GetData\").\n\t\tWithField(\"limit\", request.GetLimit()).\n\t\tWithField(\"device_name\", request.GetDeviceId().GetName()))\n\tdataList, err := s.DatabaseClient.GetDataByDeviceName(\n\t\tctx, &database.GetDataByDeviceNameRequest{\n\t\t\tDeviceName: request.GetDeviceId().GetName(),\n\t\t\tLimit: request.GetLimit(),\n\t\t})\n\tif err != nil {\n\t\treturn nil, errors.ToFrontendError(ctx, err, codes.Internal, \"Database error\")\n\t}\n\tvar apiData []*api.DeviceData\n\tfor _, data := range dataList {\n\t\tdataTime, err := time.Parse(timeFormat, data.Timestamp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.ToFrontendError(ctx, err, codes.Internal, \"Data error\")\n\t\t}\n\t\tapiData = append(apiData, &api.DeviceData{\n\t\t\tDeviceId: request.DeviceId,\n\t\t\tData: data.Data,\n\t\t\tTimestamp: timestamppb.New(dataTime),\n\t\t})\n\t}\n\tlogcontext.FromContext(ctx).Info(\"success\")\n\treturn &api.GetDataResponse{DeviceData: apiData}, nil\n}", "title": "" }, { "docid": "75bb4635ba4c14c7d39ac753af761c8c", "score": "0.4224081", "text": "func GetCommentFieldDatasByCommentTypeAndMail(offset int, limit int, CommentType_ string, Mail_ string) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"comment_type = ? and mail = ?\", CommentType_, Mail_).Limit(limit, offset).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" }, { "docid": "7a88609aa9f92e4438f5e27a47352d81", "score": "0.42167082", "text": "func (rh *SQLRows) Fetch() error {\n\t// reserve memory space\n\tfor i := 0; i < len(rh.columnBytes); i++ {\n\t\trh.columnBytes[i] = new(sql.RawBytes)\n\t}\n\t// read as variadic parameters\n\terr := rh.Scan(rh.columnBytes...)\n\treturn err\n}", "title": "" }, { "docid": "d29220f7979b7ec1f88e0dbf2bcb81fe", "score": "0.4215219", "text": "func GetData(query bson.M, waitGroup *sync.WaitGroup, mongoSession *mgo.Session) *[]common.CarTrackEntity {\n\t// Decrement the wait group count so the program knows this\n\t// has been completed once the goroutine exits.\n\tdefer waitGroup.Done()\n\n\t// Request a socket connection from the session to process our query.\n\t// Close the session when the goroutine exits and put the connection back\n\t// into the pool.\n\tsessionCopy := mongoSession.Copy()\n\tdefer sessionCopy.Close()\n\n\t// Get a collection to execute the query against.\n\tcollection := sessionCopy.DB(common.MongoConfig.TestDatabase).C(\"obd2info\")\n\n\t// Index\n\tindex := mgo.Index{\n\t\tKey: []string{\"infotype\", \"trackdate\"},\n\t\tUnique: true,\n\t\tDropDups: true,\n\t\tBackground: true,\n\t\tSparse: true,\n\t}\n\n\terr := collection.EnsureIndex(index)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcarTrackEntityList := new([]common.CarTrackEntity)\n\t// Retrieve the list of track information.\n\terr = collection.Find(query).All(carTrackEntityList)\n\tif err != nil {\n\t\tlog.Printf(\"RunQuery: ERROR: %s\\n\", err)\n\t\treturn nil\n\t}\n\n\tlog.Printf(\"RunQuery: Count[%d]\\n\", len(*carTrackEntityList))\n\n\treturn carTrackEntityList\n}", "title": "" }, { "docid": "a5518641feafef2af40f9ed3402d1b81", "score": "0.42077425", "text": "func Test_getDbRecordHandler(t *testing.T) {\n\tapiCalls_Runner(t, \"getDbRecordHandler_Tab\", getDbRecordHandler_Tab)\n}", "title": "" }, { "docid": "8287fe8ad4a64c72baa815fadc9a6238", "score": "0.42057905", "text": "func printByActivityType(activityType string) {\n\n\tactivityDates := utils.GetActivityDates(activityType)\n\n\tfor _, date := range activityDates {\n\t\tif err := utils.InitDB.Driver.Read(activityType, date, &databaseRecord); err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tutils.PrintActivity(date, databaseRecord)\n\t}\n}", "title": "" }, { "docid": "bb010b006801e9a4076c0013967fee93", "score": "0.420239", "text": "func (m *PositionDetail) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"company\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateCompanyDetailFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCompany(val.(CompanyDetailable))\n }\n return nil\n }\n res[\"description\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDescription(val)\n }\n return nil\n }\n res[\"endMonthYear\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetDateOnlyValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetEndMonthYear(val)\n }\n return nil\n }\n res[\"jobTitle\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetJobTitle(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"role\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetRole(val)\n }\n return nil\n }\n res[\"startMonthYear\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetDateOnlyValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetStartMonthYear(val)\n }\n return nil\n }\n res[\"summary\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSummary(val)\n }\n return nil\n }\n return res\n}", "title": "" }, { "docid": "8f405fa8dfedfd0e1507ee269390a6c1", "score": "0.4200237", "text": "func queryByStepAndOperationType(stub shim.ChaincodeStubInterface,\n\toperationType string,\n\tbyStep bool, // if this is 'true', mean query by step, otherwise will not query by step.\n\tstep int,\n\townerId string,\n\tdataName string,\n\ttargetOwner string,\n\ttargetDataName string) ([]byte, error) {\n\tvar err error\n\tfmt.Println(\"starting queryByDataAndOperationType\")\n\n\tif len(operationType) == 0 {\n\t\treturn nil, errors.New(\"Incorrect operationType. Expecting non empty type.\")\n\t}\n\tif byStep && step < 1 {\n\t\treturn nil, errors.New(\"Incorrect step. Expecting step >= 1.\")\n\t}\n\tif len(ownerId) != 32 || len(targetOwner) != 32 {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Incorrect owner or targetOwner. Expecting 16 bytes of md5 hash which has len == 32 of hex string.ownerId:%s\", ownerId))\n\t}\n\tif len(dataName) == 0 || len(targetDataName) == 0 {\n\t\treturn nil, errors.New(\"Incorrect dataName or targetDataName. Expecting non empty dataName and targetDataName.\")\n\t}\n\n\tvar queryString string\n\tif byStep == true {\n\t\tqueryString = fmt.Sprintf(\"{\\\"selector\\\":{\\\"operationType\\\":\\\"%s\\\",\\\"step\\\":%d,\\\"owner\\\":\\\"%s\\\",\\\"dataName\\\":\\\"%s\\\",\\\"targetOwner\\\":\\\"%s\\\",\\\"targetDataName\\\":\\\"%s\\\"}}\",\n\t\t\toperationType, step, ownerId, dataName, targetOwner, targetDataName)\n\t} else {\n\t\tqueryString = fmt.Sprintf(\"{\\\"selector\\\":{\\\"operationType\\\":\\\"%s\\\",\\\"owner\\\":\\\"%s\\\",\\\"dataName\\\":\\\"%s\\\",\\\"targetOwner\\\":\\\"%s\\\",\\\"targetDataName\\\":\\\"%s\\\"}}\",\n\t\t\toperationType, ownerId, dataName, targetOwner, targetDataName)\n\t}\n\n\tfmt.Printf(\"- queryByStepAndOperationType queryString:\\n%s\\n\", queryString)\n\n\tresultsIterator, err := stub.GetQueryResult(queryString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resultsIterator.Close()\n\tif resultsIterator.HasNext() == false {\n\t\treturn nil, nil \t//there is no record for step\n\t}\n\tqueryResponse, err := resultsIterator.Next()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfmt.Printf(\"- queryByStepAndOperationType queryResult:\\n%s\\n\", queryResponse.Value)\n\treturn queryResponse.Value, nil\n}", "title": "" }, { "docid": "8015a1526711cc0c3926afcdf74f35e7", "score": "0.41975132", "text": "func TestFetchFoo3(t *testing.T) {\n\tdummy := Dummy{}\n\tdummy.GetData(\"\")\n\n\t// Other test stuffs...\n}", "title": "" }, { "docid": "7b5f3198639a9073a9c82c6fb064ddd9", "score": "0.41867533", "text": "func (t *timeSeriesType) Fetch(\n\tapplicationId interface{},\n\tstart, end float64,\n\tresult Appender) {\n\trecord := Record{\n\t\tEndpointId: applicationId,\n\t\tInfo: t.id}\n\tt.lock.Lock()\n\tdefer t.lock.Unlock()\n\t// Only include latest value if it comes before end timestamp.\n\tif t.lastValue.TimeStamp < end {\n\t\trecord.TimeStamp = t.lastValue.TimeStamp\n\t\trecord.setValue(t.lastValue.Value)\n\t\tif !result.Append(&record) {\n\t\t\treturn\n\t\t}\n\t}\n\tif t.lastValue.TimeStamp > start {\n\t\tt.pages.Fetch(start, end, &record, result)\n\t}\n}", "title": "" }, { "docid": "b7acdb2547e9cb9916729f5e919d0020", "score": "0.41854295", "text": "func (_m *ControllerClient) FetchAllEnums(tableName string, columnName string) ([]string, error) {\n\tret := _m.Called(tableName, columnName)\n\n\tvar r0 []string\n\tif rf, ok := ret.Get(0).(func(string, string) []string); ok {\n\t\tr0 = rf(tableName, columnName)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]string)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, string) error); ok {\n\t\tr1 = rf(tableName, columnName)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "3aba39bfb246a1ed2cfaa9d2d5dd8984", "score": "0.41836733", "text": "func (rs *Results) Reload() {\n\tfor _, r := range *rs {\n\t\tr.OpenCSV()\n\t}\n}", "title": "" }, { "docid": "b1835a82afc0ce4c46a6c2c60eae568b", "score": "0.4182471", "text": "func (r Rows) GetType() string {\n\treturn r.Type\n}", "title": "" }, { "docid": "70956cb7f8af69767fd0f6a13c4f1cd8", "score": "0.4171373", "text": "func (OnReceiveOperationFinish) ListenedType() reflect.Type { return receiveOperationResType }", "title": "" }, { "docid": "6614f9b10bf2a1688b3be6268107c19d", "score": "0.41606158", "text": "func GetCommentFieldDatasByCommentTypeAndCreated(offset int, limit int, CommentType_ string, Created_ int) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"comment_type = ? and created = ?\", CommentType_, Created_).Limit(limit, offset).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" }, { "docid": "0ea25e25bd8039745dd12dccfec88fed", "score": "0.4156991", "text": "func (t *SimpleChaincode) getAllTransporterBatches(stub shim.ChaincodeStubInterface, args []string) pb.Response{\n\t\n\t//get the AllBatches index\n\tallBAsBytes,_ := stub.GetState(\"AllBatches\")\n\t\n\tvar res AllBatches\n\tjson.Unmarshal(allBAsBytes, &res)\n\t\n\tvar rab AllBatchesDetails\n\n\tfor i := range res.AllBatches{\n\n\t\tsbAsBytes,_ := stub.GetState(res.AllBatches[i])\n\t\t\n\t\tvar sb MilkProduct\n\t\tjson.Unmarshal(sbAsBytes, &sb)\n\n\tif(sb.BatchStatus == \"TP\" || sb.BatchStatus == \"RT\" || sb.BatchStatus == \"Paid\") {\n\t\trab.Batches = append(rab.Batches,sb); \n\t}\n\n\t}\n\n\trabAsBytes, _ := json.Marshal(rab)\n\n\treturn shim.Success(rabAsBytes)\n\t\n}", "title": "" }, { "docid": "9018c3719893ee9296800df095cf7dac", "score": "0.41515347", "text": "func PopulateTestData(entity interface{}) interface{} {\n\n\tel := reflect.ValueOf(entity).Elem()\n\tt := el.Type()\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfld := t.Field(i)\n\t\tcolumn := fld.Tag.Get(\"col\")\n\t\tif column == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif column == \"id\" {\n\t\t\tcontinue\n\t\t}\n\t\tval := el.FieldByIndex(fld.Index)\n\t\tv := val.Interface()\n\t\tswitch v.(type) {\n\t\tcase string:\n\t\t\tval.SetString(GenerateTestString(16))\n\t\tcase bool:\n\t\t\tval.SetBool(true)\n\t\tcase time.Time:\n\t\t\tval.Set(reflect.ValueOf(time.Now()))\n\t\tcase *time.Time:\n\t\t\tn := time.Now()\n\t\t\tval.Set(reflect.ValueOf(&n))\n\t\t}\n\t}\n\n\treturn entity\n}", "title": "" }, { "docid": "94e7aaec111ddf0f4dd5bddaae19eb6c", "score": "0.41463473", "text": "func (d *ResultDao) GetAll() []models.Result {\n\tdataList := make([]models.Result, 0)\n\terr := d.engine.Desc(\"id\").Find(&dataList)\n\tif err != nil {\n\t\tlog.Printf(\"Result dao GetAll() error : %v\\n\", err)\n\t}\n\treturn dataList\n}", "title": "" }, { "docid": "8dee4267c31e5c436f78c05d542de6f2", "score": "0.41444242", "text": "func (ms *MySQLStore) getByProvidedType(t GetByType, arg interface{}) (*User, error) {\n\tsel := string(\"SELECT UserID, CookieHash FROM TblUser WHERE \" + t + \" = ?\")\n\n\trows, err := ms.Database.Query(sel, arg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tuser := &User{}\n\n\t// Should never have more than one row, so only grab one\n\trows.Next()\n\tif err := rows.Scan(\n\t\t&user.UserID,\n\t\t&user.CookieHash); err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "c13801eb03b7c5ec0962dd429490d769", "score": "0.41441002", "text": "func GetCommentFieldDatasByCommentTypeAndMailAndEntityType(offset int, limit int, CommentType_ string, Mail_ string, EntityType_ string) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"comment_type = ? and mail = ? and entity_type = ?\", CommentType_, Mail_, EntityType_).Limit(limit, offset).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" }, { "docid": "4e4a8ef43b578ff9cc7a18c4d08de3bc", "score": "0.41427112", "text": "func GetDataClasses(parameter, service, domain string) ([]string, string, error) {\n\turl := fmt.Sprintf(baseURL+\"%s\", service)\n\n\tres, err := getData(url)\n\tif err != nil {\n\t\treturn []string{}, \"\", err\n\t}\n\tvar response []string\n\terr = json.Unmarshal(res, &response)\n\tif err != nil {\n\t\treturn []string{}, \"\", err\n\t}\n\n\tbody, _ := json.MarshalIndent(response, \"\", \" \")\n\n\treturn response, fmt.Sprintf(\"%s\", body), nil\n}", "title": "" }, { "docid": "3db84437c78fd1d82b48dea0c0359148", "score": "0.41382504", "text": "func (q *query) retrieveData() error {\n\tsql, args := q.computeQuery()\n\n\t//fmt.Println(sql, args, q, q.subQuery)\n\trows, err := GetDb().Query(sql, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// get number of columns\n\tcols, err := rows.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tncols := len(cols)\n\tfor rows.Next() {\n\t\t// This is just a way to read the columns without knowing the type\n\t\tfields := make([]interface{}, ncols)\n\t\tfieldPtrs := make([]interface{}, ncols)\n\n\t\tfor i, _ := range fields {\n\t\t\tfieldPtrs[i] = &fields[i]\n\t\t}\n\n\t\terr := rows.Scan(fieldPtrs...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trow := make(map[string]interface{})\n\t\tfor i, col := range cols {\n\t\t\trow[col] = fields[i]\n\t\t}\n\t\tq.rows = append(q.rows, row)\n\t\tq.rowNum += 1\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\treturn err\n\t}\n\n\tq.dataRetrieved = true\n\treturn nil\n}", "title": "" }, { "docid": "54b703599d4a66a045fc16be3f1e28e5", "score": "0.41371566", "text": "func (m *Manager) GetPhoneData(brand, carrier, network string) *PhoneData {\n\tif irancel.MatchString(carrier) {\n\t\tcarrier = \"Irancell\"\n\t} else if irmci.MatchString(carrier) {\n\t\tcarrier = \"IR-MCI\"\n\t} else if rightel.MatchString(carrier) {\n\t\tcarrier = \"RighTel\"\n\t}\n\tresult := PhoneData{\n\t\tBrand: brand,\n\t\t// Model: model,\n\t\tCarrier: carrier,\n\t\tNetwork: network,\n\t\tNetworkID: UnknownNetwork,\n\t}\n\tq := \"SELECT ab_id as id, ab_brand as string, ab_show as `show` FROM apps_brands WHERE ab_brand = ? LIMIT 1\"\n\tt, err := m.doCacheQuery(q, result.Brand)\n\tif err == nil && t.Show > 0 {\n\t\t// Found one\n\t\tresult.BrandID = t.ID\n\t}\n\tq = \"SELECT ac_id as id, ac_carrier as string , ac_show as `show` FROM apps_carriers WHERE ac_carrier = ? LIMIT 1\"\n\tt, err = m.doCacheQuery(q, result.Carrier)\n\tif err == nil && t.Show > 0 {\n\t\t// Found one\n\t\tresult.CarrierID = t.ID\n\t}\n\n\tq = \"SELECT an_id as id, an_network as string, an_show AS `show` FROM `apps_networks` WHERE `an_network` = ? LIMIT 1;\"\n\tt, err = m.doCacheQuery(q, result.Network)\n\tif err == nil && t.Show > 0 {\n\t\t// Found one\n\t\tresult.NetworkID = t.ID\n\t}\n\treturn &result\n}", "title": "" }, { "docid": "ec76f86aad3a7cf65f2ac2567f495d73", "score": "0.4135417", "text": "func makeFetchers(cfg Config) (map[string]Fetcher, error) {\n\tnewFetcherFuncs := []func(Config) (Fetcher, error){\n\t\tnewElastiCacheFetcher,\n\t\tnewMemoryDBFetcher,\n\t}\n\n\tfetchersByType := make(map[string]Fetcher)\n\tfor _, newFetcherFunc := range newFetcherFuncs {\n\t\tfetcher, err := newFetcherFunc(cfg)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tfetchersByType[fetcher.GetType()] = fetcher\n\t}\n\treturn fetchersByType, nil\n}", "title": "" }, { "docid": "3a50edc4d7cb65daa923c9f9c4466cf6", "score": "0.4133215", "text": "func (RealTimeLoader *LoadAnalyser) workingAverager(dataType *model.DataType, limit *time.Time,\n\twaitGroup *sync.WaitGroup) {\n\tdataTypeName := dataType.Name\n\t// list\tdata\n\trxData, err01 := RealTimeLoader.statisticalData.ListLastDataEntries(dataTypeName, *limit, uint(0))\n\ttxData, err02 := RealTimeLoader.statisticalData.ListLastDataEntries(dataTypeName, *limit, uint(1))\n\tif err01 == nil && err02 == nil {\n\t\t// smooth data\n\t\tsmoothedRxData := RealTimeLoader.smoothingCreator.SmoothData(rxData)\n\t\tsmoothedTxData := RealTimeLoader.smoothingCreator.SmoothData(txData)\n\t\t// compute averages\n\t\trxAverage := averageLoad(smoothedRxData)\n\t\ttxAverage := averageLoad(smoothedTxData)\n\t\t// building of output structures\n\t\tloadIdRx := DisplayTemplate{\n\t\t\tdataTypeId: dataType.ID,\n\t\t\tdataTypeName: dataType.Name,\n\t\t\tdirection: 0,\n\t\t\tprediction: false,\n\t\t}\n\t\tloadIdTx := DisplayTemplate{\n\t\t\tdataTypeId: dataType.ID,\n\t\t\tdataTypeName: dataType.Name,\n\t\t\tdirection: 1,\n\t\t\tprediction: false,\n\t\t}\n\t\t// notify device manager\n\t\tRealTimeLoader.deviceManager.UpdateDisplayByLoad(&loadIdRx, rxAverage)\n\t\tRealTimeLoader.deviceManager.UpdateDisplayByLoad(&loadIdTx, txAverage)\n\t} else if err01 != nil {\n\t\tconfiguration.Error.Panicf(\"An error occurred during fetching of last \" +\n\t\t\t\"statistical entries (RX): %v\", err01)\n\t} else {\n\t\tconfiguration.Error.Panicf(\"An error occurred during fetching of last \" +\n\t\t\t\"statistical entries (TX): %v\", err02)\n\t}\n\twaitGroup.Done()\n}", "title": "" }, { "docid": "d62563898e0e60149fad1eb665dde127", "score": "0.4131444", "text": "func (g Gopher) Data(as interface{}) (service.Response, error) {\n\tt := reflect.TypeOf(as)\n\tswitch {\n\tcase t == reflect.TypeOf(responses.GetGopher{}):\n\t\treturn g.asGetGopher()\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unrecognized response model %T\", as)\n\t}\n}", "title": "" }, { "docid": "83c89e8cd060d138e842820a9da8250d", "score": "0.41283858", "text": "func (s *SpreadCSV) ReadRows(startIndex int, bb interface{}, m map[int]string) error {\n\tif reflect.TypeOf(bb).Elem().Kind() != reflect.Slice {\n\t\tlog.Println(\"nil\")\n\t\treturn nil\n\t}\n\n\ttElm := reflect.TypeOf(bb).Elem().Elem().Elem()\n\n\tvv := reflect.ValueOf(bb).Elem()\n\n\ti := -1\n\tfor {\n\t\ti++\n\t\trecord, err := s.file.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif i < startIndex {\n\t\t\tcontinue\n\t\t}\n\t\tvptr := reflect.New(tElm)\n\t\tfor j, text := range record {\n\t\t\tname := m[j+1]\n\t\t\tif name == \"\" || text == \"\"{\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval := vptr.Elem().FieldByName(name)\n\t\t\tif val.Kind() == reflect.String {\n\t\t\t\tval.SetString(text)\n\t\t\t} else if val.Kind() == reflect.Float64 {\n\t\t\t\tnum, err := strconv.ParseFloat(text, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(fmt.Sprintf(\"Text: %v, i: %v, j: %v\", text, i, j))\n\t\t\t\t}\n\t\t\t\tval.SetFloat(num)\n\t\t\t} else {\n\t\t\t\treturn errors.New(\"type not implemented for parsing yet - contact maintainer or submit PR\")\n\t\t\t}\n\t\t}\n\t\tvv.Set(reflect.Append(vv, vptr))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3db3e42f9626df03e0a098066ae82cf2", "score": "0.4126314", "text": "func (mock *ColumnRepositoryMock) FetchCalls() []struct {\n\tCtx context.Context\n} {\n\tvar calls []struct {\n\t\tCtx context.Context\n\t}\n\tmock.lockFetch.RLock()\n\tcalls = mock.calls.Fetch\n\tmock.lockFetch.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "65d4ae4b4099cb521bb4cd336d2264ed", "score": "0.4125892", "text": "func GetCommentFieldDatasByMailAndEntityType(offset int, limit int, Mail_ string, EntityType_ string) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"mail = ? and entity_type = ?\", Mail_, EntityType_).Limit(limit, offset).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" }, { "docid": "4efc0078db785ba4d6c93712ed11e73c", "score": "0.41229808", "text": "func GetCommentFieldDatasByCommentTypeAndHostname(offset int, limit int, CommentType_ string, Hostname_ string) (*[]*CommentFieldData, error) {\n\tvar _CommentFieldData = new([]*CommentFieldData)\n\terr := Engine.Table(\"comment_field_data\").Where(\"comment_type = ? and hostname = ?\", CommentType_, Hostname_).Limit(limit, offset).Find(_CommentFieldData)\n\treturn _CommentFieldData, err\n}", "title": "" } ]
79babf78976ed59551a1a61032b1d9bd
HasPath returns a boolean if a field has been set.
[ { "docid": "0e130c84f144d8e46f9efe18271a5ac3", "score": "0.75655264", "text": "func (o *HyperflexDriveAllOf) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
[ { "docid": "dbd01bd035d1a29563fbe1d359d609a0", "score": "0.77018464", "text": "func (o *VmAddDevice) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1b4f0d87648a51edc636521e3bdf3013", "score": "0.7684876", "text": "func (o *MicrosoftGraphFileSecurityState) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "80ba325ce126b8d20098d18e10843584", "score": "0.76326096", "text": "func (o *SchemawafRequest) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef79b48963040ce7c123226e6c7f38ca", "score": "0.7568525", "text": "func (o *LogsMetricCompute) HasPath() bool {\n\treturn o != nil && o.Path != nil\n}", "title": "" }, { "docid": "28f195737f8920aba953cfda1924c267", "score": "0.7537565", "text": "func (path *KeyPath) HasPath() bool {\n\treturn path.DerivationPath != \"\"\n}", "title": "" }, { "docid": "2d200f68ca61d2fb49102d3d0f9e3cfb", "score": "0.7535667", "text": "func (o *CreateServerCertificateRequest) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c56cd2f371de13a53ee3616e91d7162", "score": "0.74283934", "text": "func (o *RecoveryAbstractBackupConfigAllOf) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5c5efe98f73cd32dbd23bfb87f7635c9", "score": "0.74263215", "text": "func (o *SecretSearchResult) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cd2f3ba32adb86d5dd7359424c1eb819", "score": "0.74104863", "text": "func (o *CdnCreateScopeRequest) HasPath() bool {\n\tif o != nil && o.Path != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f4d680dfc05076a683890e48d0ee0cde", "score": "0.695725", "text": "func (r MockResolver) HasPath(path string) bool {\n\tfor _, l := range r.locations {\n\t\tif l.RealPath == path {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4261c47b1adc51dc903c409ebc47a26f", "score": "0.6891375", "text": "func (c *Schema) hasFieldPath(fieldPath []string) bool {\n\tif len(fieldPath) == 0 {\n\t\treturn false\n\t}\n\tp := fieldPath[0]\n\n\tfield, hasField := c.Fields[p]\n\tif hasField {\n\t\tif len(fieldPath) == 1 {\n\t\t\treturn true\n\t\t}\n\t\tremaining := fieldPath[1:]\n\n\t\tif field.isArray {\n\t\t\ti := remaining[0]\n\t\t\tif !intRx.MatchString(i) || len(remaining) < 2 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tremaining = remaining[1:]\n\t\t}\n\n\t\tif s := getSchema(field.elementType); s != nil {\n\t\t\treturn s.hasFieldPath(remaining)\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b12a3f765d2bb486d5763d3d031676e6", "score": "0.6725733", "text": "func (o *CustconfAuthUrlSignHmacTlu) HasPathFilter() bool {\n\tif o != nil && o.PathFilter != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "cf082848d2393a0ddbd6be4c60c874a1", "score": "0.67030936", "text": "func (o *CustconfAuthUrlAsymmetricSignTlu) HasPathFilter() bool {\n\tif o != nil && o.PathFilter != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f8c1c39e85272f5936fc670c31e3b7f5", "score": "0.6694148", "text": "func (o *LogsArchiveDestinationS3) HasPath() bool {\n\treturn o != nil && o.Path != nil\n}", "title": "" }, { "docid": "a1424f07dcf28ef4c7748a9e39872fd5", "score": "0.6662311", "text": "func hasPath(data map[string]interface{}, key string) bool {\n\t_, ok := data[key]\n\treturn ok\n}", "title": "" }, { "docid": "bcbedb39cf9dfc192ba72ab057a861cb", "score": "0.6651588", "text": "func (field *Field) HasPointersInPath() bool {\n\tif field.IsPointer {\n\t\treturn true\n\t}\n\n\tif field.parent == nil {\n\t\treturn false\n\t}\n\n\treturn field.parent.HasPointersInPath()\n}", "title": "" }, { "docid": "ae53361bf62a47274832ef8db48330ef", "score": "0.66315866", "text": "func (t JSON) Has(path string) bool {\n\tv, err := t.Value(path)\n\tif err != nil || v == nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "3dab47303b7321738c7e446be5ebcc51", "score": "0.6584581", "text": "func (d Data) PathExists(ctx context.Context, path path.Path) (bool, diag.Diagnostics) {\n\tvar diags diag.Diagnostics\n\n\ttftypesPath, tftypesPathDiags := totftypes.AttributePath(ctx, path)\n\n\tdiags.Append(tftypesPathDiags...)\n\n\tif diags.HasError() {\n\t\treturn false, diags\n\t}\n\n\t_, remaining, err := tftypes.WalkAttributePath(d.TerraformValue, tftypesPath)\n\n\tif err != nil {\n\t\tif errors.Is(err, tftypes.ErrInvalidStep) {\n\t\t\treturn false, diags\n\t\t}\n\n\t\tdiags.AddAttributeError(\n\t\t\tpath,\n\t\t\td.Description.Title()+\" Read Error\",\n\t\t\t\"An unexpected error was encountered trying to read an attribute from the \"+d.Description.String()+\". This is always an error in the provider. Please report the following to the provider developer:\\n\\n\"+\n\t\t\t\tfmt.Sprintf(\"Cannot walk attribute path in %s: %s\", d.Description, err),\n\t\t)\n\t\treturn false, diags\n\t}\n\n\treturn len(remaining.Steps()) == 0, diags\n}", "title": "" }, { "docid": "5b588ec09c140085ce0ee124bc6bb681", "score": "0.65775204", "text": "func (o *HttpPushAction) HasJsonPath() bool {\n\tif o != nil && o.JsonPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7f6cf4c163436317cec6dbf5f6bf0b90", "score": "0.6569809", "text": "func (o *CustconfAuthUrlSignAliCloudA) HasPathFilter() bool {\n\tif o != nil && o.PathFilter != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "90d9c76e55809c7547f72cdb443a9877", "score": "0.6520314", "text": "func (p *Pledge_bw) Has_path( pth *Path ) ( bool ) {\n\tif p == nil || pth == nil {\n\t\treturn false\n\t}\n\n\tfor _, mpth := range p.path_list {\n\t\tif mpth.Same_anchors( pth ) {\t\t\t// match?\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "79adf31887083d4aa40efa6495580b69", "score": "0.6517495", "text": "func (o *UpdateListenerRuleRequest) HasPathPattern() bool {\n\tif o != nil && o.PathPattern.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0e5118dd8a9ff67613d4722eb2aa60da", "score": "0.6451397", "text": "func Has(path string) bool {\n\treturn config.Has(path)\n}", "title": "" }, { "docid": "eaddcea3b1faf34f14f10ff4afe4059a", "score": "0.64361733", "text": "func (o *ListenerRule) HasPathPattern() bool {\n\tif o != nil && o.PathPattern != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1288b66e9ebdb8545efecb62b72bc50c", "score": "0.62620676", "text": "func (o *CdnUpdateSiteScriptRequest) HasPaths() bool {\n\tif o != nil && o.Paths != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bae15c7825f5fbb35bb32f10984b957c", "score": "0.62278825", "text": "func (sop *Provider) PathExists(path string) bool {\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fe98f2b23554d03417a69ef07ae340c3", "score": "0.62040323", "text": "func (o *StorageHitachiRemoteReplication) HasPathGroupId() bool {\n\tif o != nil && o.PathGroupId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f0b9817887cf13b73e60b69bbbe564c6", "score": "0.6200007", "text": "func (s *Set) Has(p Path) bool {\n\tif len(p) == 0 {\n\t\t// No one owns \"the entire object\"\n\t\treturn false\n\t}\n\tfor {\n\t\tif len(p) == 1 {\n\t\t\treturn s.Members.Has(p[0])\n\t\t}\n\t\tvar ok bool\n\t\ts, ok = s.Children.Get(p[0])\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tp = p[1:]\n\t}\n}", "title": "" }, { "docid": "9af07daddd4acec2cd43fcfab0e3dcaf", "score": "0.61869514", "text": "func (o *OpaqueAndExternalWebServiceRule) HasUrlPath() bool {\n\tif o != nil && o.UrlPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b07b216c133c66571ac3a1531eb409f", "score": "0.6153777", "text": "func (hu *HostUtil) PathExists(pathname string) (bool, error) {\n\treturn true, errUnsupported\n}", "title": "" }, { "docid": "cd5f239a61a3e879b75d8495bff4d635", "score": "0.614987", "text": "func (n *Namespace) IsPath() bool {\n\treturn n.NSMode == Path\n}", "title": "" }, { "docid": "af6dea824b2b53389e8c0391e52bb7a4", "score": "0.61215204", "text": "func (config *Config) Has(path string) bool {\n\treturn config.container.ExistsP(path)\n}", "title": "" }, { "docid": "32d5a140b1712c00ff5e1b03f763b57b", "score": "0.6076965", "text": "func (p Path) Exists() bool {\n\t_, err := p.Stat()\n\treturn err == nil\n}", "title": "" }, { "docid": "9a0bdb5c36da444db0d68b44a07bdc96", "score": "0.6069205", "text": "func PathExistenceCheck(ctx context.Context, req *logical.Request, data *framework.FieldData) (bool, error) {\n\tout, err := req.Storage.Get(ctx, req.Path)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"existence check failed: %v\", err)\n\t}\n\n\treturn out != nil, nil\n}", "title": "" }, { "docid": "b45ef3bb441a1575c77139590df9bf02", "score": "0.60443336", "text": "func (md *ModelData) Has(field FieldName) bool {\n\tif _, ok := md.FieldMap.Get(field); ok {\n\t\treturn true\n\t}\n\tif _, ok := md.ToCreate[field.JSON()]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f6644a6fa28a15660f7de7ac7932e522", "score": "0.60327786", "text": "func (m Metadata) HasField(f MetadataField) bool {\n\t_, ok := m[f]\n\treturn ok\n}", "title": "" }, { "docid": "22460684eca0dbf028f8bd4b9f369d30", "score": "0.6011376", "text": "func (c *Controller) HasRoutePath(route string) bool {\n\t// Loop over the routes\n\tfor _, r := range c.Routes {\n\t\t// If the path is equal to the route passed in return true\n\t\tif r.Path == route {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// Otherwise false\n\treturn false\n}", "title": "" }, { "docid": "30e0afa02ec1ad0afb59c165c663ef47", "score": "0.600051", "text": "func (o *QueryResponse) HasQueryLambdaPath() bool {\n\tif o != nil && !IsNil(o.QueryLambdaPath) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "08fe40ccd582b6e0efce771e4cb68064", "score": "0.5972376", "text": "func (v Volumes) Has(path string) bool {\n\t_, ok := v[path]\n\treturn ok\n}", "title": "" }, { "docid": "5f0195278fac60ed12efa9568fed8d57", "score": "0.5968602", "text": "func (f Fields) HasField(name string) (ok bool) {\n\t_, ok = f[name]\n\n\treturn\n}", "title": "" }, { "docid": "6ade438cf3b72fe214890b4274cf44b0", "score": "0.59671026", "text": "func (r *Record) HasField(key string) bool {\n\treturn r.Fields()[key] != nil\n}", "title": "" }, { "docid": "044a3c0670e2b80628dde887a5ce1c70", "score": "0.5961305", "text": "func (s *SearchCodeResult) HasPathMatches() bool {\n\tif s == nil || s.PathMatches == nil {\n\t\treturn false\n\t}\n\n\tif len(s.PathMatches) == 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "75f7021ab6b6bd0d681739c16be1afce", "score": "0.5954176", "text": "func HasPathFunc(pathLine string) bool {\n\n\tfor fname := range pathFuncs {\n\t\tif !strings.HasSuffix(pathLine, fname) {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2803f81816af760daa3c73c6f2fbda8a", "score": "0.59368503", "text": "func isReferenceFieldPath(fieldPath []string) bool {\n\tfield := fieldPath[len(fieldPath)-1]\n\treturn strings.HasSuffix(field, \"Ref\")\n}", "title": "" }, { "docid": "350f4847a64ffe35d324ba4597db166f", "score": "0.59355706", "text": "func (o *V1InstanceVolumeMount) HasMountPath() bool {\n\tif o != nil && o.MountPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c2c828379e8d2d057bf2fc787b5e5fb0", "score": "0.5913615", "text": "func (o *InlineObject850) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8b2dacc7bece2d04b02ce29f4509c025", "score": "0.5896083", "text": "func (ko *Koanf) Exists(path string) bool {\n\t_, ok := ko.keyMap[path]\n\treturn ok\n}", "title": "" }, { "docid": "ee5f36d96e1e540a4d2c03e69d1c5de6", "score": "0.58713174", "text": "func (o *Artifact) HasArtifactStoragePath() bool {\n\tif o != nil && o.ArtifactStoragePath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "468d8d530a6a791f612dfece9a4ee8da", "score": "0.5867983", "text": "func (f *Form) Has(field string) bool {\n\tif strings.TrimSpace(f.Get(field)) != \"\" {\n\t\t\n\t\treturn true\n\t} else {\n\tf.Error.Add(field, \"Please enter required field\")\n\treturn false}\n\t// return (f.Get(field) != \"\")\n}", "title": "" }, { "docid": "64931ef3937b54e18d33601813600f61", "score": "0.57974356", "text": "func (mount *NodeMounter) ExistsPath(pathname string) (bool, error) {\n\t// Check if the global mount path exists and create it if it does not\n\texists := true\n\t_, err := os.Stat(pathname)\n\n\tif _, err := os.Stat(pathname); os.IsNotExist(err) {\n\t\texists = false\n\t}\n\n\treturn exists, err\n}", "title": "" }, { "docid": "23944cdb0c9a98fed0668c1ec0168025", "score": "0.5793773", "text": "func (o *DeviceStatusFilter) HasGroupPaths() bool {\n\tif o != nil && o.GroupPaths != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f49b9a51e29af3455c7c8408d91df960", "score": "0.57937074", "text": "func pathExists(fp string) bool {\n\tl.Debug.Log(\"Does '%v' exist?\", fp)\n\t_, err := os.Stat(fp)\n\tif err != nil {\n\t\tl.Debug.Log(\"No!\")\n\t\treturn false\n\t}\n\tl.Debug.Log(\"Yes!\")\n\treturn true\n}", "title": "" }, { "docid": "32438f20c24528e2e94b9bb50f4462e5", "score": "0.5783146", "text": "func (t *Preprocesser) IsPathNil() bool {\n\tif t == nil || t.Path == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c3f507e7c92db90ad594bb3b27fbdbd9", "score": "0.57798404", "text": "func (p Path) IsValid() bool {\n\treturn isValidPath(p)\n}", "title": "" }, { "docid": "b5f55d62d78710caed16253cf750dfaf", "score": "0.57759386", "text": "func (p *Path) Empty() bool {\n\treturn len(p.d) == 0\n}", "title": "" }, { "docid": "40c9967752eb4f07703ae437ee4d1a30", "score": "0.5770336", "text": "func (b *backend) pathConfigExists(ctx context.Context, req *logical.Request, _ *framework.FieldData) (bool, error) {\n\tentry, err := req.Storage.Get(ctx, \"config\")\n\tif err != nil {\n\t\treturn false, errwrap.Wrapf(\"failed to get configuration from storage: {{err}}\", err)\n\t}\n\tif entry == nil || len(entry.Value) == 0 {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "c6f020f17c2b28f6d3a36da217b147ef", "score": "0.5751745", "text": "func (o *Artifact) HasArtifactSourcePath() bool {\n\tif o != nil && o.ArtifactSourcePath.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0b0dd792ec5ed30957c047322ea561b3", "score": "0.5742191", "text": "func (p Path) IsFullPath() bool {\n\tbucket, filename := p.Split()\n\treturn (bucket != \"\" && filename != \"\")\n}", "title": "" }, { "docid": "76383e2a3302d390eaefb4b0d83e83d0", "score": "0.5735639", "text": "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := r.Form.Get(field)\n\tif x == \"\" {\n\t\tf.Errors.Add(field, \"This field is required\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "26cc3ca3fe8cdb44395c54d929b3cf5f", "score": "0.5731765", "text": "func (m *PermissionMutation) Path() (r string, exists bool) {\n\tv := m._path\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "948bf89edfdef248d2effd39dac2bde0", "score": "0.57182306", "text": "func (m *MetricEndpointMutation) Path() (r string, exists bool) {\n\tv := m._path\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "5e76b157200ef49f64becc685b282af1", "score": "0.5686182", "text": "func PathExists(path string) bool {\n\tif path == \"\" {\n\t\treturn false\n\t}\n\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "973e631f406909d22013ec47d2d06e66", "score": "0.5682522", "text": "func Has(project, branch, version string) bool {\n\tpath := buildsPath(project, branch, version)\n\t_, err := os.Stat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "bcf0305fa665aa23742c3acd59b18240", "score": "0.5677899", "text": "func (tileImpl *TileImpl) IsPathable() bool {\n\t// <<-- Creer-Merge: is-pathable -->>\n\treturn false // TODO: developer add game logic here!\n\t// <<-- /Creer-Merge: is-pathable -->>\n}", "title": "" }, { "docid": "bcf0305fa665aa23742c3acd59b18240", "score": "0.5677899", "text": "func (tileImpl *TileImpl) IsPathable() bool {\n\t// <<-- Creer-Merge: is-pathable -->>\n\treturn false // TODO: developer add game logic here!\n\t// <<-- /Creer-Merge: is-pathable -->>\n}", "title": "" }, { "docid": "c904f822621869f4f812eb7fd832c7c6", "score": "0.56763154", "text": "func (o *EquipmentSystemIoControllerAllOf) HasConnectionPath() bool {\n\tif o != nil && o.ConnectionPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "abc0b72bff28efc5a69fb5f9f78e6475", "score": "0.56647867", "text": "func (f *Field) Path() string { return f.path }", "title": "" }, { "docid": "fb6a8a7d8f4bce826101f41f67fa4739", "score": "0.5657689", "text": "func (p Path) Exists() bool {\n\tabsPath, err := filepath.Abs(string(p))\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t_, err = os.Stat(absPath)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "21c4cb65618185150e30a30a6c6b15f6", "score": "0.56564194", "text": "func (f *FieldDescs) Has(k string) bool {\n\tif f == nil {\n\t\treturn false\n\t}\n\t_, ok := f.m[k]\n\treturn ok\n}", "title": "" }, { "docid": "1b9d1770321ec54bc151f39ccdd882e5", "score": "0.564003", "text": "func PathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a86e2d3dcc83c6f06ac1ecca27cfb368", "score": "0.56315637", "text": "func PathExists(path string) bool {\n\tif st, err := os.Stat(path); err == nil && st != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "790440ac328a3be895b5d6c506abbfed", "score": "0.561975", "text": "func (x *fastReflection_PartSetHeader) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"tendermint.types.PartSetHeader.total\":\n\t\treturn x.Total != uint32(0)\n\tcase \"tendermint.types.PartSetHeader.hash\":\n\t\treturn len(x.Hash) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.PartSetHeader\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.PartSetHeader does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "9673a9ecb189c3a1e3aa9a81518785ad", "score": "0.560675", "text": "func (f *File) Has() (bool, error) {\n\t// Validate key\n\tif f.Key == \"\" {\n\t\treturn false, fmt.Errorf(\"'key' must not be nil\")\n\t}\n\n\tfile, err := os.Stat(f.path)\n\n\tif os.IsNotExist(err) {\n\t\treturn false, fmt.Errorf(\"Cache doesn't exists\")\n\t}\n\tisDir := !file.IsDir()\n\n\t// If file does not exists, if it's a directory\n\tif isDir {\n\t\treturn false, fmt.Errorf(\"Cache file doesn't exists\")\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "e0fed0d752640aff91a70339260ef656", "score": "0.5605198", "text": "func (x *fastReflection_Part) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"tendermint.types.Part.index\":\n\t\treturn x.Index != uint32(0)\n\tcase \"tendermint.types.Part.bytes\":\n\t\treturn len(x.Bytes) != 0\n\tcase \"tendermint.types.Part.proof\":\n\t\treturn x.Proof != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.Part\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.Part does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "7da0616326d1fb95df0c0205158ee36b", "score": "0.5603777", "text": "func (g GoPath) IsEmpty() bool {\n\treturn g.path == \"\"\n}", "title": "" }, { "docid": "d4de59d7e2cc15f2c16b36662047c72b", "score": "0.55878645", "text": "func (rtr *router) HasRoute(path string) bool {\n\treturn rtr.routes[path] != nil\n}", "title": "" }, { "docid": "27ba6e3d989fe00a915f74721051f922", "score": "0.5581721", "text": "func (o *MicrosoftGraphDriveItem) HasFile() bool {\n\tif o != nil && o.File != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "880a96a606b840a50973373ea93f96d8", "score": "0.55703163", "text": "func (p *Properties) Has(key string) bool {\n\treturn p.s.Has(key)\n}", "title": "" }, { "docid": "6af3c4513c659334bafc29a7a5fb59c7", "score": "0.5570026", "text": "func (r *Record) HasField(field string) (bool, error) {\n\tif !isValidID(field) {\n\t\treturn false, fmt.Errorf(\"invalid field %s\", field)\n\t}\n\t_, ok := r.fields[field]\n\treturn ok, nil\n}", "title": "" }, { "docid": "effaaf470504755fe89d5fe9b4f1d5c8", "score": "0.55692065", "text": "func (c Config) IsSet(path ...string) (ok bool) {\n\tif len(path) == 1 {\n\t\tpath = strings.Split(path[0], \".\")\n\t}\n\treturn search(c.data, path) != nil\n}", "title": "" }, { "docid": "79c8eba42b76f4b3550b49a51a45f830", "score": "0.5568659", "text": "func (path *KeyPath) IsHashPath() bool {\n\treturn strings.HasPrefix(path.DerivationPath, \"x/\")\n}", "title": "" }, { "docid": "94059c679398885901bbeaf55ec600d8", "score": "0.55603164", "text": "func (f *Field) IsExported() bool {\r\n\treturn f.field.PkgPath == \"\"\r\n}", "title": "" }, { "docid": "e5b553f622b89c1227f67bec91b000ad", "score": "0.5555757", "text": "func (m *Model) HasField(field string) (bool, error) {\n\ttableFields, err := m.db.TableFields(m.tables)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif len(tableFields) == 0 {\n\t\treturn false, fmt.Errorf(`empty table fields for table \"%s\"`, m.tables)\n\t}\n\tfieldsArray := make([]string, len(tableFields))\n\tfor k, v := range tableFields {\n\t\tfieldsArray[v.Index] = k\n\t}\n\tfor _, f := range fieldsArray {\n\t\tif f == field {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "a837635794f21019fd984be611c79a2b", "score": "0.55524635", "text": "func pathContains(hr *entities.HttpRequest, cond interface{}) bool {\n\tif strings.Contains(hr.Path, cond.(string)) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "19fa95ebd5d488c5a54fa5364ce4e0b7", "score": "0.5552429", "text": "func HasField(t reflect.Type, n string) bool {\n\tif t.Kind() != reflect.Struct {\n\t\tpanic(\"task args must be a struct\")\n\t}\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tif strings.ToLower(t.Field(i).Name) == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d1491da719be02c2b0220787a4dffa18", "score": "0.5547206", "text": "func (p Path) Empty() bool {\n\treturn len(string(p)) == 0\n}", "title": "" }, { "docid": "d28cf811da642a61504029107d6f13d6", "score": "0.5541647", "text": "func (x *fastReflection_ModuleSchemaDescriptor_FileEntry) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry.id\":\n\t\treturn x.Id != uint32(0)\n\tcase \"cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry.proto_file_name\":\n\t\treturn x.ProtoFileName != \"\"\n\tcase \"cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry.storage_type\":\n\t\treturn x.StorageType != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "932fcb40a7c74d1160558b6d95e82328", "score": "0.5526674", "text": "func PathExists(path string) bool {\n\t_, err := os.Lstat(path)\n\treturn err == nil\n}", "title": "" }, { "docid": "33172ad25d5161a22074ded05bbb695e", "score": "0.55262804", "text": "func PathExists(path string) bool {\n\tif _, err := os.Stat(path); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false\n\t\t} else {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "bc71ee04737c542c277e87b1d4b512be", "score": "0.55193096", "text": "func (x *fastReflection_Snapshot) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.base.snapshots.v1beta1.Snapshot.height\":\n\t\treturn x.Height != uint64(0)\n\tcase \"cosmos.base.snapshots.v1beta1.Snapshot.format\":\n\t\treturn x.Format != uint32(0)\n\tcase \"cosmos.base.snapshots.v1beta1.Snapshot.chunks\":\n\t\treturn x.Chunks != uint32(0)\n\tcase \"cosmos.base.snapshots.v1beta1.Snapshot.hash\":\n\t\treturn len(x.Hash) != 0\n\tcase \"cosmos.base.snapshots.v1beta1.Snapshot.metadata\":\n\t\treturn x.Metadata != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.base.snapshots.v1beta1.Snapshot\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.base.snapshots.v1beta1.Snapshot does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "4f84f5cc4c32ddb7315dd1bbde800ebd", "score": "0.55110353", "text": "func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.slashing.v1beta1.QueryParamsResponse.params\":\n\t\treturn x.Params != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.slashing.v1beta1.QueryParamsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.slashing.v1beta1.QueryParamsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "de869d67751e94605db43eda349c5192", "score": "0.5508978", "text": "func (o *MicrosoftGraphDriveItem) HasFileSystemInfo() bool {\n\tif o != nil && o.FileSystemInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "98729095a8dc5dcd0b06976a21287377", "score": "0.55088025", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d4380524729c1ffadf3e61792d7d270e", "score": "0.5489527", "text": "func (m *Mem) Exists(ctx context.Context, path string) (bool, error) {\n\t_, ok := m.values[Path(path)]\n\treturn ok, nil\n}", "title": "" }, { "docid": "50ca1bb522f48fbe96169facae08d000", "score": "0.5474824", "text": "func (fb *FileBase) Exists(subPath string) (bool, error) {\n\tnpath, err := fb.FullPath(subPath)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif _, err := os.Stat(npath); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\t// stat should never fail\n\t\tlogger.Fatalf(\"stat failed: %v\", err)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "c3b52f7e0cdea173d31ba7886e03bfdb", "score": "0.5473071", "text": "func PathExists(path string) bool {\n\t_, err := os.Stat(path)\n\n\treturn nil == err\n}", "title": "" }, { "docid": "26f6cba79ff12b14cebc9d64b4e1660d", "score": "0.5463626", "text": "func PathExists(filePath string) bool {\n\t_, err := os.Stat(filePath)\n\treturn err == nil\n}", "title": "" }, { "docid": "39d3778c5bb9ef27e202e8c22c34c45e", "score": "0.5463054", "text": "func pathExists(path string) bool {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "35f527f1cfbfe85bee75479e198ad60c", "score": "0.5459976", "text": "func (x *fastReflection_ModuleSchemaDescriptor) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.orm.v1alpha1.ModuleSchemaDescriptor.schema_file\":\n\t\treturn len(x.SchemaFile) != 0\n\tcase \"cosmos.orm.v1alpha1.ModuleSchemaDescriptor.prefix\":\n\t\treturn len(x.Prefix) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.ModuleSchemaDescriptor\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.orm.v1alpha1.ModuleSchemaDescriptor does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" }, { "docid": "86ed530a22eddf47cfa978adba567480", "score": "0.5452755", "text": "func (x *fastReflection_QuerySigningInfoRequest) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.slashing.v1beta1.QuerySigningInfoRequest.cons_address\":\n\t\treturn x.ConsAddress != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.slashing.v1beta1.QuerySigningInfoRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.slashing.v1beta1.QuerySigningInfoRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "title": "" } ]
0eb05532d7e87fcdb13ab211c881e8cb
HasGrab is a wrapper around gtk_widget_has_grab().
[ { "docid": "597e389931b61c3bb8a39e4647bea89a", "score": "0.9061477", "text": "func (v *Widget) HasGrab() bool {\n\tc := C.gtk_widget_has_grab(v.native())\n\treturn gobool(c)\n}", "title": "" } ]
[ { "docid": "f8ffa1e231245c4083d34bbc89fdb85d", "score": "0.7397439", "text": "func (d *Device) Grab() bool {\n\treturn ioctl(d.fd.Fd(), _EVIOCGRAB, 1) == nil\n}", "title": "" }, { "docid": "c5eee80d7f376d92a7f3d2925e8f1d90", "score": "0.56533957", "text": "func (v *Widget) GetHasWindow() bool {\n\tc := C.gtk_widget_get_has_window(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "5ee7b16a624d4ad72387dafc7e2813ca", "score": "0.558391", "text": "func (v *Widget) GrabDefault() {\n\tC.gtk_widget_grab_default(v.native())\n}", "title": "" }, { "docid": "240d01d48e1efb96bb21d8888f3688ed", "score": "0.5519025", "text": "func (v *Widget) HasFocus() bool {\n\tc := C.gtk_widget_has_focus(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "7261dc98062534d244c273b22bcf2ff3", "score": "0.5499832", "text": "func (p *Popup) Grab(seat *wl.Seat, serial uint32) error {\n\treturn p.Context().SendRequest(p, 1, seat, serial)\n}", "title": "" }, { "docid": "3504ff8265bf433fb82f0c1cf46ea586", "score": "0.5417041", "text": "func (w *Widget) GrabFocus() {\n\tw.Candy().Guify(\"gtk_widget_grab_focus\", w)\n}", "title": "" }, { "docid": "a8530c090fdeac3af066d3867cba8572", "score": "0.5338305", "text": "func (v *Widget) HasDefault() bool {\n\tc := C.gtk_widget_has_default(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "a824fd5c53f8dc3df2d4aa7d32931291", "score": "0.5231738", "text": "func (v *Widget) GetMapped() bool {\n\tc := C.gtk_widget_get_mapped(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "1ae28511fab26b30099f44a9445c184b", "score": "0.5206488", "text": "func (v *Widget) GrabFocus() {\n\tC.gtk_widget_grab_focus(v.native())\n}", "title": "" }, { "docid": "25aa3f0f490ce585f49d147c9a592013", "score": "0.51648813", "text": "func (eng *snapEngine) HasFocus() bool {\n\treturn eng.isHasFocus\n}", "title": "" }, { "docid": "cb261750c8daa164dc01d249c760913e", "score": "0.51641196", "text": "func (v *GLArea) HasStencilBuffer() bool {\n\treturn gobool(C.gtk_gl_area_get_has_stencil_buffer(v.native()))\n}", "title": "" }, { "docid": "ae070cdae83ff9704a6829eda5259387", "score": "0.51241666", "text": "func (v *GLArea) HasDepthBuffer() bool {\n\treturn gobool(C.gtk_gl_area_get_has_depth_buffer(v.native()))\n}", "title": "" }, { "docid": "32ade22121acaa5e3a4f66b3d0efd9b3", "score": "0.51099896", "text": "func IsMouseButtonReleased(button int32) bool {\n\tcbutton, _ := (C.int)(button), cgoAllocsUnknown\n\t__ret := C.IsMouseButtonReleased(cbutton)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "a5c9d4b8fca9e151bd2b13c3b11646ae", "score": "0.50544155", "text": "func UlOverlayHasFocus(overlay ULOverlay) bool {\n\tcoverlay, _ := *(*C.ULOverlay)(unsafe.Pointer(&overlay)), cgoAllocsUnknown\n\t__ret := C.ulOverlayHasFocus(coverlay)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "77835308510b973712f32ddcbf208565", "score": "0.5033888", "text": "func HasScreenshots() (bool, error) {\n\tpaths, err := screenshotPaths()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn len(paths) > 0, nil\n}", "title": "" }, { "docid": "d7b3f2b2b12cea527831be03609d0cbd", "score": "0.5027213", "text": "func (b *Box) HasFocus() bool {\n\tb.l.RLock()\n\tdefer b.l.RUnlock()\n\n\treturn b.hasFocus\n}", "title": "" }, { "docid": "7a8a0eacbdd2094fa7c4015ade83284a", "score": "0.50249994", "text": "func HasDriver() bool {\n\treturn hasDriver\n}", "title": "" }, { "docid": "f1785c650155b09f7770a86bce8bea7b", "score": "0.4998385", "text": "func (this *RenderWindow) HasFocus() bool {\n\treturn sfBool2Go(C.sfRenderWindow_hasFocus(this.cptr))\n}", "title": "" }, { "docid": "b34ca82a51cab6cf1c580202f89a9dd1", "score": "0.49931666", "text": "func (ol *Overlay) HasFocus() bool {\n\treturn bool(C.ulOverlayHasFocus(ol.o))\n}", "title": "" }, { "docid": "2b7324bb32f7ef02bc74cbc99f03c076", "score": "0.49637234", "text": "func (v *Widget) HasVisibleFocus() bool {\n\tc := C.gtk_widget_has_visible_focus(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "bd6dbf82c711b9e70f0df704bc8ced83", "score": "0.4935779", "text": "func (o *AndroidWorkProfileGeneralDeviceConfiguration) HasWorkProfileBlockScreenCapture() bool {\n\tif o != nil && o.WorkProfileBlockScreenCapture != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "992240117f922af10b9d18846589a9d1", "score": "0.493338", "text": "func IsMouseButtonUp(button int32) bool {\n\tcbutton, _ := (C.int)(button), cgoAllocsUnknown\n\t__ret := C.IsMouseButtonUp(cbutton)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "d90ff92e1c8d2d19e15e0f2539cf06f4", "score": "0.4919187", "text": "func (g *NodeBase) HasFocus() bool {\n\treturn bitflag.Has(g.Flag, int(HasFocus))\n}", "title": "" }, { "docid": "d4b87444e461403c2715038eaf4c9e13", "score": "0.49089944", "text": "func (d *Device) Release() bool {\n\treturn ioctl(d.fd.Fd(), _EVIOCGRAB, 0) == nil\n}", "title": "" }, { "docid": "f4f9c4b4f044d72fb9e61be8acb892b9", "score": "0.49069244", "text": "func (o *MonitorSummaryWidgetDefinition) HasShowLastTriggered() bool {\n\tif o != nil && o.ShowLastTriggered != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "25d7bd10677122927b62602583b24fe6", "score": "0.49000168", "text": "func (v *Widget) Event(event *gdk.Event) bool {\n\tc := C.gtk_widget_event(v.native(), (*C.GdkEvent)(event.Native()))\n\treturn gobool(c)\n}", "title": "" }, { "docid": "156306e0dc1a8096095b0f55613ac50f", "score": "0.48891637", "text": "func parseGrabOp(o interface{}) (bool, string) {\n\tif o != nil && reflect.TypeOf(o).Kind() == reflect.String {\n\t\tre := regexp.MustCompile(`^\\Q((\\E\\s*grab\\s+(.+)\\s*\\Q))\\E$`)\n\t\tif re.MatchString(o.(string)) {\n\t\t\tkeys := re.FindStringSubmatch(o.(string))\n\t\t\treturn true, keys[1]\n\t\t}\n\t}\n\treturn false, \"\"\n}", "title": "" }, { "docid": "36eaa192fc584ab10f8567e08b5849f5", "score": "0.4886418", "text": "func (i *i) RequiresCapture() bool {\n\treturn i.S.S == requirescapture\n}", "title": "" }, { "docid": "e8d3745bfdc66f27344defbedff65b8c", "score": "0.48688036", "text": "func (wm *WindowManager) HasFocus() bool {\n\twm.RLock()\n\tdefer wm.RUnlock()\n\n\tfor _, w := range wm.windows {\n\t\tif w.HasFocus() {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e22e88fb9c22976ed7a57f0eb4b36859", "score": "0.4865802", "text": "func IsMouseButtonDown(button int32) bool {\n\tcbutton, _ := (C.int)(button), cgoAllocsUnknown\n\t__ret := C.IsMouseButtonDown(cbutton)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "bd145c48da168ecdeb403115a2145544", "score": "0.48499757", "text": "func (probe HgProbe) IsAvailable() (bool, error) {\n\treturn commandExists(\"hg\"), nil\n}", "title": "" }, { "docid": "7f92d5c004b768f5916eb9eaf4433122", "score": "0.48458594", "text": "func (o *FirmwareBaseDistributableAllOf) HasRelease() bool {\n\tif o != nil && o.Release != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "52e59503ff95c0dde234767d7253efc2", "score": "0.48226646", "text": "func (window *Window) IsShaped() (retval bool) {\n retval = C.SDL_TRUE==(C.SDL_IsShapedWindow((*C.SDL_Window)(window)))\n return\n}", "title": "" }, { "docid": "6f1e854a46ce8546bbb7eef7ca2e56b2", "score": "0.4822615", "text": "func (o *LaunchpadButton) HasBitlink() bool {\n\tif o != nil && o.Bitlink != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1fbeb555781cab77592e7829b15b3371", "score": "0.4807939", "text": "func (tg *Tag) NeedsPull() bool {\n\tif tg.state == \"ABSENT\" || tg.state == \"CHANGED\" {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "da937175be3b23e8b2feef255b4c14a4", "score": "0.48058844", "text": "func (rect *Rectangle) HasHitScreenBorder(scr terminal.Screen) (any, top, bottom, left, right bool) {\n\tscrWidth, scrHeight := scr.Size()\n\ttop = rect.TopLeftCorner.Y <= 1\n\tbottom = rect.TopLeftCorner.Y+rect.Height >= scrHeight\n\tleft = rect.TopLeftCorner.X <= 1\n\tright = rect.TopLeftCorner.X+(rect.Width*2) >= scrWidth\n\treturn (top || bottom || left || right), top, bottom, left, right\n}", "title": "" }, { "docid": "368ae18df5513054b527f9054bfc7825", "score": "0.47937047", "text": "func (o *ImageWidgetDefinition) HasSizing() bool {\n\tif o != nil && o.Sizing != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "368ae18df5513054b527f9054bfc7825", "score": "0.47937047", "text": "func (o *ImageWidgetDefinition) HasSizing() bool {\n\tif o != nil && o.Sizing != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6cca55042f57994190b93d288839359f", "score": "0.47928566", "text": "func (g *NodeBase) IsDragging() bool {\n\treturn bitflag.Has(g.Flag, int(NodeDragging))\n}", "title": "" }, { "docid": "d389bde3b281f03deeef01b3ef2c16bd", "score": "0.4742468", "text": "func (o *SnapshotInfoType) Busy() bool {\n\tvar r bool\n\tif o.BusyPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.BusyPtr\n\treturn r\n}", "title": "" }, { "docid": "6e03a2421e8b8969b98f007ac9ed3cb3", "score": "0.47421876", "text": "func (o *ImageWidgetDefinition) HasHasBorder() bool {\n\tif o != nil && o.HasBorder != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a7de73dc330ae95400e49f28a2951d57", "score": "0.47364286", "text": "func (o *ImageWidgetDefinition) HasHasBackground() bool {\n\tif o != nil && o.HasBackground != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "917a690a6b9ee9d0e3d26329a2c276d5", "score": "0.4733126", "text": "func (d *Device) ScanInputGrabbed(ctx context.Context) error {\n\t// other programs won't receive input while we have this file handle open\n\tif err := d.Grab(); err != nil {\n\t\treturn err\n\t}\n\n\treturn d.ScanInput(ctx)\n}", "title": "" }, { "docid": "8d3210b99d04e41a6f3eb8528619f0a1", "score": "0.4711563", "text": "func WgToolIsExisted() bool {\n\twhichCmd := exec.Command(\"which\", \"wg\")\n\n\terr := whichCmd.Run()\n\n\treturn err == nil\n}", "title": "" }, { "docid": "7f408964d4654cf246bff38c65005ae2", "score": "0.47018138", "text": "func (b *binding) IsScreenOn(ctx context.Context) (bool, error) {\n\tres, err := b.Shell(\"dumpsys\", \"power\").Call(ctx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tswitch displayOnRegex.FindString(res) {\n\tcase \"Display Power: state=ON\":\n\t\tswitch displayReadyRegex.FindString(res) {\n\t\tcase \"mDisplayReady=true\":\n\t\t\treturn true, nil\n\t\tcase \"mDisplayReady=false\":\n\t\t\treturn false, nil\n\t\t}\n\tcase \"Display Power: state=DOZE\":\n\t\treturn false, nil\n\tcase \"Display Power: state=OFF\":\n\t\treturn false, nil\n\t}\n\treturn false, log.Err(ctx, ErrScreenOnState, \"\")\n}", "title": "" }, { "docid": "1b46c468b83c63e1ea4177d2237a5680", "score": "0.46780568", "text": "func (c Chip8) NeedDraw() bool {\n\treturn c.draw\n}", "title": "" }, { "docid": "7fcee6088bb0074d9e4733116ee5a644", "score": "0.46714476", "text": "func HasCapSetGID() bool {\n\tpc := cap.GetProc()\n\tsetgid, _ := pc.GetFlag(cap.Effective, cap.SETGID)\n\treturn setgid\n}", "title": "" }, { "docid": "2df58c498e8221a6ce6909d38f26fbfa", "score": "0.4665066", "text": "func IsScreenSaverOn() (bool, error) {\n\tout, err := exec.Command(\"gnome-screensaver-command\", \"--query\").Output()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn parseScreenSaver(string(out))\n}", "title": "" }, { "docid": "568bd266286296e0b3fad19c357f17b9", "score": "0.4660807", "text": "func (d Display) IsTouchAvailable() bool {\n\treturn *d.o.TouchSupport == \"available\"\n}", "title": "" }, { "docid": "291bda4edf276edffb33b0f778449e4a", "score": "0.46476582", "text": "func (u *BasicUIElement) Contains(x, y float64) bool {\n\treturn u.BasicObject.Contains(x, y)\n}", "title": "" }, { "docid": "da3e47f585184faf20e6ac198d56eee4", "score": "0.46432066", "text": "func HasDocker() bool {\n\twhereDocker, err := Which(\"docker\")\n\n\tif len(whereDocker) == 0 && err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "826aea14f5499b3b3ed540c32f2e8724", "score": "0.4634195", "text": "func (r *AuthInternalSignup) HasHandle() bool {\n\treturn r.hasHandle\n}", "title": "" }, { "docid": "5a00f4b83183be45ab4a12aad654fe45", "score": "0.46257666", "text": "func (key KeyState) JustReleased() bool {\n\treturn (key.lastState && !key.currentState)\n}", "title": "" }, { "docid": "824c25b2e7317628ae71cfa15267c037", "score": "0.46231213", "text": "func (it *Imterm) CheckClick(x, y, w, h int) MouseButton {\n\tif it.curState.mouseButton != 0 {\n\t\tif it.curState.mouseX >= x && it.curState.mouseX < x+w &&\n\t\t\tit.curState.mouseY >= y && it.curState.mouseY < y+h {\n\t\t\treturn it.curState.mouseButton\n\t\t}\n\t}\n\treturn MouseNone\n}", "title": "" }, { "docid": "4b05bcf412878a3ff9f5ce1f61ed6f91", "score": "0.4607343", "text": "func (gui *GUI) OnMouseButtonPress(leftPressed, rightPressed bool) bool {\n\tstatus := nk.NkWindowIsAnyHovered(gui.ctx)\n\treturn status == 1\n}", "title": "" }, { "docid": "ef292459ac7bc7d0e627287ad7dfd46c", "score": "0.46067733", "text": "func (v *Widget) GetVisible() bool {\n\tc := C.gtk_widget_get_visible(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "d85f6b9098e416fb4d53e0dea65c3c78", "score": "0.46061844", "text": "func (r *AllocationBitmap) Has(offset int) bool {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\treturn r.allocated.Bit(offset) == 1\n}", "title": "" }, { "docid": "53354afdd743320fd6b20c3dafdc17e1", "score": "0.4599405", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) HasScreenCaptureBlocked() bool {\n\tif o != nil && o.ScreenCaptureBlocked != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9dda3132363a90539c1374c0067bb0d8", "score": "0.45926422", "text": "func (o *Release) HasRunning() bool {\n\tif o != nil && o.Running != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d8e160a00218a438ca6186ef58d5683b", "score": "0.45813817", "text": "func (v *Widget) IsDrawable() bool {\n\tc := C.gtk_widget_is_drawable(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "c5c7d3b47518cc61965c5b9b17baf2dc", "score": "0.45771918", "text": "func (w Window) IsOpen() bool {\n\treturn w.start == nil || w.end == nil\n}", "title": "" }, { "docid": "cc4853958aaeda8cd91296ad5d3c4eb3", "score": "0.45598158", "text": "func HasInvocation() bool {\n\treturn *runnerInvocationFlag != \"\"\n}", "title": "" }, { "docid": "d5046727b027b5b7b55abf7a4594ff35", "score": "0.45589173", "text": "func (g *NodeBase) GrabFocus() {\n\twin := g.ParentWindow()\n\tif win != nil {\n\t\twin.SetFocusItem(g.This)\n\t}\n}", "title": "" }, { "docid": "38ca8016c94856ad88d4a1d6138767eb", "score": "0.45534608", "text": "func (v *Widget) GetRealized() bool {\n\tc := C.gtk_widget_get_realized(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "dca27ada450b0ba6c384b4634d36aa05", "score": "0.454251", "text": "func (*DUTUname) IsGvisor() bool {\n\treturn !Native\n}", "title": "" }, { "docid": "a8a60c46c56790d721321803ef980c15", "score": "0.4540354", "text": "func isScreenLocked() (bool, error) {\n\t// Do this command:\n\t// gnome-screensaver-command -q | grep \"is active\"\n\tcmd := exec.Command(\"gnome-screensaver-command\", \"-q\")\n\tvar (\n\t\tout bytes.Buffer\n\t\toutErr bytes.Buffer\n\t)\n\tcmd.Stdout = &out\n\tcmd.Stderr = &outErr\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"%w: %v\", err, outErr.String())\n\t}\n\tif !strings.Contains(out.String(), \"is active\") {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "e57c486ee37d34a09ba536a9f8d07147", "score": "0.45269692", "text": "func (g *GifPlayer) Ready(gtx C) bool {\n\tvar (\n\t\tnow = gtx.Now\n\t\tsince = g.since\n\t\tlatency = time.Second / time.Duration(g.FPS)\n\t)\n\treturn now.Sub(since).Milliseconds() >= latency.Milliseconds()\n}", "title": "" }, { "docid": "b8a33539e8168a6cff993bb77917ea87", "score": "0.45241117", "text": "func (window *Window) InFocus() bool {\n\n\treturn window.focused\n}", "title": "" }, { "docid": "5223cc9be06ed5b9cfeb53f087731db1", "score": "0.4523059", "text": "func (p *PromptSet) Has(flag PromptSet) bool {\n\treturn (*p)&flag != 0\n}", "title": "" }, { "docid": "b5d0ec8e0320e65e2bbb71de79845226", "score": "0.45172974", "text": "func (o *Release) HasThroughput() bool {\n\tif o != nil && o.Throughput != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "2c226be87fcc1962bb897541fcd0c5e5", "score": "0.45157266", "text": "func (o *MicrosoftGraphWindowsPhone81GeneralConfiguration) HasScreenCaptureBlocked() bool {\n\tif o != nil && o.ScreenCaptureBlocked != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f3f1dd318f2807da24c7c94f75f241c5", "score": "0.45135176", "text": "func (status PageStatus) IsWaitScreen() bool {\n\treturn strings.Contains(string(status), \"W8_\")\n}", "title": "" }, { "docid": "df10c54fcd38fd7d1d8e125cee2a1d4b", "score": "0.45134786", "text": "func (h Hook) HasCommand() bool {\n\treturn h.Command != nil && *h.Command != \"\"\n}", "title": "" }, { "docid": "926f25e20a73ad625ee136328a5ba996", "score": "0.4512761", "text": "func (t *Tree) Has(b gfx.Boundable) bool {\n\tt.RLock()\n\t_, ok := t.nodeByObject[b]\n\tt.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "21c4d9d4e16c8381eae3721c483bbe08", "score": "0.45082754", "text": "func HasScreen() predicate.Event {\n\treturn predicate.Event(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ScreenTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, ScreenTable, ScreenColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "8ff8b724edd95fa1aa7367064dad3bdc", "score": "0.4507428", "text": "func IsWindowReady() bool {\n\t__ret := C.IsWindowReady()\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "b12f06d11277eec80e7b1d744b8d66ad", "score": "0.44998997", "text": "func (o *ComputeBoard) HasComputeBlade() bool {\n\tif o != nil && o.ComputeBlade != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a2a44605a0b36f5de2746463c032b8d4", "score": "0.44992998", "text": "func (o *Retro) HasRefNum() bool {\n\tif o != nil && o.RefNum != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "33987f5944ecbe98ee4df2925deffb78", "score": "0.44978404", "text": "func (v *Widget) Activate() bool {\n\treturn gobool(C.gtk_widget_activate(v.native()))\n}", "title": "" }, { "docid": "818cf4339eeb2e714fb0f1bce36d573b", "score": "0.4496002", "text": "func (q blockQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "dec07b65f0a1c4a800dbc2a6d8adcb53", "score": "0.44923264", "text": "func (o *Compartimento) HasRefGvm() bool {\n\tif o != nil && o.RefGvm.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "28a9c2c5e7d5a9126d94dc604ab7d181", "score": "0.44879198", "text": "func (bb *BottomBar) OnClick(evt *sdl.MouseButtonEvent) bool {\n\treturn true\n}", "title": "" }, { "docid": "feefe5d10fc1e95bda49bd5712257bb5", "score": "0.44831467", "text": "func (o *consumer) checkWaitingForInterest() bool {\n\to.processWaiting(true)\n\treturn o.waiting.len() > 0\n}", "title": "" }, { "docid": "40d59177788a1efca53bf9ad78f8af70", "score": "0.4481374", "text": "func (o *MicrosoftGraphAndroidGeneralDeviceConfiguration) HasWebBrowserBlockAutofill() bool {\n\tif o != nil && o.WebBrowserBlockAutofill != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7f70cfaed9c24be0f404478c7db20e3e", "score": "0.44777644", "text": "func TestTrapHasPassed() bool {\n\tretC := C.g_test_trap_has_passed()\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "ed3e45cde29b2cf011feec6af5c32405", "score": "0.447702", "text": "func (v *Widget) GetCanFocus() bool {\n\tc := C.gtk_widget_get_can_focus(v.native())\n\treturn gobool(c)\n}", "title": "" }, { "docid": "556e4ad921ba619e98c8935551874973", "score": "0.44761404", "text": "func (o *ChangeWidgetRequest) HasShowPresent() bool {\n\tif o != nil && o.ShowPresent != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b31b758e430bea951f76aac07cdf0839", "score": "0.44758543", "text": "func (o *Tarefa) HasRefGvm() bool {\n\tif o != nil && o.RefGvm.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1d2c86a77942beb3a2897895afb790c3", "score": "0.44563273", "text": "func HasHigherDrawVal(b1, b2 o.Block) bool {\n\tfinalLock.RLock()\n\tdefer finalLock.RUnlock()\n\tfd := finalData[getFinalDataIndex(b1.Slot)]\n\n\tdraw1 := calculateDrawValue(b1.Slot, b1.Draw, fd.leadershipNonce)\n\tdraw2 := calculateDrawValue(b2.Slot, b2.Draw, fd.leadershipNonce)\n\tif draw2.Cmp(draw1) == -1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d55b4543abc19aeb5bbc27ec9c533af7", "score": "0.44559175", "text": "func (v *GLArea) GetAutoRender() bool {\n\treturn gobool(C.gtk_gl_area_get_auto_render(v.native()))\n}", "title": "" }, { "docid": "a7e0beaf3456585a38cd1e32cf473efe", "score": "0.44554663", "text": "func (obj *BaseObject) HasAttr(name Object) bool {\n\tret := C.PyObject_HasAttr(c(obj), c(name))\n\tif ret == 1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a57d22912e0c9c6d43bb6d68b3ea7338", "score": "0.44549957", "text": "func (v *Widget) IsFocus() bool {\n\treturn gobool(C.gtk_widget_is_focus(v.native()))\n}", "title": "" }, { "docid": "9800e17151a76c094a920563aec151fe", "score": "0.44532517", "text": "func (q blockQuery) ExistsGP() bool {\n\te, err := q.Exists(boil.GetDB())\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "c7b515d0d6fdb69d76a4c317c1933d21", "score": "0.44514826", "text": "func (p *Player) IsShooting() bool {\n\treturn p.window.Pressed(pixelgl.KeySpace)\n}", "title": "" }, { "docid": "f08edfec600535aab12209d4f29fd2ef", "score": "0.44463295", "text": "func readyToReturnTestKnob(stopC chan struct{}, pos string) bool {\n\tif stopC == nil {\n\t\treturn false\n\t}\n\tselect {\n\tcase <-stopC:\n\t\tplog.Infof(\"test knob set, returning early before %s\", pos)\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "0b50ed32bfd180187f07b65fed969504", "score": "0.4439489", "text": "func (o *ScrubOperationRequest) HasDisableSnapshot() bool {\n\tif o != nil && o.DisableSnapshot != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4793b8a4a7ff602336323c052f6ca624", "score": "0.4431922", "text": "func Present() bool {\n\treturn black.Present() || green.Present()\n}", "title": "" }, { "docid": "1822fb5bad658f5a469dee407a43ba58", "score": "0.44304046", "text": "func UlViewGetNeedsPaint(view ULView) bool {\n\tcview, _ := *(*C.ULView)(unsafe.Pointer(&view)), cgoAllocsUnknown\n\t__ret := C.ulViewGetNeedsPaint(cview)\n\t__v := (bool)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "e123b9023b9a5401a5e67f514f09cad4", "score": "0.44296452", "text": "func (o *MonitorSummaryWidgetDefinition) HasStart() bool {\n\tif o != nil && o.Start != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8a82d560802f4025819470f6550d7916", "score": "0.44270784", "text": "func (d *Droplet) CanReap() bool {\n\treturn d.YPos > int(rl.GetScreenHeight())\n}", "title": "" } ]
02fad2c4872ee31d825ff3c2cfda8c4c
TearoffMenuItemNew is a wrapper around the C function gtk_tearoff_menu_item_new.
[ { "docid": "37ef7093432ea23c210e8132697d2647", "score": "0.878856", "text": "func TearoffMenuItemNew() *TearoffMenuItem {\n\tretC := C.gtk_tearoff_menu_item_new()\n\tretGo := TearoffMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" } ]
[ { "docid": "4915e3a51db30361a269c7b10ccdef45", "score": "0.6510006", "text": "func CastToTearoffMenuItem(object *gobject.Object) *TearoffMenuItem {\n\treturn TearoffMenuItemNewFromC(object.ToC())\n}", "title": "" }, { "docid": "6f595bbd451e044f5263dd54a3adf64a", "score": "0.6404461", "text": "func MenuItemNew(label string, detailed_action string) (return__ *MenuItem) {\n\t__cgo__label := (*C.gchar)(unsafe.Pointer(C.CString(label)))\n\t__cgo__detailed_action := (*C.gchar)(unsafe.Pointer(C.CString(detailed_action)))\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.g_menu_item_new(__cgo__label, __cgo__detailed_action)\n\tC.free(unsafe.Pointer(__cgo__label))\n\tC.free(unsafe.Pointer(__cgo__detailed_action))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewMenuItemFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9a48ae8c287403c19be1e5c26c11befd", "score": "0.62147295", "text": "func MenuItemNew() *MenuItem {\n\tc := C.gtk_menu_item_new()\n\treturn wrapMenuItem(glib.WrapObject(unsafe.Pointer(c)))\n}", "title": "" }, { "docid": "3c63ddf5c28022079e6b59532d5e5e79", "score": "0.61943036", "text": "func MenuItemNew() *MenuItem {\n\tretC := C.gtk_menu_item_new()\n\tretGo := MenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6b0aa90e42f9bcc2265adf5007f816a0", "score": "0.6173872", "text": "func newMenuItem(ctx context.Context, rootID string, o *MenuItemOptions, d *dispatcher, i *identifier, w *writer) (m *MenuItem) {\n\tm = &MenuItem{\n\t\to: o,\n\t\tobject: newObject(ctx, d, i, w, i.new()),\n\t\trootID: rootID,\n\t}\n\tif o.OnClick != nil {\n\t\tm.On(EventNameMenuItemEventClicked, o.OnClick)\n\t}\n\tif len(o.SubMenu) > 0 {\n\t\tm.s = &SubMenu{newSubMenu(ctx, rootID, o.SubMenu, d, i, w)}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9e3e94401be87fda4ad7200da9c1f931", "score": "0.6162594", "text": "func MenuToolButtonNew(iconWidget *Widget, label string) *MenuToolButton {\n\tc_icon_widget := (*C.GtkWidget)(C.NULL)\n\tif iconWidget != nil {\n\t\tc_icon_widget = (*C.GtkWidget)(iconWidget.ToC())\n\t}\n\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_menu_tool_button_new(c_icon_widget, c_label)\n\tretGo := MenuToolButtonNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "e405b2ef61b5af6e8c6e6e01d7a6cd5d", "score": "0.60658246", "text": "func (recv *TearoffMenuItem) MenuItem() *MenuItem {\n\treturn MenuItemNewFromC(unsafe.Pointer(recv.native))\n}", "title": "" }, { "docid": "6a69c81f54e1124d47c9677236574024", "score": "0.6029655", "text": "func CheckMenuItemNew() *CheckMenuItem {\n\tretC := C.gtk_check_menu_item_new()\n\tretGo := CheckMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "86734fa8d6ac3936fdc7d099e9177787", "score": "0.59809697", "text": "func ToolItemNew() *ToolItem {\n\tretC := C.gtk_tool_item_new()\n\tretGo := ToolItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "7fbf67deb5baf5d623533320293f395f", "score": "0.5955063", "text": "func newMenu(ctx context.Context, rootID string, items []*MenuItemOptions, d *dispatcher, i *identifier, w *writer) (m *Menu) {\n\t// Init\n\tm = &Menu{newSubMenu(ctx, rootID, items, d, i, w)}\n\n\t// Make sure the menu's context is cancelled once the destroyed event is received\n\tm.On(EventNameMenuEventDestroyed, func(e Event) (deleteListener bool) {\n\t\tm.cancel()\n\t\treturn true\n\t})\n\treturn\n}", "title": "" }, { "docid": "750e93c0040070a7be541e47e6962a91", "score": "0.59413517", "text": "func CheckMenuItemNewWithMnemonic(label string) *CheckMenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_check_menu_item_new_with_mnemonic(c_label)\n\tretGo := CheckMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "c58b577c087526a1f980a6173dc4219a", "score": "0.5923631", "text": "func (recv *Action) CreateMenuItem() *Widget {\n\tretC := C.gtk_action_create_menu_item((*C.GtkAction)(recv.native))\n\tretGo := WidgetNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "14ae650c8dff6d67cb0ad5b4cb91d89b", "score": "0.5820663", "text": "func CheckMenuItemNewWithLabel(label string) *CheckMenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_check_menu_item_new_with_label(c_label)\n\tretGo := CheckMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "18fd1fefa40b8ce91907bbbb0e2934b2", "score": "0.5775551", "text": "func MenuItemNewWithLabel(label string) *MenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_menu_item_new_with_label(c_label)\n\tretGo := MenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "8791db6ec4a5d5e2246549713dbed18b", "score": "0.5745762", "text": "func MenuItemNewWithLabel(label string) *MenuItem {\n\tcstr := C.CString(label)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tc := C.gtk_menu_item_new_with_label((*C.gchar)(cstr))\n\treturn wrapMenuItem(glib.WrapObject(unsafe.Pointer(c)))\n}", "title": "" }, { "docid": "905420f398c0bf1db423a5104670c601", "score": "0.5744163", "text": "func MenuItemNewWithMnemonic(label string) *MenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_menu_item_new_with_mnemonic(c_label)\n\tretGo := MenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "c6679cd71c1b8900a8d2448554ce9281", "score": "0.5736314", "text": "func (t *TrayIcon) createMenu() {\n\tm := ui.NewQMenu(nil)\n\tt.Icon.ConnectActivated(t.onActivated)\n\n\tm.AddSeparator()\n\tmr := m.AddAction(\"Mark all as read\")\n\tmr.ConnectTriggered(t.onMarkAsReadClicked)\n\n\tset := m.AddAction(\"Settings\")\n\tset.SetIcon(gui.QIcon_FromTheme(\"gtk-preferences\"))\n\tset.ConnectTriggered(t.onSettingsClicked)\n\n\tab := m.AddAction(\"About\")\n\tab.SetIcon(gui.QIcon_FromTheme(\"gtk-about\"))\n\tab.ConnectTriggered(t.onAboutClicked)\n\n\tm.AddSeparator()\n\tquit := m.AddAction(\"Quit\")\n\tquit.SetIcon(icoExit)\n\tquit.ConnectTriggered(t.onQuitClicked)\n\n\tt.Menu = m\n\tt.Icon.SetContextMenu(m)\n}", "title": "" }, { "docid": "7c27d0a50b4df500a6a0a5deca902343", "score": "0.571642", "text": "func RecentChooserMenuNewForManager(manager *RecentManager) *RecentChooserMenu {\n\tc_manager := (*C.GtkRecentManager)(C.NULL)\n\tif manager != nil {\n\t\tc_manager = (*C.GtkRecentManager)(manager.ToC())\n\t}\n\n\tretC := C.gtk_recent_chooser_menu_new_for_manager(c_manager)\n\tretGo := RecentChooserMenuNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "5a6ea624c68541da30ba9b7d137a8839", "score": "0.5669919", "text": "func (recv *Action) CreateToolItem() *Widget {\n\tretC := C.gtk_action_create_tool_item((*C.GtkAction)(recv.native))\n\tretGo := WidgetNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6c2c066750611bf8d09c85f46bd23a42", "score": "0.5555601", "text": "func MenuItemNew(c *gin.Context) {\n\th := DefaultH(c)\n\tmenuID := c.Param(\"id\")\n\n\th[\"Title\"] = \"New menu item\"\n\th[\"Item\"] = models.MenuItem{MenuID: atouint64(menuID)}\n\tsession := sessions.Default(c)\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\n\tc.HTML(http.StatusOK, \"menu_items/form\", h)\n}", "title": "" }, { "docid": "f31bda3dc482da1e668eaad7949faa45", "score": "0.5523637", "text": "func NewMenuItem(name, stationcode string, preptime int) *MenuItem {\n\treturn &MenuItem{\n\t\tName: name,\n\t\tPrepTime: preptime,\n\t\tStationCode: stationcode,\n\t}\n}", "title": "" }, { "docid": "a0a2c4fd3d041ca710096e4f9ed7f6d2", "score": "0.54510695", "text": "func MenuNew() *Menu {\n\tretC := C.gtk_menu_new()\n\tretGo := MenuNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "d54252fb548eeb4fb9c4c6085c9ba49f", "score": "0.5437796", "text": "func NewWidgetsMenuItem2(a WidgetsMenuInterface, b int, c int) (*WidgetsMenuItem) {\n\tconv_a := javabind.NewGoToJavaCallable()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\n\tobj, err := javabind.GetEnv().NewObject(\"org/eclipse/swt/widgets/MenuItem\", conv_a.Value().Cast(\"org/eclipse/swt/widgets/Menu\"), b, c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\tx := &WidgetsMenuItem{}\n\tx.Callable = &javabind.Callable{obj}\n\treturn x\n}", "title": "" }, { "docid": "6d2285ef80b6f5cb52df5969f8568f60", "score": "0.5362069", "text": "func newMenuMutation(c config, op Op, opts ...menuOption) *MenuMutation {\n\tm := &MenuMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeMenu,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "232fc598237ba5c4f24777959bf2b6a9", "score": "0.53337926", "text": "func NewContextMenu(menuItems ...MenuItemNode) {\n\tdispatcher(func() {\n\t\tnewContextMenu(menuItems...)\n\t})\n}", "title": "" }, { "docid": "492b1e97a972019b1de36f68f177341e", "score": "0.53042847", "text": "func (recv *TearoffMenuItem) Widget() *Widget {\n\treturn recv.MenuItem().Widget()\n}", "title": "" }, { "docid": "aad1856c0c9592225b756e59359119c4", "score": "0.5279738", "text": "func ImageMenuItemNew() *ImageMenuItem {\n\tretC := C.gtk_image_menu_item_new()\n\tretGo := ImageMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "b12bf4e7561cb4ed96a487f0eba13d48", "score": "0.5279182", "text": "func ToolButtonNew(iconWidget *Widget, label string) *ToolButton {\n\tc_icon_widget := (*C.GtkWidget)(C.NULL)\n\tif iconWidget != nil {\n\t\tc_icon_widget = (*C.GtkWidget)(iconWidget.ToC())\n\t}\n\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_tool_button_new(c_icon_widget, c_label)\n\tretGo := ToolButtonNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "77681e2cfa654841ecb0375482568112", "score": "0.5239919", "text": "func ToolPaletteNew() *ToolPalette {\n\tretC := C.gtk_tool_palette_new()\n\tretGo := ToolPaletteNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "ec5da2fc77b369f9d976a84c63f5b9fb", "score": "0.52288216", "text": "func MenuNew() (return__ *Menu) {\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.g_menu_new()\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewMenuFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2e8f9dd040c6abff73c13caca7c36289", "score": "0.52073956", "text": "func NewMenuItemPostback(title, payload string) MenuItemPostback {\n\tmenuItem := MenuItemPostback{\n\t\tMenuItemBase: MenuItemBase{\n\t\t\tType: MenuItemTypePostback,\n\t\t\tTitle: title,\n\t\t},\n\t\tPayload: payload,\n\t}\n\treturn menuItem\n}", "title": "" }, { "docid": "d66a5ba2ee13674b6c25f55cae6d234d", "score": "0.51989055", "text": "func MenuButtonNew() *MenuButton {\n\tretC := C.gtk_menu_button_new()\n\tretGo := MenuButtonNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "d1d876aab35b49a82aadc5f79a54b91e", "score": "0.51834023", "text": "func MenuBarNew() *MenuBar {\n\tretC := C.gtk_menu_bar_new()\n\tretGo := MenuBarNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "c74c4c1b7134aa7eac4c55c3bab5569d", "score": "0.5181573", "text": "func SeparatorMenuItemNew() *SeparatorMenuItem {\n\tretC := C.gtk_separator_menu_item_new()\n\tretGo := SeparatorMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "7119e802c4b5fc7228053ab839dfb592", "score": "0.51495594", "text": "func CastToMenuItem(object *gobject.Object) *MenuItem {\n\treturn MenuItemNewFromC(object.ToC())\n}", "title": "" }, { "docid": "cd04c8d78741b99952af4812618e53ca", "score": "0.51321465", "text": "func (recv *Action) CreateMenu() *Widget {\n\tretC := C.gtk_action_create_menu((*C.GtkAction)(recv.native))\n\tretGo := WidgetNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6b4a94837a28272ccdbd68e4dce7d4c2", "score": "0.51288044", "text": "func SeparatorToolItemNew() *SeparatorToolItem {\n\tretC := C.gtk_separator_tool_item_new()\n\tretGo := SeparatorToolItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "5cc65481c31294bd75a7afa988a2fc31", "score": "0.51250315", "text": "func RecentChooserMenuNew() *RecentChooserMenu {\n\tretC := C.gtk_recent_chooser_menu_new()\n\tretGo := RecentChooserMenuNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "885285a770633ef07cab6bd99cb5f1ad", "score": "0.5113175", "text": "func ItemNew() *Item {\n\tretC := C.pango_item_new()\n\tretGo := ItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "0d4e9e26e3c2d630d2dd137dd9b4d36c", "score": "0.5093511", "text": "func ImageMenuItemNewWithMnemonic(label string) *ImageMenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_image_menu_item_new_with_mnemonic(c_label)\n\tretGo := ImageMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "25e87cd0365b47c975d1b58d2edc8262", "score": "0.5070724", "text": "func NewMenuItemNested(title string, callToActions ...MenuItem) MenuItemNested {\n\tmenuItem := MenuItemNested{\n\t\tMenuItemBase: MenuItemBase{\n\t\t\tType: MenuItemTypeNested,\n\t\t\tTitle: title,\n\t\t},\n\t\tCallToActions: callToActions,\n\t}\n\treturn menuItem\n}", "title": "" }, { "docid": "6b245523b04fb3758e99684424eed262", "score": "0.5063718", "text": "func (recv *TearoffMenuItem) Object() *gobject.Object {\n\treturn recv.MenuItem().Object()\n}", "title": "" }, { "docid": "1e71877e083e2ac8857c91a40026f83f", "score": "0.5052129", "text": "func ImageMenuItemNewWithLabel(label string) *ImageMenuItem {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_image_menu_item_new_with_label(c_label)\n\tretGo := ImageMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "1a3d49b94b46f6cdab0ae4f7f76e62ae", "score": "0.5022364", "text": "func RecentActionNewForManager(name string, label string, tooltip string, stockId string, manager *RecentManager) *RecentAction {\n\tc_name := C.CString(name)\n\tdefer C.free(unsafe.Pointer(c_name))\n\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tc_tooltip := C.CString(tooltip)\n\tdefer C.free(unsafe.Pointer(c_tooltip))\n\n\tc_stock_id := C.CString(stockId)\n\tdefer C.free(unsafe.Pointer(c_stock_id))\n\n\tc_manager := (*C.GtkRecentManager)(C.NULL)\n\tif manager != nil {\n\t\tc_manager = (*C.GtkRecentManager)(manager.ToC())\n\t}\n\n\tretC := C.gtk_recent_action_new_for_manager(c_name, c_label, c_tooltip, c_stock_id, c_manager)\n\tretGo := RecentActionNewFromC(unsafe.Pointer(retC))\n\n\tif retC != nil {\n\t\tC.g_object_unref((C.gpointer)(retC))\n\t}\n\n\treturn retGo\n}", "title": "" }, { "docid": "b8c51f91e42500a134f6c192590cb489", "score": "0.5009398", "text": "func MenuToolButtonNewFromStock(stockId string) *MenuToolButton {\n\tc_stock_id := C.CString(stockId)\n\tdefer C.free(unsafe.Pointer(c_stock_id))\n\n\tretC := C.gtk_menu_tool_button_new_from_stock(c_stock_id)\n\tretGo := MenuToolButtonNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "1100df2af4dda92d71a0908d6dc65506", "score": "0.4993524", "text": "func (recv *Menu) SetTearoffState(tornOff bool) {\n\tc_torn_off :=\n\t\tboolToGboolean(tornOff)\n\n\tC.gtk_menu_set_tearoff_state((*C.GtkMenu)(recv.native), c_torn_off)\n\n\treturn\n}", "title": "" }, { "docid": "451fd51a3671ba0dd791b9f5a8e7a0c1", "score": "0.4966194", "text": "func CreateMenu(usageTitle, pressed string) (hk *HotkeyMenu) {\n\thk = &HotkeyMenu{usageTitle: usageTitle, pressed: pressed}\n\treturn\n}", "title": "" }, { "docid": "e2125d7718fedac90137f64a77f9ff85", "score": "0.49437666", "text": "func CastToMenuToolButton(object *gobject.Object) *MenuToolButton {\n\treturn MenuToolButtonNewFromC(object.ToC())\n}", "title": "" }, { "docid": "6d424ec3b0b741951a55ed284f7a43dc", "score": "0.49051625", "text": "func MenuItemNewSubmenu(label string, submenu IsMenuModel) (return__ *MenuItem) {\n\t__cgo__label := (*C.gchar)(unsafe.Pointer(C.CString(label)))\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.g_menu_item_new_submenu(__cgo__label, submenu.GetMenuModelPointer())\n\tC.free(unsafe.Pointer(__cgo__label))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewMenuItemFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f75019d360d703de2bdf942b1f32cf99", "score": "0.48932433", "text": "func NewAppMenu(aboutHandler, prefsHandler func()) *webapp.Menu {\n\tmenu := webapp.NewMenu(webapp.MenuIDAppMenu, cmdline.AppName)\n\tmenu.InsertItem(-1, webapp.MenuIDAboutItem, fmt.Sprintf(i18n.Text(\"About %s\"), cmdline.AppName), nil, 0, func() bool { return aboutHandler != nil }, aboutHandler)\n\tif prefsHandler != nil {\n\t\tmenu.InsertSeparator(-1)\n\t\tmenu.InsertItem(-1, webapp.MenuIDPreferencesItem, i18n.Text(\"Preferences…\"), keys.Comma, keys.PlatformMenuModifier(), nil, prefsHandler)\n\t}\n\tif runtime.GOOS == toolbox.MacOS {\n\t\tmenu.InsertSeparator(-1)\n\t\tmenu.InsertMenu(-1, webapp.MenuIDServicesMenu, i18n.Text(\"Services\"))\n\t}\n\tif avc, ok := webapp.PlatformDriver().(webapp.AppVisibilityController); ok {\n\t\tmenu.InsertSeparator(-1)\n\t\tmenu.InsertItem(-1, webapp.MenuIDHideItem, fmt.Sprintf(i18n.Text(\"Hide %s\"), cmdline.AppName), keys.H, keys.PlatformMenuModifier(), nil, avc.HideApp)\n\t\tmenu.InsertItem(-1, webapp.MenuIDHideOthersItem, i18n.Text(\"Hide Others\"), keys.H, keys.OptionModifier|keys.PlatformMenuModifier(), nil, avc.HideOtherApps)\n\t\tmenu.InsertItem(-1, webapp.MenuIDShowAllItem, i18n.Text(\"Show All\"), nil, 0, nil, avc.ShowAllApps)\n\t}\n\tmenu.InsertSeparator(-1)\n\tInsertQuitItem(menu, -1)\n\treturn menu\n}", "title": "" }, { "docid": "3b2dcbc83d5f688f284903ce57f38432", "score": "0.48921657", "text": "func newPageItemCommand(m *Main) *pageItemCommand {\n\tc := &pageItemCommand{}\n\tc.baseCommand = m.baseCommand\n\treturn c\n}", "title": "" }, { "docid": "a86e54ae646d456b9f37f1ac7bd4500f", "score": "0.4884542", "text": "func ToolItemGroupNew(label string) *ToolItemGroup {\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_tool_item_group_new(c_label)\n\tretGo := ToolItemGroupNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "fd7d2282dbaabb0dcd02ded7cb814c6b", "score": "0.48768795", "text": "func NewMenu(menu *fyne.Menu) *Menu {\n\titems := make([]fyne.CanvasObject, len(menu.Items))\n\tm := &Menu{Items: items}\n\tfor i, item := range menu.Items {\n\t\tif item.IsSeparator {\n\t\t\titems[i] = newMenuItemSeparator()\n\t\t} else {\n\t\t\titems[i] = newMenuItem(item, m, m.activateChild)\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "00debc120b457ca0934652e5ead62878", "score": "0.48522162", "text": "func ToggleToolButtonNew() *ToggleToolButton {\n\tretC := C.gtk_toggle_tool_button_new()\n\tretGo := ToggleToolButtonNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6b8544e483124be0cb01f370fd2189b1", "score": "0.4843451", "text": "func (t *TrayIcon) addMenuItem(a Article) *ui.QAction {\n\n\titem := ui.NewQAction2(a.Title, t.Menu)\n\tt.Menu.InsertAction(t.getInsertPosition(a), item)\n\titem.SetData(core.NewQVariant7(a.PublishedDate.Unix()))\n\n\tif a.WasRead {\n\t\titem.SetIcon(icoChecked)\n\t} else {\n\t\titem.SetIcon(icoUnchecked)\n\t}\n\n\titem.ConnectTriggered(func(c bool) {\n\t\tt.openArticle(a)\n\t})\n\n\treturn item\n}", "title": "" }, { "docid": "7fe59bca367cb9dd58de6906e07f7851", "score": "0.48360187", "text": "func (recv *SeparatorMenuItem) MenuItem() *MenuItem {\n\treturn MenuItemNewFromC(unsafe.Pointer(recv.native))\n}", "title": "" }, { "docid": "344cbce7803ba664fe186b668f36805b", "score": "0.4834694", "text": "func newFoodmenuMutation(c config, op Op, opts ...foodmenuOption) *FoodmenuMutation {\n\tm := &FoodmenuMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeFoodmenu,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "107c19009559ac9906a4bd379fd2c846", "score": "0.48061877", "text": "func NewItemActivityOLD()(*ItemActivityOLD) {\n m := &ItemActivityOLD{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "0b48a1aa18d7b8d5834ffe2a3841b5a7", "score": "0.47905162", "text": "func NewTrayIcon(delay bool) error {\n\tvar err error\n\tcore.QCoreApplication_SetAttribute(core.Qt__AA_ShareOpenGLContexts, true)\n\tcore.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)\n\tt := &TrayIcon{\n\t\tApp: ui.NewQApplication(len(os.Args), os.Args),\n\t\tDelay: delay,\n\t\tArticles: []Article{},\n\t\tSettingsWidgets: &SettingsWidgets{},\n\t\tMutex: &sync.Mutex{},\n\t}\n\tt.App.SetQuitOnLastWindowClosed(false)\n\tt.App.SetApplicationName(\"mntray\")\n\tt.App.SetApplicationVersion(version)\n\n\t// set icons\n\tico = gui.QIcon_FromTheme2(\"mntray-regular\", gui.NewQIcon5(\":assets/images/mntray-regular.png\"))\n\ticoNew = gui.QIcon_FromTheme2(\"mntray-news\", gui.NewQIcon5(\":assets/images/mntray-news.png\"))\n\ticoChecked = gui.QIcon_FromTheme2(\"emblem-checked\", gui.QIcon_FromTheme2(\"emblem-default\", gui.QIcon_FromTheme(\"dialog-yes\")))\n\ticoExit = gui.QIcon_FromTheme(\"application-exit\")\n\ticoUnchecked = gui.QIcon_FromTheme2(\"vcs-removed\", gui.QIcon_FromTheme(\"emblem-draft\"))\n\n\t// create icon\n\tt.Icon = NewSystemTrayIcon(t.App)\n\tt.Icon.SetIcon(ico)\n\tt.Conf, err = NewConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// load articles from file\n\tarts, err := t.Conf.LoadArticles()\n\tif err != nil {\n\t\tfmt.Println(\"Error loading articles from file:\", err)\n\t}\n\n\t// make menu\n\tt.createMenu()\n\n\t// connect slots\n\tt.Icon.ConnectNewArticleSlot(t.onNewArticle)\n\tt.Icon.ConnectErrorSlot(t.onError)\n\tt.Icon.ConnectHideIconSlot(t.onHideIcon)\n\n\t// connect signals\n\tt.Icon.ConnectMessageClicked(t.onMessageClicked)\n\n\t// create menu items for loaded articles\n\tfor i := range arts {\n\t\tt.gotNewArticle(arts[i], true)\n\t}\n\n\t// show icon\n\tt.Icon.Show()\n\tt.setTrayIcon()\n\n\t// start loop for fetching news\n\tt.waitForNews()\n\n\t// handle signals from OS\n\tgo t.handleOSSignals()\n\n\t// Qt main loop\n\tt.App.Exec()\n\treturn nil\n}", "title": "" }, { "docid": "6bdddf838172737d966abd2d34519a3a", "score": "0.47677454", "text": "func MenuItemNewSection(label string, section IsMenuModel) (return__ *MenuItem) {\n\t__cgo__label := (*C.gchar)(unsafe.Pointer(C.CString(label)))\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.g_menu_item_new_section(__cgo__label, section.GetMenuModelPointer())\n\tC.free(unsafe.Pointer(__cgo__label))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewMenuItemFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ee9343586483dc2f7b445ffbef52b34", "score": "0.47566715", "text": "func (recv *TearoffMenuItem) InitiallyUnowned() *gobject.InitiallyUnowned {\n\treturn recv.MenuItem().InitiallyUnowned()\n}", "title": "" }, { "docid": "a8af8618e8e5ac29877811cd54eba5ef", "score": "0.47560412", "text": "func MenuItemNewFromModel(model IsMenuModel, item_index int) (return__ *MenuItem) {\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.g_menu_item_new_from_model(model.GetMenuModelPointer(), C.gint(item_index))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewMenuItemFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "28e8f3d07c57e60797dd9fc525d34945", "score": "0.47480908", "text": "func RadioMenuItemNew(group *glib.SList) *RadioMenuItem {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tretC := C.gtk_radio_menu_item_new(c_group)\n\tretGo := RadioMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "f0fdc300cd3ef07b190a37115ccd8a7c", "score": "0.47343916", "text": "func NewBackupItemAction(t mockConstructorTestingTNewBackupItemAction) *BackupItemAction {\n\tmock := &BackupItemAction{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "dd112dd42a09e8d8e1ee060094b7c971", "score": "0.47191364", "text": "func MenuItemCreate(c *gin.Context) {\n\tdb := models.GetDB()\n\tmenuID := c.Param(\"id\")\n\titem := models.MenuItem{}\n\tif err := c.ShouldBind(&item); err != nil {\n\t\tsession := sessions.Default(c)\n\t\tsession.AddFlash(err.Error())\n\t\tsession.Save()\n\t\tc.Redirect(http.StatusSeeOther, fmt.Sprintf(\"/admin/menu/%s/new_item\", menuID))\n\t\treturn\n\t}\n\tif *item.ParentID == 0 {\n\t\titem.ParentID = nil\n\t}\n\tif err := db.Create(&item).Error; err != nil {\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tc.Redirect(http.StatusFound, fmt.Sprintf(\"/admin/menu/%s\", menuID))\n}", "title": "" }, { "docid": "d0eda671c9c3cdb3f440cc6532d3f670", "score": "0.46999907", "text": "func NewMenu(style *Style) *Menu {\n\tchannel := make(chan int)\n\ts, e := tcell.NewScreen()\n\tif e != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", e)\n\t\tos.Exit(1)\n\t}\n\tp := NewPrinting(s, style)\n\treturn &Menu{\n\t\tBottomBar: true,\n\t\tBottomBarText: \"Press ESC to exit\",\n\t\tBackText: \"Press ESC to go back\",\n\t\tBoolText: \"Press Y for yes or N for No, ESC to Cancel\",\n\t\tValueText: \"Type your answer and press ENTER to continue, or ESC to Cancel\",\n\t\tWait: channel,\n\t\tp: p,\n\t\truneBuffer: []rune{},\n\t}\n}", "title": "" }, { "docid": "2b3dc63724dab7c9263bc300466d0b47", "score": "0.46934", "text": "func (recv *CheckMenuItem) MenuItem() *MenuItem {\n\treturn MenuItemNewFromC(unsafe.Pointer(recv.native))\n}", "title": "" }, { "docid": "87501e42bdb8d593b359f16654aa944d", "score": "0.46902683", "text": "func CastToCheckMenuItem(object *gobject.Object) *CheckMenuItem {\n\treturn CheckMenuItemNewFromC(object.ToC())\n}", "title": "" }, { "docid": "4e3826dd33172879b84d943edc32dbf5", "score": "0.46804026", "text": "func CastToPopoverMenu(object *gobject.Object) *PopoverMenu {\n\treturn PopoverMenuNewFromC(object.ToC())\n}", "title": "" }, { "docid": "66d93e12b97a12d474ba73066a4c878b", "score": "0.4677084", "text": "func CastToMenu(object *gobject.Object) *Menu {\n\treturn MenuNewFromC(object.ToC())\n}", "title": "" }, { "docid": "d365b5f394ab6a703128aab8a667345c", "score": "0.4674149", "text": "func NewOutlookItem()(*OutlookItem) {\n m := &OutlookItem{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "340ff75c9b651da0216f804a4e241766", "score": "0.46325782", "text": "func NewPopUpMenuAtPosition(menu *fyne.Menu, c fyne.Canvas, pos fyne.Position) *PopUp {\n\toptions := NewVBox()\n\tfor _, option := range menu.Items {\n\t\topt := option // capture value\n\t\tif opt.IsSeparator {\n\t\t\toptions.Append(newSeparator())\n\t\t} else {\n\t\t\toptions.Append(newMenuItemWidget(opt.Label))\n\t\t}\n\t}\n\tpop := NewPopUpAtPosition(options, c, pos)\n\tfocused := c.Focused()\n\tfor i, o := range options.Children {\n\t\tif label, ok := o.(*menuItemWidget); ok {\n\t\t\titem := menu.Items[i]\n\t\t\tlabel.OnTapped = func() {\n\t\t\t\tif c.Focused() == nil {\n\t\t\t\t\tc.Focus(focused)\n\t\t\t\t}\n\t\t\t\tpop.Hide()\n\t\t\t\titem.Action()\n\t\t\t}\n\t\t}\n\t}\n\treturn pop\n}", "title": "" }, { "docid": "6d0ff207752416c33213840c155b9ef1", "score": "0.4627926", "text": "func (d *Driver) NewContextMenu(c app.MenuConfig) app.Menu {\n\tm := newMenu(d, c)\n\td.setElemErr(m)\n\treturn m\n}", "title": "" }, { "docid": "bc0104887dd43f2d4c3ff721fe8d804f", "score": "0.4623852", "text": "func TargetEntryNew(target string, flags uint32, info uint32) *TargetEntry {\n\tc_target := C.CString(target)\n\tdefer C.free(unsafe.Pointer(c_target))\n\n\tc_flags := (C.guint)(flags)\n\n\tc_info := (C.guint)(info)\n\n\tretC := C.gtk_target_entry_new(c_target, c_flags, c_info)\n\tretGo := TargetEntryNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "ba3ddaea575dede953477e731db43f9d", "score": "0.46085134", "text": "func ToolbarNew() *Toolbar {\n\tretC := C.gtk_toolbar_new()\n\tretGo := ToolbarNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "8d578871485b4aa3d0407fea452b7196", "score": "0.46059906", "text": "func newMenugroupMutation(c config, op Op, opts ...menugroupOption) *MenugroupMutation {\n\tm := &MenugroupMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeMenugroup,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "2e0e4166519e664f90776cc1798cf10b", "score": "0.45976418", "text": "func newLightOnCommand(l *light) *lightOnCommand {\n\treturn &lightOnCommand{\n\t\tlight: l,\n\t}\n}", "title": "" }, { "docid": "34d9d90d498f6f3a37384f7665e15b1e", "score": "0.45866552", "text": "func RecentChooserWidgetNewForManager(manager *RecentManager) *RecentChooserWidget {\n\tc_manager := (*C.GtkRecentManager)(C.NULL)\n\tif manager != nil {\n\t\tc_manager = (*C.GtkRecentManager)(manager.ToC())\n\t}\n\n\tretC := C.gtk_recent_chooser_widget_new_for_manager(c_manager)\n\tretGo := RecentChooserWidgetNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "51f3a5ae40132fdd5281ef62b6f4f698", "score": "0.45820308", "text": "func NewMenu(name string, quickChar int, theme *Theme) *Menu {\n\treturn &Menu{\n\t\tName: name,\n\t\tQuickChar: quickChar,\n\t\tItems: make([]Item, 0, 6),\n\n\t\tbaseComponent: baseComponent{theme: theme},\n\t}\n}", "title": "" }, { "docid": "4230af8c5e76fd1c552acc8b1dd353e8", "score": "0.45789245", "text": "func TargetEntryNew(target string, flags TargetFlags, info uint) (*TargetEntry, error) {\n\tcstr := C.CString(target)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tc := C.gtk_target_entry_new((*C.gchar)(cstr), C.guint(flags), C.guint(info))\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\tt := wrapTargetEntry(c)\n\truntime.SetFinalizer(t, (*TargetEntry).free)\n\treturn t, nil\n}", "title": "" }, { "docid": "e7ac06bd9752daf1eb125e3565218c45", "score": "0.45617756", "text": "func (recv *MenuToolButton) ToolItem() *ToolItem {\n\treturn recv.ToolButton().ToolItem()\n}", "title": "" }, { "docid": "3aceb42ddccd67aa42100a69cdab6434", "score": "0.4559142", "text": "func CastToToolItem(object *gobject.Object) *ToolItem {\n\treturn ToolItemNewFromC(object.ToC())\n}", "title": "" }, { "docid": "6bab27718daa983ed0038b4fae0ec7da", "score": "0.45559925", "text": "func New(serviceName, description string) *MenuNode {\n\tvar top = &MenuNode{\n\t\tN: serviceName,\n\t\tD: description,\n\t}\n\treturn top\n}", "title": "" }, { "docid": "430bc9a392c4f3d3fef4d29dd88c6570", "score": "0.45489043", "text": "func MenuCreate(accesstoken string, menuContent []CustomButton) (error, *CustomMenu) {\n\tvar menu CustomMenu\n\tmenu.Url = url_create\n\tmenu.Url += accesstoken\n\tmenu.Content = menuContent\n\treturn nil, &menu\n}", "title": "" }, { "docid": "2f951e28e814b07894e6174547619b19", "score": "0.45455855", "text": "func RadioMenuItemNewWithMnemonicFromWidget(group *RadioMenuItem, label string) *RadioMenuItem {\n\tc_group := (*C.GtkRadioMenuItem)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GtkRadioMenuItem)(group.ToC())\n\t}\n\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_radio_menu_item_new_with_mnemonic_from_widget(c_group, c_label)\n\tretGo := RadioMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "f57b94957b0ad9be1c0c740d7cbf427d", "score": "0.45451152", "text": "func (e *Elem) WhenMenu(func(app.Menu)) {}", "title": "" }, { "docid": "f57b94957b0ad9be1c0c740d7cbf427d", "score": "0.45451152", "text": "func (e *Elem) WhenMenu(func(app.Menu)) {}", "title": "" }, { "docid": "f1175df7bec56d6dcf25663841726e10", "score": "0.45383516", "text": "func CastToRecentChooserMenu(object *gobject.Object) *RecentChooserMenu {\n\treturn RecentChooserMenuNewFromC(object.ToC())\n}", "title": "" }, { "docid": "b48270a050f24625c79fae3805278ac3", "score": "0.4532953", "text": "func (recv *MenuShell) Append(child *MenuItem) {\n\tc_child := (*C.GtkWidget)(C.NULL)\n\tif child != nil {\n\t\tc_child = (*C.GtkWidget)(child.ToC())\n\t}\n\n\tC.gtk_menu_shell_append((*C.GtkMenuShell)(recv.native), c_child)\n\n\treturn\n}", "title": "" }, { "docid": "92bcbf1b6e7772c997887b12e397bc40", "score": "0.45233822", "text": "func MenuBarNewFromModel(model *gio.MenuModel) *MenuBar {\n\tc_model := (*C.GMenuModel)(C.NULL)\n\tif model != nil {\n\t\tc_model = (*C.GMenuModel)(model.ToC())\n\t}\n\n\tretC := C.gtk_menu_bar_new_from_model(c_model)\n\tretGo := MenuBarNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "d08d86e33a3c39f0f9ec76c7637133f8", "score": "0.45231292", "text": "func NewMenu() *Menu {\n\treturn &Menu{\n\t\titems: make([]*MenuItem, 0),\n\t}\n}", "title": "" }, { "docid": "0d27c8cd374b40be87bd7a94ba8020f3", "score": "0.45186546", "text": "func RecentManagerNew() *RecentManager {\n\tretC := C.gtk_recent_manager_new()\n\tretGo := RecentManagerNewFromC(unsafe.Pointer(retC))\n\n\tif retC != nil {\n\t\tC.g_object_unref((C.gpointer)(retC))\n\t}\n\n\treturn retGo\n}", "title": "" }, { "docid": "f652917daf4fc0abc85537276c401716", "score": "0.4507994", "text": "func NewTray(id, title string, itemTree menu.ItemTree) (*Tray, error) {\n\tconn, err := dbus.SessionBus()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't connect to session bus: %w\", err)\n\t}\n\treturn NewTrayWithConn(conn, id, title, itemTree), nil\n}", "title": "" }, { "docid": "141e24395e44e8594b48c4de4727735d", "score": "0.45059937", "text": "func MenuItem(markup ...vecty.MarkupOrChild) *vecty.HTML {\n\treturn vecty.Tag(\"menuitem\", markup...)\n}", "title": "" }, { "docid": "982bff5d3b2c6608ead7cb34443d1b9d", "score": "0.45014262", "text": "func RadioMenuItemNewWithMnemonic(group *glib.SList, label string) *RadioMenuItem {\n\tc_group := (*C.GSList)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GSList)(group.ToC())\n\t}\n\n\tc_label := C.CString(label)\n\tdefer C.free(unsafe.Pointer(c_label))\n\n\tretC := C.gtk_radio_menu_item_new_with_mnemonic(c_group, c_label)\n\tretGo := RadioMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "4866c84c5f436dee3c15ae04de62eacd", "score": "0.44994864", "text": "func (recv *Menu) GetTearoffState() bool {\n\tretC := C.gtk_menu_get_tearoff_state((*C.GtkMenu)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "45120c34ca2489c826f0cc4c5fadadfc", "score": "0.4498404", "text": "func NewMenu() *EulerMenu {\n em := &EulerMenu{ \n Options: []Option{\n Option{0, \"Exit Program\", \"\"},\n Option{1, \"Multiples of 3 and 5\", \"\"},\n Option{2, \"Even Fibonnaci Numbers\",\"\"},\n },\n }\n return em\n}", "title": "" }, { "docid": "910146088884350c47fb4c18772d507b", "score": "0.44903007", "text": "func withMenu(node *Menu) menuOption {\n\treturn func(m *MenuMutation) {\n\t\tm.oldValue = func(context.Context) (*Menu, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "649fe10850deb9bfcbb4688efa917461", "score": "0.44830355", "text": "func MenuNewFromModel(model *gio.MenuModel) *Menu {\n\tc_model := (*C.GMenuModel)(C.NULL)\n\tif model != nil {\n\t\tc_model = (*C.GMenuModel)(model.ToC())\n\t}\n\n\tretC := C.gtk_menu_new_from_model(c_model)\n\tretGo := MenuNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "6cc559a92530bcf3bd2cb7540f40290f", "score": "0.4471648", "text": "func RadioMenuItemNewFromWidget(group *RadioMenuItem) *RadioMenuItem {\n\tc_group := (*C.GtkRadioMenuItem)(C.NULL)\n\tif group != nil {\n\t\tc_group = (*C.GtkRadioMenuItem)(group.ToC())\n\t}\n\n\tretC := C.gtk_radio_menu_item_new_from_widget(c_group)\n\tretGo := RadioMenuItemNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" } ]
69970773ae7a91c2810f1340565ed1f2
SetResourceARN sets the ResourceARN field's value.
[ { "docid": "d76ccdae47048477b81e86df70da3719", "score": "0.83373153", "text": "func (s *UntagResourceInput) SetResourceARN(v string) *UntagResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "f6ffd692943d1fc1085f50b3783bea5f", "score": "0.85419226", "text": "func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "f6ffd692943d1fc1085f50b3783bea5f", "score": "0.8541678", "text": "func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "f6ffd692943d1fc1085f50b3783bea5f", "score": "0.8541678", "text": "func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "c3cd3270b9011f08242ee1016a96e359", "score": "0.82538515", "text": "func (s *TagResourceInput) SetResourceARN(v string) *TagResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "c3cd3270b9011f08242ee1016a96e359", "score": "0.82538515", "text": "func (s *TagResourceInput) SetResourceARN(v string) *TagResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "c3cd3270b9011f08242ee1016a96e359", "score": "0.82538515", "text": "func (s *TagResourceInput) SetResourceARN(v string) *TagResourceInput {\n\ts.ResourceARN = &v\n\treturn s\n}", "title": "" }, { "docid": "46e5b2fb1ac7354718f311489fd1d5a7", "score": "0.6665726", "text": "func (s *GetNetworkTelemetryInput) SetResourceArn(v string) *GetNetworkTelemetryInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "8ca5eb3ec21c7d7e585fb11b2dc9815d", "score": "0.6653567", "text": "func (s *GetNetworkResourceRelationshipsInput) SetResourceArn(v string) *GetNetworkResourceRelationshipsInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "0e8a08afa6f25e6ae771beec225854a6", "score": "0.6576219", "text": "func (s *GetNetworkResourcesInput) SetResourceArn(v string) *GetNetworkResourcesInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "253a6108014a2d7dc42574b2f8ff246b", "score": "0.65382636", "text": "func (s *UpdateNetworkResourceMetadataOutput) SetResourceArn(v string) *UpdateNetworkResourceMetadataOutput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b39b69da8863ec3af31da7023ebccc8b", "score": "0.6530733", "text": "func (s *UpdateNetworkResourceMetadataInput) SetResourceArn(v string) *UpdateNetworkResourceMetadataInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "33b320eaee2d61522c8304035a628cc4", "score": "0.64710456", "text": "func (s *GetResourceShareAssociationsInput) SetResourceArn(v string) *GetResourceShareAssociationsInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "0e3da1f224f513a5a127f6351ff2c6ce", "score": "0.64362395", "text": "func (s *LogSettingsResponse) SetResourceArn(v string) *LogSettingsResponse {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7f2bfdd2d7de0fa154bf9193bb311435", "score": "0.64294386", "text": "func (s *ListPrincipalsInput) SetResourceArn(v string) *ListPrincipalsInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63847387", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.6383954", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b834f82898288ba381aaa9e0b1f1139c", "score": "0.63833964", "text": "func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "33f271af257b5a20f5f095486cc4d223", "score": "0.637372", "text": "func (s *UpdateLicenseSpecificationsForResourceInput) SetResourceArn(v string) *UpdateLicenseSpecificationsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "0eef2e23f7f31f7b70aafef8215a8733", "score": "0.63721466", "text": "func (s *ListLicenseSpecificationsForResourceInput) SetResourceArn(v string) *ListLicenseSpecificationsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "e0cd63714f32d232924dcbf88075b70a", "score": "0.63627505", "text": "func (s *ListTagsForResourceOutput) SetResourceArn(v string) *ListTagsForResourceOutput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "69c34345ad307d341f31b1cfb6596fca", "score": "0.6352671", "text": "func (s *Peering) SetResourceArn(v string) *Peering {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7cc8a03c83f4dbe35e14f3ffdb2e90ee", "score": "0.6349499", "text": "func (s *ListTagsForResourcesInput) SetResourceArn(v string) *ListTagsForResourcesInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f1195c9bc1e729ea38c807880b3b34ed", "score": "0.6338581", "text": "func (s *ListEventSubscriptionsInput) SetResourceArn(v string) *ListEventSubscriptionsInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "2bf228b9d27101d0cc86d9e1eb4e2052", "score": "0.6334023", "text": "func (s *SetTagsForResourceInput) SetResourceArn(v string) *SetTagsForResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f0fea8eed04e28ef51c004cc3fcdfe06", "score": "0.633167", "text": "func (s *LogSettingsRequest) SetResourceArn(v string) *LogSettingsRequest {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "435271dbbe413a54a3a03abf39db19b9", "score": "0.6307912", "text": "func (s *UnsubscribeFromEventInput) SetResourceArn(v string) *UnsubscribeFromEventInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7d500cadc56573377f8b382c21170bb2", "score": "0.63014674", "text": "func (s *PutResourcePolicyOutput) SetResourceArn(v string) *PutResourcePolicyOutput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7159d80ce781e1adf91048c4c2c6b150", "score": "0.6285893", "text": "func (s *PutResourcePolicyInput) SetResourceArn(v string) *PutResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7159d80ce781e1adf91048c4c2c6b150", "score": "0.6285893", "text": "func (s *PutResourcePolicyInput) SetResourceArn(v string) *PutResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "ff16b434037565a1050d2a4e8ac055ce", "score": "0.62691396", "text": "func (s *AwsBackupRecoveryPointDetails) SetResourceArn(v string) *AwsBackupRecoveryPointDetails {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "deb992beca699bb700582991f1ccd482", "score": "0.62576663", "text": "func (s *SubscribeToEventInput) SetResourceArn(v string) *SubscribeToEventInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f549a7ab94e47b3ab67ad807609f82e4", "score": "0.6240261", "text": "func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "4282eb69afd2245e31a7e85769b7a2d8", "score": "0.62164944", "text": "func (s *AppInstanceStreamingConfiguration) SetResourceArn(v string) *AppInstanceStreamingConfiguration {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "737c06ff20d444999e42726ab9087626", "score": "0.62087053", "text": "func (s *GetResourcePolicyOutput) SetResourceArn(v string) *GetResourcePolicyOutput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "25782c7d24914506cbc6e7dbb20432dc", "score": "0.6200738", "text": "func (s *LicenseConfigurationAssociation) SetResourceArn(v string) *LicenseConfigurationAssociation {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "d2d7eb81f09a0906ba75c279a94999cd", "score": "0.6194887", "text": "func (s *ResourceResult) SetResourceArn(v string) *ResourceResult {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "e18c19db1fb700be20d4214afacfd394", "score": "0.61894685", "text": "func (s *Subscription) SetResourceArn(v string) *Subscription {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "abb4a46e34471ed67e17c5c583e32f84", "score": "0.61853087", "text": "func (s *LicenseConfigurationUsage) SetResourceArn(v string) *LicenseConfigurationUsage {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "3c2145529f88af776d6e20e16489783b", "score": "0.61817235", "text": "func (s *NetworkTelemetry) SetResourceArn(v string) *NetworkTelemetry {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "1c89f7477ab054a2a0b5ab146b7c2641", "score": "0.6181687", "text": "func (s *GetResourcePolicyInput) SetResourceArn(v string) *GetResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "1c89f7477ab054a2a0b5ab146b7c2641", "score": "0.6180629", "text": "func (s *GetResourcePolicyInput) SetResourceArn(v string) *GetResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "b6fc23167f33e73afb6a106f5dcb1064", "score": "0.61707866", "text": "func (s *NetworkResourceSummary) SetResourceArn(v string) *NetworkResourceSummary {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "ae6e162eb439bb2a22c91a19d8412c1a", "score": "0.6168226", "text": "func (s *ResourceInventory) SetResourceArn(v string) *ResourceInventory {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f1f1968ed607eb60e67d9b77badbebd1", "score": "0.6150656", "text": "func (s *FirewallPolicyStatefulRuleGroupReferencesDetails) SetResourceArn(v string) *FirewallPolicyStatefulRuleGroupReferencesDetails {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "64a7f17c506f5eb6b19b302266615f28", "score": "0.6130492", "text": "func (s *DeleteResourcePolicyInput) SetResourceArn(v string) *DeleteResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "ff6cb06c9ddba11f6609e4da47609c88", "score": "0.61282283", "text": "func (s *FirewallPolicyStatelessRuleGroupReferencesDetails) SetResourceArn(v string) *FirewallPolicyStatelessRuleGroupReferencesDetails {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "64a7f17c506f5eb6b19b302266615f28", "score": "0.6125481", "text": "func (s *DeleteResourcePolicyInput) SetResourceArn(v string) *DeleteResourcePolicyInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8e2af72ece3fd04b5ec21b9ca961a", "score": "0.61189264", "text": "func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "7ceb8faa1779e0a3b84fa3322c6d30c2", "score": "0.60690445", "text": "func (s *Attachment) SetResourceArn(v string) *Attachment {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "1624f349154041bdee156d100d413173", "score": "0.60510856", "text": "func (s *NetworkResource) SetResourceArn(v string) *NetworkResource {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "4b12a867e9871f662745820d16d007f0", "score": "0.5968089", "text": "func (o *UpdateAttributeDefinitionParams) SetResource(resource *models.AttributeDefinition) {\n\to.Resource = resource\n}", "title": "" }, { "docid": "31c1c4a7d5a62caf1d32da5b9e04a08d", "score": "0.5921658", "text": "func (s *Resource) SetResourceArn(v string) *Resource {\n\ts.ResourceArn = &v\n\treturn s\n}", "title": "" }, { "docid": "66ca7118f7ee368f55f3bef291164cf9", "score": "0.5712417", "text": "func (e *Event) SetResource(v string) {\n\te.Resource = &v\n}", "title": "" }, { "docid": "6b152db06a65169bd7790606cf395ffe", "score": "0.5711219", "text": "func (s *PathComponent) SetResource(v *NetworkResourceSummary) *PathComponent {\n\ts.Resource = v\n\treturn s\n}", "title": "" }, { "docid": "51e6248608f7d3b14ea80475d0a31ab7", "score": "0.5602355", "text": "func (o *CloudManagedNetwork) SetResourceID(resourceID int) {\n\n\to.ResourceID = resourceID\n}", "title": "" }, { "docid": "edae97cdacb18c577016061864188746", "score": "0.55858684", "text": "func (s *ScreenboardLite) SetResource(v string) {\n\ts.Resource = &v\n}", "title": "" } ]
3315100d2726e88dc33ac93b1baaa50f
New returns a Regression that keeps points back as far as xDelta from the last added point.
[ { "docid": "412c4afc18306f2adec94cb880be0ad2", "score": "0.59041744", "text": "func New() Regression {\n\treturn Regression{}\n}", "title": "" } ]
[ { "docid": "52581e9d297e311c6c7924890dbbf30b", "score": "0.53040874", "text": "func NewRegression() *Regression {\n\treturn &Regression{}\n}", "title": "" }, { "docid": "b8eb05ce77721d1f4a2d788b406b9be9", "score": "0.48187244", "text": "func (g *Gyro) GetNewData() *GyroData {\n\treturn &GyroData{\n\t\tX: g.newest.X,\n\t\tY: g.newest.Y,\n\t\tZ: g.newest.Z,\n\t}\n}", "title": "" }, { "docid": "470def5b9d51bd0161a21c1840cc3a6b", "score": "0.4706917", "text": "func AdjustmentNew(value float64, lower float64, upper float64, step_increment float64, page_increment float64, page_size float64) (return__ *Adjustment) {\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.gtk_adjustment_new(C.gdouble(value), C.gdouble(lower), C.gdouble(upper), C.gdouble(step_increment), C.gdouble(page_increment), C.gdouble(page_size))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewAdjustmentFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "59c1b58b11c0ebcd0218a0dbf200bc01", "score": "0.46564707", "text": "func (t Timeseries) Before(x float64) Timeseries {\n\tif len(t.Xs) != len(t.Ys) {\n\t\tpanic(\"timeseries: Xs and Ys slice length mismatch\")\n\t}\n\n\tif j := t.findPivot(x); j == t.Len() {\n\t\treturn t\n\t} else {\n\t\treturn Timeseries{\n\t\t\tXs: t.Xs[:j],\n\t\t\tYs: t.Ys[:j],\n\t\t}\n\t}\n}", "title": "" }, { "docid": "30e0af6b1e208a616208834352910f31", "score": "0.4625636", "text": "func (m *Dense) Subtract(X *Dense) *Dense {\n\treturn Subtract(m, X, m)\n}", "title": "" }, { "docid": "c422b729e950f23d9855599b275f4dda", "score": "0.46242678", "text": "func New(x, y float64) *T {\n\treturn &T{X: x, Y: y}\n}", "title": "" }, { "docid": "c0dc214c6005445b38619b5fafa1e745", "score": "0.46010527", "text": "func (t Timeseries) Last() (x, y float64) {\n\treturn t.At(t.Len() - 1)\n}", "title": "" }, { "docid": "7bb2bb849ffe47c9d09d41ad28a5e107", "score": "0.45921972", "text": "func (r *Regression) Add(x, y float64) {\n\tr.lastCalcFresh = false\n\tr.N++\n\tr.xSum += x\n\tr.ySum += y\n\tr.xxSum += x * x\n\tr.xySum += x * y\n\tr.yySum += y * y\n}", "title": "" }, { "docid": "b515900392731e5d40b2eaa4eb69ae83", "score": "0.4565556", "text": "func newPoints(xs, ys []float64) plotter.XYs {\n\n\t// inputs : xs, ys = slices containing the x and y values respectively\n\n\tpts := make(plotter.XYs, len(xs))\n\tfor i := range pts {\n\t\tpts[i].X = xs[i]\n\t\tpts[i].Y = ys[i]\n\t}\n\n\treturn pts\n}", "title": "" }, { "docid": "ed2ba1405ab67728bac3dbcdba30ccac", "score": "0.45374194", "text": "func (sp Span) Diff() D3 {\n\treturn NewPoint(\n\t\tsp.FullEdge[1][0]-sp.FullEdge[0][0],\n\t\tsp.FullEdge[1][1]-sp.FullEdge[0][1],\n\t\tsp.FullEdge[1][2]-sp.FullEdge[0][2],\n\t)\n}", "title": "" }, { "docid": "1644a0fe88b45cd2a24703274744a3c2", "score": "0.45073807", "text": "func NewDeltaTransformer() *DeltaTransformer {\n\treturn &DeltaTransformer{lastTotals: map[string]float64{}}\n}", "title": "" }, { "docid": "ae3888ac791e31b415f3ecd785527972", "score": "0.4466741", "text": "func Delta(first uint64) func(uint64) uint64 {\n\tkeep := first\n\treturn func(delta uint64) uint64 {\n\t\tv := delta - keep\n\t\tkeep = delta\n\t\treturn v\n\t}\n}", "title": "" }, { "docid": "3bd0ccdd27fcee3d0209408516177509", "score": "0.4410079", "text": "func newLosslessAccum() losslessAccum {\n\treturn losslessAccum{make([]float64, 0)}\n}", "title": "" }, { "docid": "2aa9fcb8beeb3fdf8339c6d7cc0619e4", "score": "0.4384888", "text": "func newLeakyRelu(alpha float64) func(x float64) float64 {\n\treturn func(x float64) float64 {\n\t\tif x > 0 {\n\t\t\treturn x\n\t\t}\n\t\treturn alpha * x\n\t}\n}", "title": "" }, { "docid": "3bd5b1071b30ebe12567839259ce0ed0", "score": "0.43479463", "text": "func (el *Element) CopyNew() *Element {\n\n\tctxCopy := new(Element)\n\n\tctxCopy.value = make([]*ring.Poly, el.Degree()+1)\n\tfor i := range el.value {\n\t\tctxCopy.value[i] = el.value[i].CopyNew()\n\t}\n\n\tctxCopy.CopyParams(el)\n\n\treturn ctxCopy\n}", "title": "" }, { "docid": "9d42d1503ea25ed945da7c76eb6ad81e", "score": "0.43416885", "text": "func NewRegretTarget(f *Feature) *RegretTarget {\n\treturn &RegretTarget{f, make([]float64, f.NCats())}\n}", "title": "" }, { "docid": "986aabd452d9b5192fe8c8c376b36598", "score": "0.43394965", "text": "func (s GeoPointArray) Retain(keep func(x GeoPoint) bool) GeoPointArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "title": "" }, { "docid": "ddff533d88e3a6d9d9b9120cf60dca0e", "score": "0.4312117", "text": "func newLine(y float64, xx []float64, marks []TextMark) textLine {\n\tdxList := make([]float64, len(xx)-1)\n\tfor i := 1; i < len(xx); i++ {\n\t\tdxList[i-1] = xx[i] - xx[i-1]\n\t}\n\treturn textLine{\n\t\tx: xx[0],\n\t\ty: y,\n\t\tdxList: dxList,\n\t\tmarks: marks,\n\t}\n}", "title": "" }, { "docid": "ae621b5097f03189096b2fc478876b09", "score": "0.42756632", "text": "func NewMinus(left, right sql.Expression) *Arithmetic {\n\treturn NewArithmetic(left, right, sqlparser.MinusStr)\n}", "title": "" }, { "docid": "918ee7c1760eabfa3152a72822f5d953", "score": "0.42548108", "text": "func (s GeoPointClassArray) Retain(keep func(x GeoPointClass) bool) GeoPointClassArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "title": "" }, { "docid": "dc96af210a31f465a58a2813ada76594", "score": "0.42534107", "text": "func (p *Provider) RemoveOldPoints(minAllowedTime time.Time) {\n\t// it is guaranteed that prices added to slice in ascending order (entries with greater time comes last)\n\t// so we can just cut off part of the slice\n\tp.pointsLock.Lock()\n\tdefer p.pointsLock.Unlock()\n\tnewStartIndex := len(p.points)\n\tfor i := range p.points {\n\t\tif p.points[i].Time.After(minAllowedTime) {\n\t\t\tnewStartIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tp.points = p.points[newStartIndex:len(p.points)]\n}", "title": "" }, { "docid": "8f7d3beca276790bbf8a06cce2b735ab", "score": "0.4251718", "text": "func newLocationData(x, y int) locationData {\n\treturn locationData{\n\t\tx: x, y: y,\n\t}\n}", "title": "" }, { "docid": "15dace1ea0a7e29e1c29f1d22393d5f5", "score": "0.42447868", "text": "func NewHistory(nMaxIt int, f0 float64, x0 la.Vector, ffcn fun.Sv) (o *History) {\n\to = new(History)\n\to.Ndim = len(x0)\n\to.HistX = append(o.HistX, x0.GetCopy())\n\to.HistU = append(o.HistU, nil)\n\to.HistF = append(o.HistF, f0)\n\to.HistI = append(o.HistI, 0)\n\to.NptsI = 41\n\to.NptsJ = 41\n\to.ffcn = ffcn\n\treturn\n}", "title": "" }, { "docid": "8ea06dfe3d61ef71d12a8bf9a6d96414", "score": "0.42419693", "text": "func NewLogarithmic() Regression {\n\treturn NewLogarithmicWithLogFunc(\n\t\tmath.Log, // natural logarithm\n\t)\n}", "title": "" }, { "docid": "71c96e4b21fdc0ace90bd749398cb1f7", "score": "0.42372328", "text": "func PointNew(x float64, y float64) Point {\n\tvar p Point\n\tp.X = x\n\tp.Y = y\n\treturn p\n}", "title": "" }, { "docid": "f4629f42b7786145eb4cf42c75638fe1", "score": "0.42237145", "text": "func (ts *Timeseries) LastX() int64 {\n\n\tts.orderIndex()\n\n\treturn ts.lastX\n\n}", "title": "" }, { "docid": "b3ade312fa7edde26c9673de68544419", "score": "0.42006326", "text": "func (diffs *Data) PushDel(old text.Line) {\n\tdiffs.Dels = append(diffs.Dels, old)\n}", "title": "" }, { "docid": "82680d63fa3cac7d7554eedb197873f2", "score": "0.41933763", "text": "func (l *Light) Xy(new []float32) error {\n\treturn l.XyContext(context.Background(), new)\n}", "title": "" }, { "docid": "02a9409c3bf86e6047fadd5c9b37f0be", "score": "0.41834056", "text": "func (b *dictionaryBuilder) NewDelta() (indices, delta arrow.Array, err error) {\n\tindicesData, deltaData, err := b.newWithDictOffset(b.deltaOffset)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdefer indicesData.Release()\n\tdefer deltaData.Release()\n\tindices, delta = MakeFromData(indicesData), MakeFromData(deltaData)\n\treturn\n}", "title": "" }, { "docid": "4da149dbec721274f484c0404a95e058", "score": "0.41687748", "text": "func New(x, y int) Point {\n\treturn Point{x, y}\n}", "title": "" }, { "docid": "70f09e2daaaea61ade425ac6fd271de2", "score": "0.41663682", "text": "func newDerivLeakyRelu(alpha float64) func(x float64) float64 {\n\treturn func(x float64) float64 {\n\t\tif x > 0 {\n\t\t\treturn 1\n\t\t}\n\t\treturn alpha\n\t}\n}", "title": "" }, { "docid": "c23feb58d2959672c36959a00decf4fc", "score": "0.41614074", "text": "func (n *Number) rangeDelta() *big.Rat {\n\tp := n.Precision + 1\n\tdenomInt := new(big.Int).Exp(big.NewInt(int64(10)), big.NewInt(int64(p)), nil)\n\tdenomRat, _ := new(big.Rat).SetString(denomInt.String())\n\treturn new(big.Rat).Quo(new(big.Rat).SetInt64(5), denomRat)\n}", "title": "" }, { "docid": "4b20578b18193ee992e26ce5d6c6c7c8", "score": "0.41354048", "text": "func newExtensible(px, py *bigNumber) *extensibleCoordinates {\n\tx := px.copy()\n\ty := py.copy()\n\tz := &bigNumber{1}\n\tt := x.copy()\n\tu := y.copy()\n\n\treturn &extensibleCoordinates{\n\t\tx: x,\n\t\ty: y,\n\t\tz: z,\n\t\tt: t,\n\t\tu: u,\n\t}\n}", "title": "" }, { "docid": "c77074e081f9a63431d3a457504819d9", "score": "0.4125768", "text": "func newtonsRegression(X, Y []float64, epsilon float64, show bool) (float64, float64) {\n\t// define m and b as well as their changes, the magnitude of those changes,\n\t// and the number of iterations counted\n\tvar m, b, deltaM, deltaB, heshMagnitude, iterations float64\n\t// loop until magnitude is lower than epsilon except for the first iteration\n\tfor heshMagnitude > epsilon || iterations == 0 {\n\t\t// calculate changes in m and b as well as calculating their combined magnitude\n\t\tdeltaM, deltaB = stepNewton(X, Y, m, b)\n\t\theshMagnitude = math.Pow((math.Pow(deltaM, 2) + math.Pow(deltaB, 2)), .5)\n\t\tif show {\n\t\t\tfmt.Printf(\"Iteration: %.0f\\t%cm: %.8f\\t%cb: %.8f\\t |%cf|: %.8f\\tm: %.16f\\tb: %.16f\\n\",\n\t\t\t\titerations, 0x0394, deltaM, 0x0394, deltaB, 0x0394, heshMagnitude, m, b)\n\t\t}\n\t\t//why are these signs different. Wolfe Conditions?\n\t\tm = m + deltaM\n\t\tb = b - deltaB\n\t\titerations++\n\t}\n\treturn m, b\n}", "title": "" }, { "docid": "f26accd4a1407c203d20c0191d512799", "score": "0.41114417", "text": "func (l *LinSysFunc) Gradient(x linalg.Vector) linalg.Vector {\n\tvariableTerm := l.normal.Mul(linalg.NewMatrixColumn(x))\n\ttotal := variableTerm.Add(l.constTerm)\n\treturn linalg.Vector(total.Data)\n}", "title": "" }, { "docid": "8b8cb447f5a9f29b77ba4c2c59cb1c29", "score": "0.41055876", "text": "func NewSeriesPoint(name string, points DataPoints, step int) *SeriesPoint {\n\tpoints = points.AlignTimestamp(step).Sort().Deduplicate()\n\treturn &SeriesPoint{\n\t\tname: name,\n\t\tpoints: points,\n\t\tstep: step,\n\t}\n}", "title": "" }, { "docid": "caebf1754da8e17bb95614973a9dc792", "score": "0.41015488", "text": "func newTrigger() trigger { return trigger{epoch: triggerFree} }", "title": "" }, { "docid": "6c07da69287cf378cf169d43cc39a893", "score": "0.40977252", "text": "func (d *Dec) Add(x, y *Dec) *Dec {\n\tdx, dy := maxscale(x, y)\n\tif d != dx {\n\t\td.scale = dx.scale\n\t}\n\td.coef.Add(&dx.coef, &dy.coef)\n\treturn d\n}", "title": "" }, { "docid": "f4e7cbb0a0daa0335424d2051fc36ed7", "score": "0.40973243", "text": "func newRecvHistory() *recvHistory {\n\treturn &recvHistory{\n\t\tranges: utils.NewPacketIntervalList(),\n\t}\n}", "title": "" }, { "docid": "7f8a1301f4046ac8335b7f4141c7594c", "score": "0.40918896", "text": "func (t Timeseries) After(x float64) Timeseries {\n\tif len(t.Xs) != len(t.Ys) {\n\t\tpanic(\"timeseries: Xs and Ys slice length mismatch\")\n\t}\n\n\tif i := t.findPivot(x); i == t.Len() {\n\t\t// After is newer than all the items in the series\n\t\treturn Timeseries{}\n\t} else {\n\t\treturn Timeseries{\n\t\t\tXs: t.Xs[i:],\n\t\t\tYs: t.Ys[i:],\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7af974343325389448dcff001fa86ec", "score": "0.40803617", "text": "func NewSlope(data []byte) Slope {\n\tstrValues := strings.Split(string(data), \"\\n\")\n\theight := len(strValues)\n\twidth := len(strValues[0])\n\treturn Slope{\n\t\tWidth: width,\n\t\tHeight: height,\n\t\tvisibleArea: strValues,\n\t}\n}", "title": "" }, { "docid": "b590e25708c248ba586369adcf29466b", "score": "0.40785217", "text": "func (ts *Timeseries) GetPreviousPoint(x int64) Point {\n\n\tts.Lock()\n\tdefer ts.Unlock()\n\n\tkeys := make([]float64, 0, len(ts.XY))\n\tfor k := range ts.XY {\n\t\tkeys = append(keys, float64(k))\n\t}\n\tsort.Float64s(keys)\n\n\tvar index []int64\n\n\tfor _, k := range keys {\n\t\tindex = append(index, int64(k))\n\t}\n\n\tvar previousx int64\n\tfor n, i := range index {\n\t\tif i == x {\n\t\t\tpreviousx = index[n-1]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar p Point\n\tp.X = previousx\n\tp.Y = ts.XY[previousx]\n\n\treturn p\n}", "title": "" }, { "docid": "18ee29a9a9344c7d30d21a558e1da1bf", "score": "0.40719953", "text": "func New(t time.Time, d time.Duration) Span {\n\tstart := t\n\tend := t.Add(d)\n\tif end.Before(t) {\n\t\tstart, end = end, start\n\t}\n\n\treturn Span{\n\t\tstart: start,\n\t\tend: end,\n\t}\n}", "title": "" }, { "docid": "45a5e832d1bf05eed35e2eb09865b3a5", "score": "0.40668744", "text": "func NewRedo() *Redo {\n\treturn &Redo{}\n}", "title": "" }, { "docid": "72479d5f0cc5bf2d43888ea6a7c6bcdc", "score": "0.40656644", "text": "func (input *DoQueryInput) OnlyNew() *DoQueryInput {\n\tinput.EnsureOptions().OnlyNew = true\n\treturn input\n}", "title": "" }, { "docid": "a7af5eccb5acc3a4d8b526c9c8a3d8e9", "score": "0.4058726", "text": "func (c Circle) Moved(delta Vec) Circle {\n\treturn Circle{\n\t\tCenter: c.Center.Add(delta),\n\t\tRadius: c.Radius,\n\t}\n}", "title": "" }, { "docid": "d43a291f910171d494709c443c5584bf", "score": "0.4045844", "text": "func (p *BarChart) Add(x, y int) { p.xy = append(p.xy, XY{x, y}) }", "title": "" }, { "docid": "d335eb5e39f975af94fa374adcecb87a", "score": "0.40432805", "text": "func New() *Timeseries {\n\n\tts := new(Timeseries)\n\tts.XY = make(map[int64]float64, 0)\n\n\treturn ts\n}", "title": "" }, { "docid": "2288b29b5cb23a2f3d1b8343a531a68e", "score": "0.40374", "text": "func (self *Filter) PrevPoint() *Point{\n return &Point{self.Object.Get(\"prevPoint\")}\n}", "title": "" }, { "docid": "91520fc783006f459a0e9dcfec75ece8", "score": "0.4035376", "text": "func (self *Rope) PreviousPosition() *Point{\n return &Point{self.Object.Get(\"previousPosition\")}\n}", "title": "" }, { "docid": "489048d1ed7503dd613007e72ff6fac1", "score": "0.40329424", "text": "func newFixedNext(vals []refs.Ref) *fixedNext {\n\treturn &fixedNext{\n\t\tvalues: vals,\n\t}\n}", "title": "" }, { "docid": "43a27df5e668e04ce08074389605a743", "score": "0.40326276", "text": "func NewMutable() *MutableTreap {\n\treturn &MutableTreap{}\n}", "title": "" }, { "docid": "d1776341db2ee26cedb7c88c34b56718", "score": "0.40309677", "text": "func NewHistory(name string, interval time.Duration, keep int, tickChannel chan *History) *History {\n\tvar rc = History{\n\t\tticker: time.NewTicker(interval),\n\t\tName: name,\n\t\tCapacity: keep,\n\t\tinterval: interval,\n\t\tentries: list.New(),\n\t}\n\n\t// get initial snapshot\n\ttickChannel <- &rc\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-rc.ticker.C:\n\t\t\t\ttickChannel <- &rc\n\t\t\tcase <-rc.done:\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn &rc\n}", "title": "" }, { "docid": "f4aae8a3e86fe08e5a3e5cbf371caef3", "score": "0.40305054", "text": "func (t *SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement) NewWredSlope(TrafficType E_SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope_TrafficType, DropProbability E_SrlNokiaQos_DropProbability) (*SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.WredSlope == nil {\n\t\tt.WredSlope = make(map[SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope_Key]*SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope)\n\t}\n\n\tkey := SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope_Key{\n\t\tTrafficType: TrafficType,\n\t\tDropProbability: DropProbability,\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.WredSlope[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list WredSlope\", key)\n\t}\n\n\tt.WredSlope[key] = &SrlNokiaInterfaces_Interface_Qos_Output_UnicastQueue_ActiveQueueManagement_WredSlope{\n\t\tTrafficType: TrafficType,\n\t\tDropProbability: DropProbability,\n\t}\n\n\treturn t.WredSlope[key], nil\n}", "title": "" }, { "docid": "edef9bf78d2295a43d6e6c846ff312b0", "score": "0.40182602", "text": "func NewPlusDmWithSrcLen(sourceLength uint, timePeriod int) (indicator *PlusDm, err error) {\n\tind, err := NewPlusDm(timePeriod)\n\n\t// only initialise the storage if there is enough source data to require it\n\tif sourceLength-uint(ind.GetLookbackPeriod()) > 1 {\n\t\tind.Data = make([]float64, 0, sourceLength-uint(ind.GetLookbackPeriod()))\n\t}\n\n\treturn ind, err\n}", "title": "" }, { "docid": "3f482d2273bcc18c6de848b42aaae6aa", "score": "0.40181032", "text": "func (p Point) Displace(delta Point) Point {\n\treturn Point{p.X + delta.X, p.Y + delta.Y}\n}", "title": "" }, { "docid": "5f451edb155673ada76b67e889679366", "score": "0.40136287", "text": "func NewDecorator() *Decorator { return &Decorator{} }", "title": "" }, { "docid": "f917514cbae6ed213b21e067d16e607e", "score": "0.40105218", "text": "func (l *Line3) Delta() Vec3 {\n\treturn l.End.Sub(l.Start)\n}", "title": "" }, { "docid": "1f70120a1d968dec840560fc14f444fe", "score": "0.40035507", "text": "func (lp *Point) LinearDecay() float32 {\n\n\treturn lp.uni.GetPos(pLinearDecay)\n}", "title": "" }, { "docid": "c43effb14089229b7681bbae63494629", "score": "0.39911097", "text": "func (z *Int) New(x int64) *Int {\n\tz.neg = false;\n\tif x < 0 {\n\t\tz.neg = true;\n\t\tx = -x;\n\t}\n\tz.abs = newN(z.abs, uint64(x));\n\treturn z;\n}", "title": "" }, { "docid": "b07228c0d2f829e64e8cf4296f8ad95a", "score": "0.39877802", "text": "func (t Timeseries) Difference() (ret Timeseries) {\n\tif len(t.Xs) != len(t.Ys) {\n\t\tpanic(\"timeseries: Xs and Ys slice length mismatch\")\n\t}\n\n\tif t.Len() < 2 {\n\t\t// We must have at least two elements to difference\n\t\treturn ret\n\t}\n\n\tret = makeTimeseries(t.Len() - 1)\n\tfor i := 0; i < ret.Len(); i++ {\n\t\tret.Ys[i] = t.Ys[i+1] - t.Ys[i]\n\t\tret.Xs[i] = t.Xs[i+1]\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "d60b8e8c596f04a606e5ffc7884ef172", "score": "0.3981464", "text": "func XstatDiff(incoming, old, delta []Xstat) (newOld, newDelta []Xstat) {\n\tfor _, d := range incoming {\n\t\tif n := searchXstat(old, d.Index); n < 0 {\n\t\t\told = append(old, d)\n\t\t\td.Value = 0\n\t\t} else if f := old[n].Value; f > 0 && f < d.Value {\n\t\t\told[n].Value = d.Value\n\t\t\td.Value -= f\n\t\t} else {\n\t\t\told[n].Value = d.Value\n\t\t\td.Value = 0\n\t\t}\n\n\t\tif k := searchXstat(delta, d.Index); k < 0 {\n\t\t\tdelta = append(delta, d)\n\t\t} else {\n\t\t\tdelta[k].Value = d.Value\n\t\t}\n\t}\n\n\treturn old, delta\n}", "title": "" }, { "docid": "7d9501dd850c878dac3b4d35468a4e2c", "score": "0.39788604", "text": "func (t *SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement) NewWredSlope(TrafficType E_SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope_TrafficType, DropProbability E_SrlNokiaQos_DropProbability) (*SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.WredSlope == nil {\n\t\tt.WredSlope = make(map[SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope_Key]*SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope)\n\t}\n\n\tkey := SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope_Key{\n\t\tTrafficType: TrafficType,\n\t\tDropProbability: DropProbability,\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.WredSlope[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list WredSlope\", key)\n\t}\n\n\tt.WredSlope[key] = &SrlNokiaQos_Qos_QueueTemplates_QueueTemplate_ActiveQueueManagement_WredSlope{\n\t\tTrafficType: TrafficType,\n\t\tDropProbability: DropProbability,\n\t}\n\n\treturn t.WredSlope[key], nil\n}", "title": "" }, { "docid": "647e85fdd86971390e165a342272daa9", "score": "0.39609718", "text": "func NewX(xArray []float64) (X, error) {\n\tsize := len(xArray)\n\tif size < 1 {\n\t\treturn X{}, fmt.Errorf(\"Array cannot be empty or nil\")\n\t}\n\n\treturn X{array: xArray, n: size, size: size}, nil\n}", "title": "" }, { "docid": "0eb6f607211cbe3f6e685ad657ae408e", "score": "0.39605203", "text": "func (db *database) newBatch() *leveldb.Batch {\n\treturn new(leveldb.Batch)\n}", "title": "" }, { "docid": "a4337c53cf8db9b59fa7b7e29c67dd44", "score": "0.3955791", "text": "func reverseIterativeNew(old *List) *List {\n var list *List\n\n for old != nil {\n list = &List{old.value, list}\n old = old.next\n }\n\n return list\n}", "title": "" }, { "docid": "909d48710afd78e68eaf8e7523846ed9", "score": "0.39557302", "text": "func NewHistory() History {\n\treturn History{\n\t\tlbuffer: newLBuffer(128),\n\t}\n}", "title": "" }, { "docid": "723fb0c448657612bc0760ffdfc4e099", "score": "0.39545643", "text": "func (ob *Delta) NewCount() int {\n\treturn ob.newCount\n}", "title": "" }, { "docid": "f8172607a99626459edab010fc371fd6", "score": "0.3944733", "text": "func New(value int64 ,exp int32)Decimal{\n\ttemp:=NewFromFloat(float64(value)*math.Pow(10,float64(exp)))\n\treturn temp\n}", "title": "" }, { "docid": "94d47c14c1ce3f715b22f3ffd987062a", "score": "0.39424014", "text": "func NewDefaultPlusDmWithSrcLen(sourceLength uint) (indicator *PlusDm, err error) {\n\tind, err := NewDefaultPlusDm()\n\n\t// only initialise the storage if there is enough source data to require it\n\tif sourceLength-uint(ind.GetLookbackPeriod()) > 1 {\n\t\tind.Data = make([]float64, 0, sourceLength-uint(ind.GetLookbackPeriod()))\n\t}\n\n\treturn ind, err\n}", "title": "" }, { "docid": "b70e559ed399f71222f8c44e30c6593d", "score": "0.39317966", "text": "func NewLagrangePolynomial(x, y []group.Scalar) (l LagrangePolynomial) {\n\tif len(x) != len(y) {\n\t\tpanic(\"lagrange: invalid length\")\n\t}\n\n\tif !areAllDifferent(x) {\n\t\tpanic(\"lagrange: x[i] must be different\")\n\t}\n\n\tif n := len(x); n != 0 {\n\t\tl.x, l.y = make([]group.Scalar, n), make([]group.Scalar, n)\n\t\tfor i := range x {\n\t\t\tl.x[i], l.y[i] = x[i].Copy(), y[i].Copy()\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5f4e49e3ace15ecf2dd0bb17cbff2cc1", "score": "0.3923794", "text": "func (fl Line) New() bool {\n\treturn fl.Op == OpContext || fl.Op == OpAdd\n}", "title": "" }, { "docid": "2f95154173a51cb86dded9e37d1c9c1f", "score": "0.39205045", "text": "func New(p float64) *Model {\n\treturn &Model{\n\t\tP: p,\n\t}\n}", "title": "" }, { "docid": "674347e3ef1ed762e5d1943b61abae05", "score": "0.39174977", "text": "func newLeaf() *Node {\n\tleaf := newNode()\n\tleaf.isLeaf = true\n\treturn leaf\n}", "title": "" }, { "docid": "7a728ad8a1b356412e9414f0932bc6c5", "score": "0.39057454", "text": "func NewDifferential() *Differential {\n\treturn &Differential{\n\t\tmaxDelta: 20.0,\n\t}\n}", "title": "" }, { "docid": "3326c482065032f39cf6c1b618e40003", "score": "0.3903041", "text": "func NewDiff(r1, r2 Relation) Relation {\n\tif r1.Err() != nil {\n\t\t// don't bother building the relation and just return the original\n\t\treturn r1\n\t}\n\tif r2.Err() != nil {\n\t\t// don't bother building the relation and just return the original\n\t\treturn r2\n\t}\n\terr := EnsureSameDomain(Heading(r1), Heading(r2))\n\treturn &diffExpr{r1, r2, err}\n}", "title": "" }, { "docid": "c63e430c6237ab7f50e6a899a6c087f7", "score": "0.3897697", "text": "func (f *Floats) SetCurr(val []float64) {\n\tf.AddToHist(val)\n\tcopy(f.curr, val)\n\tf.norm = floats.Norm(f.curr, 2)\n}", "title": "" }, { "docid": "7142798ae15e45f7acd9dd633bfbb39f", "score": "0.3897164", "text": "func NewDerivedGauge(name, description string) DerivedMetric {\n\tknownMetrics.register(MetricDefinition{\n\t\tName: name,\n\t\tType: \"LastValue\",\n\t\tDescription: description,\n\t})\n\treturn newDerivedGauge(name, description)\n}", "title": "" }, { "docid": "283092438bd83e306dfda34eeb8fa786", "score": "0.38851628", "text": "func ModNew(size int) ModRing {\n\treturn ModRing{size: size}\n}", "title": "" }, { "docid": "e1006c4b9505287af65d207eebc90738", "score": "0.3880889", "text": "func (self *PhysicsNinjaCircle) Oldpos() *Point{\n return &Point{self.Object.Get(\"oldpos\")}\n}", "title": "" }, { "docid": "b7fce4c3650c8435531d8bc100fac746", "score": "0.38714978", "text": "func NewGauge(name, description string, opts ...Options) Metric {\n\tknownMetrics.register(MetricDefinition{\n\t\tName: name,\n\t\tType: \"LastValue\",\n\t\tDescription: description,\n\t})\n\to, dm := createOptions(name, description, opts...)\n\tif dm != nil {\n\t\treturn dm\n\t}\n\treturn newGauge(o)\n}", "title": "" }, { "docid": "8bff72da792cccadd4498a4ebc3a9ec3", "score": "0.38695145", "text": "func New(value int64, exp int) Decimal {\n\treturn Decimal{\n\t\tvalue: value,\n\t\texp: exp,\n\t}\n}", "title": "" }, { "docid": "a9804a0a4e18e5961cccb1634f0072b8", "score": "0.38554484", "text": "func (interp PiecewiseLinear) Gradient(x float64) float64 {\n\tif n := len(interp.xys); n == 1 {\n\t\t// In case a single data point is provided, assume a constant curve\n\t\treturn 0.0\n\t}\n\n\tp1, p2 := interp.xys.Interval(x)\n\n\treturn (p2.Y - p1.Y) / (p2.X - p1.X)\n}", "title": "" }, { "docid": "31bfbfc60e3c5bcd96b462108867b991", "score": "0.38512114", "text": "func New() dawn.Moduler {\n\treturn m\n}", "title": "" }, { "docid": "76982d2f61e02f64add0ff791a9117e0", "score": "0.3850628", "text": "func (d *Dec) Abs(x *Dec) *Dec {\n\td.coef.Abs(&x.coef)\n\tif d != x {\n\t\td.scale = x.scale\n\t}\n\treturn d\n}", "title": "" }, { "docid": "40eb9d76cb00fdc8682598f8a992e22f", "score": "0.3840377", "text": "func New(length int) *History {\n\treturn &History{records: make([]interface{}, length)}\n}", "title": "" }, { "docid": "fea5470d75e5b0db6521663895dbf580", "score": "0.38370028", "text": "func (d DeltaEncoding) LngDelta() DeltaEncoding {\n\treturn d & 0b110000 >> 4\n}", "title": "" }, { "docid": "4eac2bf5de449799c8662f4c1cc8334d", "score": "0.38369045", "text": "func (b *builder) newTemp(t *xtype) *enode {\n\tret := new(enode)\n\tret.t = t\n\tret.v = b.f.StackAlloc(t.size())\n\n\treturn ret\n}", "title": "" }, { "docid": "b9fed80b566ab9c96bc6238a705b986b", "score": "0.3834385", "text": "func (m Measure) Clone() Measure {\n\treturn Measure{\n\t\tName: m.Name,\n\t\tFields: copyFields(m.Fields),\n\t\tTags: copyTags(m.Tags),\n\t}\n}", "title": "" }, { "docid": "e7638a48d4869c2d84dc29de3fd6cf40", "score": "0.3834036", "text": "func (s HelpTermsOfServiceUpdateArray) Retain(keep func(x HelpTermsOfServiceUpdate) bool) HelpTermsOfServiceUpdateArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "title": "" }, { "docid": "250638df48aef2dd3f1111d635a0bc39", "score": "0.3834007", "text": "func UXY() *T {\n\treturn &T{1.0, 1.0}\n}", "title": "" }, { "docid": "4274c1be5ed2e012ed1207fed8ee632f", "score": "0.3833124", "text": "func (z *Hyper) Copy(y *Hyper) *Hyper {\n\tz[0] = new(Real).Copy(y[0])\n\tz[1] = new(Real).Copy(y[1])\n\treturn z\n}", "title": "" }, { "docid": "e2381b5121edaea37e057eb02604bcbd", "score": "0.38313225", "text": "func (v *Vec) NewCross(b *Vec) *Vec {\n\treturn &Vec{\n\t\tv[1]*b[2] - v[2]*b[1],\n\t\tv[2]*b[0] - v[0]*b[2],\n\t\tv[0]*b[1] - v[1]*b[0],\n\t}\n\n}", "title": "" }, { "docid": "60119d1d79ffe37066576e1ac85fc628", "score": "0.3830995", "text": "func NewGradientDescent(opts *NewtonOpts) Minimizer {\n\topts.alpha = 0.5\n\treturn &gradientDescent{*opts}\n}", "title": "" }, { "docid": "287003b5ca8d152a4f90d99ba8d15017", "score": "0.38299453", "text": "func (l *launch) newButtonAnimation() animation { return &buttonAnimation{l: l} }", "title": "" }, { "docid": "0e4b4a228d57b88e83a0e7dbb9d20c99", "score": "0.38294986", "text": "func (d *Dec) Sub(x, y *Dec) *Dec {\n\tdx, dy := maxscale(x, y)\n\tif d != dx {\n\t\td.scale = dx.scale\n\t}\n\td.coef.Sub(&dx.coef, &dy.coef)\n\treturn d\n}", "title": "" }, { "docid": "a9b0e785173700fde8412cb884b1c195", "score": "0.38282308", "text": "func New(expression, label string, min, max int) Expression {\n\treturn Expression{\n\t\tStatement: expression,\n\t\tName: label,\n\t\tMin: min,\n\t\tMax: max,\n\t}\n}", "title": "" }, { "docid": "0e7823902c77573f854b6c75d18067e2", "score": "0.38244963", "text": "func (v *Visitor) NewestCurrent() Target {\n\treturn v.newestCurrent\n}", "title": "" }, { "docid": "fa8f581b2123ceee9891113f0f24c1b4", "score": "0.38211882", "text": "func putDelta(currentPrice float64, strikePrice float64, timeToExpiration float64, volatility float64, interestRate float64) float64 {\n\tvar delta = callDelta(currentPrice, strikePrice, timeToExpiration, volatility, interestRate) - 1\n\n\tif delta == -1 && strikePrice == currentPrice {\n\t\treturn 0\n\t}\n\treturn delta\n}", "title": "" }, { "docid": "e05c55c51a7a433a62ecf2a3715e64e9", "score": "0.38198656", "text": "func funcDelta(ev *evaluator, args Expressions) Value {\n\treturn extrapolatedRate(ev, args[0], false, false)\n}", "title": "" } ]
ec7e5f012f98e4c3dc836eb2c84272df
IntergerUnsignedUpperBound indicates the max uint64 values of different mysql types.
[ { "docid": "124994c72bd574398ddf329abf23ae03", "score": "0.82522166", "text": "func IntergerUnsignedUpperBound(intType byte) uint64 {\n\tswitch intType {\n\tcase mysql.TypeTiny:\n\t\treturn math.MaxUint8\n\tcase mysql.TypeShort:\n\t\treturn math.MaxUint16\n\tcase mysql.TypeInt24:\n\t\treturn mysql.MaxUint24\n\tcase mysql.TypeLong:\n\t\treturn math.MaxUint32\n\tcase mysql.TypeLonglong:\n\t\treturn math.MaxUint64\n\tcase mysql.TypeBit:\n\t\treturn math.MaxUint64\n\tcase mysql.TypeEnum:\n\t\t// enum can have at most 65535 distinct elements\n\t\t// it would be better to use len(FieldType.GetElems()), but we only have a byte type here\n\t\treturn 65535\n\tcase mysql.TypeSet:\n\t\treturn math.MaxUint64\n\tdefault:\n\t\tpanic(\"Input byte is not a mysql type\")\n\t}\n}", "title": "" } ]
[ { "docid": "bfc2a8e9e86ef830c4dfc0f88e997a68", "score": "0.7623932", "text": "func IntergerSignedUpperBound(intType byte) int64 {\n\tswitch intType {\n\tcase mysql.TypeTiny:\n\t\treturn math.MaxInt8\n\tcase mysql.TypeShort:\n\t\treturn math.MaxInt16\n\tcase mysql.TypeInt24:\n\t\treturn mysql.MaxInt24\n\tcase mysql.TypeLong:\n\t\treturn math.MaxInt32\n\tcase mysql.TypeLonglong:\n\t\treturn math.MaxInt64\n\tcase mysql.TypeEnum:\n\t\t// enum can have at most 65535 distinct elements\n\t\t// it would be better to use len(FieldType.GetElems()), but we only have a byte type here\n\t\treturn 65535\n\tdefault:\n\t\tpanic(\"Input byte is not a mysql int type\")\n\t}\n}", "title": "" }, { "docid": "804ac2e2430c60d4e30466a62d800727", "score": "0.66929257", "text": "func MaxUint64(a uint64, b uint64) uint64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "2d3d85ceb8cb860dc459c8026fca4ce6", "score": "0.6675489", "text": "func (b BitDepth) MaxUnsignedValue() uint64 {\n\tif b == 0 {\n\t\treturn 0\n\t}\n\treturn 1<<b - 1\n}", "title": "" }, { "docid": "c61f81def694f20c53efdcecfafcac62", "score": "0.66571265", "text": "func MaxUint64(a, b uint64) uint64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "abdeb1eb79c42ccccbbdf2452b03dd99", "score": "0.65536046", "text": "func maxUInt64(a, b uint64) (max uint64) {\n\tif a >= b {\n\t\tmax = a\n\t} else {\n\t\tmax = b\n\t}\n\treturn max\n}", "title": "" }, { "docid": "53fb2bc084fcd89a936b7f9bcfd6d003", "score": "0.65482956", "text": "func MaxUint(a, b uint) uint {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "53fb2bc084fcd89a936b7f9bcfd6d003", "score": "0.65482956", "text": "func MaxUint(a, b uint) uint {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "53fb2bc084fcd89a936b7f9bcfd6d003", "score": "0.65482956", "text": "func MaxUint(a, b uint) uint {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "d2b0df77cfe98e66f011a705277be88f", "score": "0.6450815", "text": "func (t *UintType) MaxVal() *big.Rat {\n\tbits := t.Bits\n\tswitch bits {\n\tcase 8:\n\t\treturn maxUInt8Val\n\tcase 16:\n\t\treturn maxUInt16Val\n\tcase 32:\n\t\treturn maxUInt32Val\n\tcase 64:\n\t\treturn maxUInt64Val\n\tcase 0:\n\t\tif t.Ptr {\n\t\t\treturn maxUIntPtrVal\n\t\t}\n\t\treturn maxUIntVal\n\t}\n\tlogger.Panic().Msgf(\"unexpected uint bit count: %d\", t.Bits)\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "45ff40c99fb2f9e971340c11731a5187", "score": "0.6386092", "text": "func (_Usdt *UsdtSession) MAXUINT() (*big.Int, error) {\n\treturn _Usdt.Contract.MAXUINT(&_Usdt.CallOpts)\n}", "title": "" }, { "docid": "bdc91df4c58685c0f3ade521c738724e", "score": "0.635334", "text": "func Uintmax(a, b uint) uint {\n\tif a > b {\n\t\treturn a\n\t} else {\n\t\treturn b\n\t}\n}", "title": "" }, { "docid": "9ff831b8afd095689dded7cad315e499", "score": "0.63084126", "text": "func (m *_AdsDataTypeArrayInfo) GetUpperBound() uint32 {\n\tctx := context.Background()\n\t_ = ctx\n\treturn uint32(uint32(m.GetLowerBound()) + uint32(m.GetNumElements()))\n}", "title": "" }, { "docid": "ed312f29d132f4e8959e1ac38c5ef65c", "score": "0.6302117", "text": "func MaxUInt32(x, y uint32) uint32 {\n\n\tif x > y {\n\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "ec1da377b93d0a302a3c77b6dced889f", "score": "0.6244511", "text": "func (_UpgradedStandardToken *UpgradedStandardTokenCaller) MAXUINT(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _UpgradedStandardToken.contract.Call(opts, &out, \"MAX_UINT\")\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": "d5fc5684c07e18d892ce7dbb35cb3f22", "score": "0.6201325", "text": "func (_TetherToken *TetherTokenCaller) MAXUINT(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _TetherToken.contract.Call(opts, &out, \"MAX_UINT\")\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": "19344b580157472b2b0f48fe1536132d", "score": "0.6194711", "text": "func (_Usdt *UsdtCaller) MAXUINT(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Usdt.contract.Call(opts, out, \"MAX_UINT\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9d78b608be7fd1e9bfe002d95b0f0922", "score": "0.6161695", "text": "func (_StandardToken *StandardTokenCaller) MAXUINT(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _StandardToken.contract.Call(opts, &out, \"MAX_UINT\")\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": "00d459a0f5d3653462cd3437ff04db84", "score": "0.61478746", "text": "func (_Usdt *UsdtCallerSession) MAXUINT() (*big.Int, error) {\n\treturn _Usdt.Contract.MAXUINT(&_Usdt.CallOpts)\n}", "title": "" }, { "docid": "f220560dfca1d57871fa31bccb0a718b", "score": "0.6058549", "text": "func (p *RpcServiceImpl) DbUpperboundI64(ctx context.Context, code int64, scope int64, table int64, id int64) (r int32, err error) {\n ret := C.db_upperbound_i64(C.uint64_t(code), C.uint64_t(scope), C.uint64_t(table), C.uint64_t(id))\n return int32(ret), nil\n}", "title": "" }, { "docid": "dd077191d2a7e4125fc06322ccc84613", "score": "0.60384697", "text": "func (v *V) GreaterThanInt64Max() bool {\n\tif v.valueType != jsonparser.Number {\n\t\treturn false\n\t}\n\tif false == v.status.parsed {\n\t\tv.parseNumber()\n\t}\n\tif v.status.negative {\n\t\treturn false\n\t}\n\treturn v.value.u64 > 0x7fffffffffffffff\n}", "title": "" }, { "docid": "ad23fbc28f0019aa3cfbdb90e7c2c7f3", "score": "0.60293996", "text": "func MaxU64(nums ...uint64) uint64 {\n\tif len(nums) == 0 {\n\t\tpanic(\"MaxU64 argument list empty\")\n\t}\n\tmax := nums[0]\n\tfor _, num := range nums {\n\t\tif num > max {\n\t\t\tmax = num\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "f4907bad34de8a9a73f1aba10ae52eba", "score": "0.6026021", "text": "func (eTypedElement *eTypedElementImpl) GetUpperBound() int {\n\treturn eTypedElement.upperBound\n}", "title": "" }, { "docid": "fbb92e6fdc4ac7526a1177dcd5012372", "score": "0.5984432", "text": "func (_TetherToken *TetherTokenSession) MAXUINT() (*big.Int, error) {\n\treturn _TetherToken.Contract.MAXUINT(&_TetherToken.CallOpts)\n}", "title": "" }, { "docid": "93a4bfafe1adea600cf221a6c68c6a38", "score": "0.59730744", "text": "func (_UpgradedStandardToken *UpgradedStandardTokenSession) MAXUINT() (*big.Int, error) {\n\treturn _UpgradedStandardToken.Contract.MAXUINT(&_UpgradedStandardToken.CallOpts)\n}", "title": "" }, { "docid": "b762c83a5b19f5fa715d90181fec0b48", "score": "0.5970705", "text": "func (_StandardToken *StandardTokenSession) MAXUINT() (*big.Int, error) {\n\treturn _StandardToken.Contract.MAXUINT(&_StandardToken.CallOpts)\n}", "title": "" }, { "docid": "1f5abfba6aca455cb935a6bd67f42b08", "score": "0.5963121", "text": "func GetUpperBound(safearray *COMArray, dimension uint32) (int64, error) {\n\treturn int64(0), NotImplementedError\n}", "title": "" }, { "docid": "b77f2cfc14d6ffc35464f2bb4ceeee49", "score": "0.5947834", "text": "func maxU64(x, y uint64) uint64 {\n\tif x < y {\n\t\treturn y\n\t}\n\treturn x\n}", "title": "" }, { "docid": "deda508db422ec37a9830f85599d1540", "score": "0.5947683", "text": "func (s Bitset) Max() uint64 {\n\treturn s.Len()*Byte - 1\n}", "title": "" }, { "docid": "2388375a7d7b9077d74919f5c75fd812", "score": "0.59442204", "text": "func MaxInt64(a ...int64) int64 {\n\tm := a[0]\n\tfor _, v := range a {\n\t\tif v > m {\n\t\t\tm = v\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "52f2f40a3e4a61f6fcae3e41a02554c4", "score": "0.5933311", "text": "func (o GooglePrivacyDlpV2FixedSizeBucketingConfigOutput) UpperBound() GooglePrivacyDlpV2ValueOutput {\n\treturn o.ApplyT(func(v GooglePrivacyDlpV2FixedSizeBucketingConfig) GooglePrivacyDlpV2Value { return v.UpperBound }).(GooglePrivacyDlpV2ValueOutput)\n}", "title": "" }, { "docid": "9162c63b8db6d68228bc70f5ce36fbce", "score": "0.59054023", "text": "func MaxUint8(a, b uint8) uint8 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "6e206f6a34cfe4e79a03d20701e58a4b", "score": "0.58375186", "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": "a4c3cc71282a8d28de9bbe8b5968bb0e", "score": "0.5826899", "text": "func (b BitDepth) UnsignedValue(val uint64) uint64 {\n\tmax := b.MaxUnsignedValue()\n\tif val > max {\n\t\treturn max\n\t}\n\treturn val\n}", "title": "" }, { "docid": "cbe2763ef790a37f4527f25f792ccbe6", "score": "0.58113724", "text": "func UMax2(a, b uint) uint {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "55ef9af80d01281f8e797d9f30a74650", "score": "0.5795004", "text": "func (i Int) Uint64() (_ uint64, ok bool) {\n\tif i.big != nil {\n\t\tx, acc := bigintToUint64(i.big)\n\t\tif acc != big.Exact {\n\t\t\treturn // inexact\n\t\t}\n\t\treturn x, true\n\t}\n\tif i.small < 0 {\n\t\treturn // inexact\n\t}\n\treturn uint64(i.small), true\n}", "title": "" }, { "docid": "8ff839df9391c4968c4d977735eb4872", "score": "0.57703257", "text": "func Uint(valuea ...interface{}) uint64 {\n\tvalue := valuea[0]\n\tswitch val := value.(type) {\n\tcase int:\n\t\treturn uint64(val)\n\tcase int8:\n\t\treturn uint64(val)\n\tcase int16:\n\t\treturn uint64(val)\n\tcase int32:\n\t\treturn uint64(val)\n\tcase int64:\n\t\treturn uint64(val)\n\tcase uint:\n\t\treturn uint64(val)\n\tcase uint8:\n\t\treturn uint64(val)\n\tcase uint16:\n\t\treturn uint64(val)\n\tcase uint32:\n\t\treturn uint64(val)\n\tcase uint64:\n\t\treturn uint64(val)\n\tcase float32:\n\t\treturn uint64(val + 0.5)\n\tcase float64:\n\t\treturn uint64(val + 0.5)\n\tcase time.Time:\n\t\treturn uint64(val.Unix())\n\tcase bool:\n\t\tif val == true {\n\t\t\treturn uint64(1)\n\t\t}\n\t\treturn uint64(0)\n\tdefault:\n\t\ti, _ := strconv.ParseFloat(String(value), 64)\n\t\treturn uint64(i + 0.5)\n\t}\n}", "title": "" }, { "docid": "0a140d1a52f7c87863fae2f68e77f9de", "score": "0.5753382", "text": "func BoundUnt(val, min, max uint) uint {\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": "15ff8e33807fda8c723cfd052cee73bd", "score": "0.57530093", "text": "func (p *RpcServiceImpl) DbUpperboundI64(ctx context.Context, code int64, scope int64, table int64, id int64) (r int32, err error) {\n\tret := C.db_upperbound_i64(C.uint64_t(code), C.uint64_t(scope), C.uint64_t(table), C.uint64_t(id))\n\treturn int32(ret), nil\n}", "title": "" }, { "docid": "6789b586a31e624e6aaf18123b5d36e7", "score": "0.5743785", "text": "func (_TokenNetwork *TokenNetworkCaller) MAX_SAFE_UINT256(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TokenNetwork.contract.Call(opts, out, \"MAX_SAFE_UINT256\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4bfaca0fcaa55e52cc9653796b68cd10", "score": "0.57224995", "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": "d0b47ec4eb61c116096a2bafa98cfad9", "score": "0.5722105", "text": "func (i Int) Uint64() uint64 {\n\tif !i.i.IsUint64() {\n\t\tpanic(\"Uint64() out of bounds\")\n\t}\n\treturn i.i.Uint64()\n}", "title": "" }, { "docid": "cef163c60343b7accf2f87c269bf1f99", "score": "0.5711276", "text": "func (m *PaxosMsg) SizeUpperLimit() int {\n\tl := 8 * 2\n\tl += 16 * 12\n\tl += 16\n\tl += len(m.Value)\n\treturn l\n}", "title": "" }, { "docid": "ac7327446524fbeede06e3620c19b858", "score": "0.5703833", "text": "func (si *StampIssuer) BucketUpperBound() uint32 {\n\treturn 1 << (si.Depth() - si.BucketDepth())\n}", "title": "" }, { "docid": "f9686a8886fb4f34b017a1b894e3ca9e", "score": "0.5702604", "text": "func (_UpgradedStandardToken *UpgradedStandardTokenCallerSession) MAXUINT() (*big.Int, error) {\n\treturn _UpgradedStandardToken.Contract.MAXUINT(&_UpgradedStandardToken.CallOpts)\n}", "title": "" }, { "docid": "2d08fddf433767cb23abca5e313f941d", "score": "0.5701109", "text": "func MaxU8(nums ...uint8) uint8 {\n\tif len(nums) == 0 {\n\t\tpanic(\"MaxU8 argument list empty\")\n\t}\n\tmax := nums[0]\n\tfor _, num := range nums {\n\t\tif num > max {\n\t\t\tmax = num\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "dd9583cf9c7dc1a42065513de4118591", "score": "0.56909496", "text": "func (i BigInt) Uint64() uint64 {\n\tif !i.i.IsUint64() {\n\t\tpanic(\"Uint64() out of bounds\")\n\t}\n\treturn i.i.Uint64()\n}", "title": "" }, { "docid": "a7e4909af8e2596cccb815bdebf11145", "score": "0.5685925", "text": "func uint64Constraint(object interface{}) uint64 {\n\tswitch value := object.(type) {\n\tcase uint:\n\t\treturn uint64(value)\n\tcase uint8:\n\t\treturn uint64(value)\n\tcase uint16:\n\t\treturn uint64(value)\n\tcase uint32:\n\t\treturn uint64(value)\n\tcase uint64:\n\t\treturn uint64(value)\n\tcase int:\n\t\treturn uint64(value)\n\tcase int8:\n\t\treturn uint64(value)\n\tcase int16:\n\t\treturn uint64(value)\n\tcase int32:\n\t\treturn uint64(value)\n\tcase int64:\n\t\treturn uint64(value)\n\tdefault:\n\t\tErr(fmt.Sprintf(\"Expected integer type, but instead got: %T.\", value), List(value))\n\t}\n\treturn 0 // Should be uncalled since Err will raise an exception.\n}", "title": "" }, { "docid": "85f31f47125c1229bbb70fb805792378", "score": "0.5682302", "text": "func (o GooglePrivacyDlpV2FixedSizeBucketingConfigResponseOutput) UpperBound() GooglePrivacyDlpV2ValueResponseOutput {\n\treturn o.ApplyT(func(v GooglePrivacyDlpV2FixedSizeBucketingConfigResponse) GooglePrivacyDlpV2ValueResponse {\n\t\treturn v.UpperBound\n\t}).(GooglePrivacyDlpV2ValueResponseOutput)\n}", "title": "" }, { "docid": "cb4a77f1309b26d5ae0ca9f8d9ca9d6f", "score": "0.5682058", "text": "func (v Uint) Uint64() uint64 {\n\tif !v.Valid() {\n\t\treturn 0\n\t}\n\treturn v.uint\n}", "title": "" }, { "docid": "f1cd7e73dd0f25fac56b0c23ae2d8e53", "score": "0.5678516", "text": "func (o GooglePrivacyDlpV2FixedSizeBucketingConfigPtrOutput) UpperBound() GooglePrivacyDlpV2ValuePtrOutput {\n\treturn o.ApplyT(func(v *GooglePrivacyDlpV2FixedSizeBucketingConfig) *GooglePrivacyDlpV2Value {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.UpperBound\n\t}).(GooglePrivacyDlpV2ValuePtrOutput)\n}", "title": "" }, { "docid": "8328f7d6ec1f78ae44fdf86a6376cea1", "score": "0.5678104", "text": "func Int64Max(a, b int64) int64 {\n\tif b > a {\n\t\treturn b\n\t}\n\treturn a\n}", "title": "" }, { "docid": "c0896df238cb8289d912390eaac877a0", "score": "0.5670051", "text": "func (r *RangeBox) Max() uint32 {\n\treturn r.max\n}", "title": "" }, { "docid": "b5b4d308570d1a2ede5db15b18dbb78d", "score": "0.56679416", "text": "func (_TetherToken *TetherTokenCallerSession) MAXUINT() (*big.Int, error) {\n\treturn _TetherToken.Contract.MAXUINT(&_TetherToken.CallOpts)\n}", "title": "" }, { "docid": "5a9e4374d47a2091b9f09abb6bf608a4", "score": "0.5659638", "text": "func (_StandardToken *StandardTokenCallerSession) MAXUINT() (*big.Int, error) {\n\treturn _StandardToken.Contract.MAXUINT(&_StandardToken.CallOpts)\n}", "title": "" }, { "docid": "68841e78cf400bdb10e09a3581ca7b0e", "score": "0.56576574", "text": "func MaxInt64(a, b int64) int64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "68841e78cf400bdb10e09a3581ca7b0e", "score": "0.56576574", "text": "func MaxInt64(a, b int64) int64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "f66f2363679d75ceeab78a76f071a75f", "score": "0.5655315", "text": "func Max(n ...int) (max int) {\n\tmax = math.MinInt64\n\tfor _, val := range n {\n\t\tif val > max {\n\t\t\tmax = val\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "76eb82be433295e876aacc13b67f0bd7", "score": "0.56540996", "text": "func Max(x, y uint) uint {\n\tif x > y {\n\t\treturn x\n\t}\n\treturn y\n}", "title": "" }, { "docid": "3e25d5fecdd67cd1e110a1417c23cedd", "score": "0.5637469", "text": "func MaxUint32(a, b uint32) uint32 {\n\tif a >= b {\n\t\treturn a\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "e17ac5e2923da94cdee987951b2d137f", "score": "0.5636258", "text": "func MaxUint32(a, b uint32) uint32 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "99910dc04f6d9475c21b2a1b9722c3a8", "score": "0.56312954", "text": "func Uint256Max() Uint256 {\n\treturn Uint256{\n\t\tLo: Uint128Max(),\n\t\tHi: Uint128Max(),\n\t}\n}", "title": "" }, { "docid": "4df504df6719d9338c94d42770ba1c8c", "score": "0.56275314", "text": "func opUI8Max(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\tinpV0 := ReadUI8(fp, expr.Inputs[0])\n\tinpV1 := ReadUI8(fp, expr.Inputs[1])\n\tif inpV1 > inpV0 {\n\t\tinpV0 = inpV1\n\t}\n\tWriteUI8(GetFinalOffset(fp, expr.Outputs[0]), inpV0)\n}", "title": "" }, { "docid": "be399deab6341c78a097ab2fffc81ee7", "score": "0.56249756", "text": "func (V VEB) Max() int { return V.max }", "title": "" }, { "docid": "3569370a0bd2488ba68a3b12d741f23e", "score": "0.56219786", "text": "func (v *VarImp) Uint64() uint64 {\n\treturn qn_conv.Uint64(v.Val())\n}", "title": "" }, { "docid": "f852f7014117f76f75d80e2a39bfc4d1", "score": "0.5621", "text": "func (p *RpcServiceClient) DbUpperboundI64(ctx context.Context, code int64, scope int64, table int64, id int64) (r int32, err error) {\n var _args24 RpcServiceDbUpperboundI64Args\n _args24.Code = code\n _args24.Scope = scope\n _args24.Table = table\n _args24.ID = id\n var _result25 RpcServiceDbUpperboundI64Result\n if err = p.c.Call(ctx, \"db_upperbound_i64\", &_args24, &_result25); err != nil {\n return\n }\n return _result25.GetSuccess(), nil\n}", "title": "" }, { "docid": "41dd9d7456fffb82b67335f9be943a78", "score": "0.5617311", "text": "func MaxInt64(a int64, b int64) int64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "c7d5da0274fb2970008ad0c46b1e20ab", "score": "0.56101894", "text": "func SetUInt64Max(max uint64) UInt64Option {\n\treturn func(iOpts *UInt64Options) {\n\t\tiOpts.max = max\n\t}\n}", "title": "" }, { "docid": "a8eee3b0d1df6cd363bf792c6b6735db", "score": "0.5609306", "text": "func op_i64_max(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromI64(int64(math.Max(float64(ReadI64(fp, inp1)), float64(ReadI64(fp, inp2)))))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "title": "" }, { "docid": "b173d98e01b8735da3de43782a5afbb2", "score": "0.56039625", "text": "func (_TokenNetwork *TokenNetworkSession) MAX_SAFE_UINT256() (*big.Int, error) {\n\treturn _TokenNetwork.Contract.MAX_SAFE_UINT256(&_TokenNetwork.CallOpts)\n}", "title": "" }, { "docid": "f1a0f1c8005551ea3d42262af3d91055", "score": "0.5600363", "text": "func (p *RpcServiceClient) DbUpperboundI64(ctx context.Context, code int64, scope int64, table int64, id int64) (r int32, err error) {\n var _args20 RpcServiceDbUpperboundI64Args\n _args20.Code = code\n _args20.Scope = scope\n _args20.Table = table\n _args20.ID = id\n var _result21 RpcServiceDbUpperboundI64Result\n if err = p.c.Call(ctx, \"db_upperbound_i64\", &_args20, &_result21); err != nil {\n return\n }\n return _result21.GetSuccess(), nil\n}", "title": "" }, { "docid": "bdac6bcdce7ea82bdeedb4f67e818920", "score": "0.5576667", "text": "func (r RNG) Uintn(max uint) uint {\n\treturn uint(r.Uint64n(uint64(max)))\n}", "title": "" }, { "docid": "e479e6a258d57496135cefbd10a5c82c", "score": "0.55663186", "text": "func (v *Value) Max() int {\n\tmax := math.MinInt64\n\tfor _, face := range v.Faces {\n\t\tif face > max {\n\t\t\tmax = face\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "03fad1486c1d60ec0d63643f739a339f", "score": "0.555831", "text": "func NewUpperBoundUnit(id, name, unit string, precision int, max float64) *Unit {\n\treturn NewBoundedUnit(id, name, unit, precision, -math.MaxFloat64, max)\n}", "title": "" }, { "docid": "efbbddcb05b461330659ad42243010fc", "score": "0.55530804", "text": "func MaxInt(args ...int) int {\n\tval := args[0]\n\tfor _, v := range args {\n\t\tif !intLessThan(v, val) {\n\t\t\tval = v\n\t\t}\n\t}\n\treturn val\n}", "title": "" }, { "docid": "5e5e317bd7ee2facfb3e978fa78598b6", "score": "0.5553013", "text": "func MaxInt() int {\n\tvar v int\n\tv = 1\n\tvar bits uint = 1\n\tfor {\n\t\tv <<= 1\n\t\tif v < 0 {\n\t\t\tbreak\n\t\t}\n\t\tbits++\n\t}\n\n\treturn (1 << bits) - 1\n}", "title": "" }, { "docid": "7f22f336efb7e1e5d640e8de8125ce97", "score": "0.55505896", "text": "func MaxInt8(a, b int8) int8 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}", "title": "" }, { "docid": "505689c0ff79fac93d5b82dfc8125deb", "score": "0.55487835", "text": "func (f *fragment) maxUnsigned(tx Tx, filter *Row, bitDepth uint64) (max int64, count uint64, err error) {\n\tcount = filter.Count()\n\tfor i := int(bitDepth - 1); i >= 0; i-- {\n\t\trow, err := f.row(tx, uint64(bsiOffsetBit+i))\n\t\tif err != nil {\n\t\t\treturn max, count, err\n\t\t}\n\t\trow = row.Intersect(filter)\n\n\t\tcount = row.Count()\n\t\tif count > 0 {\n\t\t\tmax += (1 << uint(i))\n\t\t\tfilter = row\n\t\t} else if i == 0 {\n\t\t\tcount = filter.Count()\n\t\t}\n\t}\n\treturn max, count, nil\n}", "title": "" }, { "docid": "8632447ef07761a3a4589cae2dd1d8f2", "score": "0.55428463", "text": "func Uint64(i interface{}) (uint64, error) {\n\tswitch v := i.(type) {\n\tcase nil:\n\t\treturn 0, nil\n\tcase string:\n\t\tn, err := strconv.ParseUint(v, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn uint64(n), nil\n\tcase int:\n\t\tif v < 0 {\n\t\t\treturn 0, ErrNegativeNumber\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int64:\n\t\tif v < 0 {\n\t\t\treturn 0, ErrNegativeNumber\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int32:\n\t\tif v < 0 {\n\t\t\treturn 0, ErrNegativeNumber\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int16:\n\t\tif v < 0 {\n\t\t\treturn 0, ErrNegativeNumber\n\t\t}\n\t\treturn uint64(v), nil\n\tcase int8:\n\t\tif v < 0 {\n\t\t\treturn 0, ErrNegativeNumber\n\t\t}\n\t\treturn uint64(v), nil\n\tcase uint:\n\t\treturn uint64(v), nil\n\tcase uint64:\n\t\treturn uint64(v), nil\n\tcase uint32:\n\t\treturn uint64(v), nil\n\tcase uint16:\n\t\treturn uint64(v), nil\n\tcase uint8:\n\t\treturn uint64(v), nil\n\tdefault:\n\t\treturn 0, ErrInvalidType\n\t}\n}", "title": "" }, { "docid": "f786d381bd4c4ccda2d0def4d1a723f3", "score": "0.55270135", "text": "func SafeUint64(i interface{}) uint64 {\n\tif i == nil {\n\t\treturn 0\n\t}\n\tv := reflect.ValueOf(i)\n\tswitch v.Kind() {\n\tcase reflect.Int32:\n\t\treturn uint64(i.(int32))\n\tcase reflect.Int64:\n\t\treturn uint64(i.(int64))\n\tcase reflect.Int16:\n\t\treturn uint64(i.(int16))\n\tcase reflect.Uint32:\n\t\treturn uint64(i.(uint32))\n\tcase reflect.Uint64:\n\t\treturn uint64(i.(uint64))\n\tcase reflect.Uint16:\n\t\treturn uint64(i.(uint16))\n\tcase reflect.Slice:\n\t\tr, err := strconv.ParseUint(string(i.([]byte)), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn r\n\t}\n\tpanic(\"Safeuint64 unsupported type : \" + v.Kind().String())\n}", "title": "" }, { "docid": "1f6b0ad70582064605ff62c9f4b6bdb1", "score": "0.55251664", "text": "func (c Column) Uint64() uint64 {\n\tif len(c.Value) != 8 {\n\t\treturn binary.LittleEndian.Uint64(c.Value)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "844d041eea7e12f95167ee7c2654fc63", "score": "0.55181575", "text": "func (a *SpreadUIntAgg) ValueUInt() uint64 {\n\treturn a.max - a.min\n}", "title": "" }, { "docid": "0a4d94d546d711762fb9ddb6ce0d89d9", "score": "0.55151767", "text": "func (o SqlPartitionSettingsOutput) PartitionUpperBound() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlPartitionSettings) interface{} { return v.PartitionUpperBound }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "079040cc2ad9116cd3627b81d455cc30", "score": "0.5509263", "text": "func (r RNG) Uint64n(max uint64) uint64 {\n\tbad := 0xffffffffffffffff - 0xffffffffffffffff%max\n\tx := r.Uint64()\n\tfor x > bad {\n\t\tx = r.Uint64()\n\t}\n\treturn x % max\n}", "title": "" }, { "docid": "38c6097b3383064d8243bd0f567164ec", "score": "0.55030495", "text": "func max(a, b int) uint {\n\tif a < 0 {\n\t\ta = 0\n\t}\n\tif b > a {\n\t\ta = b\n\t}\n\treturn uint(a)\n}", "title": "" }, { "docid": "03123d252a03487abdf0747af6c30301", "score": "0.55004764", "text": "func (v Value) Uint64() uint64 { return v.u64 }", "title": "" }, { "docid": "90cb15f69ce7c271a5f577d90f1e65bf", "score": "0.54926735", "text": "func Uint64(reply interface{}, err error) (uint64, error) {\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tswitch reply := reply.(type) {\n\tcase int64:\n\t\tif reply < 0 {\n\t\t\treturn 0, errNegativeInt(reply)\n\t\t}\n\t\treturn uint64(reply), nil\n\tcase []byte:\n\t\tn, err := strconv.ParseUint(string(reply), 10, 64)\n\t\treturn n, err\n\tcase nil:\n\t\treturn 0, ErrNil\n\tcase Error:\n\t\treturn 0, reply\n\t}\n\treturn 0, fmt.Errorf(\"redigo: unexpected type for Uint64, got type %T\", reply)\n}", "title": "" }, { "docid": "3126439f305c154b1ab59123b88061b8", "score": "0.5492527", "text": "func MaxInt(vals ...int) (r int) {\n\tr = vals[0]\n\n\tfor _, v := range vals {\n\t\tif v > r {\n\t\t\tr = v\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b0bbdb87a8c03e066875d91a77d84ac1", "score": "0.54915774", "text": "func TimeMaxUsefulUpperBound() time.Time {\n\treturn time.Unix(1<<63-62135596801, 999999999)\n}", "title": "" }, { "docid": "369157d64081f97536a41f87eda1542c", "score": "0.54893893", "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": "42622cbae7ab15c447b1555203851b36", "score": "0.5478471", "text": "func (t *EncoderTest) TestUint64(c *C) {\n\tq, err := pg.FormatQ(\"?\", uint64(math.MaxUint64))\n\tc.Assert(err, IsNil)\n\tc.Assert(string(q), Equals, \"-1\")\n}", "title": "" }, { "docid": "0d05db2ffde422e0c2e0d1918ad5471a", "score": "0.54757714", "text": "func (o SqlPartitionSettingsPtrOutput) PartitionUpperBound() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v *SqlPartitionSettings) interface{} {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PartitionUpperBound\n\t}).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8cb7a93d3e51c4f7267c551b02f8be8f", "score": "0.54754704", "text": "func MaxInt(i, i2 Int) Int {\n\treturn Int{max(i.BigInt(), i2.BigInt())}\n}", "title": "" }, { "docid": "82547052b0d8a071aa649ce9c90c78cb", "score": "0.5471692", "text": "func (d Int32) MaxValue() int32 {\n\treturn math.MaxInt32\n}", "title": "" }, { "docid": "9c8d0f49c877c5b724deb69c19bfe784", "score": "0.54639137", "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": "7a6b118b521d00298c12c77c95d22eb0", "score": "0.5462288", "text": "func opI64Max(expr *CXExpression, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromI64(int64(math.Max(float64(ReadI64(fp, inp1)), float64(ReadI64(fp, inp2)))))\n\tWriteMemory(GetFinalOffset(fp, out1), outB1)\n}", "title": "" }, { "docid": "72017ca8904e37eedf44723aee27e78b", "score": "0.546187", "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": "5a4599a1cae73efc0c0ca263518e57e2", "score": "0.54616785", "text": "func MaxInt(a, b int) int { return max(a, b) }", "title": "" }, { "docid": "f09553c27171980585c0a1975a4320cb", "score": "0.5460516", "text": "func Max(ns ...uint32) (n uint32) {\n\tif len(ns) > 0 {\n\t\tn = ns[0]\n\t}\n\tfor i := 1; i < len(ns); i++ {\n\t\tif ns[i] > n {\n\t\t\tn = ns[i]\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "25619b92b9ed12b391afee85110158f9", "score": "0.5455326", "text": "func getuint64(val *querypb.BindVariable) (uv uint64, status int) {\n\tbv, err := sqltypes.BindVariableToValue(val)\n\tif err != nil {\n\t\treturn 0, QROutOfRange\n\t}\n\tv, err := bv.ToCastUint64()\n\tif err != nil {\n\t\treturn 0, QROutOfRange\n\t}\n\treturn v, QROK\n}", "title": "" }, { "docid": "5f81045a8a853cd76af59a9f559dcda0", "score": "0.5454571", "text": "func Max(v uint, vs ...uint) uint {\n\treturn helpy.Max(v, vs...)\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "afaae8237b24da919bf417e249a2a646", "score": "0.0", "text": "func (in *GenericBootstrapConfig) DeepCopyInto(out *GenericBootstrapConfig) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Status.DeepCopyInto(&out.Status)\n}", "title": "" } ]
[ { "docid": "048b519d3e53b62f5b4bc1ff775f4ced", "score": "0.8202259", "text": "func (in *DeepCopyNonPtr) DeepCopyInto(out *DeepCopyNonPtr) {\n\t*out = in.DeepCopy()\n}", "title": "" }, { "docid": "fb2bc55c9644bc3872b478b5ab8d7aeb", "score": "0.81697565", "text": "func (in *Inner) DeepCopyInto(out *Inner) {\n\t*out = *in\n}", "title": "" }, { "docid": "333b67297f915fbee5d71b6723b8df18", "score": "0.81422216", "text": "func (in *Info) DeepCopyInto(out *Info) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4ea2f4990a9bb9f5d6f1b1c433545996", "score": "0.81188923", "text": "func (in *ModelArgReset) DeepCopyInto(out *ModelArgReset) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "96d1a99b123fa716566b1547c6bfe7a4", "score": "0.81035995", "text": "func (obj *LiteObject) DeepCopyInto(out *LiteObject) {\n\t*out = *obj\n\treturn\n}", "title": "" }, { "docid": "fd68cc5c404d65fa5c03c64949665da7", "score": "0.80897367", "text": "func (in *Size) DeepCopyInto(out *Size) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e4ac2b7c08ccfa219135f2b5b252450", "score": "0.8087213", "text": "func (in *Struct) DeepCopyInto(out *Struct) {\n\t*out = *in\n}", "title": "" }, { "docid": "21a4dc0bd810e7ad7e5a1989d07e436c", "score": "0.80673146", "text": "func (in *Input) DeepCopyInto(out *Input) {\n\t*out = *in\n}", "title": "" }, { "docid": "04fac3bead17f8bd4b26c8360aacb580", "score": "0.8063649", "text": "func (in *BuildArg) DeepCopyInto(out *BuildArg) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "41475496763ae4276f7015dae332c81a", "score": "0.8058077", "text": "func (in *MX) DeepCopyInto(out *MX) {\n\t*out = *in\n}", "title": "" }, { "docid": "301de8be1b8a048ae01b54dbd4ec7aa8", "score": "0.8049101", "text": "func (in *BadDeepCopyNonPtrVal) DeepCopyInto(out *BadDeepCopyNonPtrVal) {\n\t*out = *in\n}", "title": "" }, { "docid": "009b9d06dd3a7a9ef7a22f9ad17d0c6f", "score": "0.80470526", "text": "func (in *InMemoryNodeBehaviour) DeepCopyInto(out *InMemoryNodeBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "c8589014e3e027a9879b6e278ef45d69", "score": "0.8038561", "text": "func (in *InMemoryVMBehaviour) DeepCopyInto(out *InMemoryVMBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "8348d262057586a69eb15a3f217f5d4a", "score": "0.8034583", "text": "func (in *OIDCTestOutput) DeepCopyInto(out *OIDCTestOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9f8b8a23dcf73e6ba1910cae5ae70043", "score": "0.8034077", "text": "func (in *Value) DeepCopyInto(out *Value) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "684ea75f78edffb1a05bfdf42b6f1191", "score": "0.802035", "text": "func (in *CVSS) DeepCopyInto(out *CVSS) {\n\t*out = *in\n}", "title": "" }, { "docid": "092f9a09ed2586f4ce7cf6247a8fd452", "score": "0.8003537", "text": "func (in *Foo) DeepCopyInto(out *Foo) {\n\t*out = *in\n}", "title": "" }, { "docid": "24891879c3796e85357de6b6d3986a17", "score": "0.8001523", "text": "func (in *Empty) DeepCopyInto(out *Empty) {\n\t*out = *in\n}", "title": "" }, { "docid": "0e6b303fbadbc23c61dcee39495476b2", "score": "0.79985833", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n}", "title": "" }, { "docid": "25d6f8a1ae7844ca27c7b513f87a921c", "score": "0.7996636", "text": "func (in *BadDeepCopyNoReturn) DeepCopyInto(out *BadDeepCopyNoReturn) {\n\t*out = *in\n}", "title": "" }, { "docid": "2fe17056672126433e92688bbc6c7532", "score": "0.7990644", "text": "func (in *GroupVersionForDiscovery) DeepCopyInto(out *GroupVersionForDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2fe17056672126433e92688bbc6c7532", "score": "0.7990644", "text": "func (in *GroupVersionForDiscovery) DeepCopyInto(out *GroupVersionForDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "727fb0034d4fb617ed30df9887e7dc97", "score": "0.7990549", "text": "func (in *MongoDBVersionInitContainer) DeepCopyInto(out *MongoDBVersionInitContainer) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "720f714354a151aefd95f8d577d05159", "score": "0.7986762", "text": "func (in *DatabaseNode) DeepCopyInto(out *DatabaseNode) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.7975989", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "885731d95003e6f9b658d976bd38dfdc", "score": "0.7975989", "text": "func (in *SSH) DeepCopyInto(out *SSH) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "980fdef1bb7b3518843e5cde9e15cf96", "score": "0.7975752", "text": "func (in *SyscallFromSourceType) DeepCopyInto(out *SyscallFromSourceType) {\n\t*out = *in\n}", "title": "" }, { "docid": "b82493d02142c9938c5c7522f25a0f62", "score": "0.7972119", "text": "func (in *ExternalNode) DeepCopyInto(out *ExternalNode) {\n\t*out = *in\n}", "title": "" }, { "docid": "883e1692748cbc47dc1ea579a21b83cd", "score": "0.79713833", "text": "func (in *CommandAndArgs) DeepCopyInto(out *CommandAndArgs) {\n\t*out = *in\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "dc25f670b9ab6635efd1a7f707841646", "score": "0.79695636", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "f25f31a63ac38b2bdf2dd3d75c7198b7", "score": "0.7965354", "text": "func (in *Struct_Empty) DeepCopyInto(out *Struct_Empty) {\n\t*out = *in\n}", "title": "" }, { "docid": "a1257b8c0770e028b3129ab02b3a1911", "score": "0.79643905", "text": "func (in *TokenInfo) DeepCopyInto(out *TokenInfo) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "be82863d9978b104237d2472cfdf3614", "score": "0.79602563", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "d71a08ebbf7d7d2bc0c2ca3727a341a9", "score": "0.7954875", "text": "func (in *OCIContentID) DeepCopyInto(out *OCIContentID) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "91822354dc9c7c5522209b70c93931f1", "score": "0.7953985", "text": "func (in *InMemoryEtcdBehaviour) DeepCopyInto(out *InMemoryEtcdBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "fa34b9e99dc2aa3d5c6d52b55d95ad90", "score": "0.795201", "text": "func (in *CephBackupSource) DeepCopyInto(out *CephBackupSource) {\n\t*out = *in\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.7945754", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7346345b0a2d608dba2995dc744da425", "score": "0.7943555", "text": "func (in *SomeStruct) DeepCopyInto(out *SomeStruct) {\n\t*out = *in\n}", "title": "" }, { "docid": "76b62ad159adac94ccfe3c31208085ec", "score": "0.7940948", "text": "func (in *BadDeepCopyIntoHasResult) DeepCopyInto(out *BadDeepCopyIntoHasResult) {\n\t*out = *in\n}", "title": "" }, { "docid": "a62d2491925276d66a89576351b7bdb4", "score": "0.7940367", "text": "func (in *Replicas) DeepCopyInto(out *Replicas) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4e89e189987c500586638a1efac2583d", "score": "0.79361534", "text": "func (in *ExportOutput) DeepCopyInto(out *ExportOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c98ffe01606a65bbc00e878445f7020d", "score": "0.7935412", "text": "func (in *TestBuiltins) DeepCopyInto(out *TestBuiltins) {\n\t*out = *in\n}", "title": "" }, { "docid": "01a4a6fa60275bc00731594653970844", "score": "0.793288", "text": "func (in *ObjectStorageTLSSpec) DeepCopyInto(out *ObjectStorageTLSSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "035c57e5b867d4ec15daf30d08d7d69e", "score": "0.7930392", "text": "func (in *GoRuntime) DeepCopyInto(out *GoRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "9a15d89300bd7975c23b970cd7e97f3d", "score": "0.7928252", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a9e1cd549f537d2c2cb2f2e1216d7225", "score": "0.79280424", "text": "func (in *PoolMirroringInfo) DeepCopyInto(out *PoolMirroringInfo) {\n\t*out = *in\n\tif in.Peers != nil {\n\t\tin, out := &in.Peers, &out.Peers\n\t\t*out = make([]PeersSpec, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fbe65d613a92e723394102e79c892716", "score": "0.79195696", "text": "func (in *RootComponent) DeepCopyInto(out *RootComponent) {\n\t*out = *in\n}", "title": "" }, { "docid": "14b2f553637143403dbe2897add2909f", "score": "0.79188687", "text": "func (in *QueryParameter) DeepCopyInto(out *QueryParameter) {\n\t*out = *in\n}", "title": "" }, { "docid": "cdbdcac5268c93872566a1dbbf202b5d", "score": "0.7917624", "text": "func (in *CISBenchmarkResult) DeepCopyInto(out *CISBenchmarkResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "259a9547b7102244862bca671083e2c9", "score": "0.7916506", "text": "func (in *FabricInfo) DeepCopyInto(out *FabricInfo) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c9a56664a293f4158a6788eb506cc8cc", "score": "0.79161125", "text": "func (in *Selection) DeepCopyInto(out *Selection) {\n\t*out = *in\n\tif in.UseAllDevices != nil {\n\t\tin, out := &in.UseAllDevices, &out.UseAllDevices\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.Devices != nil {\n\t\tin, out := &in.Devices, &out.Devices\n\t\t*out = make([]Device, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]corev1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6eb2a79b125d469ab0fe3abf20a19b8e", "score": "0.79125196", "text": "func (in *Delete) DeepCopyInto(out *Delete) {\n\t*out = *in\n}", "title": "" }, { "docid": "ade6ed73a501a383b2bb84cc3c832913", "score": "0.79082656", "text": "func (in *Struct_Primitives_Alias) DeepCopyInto(out *Struct_Primitives_Alias) {\n\t*out = *in\n}", "title": "" }, { "docid": "515c63092873c3f63bfdc531f088f552", "score": "0.7902317", "text": "func (in *Pull) DeepCopyInto(out *Pull) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "88b5329b28f6cf5edf471f0d6150c481", "score": "0.78990966", "text": "func (in *GithubConfigTestOutput) DeepCopyInto(out *GithubConfigTestOutput) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "765f173f5ddb0038fd7e0370a824e0f6", "score": "0.7898786", "text": "func (in *JenkinsFile) DeepCopyInto(out *JenkinsFile) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "eff0622caffaed25ba5e7aa86ed9abd3", "score": "0.7897443", "text": "func (in *ImageSourcePath) DeepCopyInto(out *ImageSourcePath) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "118ba62bc171ec4213ad230b73af2117", "score": "0.7897345", "text": "func (in *Struct_Primitives) DeepCopyInto(out *Struct_Primitives) {\n\t*out = *in\n}", "title": "" }, { "docid": "1f709093026f70cab533f03d4a5d6cf0", "score": "0.7897118", "text": "func (in *CephRestoreSource) DeepCopyInto(out *CephRestoreSource) {\n\t*out = *in\n}", "title": "" }, { "docid": "beef70b1916b67776c8e84225599dd8e", "score": "0.7895959", "text": "func (in *ImageDigest) DeepCopyInto(out *ImageDigest) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d6832563794ae47600e6a6296fa86ecc", "score": "0.7895805", "text": "func (in *BuildOutput) DeepCopyInto(out *BuildOutput) {\n\t*out = *in\n\tif in.To != nil {\n\t\tin, out := &in.To, &out.To\n\t\t*out = new(corev1.ObjectReference)\n\t\t**out = **in\n\t}\n\tif in.PushSecret != nil {\n\t\tin, out := &in.PushSecret, &out.PushSecret\n\t\t*out = new(corev1.LocalObjectReference)\n\t\t**out = **in\n\t}\n\tif in.ImageLabels != nil {\n\t\tin, out := &in.ImageLabels, &out.ImageLabels\n\t\t*out = make([]ImageLabel, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a4bf692f8f6286e7819a448a72dcfad0", "score": "0.7895415", "text": "func (in *PhaseInfo) DeepCopyInto(out *PhaseInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "564805f323fbadde55f67e46f75ac865", "score": "0.7894315", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n}", "title": "" }, { "docid": "06a3b3f38b6ff0617d4968300458ec9c", "score": "0.789431", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3dbac8b7d13838a94e731bbe00f460d5", "score": "0.7893283", "text": "func (in *OS) DeepCopyInto(out *OS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a032549f561910a66098977e33380961", "score": "0.78928816", "text": "func (in *AllocatableModeling) DeepCopyInto(out *AllocatableModeling) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "09c4dcffa19a3bab59ed150ba5969941", "score": "0.78927106", "text": "func (in *Member) DeepCopyInto(out *Member) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0bba3a2f1f7e5d69a617aaccc6d25c00", "score": "0.7891777", "text": "func (in *MongoDBVersionExporter) DeepCopyInto(out *MongoDBVersionExporter) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23fa856144960771fdedc08d73a6334e", "score": "0.7891238", "text": "func (in *ProxySQLVersionProxysql) DeepCopyInto(out *ProxySQLVersionProxysql) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.7889831", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "54696db3f914ef5236271dad05b38ac8", "score": "0.7889451", "text": "func (in *BadDeepCopyIntoNoParams) DeepCopyInto(out *BadDeepCopyIntoNoParams) {\n\t*out = *in\n}", "title": "" }, { "docid": "153a99a016a77679a9b35b2afac0ce73", "score": "0.78857577", "text": "func (in *CloneFrom) DeepCopyInto(out *CloneFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "23db226639df1ec5bfce6ed220d55ed3", "score": "0.7885264", "text": "func (in *Port) DeepCopyInto(out *Port) {\n\t*out = *in\n}", "title": "" }, { "docid": "31bc84415f77e0c156fdfbb6ac723966", "score": "0.788405", "text": "func (in *Gitlab) DeepCopyInto(out *Gitlab) {\n\t*out = *in\n}", "title": "" }, { "docid": "d16087e4b89eb0ac20119d490e0084d1", "score": "0.78797835", "text": "func (in *CISBenchmarkSelection) DeepCopyInto(out *CISBenchmarkSelection) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "98a5fec2843f9518f6f2fd61b9fa9c74", "score": "0.7875915", "text": "func (in *BinaryBuildSource) DeepCopyInto(out *BinaryBuildSource) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "39fc6ad3b33696c5a382172839f602c4", "score": "0.78755045", "text": "func (in *Mysql) DeepCopyInto(out *Mysql) {\n\t*out = *in\n}", "title": "" }, { "docid": "0b41c52e9da3545832627f75cd1798b0", "score": "0.78719705", "text": "func (in *InMemoryAPIServerBehaviour) DeepCopyInto(out *InMemoryAPIServerBehaviour) {\n\t*out = *in\n\tout.Provisioning = in.Provisioning\n}", "title": "" }, { "docid": "d04effc735adc59932f839adb9a5fcca", "score": "0.78713626", "text": "func (in *Target) DeepCopyInto(out *Target) {\n\t*out = *in\n}", "title": "" }, { "docid": "1bdb8740dd406f99e36d269dd6e9990b", "score": "0.78712523", "text": "func (in *Custom) DeepCopyInto(out *Custom) {\n\t*out = *in\n\tout.Expr = in.Expr\n\treturn\n}", "title": "" }, { "docid": "13d7c5f7535e75d698e840b9cfd16ae3", "score": "0.7867813", "text": "func (in *Expr) DeepCopyInto(out *Expr) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "6fc5d0984d8c73e612ab3ac8df3a35b3", "score": "0.7867336", "text": "func (in *Identity) DeepCopyInto(out *Identity) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d7c370bb74cf9022ffb0b1644dac2baa", "score": "0.786481", "text": "func (in *Mongo) DeepCopyInto(out *Mongo) {\n\t*out = *in\n}", "title": "" }, { "docid": "23a65f1f8246d0a6155b7ec686aafb86", "score": "0.7864268", "text": "func (in *Revision) DeepCopyInto(out *Revision) {\n\t*out = *in\n}", "title": "" }, { "docid": "60f2c810f51132cc5295ed2b35dac8ab", "score": "0.7864215", "text": "func (in *Action) DeepCopyInto(out *Action) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5186b8d1bfd3abf2fb983694f27e4aed", "score": "0.7863321", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "126b737579f2263a795ede56342e2f86", "score": "0.7862278", "text": "func (in *Feed) DeepCopyInto(out *Feed) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "547474ce2a12555364e84de325180903", "score": "0.7861857", "text": "func (in *FilesFrom) DeepCopyInto(out *FilesFrom) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "d6c78efb8990c0e87750c6aa88b98475", "score": "0.786148", "text": "func (in *RedisVersionCoordinator) DeepCopyInto(out *RedisVersionCoordinator) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "dbff322ba9de4ebcad7d38fc96f4c23d", "score": "0.7861228", "text": "func (in *MySQLVersionCoordinator) DeepCopyInto(out *MySQLVersionCoordinator) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "65ae9948c541da496f7ad198975ba2f5", "score": "0.7860243", "text": "func (in *MigrationSpec) DeepCopyInto(out *MigrationSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "4f4fcbb079c2abc9452aac73d8b653a1", "score": "0.7860037", "text": "func (in *Body) DeepCopyInto(out *Body) {\n\t*out = *in\n\tif in.KV != nil {\n\t\tin, out := &in.KV, &out.KV\n\t\t*out = make(map[string]Any, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.Byte != nil {\n\t\tin, out := &in.Byte, &out.Byte\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.JSON != nil {\n\t\tin, out := &in.JSON, &out.JSON\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\treturn\n}", "title": "" }, { "docid": "a70b2ea5a026ffdba657063ccc91180f", "score": "0.7855658", "text": "func (in *PodInfo) DeepCopyInto(out *PodInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "848fd773e0c97792e3685f1559eefa69", "score": "0.78512", "text": "func (in *TestRunner) DeepCopyInto(out *TestRunner) {\n\t*out = *in\n\tout.Teamcity = in.Teamcity\n\tout.Gitlab = in.Gitlab\n}", "title": "" }, { "docid": "d291b0f5d54262faa3ca288a73994a94", "score": "0.7849717", "text": "func (in *JavaRuntime) DeepCopyInto(out *JavaRuntime) {\n\t*out = *in\n}", "title": "" }, { "docid": "170ddf2575c007ccb3fc0068b04801fb", "score": "0.7848102", "text": "func (in *MemoryGibPerVcpuObservation) DeepCopyInto(out *MemoryGibPerVcpuObservation) {\n\t*out = *in\n}", "title": "" }, { "docid": "ba403d912e2353789e17a5a9a9c4fa3b", "score": "0.7847872", "text": "func (in OptionalNodeSelector) DeepCopyInto(out *OptionalNodeSelector) {\n\t{\n\t\tin := &in\n\t\t*out = make(OptionalNodeSelector, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "466efa302ee30b818f18f14131212f2b", "score": "0.78478134", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" } ]
62240f4de2ef99507f871f60356dbab1
getLayerValue returns the value for neurons in layer for all samples
[ { "docid": "cf1187a42a82dcba36ca65524df2102b", "score": "0.7172855", "text": "func getLayerValue(nn neuralNetwork, output [][]float32, layer int) [][]float32 {\n\tvar z [][]float32\n\tfor sample, _ := range output {\n\t\tvar layer_value []float32\n\t\tfor _, neuron := range nn.layers[layer].neurons {\n\t\t\tlayer_value = append(layer_value, neuron.z[sample])\n\t\t}\n\t\tz = append(z, layer_value)\n\t}\n\treturn z\n}", "title": "" } ]
[ { "docid": "e2db21d2618f2c553c2b6c6023410257", "score": "0.5434347", "text": "func getLayerOutput(nn neuralNetwork, prime [][]float32, layer int) [][]float32 {\n\tvar layerOutputs [][]float32\n\tfor sample, _ := range prime {\n\t\tvar layerOutput []float32\n\t\tfor neuron := 0; neuron < nn.architecture[layer-1]; neuron++ {\n\t\t\tlayerOutput = append(layerOutput, nn.layers[layer-1].neurons[neuron].outputs[sample])\n\t\t}\n\t\tlayerOutputs = append(layerOutputs, layerOutput)\n\t}\n\treturn layerOutputs\n}", "title": "" }, { "docid": "632cef48adb13e4820703f142224c913", "score": "0.52523094", "text": "func countValuesInLayer(layer []string, value string) (result int) {\n\tfor _, p := range layer {\n\t\tif p == value {\n\t\t\tresult++\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9294b46388d5aaf9a6972a07d35bc962", "score": "0.5119151", "text": "func (h *H1D) Value(idx int) float64 {\n\treturn h.bins[idx].sw\n}", "title": "" }, { "docid": "404cc34dd62abe0e7d6a37ec8b3631e6", "score": "0.49682564", "text": "func (c *FloatSliceConverter) Value() []float64 {\n\treturn c.value\n}", "title": "" }, { "docid": "ce252860fe8564b8f43c86762e94ad4a", "score": "0.49351293", "text": "func (h *H1D) Value(i int) float64 {\n\treturn h.Binning.Bins[i].SumW()\n}", "title": "" }, { "docid": "0797d74722cf08c68820b7cbdf08b1da", "score": "0.4915623", "text": "func (w Weight) Value() float64 {\n\treturn w.value\n}", "title": "" }, { "docid": "de67841ae566936e01b19cfe88521029", "score": "0.4899375", "text": "func (m *DummyModel) Value() float32 {\n\treturn m.value\n}", "title": "" }, { "docid": "f4b98a41b44960b72c82421871c35fcf", "score": "0.48316517", "text": "func getLayerWeights(nn neuralNetwork, layer int) [][]float32 {\n\tvar weights [][]float32\n\tfor _, neuron := range nn.layers[layer].neurons {\n\t\tvar weightLayer []float32\n\t\tweightLayer = append(weightLayer, neuron.weights...)\n\t\tweights = append(weights, weightLayer)\n\t}\n\treturn weights\n}", "title": "" }, { "docid": "5fa6cf495be41f93b7f3b5e991bfef5e", "score": "0.47717848", "text": "func (i *sliceIter) Value() Metric {\n\treturn i.val\n}", "title": "" }, { "docid": "147eeb956569da76dca4d60ecc9d2251", "score": "0.47316435", "text": "func (o VirtualNodeSpecListenerOutlierDetectionIntervalOutput) Value() pulumi.IntOutput {\n\treturn o.ApplyT(func(v VirtualNodeSpecListenerOutlierDetectionInterval) int { return v.Value }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "447c7bfe652ad2d2e0f5a7150a6bfa3f", "score": "0.4682432", "text": "func softmaxLayer(nn neuralNetwork, layer int) {\n\tvar values []float32\n\tfor neuron := 0; neuron < nn.architecture[layer]; neuron++ {\n\t\tvalues = append(values, nn.layers[layer].neurons[neuron].value)\n\t}\n\touput := softmax(values)\n\tfor neuron := 0; neuron < nn.architecture[layer]; neuron++ {\n\t\tnn.layers[layer].neurons[neuron].output = ouput[neuron]\n\t}\n}", "title": "" }, { "docid": "ad95be662e43d8d3769105d98553e9cd", "score": "0.46798718", "text": "func (v *Vector) Value(val spn.VarSet) float64 { return v.Soft(val, \"soft\") }", "title": "" }, { "docid": "009ca0c0438bc03bba01ca4fdab0721c", "score": "0.4668783", "text": "func (o FeatureVariationOutput) Value() FeatureVariationValueOutput {\n\treturn o.ApplyT(func(v FeatureVariation) FeatureVariationValue { return v.Value }).(FeatureVariationValueOutput)\n}", "title": "" }, { "docid": "72771f87fbd2d0b495b2090e33c1c3fc", "score": "0.46438015", "text": "func (f Feature) Value() (driver.Value, error) {\n\treturn f.Geometry.Value()\n}", "title": "" }, { "docid": "6e8003984528520b7e6df3e013f4bca9", "score": "0.4607735", "text": "func (r *grassAsciiRaster) Value(index int) float64 {\n\treturn float64(r.data[index])\n}", "title": "" }, { "docid": "62cccd45ff9ca5277c4e9171683694dd", "score": "0.46062884", "text": "func (d *Data) computeValue(pt dvid.Vector3d, ctx storage.Context, keyF KeyFunc, cache *ValueCache) ([]byte, error) {\n\tdb, err := datastore.GetOrderedKeyValueDB(d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvaluesPerElement := d.Properties.Values.ValuesPerElement()\n\tbytesPerValue, err := d.Properties.Values.BytesPerValue()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbytesPerVoxel := valuesPerElement * bytesPerValue\n\n\t// Allocate an empty block.\n\tblockSize, ok := d.BlockSize().(dvid.Point3d)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Data %q does not have a 3d block size\", d.DataName())\n\t}\n\tnx := blockSize[0]\n\tnxy := nx * blockSize[1]\n\temptyBlock := d.BackgroundBlock()\n\n\tpopulateF := func(key []byte) ([]byte, error) {\n\t\tserializedData, err := db.Get(ctx, key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar deserializedData []byte\n\t\tif serializedData == nil || len(serializedData) == 0 {\n\t\t\tdeserializedData = emptyBlock\n\t\t} else {\n\t\t\tdeserializedData, _, err = dvid.DeserializeData(serializedData, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Unable to deserialize block: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn deserializedData, nil\n\t}\n\n\t// For the given point, compute surrounding lattice points and retrieve values.\n\tneighbors := d.neighborhood(pt)\n\tvar valuesI int32\n\tfor _, voxelCoord := range neighbors.coords {\n\t\tdeserializedData, _, err := cache.Get(keyF(voxelCoord), populateF)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tblockPt := voxelCoord.PointInChunk(blockSize).(dvid.Point3d)\n\t\tblockI := blockPt[2]*nxy + blockPt[1]*nx + blockPt[0]\n\t\t//fmt.Printf(\"Block %s (%d) len %d -> Neighbor %s (buffer %d, len %d)\\n\",\n\t\t//\tblockPt, blockI, len(blockData), voxelCoord, valuesI, len(neighbors.values))\n\t\tcopy(neighbors.values[valuesI:valuesI+bytesPerVoxel], deserializedData[blockI:blockI+bytesPerVoxel])\n\t\tvaluesI += bytesPerVoxel\n\t}\n\n\t// Perform trilinear interpolation on the underlying data values.\n\tunsupported := func() error {\n\t\treturn fmt.Errorf(\"DVID cannot retrieve images with arbitrary orientation using %d channels and %d bytes/channel\",\n\t\t\tvaluesPerElement, bytesPerValue)\n\t}\n\tvar value []byte\n\tswitch valuesPerElement {\n\tcase 1:\n\t\tswitch bytesPerValue {\n\t\tcase 1:\n\t\t\tif d.Interpolable {\n\t\t\t\tinterpValue := trilinearInterpUint8(neighbors.xd, neighbors.yd, neighbors.zd, []uint8(neighbors.values))\n\t\t\t\tvalue = []byte{byte(interpValue)}\n\t\t\t} else {\n\t\t\t\tvalue = []byte{nearestNeighborUint8(neighbors.xd, neighbors.yd, neighbors.zd, []uint8(neighbors.values))}\n\t\t\t}\n\t\tcase 2:\n\t\t\tfallthrough\n\t\tcase 4:\n\t\t\tfallthrough\n\t\tcase 8:\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\treturn nil, unsupported()\n\t\t}\n\tcase 4:\n\t\tswitch bytesPerValue {\n\t\tcase 1:\n\t\t\tvalue = make([]byte, 4, 4)\n\t\t\tfor c := 0; c < 4; c++ {\n\t\t\t\tchannelValues := make([]uint8, 8, 8)\n\t\t\t\tfor i := 0; i < 8; i++ {\n\t\t\t\t\tchannelValues[i] = uint8(neighbors.values[i*4+c])\n\t\t\t\t}\n\t\t\t\tif d.Interpolable {\n\t\t\t\t\tinterpValue := trilinearInterpUint8(neighbors.xd, neighbors.yd, neighbors.zd, channelValues)\n\t\t\t\t\tvalue[c] = byte(interpValue)\n\t\t\t\t} else {\n\t\t\t\t\tvalue[c] = byte(nearestNeighborUint8(neighbors.xd, neighbors.yd, neighbors.zd, channelValues))\n\t\t\t\t}\n\t\t\t}\n\t\tcase 2:\n\t\t\tfallthrough\n\t\tdefault:\n\t\t\treturn nil, unsupported()\n\t\t}\n\tdefault:\n\t}\n\n\treturn value, nil\n}", "title": "" }, { "docid": "56491f21904e6837f7632851a95c63b9", "score": "0.45594376", "text": "func (iter LogicalNetworkCollectionIterator) Value() LogicalNetwork {\n\tif !iter.page.NotDone() {\n\t\treturn LogicalNetwork{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "title": "" }, { "docid": "9667b71455fa95bd3a701f30b2536d7a", "score": "0.45088765", "text": "func (g UndirectedLayers) Layer(l int) graph.Undirected { return g[l] }", "title": "" }, { "docid": "c2b598b89e9af1afde96b694450889ec", "score": "0.44969264", "text": "func (AttackLayer) Values() []AttackLayer {\n\treturn []AttackLayer{\n\t\t\"NETWORK\",\n\t\t\"APPLICATION\",\n\t}\n}", "title": "" }, { "docid": "a06fb29f5370ab5a84bf0d7eeb6df46f", "score": "0.4481297", "text": "func getValue(numberDataPoint pmetric.NumberDataPoint) (float64, error) {\n\tswitch numberDataPoint.ValueType() {\n\tcase pmetric.NumberDataPointValueTypeInt:\n\t\treturn float64(numberDataPoint.IntValue()), nil\n\tcase pmetric.NumberDataPointValueTypeDouble:\n\t\treturn numberDataPoint.DoubleValue(), nil\n\tdefault:\n\t\treturn 0.0, errors.New(\"unsupported metric value type\")\n\t}\n}", "title": "" }, { "docid": "5f7f8202e072d336cb15d14390af1d16", "score": "0.4450602", "text": "func (s *EWMStd) Value() (float64, error) {\n\tif !s.IsSetCore() {\n\t\treturn 0, errors.New(\"Core is not set\")\n\t}\n\n\tvariance, err := s.variance.Value()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"error retrieving 2nd moment\")\n\t}\n\treturn math.Sqrt(variance), nil\n}", "title": "" }, { "docid": "2eb6067420f8cc5450bb7217cbc161ea", "score": "0.44467166", "text": "func testNetworkOutputNodesLayerLevel(t *testing.T, network *NeuralNetwork) {\r\n\t// Validate the level of output nodes.\r\n\tmaxLevel := LayerLevelInit\r\n\tfor i, outputNode := range network.OutputNodes {\r\n\t\tlevelValid, err := outputNode.Level()\r\n\t\tif err != nil {\r\n\t\t\tt.Error(\"error while validating the layer levels of output nodes\")\r\n\t\t\tt.Error(\"outputNode.Level()\")\r\n\t\t\tt.Error(err)\r\n\t\t}\r\n\t\tif maxLevel == LayerLevelInit {\r\n\t\t\tmaxLevel = levelValid\r\n\t\t\t// Agnostic. Neither true nor false.\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tif maxLevel != levelValid {\r\n\t\t\tt.Error(\"the layer level is invalid for [\" + string(i) + \"]th output node\")\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "5869722d22a41102c4341528128a29fa", "score": "0.44379458", "text": "func (v *Rolling) Value() float64 {\n\treturn v.c.Value()\n}", "title": "" }, { "docid": "b0bd48072ba370fcaf8889672e261084", "score": "0.44284016", "text": "func (o *UsageAttributionAggregatesBody) GetValue() float64 {\n\tif o == nil || o.Value == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.Value\n}", "title": "" }, { "docid": "64358d59f3091184065e2334762611de", "score": "0.4426409", "text": "func (o *ClusterResourceTotal) GetValue() float64 {\n\tif o == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\n\treturn o.Value\n}", "title": "" }, { "docid": "02ddb23114d9b538ca884c8044bd70f2", "score": "0.44247064", "text": "func (c Color) Value() int { return c.v & 0xffffff }", "title": "" }, { "docid": "a8cd1d2c2b8fdd10bde75fde545bdb28", "score": "0.44075984", "text": "func (lrs *LinearRegressionSeries) GetValue(index int) (x, y float64) {\n\tif lrs.InnerSeries == nil {\n\t\treturn\n\t}\n\tif lrs.m == 0 && lrs.b == 0 {\n\t\tlrs.computeCoefficients()\n\t}\n\toffset := lrs.GetOffset()\n\teffectiveIndex := Math.MinInt(index+offset, lrs.InnerSeries.Len())\n\tx, y = lrs.InnerSeries.GetValue(effectiveIndex)\n\ty = (lrs.m * lrs.normalize(x)) + lrs.b\n\treturn\n}", "title": "" }, { "docid": "314e412e676086ed11f4be6ad7bc9e34", "score": "0.4405139", "text": "func (i *FloatIterator) Value() float64 {\n\tvs := i.Values[0]\n\treturn vs.Value(i.i)\n}", "title": "" }, { "docid": "543f2ba4bf12d7e2ec21ee1703087e28", "score": "0.43990612", "text": "func (n *Neuron) sumErrLayer(nextLayer *Layer) float64 {\n\tsum := 0.0\n\tfor i := 0; i < nextLayer.Length; i++ {\n\t\tsum += n.connections[i].weight * nextLayer.neurons[i].gradient\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "504f2b3c2b923c0657a9362d4401e259", "score": "0.43724805", "text": "func (output *output) Value() uint64 {\n\treturn output.value\n}", "title": "" }, { "docid": "33d91a0e249083b6c3ddb7355491b420", "score": "0.43682662", "text": "func (node *OpBasedDagNode) GetValue() cid.Cid {\n\treturn *node.nodeOp.Value\n}", "title": "" }, { "docid": "c7a6384ba71879822b4da9cddbe7c21c", "score": "0.43569028", "text": "func (c *computeCell) Value() (value int) {\n\treturn c.valueFunc()\n}", "title": "" }, { "docid": "0c65f11b9a867f7e0bf7ad47692b2aba", "score": "0.43530348", "text": "func (LayerType) Values() []LayerType {\n\treturn []LayerType{\n\t\t\"aws-flow-ruby\",\n\t\t\"ecs-cluster\",\n\t\t\"java-app\",\n\t\t\"lb\",\n\t\t\"web\",\n\t\t\"php-app\",\n\t\t\"rails-app\",\n\t\t\"nodejs-app\",\n\t\t\"memcached\",\n\t\t\"db-master\",\n\t\t\"monitoring-master\",\n\t\t\"custom\",\n\t}\n}", "title": "" }, { "docid": "878a61dd7d8dab5d00f749dd41808e88", "score": "0.43353972", "text": "func (g *Grid) getVal(row, col int) int {\n\treturn g.g[((row * g.size) + col)].neighbour\n}", "title": "" }, { "docid": "6fdb5cc14741be07856b694a58f3be4b", "score": "0.43173912", "text": "func (node *Node) computeLightValue(value uint64) uint8 {\n\treturn uint8((value * 100) / 255)\n}", "title": "" }, { "docid": "63b7b68eec1210d16a1fd5d53782a2ba", "score": "0.43171406", "text": "func (d *Double) Value() float64 { return d.value }", "title": "" }, { "docid": "a0e5a038700f608e5d756b7c86adb584", "score": "0.43170318", "text": "func (iter NetworkCollectionIterator) Value() Network {\n\tif !iter.page.NotDone() {\n\t\treturn Network{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "title": "" }, { "docid": "e1ec16ff5d6386cf4e32eb6fa33f488d", "score": "0.43144113", "text": "func (ps *PlayerState) SampleValues() (float32, float32) {\n\treturn ps.leftChannel, ps.rightChannel\n}", "title": "" }, { "docid": "fdd156e6d9cc949f3670bef1d40b536e", "score": "0.43102637", "text": "func (r *Raster) Value(row, column int) float64 {\n\tif column >= 0 && column < r.Columns && row >= 0 && row < r.Rows {\n\t\t// what is the cell number?\n\t\tcellNum := row*r.Columns + column\n\t\treturn r.rd.Value(cellNum)\n\t} else {\n\t\tif !r.reflectAtBoundaries {\n\t\t\treturn r.rd.NoData()\n\t\t}\n\n\t\t// if you get to this point, it is reflected at the edges\n\t\tif row < 0 {\n\t\t\trow = -row - 1\n\t\t}\n\t\tif row >= r.Rows {\n\t\t\trow = r.Rows - (row - r.Rows) - 1\n\t\t}\n\t\tif column < 0 {\n\t\t\tcolumn = -column - 1\n\t\t}\n\t\tif column >= r.Columns {\n\t\t\tcolumn = r.Columns - (column - r.Columns) - 1\n\t\t}\n\t\tif column >= 0 && column < r.Columns && row >= 0 && row < r.Rows {\n\t\t\treturn r.Value(row, column)\n\t\t} else {\n\t\t\t// it was too off grid to be reflected.\n\t\t\treturn r.rd.NoData()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b546b6f158fc306d07730f9db06a80c", "score": "0.43034416", "text": "func (o *ClusterResourceTotal) GetValueOk() (*float64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Value, true\n}", "title": "" }, { "docid": "4775af9f1fd52b16a040e42c13cbba60", "score": "0.42958313", "text": "func (g Graph) Value(id uint32) (uint32, error) {\n\tif int(id) >= len(g.units) {\n\t\treturn 0, fmt.Errorf(\"index out of bounds\")\n\t}\n\treturn g.units[id].value(), nil\n}", "title": "" }, { "docid": "4c27ac97f0f9262ba5dfbb9c543073bc", "score": "0.4295109", "text": "func (it *Iterator) value() *float64 {\n\treturn &it.data[it.current]\n}", "title": "" }, { "docid": "bd855be12c06c26606dc728281b48d30", "score": "0.4294365", "text": "func (c *Counts) Value(label uint64) int {\n\tif c.m == nil {\n\t\treturn 0\n\t}\n\tc.RLock()\n\tdefer c.RUnlock()\n\treturn c.m[label]\n}", "title": "" }, { "docid": "3fc8bd1c7e28d20de575d859f2e92c34", "score": "0.42919755", "text": "func sigmoidLayer(nn neuralNetwork, layer int) {\n\tfor neuron := 0; neuron < nn.architecture[layer]; neuron++ {\n\t\tnn.layers[layer].neurons[neuron].output = sigmoid(nn.layers[layer].neurons[neuron].value)\n\t\tnn.layers[layer].neurons[neuron].outputs = append(nn.layers[layer].neurons[neuron].outputs, nn.layers[layer].neurons[neuron].output)\n\t}\n}", "title": "" }, { "docid": "033e745b2d20d26a2538086d363be508", "score": "0.42885756", "text": "func testNetEvaluateBothNeuralValueAndNeuralLevel(t *testing.T, network *NeuralNetwork, inputs []NeuralValue) (\r\n\toutputs []NeuralNode, maxLevelUpperBound int, err error,\r\n) {\r\n\tconst levelBase = LayerLevelInit + 1 // 0 is returned for (maxLevelUpperBound int) when there is an error.\r\n\r\n\t// Validate the input.\r\n\tif len(inputs) != network.NumInputNodes-network.NumBiasNodes {\r\n\t\tt.Error(\"testNetEvaluateTwo()\")\r\n\t\tt.Error(\"the number of inputs does not match to that of this neural network\")\r\n\t\treturn nil, levelBase, errors.New(\"the number of inputs does not match to that of this neural network\")\r\n\t}\r\n\r\n\t// Init.\r\n\tnetwork.IsEvaluatedWell = false\r\n\tnodes, err := testClearAll(t, network)\r\n\tif err != nil {\r\n\t\tt.Error(\"testNetEvaluateTwo()\")\r\n\t\tt.Error(err)\r\n\t\treturn nil, levelBase, err\r\n\t}\r\n\r\n\t// All input nodes are evaluated here.\r\n\tfor _, node := range network.InputNodes[:network.NumBiasNodes] {\r\n\t\tnode.EvaluateWithoutActivation(NeuralValueMax)\r\n\t}\r\n\t// Pass inputs.\r\n\tfor i, node := range network.InputNodes[network.NumBiasNodes:] {\r\n\t\t// log.Println(node) //\r\n\t\tif !inputs[i].IsEvaluated() {\r\n\t\t\tt.Error(\r\n\t\t\t\tfmt.Sprint(\r\n\t\t\t\t\t\"each input value should be in range\",\r\n\t\t\t\t\t\" [\", NeuralValueMin, \", \", NeuralValueMax, \"]\",\r\n\t\t\t\t\t// It doesn't actually have to be.\r\n\t\t\t\t\t// Generating error like this is just to help the user know what he/she is doing.\r\n\t\t\t\t),\r\n\t\t\t)\r\n\t\t\treturn nil, levelBase, errors.New(\r\n\t\t\t\tfmt.Sprint(\r\n\t\t\t\t\t\"each input value should be in range\",\r\n\t\t\t\t\t\" [\", NeuralValueMin, \", \", NeuralValueMax, \"]\",\r\n\t\t\t\t\t// It doesn't actually have to be.\r\n\t\t\t\t\t// Generating error like this is just to help the user know what he/she is doing.\r\n\t\t\t\t),\r\n\t\t\t)\r\n\t\t}\r\n\t\tnode.EvaluateWithoutActivation(inputs[i])\r\n\t\tnode.SetLevel(0)\r\n\t\t// log.Println(inputs[i], \"->\", node.Value) //\r\n\t}\r\n\r\n\t// FF in BFS-like order.\r\n\tfor _, toNode := range nodes {\r\n\t\t// log.Println(toNode) //\r\n\t\tif toNode.IsEvaluated() { // When toNode is not an input node.\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tsum := 0.0 // 1\r\n\t\tlevel := float64(LayerLevelInit) // 2\r\n\t\t{\r\n\t\t\tfroms := network.NeuralNodesTo(toNode)\r\n\t\t\tfor froms.Next() {\r\n\t\t\t\tfromNode := froms.NeuralNode()\r\n\t\t\t\tw := network.NeuralEdge(fromNode, toNode).Weight()\r\n\t\t\t\tv, err := fromNode.Output()\r\n\t\t\t\tif err != nil {\r\n\t\t\t\t\tt.Error(err)\r\n\t\t\t\t\treturn nil, levelBase, err\r\n\t\t\t\t}\r\n\t\t\t\tsum += (v.Float64() * w) // 1\r\n\t\t\t\tcandidate, err := fromNode.Level()\r\n\t\t\t\tif err != nil {\r\n\t\t\t\t\tt.Error(err)\r\n\t\t\t\t\treturn nil, levelBase, err\r\n\t\t\t\t}\r\n\t\t\t\tlevel = math.Max(float64(candidate), float64(level)) // 2\r\n\t\t\t}\r\n\t\t}\r\n\t\ttoNode.Evaluate(NeuralValue(sum)) // 1\r\n\t\ttoNode.SetLevel(int(level + 1)) // 2\r\n\t\t// log.Println(sum, \"->\", toNode.Value) //\r\n\t}\r\n\r\n\t// The output nodes to be returned.\r\n\toutputs = make([]NeuralNode, len(network.OutputNodes))\r\n\tfor i := range outputs {\r\n\t\toutputs[i] = *network.OutputNodes[i]\r\n\t}\r\n\t// Validate (test) these output nodes and return.\r\n\tmaxLevel := LayerLevelInit\r\n\tfor i, outputNode := range outputs {\r\n\t\tlevelValid, err := outputNode.Level()\r\n\t\tif err != nil {\r\n\t\t\tt.Error(err)\r\n\t\t\treturn nil, LayerLevelInit, err\r\n\t\t}\r\n\t\tif maxLevel == LayerLevelInit {\r\n\t\t\tmaxLevel = levelValid\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tif maxLevel != levelValid {\r\n\t\t\tt.Error(err)\r\n\t\t\treturn nil, LayerLevelInit, errors.New(\"the layer level is invalid for [\" + string(i) + \"]th output node\")\r\n\t\t}\r\n\t}\r\n\tnetwork.IsEvaluatedWell = true // back at it again.\r\n\treturn outputs, maxLevel + 1, nil\r\n}", "title": "" }, { "docid": "0f0fdf2bb47764b07127f0ea71a7fffb", "score": "0.42865312", "text": "func (a Axis) Value() float32 {\n\tfor _, pair := range a.Pairs {\n\t\tv := pair.Value()\n\t\tif v != AxisNeutral {\n\t\t\treturn v\n\t\t}\n\t}\n\n\treturn AxisNeutral\n}", "title": "" }, { "docid": "0165a1365def02ebe6dd2ba6f4bbc731", "score": "0.42790267", "text": "func (f Frame) Layer() int {\n\treturn int(f[1]&6) >> 1\n}", "title": "" }, { "docid": "fa13aa6fb803c8d60c9b6cfe6da403e9", "score": "0.4276487", "text": "func (s stockPosition) getValue() float32 {\n\treturn s.sharePrice * s.count\n}", "title": "" }, { "docid": "4b4388425abf63dff36808f040bc680c", "score": "0.42755082", "text": "func (ly *LHbRMTgLayer) GetMonitorVal(data []string) float64 {\n\tvar val float32\n\tvalType := data[0]\n\tswitch valType {\n\tcase \"TotalAct\":\n\t\tval = TotalAct(ly)\n\n\tcase \"VSPatchPosD1\":\n\t\tval = ly.InternalState.VSPatchPosD1\n\tcase \"VSPatchPosD2\":\n\t\tval = ly.InternalState.VSPatchPosD2\n\tcase \"VSPatchNegD1\":\n\t\tval = ly.InternalState.VSPatchNegD1\n\tcase \"VSPatchNegD2\":\n\t\tval = ly.InternalState.VSPatchNegD2\n\tcase \"VSMatrixPosD1\":\n\t\tval = ly.InternalState.VSMatrixPosD1\n\tcase \"VSMatrixPosD2\":\n\t\tval = ly.InternalState.VSMatrixPosD2\n\tcase \"VSMatrixNegD1\":\n\t\tval = ly.InternalState.VSMatrixNegD1\n\tcase \"VSMatrixNegD2\":\n\t\tval = ly.InternalState.VSMatrixNegD2\n\tcase \"PosPV\":\n\t\tval = ly.InternalState.PosPV\n\tcase \"NegPV\":\n\t\tval = ly.InternalState.NegPV\n\tcase \"VSPatchPosNet\":\n\t\tval = ly.InternalState.VSPatchPosNet\n\tcase \"VSPatchNegNet\":\n\t\tval = ly.InternalState.VSPatchNegNet\n\tcase \"VSMatrixPosNet\":\n\t\tval = ly.InternalState.VSMatrixPosNet\n\tcase \"VSMatrixNegNet\":\n\t\tval = ly.InternalState.VSMatrixNegNet\n\tcase \"NetPos\":\n\t\tval = ly.InternalState.NetPos\n\tcase \"NetNeg\":\n\t\tval = ly.InternalState.NetNeg\n\n\tdefault:\n\t\tval = ly.Neurons[0].Act\n\t}\n\treturn float64(val)\n}", "title": "" }, { "docid": "b789f1b3b9ca10f74fd1eaba8fb30055", "score": "0.42694244", "text": "func (m *OmaSettingFloatingPoint) GetValue()(*float32) {\n return m.value\n}", "title": "" }, { "docid": "f03ba0fa262589aea56375e7a792d5b3", "score": "0.42627016", "text": "func (b *Float64Array) Value(i int) float64 {\n\treturn b.rawData[i]\n}", "title": "" }, { "docid": "c2ad97efab48dd9af34f72a0927d3932", "score": "0.42567164", "text": "func (x *Trust) Value() float64 {\n\treturn (*reputation.Trust)(x).\n\t\tGetValue()\n}", "title": "" }, { "docid": "42540cb448f0a048b17defcf26e4ff4b", "score": "0.42409173", "text": "func (s Series) Value() interface{} { return &s }", "title": "" }, { "docid": "20ab155f2a9f118508fda145b28b6f9d", "score": "0.4240903", "text": "func (nn *NeuralNetwork) GetLayers() [][]*Neuron {\n\tinput, others := nn.GetLayer(0)\n\treturn append([][]*Neuron{input}, others...)\n}", "title": "" }, { "docid": "df42423d4162ec9d6439ae5d9856d3b0", "score": "0.4237082", "text": "func (k *Kurtosis) Value() (float64, error) {\n\tif !k.IsSetCore() {\n\t\treturn 0, errors.New(\"Core is not set\")\n\t}\n\n\tk.core.RLock()\n\tdefer k.core.RUnlock()\n\n\tcount := float64(k.core.Count())\n\tif count == 0 {\n\t\treturn 0, errors.New(\"no values seen yet\")\n\t}\n\n\tvariance, err := k.variance.Value()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"error retrieving 2nd moment\")\n\t}\n\n\tmoment, err := k.moment4.Value()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"error retrieving 4th moment\")\n\t}\n\n\tmoment *= (count - 1) / count\n\tvariance *= (count - 1) / count\n\n\treturn moment/math.Pow(variance, 2) - 3, nil\n}", "title": "" }, { "docid": "5216dca5b93f0b8e6f95cd6c3e5181a8", "score": "0.42306998", "text": "func (ld *Layered) GetLayer() int {\n\tif ld == nil {\n\t\treturn Undraw\n\t}\n\treturn ld.layer\n}", "title": "" }, { "docid": "f69f8a63e2977e98e4123f0ce4cc6ac9", "score": "0.42287314", "text": "func (ldp *LayeredPoint) GetLayer() int {\n\tif ldp == nil {\n\t\treturn Undraw\n\t}\n\treturn ldp.Layered.GetLayer()\n}", "title": "" }, { "docid": "1b1e7fcedb84649b347518186fab3c72", "score": "0.4228083", "text": "func (v VertexPageRank) GetValue() float64 {\n\treturn v.Value\n}", "title": "" }, { "docid": "20cb43017ce212f9775280d7462d6ba8", "score": "0.4210897", "text": "func (f Float64) Value() float64 {\n\treturn f.value\n}", "title": "" }, { "docid": "5037285789bb2be07f5184075b76f0db", "score": "0.42069808", "text": "func (c *IntegerSliceConverter) Value() []int64 {\n\treturn c.value\n}", "title": "" }, { "docid": "a210423f6b6f8e74da7fe98f4faa0ba4", "score": "0.420332", "text": "func (o *UsageAttributionAggregatesBody) GetValueOk() (*float64, bool) {\n\tif o == nil || o.Value == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Value, true\n}", "title": "" }, { "docid": "06b20fb011963bcd6c42900be91ca31b", "score": "0.41947088", "text": "func (s *Sample) ValueFor(f feature.Feature) (interface{}, error) {\n\tc, ok := s.FeatureNamesColumns[f.Name()]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\tv, ok := s.Values[c]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\t_, ok = f.(*feature.DiscreteFeature)\n\tif ok {\n\t\tiv, ok := v.(int)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected sql representation for the value of %s to be an int, got %T\", f.Name(), v)\n\t\t}\n\t\tv = interface{}(s.DiscreteFeatureValues[iv])\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "8376f439f3adfbc97122994304e52ce1", "score": "0.41938445", "text": "func (page NetworkCollectionPage) Values() []Network {\n\tif page.nc.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.nc.Value\n}", "title": "" }, { "docid": "a5d9208b789f067dc35647ec8f603610", "score": "0.4185945", "text": "func (c *Converter) getValueRoot() *gen.PackageManager {\n\treturn c.GenRoot.Sub(\"values\")\n}", "title": "" }, { "docid": "06adaa400c11affb7b6d21fbc13257cc", "score": "0.41635403", "text": "func (v VertexSSSP) GetValue() float64 {\n\treturn v.Value\n}", "title": "" }, { "docid": "cce008b9e17991a238489f89afa0d975", "score": "0.41619387", "text": "func (i ForwardIterator) Value() Value { return i.node.value }", "title": "" }, { "docid": "73469cf67dbff21fe0d97b1137419cc6", "score": "0.41606227", "text": "func Value(colors []string) int {\n\tlength := len(colors)\n\tif length < 2 {\n\t\treturn -1\n\t}\n\n\tif ignoreBandsAfterSecond {\n\t\tlength = 2\n\t}\n\n\tresistances := make([]int, length)\n\ndecode:\n\tfor resistance, color := range allColors() {\n\t\tfor i, band := range colors {\n\t\t\tif ignoreBandsAfterSecond && i > 1 {\n\t\t\t\tcontinue decode\n\t\t\t}\n\t\t\tif band == color {\n\t\t\t\tresistances[i] = resistance\n\t\t\t}\n\t\t}\n\t}\n\n\ttotalResistance := 0\n\tfor i, resistance := range resistances {\n\t\ttotalResistance += resistance * ipow(10, length-1-i)\n\t}\n\n\treturn totalResistance\n}", "title": "" }, { "docid": "11895429715b25660c8f8334954e85ff", "score": "0.41541806", "text": "func (t CubeMap) GetLayers() int32 {\n\treturn t.layers\n}", "title": "" }, { "docid": "db60c69dfabcfdf0f132276a93ba7470", "score": "0.41502795", "text": "func (a *EWMA) Value() float64 {\n\treturn a.value\n}", "title": "" }, { "docid": "4c84941679f75231ec47b59fe0e5b638", "score": "0.41491747", "text": "func (n North) GetValue() int {\n\treturn 0\n}", "title": "" }, { "docid": "5f7c877891c2c90d9ad40f0c62a2c8e4", "score": "0.4145661", "text": "func (o *Portfolio) GetValue() int {\n return o.Value\n}", "title": "" }, { "docid": "d58b2dca3525ce6a3c0f579a6d55bd6b", "score": "0.4143949", "text": "func (b Brightness) Value() int {\n\treturn b.value\n}", "title": "" }, { "docid": "219fcb61e03ac65e9115da0771533e9e", "score": "0.41437185", "text": "func (o *VisualScriptCustomNode) X_GetOutputValuePortCount() gdnative.Int {\n\t//log.Println(\"Calling VisualScriptCustomNode.X_GetOutputValuePortCount()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"VisualScriptCustomNode\", \"_get_output_value_port_count\")\n\n\t// Call the parent method.\n\t// int\n\tretPtr := gdnative.NewEmptyInt()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewIntFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "875f8d38ad70aa978ddf0cca51957f96", "score": "0.41194427", "text": "func (iter SubnetListResultIterator) Value() Subnet {\n\tif !iter.page.NotDone() {\n\t\treturn Subnet{}\n\t}\n\treturn iter.page.Values()[iter.i]\n}", "title": "" }, { "docid": "9f4a443314879f4b2a06117f99b893eb", "score": "0.4118492", "text": "func getValue(s Score) float32 {\n\tif flagSortBy == \"score\" {\n\t\treturn s.value\n\t}\n\tresult, _ := calculators.LigEffUI8(s.value, s.numHAtoms)\n\treturn result\n}", "title": "" }, { "docid": "ecdb42fe4a56d994028730930a8e23d7", "score": "0.41148013", "text": "func (o VirtualNodeSpecListenerOutlierDetectionBaseEjectionDurationOutput) Value() pulumi.IntOutput {\n\treturn o.ApplyT(func(v VirtualNodeSpecListenerOutlierDetectionBaseEjectionDuration) int { return v.Value }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "cac3e3fece7c3bfbeeaeb9764b8b908c", "score": "0.41067278", "text": "func getBiasSlope(nn neuralNetwork, d_z [][]float32, layer int) []float32 {\n\td_bias := make([]float32, nn.architecture[layer])\n\tfor _, sample := range d_z {\n\t\tfor neuron, _ := range nn.layers[layer].neurons {\n\t\t\td_bias[neuron] += sample[neuron]\n\t\t}\n\t}\n\treturn d_bias\n}", "title": "" }, { "docid": "ccf5d8ebfc40ccb8d50ceeb8d3b0f951", "score": "0.41022906", "text": "func (x LayerProperties) PassValue() (C.VkLayerProperties, *cgoAllocMap) {\n\tif x.refd9407ce7 != nil {\n\t\treturn *x.refd9407ce7, nil\n\t}\n\tref, allocs := x.PassRef()\n\treturn *ref, allocs\n}", "title": "" }, { "docid": "ccf5d8ebfc40ccb8d50ceeb8d3b0f951", "score": "0.41022906", "text": "func (x LayerProperties) PassValue() (C.VkLayerProperties, *cgoAllocMap) {\n\tif x.refd9407ce7 != nil {\n\t\treturn *x.refd9407ce7, nil\n\t}\n\tref, allocs := x.PassRef()\n\treturn *ref, allocs\n}", "title": "" }, { "docid": "ec6314a2f7dddc622c2623d05a473154", "score": "0.40945184", "text": "func (device *IndustrialDigitalIn4Bricklet) GetValue() (valueMask uint16, err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Get(uint8(FunctionGetValue), buf.Bytes())\n\tif err != nil {\n\t\treturn valueMask, err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 10 {\n\t\t\treturn valueMask, fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 10)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn valueMask, DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tresultBuf := bytes.NewBuffer(resultBytes[8:])\n\t\tbinary.Read(resultBuf, binary.LittleEndian, &valueMask)\n\n\t}\n\n\treturn valueMask, nil\n}", "title": "" }, { "docid": "3bc5cd91cc39283acfee3ca1d499f9be", "score": "0.40931666", "text": "func (self *Variable) Value() float64 {\n\treturn self.value\n}", "title": "" }, { "docid": "a7556b18a60b77b41d946ec6979a95ee", "score": "0.4092252", "text": "func (i *blockIter) Value() []byte {\n\treturn i.val\n}", "title": "" }, { "docid": "cf5298dc4bae35b315d7d9d63c24f764", "score": "0.40833682", "text": "func (s Float) Value() float64 {\n\treturn s.value.(float64)\n}", "title": "" }, { "docid": "f3a168ef03659fdb8c404460194c3a1e", "score": "0.4082712", "text": "func (c *SliceConverter) Value() []interface{} {\n\treturn c.value\n}", "title": "" }, { "docid": "af49b63d4da7509463a3c7704ad8bebe", "score": "0.40780887", "text": "func nodeCPPNValues(n *QuadNode) []float64 {\n\tif len(n.Nodes) > 0 {\n\t\taccumulator := make([]float64, 0)\n\t\tfor _, p := range n.Nodes {\n\t\t\t// go into child nodes\n\t\t\tpVals := nodeCPPNValues(p)\n\t\t\taccumulator = append(accumulator, pVals...)\n\t\t}\n\t\treturn accumulator\n\t} else {\n\t\treturn []float64{n.W}\n\t}\n}", "title": "" }, { "docid": "e929694c9f96f08ee83f041e13eb1121", "score": "0.40696004", "text": "func (s *Streaming) Value() float64 {\n\treturn s.c.Value()\n}", "title": "" }, { "docid": "b953dfdfd1f9859b3f49200888f4f94e", "score": "0.40675208", "text": "func (s Series) GetValue(pointIdx int) *float64 {\n\tif s.ValueIsNullable {\n\t\treturn s.Frame.Fields[s.ValueIdx].At(pointIdx).(*float64)\n\t}\n\tf := s.Frame.Fields[s.ValueIdx].At(pointIdx).(float64)\n\treturn &f\n}", "title": "" }, { "docid": "e88479c7bb07fa58942d5e136c44020d", "score": "0.40646484", "text": "func (x ImageSubresourceLayers) PassValue() (C.VkImageSubresourceLayers, *cgoAllocMap) {\n\tif x.ref3b13bcd2 != nil {\n\t\treturn *x.ref3b13bcd2, nil\n\t}\n\tref, allocs := x.PassRef()\n\treturn *ref, allocs\n}", "title": "" }, { "docid": "e88479c7bb07fa58942d5e136c44020d", "score": "0.40646484", "text": "func (x ImageSubresourceLayers) PassValue() (C.VkImageSubresourceLayers, *cgoAllocMap) {\n\tif x.ref3b13bcd2 != nil {\n\t\treturn *x.ref3b13bcd2, nil\n\t}\n\tref, allocs := x.PassRef()\n\treturn *ref, allocs\n}", "title": "" }, { "docid": "8ba4108c04f17959256fcdcba6b1e7a2", "score": "0.4060978", "text": "func (s *MessagesGetMaskStickers) Value() *tg.MessagesAllStickers {\n\tinner, _ := s.load()\n\treturn inner.value\n}", "title": "" }, { "docid": "fc3222690ac363d98ac294b29adb8946", "score": "0.40476382", "text": "func value(x, y int) bool {\n\tisOn := grid[pos{x, y}]\n\tneigh := onNeigh(x, y)\n\tif isOn {\n\t\tif neigh == 2 || neigh == 3 {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif neigh == 3 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ca65bd89e5d65902ed04a6b3343e0d0e", "score": "0.40468857", "text": "func (e East) GetValue() int {\n\treturn 1\n}", "title": "" }, { "docid": "f1e13dfd973423d5e9e04a8cabb9808f", "score": "0.40413177", "text": "func (o ImageRecipeComponentParameterOutput) Value() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ImageRecipeComponentParameter) []string { return v.Value }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "6a26fc69ab09886dd8997747936bd4f8", "score": "0.4039683", "text": "func (it *Iterator) Value() interface{} {\n\treturn it.n.val\n}", "title": "" }, { "docid": "5e2920fc53b083f0a27f0d7ec2d1a2f4", "score": "0.4036909", "text": "func (m measure) Value() float64 {\n\treturn m.value\n}", "title": "" }, { "docid": "b509ceb8c70434c35d95df0e7507e1db", "score": "0.4034657", "text": "func (m *protoMap) Value() any {\n\treturn m.value\n}", "title": "" }, { "docid": "69fbc499402690f4088cc392bb539f31", "score": "0.4034373", "text": "func (c *UnsignedIntegerSliceConverter) Value() []uint64 {\n\treturn c.value\n}", "title": "" }, { "docid": "e482e81491fea1647c582fab8e42a4e3", "score": "0.40323123", "text": "func (i forwardIteratorOrderMap) Value() bool { return i.node.value }", "title": "" }, { "docid": "18154cbb216abd925b2a2045d79942b4", "score": "0.40305245", "text": "func (o *AnimationNodeBlendSpace1D) GetValueLabel() gdnative.String {\n\t//log.Println(\"Calling AnimationNodeBlendSpace1D.GetValueLabel()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"AnimationNodeBlendSpace1D\", \"get_value_label\")\n\n\t// Call the parent method.\n\t// String\n\tretPtr := gdnative.NewEmptyString()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewStringFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "ee2b3ed9cfc3a5a1941893bdfb80d08d", "score": "0.40266567", "text": "func (gp GroupPatterns) Value() (driver.Value, error) {\n\tdata, err := json.Marshal(gp)\n\treturn data, err\n}", "title": "" } ]
c1ce080550c2deab728edd435e3cad4e
Disable returns a configurer to disable metrics.
[ { "docid": "405bca2f71b90c48518d69f5e8e34a3e", "score": "0.65878946", "text": "func Disable() nirvana.Configurer {\n\treturn func(c *nirvana.Config) error {\n\t\tc.Set(ExternalConfigName, nil)\n\t\treturn nil\n\t}\n}", "title": "" } ]
[ { "docid": "7fe44f1f7aea65c9584b9571c680621f", "score": "0.7198648", "text": "func Disable() MetricOption {\n\treturn metricOptionFunc(func(o *metricOptions) { o.disable = true })\n}", "title": "" }, { "docid": "64d17b8b8737abebc55882957467929a", "score": "0.6005878", "text": "func WithDisableSettingsMetrics(b bool) Opt {\n\treturn func(e *Exporter) {\n\t\te.disableSettingsMetrics = b\n\t}\n}", "title": "" }, { "docid": "a8f917d0c1766659f5b4f70555bc2dbf", "score": "0.5776968", "text": "func (s *statistics) Disable() {\n\ts.mu.Lock()\n\ts.enabled = false\n\ts.mu.Unlock()\n}", "title": "" }, { "docid": "6a5522f8148beed3221091add72b9f02", "score": "0.5695667", "text": "func (uLogger *UsageLoggers) Disable() {\n\tuLogger.disabled = true\n}", "title": "" }, { "docid": "5b491055c5cea5ddb0652a28d9686564", "score": "0.56251794", "text": "func TestMetricsDisabled(t *testing.T) {\n\tdisableMetricsConfig := cfg\n\tdisableMetricsConfig.DisableMetrics = config.BooleanDefaultFalse{Value: config.ExplicitlyEnabled}\n\n\tcontainerID := \"containerID\"\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tresolver := mock_resolver.NewMockContainerMetadataResolver(mockCtrl)\n\tresolver.EXPECT().ResolveTask(containerID).Return(&apitask.Task{\n\t\tArn: \"t1\",\n\t\tKnownStatusUnsafe: apitaskstatus.TaskRunning,\n\t\tFamily: \"f1\",\n\t}, nil)\n\tresolver.EXPECT().ResolveContainer(containerID).Return(&apicontainer.DockerContainer{\n\t\tDockerID: containerID,\n\t\tContainer: &apicontainer.Container{\n\t\t\tHealthCheckType: \"docker\",\n\t\t},\n\t}, nil).Times(2)\n\n\tengine := NewDockerStatsEngine(&disableMetricsConfig, nil, eventStream(\"TestMetricsDisabled\"), nil, nil)\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\tengine.ctx = ctx\n\tengine.resolver = resolver\n\tengine.addAndStartStatsContainer(containerID)\n\n\tassert.Len(t, engine.tasksToContainers, 0, \"No containers should be tracked if metrics is disabled\")\n\tassert.Len(t, engine.tasksToHealthCheckContainers, 1)\n}", "title": "" }, { "docid": "cd995c41c03979c6967b072a98561224", "score": "0.5572397", "text": "func Disable() func() {\n\torig := netTracer\n\tnetTracer = opentracing.NoopTracer{}\n\treturn func() {\n\t\tnetTracer = orig\n\t}\n}", "title": "" }, { "docid": "731ac0975d7d1d3eecd8378856b8d7b6", "score": "0.55485994", "text": "func Disable(cap Enum) {\n\t_pluginInstance.glContext.Disable(gl.Enum(cap))\n}", "title": "" }, { "docid": "5b475a3b9d6676857223b5506f8bf530", "score": "0.5544204", "text": "func TestMetrics_Disabled(t *testing.T) {\n\t// This test messes with global state. Gotta fix it up otherwise other tests panic. I really\n\t// am beginning to wonder about our metrics.\n\tdefer func() {\n\t\tmmu.Lock()\n\t\tsms = nil\n\t\tims = nil\n\t\tmmu.Unlock()\n\t}()\n\n\tpath, err := ioutil.TempDir(\"\", \"sfile-metrics-\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer os.RemoveAll(path)\n\n\t// Step 1. make a series file with metrics and some labels\n\tsfile := NewSeriesFile(path)\n\tsfile.SetDefaultMetricLabels(prometheus.Labels{\"foo\": \"bar\"})\n\tif err := sfile.Open(context.Background()); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := sfile.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Step 2. open the series file again, but disable metrics\n\tsfile = NewSeriesFile(path)\n\tsfile.DisableMetrics()\n\tif err := sfile.Open(context.Background()); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer sfile.Close()\n\n\t// Step 3. add a series\n\tpoints := []models.Point{models.MustNewPoint(\"a\", models.Tags{}, models.Fields{\"f\": 1.0}, time.Now())}\n\tif err := sfile.CreateSeriesListIfNotExists(NewSeriesCollection(points)); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "78c104473ec6a71e54bde8bb15efc120", "score": "0.55382824", "text": "func (s *Scenario) Disable() error {\n\tif !s.Enabled {\n\t\treturn nil\n\t}\n\tif err := os.Remove(s.EnabledSymlink); err != nil {\n\t\treturn err\n\t}\n\ts.Enabled = false\n\treturn nil\n}", "title": "" }, { "docid": "527f15733d36364330544d62e9ebee48", "score": "0.5533631", "text": "func (p *Metrics) DisableMonitoring(queryName string, issue model.Issue) {\n\tp.issues.WithLabelValues(queryName, issue.ID, issue.Title).Set(0)\n}", "title": "" }, { "docid": "e5c5f29147ac64a89e8de133b372011d", "score": "0.55293155", "text": "func (protocol *ProfilerProtocol) Disable() <-chan *profiler.DisableResult {\n\tresultChan := make(chan *profiler.DisableResult)\n\tcommand := NewCommand(protocol.Socket, \"Profiler.disable\", nil)\n\tresult := &profiler.DisableResult{}\n\n\tgo func() {\n\t\tresponse := <-protocol.Socket.SendCommand(command)\n\t\tif nil != response.Error && 0 != response.Error.Code {\n\t\t\tresult.Err = response.Error\n\t\t}\n\t\tresultChan <- result\n\t\tclose(resultChan)\n\t}()\n\n\treturn resultChan\n}", "title": "" }, { "docid": "109ff800f6161d812f3b53f3de7952e1", "score": "0.5528678", "text": "func (s Server) DisableConfiguration(writer http.ResponseWriter, request *http.Request) {\n\ts.EnableOrDisableConfiguration(writer, request, \"0\")\n}", "title": "" }, { "docid": "b467c373e588be34d8d107f6d1c75a18", "score": "0.5493904", "text": "func (s *Server) DisableConfiguration(writer http.ResponseWriter, request *http.Request) {\n\ts.EnableOrDisableConfiguration(writer, request, \"0\")\n}", "title": "" }, { "docid": "398d3ab0a18f61f916a71b9a7656bfbb", "score": "0.54900897", "text": "func Disable(c Capability) {\n\talDisable(int32(c))\n}", "title": "" }, { "docid": "a214e7dcce6b93a2acbee38d344de92f", "score": "0.5471889", "text": "func DisableMonitor(url, name string) error {\n\treturn (&ghost{\n\t\turl: url,\n\t\thttp: http.DefaultClient,\n\t}).DisableMonitor(name)\n}", "title": "" }, { "docid": "bb3edc30c2180112f5dcf2942eabf5b6", "score": "0.54398274", "text": "func (c *CmdProcessor) Disable(ctx context.Context) error {\n\tif err := c.setAnnotationAndPatch(ctx, \"false\"); err != nil {\n\t\treturn fmt.Errorf(\"setting gc annotation to false: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "abaab910ec0c809b869cd7d5b653e453", "score": "0.5415855", "text": "func (m *Manager) Disable(t Type) error {\n\tif m.m == nil {\n\t\tm.m = new(manager)\n\t\tm.m.initialize()\n\t}\n\tif t < 0 || int(t) >= len(sensorNames) {\n\t\treturn errors.New(\"sensor: unknown sensor type\")\n\t}\n\treturn m.m.disable(t)\n}", "title": "" }, { "docid": "b2305410de86bcbe998c77ebbc6b49ca", "score": "0.5377573", "text": "func Disable() {\n\tm.Lock()\n\tdefer m.Unlock()\n\tenabled = false\n}", "title": "" }, { "docid": "9d0088c3d7e2cfd55d8b192b4de3c7b7", "score": "0.53306425", "text": "func DisableHandler(w http.ResponseWriter, r *http.Request) {\n\tlogger := globalProbe.configuration.Logger\n\tlogger.Info().Msgf(\"Blackfire (HTTP): Disable profiling\")\n\tif err := globalProbe.Disable(); err != nil {\n\t\twriteJsonError(w, &problem{Status: 500, Title: \"Disable error\", Detail: err.Error()})\n\t} else {\n\t\twriteJsonStatus(w)\n\t}\n}", "title": "" }, { "docid": "adde5e023e52e69d67918cb866023504", "score": "0.5313536", "text": "func (d *domainClient) Disable(ctx context.Context) (err error) {\n\terr = rpcc.Invoke(ctx, \"HeapProfiler.disable\", nil, nil, d.conn)\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"HeapProfiler\", Op: \"Disable\", Err: err}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8a119334ab95d5304d14bae005f35130", "score": "0.5304423", "text": "func Disable(checks ...string) Option {\n\treturn func(l *Linter) {\n\t\tl.checkers = l.checkers.CloneAndDisable(checks...)\n\t}\n}", "title": "" }, { "docid": "90a41931a768ffed8cb81ad9ccc5d8d1", "score": "0.53016835", "text": "func Disable() {\n\tenabled = false\n}", "title": "" }, { "docid": "7f6b1d407872c4046a771d643408bad6", "score": "0.5287558", "text": "func Disable(name string) {\n\tvolatile.TransactionsWrapper(func() {\n\t\tvolatile.DeleteFieldAtKey(\"feature.gates\", name)\n\t})\n}", "title": "" }, { "docid": "848403f18255f51ad83b19636dbabacc", "score": "0.5269345", "text": "func (o IdentityServiceGoogleConfigResponseOutput) Disable() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v IdentityServiceGoogleConfigResponse) bool { return v.Disable }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "47566eae19accea7c443b425c4c8cfb7", "score": "0.5265171", "text": "func (a *ADC) Disable() error {\n\treturn a.parent.Write([2]byte{0x50, (a.n & 0x7) << 4})\n}", "title": "" }, { "docid": "3364e0780c561980ebfb57c6a95dec6e", "score": "0.5239975", "text": "func Disable() {\n\tSet(log.NewNil())\n}", "title": "" }, { "docid": "0abd002d9bcc383bbc3fba00394d588f", "score": "0.5229936", "text": "func (a *Tracker) Disable() {\n\ta.enable = false\n\n\ta.close()\n}", "title": "" }, { "docid": "4fd12e6f1b734a28f8aaeb67f446de26", "score": "0.52029777", "text": "func MakeDisableEndpoint(svc service.APISchedulerService) (ep endpoint.Endpoint) {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DisableRequest)\n\t\tmessage, err := svc.Disable(ctx, req.Id)\n\t\treturn DisableResponse{Message: message, Err: err}, err\n\t}\n}", "title": "" }, { "docid": "cd7d1e266de1ff1e7affa2bd0acb0c07", "score": "0.5193093", "text": "func Disable() {\n\tlog.Out = io.Discard\n}", "title": "" }, { "docid": "49b3733b404720d8200053cba7b3b9f7", "score": "0.51852673", "text": "func (p *PeriodicTask) Disable() {\n\tp.enable = false\n\tclose(p.signal)\n\tp.ticker.Stop()\n\tp.ticker = nil\n}", "title": "" }, { "docid": "47551dca2f585fc0af76c39014a6bcfd", "score": "0.51825106", "text": "func (i *Interceptor) Disable() {\n\ti.disabled = true\n}", "title": "" }, { "docid": "3d6b090b5f2494ae9bf8694e604264a6", "score": "0.5172758", "text": "func (c *CORSConfig) Disable(ctx context.Context) error {\n\tatomic.StoreUint32(c.Enabled, CORSDisabled)\n\tc.Lock()\n\n\tc.AllowedOrigins = nil\n\tc.AllowedHeaders = nil\n\n\tc.Unlock()\n\n\treturn c.core.saveCORSConfig(ctx)\n}", "title": "" }, { "docid": "d54d272f87c960299bfdf2f828d5bcc3", "score": "0.51637876", "text": "func (c *EchoPlugin) Disable() error {\n\tlog.Println(\"echo plugin disbled\")\n\treturn nil\n}", "title": "" }, { "docid": "5de18aeb813d0861bcd1797be54cb091", "score": "0.5131529", "text": "func (m metrics) IsDisabled() bool {\n\treturn m.disabled\n}", "title": "" }, { "docid": "35ef3620945d492d79ee07cf94cc0f66", "score": "0.51227385", "text": "func (doAccessibility Accessibility) Disable() (err error) {\n\tb := accessibility.Disable()\n\treturn b.Do(doAccessibility.ctxWithExecutor)\n}", "title": "" }, { "docid": "5dbd8e5a694759b79982c32863606ad7", "score": "0.51221627", "text": "func (e *NotifierExecutor) Disable(ctx context.Context, cmdCtx CommandContext) (interactive.Message, error) {\n\tcmdVerb, cmdRes := parseCmdVerb(cmdCtx.Args)\n\tdefer e.reportCommand(cmdVerb, cmdRes, cmdCtx.Conversation.CommandOrigin, cmdCtx.Platform)\n\n\tconst enabled = false\n\terr := cmdCtx.NotifierHandler.SetNotificationsEnabled(cmdCtx.Conversation.ID, enabled)\n\tif err != nil {\n\t\tif errors.Is(err, ErrNotificationsNotConfigured) {\n\t\t\tmsg := fmt.Sprintf(notifierNotConfiguredMsgFmt, cmdCtx.Conversation.ID, cmdCtx.ClusterName)\n\t\t\treturn respond(msg, cmdCtx), nil\n\t\t}\n\t\treturn interactive.Message{}, fmt.Errorf(\"while setting notifications to %t: %w\", enabled, err)\n\t}\n\tsuccessMessage := fmt.Sprintf(notifierStopMsgFmt, cmdCtx.ClusterName)\n\terr = e.cfgManager.PersistNotificationsEnabled(ctx, cmdCtx.CommGroupName, cmdCtx.Platform, cmdCtx.Conversation.Alias, enabled)\n\tif err != nil {\n\t\tif err == config.ErrUnsupportedPlatform {\n\t\t\te.log.Warnf(notifierPersistenceNotSupportedFmt, cmdCtx.Platform)\n\t\t\treturn respond(successMessage, cmdCtx), nil\n\t\t}\n\t\treturn interactive.Message{}, fmt.Errorf(\"while persisting configuration: %w\", err)\n\t}\n\treturn respond(successMessage, cmdCtx), nil\n}", "title": "" }, { "docid": "f4d4e7835532c243ac91fb3b14e580d2", "score": "0.5119267", "text": "func (l *Logger) Disable() {\n\tl.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "ade7020de27971009e1e6af94915cf94", "score": "0.5109115", "text": "func WithDisableHealthCheck() DialOption {\n\treturn newFuncDialOption(func(o *dialOptions) {\n\t\to.disableHealthCheck = true\n\t})\n}", "title": "" }, { "docid": "606c972cfff0dd40ad830d70933c9d88", "score": "0.5096971", "text": "func (m *Machine) Disable() {\n\tm.State = State{Enabled: false, Generation: m.nextGen()}\n}", "title": "" }, { "docid": "247d7d163c612dc38f9d57f34d153ae2", "score": "0.5094314", "text": "func (o IdentityServiceGoogleConfigOutput) Disable() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v IdentityServiceGoogleConfig) *bool { return v.Disable }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "4089befb0588019be2a59f34abf0a9ad", "score": "0.5029484", "text": "func (c *Client) SetDisableWarn(d bool) *Client {\n\tc.DisableWarn = d\n\treturn c\n}", "title": "" }, { "docid": "e985dfc64f9cae289bd4a63c121348a0", "score": "0.5020358", "text": "func Disable() *DisableParams {\n\treturn &DisableParams{}\n}", "title": "" }, { "docid": "e985dfc64f9cae289bd4a63c121348a0", "score": "0.5020358", "text": "func Disable() *DisableParams {\n\treturn &DisableParams{}\n}", "title": "" }, { "docid": "e985dfc64f9cae289bd4a63c121348a0", "score": "0.5020358", "text": "func Disable() *DisableParams {\n\treturn &DisableParams{}\n}", "title": "" }, { "docid": "e985dfc64f9cae289bd4a63c121348a0", "score": "0.5020358", "text": "func Disable() *DisableParams {\n\treturn &DisableParams{}\n}", "title": "" }, { "docid": "e2c8bd468856b52203054ff7635c87ab", "score": "0.5019564", "text": "func (lw *TailLogWriter) Disable() {\n\tlw.mutex.Lock()\n\tdefer lw.mutex.Unlock()\n\n\tlw.enabled = false\n}", "title": "" }, { "docid": "7fb22dd077ec568392111f54fed7404d", "score": "0.50068265", "text": "func (c *WebAuthn) Disable(ctx context.Context) (*gcdmessage.ChromeResponse, error) {\n\treturn c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"WebAuthn.disable\"})\n}", "title": "" }, { "docid": "6ad1e6e756dfbd01eb62dafd6a20614a", "score": "0.49759206", "text": "func (n *NetAdapter) Disable() error {\n\tn.lock.Lock()\n\tdefer n.lock.Unlock()\n\tif n.State != 2 {\n\t\treturn nil\n\t}\n\tres, err := n.callFunction(\"Disable\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tn = res\n\treturn nil\n}", "title": "" }, { "docid": "68c8feb232e121b2690a7766ae1e84f6", "score": "0.49658054", "text": "func Disable() {\n\tlog.SetFlags(0)\n\tlog.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "1baed9557a9b6d899790903d2a7cbdea", "score": "0.49642292", "text": "func (g *Glg) DisableColor() *Glg {\n\tg.mu.Lock()\n\tfor level := range g.isColor {\n\t\tg.isColor[level] = false\n\t}\n\tg.mu.Unlock()\n\treturn g\n}", "title": "" }, { "docid": "539e857c71f4fbf91a5ab088d0b596cf", "score": "0.49272078", "text": "func (l *Logger) Disable(target interface{}) {\n\tvar id string\n\tvar appender Appender\n\n\tswitch object := target.(type) {\n\tcase string:\n\t\tid = object\n\tcase Appender:\n\t\tappender = object\n\tdefault:\n\t\tl.Warn(\"Error while disabling logger. Cannot cast to target type.\")\n\t\treturn\n\t}\n\n\tfor i, app := range l.appenders {\n\t\t// if we can find the same appender reference\n\t\t// or we can extract and match id from appender\n\t\t// or we can match received id string argument with one of appender's id\n\t\tif (appender != nil && (app == appender || appender.Id() == app.Id())) || id == app.Id() {\n\t\t\tvar toAppend []Appender\n\n\t\t\tif len(l.appenders) >= i+1 {\n\t\t\t\ttoAppend = l.appenders[i+1:]\n\t\t\t}\n\n\t\t\tl.appenders = append(l.appenders[:i], toAppend...)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63751da4df22281adc5b59e92367c5bd", "score": "0.49243966", "text": "func (s *StubEventSource) Disable() error {\n\ts.DisableCount++\n\ts.Enabled = false\n\treturn nil\n}", "title": "" }, { "docid": "39a2b28cb86c72d3c1c82e659ca15757", "score": "0.49178573", "text": "func Disable() error {\n\treturn command(\"disable\")\n}", "title": "" }, { "docid": "8918aea45e5cf743ff44f8e9b556e95b", "score": "0.4859006", "text": "func DisableLog() {\n\tLogger = seelog.Disabled\n}", "title": "" }, { "docid": "8918aea45e5cf743ff44f8e9b556e95b", "score": "0.4859006", "text": "func DisableLog() {\n\tLogger = seelog.Disabled\n}", "title": "" }, { "docid": "8918aea45e5cf743ff44f8e9b556e95b", "score": "0.4859006", "text": "func DisableLog() {\n\tLogger = seelog.Disabled\n}", "title": "" }, { "docid": "127c995a19386412c73a87f53568a403", "score": "0.48573387", "text": "func Disable(ctx context.Context) context.Context {\n\tval, _ := FromContext(ctx)\n\tctx.Create(restoreKey, val)\n\tctx.Delete(valueKey)\n\treturn ctx\n}", "title": "" }, { "docid": "c2ccf398d84a85f72bf9f17a5390bda7", "score": "0.48557305", "text": "func (pool *WorkerPool) DisableWorker(name string) {\n\tpool.SetState(name, WorkerDisabled)\n}", "title": "" }, { "docid": "f5d27001d8fb0ac8e1eda1ab4004d632", "score": "0.48522806", "text": "func (device *IndustrialAnalogOutBricklet) Disable() (err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Set(uint8(FunctionDisable), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a60c69f13709785870d81f9898e0676", "score": "0.48488787", "text": "func Disable(key string) {\n\tdelete(experiments, key)\n}", "title": "" }, { "docid": "34a07ea4bfcfeac2b6d8f81fde1b6217", "score": "0.48422104", "text": "func (pwm PWM) Disable() {\n\tpwm.P.CR1.Store(0)\n}", "title": "" }, { "docid": "53e8c297fd10144b13e50ee2bf8a0c25", "score": "0.48366767", "text": "func (c *Concierge) Disable() error {\n\tvar service *mgr.Service\n\tok, err := c.ServiceExists()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error checking if the service exists\")\n\t}\n\tif !ok {\n\t\treturn errors.Errorf(\"service %s not found\", c.path)\n\t}\n\n\tif service, err = c.fetchService(); err != nil {\n\t\treturn errors.Wrap(err, \"error fetching the service\")\n\t}\n\tdefer service.Close()\n\n\tif _, err := service.Control(svc.Stop); err != nil {\n\t\treturn errors.Wrap(err, \"error stopping the service\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37f4effe14b84a579675288f7de9b40d", "score": "0.48339057", "text": "func WithDisableServiceConfig() DialOption {\n\treturn newFuncDialOption(func(o *dialOptions) {\n\t\to.disableServiceConfig = true\n\t})\n}", "title": "" }, { "docid": "5b31731dc094f6d03270135308d5dc5f", "score": "0.4826011", "text": "func (c *Debugger) Disable() (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.disable\"})\n}", "title": "" }, { "docid": "08ef498d968ba3f93ec28d463148e285", "score": "0.48145166", "text": "func (bt *BrbTimer) Disable() (brbAt time.Time) {\n\tbt.client.stateMutex.Lock()\n\tdefer bt.client.stateMutex.Unlock()\n\n\tif bt.state == BrbEnabled {\n\t\tbt.state = BrbDisabled\n\t\tbrbAt = bt.brbAt\n\t\tbt.brbAt = time.Time{}\n\t}\n\tbt.resetTimeout()\n\treturn\n}", "title": "" }, { "docid": "9b64fef14990b2dd326a78223f45fbac", "score": "0.47994572", "text": "func (f *FieldSetType) Disable() *FieldSetType {\n\tf.AddTag(\"disabled\")\n\treturn f\n}", "title": "" }, { "docid": "1875c34c8360b85494cc86b310c2888c", "score": "0.47977352", "text": "func (o IdentityServiceGoogleConfigPtrOutput) Disable() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *IdentityServiceGoogleConfig) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Disable\n\t}).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "e6ea47cda5ac25f20faab438cbb624e3", "score": "0.4790449", "text": "func DisableLog() {\n\tlogger = seelog.Disabled\n}", "title": "" }, { "docid": "3454ee28d5482b36eb5e74b9edb24453", "score": "0.4786228", "text": "func Disable() {\n\tos.Setenv(\"DEBUG\", \"\")\n\tlogrus.SetLevel(logrus.InfoLevel)\n}", "title": "" }, { "docid": "730679b211ad29795baab8df21c3f797", "score": "0.47857913", "text": "func DisableLog() {\n\tdebugLogger = seelog.Disabled\n}", "title": "" }, { "docid": "0ed1e92a31ca7ab116d5a5d0d59aaeb7", "score": "0.47648126", "text": "func (r *BlockingResolver) DisableBlocking(duration time.Duration, disableGroups []string) error {\n\ts := r.status\n\ts.enableTimer.Stop()\n\ts.enabled = false\n\tallBlockingGroups := r.retrieveAllBlockingGroups()\n\n\tif len(disableGroups) == 0 {\n\t\ts.disabledGroups = allBlockingGroups\n\t} else {\n\t\tfor _, g := range disableGroups {\n\t\t\ti := sort.SearchStrings(allBlockingGroups, g)\n\t\t\tif !(i < len(allBlockingGroups) && allBlockingGroups[i] == g) {\n\t\t\t\treturn fmt.Errorf(\"group '%s' is unknown\", g)\n\t\t\t}\n\t\t}\n\t\ts.disabledGroups = disableGroups\n\t}\n\n\tevt.Bus().Publish(evt.BlockingEnabledEvent, false)\n\n\ts.disableEnd = time.Now().Add(duration)\n\n\tif duration == 0 {\n\t\tlog.Log().Infof(\"disable blocking for group(s) '%s'\", strings.Join(s.disabledGroups, \"; \"))\n\t} else {\n\t\tlog.Log().Infof(\"disable blocking for %s for group(s) '%s'\", duration, strings.Join(s.disabledGroups, \"; \"))\n\t\ts.enableTimer = time.AfterFunc(duration, func() {\n\t\t\tr.EnableBlocking()\n\t\t\tlog.Log().Info(\"blocking enabled again\")\n\t\t})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3090c2b4c4ffba75de7c8c1eec65a6f3", "score": "0.47581562", "text": "func Disable(appName string) error {\n\tif !IsAppProxyEnabled(appName) {\n\t\tcommon.LogInfo1(\"Proxy is already disable for app\")\n\t\treturn nil\n\t}\n\n\tcommon.LogInfo1(\"Disabling proxy for app\")\n\tentries := map[string]string{\n\t\t\"DOKKU_DISABLE_PROXY\": \"1\",\n\t}\n\n\tif err := config.SetMany(appName, entries, false); err != nil {\n\t\treturn err\n\t}\n\n\treturn common.PlugnTrigger(\"proxy-disable\", []string{appName}...)\n}", "title": "" }, { "docid": "586806cd0d1e054f6f9f10395764a7e6", "score": "0.47556195", "text": "func (o *MockOracle) Disable() {\n\to.Lock()\n\tdefer o.Unlock()\n\to.stop = true\n}", "title": "" }, { "docid": "2b78045caccfc5fbb15ee3d1acae7cb5", "score": "0.47531638", "text": "func DisableFeature(c *gin.Context) {\n\tfeature := c.Param(\"name\")\n\tenabled := featureService.DisableFeature(feature)\n\n\tif enabled == false {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"message\": \"can not enable feature!\"})\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\"message\": \"successfully disabled!!\"})\n\t}\n}", "title": "" }, { "docid": "e3b85e6e62540bacc1d50a4ca440fa09", "score": "0.4752993", "text": "func (c *ChromeDebugger) Disable() (*ChromeResponse, error) {\n return sendDefaultRequest(c.target.sendCh, &ParamRequest{Id: c.target.getId(), Method: \"Debugger.disable\"})\n}", "title": "" }, { "docid": "52c7b428bd62e594053a4d62cc1b9442", "score": "0.47448963", "text": "func (b *ContainerBuilder) HealthDisable() *ContainerBuilder {\n\tb.ensureHealth()\n\tb.ContainerConfig.Healthcheck.Test = []string{\"NONE\"}\n\n\treturn b\n}", "title": "" }, { "docid": "699384d1a619ff9b83b44c52ba504654", "score": "0.47434723", "text": "func (m *MeshConfig) GetDisableMixerHttpReports() bool {\n\tif m != nil {\n\t\treturn m.DisableMixerHttpReports\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ef266bbf74e31fd7179f14cd67a8faa0", "score": "0.4738878", "text": "func (doFetch Fetch) Disable() (err error) {\n\tb := fetch.Disable()\n\treturn b.Do(doFetch.ctxWithExecutor)\n}", "title": "" }, { "docid": "56c63594d9940f95767d6c6bd12905da", "score": "0.4734825", "text": "func (i *Installer) disableAlertManagerWarning(ctx context.Context) error {\n\treturn retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\ts, err := i.kubernetescli.CoreV1().Secrets(\"openshift-monitoring\").Get(\"alertmanager-main\", metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar am map[string]interface{}\n\t\terr = yaml.Unmarshal(s.Data[\"alertmanager.yaml\"], &am)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, r := range am[\"receivers\"].([]interface{}) {\n\t\t\tr := r.(map[string]interface{})\n\t\t\tif name, ok := r[\"name\"]; !ok || name != \"null\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tr[\"webhook_configs\"] = []interface{}{\n\t\t\t\tmap[string]interface{}{\"url\": \"http://localhost:1234/\"}, // dummy\n\t\t\t}\n\t\t}\n\n\t\ts.Data[\"alertmanager.yaml\"], err = yaml.Marshal(am)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = i.kubernetescli.CoreV1().Secrets(\"openshift-monitoring\").Update(s)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "47f3c7c9bb8be763b3068ca79a33e067", "score": "0.47289908", "text": "func (w *World) Disable(o Object, dt DisableType, d InstanceDuration) {\n\tw.AttachEffect(NewDisable(w, o, dt, w.clock.Add(d)))\n}", "title": "" }, { "docid": "3ce66744b952aff9614f57fd89d1d945", "score": "0.47272342", "text": "func (module *BBAnalogModule) Disable() error {\n\t// Unassign any pins we may have assigned\n\tfor pin, _ := range module.definedPins {\n\t\t// attempt to assign this pin for this module.\n\t\tUnassignPin(pin)\n\t}\n\n\t// if there are any open analog pins, close them\n\tfor _, openPin := range module.openPins {\n\t\topenPin.analogClose()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2fc4fd0022936616ede7e500b943a11", "score": "0.4715208", "text": "func Disable(address string) error {\n\treq := &protos.DisableMessage{}\n\tclient, err := getClient(address)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = client.Disable(context.Background(), req)\n\treturn err\n}", "title": "" }, { "docid": "1e230674414b4b70e11a74df189ab3d9", "score": "0.47108063", "text": "func DisableRESTClientMetrics() {\n\tclientmetrics.RequestLatency = noopLatency{}\n}", "title": "" }, { "docid": "bb72c74b185383172619150af2cf1551", "score": "0.47060528", "text": "func (c *MemoryJobCache) Disable(j *Job) error {\n\treturn disable(j, c, c.PersistOnWrite)\n}", "title": "" }, { "docid": "57b71308d44f90121ccf875b5239d432", "score": "0.4704616", "text": "func (c Capabilities) Without(feature string) Capabilities {\n\tc[feature] = false\n\treturn c\n}", "title": "" }, { "docid": "5184ad2e0bc8d55f9fdd036fe819af64", "score": "0.4696617", "text": "func (s *UsergroupsService) Disable(usergroup string) *UsergroupsDisableCall {\n\tvar call UsergroupsDisableCall\n\tcall.service = s\n\tcall.usergroup = usergroup\n\treturn &call\n}", "title": "" }, { "docid": "9487a8392d0983e4b2a1a39655e90b30", "score": "0.46895966", "text": "func (d DeisCmd) MaintenanceDisable(appID string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Disabling maintenance mode for %s... \", appID)\n\n\tquit := progress()\n\tb := false\n\t_, err = appsettings.Set(s.Client, appID, api.AppSettings{Maintenance: &b})\n\n\tquit <- true\n\t<-quit\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Print(\"done\\n\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "93c21309451ca878a022f19dee4df844", "score": "0.46724817", "text": "func DisableCache(disableCache bool) Option {\n\treturn func(renderer *renderer) {\n\t\trenderer.disableCache = disableCache\n\t}\n}", "title": "" }, { "docid": "f602646257c1962d6ab37c27e0e9b76e", "score": "0.46718016", "text": "func (s *Service) Disable() error {\n\n\toutput, err := exec.Command(\"/usr/bin/systemctl\", \"disable\", s.Name).CombinedOutput()\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s %s\", output, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4868670806d85ababfc42c0269efeb99", "score": "0.4667612", "text": "func DisableFeatureGate(c client.Client, featureGate string) (*bool, error) {\n\tvar previousValue = false\n\n\tif err := UpdateCDIConfig(c, func(config *cdiv1.CDIConfigSpec) {\n\t\tif !hasString(config.FeatureGates, featureGate) {\n\t\t\treturn\n\t\t}\n\n\t\tpreviousValue = true\n\t\tconfig.FeatureGates = removeString(config.FeatureGates, featureGate)\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &previousValue, nil\n}", "title": "" }, { "docid": "5c8876425d8bb507151ee5bc88e43bcb", "score": "0.46673003", "text": "func Disable() {\n\tentry.Disable()\n}", "title": "" }, { "docid": "153b3c960d2d8282d92fa8092bc55d72", "score": "0.46629792", "text": "func (p *Product) Disable() {\n\tp.Active = false\n\tp.UpdateAt = DateNow()\n}", "title": "" }, { "docid": "523ae2321e8b4f260541b6f356a40116", "score": "0.46447933", "text": "func (c *Command) Disable() {\n\tc.disabled = true\n}", "title": "" }, { "docid": "0473b3fe5b50d01a63d5fbe7e1d873aa", "score": "0.46447134", "text": "func Disable(c *golangsdk.ServiceClient, id string) (r JobResult) {\n\topts := DisableOpts{}\n\tb, err := opts.ToGroupDisableMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{200}}\n\t_, r.Err = c.Post(actionURL(c, id), b, &r.Body, reqOpt)\n\treturn\n}", "title": "" }, { "docid": "d82a0e768b3afd46938eca7222e610a3", "score": "0.46360517", "text": "func (as *AutoScaling) DisableMetricsCollection(asgName string, metrics []string) (\n\tresp *SimpleResp, err error) {\n\tparams := makeParams(\"DisableMetricsCollection\")\n\tparams[\"AutoScalingGroupName\"] = asgName\n\n\tif len(metrics) > 0 {\n\t\taddParamsList(params, \"Metrics.member\", metrics)\n\t}\n\n\tresp = new(SimpleResp)\n\tif err := as.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "f7ee6c3276b0638ba1ba14cf63b8edfd", "score": "0.4631017", "text": "func (m *Monitor) Configure(c *Config) error {\n\tconf := *c\n\tconf.Metrics = append([]Metric(nil), c.Metrics...)\n\n\t// Track if the user has already configured the metric.\n\tconfiguredMetrics := map[string]bool{}\n\n\tfor _, metricConfig := range c.Metrics {\n\t\tconfiguredMetrics[metricConfig.MetricName] = true\n\t}\n\n\t// For enabled metrics configure the Python metric name unless the user\n\t// already has.\n\tfor _, metric := range m.Output.EnabledMetrics() {\n\t\tmetricConfig := metricConfigMap[metric]\n\t\tif metricConfig == \"\" {\n\t\t\tm.Logger().Warnf(\"Unable to determine metric configuration name for %s\", metric)\n\t\t\tcontinue\n\t\t}\n\n\t\tif !configuredMetrics[metricConfig] {\n\t\t\tconf.Metrics = append(conf.Metrics, Metric{metricConfig, true})\n\t\t}\n\t}\n\n\tconf.pyConf = &python.Config{\n\t\tMonitorConfig: conf.MonitorConfig,\n\t\tHost: conf.Host,\n\t\tPort: conf.Port,\n\t\tModuleName: \"kong_plugin\",\n\t\tModulePaths: []string{collectd.MakePythonPluginPath(\"kong\")},\n\t\tTypesDBPaths: []string{collectd.DefaultTypesDBPath()},\n\t\tPluginConfig: map[string]interface{}{\n\t\t\t\"URL\": conf.URL,\n\t\t\t\"Interval\": conf.IntervalSeconds,\n\t\t\t\"Verbose\": conf.Verbose,\n\t\t\t\"Name\": conf.Name,\n\t\t\t\"VerifyCerts\": conf.VerifyCerts,\n\t\t\t\"CABundle\": conf.CABundle,\n\t\t\t\"ClientCert\": conf.ClientCert,\n\t\t\t\"ClientCertKey\": conf.ClientCertKey,\n\t\t\t\"ReportAPIIDs\": conf.ReportAPIIDs,\n\t\t\t\"ReportAPINames\": conf.ReportAPINames,\n\t\t\t\"ReportServiceIDs\": conf.ReportServiceIDs,\n\t\t\t\"ReportServiceNames\": conf.ReportServiceNames,\n\t\t\t\"ReportRouteIDs\": conf.ReportRouteIDs,\n\t\t\t\"ReportHTTPMethods\": conf.ReportHTTPMethods,\n\t\t\t\"ReportStatusCodeGroups\": conf.ReportStatusCodeGroups,\n\t\t\t\"ReportStatusCodes\": conf.ReportStatusCodes,\n\t\t\t\"APIIDs\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.APIIDs,\n\t\t\t},\n\t\t\t\"APIIDsBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.APIIDsBlacklist,\n\t\t\t},\n\t\t\t\"APINames\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.APINames,\n\t\t\t},\n\t\t\t\"APINamesBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.APINamesBlacklist,\n\t\t\t},\n\t\t\t\"ServiceIDs\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.ServiceIDs,\n\t\t\t},\n\t\t\t\"ServiceIDsBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.ServiceIDsBlacklist,\n\t\t\t},\n\t\t\t\"ServiceNames\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.ServiceNames,\n\t\t\t},\n\t\t\t\"ServiceNamesBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.ServiceNamesBlacklist,\n\t\t\t},\n\t\t\t\"RouteIDs\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.RouteIDs,\n\t\t\t},\n\t\t\t\"RouteIDsBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.RouteIDsBlacklist,\n\t\t\t},\n\t\t\t\"HTTPMethods\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.HTTPMethods,\n\t\t\t},\n\t\t\t\"HTTPMethodsBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.HTTPMethodsBlacklist,\n\t\t\t},\n\t\t\t\"StatusCodes\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.StatusCodes,\n\t\t\t},\n\t\t\t\"StatusCodesBlacklist\": map[string]interface{}{\n\t\t\t\t\"#flatten\": true,\n\t\t\t\t\"values\": conf.StatusCodesBlacklist,\n\t\t\t},\n\t\t},\n\t}\n\n\tif conf.AuthHeader != nil {\n\t\tconf.pyConf.PluginConfig[\"AuthHeader\"] = []string{conf.AuthHeader.HeaderName, conf.AuthHeader.Value}\n\t}\n\n\tif len(conf.Metrics) > 0 {\n\t\tvalues := make([][]interface{}, 0, len(conf.Metrics))\n\t\tfor _, m := range conf.Metrics {\n\t\t\tvalues = append(values, []interface{}{m.MetricName, m.ReportBool})\n\t\t}\n\t\tconf.pyConf.PluginConfig[\"Metric\"] = map[string]interface{}{\n\t\t\t\"#flatten\": true,\n\t\t\t\"values\": values,\n\t\t}\n\t}\n\n\treturn m.PyMonitor.Configure(&conf)\n}", "title": "" }, { "docid": "427190817b6cd95e0eacd50efdddd0d6", "score": "0.46100605", "text": "func Disable() (state State) {\n\t// Save the previous interrupt state.\n\tstate = State(gba.INTERRUPT.PAUSE.Get())\n\t// Disable all interrupts.\n\tgba.INTERRUPT.PAUSE.Set(0)\n\treturn\n}", "title": "" }, { "docid": "e758367dfed7bf49c2b41f0bb2937f8b", "score": "0.4606595", "text": "func (s *RPCServer) DisableSubsystem(ctx context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericSubsystemResponse, error) {\n\terr := SetSubsystem(r.Subsystem, false)\n\treturn &gctrpc.GenericSubsystemResponse{}, err\n}", "title": "" }, { "docid": "4ba901de55a71a29bb037a11364118bc", "score": "0.46059293", "text": "func (s *Chaser) StopWithoutReporting() {\n\ts.skipNotify = true\n\ts.Stop()\n}", "title": "" } ]
c877b41b8764ac03b7567a4c0c6bda0f
Returns cell's value by determining which type it is (CCell or ICell) Receives c as cell stored inside the graph vertex Returns the integer value
[ { "docid": "7be8130fa770b64956d39959e8ef49e5", "score": "0.6334926", "text": "func getValueByType(c interface{}) int {\n\tvar value int\n\n\tswitch c.(type) {\n\tcase *CCell:\n\t\tvalue = c.(*CCell).Value()\n\tcase *ICell:\n\t\tvalue = c.(*ICell).Value()\n\t}\n\n\treturn value\n}", "title": "" } ]
[ { "docid": "a74af8769af9064dfee641bc243a025c", "score": "0.72603655", "text": "func (c *RCell) Value() int {\n\treturn int(*c)\n}", "title": "" }, { "docid": "0206cd8f24e4e77d81e9d645bcfe92cb", "score": "0.6486104", "text": "func (ic *inputCell) Value() int {\n\treturn ic.value\n}", "title": "" }, { "docid": "7289145aeb87135f9139b0bd396752b7", "score": "0.6370773", "text": "func (c *Cell) Int() (int, error) {\n\tf, err := strconv.ParseFloat(c.Value, 64)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn int(f), nil\n}", "title": "" }, { "docid": "30e2f07b1018bb3955f1f3c6f95a07d8", "score": "0.63680434", "text": "func (c Coord) C() int { return c.x }", "title": "" }, { "docid": "5ad4579373cbcde60a8ed4632a60f0af", "score": "0.6220141", "text": "func (b *Board) Cell(r, c int) int {\n return b.cell[r][c]\n}", "title": "" }, { "docid": "6e6066f2969d709404d495e4ac5316cc", "score": "0.6074491", "text": "func (cc *computeCell) Value() int {\n\treturn cc.compute()\n}", "title": "" }, { "docid": "81a7f5840c22c95288e9c336698af8db", "score": "0.562947", "text": "func (leaf *LeafC) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "dfc626381ca0b995def7be6e28e59a0e", "score": "0.56265056", "text": "func (grid Grid) GetCellValue(row, col int) int {\n\treturn grid.cells[row][col].Value\n}", "title": "" }, { "docid": "e9e0c5454cabd1a70da75cd98c261764", "score": "0.5592453", "text": "func (self *sudoku) getCellValue(i, j int) []int {\n\treturn (*self).sudokuMatrix[i][j]\n}", "title": "" }, { "docid": "317f55901316494a6298ab05fd3cec8e", "score": "0.55800027", "text": "func (c *columnInt) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "317f55901316494a6298ab05fd3cec8e", "score": "0.55800027", "text": "func (c *columnInt) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "7e28628296903158194cbef35e4f64f1", "score": "0.5515745", "text": "func (c *Cell) Type() CellType {\n\treturn c.cellType\n}", "title": "" }, { "docid": "d7f9d821ada10bd530fd1e26443f99a3", "score": "0.55120355", "text": "func (s *Spreadsheet) Get(cell string) int {\n\telem := s.cells[cell]\n\treturn elem\n}", "title": "" }, { "docid": "8e8167110153cf515bea4b472b89e9bc", "score": "0.55057484", "text": "func (f *Row) Value() int {\n\treturn int(binary.BigEndian.Uint32(f.data))\n}", "title": "" }, { "docid": "56194b7e09419032ddce81bec5f16c33", "score": "0.54798716", "text": "func (n *Node) IntValue() int {\n\ttype inter interface {\n\t\tInt() int\n\t}\n\tif v, ok := n.value.(int); ok {\n\t\treturn v\n\t} else if v, ok := n.value.(inter); ok {\n\t\treturn v.Int()\n\t}\n\tpanic(\"\") // TODO: Write this!\n}", "title": "" }, { "docid": "3bec3c1d8ab32a521c78064eca17874d", "score": "0.5450666", "text": "func (c *Cell) X() int {\n\treturn c.x\n}", "title": "" }, { "docid": "43e3dd433ab39058f69fe2f5e51076c6", "score": "0.5429098", "text": "func (c *columnInt32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "43e3dd433ab39058f69fe2f5e51076c6", "score": "0.5429098", "text": "func (c *columnInt32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "236e08902cc971222301e2707a86ec82", "score": "0.5383392", "text": "func (c *Cell) String() string {\n\treturn c.Value\n}", "title": "" }, { "docid": "dfba8dd24db184cb95ac38d40b3a52ef", "score": "0.5376001", "text": "func Evaluate(cs *cells.Cells, c *cells.Cell) cells.CellValue {\n\tif c.HasValue() {\n\t\treturn c.Value\n\t}\n\n\tif c.CycleState == cells.Pending {\n\t\tc.CycleState = cells.Cycle\n\t\tc.Value = cells.NewErrorValue(\"Cycle detected\")\n\t\treturn c.Value\n\t}\n\n\tc.CycleState = cells.Pending\n\n\ttokens := strings.Fields(c.Expr)\n\n\tdefer func() {\n\t\tif c.CycleState != cells.Cycle {\n\t\t\tc.CycleState = cells.NoCycle\n\t\t}\n\t}()\n\n\tif len(tokens) == 0 {\n\t\tc.Value = cells.NewFloatValue(0)\n\t\treturn c.Value\n\t}\n\n\tstack := stack.NewStack()\n\n\tfor _, token := range tokens {\n\t\tif value, ok := parseValue(token); ok {\n\t\t\tstack.Push(cells.NewFloatValue(value))\n\t\t} else if op, ok := parseOperation(token); ok {\n\t\t\tvalue2, ok2 := stack.Pop()\n\t\t\tvalue1, ok1 := stack.Pop()\n\t\t\tif !ok1 || !ok2 {\n\t\t\t\tc.Value = cells.NewErrorValue(\"Not enough operands\")\n\t\t\t\treturn c.Value\n\t\t\t}\n\t\t\tstack.Push(operations[op](value1, value2))\n\t\t} else if scol, row, ok := parseCellRef(token); ok {\n\t\t\tstack.Push(Evaluate(cs, cs.At(scol, row)))\n\t\t} else {\n\t\t\tc.Value = cells.NewErrorValue(\"Invalid Expression\")\n\t\t\treturn c.Value\n\t\t}\n\t}\n\n\tif stack.Len() == 1 {\n\t\tc.Value, _ = stack.Pop()\n\t} else {\n\t\tc.Value = cells.NewErrorValue(\"Invalid Expression\")\n\t}\n\treturn c.Value\n}", "title": "" }, { "docid": "d01a23658575f6262371d21085529a35", "score": "0.5318817", "text": "func (m *MergeCell) GetCellValue() string {\n\treturn (*m)[1]\n}", "title": "" }, { "docid": "e08f3f7d4058967040592056cc4e77d5", "score": "0.528678", "text": "func CellID(lat float64, lng float64) uint64 {\n\n\tlatlng := s2.LatLngFromDegrees(lat, lng)\n\n\tlatA := latlng.Lat\n\n\tlog.Println(\n\t\t\"lat degrees: \", latA.Degrees(),\n\t\t\"\\nradians: \", latA.Radians(),\n\t\t\"\\nE7: \", latA.E7(),\n\t\t\"\\nAbs: \", latA.Abs(),\n\t\t\"\\nNormalized: \", latA.Normalized(),\n\t\t\"\\nString: \", latA.String(),\n\t)\n\n\tpoint := s2.PointFromLatLng(latlng)\n\n\tlog.Println(\"point x: \", point.X, \" y: \", point.Y, \" z: \", point.Z)\n\n\tcid := s2.CellIDFromLatLng(latlng)\n\n\tlog.Println(\n\t\t\"cellID: \", cid,\n\t\t\"\\nToToken: \", cid.ToToken(),\n\t\t\"\\nIsValid: \", cid.IsValid(),\n\t\t\"\\nFace: \", cid.Face(),\n\t\t\"\\nPos: \", cid.Pos(),\n\t\t\"\\nLevel: \", cid.Level(),\n\t\t\"\\nIsLeaf: \", cid.IsLeaf(),\n\t\t\"\\nParent_level13: \", cid.Parent(13),\n\t\t\"\\nparent _level13's calculated level: \", cid.Parent(13).Level(),\n\t\t\"\\nString: \", cid.String(),\n\t\t\"\\nPoint: \", cid.Point(),\n\t\t\"\\nLatLng: \", cid.LatLng(),\n\t\t\"\\nfromtoken:\", s2.CellIDFromToken(cid.ToToken()),\n\t)\n\n\tparent := cid.Parent(29)\n\tlog.Println(\"parent contains cid:\", parent.Contains(cid))\n\n\treturn uint64(cid)\n\n}", "title": "" }, { "docid": "f9d1ecf785f7276d4c88ef072d2dbf3e", "score": "0.528251", "text": "func (c *columnInt64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "f9d1ecf785f7276d4c88ef072d2dbf3e", "score": "0.528251", "text": "func (c *columnInt64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "81d4714dbf601919aeffd87377aa0f75", "score": "0.52386683", "text": "func (d *Distances) Get(cell *Cell) int {\n\tif n, found := d.cells[cell]; found {\n\t\treturn n\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "b07603033169367103d8122bf36e6ff2", "score": "0.52203244", "text": "func LOGetCellValue(cell *ole.IDispatch) (value string) {\n\tval := oleutil.MustGetProperty(cell, \"value\")\n\tfmt.Printf(\"Cell: %+v\\n\", val)\n\treturn val.ToString()\n}", "title": "" }, { "docid": "ffb2921c5baf92e773ad968fe8c3396e", "score": "0.5212665", "text": "func (a *Cells) GetCell() (main Main, v Index, opta *Opta) {\n\tc := a.CellS[a.Level]\n\tmain, v, opta = c.Main, c.Index, c.Opta\n\treturn\n}", "title": "" }, { "docid": "f1dc0eff43dc09a1fb0a3a980b350506", "score": "0.51760924", "text": "func (c *columnUint32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "f1dc0eff43dc09a1fb0a3a980b350506", "score": "0.51760924", "text": "func (c *columnUint32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "761d15f89b679663c2ed2adfd9d58a72", "score": "0.5169022", "text": "func (c *columnFloat32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = float32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "761d15f89b679663c2ed2adfd9d58a72", "score": "0.5169022", "text": "func (c *columnFloat32) Value(idx uint32) (v interface{}, ok bool) {\n\tv = float32(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "ecd589b1a180b769c2eda81bddc3b110", "score": "0.5167502", "text": "func (c *columnUint) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "ecd589b1a180b769c2eda81bddc3b110", "score": "0.5167502", "text": "func (c *columnUint) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "8d83726fe38c13b597cfccc930dfc5e7", "score": "0.515894", "text": "func (c *cellConverter) cellToInt(cell string) (map[string]interface{}, error) {\n\tval := make(map[string]interface{})\n\n\tif err := json.Unmarshal([]byte(fmt.Sprintf(`{\"value\": %d}`, c.intVal)), &val); err != nil {\n\t\treturn c.cellToString(cell)\n\t}\n\n\treturn val, nil\n}", "title": "" }, { "docid": "d81c37196b168cc387854ed47f2562f1", "score": "0.5141803", "text": "func (leaf *LeafC) value() interface{} {\n\treturn leaf.val\n}", "title": "" }, { "docid": "a27fe0cab9bc9e2cac50de40d50a2fba", "score": "0.51345414", "text": "func (r *C) Value(col string) (interface{}, error) {\n\tswitch col {\n\tcase \"id\":\n\t\treturn r.ID, nil\n\tcase \"name\":\n\t\treturn r.Name, nil\n\tcase \"b_id\":\n\t\tv := r.Model.VirtualColumn(col)\n\t\tif v == nil {\n\t\t\treturn nil, kallax.ErrEmptyVirtualColumn\n\t\t}\n\t\treturn v, nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"kallax: invalid column in C: %s\", col)\n\t}\n}", "title": "" }, { "docid": "348312d9c5b688c9f4cca80df12da085", "score": "0.51014835", "text": "func (c *columnFloat64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = float64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "348312d9c5b688c9f4cca80df12da085", "score": "0.51014835", "text": "func (c *columnFloat64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = float64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "52b168c69f1592fe1cb39604294b7e47", "score": "0.5100481", "text": "func (xs *XScale) ValueToCell(v int) (int, error) {\n\tp, err := xs.ValueToPixel(v)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn p / braille.ColMult, nil\n}", "title": "" }, { "docid": "eb0451f30a9eca692439fcb81e37debd", "score": "0.5079661", "text": "func (c *Color) Value() int {\n\treturn c.set\n}", "title": "" }, { "docid": "4ee7b42a46f725c972a4f98312b147c6", "score": "0.5071931", "text": "func (i RedisDataType) IntValue() int {\n\treturn int(i)\n}", "title": "" }, { "docid": "8e97a08bdea277d754f525108f09019f", "score": "0.5069525", "text": "func (c Cell) SizeIJ() int {\n\treturn sizeIJ(int(c.level))\n}", "title": "" }, { "docid": "5979d1c1b70eab82b56fa0801b92768f", "score": "0.50683194", "text": "func (leaf *LeafI) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "706fe7a1583371997ab6ac0e7995e40a", "score": "0.506706", "text": "func (c *cardinality) Value(attributes call.Attributes) (int, error) {\n\tvalue, ok := attributes[string(*c)]\n\tif !ok {\n\t\tif *c == \"\" {\n\t\t\treturn 1, nil\n\t\t}\n\t\treturn strconv.Atoi(string(*c))\n\t}\n\tswitch value.(type) {\n\tcase int:\n\t\treturn value.(int), nil\n\tcase string:\n\t\treturn strconv.Atoi(value.(string))\n\tdefault:\n\t\treturn -1, errors.Errorf(\"unknown type: expected int or string, got %T\", value)\n\t}\n}", "title": "" }, { "docid": "3dee2ecb0c9eb9ed6090ca763e38b8c3", "score": "0.50660324", "text": "func (leaf *LeafS) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "6cd84dbfdc1a0277c68d5fdcbd6b9e86", "score": "0.5055146", "text": "func (c *columnUint64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "6cd84dbfdc1a0277c68d5fdcbd6b9e86", "score": "0.5055146", "text": "func (c *columnUint64) Value(idx uint32) (v interface{}, ok bool) {\n\tv = uint64(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "fc286b8d4e3ead52762936938bdaea4f", "score": "0.50491774", "text": "func (c *Cell) Render() string {\n\tswitch {\n\tcase c.Clicked == false:\n\t\treturn \"?\"\n\tcase c.Mine == true:\n\t\treturn \"X\"\n\tdefault:\n\t\treturn strconv.Itoa(c.Value)\n\t}\n}", "title": "" }, { "docid": "4ceb5582ae1f990374ed843464d8d012", "score": "0.50473326", "text": "func (leaf *LeafD) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "b5af0600fbe3c33eeff680ba620652d8", "score": "0.5044965", "text": "func (c Canvas) Value(x, y int) (rune, bool) {\n\treturn c[y][x].Value()\n}", "title": "" }, { "docid": "2f955a4697eb73bda1eadc995cd5bb8f", "score": "0.50383115", "text": "func (c *Cell) String() string {\n\t// To preserve the String() interface we'll throw away errors.\n\t// Note that using FormattedValue is therefore strongly\n\t// preferred.\n\tvalue, _ := c.FormattedValue()\n\treturn value\n}", "title": "" }, { "docid": "1b67918c3d34712185de9ea0c2d7e042", "score": "0.50210744", "text": "func (n *Node) Int() int {\n\treturn n.node.Int()\n}", "title": "" }, { "docid": "bc147a0582b494a6902ad0b9a109c3de", "score": "0.5016154", "text": "func (this *displayType) getPixelValue(row, column int) int {\n\tthatRow := this.led[row]\n\tpixel := thatRow[column]\n\n\treturn pixel\n}", "title": "" }, { "docid": "78bc4af1cd87f18309eddfe9e0be635e", "score": "0.5007464", "text": "func (A *Matrix) Get(r, c int) *big.Int {\n\treturn A.data[findIndex(r, c, A)]\n}", "title": "" }, { "docid": "58fb775ebc1d4fe7d193d983de17f58c", "score": "0.5001086", "text": "func (leaf *LeafL) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "ab81d03a147f51ff76c0f15f6a602dbe", "score": "0.50000376", "text": "func (leaf *LeafO) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "78f842eb5dcebdf33b8ef0120f120ee0", "score": "0.49944827", "text": "func (c *Cursor) Get() int {\n\treturn c.Square.Sq[c.Row][c.Col]\n}", "title": "" }, { "docid": "91e9c555f475e28982c6820333ff9dd0", "score": "0.4990974", "text": "func (leaf *LeafB) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "fc742cbf953df9574f34ca4f081713a5", "score": "0.49796805", "text": "func (m *FooModel) Value(row, col int) interface{} {\n\titem := m.items[row]\n\n\tswitch col {\n\tcase 0:\n\t\treturn item.Index\n\n\tcase 1:\n\t\treturn item.Name\n\n\tcase 2:\n\t\treturn item.Points\n\n\tcase 3:\n\t\treturn item.Date\n\t}\n\n\tpanic(\"unexpected col\")\n}", "title": "" }, { "docid": "9393655b233a43bbb4226978d823b9de", "score": "0.4969518", "text": "func constValue(i *interpreter, c *ssa.Const) value {\n\tif c.IsNil() {\n\t\treturn reflect.Zero(i.toType(c.Type())).Interface()\n\t\t// return zero(c.Type()) // typed nil\n\t}\n\tif t, ok := c.Type().Underlying().(*types.Basic); ok {\n\t\t// TODO(adonovan): eliminate untyped constants from SSA form.\n\t\tswitch t.Kind() {\n\t\tcase types.Bool, types.UntypedBool:\n\t\t\treturn constant.BoolVal(c.Value)\n\t\tcase types.Int, types.UntypedInt:\n\t\t\t// Assume sizeof(int) is same on host and target.\n\t\t\treturn int(c.Int64())\n\t\tcase types.Int8:\n\t\t\treturn int8(c.Int64())\n\t\tcase types.Int16:\n\t\t\treturn int16(c.Int64())\n\t\tcase types.Int32, types.UntypedRune:\n\t\t\treturn int32(c.Int64())\n\t\tcase types.Int64:\n\t\t\treturn c.Int64()\n\t\tcase types.Uint:\n\t\t\t// Assume sizeof(uint) is same on host and target.\n\t\t\treturn uint(c.Uint64())\n\t\tcase types.Uint8:\n\t\t\treturn uint8(c.Uint64())\n\t\tcase types.Uint16:\n\t\t\treturn uint16(c.Uint64())\n\t\tcase types.Uint32:\n\t\t\treturn uint32(c.Uint64())\n\t\tcase types.Uint64:\n\t\t\treturn c.Uint64()\n\t\tcase types.Uintptr:\n\t\t\t// Assume sizeof(uintptr) is same on host and target.\n\t\t\treturn uintptr(c.Uint64())\n\t\tcase types.Float32:\n\t\t\treturn float32(c.Float64())\n\t\tcase types.Float64, types.UntypedFloat:\n\t\t\treturn c.Float64()\n\t\tcase types.Complex64:\n\t\t\treturn complex64(c.Complex128())\n\t\tcase types.Complex128, types.UntypedComplex:\n\t\t\treturn c.Complex128()\n\t\tcase types.String, types.UntypedString:\n\t\t\tif c.Value.Kind() == constant.String {\n\t\t\t\treturn constant.StringVal(c.Value)\n\t\t\t}\n\t\t\treturn string(rune(c.Int64()))\n\t\t}\n\t}\n\n\tpanic(fmt.Sprintf(\"constValue: %s\", c))\n}", "title": "" }, { "docid": "76894cd0ea6088079040a64214df62ae", "score": "0.49541676", "text": "func setCellIntFunc(c *xlsxC, val interface{}) (err error) {\n\tswitch val := val.(type) {\n\tcase int:\n\t\tc.T, c.V = setCellInt(val)\n\tcase int8:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase int16:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase int32:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase int64:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase uint:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase uint8:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase uint16:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase uint32:\n\t\tc.T, c.V = setCellInt(int(val))\n\tcase uint64:\n\t\tc.T, c.V = setCellInt(int(val))\n\tdefault:\n\t}\n\treturn\n}", "title": "" }, { "docid": "a00100ea9a914a4b84e97631f58537b6", "score": "0.4953635", "text": "func (c *columnInt16) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int16(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "a00100ea9a914a4b84e97631f58537b6", "score": "0.4953635", "text": "func (c *columnInt16) Value(idx uint32) (v interface{}, ok bool) {\n\tv = int16(0)\n\tif idx < uint32(len(c.data)) && c.fill.Contains(idx) {\n\t\tv, ok = c.data[idx], true\n\t}\n\treturn\n}", "title": "" }, { "docid": "7f9e5e70ac62a1b67e256af77858f9a1", "score": "0.49536112", "text": "func (leaf *LeafS) ivalue() int {\n\treturn int(leaf.val[0])\n}", "title": "" }, { "docid": "0245f78dfb34281f03aa7fff528328f4", "score": "0.49516374", "text": "func (c Cell) String() string {\n\treturn fmt.Sprintf(\"[%c]\", c.val)\n}", "title": "" }, { "docid": "eec74704ee3809b7ff298b3922d2cdb4", "score": "0.4946794", "text": "func (it *Iter3) Value() int {\n\treturn it.prenode.data\n}", "title": "" }, { "docid": "638469036f2d962a18d267012ecf8904", "score": "0.4943198", "text": "func (g GaugeSnapshot) Value() int64 { return int64(g) }", "title": "" }, { "docid": "e2e3eaba8b9d4adab1459840723cad05", "score": "0.49415866", "text": "func (d *Dense) Get(i int, j int) int {\n\td.assertIndexes(i, j)\n\tpos := d.pos(i, j)\n\treturn d.cells[pos]\n}", "title": "" }, { "docid": "16baf2b541799ac25d747c42f8c7c0ad", "score": "0.4940166", "text": "func Cell() horizon.Script {\n\t// variables\n\tvar (\n\t\tvisited = false\n\t\tback horizon.Object\n\t)\n\treturn func(self horizon.Object, e horizon.Event) {\n\t\tprobe := self.Wires()[\"probe\"]\n\t\tswitch e.Name {\n\t\tcase \"visit\":\n\t\t\tobj := e.Arg.(horizon.Object)\n\t\t\tback = obj\n\t\t\tvisited = true\n\t\t\t// Select a random probe to initiate the next visit.\n\t\t\tself.Send(probe, \"visitRand\", rand.Int()%4)\n\t\tcase \"check\":\n\t\t\t// Someone wants to know if this cell has been visited.\n\t\t\tobj := e.Arg.(horizon.Object)\n\t\t\tself.Send(obj, \"checkResult\", visited)\n\t\tcase \"deadEnd\":\n\t\t\t// pop stack. the `back` cell will check for other unvisited neighbors before itself popping.\n\t\t\tself.Send(back, \"backTrack\", nil)\n\t\tcase \"backTrack\":\n\t\t\t// Check for other paths before popping stack again. Simplest way is to\n\t\t\t// re-use the existing \"visit\" logic.\n\t\t\tself.Send(self, \"visit\", back)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "88df367505bbcf458c59cafe8bb267b8", "score": "0.49337405", "text": "func (g Game) Get(row, col int) Cell { return g[row][col] }", "title": "" }, { "docid": "644eb979ba109752c3bdd224c09e6274", "score": "0.4932223", "text": "func (leaf *LeafF) Value(i int) interface{} {\n\treturn leaf.val[i]\n}", "title": "" }, { "docid": "d460ca4971115077477c23c38e36866f", "score": "0.49303943", "text": "func (leaf *LeafI) ivalue() int {\n\treturn int(leaf.val[0])\n}", "title": "" }, { "docid": "5b786494c962bac193b1c8a5b62c6627", "score": "0.49303886", "text": "func (m *IntMatrix) Value(i, j int) int32 {\n\tfor _, t := range m.values {\n\t\tif !t.storedLeftOf(i, j) { // have skipped all lesser indices\n\t\t\tif t.storedAt(i, j) {\n\t\t\t\treturn t.value.a\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn m.nullval\n}", "title": "" }, { "docid": "635a5c97a2ef229b90bde84c2cf94843", "score": "0.49272883", "text": "func (m *CondomStudentModel) Value(row, col int) interface{} {\n\titem := m.items[row]\n\tif item != nil {\n\t\tswitch col {\n\t\tcase 0:\n\t\t\treturn item.course\n\t\tcase 1:\n\t\t\treturn item.sorce\n\t\t}\n\t} else {\n\t\treturn \"\"\n\t}\n\n\tpanic(\"unexpected col\")\n}", "title": "" }, { "docid": "e26d1488c125c967395c13de52849405", "score": "0.49241328", "text": "func (A *Matrix) Get(r, c int) int {\n\treturn A.data[findIndex(r, c, A)]\n}", "title": "" }, { "docid": "4957776970f90cf5c24a6985c8655516", "score": "0.49222338", "text": "func getIdByType(c Cell) string {\n\tid := \"\"\n\tswitch c.(type) {\n\tcase *CCell:\n\t\tid = c.(*CCell).GetId()\n\tcase *ICell:\n\t\tid = c.(*ICell).GetId()\n\t}\n\n\treturn id\n}", "title": "" }, { "docid": "22c809edefbb10b2f38763bd782246de", "score": "0.49148262", "text": "func (c *ConditionalFormat) GetValue() int {\n\tif c == nil || c.Value == nil {\n\t\treturn 0\n\t}\n\treturn *c.Value\n}", "title": "" }, { "docid": "4de19520c446560771e42570f8ec8c6f", "score": "0.49070376", "text": "func (s *Suit) GetValue() int {\n return s.GetRank()\n}", "title": "" }, { "docid": "9127eb1b0e79168865dd7e8814c41994", "score": "0.49061266", "text": "func (leaf *LeafB) ivalue() int {\n\treturn int(leaf.val[0])\n}", "title": "" }, { "docid": "4ae356a82da9172d5831f66af0b329e3", "score": "0.49006268", "text": "func writeCell(buf *bufferedWriter, c xlsxC) {\n\t_, _ = buf.WriteString(`<c`)\n\tif c.XMLSpace.Value != \"\" {\n\t\t_, _ = buf.WriteString(` xml:`)\n\t\t_, _ = buf.WriteString(c.XMLSpace.Name.Local)\n\t\t_, _ = buf.WriteString(`=\"`)\n\t\t_, _ = buf.WriteString(c.XMLSpace.Value)\n\t\t_, _ = buf.WriteString(`\"`)\n\t}\n\t_, _ = buf.WriteString(` r=\"`)\n\t_, _ = buf.WriteString(c.R)\n\t_, _ = buf.WriteString(`\"`)\n\tif c.S != 0 {\n\t\t_, _ = buf.WriteString(` s=\"`)\n\t\t_, _ = buf.WriteString(strconv.Itoa(c.S))\n\t\t_, _ = buf.WriteString(`\"`)\n\t}\n\tif c.T != \"\" {\n\t\t_, _ = buf.WriteString(` t=\"`)\n\t\t_, _ = buf.WriteString(c.T)\n\t\t_, _ = buf.WriteString(`\"`)\n\t}\n\t_, _ = buf.WriteString(`>`)\n\tif c.F != nil {\n\t\t_, _ = buf.WriteString(`<f>`)\n\t\t_ = xml.EscapeText(buf, []byte(c.F.Content))\n\t\t_, _ = buf.WriteString(`</f>`)\n\t}\n\tif c.V != \"\" {\n\t\t_, _ = buf.WriteString(`<v>`)\n\t\t_ = xml.EscapeText(buf, []byte(c.V))\n\t\t_, _ = buf.WriteString(`</v>`)\n\t}\n\tif c.IS != nil {\n\t\tif len(c.IS.R) > 0 {\n\t\t\tis, _ := xml.Marshal(c.IS.R)\n\t\t\t_, _ = buf.WriteString(`<is>`)\n\t\t\t_, _ = buf.Write(is)\n\t\t\t_, _ = buf.WriteString(`</is>`)\n\t\t}\n\t\tif c.IS.T != nil {\n\t\t\t_, _ = buf.WriteString(`<is><t`)\n\t\t\tif c.IS.T.Space.Value != \"\" {\n\t\t\t\t_, _ = buf.WriteString(` xml:`)\n\t\t\t\t_, _ = buf.WriteString(c.IS.T.Space.Name.Local)\n\t\t\t\t_, _ = buf.WriteString(`=\"`)\n\t\t\t\t_, _ = buf.WriteString(c.IS.T.Space.Value)\n\t\t\t\t_, _ = buf.WriteString(`\"`)\n\t\t\t}\n\t\t\t_, _ = buf.WriteString(`>`)\n\t\t\t_, _ = buf.Write([]byte(c.IS.T.Val))\n\t\t\t_, _ = buf.WriteString(`</t></is>`)\n\t\t}\n\t}\n\t_, _ = buf.WriteString(`</c>`)\n}", "title": "" }, { "docid": "42a9bd58c78645cadc45fb121c069d71", "score": "0.48902363", "text": "func (v Value) Int() int64", "title": "" }, { "docid": "456daa72d180f1fe204373ba627fca5d", "score": "0.48857254", "text": "func (n *Number) Value() int {\n\treturn n.value\n}", "title": "" }, { "docid": "89a5d7045f85570de808861575151f47", "score": "0.48660186", "text": "func (n *Node) Value() float64 {\n\treturn n.val\n}", "title": "" }, { "docid": "d78890334fcf14a6d56f1a0430edb711", "score": "0.48576683", "text": "func getValue(c *computer) computer {\n\treturn *c\n}", "title": "" }, { "docid": "952b0c1ea67928dd124da57209bec63b", "score": "0.48528168", "text": "func (leaf *LeafL) ivalue() int {\n\treturn int(leaf.val[0])\n}", "title": "" }, { "docid": "1a2da22eedf6a8c5b0d9e86e06a96292", "score": "0.48489642", "text": "func (c *Char) GetInt() int {\n\treturn int(c.b)\n}", "title": "" }, { "docid": "83ba99c0c5a1f5b97cf6baaba32ffcad", "score": "0.4840724", "text": "func (b *Buffer) Get(col, row int) *Cell {\n\tb.check(col, row)\n\n\treturn b.cc[col+row*b.Cols]\n}", "title": "" }, { "docid": "41b954c421411f2dc75263377b7d42c2", "score": "0.48277524", "text": "func (p *ClientServiceClient) GetCell(ns Namespace, table_name string, row string, column string) (r Value, e *ClientException, err error) {\n\tif err = p.sendGetCell(ns, table_name, row, column); err != nil {\n\t\treturn\n\t}\n\treturn p.recvGetCell()\n}", "title": "" }, { "docid": "5d4cac69b9bf0b08106c6133cf29f4e3", "score": "0.48273683", "text": "func GetCellID(row uint32, col uint32) int64 {\n\treturn int64(row)<<32 | int64(col)\n}", "title": "" }, { "docid": "eb3f8422923d5b2489a6ad4aeaf79ff2", "score": "0.48125023", "text": "func (c *Int) GetValue() int {\n\treturn c.Characteristic.GetValue().(int)\n}", "title": "" }, { "docid": "322689aa3cf75ec1aa228b26b00b802f", "score": "0.48124695", "text": "func (u Vec2) C(i int) QQ {\n\treturn u.c[i]\n}", "title": "" }, { "docid": "d05d65b97b6ec47bfee521634a266980", "score": "0.4804588", "text": "func (c *Cursor) Value() (key KeyType, value []byte, err error) {\n\t// Return any previous error we've encountered.\n\tif c.advanceError != nil {\n\t\treturn zeroKey, nil, c.advanceError\n\t}\n\n\t// Get the current page.\n\tpage, err := c.table.pager.GetPage(c.pageNum)\n\tif err != nil {\n\t\t// Save this error.\n\t\tc.advanceError = errors.Wrap(err, \"unable to get page\")\n\t\treturn zeroKey, nil, c.advanceError\n\t}\n\n\t// We always point to a leaf node.\n\tleaf := pageToLeafNode(page)\n\n\t// Get the cell data.\n\tkey, value = leaf.getCell(c.table, c.cellNum)\n\n\treturn key, value, nil\n}", "title": "" }, { "docid": "011abc622a007865559ce4e4b535800a", "score": "0.48044792", "text": "func (c Coord) X() int { return c.x }", "title": "" }, { "docid": "5bcd3dcf1afbfc2f9fe52d85eaab92b8", "score": "0.48014334", "text": "func (m *MapOfCharacterToGlyphIndex) Val(k rune) (uint, bool) {\n\ti, ok := m.Index(k)\n\tif !ok {\n\t\treturn 0, false\n\t}\n\treturn m.Vals[i], true\n}", "title": "" }, { "docid": "45f9da67f022d2ae5ab7c1a674043a4f", "score": "0.47983995", "text": "func Cell2Int64(val xorm.Cell) int64 {\n\tswitch (*val).(type) {\n\tcase []uint8:\n\t\tlog.Trace(\"Cell2Int64 ([]uint8): %v\", *val)\n\t\treturn com.StrTo(string((*val).([]uint8))).MustInt64()\n\t}\n\treturn (*val).(int64)\n}", "title": "" }, { "docid": "5d10d137b1b9551c7feff11741afdb55", "score": "0.47856516", "text": "func whoami(c Cell)(name string) {\n\tinputC, fst := c.(myInputCell)\n computeC, _ := c.(myComputeCell)\n\tif fst {\n\t name = inputC.id\n\t} else { \n name = computeC.id\n }\n return\n\t\n}", "title": "" }, { "docid": "9b7e42c6ad3faf7a098eb2d2b352ce2a", "score": "0.4780554", "text": "func (i RedisRadiusUnit) IntValue() int {\n\treturn int(i)\n}", "title": "" }, { "docid": "b41dc4584ff9723996f73ef6c8ba2cdf", "score": "0.477342", "text": "func (c Coord) R() int { return c.y }", "title": "" }, { "docid": "6900237d9a523e08061d16f14a72a777", "score": "0.47685507", "text": "func (e DataType) C() C.cudnnDataType_t { return C.cudnnDataType_t(e) }", "title": "" }, { "docid": "f4acbdba1c660873bac7031f5c7bb79a", "score": "0.47662032", "text": "func (m *FooModel) Value(row, col int) interface{} {\n\titem := m.sItems[row]\n\tswitch col {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn item.Name\n\tcase 2:\n\t\treturn item.Phone\n\tcase 3:\n\t\treturn item.Sex\n\tcase 4:\n\t\treturn item.Age\n\tcase 5:\n\t\treturn item.AllFee\n\tcase 6:\n\t\treturn item.RealFee\n\tcase 7:\n\t\treturn item.PaidFee\n\tcase 8:\n\t\treturn item.Create\n\tcase 9:\n\t\treturn item.Update\n\tcase 10:\n\t\treturn item.Diagnosed\n\tcase 11:\n\t\treturn item.Program\n\tcase 12:\n\t\treturn item.Address\n\tcase 13:\n\t\treturn item.Deleted\n\t}\n\n\tpanic(\"unexpected col\")\n}", "title": "" } ]
3c4feb34b39209a5cb438ee08aeacf44
IsUnitTesting returns true if the unit testing env var is set
[ { "docid": "cafd4eda9e791dc779ad990ed2ca58c5", "score": "0.8711466", "text": "func IsUnitTesting() bool {\n\t_, isSet := os.LookupEnv(constants.UnitTestingEnvVar)\n\treturn isSet\n}", "title": "" } ]
[ { "docid": "7dfd9c694471dfa8d779bd7c75d348f5", "score": "0.73897254", "text": "func (c *ViperConfig) IsTestingMode() bool {\n\treturn c.GetEnvironment() == UnitTestsEnvironment\n}", "title": "" }, { "docid": "e2d2e828358cbf9a45955b80406c391f", "score": "0.736417", "text": "func IsTestEnvironment() bool {\n\treturn env == \"tests\"\n}", "title": "" }, { "docid": "03b287a5d7eb32203277da812166e306", "score": "0.71809685", "text": "func IsTest() bool {\n\tcurrMode := os.Getenv(EnvVarMode)\n\treturn strings.ToLower(currMode) == strings.ToLower(AlunModeTest)\n}", "title": "" }, { "docid": "83f4369f3011936727a7e20d08b58499", "score": "0.71708196", "text": "func IsTesting() bool {\n\treturn flag.Lookup(\"test.v\") != nil\n}", "title": "" }, { "docid": "ddd462c9e30bb8ea5558b3a62ed14f81", "score": "0.6991146", "text": "func IsTestEnv() bool {\n\treturn Env.GoEnv == \"test\"\n}", "title": "" }, { "docid": "5d29cd4c16c9d68481571c6833e1b7bc", "score": "0.6982728", "text": "func IsTesting(args []string) bool {\n\tfor _, arg := range args {\n\t\tif arg == \"loadtest\" {\n\t\t\tfmt.Println(\"Load testing enabled\")\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6047d4b252d50bff4712d492d868f642", "score": "0.683307", "text": "func (e Env) IsTest() bool {\n\treturn e == \"test\"\n}", "title": "" }, { "docid": "1129a6a04895407d942447febedcd37a", "score": "0.6681431", "text": "func SetUnitTestingEnv() {\n\tos.Setenv(constants.UnitTestingEnvVar, \"true\")\n}", "title": "" }, { "docid": "084b070fcb967072e36cf90e65a07c3b", "score": "0.66712487", "text": "func (c *Config) TestingEnv() bool {\n\treturn c.TestFSP.Count > 0\n}", "title": "" }, { "docid": "21ec1c850c7670c049a87afedb96d120", "score": "0.6661063", "text": "func (f *BaseFeature) InTestMode() bool {\n\treturn strings.HasSuffix(os.Args[0], \".test\")\n\n}", "title": "" }, { "docid": "4273004142e8cb8d710976fdb0eaa14f", "score": "0.6444089", "text": "func IsDevelopmentEnv() bool { return GetEnvironment() == devMode }", "title": "" }, { "docid": "aee0af54f60705e41cc1914ab8ee8d57", "score": "0.63441133", "text": "func inTest() bool {\n\tinTest, _ := strconv.ParseBool(os.Getenv(\"IN_TS_TEST\"))\n\treturn inTest\n}", "title": "" }, { "docid": "c744a33143eea7bf842b017456e0e02e", "score": "0.6291687", "text": "func Testing() bool {\n\t// detect if an argument has the prefix \"-test.\" or suffix \".test\"\n\tfor _, arg := range os.Args {\n\t\tif strings.HasPrefix(arg, \"-test.\") || strings.HasSuffix(arg, \".test\") {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4fc1988b1bc9768e80eea7236fa033e2", "score": "0.62580466", "text": "func IntegrationTestsEnabled() bool {\n\treturn os.Getenv(\"INTEGRATION\") == \"1\"\n}", "title": "" }, { "docid": "be89db1235bb22c2b68d0d623aa70a03", "score": "0.61838955", "text": "func (e MTPConfigEnvironment) Test() bool {\n\treturn e == 1\n}", "title": "" }, { "docid": "bed0b16968f3c663ff3a50e92f973fda", "score": "0.61710846", "text": "func IsUnitTest(pod *Pod) bool {\n\treturn len(pod.Status.Phase) == 0\n}", "title": "" }, { "docid": "ebbb54b1a83db046337821d364ef0528", "score": "0.6166882", "text": "func IsInIntegTestEnv() bool {\n\t_, found := os.LookupEnv(beatsDockerIntegrationTestEnvVar)\n\treturn found\n}", "title": "" }, { "docid": "fb8f4df3a6cd280973d9de8dbd40beb4", "score": "0.6166845", "text": "func SetToTestingEnv() {\n\tGDevEnv = false\n\tGUnitTestingEnv = true\n}", "title": "" }, { "docid": "e3af39d08e8391b80f2dd65e6b3d32e4", "score": "0.6020541", "text": "func TestNet() bool {\n\treturn Configuration.DeploymentMode == DeploymentTestNet\n}", "title": "" }, { "docid": "a7b67a1bc0392bba27da9dafcb88f656", "score": "0.6003593", "text": "func TestIsDebug(t *testing.T) {\n\tvar tests = []struct {\n\t\tvalue string\n\t\texpected bool\n\t}{\n\t\t// Garbage values\n\t\t{envTest, false},\n\t\t{\"HELLO\", false},\n\t\t{\"WORLD\", false},\n\n\t\t// Correct values\n\t\t{disabled, false},\n\t\t{enabled, true},\n\t}\n\n\tfor i, test := range tests {\n\t\tif err := os.Setenv(envDebug, test.value); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif IsDebug() != test.expected {\n\t\t\tt.Fatalf(\"[%02d] unexpected environment variable value and expected value: %v\", i, test)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32afe977d252925535bb5a43c0b2222f", "score": "0.59652084", "text": "func TestIsTest(t *testing.T) {\n\tvar tests = []struct {\n\t\tvalue string\n\t\texpected bool\n\t}{\n\t\t// Garbage values\n\t\t{envDebug, false},\n\t\t{\"HELLO\", false},\n\t\t{\"WORLD\", false},\n\n\t\t// Correct values\n\t\t{disabled, false},\n\t\t{enabled, true},\n\t}\n\n\tfor i, test := range tests {\n\t\tif err := os.Setenv(envTest, test.value); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif IsTest() != test.expected {\n\t\t\tt.Fatalf(\"[%02d] unexpected environment variable value and expected value: %v\", i, test)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a7374f7b9a43c604533ec07c9467057", "score": "0.5922503", "text": "func IsSetUp() bool {\n\treturn webhookServer != nil\n}", "title": "" }, { "docid": "dd96849c4a13811ae01b5a8e0cf318b5", "score": "0.5917281", "text": "func IsDev() bool {\n\tcurrMode := os.Getenv(EnvVarMode)\n\treturn strings.ToLower(currMode) == strings.ToLower(AlunModeDev)\n}", "title": "" }, { "docid": "4927644371e2b2502ae471bf4db8d389", "score": "0.5906559", "text": "func isE2ETestingAllowed() bool {\n\tboolean, err := strconv.ParseBool(os.Getenv(\"ENABLE_E2E_TEST\"))\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn boolean\n}", "title": "" }, { "docid": "6882921696546635832218ff5431a970", "score": "0.58619195", "text": "func UnitTest() {\n\tmg.SerialDeps(GoUnitTest, PythonUnitTest)\n}", "title": "" }, { "docid": "5362e540bf5081b12b0bd49b69263a1c", "score": "0.5714783", "text": "func UnitTest() error {\n\tmg.Deps(Format)\n\tfmt.Println(\"Running Unit tests...\")\n\treturn sh.RunV(\"go\", \"test\", \"./...\", \"-run\", \"TestUN_\", \"-v\")\n}", "title": "" }, { "docid": "f50d2abeb153b33ea7a64c895eeedeaa", "score": "0.5714172", "text": "func isVerboseTesting() bool {\n\tfor _, arg := range os.Args {\n\t\tif arg == \"-test.v=true\" || arg == \"-test.v\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6ffb64cd21a81a0836fc3a918b3fc13c", "score": "0.5698358", "text": "func InTestWrapper() bool {\n\treturn os.Getenv(\"TS_IN_TESTWRAPPER\") != \"\"\n}", "title": "" }, { "docid": "82376eb876f73abaa30e2222c5ea18cb", "score": "0.5678162", "text": "func TestSystem(t *testing.T) {\n\n\tif *systemTest {\n\t\tmain()\n\t}\n}", "title": "" }, { "docid": "0ec869db8a9027b58a45ddc2972e249f", "score": "0.5619218", "text": "func (target *BuildTarget) IsTest() bool {\n\treturn target.Test != nil\n}", "title": "" }, { "docid": "9e83f5d07b8b374c39fc9d07ba0358c5", "score": "0.5571325", "text": "func isTesting(firstArg string) bool {\n\tmatched, _ := regexp.MatchString(\".test$\", firstArg)\n\treturn matched\n}", "title": "" }, { "docid": "2a920a70661ff28756133986e6a1337b", "score": "0.55391014", "text": "func IsDevEnv() bool {\n\treturn Get(\"env\") == \"dev\"\n}", "title": "" }, { "docid": "f0a0557f627d78eddfb0176188e8e295", "score": "0.5472143", "text": "func (Adapter *Adapter) IsDevelopingMode() bool {\n\treturn Adapter.GetApplicationMode() == \"dev\"\n}", "title": "" }, { "docid": "948525c269ab56d9d1b0321841ad8214", "score": "0.5456939", "text": "func EnsureIntegrationTest(t *testing.T) {\n\tif _, ok := os.LookupEnv(\"INTEGRATION_TEST\"); !ok {\n\t\tt.Skip(\"skip an integration test\")\n\t}\n}", "title": "" }, { "docid": "25f12f68ad533ebec1a513f6e8363ef1", "score": "0.54489696", "text": "func Test() {\n\tmg.Deps(unittest.GoUnitTest)\n}", "title": "" }, { "docid": "0e6c1706b9f3c312fe43cfa103eb3cd1", "score": "0.54336643", "text": "func IsBrokeTestsEnabled() bool {\n\t_, ok := os.LookupEnv(\"BROKEN_TESTS_ENABLED\")\n\treturn ok\n}", "title": "" }, { "docid": "542022c3d9a405d60f16b829a2d5d21c", "score": "0.5416656", "text": "func TestSupportedEnv(t *testing.T) {\n\tReset()\n\n\t// Mock command line arguments\n\tos.Args = append(os.Args, defaultDuskConfig)\n\n\tos.Setenv(\"DUSK_GENERAL_NETWORK\", \"GLOBAL_VAR\")\n\tos.Setenv(\"DUSK_LOGGER_LEVEL\", \"NEW_LEVEL\")\n\tviper.AutomaticEnv()\n\n\t// This relies on default.dusk.toml\n\tif err := Load(\"default.dusk\", nil, nil); err != nil {\n\t\tt.Errorf(\"Failed parse: %v\", err)\n\t}\n\n\tif Get().General.Network != \"GLOBAL_VAR\" {\n\t\tt.Errorf(\"Invalid ENV value: %s\", Get().General.Network)\n\t}\n\n\tif Get().Logger.Level != \"NEW_LEVEL\" {\n\t\tt.Errorf(\"Invalid Logger ENV value %s\", Get().Logger.Level)\n\t}\n}", "title": "" }, { "docid": "9075c4d04008a78d1de6de6396ec7965", "score": "0.54151535", "text": "func isTestFile(file string) bool {\n\t// We don't cover tests, only the code they test.\n\treturn strings.HasSuffix(file, \"_test.go\")\n}", "title": "" }, { "docid": "a0206dd5e5a304e494afba6be7a58612", "score": "0.53817767", "text": "func GoUnitTest(ctx context.Context) error {\n\treturn mage.GoTest(ctx, mage.DefaultGoTestUnitArgs())\n}", "title": "" }, { "docid": "e46d66c1402ec3f7dbc53272c6ba7536", "score": "0.53784883", "text": "func (env AppEnvironment) IsDev() bool {\n\treturn env == DEV\n}", "title": "" }, { "docid": "0abd18f28260f26ff7ab636e747345bf", "score": "0.5363337", "text": "func SetTestMode() {\n\ttestMode = true\n\ttestPrograms = make(map[string]string)\n}", "title": "" }, { "docid": "db5777032184eba6506ec6ea0bec41ee", "score": "0.53494817", "text": "func Test(t *testing.T) { chk.TestingT(t) }", "title": "" }, { "docid": "db5777032184eba6506ec6ea0bec41ee", "score": "0.53494817", "text": "func Test(t *testing.T) { chk.TestingT(t) }", "title": "" }, { "docid": "db5777032184eba6506ec6ea0bec41ee", "score": "0.53494817", "text": "func Test(t *testing.T) { chk.TestingT(t) }", "title": "" }, { "docid": "64088615d28cc0cca93c7cbaea4fc65c", "score": "0.5347544", "text": "func IsProd() bool {\n\tcurrMode := os.Getenv(EnvVarMode)\n\treturn strings.ToLower(currMode) == strings.ToLower(AlunModeProd)\n}", "title": "" }, { "docid": "ce220296e8343dd9d9eef7d2af63dac0", "score": "0.5347033", "text": "func IsProduction() bool {\n\treturn Env == \"production\"\n}", "title": "" }, { "docid": "ce220296e8343dd9d9eef7d2af63dac0", "score": "0.5347033", "text": "func IsProduction() bool {\n\treturn Env == \"production\"\n}", "title": "" }, { "docid": "ee5c9d00ae30713c7a2970d6bf16a461", "score": "0.5324879", "text": "func UnitTest() error {\n\tverboseFlag := \"\"\n\tif mg.Verbose() {\n\t\tverboseFlag = \"-v\"\n\t}\n\ttestCommand := [][]string{\n\t\t{\"go\", \"test\", verboseFlag, \"-cover\", \"-race\", \"./...\"},\n\t}\n\treturn spartamage.Script(testCommand)\n}", "title": "" }, { "docid": "518a896c0a7e83e99bae196d3563431e", "score": "0.53189826", "text": "func IsE2ETestsEnabled() bool {\n\treturn IsTrue(envEnableE2ETests)\n}", "title": "" }, { "docid": "1ba84041d1fbc0a13658a78734a15a3c", "score": "0.53146386", "text": "func Development() bool {\n\treturn Configuration.DeploymentMode == DeploymentDevelopment\n}", "title": "" }, { "docid": "c3def06ddf1fdc3e61426dfe17557749", "score": "0.53104657", "text": "func (e Env) IsDevelop() bool {\n\treturn e == \"develop\"\n}", "title": "" }, { "docid": "2e8074b4b10eb9d6718e57209808f475", "score": "0.53067577", "text": "func (e Env) IsProduction() bool {\n\treturn e == \"production\"\n}", "title": "" }, { "docid": "43ae500348646648ec2a8512dfa29380", "score": "0.53043205", "text": "func IsKeepingTestingCluster() bool {\n\treturn IsTrue(envKeepTestingCluster)\n}", "title": "" }, { "docid": "6a023d01041146bdec3aa42915755f27", "score": "0.5278643", "text": "func (obj *application) HasTests() bool {\n\treturn obj.tests != nil\n}", "title": "" }, { "docid": "d3e358a2075f1a6aa5a505f4e1c93d1a", "score": "0.5271681", "text": "func IsDevEnv() bool {\n\tval, isSet := os.LookupEnv(constants.Env)\n\tif !isSet {\n\t\treturn false\n\t}\n\treturn val == \"DEV\"\n}", "title": "" }, { "docid": "1ae64c366bd8446e2ca839320e57211a", "score": "0.5271025", "text": "func skipIntegTest() (reason string, skip bool) {\n\tif IsInIntegTestEnv() {\n\t\treturn \"\", false\n\t}\n\n\t// Honor the TEST_ENVIRONMENT value if set.\n\tif testEnvVar, isSet := os.LookupEnv(\"TEST_ENVIRONMENT\"); isSet {\n\t\tenabled, err := strconv.ParseBool(testEnvVar)\n\t\tif err != nil {\n\t\t\tpanic(errors.Wrap(err, \"failed to parse TEST_ENVIRONMENT value\"))\n\t\t}\n\t\treturn \"TEST_ENVIRONMENT=\" + testEnvVar, !enabled\n\t}\n\n\t// Otherwise skip if we don't have all the right dependencies.\n\tif err := haveIntegTestEnvRequirements(); err != nil {\n\t\t// Skip if we don't meet the requirements.\n\t\tlog.Println(\"Skipping integ test because:\", err)\n\t\treturn \"docker is not available\", true\n\t}\n\n\treturn \"\", false\n}", "title": "" }, { "docid": "dda006348a995cc959fcd651d8ff4a5f", "score": "0.5269389", "text": "func isTest(s string) bool {\n\tl := strings.ToLower(s)\n\n\t// Add more patterns here!\n\tfor _, pattern := range []string{\n\t\t\"appveyor\", \"buildkite\", \"circleci\", \"e2e\", \"github-actions\", \"jenkins\",\n\t\t\"mergeable\", \"packit-as-a-service\", \"semaphoreci\", \"test\", \"travis-ci\",\n\t\t\"flutter-dashboard\", \"Cirrus CI\", \"azure-pipelines\",\n\t} {\n\t\tif strings.Contains(l, pattern) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "95557cb692030c031f50a2180d37e9ba", "score": "0.5266871", "text": "func TestNotExposedIfNotInDevelopment(t *testing.T) {\n\tres := setup()\n\n\t// Check that we are not in development.\n\tif martini.Env != martini.Dev {\n\t\tif res.Code != http.StatusNotFound {\n\t\t\tt.Error(\"/martini/routes endpoint should not be exposed when environment is not development.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b08ddfedd7af78bfa874d8a18d80617", "score": "0.52603275", "text": "func IsProduction() bool {\n\treturn Config.Env == \"production\"\n}", "title": "" }, { "docid": "88d57e10aa36620cac5dd7ad7ef7eb08", "score": "0.5255931", "text": "func getTestType() testType {\n\tcontext := os.Getenv(testTypeEnv)\n\tif context != \"\" {\n\t\treturn testType(context)\n\t}\n\treturn testTypeCoordinator\n}", "title": "" }, { "docid": "682b25bc630277a001a55da1e4530638", "score": "0.5238472", "text": "func IsKeepingTestingResource() bool {\n\treturn IsTrue(envKeepTestingResource)\n}", "title": "" }, { "docid": "999826f2629b09e7d7e1be3f36658c11", "score": "0.5233474", "text": "func IsUsingEmulation() bool {\n\treturn !IsTrue(envDontUseEmulation)\n}", "title": "" }, { "docid": "d2eb5c7efcd1e4aeea2e3880cdd99bfe", "score": "0.5220894", "text": "func IsTestFile(file string) bool {\n\t// We don't cover tests, only the code they test.\n\treturn strings.HasSuffix(file, \"_test.go\")\n}", "title": "" }, { "docid": "61e4bc71739e6ac8a668707313c4d88b", "score": "0.5215147", "text": "func isTestCached(t *testing.T, pc uintptr) bool {\n\tpkgName, testName := instrumentation.GetPackageAndName(pc)\n\tfqn := fmt.Sprintf(\"%s.%s\", pkgName, testName)\n\tcachedMap := config.GetCachedTestsMap()\n\tif _, ok := cachedMap[fqn]; ok {\n\t\tinstrumentation.Logger().Printf(\"Test '%v' is cached.\", fqn)\n\t\tfmt.Print(\"[SCOPE CACHED] \")\n\t\treflection.SkipAndFinishTest(t)\n\t\treturn true\n\t}\n\tinstrumentation.Logger().Printf(\"Test '%v' is not cached.\", fqn)\n\treturn false\n}", "title": "" }, { "docid": "0d038468c4852fdc69c41c503892f6dd", "score": "0.52012336", "text": "func GoTestUnit(ctx context.Context) error {\n\treturn mage.GoTest(ctx, mage.DefaultGoTestUnitArgs())\n}", "title": "" }, { "docid": "0d038468c4852fdc69c41c503892f6dd", "score": "0.52012336", "text": "func GoTestUnit(ctx context.Context) error {\n\treturn mage.GoTest(ctx, mage.DefaultGoTestUnitArgs())\n}", "title": "" }, { "docid": "0874914ac254eb8796c1f01599e56a03", "score": "0.51909465", "text": "func isTestnet(params *bitcoinNetParams) bool {\n\tswitch params.Params.Net {\n\tcase bitcoinWire.TestNet3, bitcoinWire.BitcoinNet(litecoinfinanceWire.TestNet4):\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "befafa38a36a89207bdc6ffd89c8d6d8", "score": "0.5169885", "text": "func IsRunningOnTravis() bool {\n\t_, isSet := os.LookupEnv(constants.TravisEnvVar)\n\treturn isSet\n}", "title": "" }, { "docid": "8c096e6f3d5f8c9fcebc0c20825b84e5", "score": "0.51678175", "text": "func Run() bool {\n\tswitch tm := os.Getenv(\"TEST_TASK\"); tm {\n\tcase \"\":\n\t\treturn false\n\tcase \"execute\":\n\t\texecute()\n\t\treturn true\n\tdefault:\n\t\tfmt.Fprintf(os.Stderr, \"unexpected value for TEST_TASK, \\\"%s\\\"\\n\", tm)\n\t\tos.Exit(1)\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "bcef97f1bcd8d3487e58e5615963f894", "score": "0.5166544", "text": "func GetTest(t *testing.T, name string) (value string) {\n\tvalue = os.Getenv(name)\n\tif value == \"\" {\n\t\tt.Skipf(\"%v not set\", name)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "4747dbf12b7ebd6e33461cd4159ca4a2", "score": "0.5149939", "text": "func (_m *MockmdServerLocal) isShutdown() bool {\n\tret := _m.ctrl.Call(_m, \"isShutdown\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "fd269aad632d773622bda7f915d3caf5", "score": "0.513224", "text": "func PythonUnitTest() error {\n\tmg.Deps(mage.BuildSystemTestBinary)\n\treturn mage.PythonNoseTest(mage.DefaultPythonTestUnitArgs())\n}", "title": "" }, { "docid": "84c72c50b3d124d7be702b139532c6e3", "score": "0.5075532", "text": "func IsProdEnv() bool {\n\treturn Get(\"env\") == \"prod\"\n}", "title": "" }, { "docid": "3977099c0a8b19425352f576a868319c", "score": "0.50688034", "text": "func isTestingImage(image build.Image, pave bool) bool {\n\tswitch {\n\tcase len(image.PaveZedbootArgs) != 0: // Used by catalyst.\n\t\treturn true\n\tcase pave && len(image.PaveArgs) != 0: // Used for paving.\n\t\treturn true\n\tcase !pave && len(image.NetbootArgs) != 0: // Used for netboot.\n\t\treturn true\n\tcase contains(qemuImageNames, image.Name): // Used for QEMU.\n\t\treturn true\n\tcase image.Name == \"uefi-disk\": // Used for GCE.\n\t\treturn true\n\tcase image.Type == \"script\":\n\t\t// In order for a user to provision without Zedboot the scripts are\n\t\t// needed too, so we want to include them such that artifactory can\n\t\t// upload them. This covers scripts like \"pave.sh\", \"flash.sh\", etc.\n\t\tif pave && strings.Contains(image.Name, \"netboot\") {\n\t\t\t// If we're paving then we shouldn't build any netboot scripts,\n\t\t\t// because they would pull netboot images into the build graph that\n\t\t\t// take a while to build and that we don't actually need.\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t// Allow-list a specific set of zbi images that are used for testing.\n\tcase image.Type == \"zbi\" && image.Name == \"overnet\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "8bc9bf0299f4e98b0b823b9aadc326e7", "score": "0.5033895", "text": "func isTestSignature(sign *types.Signature) bool {\n\tif sign.Recv() != nil {\n\t\treturn false\n\t}\n\tparams := sign.Params()\n\tif params.Len() != 1 {\n\t\treturn false\n\t}\n\tobj := objOf(params.At(0).Type())\n\treturn obj != nil && obj.Pkg().Path() == \"testing\" && obj.Name() == \"T\"\n}", "title": "" }, { "docid": "2996fc3ec813c276c4781933513de44e", "score": "0.5027137", "text": "func isTestCached(c *chk.C) bool {\n\tfqn := c.TestName()\n\tcachedMap := config.GetCachedTestsMap()\n\tif _, ok := cachedMap[fqn]; ok {\n\t\tinstrumentation.Logger().Printf(\"Test '%v' is cached.\", fqn)\n\t\tfmt.Print(\"[SCOPE CACHED] \")\n\t\treturn true\n\t}\n\tinstrumentation.Logger().Printf(\"Test '%v' is not cached.\", fqn)\n\treturn false\n}", "title": "" }, { "docid": "5d4a2b5edc9f39fe9cba421576d43238", "score": "0.5018188", "text": "func isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\treturn ast.IsExported(name[len(prefix):])\n}", "title": "" }, { "docid": "9b423b9ab0ad169e25971b9fa4a56ccb", "score": "0.50174785", "text": "func TestTesting(t *testing.T) {\n\tt.Skip()\n}", "title": "" }, { "docid": "b26d33e61d4bcd7479272a929e91623c", "score": "0.49975047", "text": "func (Adapter *Adapter) IsProductionMode() bool {\n\treturn Adapter.GetApplicationMode() == \"pro\"\n}", "title": "" }, { "docid": "535d6e6495cef22408026fc31a42cc3c", "score": "0.4990325", "text": "func Test(t *testing.T) {\n\tt.Run(\"Common\", testCommon)\n\tif runClusterTests {\n\t\tt.Run(\"Cluster\", testCluster)\n\t}\n\tif runQATests {\n\t\tt.Run(\"QA\", testQA)\n\t}\n}", "title": "" }, { "docid": "ce5bd0fae6c9c9abac86d77934ef6c65", "score": "0.49878737", "text": "func testConfig(config *core.Config) bool {\n\tcoordinator := NewCoordinator()\n\tdefer coordinator.Shutdown()\n\n\tif err := coordinator.Configure(config); err != nil {\n\t\tlogrus.WithError(err).Error(\"Configure pass failed.\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "4b0103272bdecf628bdf825f47e854a8", "score": "0.49871638", "text": "func isAzureDevMode(user string) bool {\n\treturn user == azureDevAccName\n}", "title": "" }, { "docid": "3d1bf6b9db6a2fe16471070072381e71", "score": "0.49865976", "text": "func runLifecycleTests() bool {\n\treturn ginkgo.Describe(\"\", func() {\n\t\t_ = lifecycle.RunLifecycleTest()\n\t})\n}", "title": "" }, { "docid": "233335ffbb2c1d5e030563189e9f5527", "score": "0.49851426", "text": "func init() {\n\tisTestNet = strings.EqualFold(os.Getenv(\"IOTEX_NETWORK_TYPE\"), \"testnet\")\n}", "title": "" }, { "docid": "26cf5613016d3cd9c74468b2226ed68d", "score": "0.49838218", "text": "func TestEnvironment(t *testing.T) {\n\tassert := asserts.NewTestingAsserts(t, true)\n\tenv := NewEnvironment(\"environment\")\n\n\tassert.NotNil(env, \"Environment is created.\")\n\tassert.Equal(env.id, Id(\"environment\"), \"Environment id is 'environment'.\")\n\n\terr := env.Shutdown()\n\tassert.Nil(err, \"No error during shutdown.\")\n}", "title": "" }, { "docid": "9395a986e47f7f54c61362adf6814556", "score": "0.49796036", "text": "func TestUnit() {\n\tmg.Deps(copySchema)\n\n\t// Only do verbose output of tests when called with `mage -v TestSmoke`\n\tv := \"\"\n\tif mg.Verbose() {\n\t\tv = \"-v\"\n\t}\n\n\tmust.Command(\"go\", \"test\", v, \"./...\").CollapseArgs().RunV()\n\n\t// Verify integration tests compile since we don't run them automatically on pull requests\n\tmust.Run(\"go\", \"test\", \"-run=non\", \"-tags=integration\", \"./...\")\n\n\tTestInitWarnings()\n}", "title": "" }, { "docid": "761b01ede07c5a0d1e5427356a625b88", "score": "0.4979002", "text": "func (m *MockClient) DevMode() bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DevMode\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "title": "" }, { "docid": "9ea72a65905d0a51383672497bba200c", "score": "0.49768674", "text": "func TestMain(m *testing.M) {\n\tswitch os.Getenv(\"GO_TEST_MODE\") {\n\tcase \"\":\n\t\t// Normal test mode\n\t\tos.Exit(m.Run())\n\n\tcase \"error\":\n\t\t// Makes cmd.Run() return an error.\n\t\tos.Exit(2)\n\n\tcase \"badoutput\":\n\t\t// Makes the gcloudOutput Unmarshaler fail.\n\t\tfmt.Println(badoutput)\n\n\tcase \"badexpiry\":\n\t\t// Makes the token_expiry time parser fail.\n\t\tfmt.Println(badexpiry)\n\n\tcase \"success\":\n\t\t// Returns a seemingly valid token.\n\t\tfmt.Println(success)\n\t}\n}", "title": "" }, { "docid": "ad238456690cf973608283c1f462a633", "score": "0.4966349", "text": "func (m *PrebuiltTestcase) InstallInTestcases() bool {\n\treturn true\n}", "title": "" }, { "docid": "02805c39700227658da96260ae5ace2b", "score": "0.49506792", "text": "func SkipPluginTests() bool {\n\treturn os.Getenv(\"SKIP_PLUGIN_TESTS\") != \"\"\n}", "title": "" }, { "docid": "c7d10e756e6cc1d15380f3422d72ad43", "score": "0.49445763", "text": "func IsDevModeOn(d *appsv1.Deployment) bool {\n\treturn labels.Get(d.GetObjectMeta(), constants.DevLabel) != \"\"\n}", "title": "" }, { "docid": "c63d8089a723808197da25306252dd27", "score": "0.49407208", "text": "func TestMain(m *testing.M) {\n\t//before\n\tfmt.Println(\"BEFORE UNIT TEST\")\n\n\tm.Run()\n\n\t//after\n\tfmt.Println(\"AFTER UNIT TEST\")\n}", "title": "" }, { "docid": "f8e45323699119f1e9cbe3f7b72512c2", "score": "0.49313554", "text": "func Test(t *testing.T) { check.TestingT(t) }", "title": "" }, { "docid": "f8e45323699119f1e9cbe3f7b72512c2", "score": "0.49313554", "text": "func Test(t *testing.T) { check.TestingT(t) }", "title": "" }, { "docid": "f8e45323699119f1e9cbe3f7b72512c2", "score": "0.49313554", "text": "func Test(t *testing.T) { check.TestingT(t) }", "title": "" }, { "docid": "f8e45323699119f1e9cbe3f7b72512c2", "score": "0.49313554", "text": "func Test(t *testing.T) { check.TestingT(t) }", "title": "" }, { "docid": "5229f77a627d448bcb6c58d0d9337147", "score": "0.49289343", "text": "func canTestFoo() bool { return true; }", "title": "" }, { "docid": "e72793e43533393cb0681d64e2c2b3f9", "score": "0.49284577", "text": "func IsDebug() bool {\n\tdebug := os.Getenv(\"SCHEMA_DEBUG\")\n\tif debug != \"\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "df28d55f096899f61825ebcec0959731", "score": "0.48977667", "text": "func TestApiImpl_something(t *testing.T) {\n\tassert.True(t, true)\n}", "title": "" }, { "docid": "a07ee8ad894ff33ec7f4928ee090cb1d", "score": "0.48905176", "text": "func TestShutdown(t *testing.T) {\n\tif os.Getenv(shutdownEnv) == \"true\" {\n\t\ttestShutdownChildProcess()\n\t\treturn\n\t}\n\n\tt.Run(\"clean\", func(t *testing.T) { testShutdown(t, true) })\n\tt.Run(\"messy\", func(t *testing.T) { testShutdown(t, false) })\n}", "title": "" } ]
39fa3b67770ed5f00e3e2f4061146d6e
MarshalFields encodes the AWS API shape using the passed in protocol encoder.
[ { "docid": "ebb81d1de5dea02b97ea44bd7c009216", "score": "0.0", "text": "func (s GetDomainAssociationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AppId != nil {\n\t\tv := *s.AppId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"appId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainName != nil {\n\t\tv := *s.DomainName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"domainName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "57f9925380644be1fff7920d489a0852", "score": "0.63469416", "text": "func (s CreateApiOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiEndpoint != nil {\n\t\tv := *s.ApiEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Warnings) > 0 {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd82520ebfa633cfc9ec76b8a5948aa7", "score": "0.62473285", "text": "func (s OutputService9TestShapeSingleStructure) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ddd15110e4141bcb782bed798fa9d29", "score": "0.619402", "text": "func (s OutputService6TestShapeSingleStructure) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f5f7e0696e49941923140f60240862c8", "score": "0.6178596", "text": "func (s CreateApiInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd9b0bb7001d53c0f5aad9e287e661e3", "score": "0.61666745", "text": "func (s Api) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiEndpoint != nil {\n\t\tv := *s.ApiEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Warnings) > 0 {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe2f60d81d4e6648ae8349304396451a", "score": "0.6118883", "text": "func (s GetApiOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiEndpoint != nil {\n\t\tv := *s.ApiEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Warnings) > 0 {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55cfd61270b4c574d387738a8d4a3f09", "score": "0.60989183", "text": "func (s UpdateApiOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiEndpoint != nil {\n\t\tv := *s.ApiEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Warnings) > 0 {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd02faa3a39593d7dcdc1766357a7b5e", "score": "0.6068759", "text": "func (s UpdateRestApiOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.ApiKeySource) > 0 {\n\t\tv := s.ApiKeySource\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySource\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.BinaryMediaTypes != nil {\n\t\tv := s.BinaryMediaTypes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"binaryMediaTypes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EndpointConfiguration != nil {\n\t\tv := s.EndpointConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"endpointConfiguration\", v, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MinimumCompressionSize != nil {\n\t\tv := *s.MinimumCompressionSize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"minimumCompressionSize\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Policy != nil {\n\t\tv := *s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"policy\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Warnings != nil {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9747bef3bd2b287f9411e6d6e3d822e1", "score": "0.60628486", "text": "func (s CreateCanaryInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ArtifactS3Location != nil {\n\t\tv := *s.ArtifactS3Location\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ArtifactS3Location\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Code != nil {\n\t\tv := s.Code\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Code\", v, metadata)\n\t}\n\tif s.ExecutionRoleArn != nil {\n\t\tv := *s.ExecutionRoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ExecutionRoleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FailureRetentionPeriodInDays != nil {\n\t\tv := *s.FailureRetentionPeriodInDays\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FailureRetentionPeriodInDays\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RunConfig != nil {\n\t\tv := s.RunConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"RunConfig\", v, metadata)\n\t}\n\tif s.RuntimeVersion != nil {\n\t\tv := *s.RuntimeVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RuntimeVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schedule != nil {\n\t\tv := s.Schedule\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Schedule\", v, metadata)\n\t}\n\tif s.SuccessRetentionPeriodInDays != nil {\n\t\tv := *s.SuccessRetentionPeriodInDays\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SuccessRetentionPeriodInDays\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"Tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.VpcConfig != nil {\n\t\tv := s.VpcConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"VpcConfig\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f70b5beff5c940ad28f2f7ef051bba88", "score": "0.60115397", "text": "func (s VirtualGatewayRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VirtualGatewayName != nil {\n\t\tv := *s.VirtualGatewayName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualGatewayName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3db30c6b6a4cb6882ccc5c5e25d38286", "score": "0.60080683", "text": "func (s CreateAccessPointInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ClientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FileSystemId != nil {\n\t\tv := *s.FileSystemId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FileSystemId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PosixUser != nil {\n\t\tv := s.PosixUser\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"PosixUser\", v, metadata)\n\t}\n\tif s.RootDirectory != nil {\n\t\tv := s.RootDirectory\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"RootDirectory\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c298633452858041b3d33db2582dc5c", "score": "0.5959189", "text": "func (s UpdateRouteInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b07cbe7b502d1794b455b6a1963f77f5", "score": "0.5951602", "text": "func (s CreateRouteOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90c5d574d4c1b5af34e86c7a7ef8ea7e", "score": "0.5932471", "text": "func (s CreateModelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schema != nil {\n\t\tv := *s.Schema\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"schema\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aede1c1c19126b1c1b0ba4d6fe6a71b9", "score": "0.5927213", "text": "func (s CreateRouteInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3d362d412fc8c24f8d1af7f25e2337c8", "score": "0.59209234", "text": "func (s Api) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiEndpoint != nil {\n\t\tv := *s.ApiEndpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiEndpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CorsConfiguration != nil {\n\t\tv := s.CorsConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"corsConfiguration\", v, metadata)\n\t}\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ImportInfo != nil {\n\t\tv := s.ImportInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"importInfo\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProtocolType) > 0 {\n\t\tv := s.ProtocolType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"protocolType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Warnings != nil {\n\t\tv := s.Warnings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"warnings\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed25d1ec0029ab61077904f31da4e4d4", "score": "0.59090286", "text": "func (s OutputService15TestShapeItemDetailShape) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ID != nil {\n\t\tv := *s.ID\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ID\", protocol.StringValue(v), metadata)\n\t}\n\t// Skipping Type XML Attribute.\n\treturn nil\n}", "title": "" }, { "docid": "e46340e9f82be9b816f17f6ba87f5d5b", "score": "0.5904053", "text": "func (s CreateProxySessionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Capabilities != nil {\n\t\tv := s.Capabilities\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Capabilities\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.ExpiryMinutes != nil {\n\t\tv := *s.ExpiryMinutes\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ExpiryMinutes\", protocol.Int64Value(v), metadata)\n\t}\n\tif len(s.GeoMatchLevel) > 0 {\n\t\tv := s.GeoMatchLevel\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"GeoMatchLevel\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.GeoMatchParams != nil {\n\t\tv := s.GeoMatchParams\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"GeoMatchParams\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.NumberSelectionBehavior) > 0 {\n\t\tv := s.NumberSelectionBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"NumberSelectionBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ParticipantPhoneNumbers != nil {\n\t\tv := s.ParticipantPhoneNumbers\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"ParticipantPhoneNumbers\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.VoiceConnectorId != nil {\n\t\tv := *s.VoiceConnectorId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"voiceConnectorId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8cd7d79de8c777335c2e85726015b0df", "score": "0.58980983", "text": "func (s UpdateRouteOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4c87921c95d3610c9b38a58ba07c03aa", "score": "0.5882819", "text": "func (s UpdateStageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AccessLogSettings != nil {\n\t\tv := s.AccessLogSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"accessLogSettings\", v, metadata)\n\t}\n\tif s.ClientCertificateId != nil {\n\t\tv := *s.ClientCertificateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientCertificateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DefaultRouteSettings != nil {\n\t\tv := s.DefaultRouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"defaultRouteSettings\", v, metadata)\n\t}\n\tif s.DeploymentId != nil {\n\t\tv := *s.DeploymentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deploymentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RouteSettings) > 0 {\n\t\tv := s.RouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"routeSettings\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.StageVariables) > 0 {\n\t\tv := s.StageVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"stageVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"stageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "832ce611f8b03a360e82e751fca7bbda", "score": "0.58770883", "text": "func (s VirtualGatewaySpec) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.BackendDefaults != nil {\n\t\tv := s.BackendDefaults\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"backendDefaults\", v, metadata)\n\t}\n\tif s.Listeners != nil {\n\t\tv := s.Listeners\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"listeners\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Logging != nil {\n\t\tv := s.Logging\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"logging\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "522012604bd1c631eaf5086f47073d73", "score": "0.58741236", "text": "func (s UpdateApiInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiKeySelectionExpression != nil {\n\t\tv := *s.ApiKeySelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeySelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisableSchemaValidation != nil {\n\t\tv := *s.DisableSchemaValidation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"disableSchemaValidation\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteSelectionExpression != nil {\n\t\tv := *s.RouteSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7d672c72f61ebc5d33ff25e83ac6032", "score": "0.5872173", "text": "func (s CreateIntegrationOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationResponseSelectionExpression != nil {\n\t\tv := *s.IntegrationResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e846ce831b719615269918729b566bd0", "score": "0.586946", "text": "func (s DescribeDetectorInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DetectorModelName != nil {\n\t\tv := *s.DetectorModelName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"detectorModelName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.KeyValue != nil {\n\t\tv := *s.KeyValue\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"keyValue\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7927b5d361299c2cea4990431e1d8b2", "score": "0.586933", "text": "func (s UpdateSignalingChannelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ChannelARN != nil {\n\t\tv := *s.ChannelARN\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ChannelARN\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CurrentVersion != nil {\n\t\tv := *s.CurrentVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CurrentVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SingleMasterConfiguration != nil {\n\t\tv := s.SingleMasterConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SingleMasterConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e2bf1e070b6b86a288cf46677431add", "score": "0.58562946", "text": "func (s CreateApiMappingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainName != nil {\n\t\tv := *s.DomainName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"domainName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "709a49652b24ef131b340b429fe5b898", "score": "0.5848596", "text": "func (s CreateThingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.AttributePayload != nil {\n\t\tv := s.AttributePayload\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"attributePayload\", v, metadata)\n\t}\n\tif s.BillingGroupName != nil {\n\t\tv := *s.BillingGroupName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"billingGroupName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThingTypeName != nil {\n\t\tv := *s.ThingTypeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"thingTypeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ThingName != nil {\n\t\tv := *s.ThingName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"thingName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "247794f0a36844ce7dbbb15521aaae8f", "score": "0.58484286", "text": "func encodeSchema(w io.Writer, s *schema.Schema) (err error) {\n\tif s == nil {\n\t\treturn\n\t}\n\n\tew := errWriter{w: w}\n\tif s.Description != \"\" {\n\t\tew.writeFormat(`\"description\": %q, `, s.Description)\n\t}\n\tew.writeString(`\"type\": \"object\", `)\n\tew.writeString(`\"additionalProperties\": false, `)\n\tew.writeString(`\"properties\": {`)\n\tvar required []string\n\tvar notFirst bool\n\tfor _, key := range sortedFieldNames(s.Fields) {\n\t\tfield := s.Fields[key]\n\t\tif notFirst {\n\t\t\tew.writeString(\", \")\n\t\t}\n\t\tnotFirst = true\n\t\tif field.Required {\n\t\t\trequired = append(required, fmt.Sprintf(\"%q\", key))\n\t\t}\n\t\tew.err = encodeField(ew, key, field)\n\t\tif ew.err != nil {\n\t\t\treturn ew.err\n\t\t}\n\t}\n\tew.writeString(\"}\")\n\tif s.MinLen > 0 {\n\t\tew.writeFormat(`, \"minProperties\": %s`, strconv.FormatInt(int64(s.MinLen), 10))\n\t}\n\tif s.MaxLen > 0 {\n\t\tew.writeFormat(`, \"maxProperties\": %s`, strconv.FormatInt(int64(s.MaxLen), 10))\n\t}\n\n\tif len(required) > 0 {\n\t\tew.writeFormat(`, \"required\": [%s]`, strings.Join(required, \", \"))\n\t}\n\treturn ew.err\n}", "title": "" }, { "docid": "a576cc47f2625b86ff6b161c4e8a90c6", "score": "0.58436584", "text": "func (s OutputService15TestShapeItemShape) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ItemDetail != nil {\n\t\tv := s.ItemDetail\n\t\tattrs := make([]protocol.Attribute, 0, 1)\n\n\t\tif len(s.ItemDetail.Type) > 0 {\n\n\t\t\tv := s.ItemDetail.Type\n\t\t\tattrs = append(attrs, protocol.Attribute{Name: \"xsi:type\", Value: v, Meta: protocol.Metadata{}})\n\t\t}\n\t\tmetadata := protocol.Metadata{Attributes: attrs, XMLNamespacePrefix: \"xsi\", XMLNamespaceURI: \"http://www.w3.org/2001/XMLSchema-instance\"}\n\t\te.SetFields(protocol.BodyTarget, \"ItemDetail\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3a34400a7c54c895e425b103bc6be909", "score": "0.58354187", "text": "func (s UpdateApiMappingInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingId != nil {\n\t\tv := *s.ApiMappingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiMappingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DomainName != nil {\n\t\tv := *s.DomainName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"domainName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e360077cc7527b2022ee1421b21e3420", "score": "0.58325946", "text": "func (s VirtualServiceRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VirtualServiceName != nil {\n\t\tv := *s.VirtualServiceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualServiceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "875a0d9a43cb80c8b92a6ee86fe63de3", "score": "0.5819112", "text": "func (s UpdateIntegrationOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationResponseSelectionExpression != nil {\n\t\tv := *s.IntegrationResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d81ecd337506303e7eee1f72554004a8", "score": "0.58175355", "text": "func (s UpdateIPSetInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Activate != nil {\n\t\tv := *s.Activate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"activate\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Location != nil {\n\t\tv := *s.Location\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"location\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DetectorId != nil {\n\t\tv := *s.DetectorId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"detectorId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IpSetId != nil {\n\t\tv := *s.IpSetId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ipSetId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3774edea4dd0077f630b2cf562a0300", "score": "0.58131146", "text": "func (s CreateStageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AccessLogSettings != nil {\n\t\tv := s.AccessLogSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"accessLogSettings\", v, metadata)\n\t}\n\tif s.ClientCertificateId != nil {\n\t\tv := *s.ClientCertificateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientCertificateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DefaultRouteSettings != nil {\n\t\tv := s.DefaultRouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"defaultRouteSettings\", v, metadata)\n\t}\n\tif s.DeploymentId != nil {\n\t\tv := *s.DeploymentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deploymentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RouteSettings) > 0 {\n\t\tv := s.RouteSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"routeSettings\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.StageVariables) > 0 {\n\t\tv := s.StageVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"stageVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff55d9fc16b836dd2ab35576f21172f1", "score": "0.5812274", "text": "func (s GetSigningPlatformInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PlatformId != nil {\n\t\tv := *s.PlatformId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"platformId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "401fb530a7dd0a65b03e48a7b630c5ca", "score": "0.58100855", "text": "func (s Robot) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Architecture) > 0 {\n\t\tv := s.Architecture\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"architecture\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.FleetArn != nil {\n\t\tv := *s.FleetArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"fleetArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.GreenGrassGroupId != nil {\n\t\tv := *s.GreenGrassGroupId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"greenGrassGroupId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastDeploymentJob != nil {\n\t\tv := *s.LastDeploymentJob\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastDeploymentJob\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastDeploymentTime != nil {\n\t\tv := *s.LastDeploymentTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastDeploymentTime\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Status) > 0 {\n\t\tv := s.Status\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"status\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f9d9daca1ae0d1836f7ec3335af8bf7", "score": "0.5802896", "text": "func (s UpdateIntegrationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cafe649a440e212d8b56e43261ca515", "score": "0.5801313", "text": "func (s DescribeInputDeviceOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionState) > 0 {\n\t\tv := s.ConnectionState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionState\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.DeviceSettingsSyncState) > 0 {\n\t\tv := s.DeviceSettingsSyncState\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"deviceSettingsSyncState\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.HdDeviceSettings != nil {\n\t\tv := s.HdDeviceSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"hdDeviceSettings\", v, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MacAddress != nil {\n\t\tv := *s.MacAddress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"macAddress\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.NetworkSettings != nil {\n\t\tv := s.NetworkSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"networkSettings\", v, metadata)\n\t}\n\tif s.SerialNumber != nil {\n\t\tv := *s.SerialNumber\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"serialNumber\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "111b430fdfb285e2d2ef0f5ed5ccc8ed", "score": "0.580113", "text": "func (s CreateAliasInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.FunctionVersion != nil {\n\t\tv := *s.FunctionVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FunctionVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoutingConfig != nil {\n\t\tv := s.RoutingConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"RoutingConfig\", v, metadata)\n\t}\n\tif s.FunctionName != nil {\n\t\tv := *s.FunctionName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"FunctionName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0f9e44025dec66226ae180a37bf3427", "score": "0.57850075", "text": "func (s CreateImageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DistributionConfigurationArn != nil {\n\t\tv := *s.DistributionConfigurationArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"distributionConfigurationArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnhancedImageMetadataEnabled != nil {\n\t\tv := *s.EnhancedImageMetadataEnabled\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enhancedImageMetadataEnabled\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ImageRecipeArn != nil {\n\t\tv := *s.ImageRecipeArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"imageRecipeArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ImageTestsConfiguration != nil {\n\t\tv := s.ImageTestsConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"imageTestsConfiguration\", v, metadata)\n\t}\n\tif s.InfrastructureConfigurationArn != nil {\n\t\tv := *s.InfrastructureConfigurationArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"infrastructureConfigurationArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e358c29bde54ac52247273412cead9e0", "score": "0.5779894", "text": "func (s VpcLink) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CreatedDate != nil {\n\t\tv := *s.CreatedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"iso8601\", QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SecurityGroupIds != nil {\n\t\tv := s.SecurityGroupIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"securityGroupIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.SubnetIds != nil {\n\t\tv := s.SubnetIds\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"subnetIds\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.VpcLinkId != nil {\n\t\tv := *s.VpcLinkId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"vpcLinkId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.VpcLinkStatus) > 0 {\n\t\tv := s.VpcLinkStatus\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"vpcLinkStatus\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.VpcLinkStatusMessage != nil {\n\t\tv := *s.VpcLinkStatusMessage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"vpcLinkStatusMessage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.VpcLinkVersion) > 0 {\n\t\tv := s.VpcLinkVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"vpcLinkVersion\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be9a01c98154fa64658b181866b5369b", "score": "0.5775581", "text": "func (s Route) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiGatewayManaged != nil {\n\t\tv := *s.ApiGatewayManaged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiGatewayManaged\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.AuthorizationScopes != nil {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestModels != nil {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RequestParameters != nil {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37eda34b3bdceb6cb1401ef150010eef", "score": "0.5772966", "text": "func (s Integration) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiGatewayManaged != nil {\n\t\tv := *s.ApiGatewayManaged\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiGatewayManaged\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationResponseSelectionExpression != nil {\n\t\tv := *s.IntegrationResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.PayloadFormatVersion != nil {\n\t\tv := *s.PayloadFormatVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"payloadFormatVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestParameters != nil {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RequestTemplates != nil {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.TlsConfig != nil {\n\t\tv := s.TlsConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"tlsConfig\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef50da37de44c678f121905c3e92b021", "score": "0.5771088", "text": "func (s UpdateModelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schema != nil {\n\t\tv := *s.Schema\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"schema\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelId != nil {\n\t\tv := *s.ModelId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"modelId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df968391df7d15ba5a93ff860628f4d0", "score": "0.57631975", "text": "func (s CreateOTAUpdateInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.AdditionalParameters != nil {\n\t\tv := s.AdditionalParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"additionalParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.AwsJobExecutionsRolloutConfig != nil {\n\t\tv := s.AwsJobExecutionsRolloutConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"awsJobExecutionsRolloutConfig\", v, metadata)\n\t}\n\tif s.AwsJobPresignedUrlConfig != nil {\n\t\tv := s.AwsJobPresignedUrlConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"awsJobPresignedUrlConfig\", v, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Files != nil {\n\t\tv := s.Files\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"files\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Protocols != nil {\n\t\tv := s.Protocols\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"protocols\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.TargetSelection) > 0 {\n\t\tv := s.TargetSelection\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"targetSelection\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Targets != nil {\n\t\tv := s.Targets\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"targets\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.OtaUpdateId != nil {\n\t\tv := *s.OtaUpdateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"otaUpdateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dbcf999e33b6ce02a0956150f5f64d24", "score": "0.57597417", "text": "func (s CreateIntegrationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1433b65ca3d72133a8d9e7f0260a37fc", "score": "0.5757646", "text": "func (s CreateApiKeyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Expires != nil {\n\t\tv := *s.Expires\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"expires\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "74e8dfadf300d22cb08c4255a3b9504a", "score": "0.575759", "text": "func (s CreateBranchInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.BackendEnvironmentArn != nil {\n\t\tv := *s.BackendEnvironmentArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"backendEnvironmentArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BasicAuthCredentials != nil {\n\t\tv := *s.BasicAuthCredentials\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"basicAuthCredentials\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BranchName != nil {\n\t\tv := *s.BranchName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"branchName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BuildSpec != nil {\n\t\tv := *s.BuildSpec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"buildSpec\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DisplayName != nil {\n\t\tv := *s.DisplayName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"displayName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnableAutoBuild != nil {\n\t\tv := *s.EnableAutoBuild\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableAutoBuild\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableBasicAuth != nil {\n\t\tv := *s.EnableBasicAuth\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBasicAuth\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableNotification != nil {\n\t\tv := *s.EnableNotification\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableNotification\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnablePullRequestPreview != nil {\n\t\tv := *s.EnablePullRequestPreview\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enablePullRequestPreview\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnvironmentVariables != nil {\n\t\tv := s.EnvironmentVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"environmentVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Framework != nil {\n\t\tv := *s.Framework\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"framework\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PullRequestEnvironmentName != nil {\n\t\tv := *s.PullRequestEnvironmentName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"pullRequestEnvironmentName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Stage) > 0 {\n\t\tv := s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Ttl != nil {\n\t\tv := *s.Ttl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ttl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AppId != nil {\n\t\tv := *s.AppId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"appId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "71ab6a41164b1ee4e4a600d7e77413a5", "score": "0.57502675", "text": "func (s UpdateRouteResponseInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ResponseModels) > 0 {\n\t\tv := s.ResponseModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.ResponseParameters) > 0 {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteResponseKey != nil {\n\t\tv := *s.RouteResponseKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseId != nil {\n\t\tv := *s.RouteResponseId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeResponseId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce503e98299a2d5d9fb37f24e9799ac5", "score": "0.5747419", "text": "func (s CreatePackageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PackageDescription != nil {\n\t\tv := *s.PackageDescription\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PackageDescription\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PackageName != nil {\n\t\tv := *s.PackageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PackageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PackageSource != nil {\n\t\tv := s.PackageSource\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"PackageSource\", v, metadata)\n\t}\n\tif len(s.PackageType) > 0 {\n\t\tv := s.PackageType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PackageType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84d818baec5be660b09d03980b783768", "score": "0.5746056", "text": "func (s UpdatePipelineOutput) MarshalFields(e protocol.FieldEncoder) error {\n\treturn nil\n}", "title": "" }, { "docid": "abc7b25006df816195c0bd7ba6a608b4", "score": "0.5745568", "text": "func (s OutputService11TestShapeOutputService11TestCaseOperation1Output) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Char != nil {\n\t\tv := *s.Char\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-char\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Double != nil {\n\t\tv := *s.Double\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-double\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.FalseBool != nil {\n\t\tv := *s.FalseBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-false-bool\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Float != nil {\n\t\tv := *s.Float\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-float\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.Integer != nil {\n\t\tv := *s.Integer\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-int\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Long != nil {\n\t\tv := *s.Long\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-long\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Str != nil {\n\t\tv := *s.Str\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-str\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Timestamp != nil {\n\t\tv := *s.Timestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-timestamp\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.RFC822TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.TrueBool != nil {\n\t\tv := *s.TrueBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-true-bool\", protocol.BoolValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aacfb9de7cb45bdebcf091fbdbe84149", "score": "0.57412916", "text": "func (s CreateRouteResponseInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ResponseModels) > 0 {\n\t\tv := s.ResponseModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.ResponseParameters) > 0 {\n\t\tv := s.ResponseParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"responseParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteResponseKey != nil {\n\t\tv := *s.RouteResponseKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b8557f983fdb2dd77a36ba9bc9cfbd66", "score": "0.57377005", "text": "func (s CreateAppInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.BasicAuthCredentials != nil {\n\t\tv := *s.BasicAuthCredentials\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"basicAuthCredentials\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BuildSpec != nil {\n\t\tv := *s.BuildSpec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"buildSpec\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.CustomRules) > 0 {\n\t\tv := s.CustomRules\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"customRules\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnableBasicAuth != nil {\n\t\tv := *s.EnableBasicAuth\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBasicAuth\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableBranchAutoBuild != nil {\n\t\tv := *s.EnableBranchAutoBuild\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBranchAutoBuild\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.EnvironmentVariables) > 0 {\n\t\tv := s.EnvironmentVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"environmentVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.IamServiceRoleArn != nil {\n\t\tv := *s.IamServiceRoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"iamServiceRoleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OauthToken != nil {\n\t\tv := *s.OauthToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"oauthToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Platform) > 0 {\n\t\tv := s.Platform\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"platform\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Repository != nil {\n\t\tv := *s.Repository\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"repository\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d50274d19d72f8183a63b5f103e9f3ad", "score": "0.57312983", "text": "func (s CreateBranchInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.BasicAuthCredentials != nil {\n\t\tv := *s.BasicAuthCredentials\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"basicAuthCredentials\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BranchName != nil {\n\t\tv := *s.BranchName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"branchName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BuildSpec != nil {\n\t\tv := *s.BuildSpec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"buildSpec\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnableAutoBuild != nil {\n\t\tv := *s.EnableAutoBuild\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableAutoBuild\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableBasicAuth != nil {\n\t\tv := *s.EnableBasicAuth\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBasicAuth\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableNotification != nil {\n\t\tv := *s.EnableNotification\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableNotification\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.EnvironmentVariables) > 0 {\n\t\tv := s.EnvironmentVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"environmentVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Framework != nil {\n\t\tv := *s.Framework\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"framework\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Stage) > 0 {\n\t\tv := s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.Tags) > 0 {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Ttl != nil {\n\t\tv := *s.Ttl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ttl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AppId != nil {\n\t\tv := *s.AppId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"appId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30d593656488375d9c95b05c295fba9b", "score": "0.5731216", "text": "func (s GetApiInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7b5b136aa2d78eebbf4fad88f244cec5", "score": "0.57271695", "text": "func (s CreateApiMappingOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingId != nil {\n\t\tv := *s.ApiMappingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f6b5dcc9782e7583eb35ff1ffcd2d9c", "score": "0.57197875", "text": "func (s VirtualNodeSpec) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.BackendDefaults != nil {\n\t\tv := s.BackendDefaults\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"backendDefaults\", v, metadata)\n\t}\n\tif s.Backends != nil {\n\t\tv := s.Backends\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"backends\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Listeners != nil {\n\t\tv := s.Listeners\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"listeners\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Logging != nil {\n\t\tv := s.Logging\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"logging\", v, metadata)\n\t}\n\tif s.ServiceDiscovery != nil {\n\t\tv := s.ServiceDiscovery\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"serviceDiscovery\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6bb18ecb0385efcb479bda99c2836e1e", "score": "0.5717948", "text": "func (s Integration) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationResponseSelectionExpression != nil {\n\t\tv := *s.IntegrationResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d4e801574b2964242608cc35e7e968c", "score": "0.5708417", "text": "func (s NetworkPathComponent) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ComponentId != nil {\n\t\tv := *s.ComponentId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ComponentId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ComponentType != nil {\n\t\tv := *s.ComponentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ComponentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Egress != nil {\n\t\tv := s.Egress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Egress\", v, metadata)\n\t}\n\tif s.Ingress != nil {\n\t\tv := s.Ingress\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Ingress\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9f2fa66091825136f384ad4f17a2bd5", "score": "0.5700894", "text": "func (s OutputService13TestShapeTimeContainer) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Bar != nil {\n\t\tv := *s.Bar\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"bar\",\n\t\t\tprotocol.TimeValue{V: v, Format: \"unixTimestamp\", QuotedFormatTime: false}, metadata)\n\t}\n\tif s.Foo != nil {\n\t\tv := *s.Foo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"foo\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fdb6261a3ad558d44ca575f1979440d4", "score": "0.57007056", "text": "func (s UpdateBranchInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.BasicAuthCredentials != nil {\n\t\tv := *s.BasicAuthCredentials\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"basicAuthCredentials\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BuildSpec != nil {\n\t\tv := *s.BuildSpec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"buildSpec\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnableAutoBuild != nil {\n\t\tv := *s.EnableAutoBuild\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableAutoBuild\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableBasicAuth != nil {\n\t\tv := *s.EnableBasicAuth\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBasicAuth\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableNotification != nil {\n\t\tv := *s.EnableNotification\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableNotification\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.EnvironmentVariables) > 0 {\n\t\tv := s.EnvironmentVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"environmentVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Framework != nil {\n\t\tv := *s.Framework\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"framework\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Stage) > 0 {\n\t\tv := s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Ttl != nil {\n\t\tv := *s.Ttl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ttl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AppId != nil {\n\t\tv := *s.AppId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"appId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BranchName != nil {\n\t\tv := *s.BranchName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"branchName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e5564c7a45d45dd0f028addfe2a47e8", "score": "0.56988305", "text": "func (s ImportComponentInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ChangeDescription != nil {\n\t\tv := *s.ChangeDescription\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"changeDescription\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tvar ClientToken string\n\tif s.ClientToken != nil {\n\t\tClientToken = *s.ClientToken\n\t} else {\n\t\tClientToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Data != nil {\n\t\tv := *s.Data\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"data\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Format) > 0 {\n\t\tv := s.Format\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"format\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.KmsKeyId != nil {\n\t\tv := *s.KmsKeyId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"kmsKeyId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Platform) > 0 {\n\t\tv := s.Platform\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"platform\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.SemanticVersion != nil {\n\t\tv := *s.SemanticVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"semanticVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Uri != nil {\n\t\tv := *s.Uri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"uri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "feba6b45ff172bb890d486b670e1fb40", "score": "0.56950074", "text": "func (s Route) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fe88b867cf5b2787c27e4665410edb61", "score": "0.5692928", "text": "func (s CodeReview) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CodeReviewArn != nil {\n\t\tv := *s.CodeReviewArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeReviewArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedTimeStamp != nil {\n\t\tv := *s.CreatedTimeStamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CreatedTimeStamp\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedTimeStamp != nil {\n\t\tv := *s.LastUpdatedTimeStamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"LastUpdatedTimeStamp\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Metrics != nil {\n\t\tv := s.Metrics\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"Metrics\", v, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Owner != nil {\n\t\tv := *s.Owner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Owner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ProviderType) > 0 {\n\t\tv := s.ProviderType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProviderType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.PullRequestId != nil {\n\t\tv := *s.PullRequestId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"PullRequestId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RepositoryName != nil {\n\t\tv := *s.RepositoryName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RepositoryName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SourceCodeType != nil {\n\t\tv := s.SourceCodeType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SourceCodeType\", v, metadata)\n\t}\n\tif len(s.State) > 0 {\n\t\tv := s.State\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"State\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.StateReason != nil {\n\t\tv := *s.StateReason\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StateReason\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Type) > 0 {\n\t\tv := s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a4d2b4a95f57ef42523ef3da4c3c867", "score": "0.5691443", "text": "func (s PutObjectOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ContentSHA256 != nil {\n\t\tv := *s.ContentSHA256\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ContentSHA256\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ETag != nil {\n\t\tv := *s.ETag\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ETag\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.StorageClass) > 0 {\n\t\tv := s.StorageClass\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"StorageClass\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c06f372236a5c8ebe407296d14f9fba", "score": "0.5684171", "text": "func (s GetRouteOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiKeyRequired != nil {\n\t\tv := *s.ApiKeyRequired\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiKeyRequired\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.AuthorizationScopes) > 0 {\n\t\tv := s.AuthorizationScopes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"authorizationScopes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.AuthorizationType) > 0 {\n\t\tv := s.AuthorizationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AuthorizerId != nil {\n\t\tv := *s.AuthorizerId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"authorizerId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelSelectionExpression != nil {\n\t\tv := *s.ModelSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OperationName != nil {\n\t\tv := *s.OperationName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"operationName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.RequestModels) > 0 {\n\t\tv := s.RequestModels\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestModels\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetFields(k1, v1)\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.RouteId != nil {\n\t\tv := *s.RouteId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteKey != nil {\n\t\tv := *s.RouteKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteResponseSelectionExpression != nil {\n\t\tv := *s.RouteResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dba3c62a9ef97f36cc0f0ab981a52513", "score": "0.56820863", "text": "func (s OutputService1TestShapeOutputService1TestCaseOperation1Output) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Char != nil {\n\t\tv := *s.Char\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Char\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Double != nil {\n\t\tv := *s.Double\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Double\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.FalseBool != nil {\n\t\tv := *s.FalseBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FalseBool\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Float != nil {\n\t\tv := *s.Float\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Float\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.Float64s != nil {\n\t\tv := s.Float64s\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Float64s\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.Float64Value(v1))\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Long != nil {\n\t\tv := *s.Long\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Long\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Num != nil {\n\t\tv := *s.Num\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FooNum\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Str != nil {\n\t\tv := *s.Str\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Str\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Timestamp != nil {\n\t\tv := *s.Timestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Timestamp\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.TrueBool != nil {\n\t\tv := *s.TrueBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"TrueBool\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ImaHeader != nil {\n\t\tv := *s.ImaHeader\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"ImaHeader\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ImaHeaderLocation != nil {\n\t\tv := *s.ImaHeaderLocation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"X-Foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9929a8f47b7e20bf8922b797d78344de", "score": "0.5676197", "text": "func (s GetStageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.StageName != nil {\n\t\tv := *s.StageName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"stageName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b27ac75171d89d5633e5e1a549c4e5bd", "score": "0.56744903", "text": "func (s OutputService1TestShapeOutputService1TestCaseOperation2Output) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Char != nil {\n\t\tv := *s.Char\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Char\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Double != nil {\n\t\tv := *s.Double\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Double\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.FalseBool != nil {\n\t\tv := *s.FalseBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FalseBool\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Float != nil {\n\t\tv := *s.Float\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Float\", protocol.Float64Value(v), metadata)\n\t}\n\tif s.Float64s != nil {\n\t\tv := s.Float64s\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Float64s\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.Float64Value(v1))\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Long != nil {\n\t\tv := *s.Long\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Long\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Num != nil {\n\t\tv := *s.Num\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"FooNum\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Str != nil {\n\t\tv := *s.Str\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Str\", protocol.StringValue(v), metadata)\n\t}\n\tif s.Timestamp != nil {\n\t\tv := *s.Timestamp\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Timestamp\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormatName, QuotedFormatTime: false}, metadata)\n\t}\n\tif s.TrueBool != nil {\n\t\tv := *s.TrueBool\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"TrueBool\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.ImaHeader != nil {\n\t\tv := *s.ImaHeader\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"ImaHeader\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ImaHeaderLocation != nil {\n\t\tv := *s.ImaHeaderLocation\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"X-Foo\", protocol.StringValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff7eb29537f110e0d2f044cf42780f2f", "score": "0.5674415", "text": "func (s UpdateAppInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.BasicAuthCredentials != nil {\n\t\tv := *s.BasicAuthCredentials\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"basicAuthCredentials\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.BuildSpec != nil {\n\t\tv := *s.BuildSpec\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"buildSpec\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.CustomRules) > 0 {\n\t\tv := s.CustomRules\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"customRules\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.EnableBasicAuth != nil {\n\t\tv := *s.EnableBasicAuth\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBasicAuth\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.EnableBranchAutoBuild != nil {\n\t\tv := *s.EnableBranchAutoBuild\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"enableBranchAutoBuild\", protocol.BoolValue(v), metadata)\n\t}\n\tif len(s.EnvironmentVariables) > 0 {\n\t\tv := s.EnvironmentVariables\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"environmentVariables\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.IamServiceRoleArn != nil {\n\t\tv := *s.IamServiceRoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"iamServiceRoleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Platform) > 0 {\n\t\tv := s.Platform\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"platform\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.AppId != nil {\n\t\tv := *s.AppId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"appId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bed2287cd0629708904449113dc6cca", "score": "0.5662944", "text": "func (s GetIntegrationOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ConnectionId != nil {\n\t\tv := *s.ConnectionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ConnectionType) > 0 {\n\t\tv := s.ConnectionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"connectionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.ContentHandlingStrategy) > 0 {\n\t\tv := s.ContentHandlingStrategy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentHandlingStrategy\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.CredentialsArn != nil {\n\t\tv := *s.CredentialsArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"credentialsArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationId != nil {\n\t\tv := *s.IntegrationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationMethod != nil {\n\t\tv := *s.IntegrationMethod\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationMethod\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationResponseSelectionExpression != nil {\n\t\tv := *s.IntegrationResponseSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationResponseSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.IntegrationType) > 0 {\n\t\tv := s.IntegrationType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IntegrationUri != nil {\n\t\tv := *s.IntegrationUri\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"integrationUri\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PassthroughBehavior) > 0 {\n\t\tv := s.PassthroughBehavior\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"passthroughBehavior\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.RequestParameters) > 0 {\n\t\tv := s.RequestParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif len(s.RequestTemplates) > 0 {\n\t\tv := s.RequestTemplates\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"requestTemplates\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.TemplateSelectionExpression != nil {\n\t\tv := *s.TemplateSelectionExpression\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"templateSelectionExpression\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TimeoutInMillis != nil {\n\t\tv := *s.TimeoutInMillis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"timeoutInMillis\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8e4aa9448074616f6d3b29c06e9b4d1", "score": "0.5659592", "text": "func (s VirtualServiceBackend) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ClientPolicy != nil {\n\t\tv := s.ClientPolicy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"clientPolicy\", v, metadata)\n\t}\n\tif s.VirtualServiceName != nil {\n\t\tv := *s.VirtualServiceName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualServiceName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1b9882383427a8c296aad761ae0c80fb", "score": "0.5659191", "text": "func (s CreatePolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PolicyDocument != nil {\n\t\tv := *s.PolicyDocument\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"policyDocument\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PolicyName != nil {\n\t\tv := *s.PolicyName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"policyName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "150c9cefff52014392911bdaebb9bf0b", "score": "0.56584865", "text": "func (s CreateBucketInput) MarshalFields(e protocol.FieldEncoder) error {\n\n\tif len(s.ACL) > 0 {\n\t\tv := s.ACL\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-acl\", v, metadata)\n\t}\n\tif s.GrantFullControl != nil {\n\t\tv := *s.GrantFullControl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-full-control\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantRead != nil {\n\t\tv := *s.GrantRead\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-read\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantReadACP != nil {\n\t\tv := *s.GrantReadACP\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-read-acp\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantWrite != nil {\n\t\tv := *s.GrantWrite\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-write\", protocol.StringValue(v), metadata)\n\t}\n\tif s.GrantWriteACP != nil {\n\t\tv := *s.GrantWriteACP\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-grant-write-acp\", protocol.StringValue(v), metadata)\n\t}\n\tif s.ObjectLockEnabledForBucket != nil {\n\t\tv := *s.ObjectLockEnabledForBucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"x-amz-bucket-object-lock-enabled\", protocol.BoolValue(v), metadata)\n\t}\n\tif s.Bucket != nil {\n\t\tv := *s.Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"Bucket\", protocol.StringValue(v), metadata)\n\t}\n\tif s.CreateBucketConfiguration != nil {\n\t\tv := s.CreateBucketConfiguration\n\n\t\tmetadata := protocol.Metadata{XMLNamespaceURI: \"http://s3.amazonaws.com/doc/2006-03-01/\"}\n\t\te.SetFields(protocol.PayloadTarget, \"CreateBucketConfiguration\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "641637d8feabd052a2aa53b60ac334b8", "score": "0.5656602", "text": "func (s UpdateApiMappingOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingId != nil {\n\t\tv := *s.ApiMappingId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ApiMappingKey != nil {\n\t\tv := *s.ApiMappingKey\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"apiMappingKey\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Stage != nil {\n\t\tv := *s.Stage\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"stage\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a82176f1dbea831ffb26e45228277e5a", "score": "0.5651856", "text": "func (s Pipeline) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Activities) > 0 {\n\t\tv := s.Activities\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"activities\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreationTime != nil {\n\t\tv := *s.CreationTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"creationTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.LastUpdateTime != nil {\n\t\tv := *s.LastUpdateTime\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdateTime\", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.ReprocessingSummaries) > 0 {\n\t\tv := s.ReprocessingSummaries\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"reprocessingSummaries\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6af000f50518eb6f94873d65275cda85", "score": "0.5649373", "text": "func (s VirtualNodeRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VirtualNodeName != nil {\n\t\tv := *s.VirtualNodeName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualNodeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cbc24b95a09bf80488e04967fa476857", "score": "0.56433326", "text": "func (s GetIntrospectionSchemaInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Format) > 0 {\n\t\tv := s.Format\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"format\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.IncludeDirectives != nil {\n\t\tv := *s.IncludeDirectives\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"includeDirectives\", protocol.BoolValue(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "21ee08253493676d553887907dccaeac", "score": "0.5642019", "text": "func (s OTAUpdateInfo) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.AdditionalParameters != nil {\n\t\tv := s.AdditionalParameters\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"additionalParameters\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.AwsIotJobArn != nil {\n\t\tv := *s.AwsIotJobArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"awsIotJobArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AwsIotJobId != nil {\n\t\tv := *s.AwsIotJobId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"awsIotJobId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AwsJobExecutionsRolloutConfig != nil {\n\t\tv := s.AwsJobExecutionsRolloutConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"awsJobExecutionsRolloutConfig\", v, metadata)\n\t}\n\tif s.AwsJobPresignedUrlConfig != nil {\n\t\tv := s.AwsJobPresignedUrlConfig\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"awsJobPresignedUrlConfig\", v, metadata)\n\t}\n\tif s.CreationDate != nil {\n\t\tv := *s.CreationDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"creationDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ErrorInfo != nil {\n\t\tv := s.ErrorInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"errorInfo\", v, metadata)\n\t}\n\tif s.LastModifiedDate != nil {\n\t\tv := *s.LastModifiedDate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastModifiedDate\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.OtaUpdateArn != nil {\n\t\tv := *s.OtaUpdateArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"otaUpdateArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.OtaUpdateFiles != nil {\n\t\tv := s.OtaUpdateFiles\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"otaUpdateFiles\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.OtaUpdateId != nil {\n\t\tv := *s.OtaUpdateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"otaUpdateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.OtaUpdateStatus) > 0 {\n\t\tv := s.OtaUpdateStatus\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"otaUpdateStatus\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Protocols != nil {\n\t\tv := s.Protocols\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"protocols\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif len(s.TargetSelection) > 0 {\n\t\tv := s.TargetSelection\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"targetSelection\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Targets != nil {\n\t\tv := s.Targets\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"targets\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f597adce3451d68804b94f65f0544157", "score": "0.564168", "text": "func (s Source) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Architecture) > 0 {\n\t\tv := s.Architecture\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"architecture\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Etag != nil {\n\t\tv := *s.Etag\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"etag\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.S3Bucket != nil {\n\t\tv := *s.S3Bucket\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"s3Bucket\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.S3Key != nil {\n\t\tv := *s.S3Key\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"s3Key\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4caead0076ab706f3a82502140daac0d", "score": "0.5636668", "text": "func (s CreateModelOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ContentType != nil {\n\t\tv := *s.ContentType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"contentType\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelId != nil {\n\t\tv := *s.ModelId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"modelId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Schema != nil {\n\t\tv := *s.Schema\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"schema\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6b0fc3376734883505adf11207beef0d", "score": "0.5635322", "text": "func (s CreateJobInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.HopDestinations != nil {\n\t\tv := s.HopDestinations\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"hopDestinations\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\t}\n\tif s.AccelerationSettings != nil {\n\t\tv := s.AccelerationSettings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"accelerationSettings\", v, metadata)\n\t}\n\tif len(s.BillingTagsSource) > 0 {\n\t\tv := s.BillingTagsSource\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"billingTagsSource\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tvar ClientRequestToken string\n\tif s.ClientRequestToken != nil {\n\t\tClientRequestToken = *s.ClientRequestToken\n\t} else {\n\t\tClientRequestToken = protocol.GetIdempotencyToken()\n\t}\n\t{\n\t\tv := ClientRequestToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"clientRequestToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.JobTemplate != nil {\n\t\tv := *s.JobTemplate\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"jobTemplate\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Priority != nil {\n\t\tv := *s.Priority\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"priority\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Queue != nil {\n\t\tv := *s.Queue\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"queue\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Role != nil {\n\t\tv := *s.Role\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"role\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Settings != nil {\n\t\tv := s.Settings\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"settings\", v, metadata)\n\t}\n\tif len(s.SimulateReservedQueue) > 0 {\n\t\tv := s.SimulateReservedQueue\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"simulateReservedQueue\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.StatusUpdateInterval) > 0 {\n\t\tv := s.StatusUpdateInterval\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"statusUpdateInterval\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"tags\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.UserMetadata != nil {\n\t\tv := s.UserMetadata\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"userMetadata\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5dc02a69818eb40d8364ead2f467e8d", "score": "0.5634394", "text": "func (s UpdateBrokerStorageInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.CurrentVersion != nil {\n\t\tv := *s.CurrentVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"currentVersion\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TargetBrokerEBSVolumeInfo != nil {\n\t\tv := s.TargetBrokerEBSVolumeInfo\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"targetBrokerEBSVolumeInfo\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.ClusterArn != nil {\n\t\tv := *s.ClusterArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"clusterArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d93e1ea8ba5df52890395b0f7556a18", "score": "0.56334716", "text": "func (s CustomCodeSigning) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CertificateChain != nil {\n\t\tv := s.CertificateChain\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"certificateChain\", v, metadata)\n\t}\n\tif s.HashAlgorithm != nil {\n\t\tv := *s.HashAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"hashAlgorithm\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Signature != nil {\n\t\tv := s.Signature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"signature\", v, metadata)\n\t}\n\tif s.SignatureAlgorithm != nil {\n\t\tv := *s.SignatureAlgorithm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"signatureAlgorithm\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "105e76c4adfffd31c02778adc6e93131", "score": "0.56328213", "text": "func (s GetMacieSessionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\treturn nil\n}", "title": "" }, { "docid": "b11d6779239bdbea5231638d150344fb", "score": "0.56309557", "text": "func (s MeshRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c21b5e7df11631bd387f1898667cf51f", "score": "0.56252897", "text": "func (s GatewayRouteRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.GatewayRouteName != nil {\n\t\tv := *s.GatewayRouteName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"gatewayRouteName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VirtualGatewayName != nil {\n\t\tv := *s.VirtualGatewayName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualGatewayName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a13d22a58fa29196389df0b3e721cd31", "score": "0.5624952", "text": "func (s Resource) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Attributes) > 0 {\n\t\tv := s.Attributes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tms0 := e.Map(protocol.BodyTarget, \"attributes\", metadata)\n\t\tms0.Start()\n\t\tfor k1, v1 := range v {\n\t\t\tms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tms0.End()\n\n\t}\n\tif s.Feature != nil {\n\t\tv := *s.Feature\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"feature\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Type != nil {\n\t\tv := *s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "13e2a577926d52be40de1dc239c4f985", "score": "0.56231993", "text": "func (s RouteRef) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CreatedAt != nil {\n\t\tv := *s.CreatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"createdAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.LastUpdatedAt != nil {\n\t\tv := *s.LastUpdatedAt\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"lastUpdatedAt\",\n\t\t\tprotocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)\n\t}\n\tif s.MeshName != nil {\n\t\tv := *s.MeshName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MeshOwner != nil {\n\t\tv := *s.MeshOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"meshOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceOwner != nil {\n\t\tv := *s.ResourceOwner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceOwner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RouteName != nil {\n\t\tv := *s.RouteName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"routeName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Version != nil {\n\t\tv := *s.Version\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"version\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.VirtualRouterName != nil {\n\t\tv := *s.VirtualRouterName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"virtualRouterName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d6919cac4e6e914c9f26c04b0369f74", "score": "0.56211424", "text": "func (s DescribePipelineOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Pipeline != nil {\n\t\tv := s.Pipeline\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"pipeline\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6d6919cac4e6e914c9f26c04b0369f74", "score": "0.56211424", "text": "func (s DescribePipelineOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Pipeline != nil {\n\t\tv := s.Pipeline\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"pipeline\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7207301452e6011d47f8bac4dc0fd12a", "score": "0.5618491", "text": "func (s DescribeDetectorModelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.DetectorModelName != nil {\n\t\tv := *s.DetectorModelName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"detectorModelName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.DetectorModelVersion != nil {\n\t\tv := *s.DetectorModelVersion\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"version\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edfc7dab41e54a31e21f36723cf5eb47", "score": "0.5614795", "text": "func (s AttachPolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PolicyName != nil {\n\t\tv := *s.PolicyName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"policyName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a6036a5db218d152553c55051d09934", "score": "0.5613813", "text": "func (v *Service) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TBinary}); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteString(v.Name); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteString(v.ThriftName); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.ParentID != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TI32}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := v.ParentID.Encode(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 err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TList}); err != nil {\n\t\treturn err\n\t}\n\tif err := _List_Function_Encode(v.Functions, sw); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TI32}); err != nil {\n\t\treturn err\n\t}\n\tif err := v.ModuleID.Encode(sw); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.Annotations != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TMap}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := _Map_String_String_Encode(v.Annotations, 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": "1fc0f5c2111116565a7b93c5c2efba09", "score": "0.56108695", "text": "func (s GetSigningPlatformOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Category) > 0 {\n\t\tv := s.Category\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"category\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.DisplayName != nil {\n\t\tv := *s.DisplayName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"displayName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.MaxSizeInMB != nil {\n\t\tv := *s.MaxSizeInMB\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"maxSizeInMB\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Partner != nil {\n\t\tv := *s.Partner\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"partner\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PlatformId != nil {\n\t\tv := *s.PlatformId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"platformId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.SigningConfiguration != nil {\n\t\tv := s.SigningConfiguration\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"signingConfiguration\", v, metadata)\n\t}\n\tif s.SigningImageFormat != nil {\n\t\tv := s.SigningImageFormat\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"signingImageFormat\", v, metadata)\n\t}\n\tif s.Target != nil {\n\t\tv := *s.Target\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"target\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba023f8a028646bb74c8a02caa256f8b", "score": "0.56096196", "text": "func (s Product) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.ActivationUrl != nil {\n\t\tv := *s.ActivationUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ActivationUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Categories != nil {\n\t\tv := s.Categories\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Categories\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.CompanyName != nil {\n\t\tv := *s.CompanyName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CompanyName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Description != nil {\n\t\tv := *s.Description\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Description\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.IntegrationTypes != nil {\n\t\tv := s.IntegrationTypes\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"IntegrationTypes\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.MarketplaceUrl != nil {\n\t\tv := *s.MarketplaceUrl\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"MarketplaceUrl\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProductArn != nil {\n\t\tv := *s.ProductArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProductArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProductName != nil {\n\t\tv := *s.ProductName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProductName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProductSubscriptionResourcePolicy != nil {\n\t\tv := *s.ProductSubscriptionResourcePolicy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"ProductSubscriptionResourcePolicy\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4148ac636cd59ea12951570a57c17d1", "score": "0.5608886", "text": "func (s AwsLambdaFunctionLayer) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Arn != nil {\n\t\tv := *s.Arn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Arn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.CodeSize != nil {\n\t\tv := *s.CodeSize\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"CodeSize\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2844f350eb134d59688b155003690c3c", "score": "0.5607481", "text": "func (s HttpAuthorization) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Sigv4 != nil {\n\t\tv := s.Sigv4\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"sigv4\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a50bd2614c6c6856d48d1a32c3485c1", "score": "0.56039125", "text": "func (s DescribePipelineInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.PipelineName != nil {\n\t\tv := *s.PipelineName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"pipelineName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8226db037565273fd3eb5f3085c980cf", "score": "0.5586996", "text": "func (s GetModelInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ModelId != nil {\n\t\tv := *s.ModelId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"modelId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
a9a00ecd4779d8a8b14136f8a27e11c7
EXPECT returns an object that allows the caller to indicate expected use.
[ { "docid": "b683aa61af3676558e3344fb2b71ce83", "score": "0.0", "text": "func (m *MockIssueSparePartRepo) EXPECT() *MockIssueSparePartRepoMockRecorder {\n\treturn m.recorder\n}", "title": "" } ]
[ { "docid": "8e9cd2d35b436e4e2e71fe6311a7ceab", "score": "0.61719143", "text": "func Expect(t *testing.T, actual interface{}) *Testee {\n\treturn newTestee(t, actual)\n}", "title": "" }, { "docid": "d91658ed8083d76d5bcd2be2f939f9d1", "score": "0.6054691", "text": "func (m *Mint) Expect(actual interface{}) *Testee {\n\treturn newTestee(m.t, actual)\n}", "title": "" }, { "docid": "9616a65bc4acd286dcbc96d1aed023cd", "score": "0.601819", "text": "func Expect(data ...interface{}) MyExpect {\n\treturn MyExpect{\n\t\tIExpect: hit.Expect(data...),\n\t}\n}", "title": "" }, { "docid": "6a28f5dfb8215992ccd368c6aaee8947", "score": "0.58801794", "text": "func (mmIsAvailable *mAvailabilityCheckerMockIsAvailable) Expect(ctx context.Context) *mAvailabilityCheckerMockIsAvailable {\n\tif mmIsAvailable.mock.funcIsAvailable != nil {\n\t\tmmIsAvailable.mock.t.Fatalf(\"AvailabilityCheckerMock.IsAvailable mock is already set by Set\")\n\t}\n\n\tif mmIsAvailable.defaultExpectation == nil {\n\t\tmmIsAvailable.defaultExpectation = &AvailabilityCheckerMockIsAvailableExpectation{}\n\t}\n\n\tmmIsAvailable.defaultExpectation.params = &AvailabilityCheckerMockIsAvailableParams{ctx}\n\tfor _, e := range mmIsAvailable.expectations {\n\t\tif minimock.Equal(e.params, mmIsAvailable.defaultExpectation.params) {\n\t\t\tmmIsAvailable.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmIsAvailable.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmIsAvailable\n}", "title": "" }, { "docid": "abde1aa7d95f24accc883003bc90160f", "score": "0.5873241", "text": "func (tc TestCases) expect() {\n\tif !reflect.DeepEqual(tc.resp, tc.respExp) {\n\t\ttc.t.Error(fmt.Sprintf(\"\\nRequested: \", tc.req, \"\\nExpected: \", tc.respExp, \"\\nFound: \", tc.resp))\n\t}\n}", "title": "" }, { "docid": "0f5933e03c60bbb842bc9252fa54cbf7", "score": "0.5782811", "text": "func mockSenderReference() *SenderReference {\n\tsr := NewSenderReference()\n\tsr.SenderReference = \"Sender Reference\"\n\treturn sr\n}", "title": "" }, { "docid": "9f8caa7b784236351efbe3ee63b04120", "score": "0.57110333", "text": "func testMetadataObj() (metadata Metadata) {\n\tmetadata = Metadata{\n\t\tPackage: testModuleName(),\n\t\tVersion: \"0.1.0\",\n\t\tDescription: \"Test Project for Gomason.\",\n\t\tBuildInfo: BuildInfo{\n\t\t\tPrepCommands: []string{\n\t\t\t\t\"echo \\\"GOPATH is: ${GOPATH}\\\"\",\n\t\t\t},\n\t\t\tTargets: []BuildTarget{\n\t\t\t\t{\n\t\t\t\t\tName: \"linux/amd64\",\n\t\t\t\t\tFlags: map[string]string{\n\t\t\t\t\t\t\"FOO\": \"bar\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tSignInfo: SignInfo{\n\t\t\tProgram: \"gpg\",\n\t\t\tEmail: \"gomason-tester@foo.com\",\n\t\t},\n\t\tPublishInfo: PublishInfo{\n\t\t\tTargets: []PublishTarget{\n\t\t\t\t{\n\t\t\t\t\tSource: \"testproject_linux_amd64\",\n\t\t\t\t\tDestination: \"{{.Repository}}/testproject/{{.Version}}/linux/amd64/testproject\",\n\t\t\t\t\tSignature: true,\n\t\t\t\t\tChecksums: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTargetsMap: map[string]PublishTarget{\n\t\t\t\t\"testproject_linux_amd64\": {\n\t\t\t\t\tSource: \"testproject_linux_amd64\",\n\t\t\t\t\tDestination: \"{{.Repository}}/testproject/{{.Version}}/linux/amd64/testproject\",\n\t\t\t\t\tSignature: true,\n\t\t\t\t\tChecksums: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn metadata\n}", "title": "" }, { "docid": "0a03d2b73359fd0d3c3a30f9f1410c34", "score": "0.56970483", "text": "func (m *MockMachinery) EXPECT() *MockMachineryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "05f86ef8d05cf6c5c7014e56476aee3e", "score": "0.5690189", "text": "func (i *Mock) Expect() *RequestBuilder {\n\treturn i.request(nil)\n}", "title": "" }, { "docid": "aa77dfd1b6378abe9a9176b11c4060e0", "score": "0.56505734", "text": "func mock() error {\n\treturn nil\n}", "title": "" }, { "docid": "2462c35c7cc292b9dbb86b8826299b62", "score": "0.5649994", "text": "func (_m *MockPhotoUsecase) EXPECT() *MockPhotoUsecaseMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "df50189b0189759b5ec904bb0719049c", "score": "0.56433994", "text": "func expect(t *testing.T, a interface{}, b interface{}) {\n\tif a != b {\n\t\tt.Errorf(\n\t\t\t\"Expected %v - Got %v\",\n\t\t\ta, b,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "8f3df68329efd943b20abbf46e60e945", "score": "0.56365556", "text": "func (m *MocksecretCreator) EXPECT() *MocksecretCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "81ab3881ba841fa9c2b63364405c0a60", "score": "0.5632021", "text": "func (_m *MockYAML) EXPECT() *MockYAMLMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "85ed90beba6e45df1971b82b727bb898", "score": "0.5624333", "text": "func (mmAsBytes *mSignatureHolderMockAsBytes) Expect() *mSignatureHolderMockAsBytes {\n\tif mmAsBytes.mock.funcAsBytes != nil {\n\t\tmmAsBytes.mock.t.Fatalf(\"SignatureHolderMock.AsBytes mock is already set by Set\")\n\t}\n\n\tif mmAsBytes.defaultExpectation == nil {\n\t\tmmAsBytes.defaultExpectation = &SignatureHolderMockAsBytesExpectation{}\n\t}\n\n\treturn mmAsBytes\n}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5623748", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5623748", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5623748", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5d695a2909565d104acc0790ce0ccf1e", "score": "0.5623748", "text": "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "b8fd990bd60fd4c54b28a110ed49f477", "score": "0.5610377", "text": "func (m *MockHelm) EXPECT() *MockHelmMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "e17ee473a9ab97b4cb84870278f52560", "score": "0.5603535", "text": "func (mmMatch *mStaterMockMatch) Expect() *mStaterMockMatch {\n\tif mmMatch.mock.funcMatch != nil {\n\t\tmmMatch.mock.t.Fatalf(\"StaterMock.Match mock is already set by Set\")\n\t}\n\n\tif mmMatch.defaultExpectation == nil {\n\t\tmmMatch.defaultExpectation = &StaterMockMatchExpectation{}\n\t}\n\n\treturn mmMatch\n}", "title": "" }, { "docid": "975a9873c8ed197390d4794172408215", "score": "0.560104", "text": "func (mmCreate *mStorageMockCreate) Expect(model interface{}) *mStorageMockCreate {\n\tif mmCreate.mock.funcCreate != nil {\n\t\tmmCreate.mock.t.Fatalf(\"StorageMock.Create mock is already set by Set\")\n\t}\n\n\tif mmCreate.defaultExpectation == nil {\n\t\tmmCreate.defaultExpectation = &StorageMockCreateExpectation{}\n\t}\n\n\tmmCreate.defaultExpectation.params = &StorageMockCreateParams{model}\n\tfor _, e := range mmCreate.expectations {\n\t\tif minimock.Equal(e.params, mmCreate.defaultExpectation.params) {\n\t\t\tmmCreate.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmCreate.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmCreate\n}", "title": "" }, { "docid": "2945593079656838127544e97014ddb9", "score": "0.5600347", "text": "func (mmState *mStaterMockState) Expect() *mStaterMockState {\n\tif mmState.mock.funcState != nil {\n\t\tmmState.mock.t.Fatalf(\"StaterMock.State mock is already set by Set\")\n\t}\n\n\tif mmState.defaultExpectation == nil {\n\t\tmmState.defaultExpectation = &StaterMockStateExpectation{}\n\t}\n\n\treturn mmState\n}", "title": "" }, { "docid": "457c17df2b7332599c73fcd99bfc8ea9", "score": "0.55862296", "text": "func (mmWriteTo *mSignatureHolderMockWriteTo) Expect(w io.Writer) *mSignatureHolderMockWriteTo {\n\tif mmWriteTo.mock.funcWriteTo != nil {\n\t\tmmWriteTo.mock.t.Fatalf(\"SignatureHolderMock.WriteTo mock is already set by Set\")\n\t}\n\n\tif mmWriteTo.defaultExpectation == nil {\n\t\tmmWriteTo.defaultExpectation = &SignatureHolderMockWriteToExpectation{}\n\t}\n\n\tmmWriteTo.defaultExpectation.params = &SignatureHolderMockWriteToParams{w}\n\tfor _, e := range mmWriteTo.expectations {\n\t\tif minimock.Equal(e.params, mmWriteTo.defaultExpectation.params) {\n\t\t\tmmWriteTo.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmWriteTo.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmWriteTo\n}", "title": "" }, { "docid": "6bfd13a35eb7e1a9bb22d7badd701a73", "score": "0.55823755", "text": "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "6bfd13a35eb7e1a9bb22d7badd701a73", "score": "0.55823755", "text": "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "8fd83461c48baa3c0140ce2806f31547", "score": "0.5563171", "text": "func (mmStart *mStarterMockStart) Expect(ctx context.Context) *mStarterMockStart {\n\tif mmStart.mock.funcStart != nil {\n\t\tmmStart.mock.t.Fatalf(\"StarterMock.Start mock is already set by Set\")\n\t}\n\n\tif mmStart.defaultExpectation == nil {\n\t\tmmStart.defaultExpectation = &StarterMockStartExpectation{}\n\t}\n\n\tmmStart.defaultExpectation.params = &StarterMockStartParams{ctx}\n\tfor _, e := range mmStart.expectations {\n\t\tif minimock.Equal(e.params, mmStart.defaultExpectation.params) {\n\t\t\tmmStart.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmStart.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmStart\n}", "title": "" }, { "docid": "5e172ad935996c4d8245964d03ae121e", "score": "0.5560725", "text": "func (m *MockArticlesUsecase) EXPECT() *MockArticlesUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "411745a5804c54803f984dd4e92f3439", "score": "0.5557417", "text": "func NewRequesterArgSameAsNamedImport(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *RequesterArgSameAsNamedImport {\n\tmock := &RequesterArgSameAsNamedImport{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "e039ee2460bf9ba1928b1597f55fdcff", "score": "0.5551496", "text": "func (mmAsByteString *mSignatureHolderMockAsByteString) Expect() *mSignatureHolderMockAsByteString {\n\tif mmAsByteString.mock.funcAsByteString != nil {\n\t\tmmAsByteString.mock.t.Fatalf(\"SignatureHolderMock.AsByteString mock is already set by Set\")\n\t}\n\n\tif mmAsByteString.defaultExpectation == nil {\n\t\tmmAsByteString.defaultExpectation = &SignatureHolderMockAsByteStringExpectation{}\n\t}\n\n\treturn mmAsByteString\n}", "title": "" }, { "docid": "8bee2904aec9a91efe4fb8a85938faed", "score": "0.55441123", "text": "func (m *MockIssueParser) EXPECT() *MockIssueParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "935a097e8ed9b7113c4311bd8276b9ba", "score": "0.55379456", "text": "func (m *MockItemUsecase) EXPECT() *MockItemUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "d6b09a8d78998bd92bd646477962a7ba", "score": "0.5529569", "text": "func (mmStorage *mJetKeeperMockStorage) Expect() *mJetKeeperMockStorage {\n\tif mmStorage.mock.funcStorage != nil {\n\t\tmmStorage.mock.t.Fatalf(\"JetKeeperMock.Storage mock is already set by Set\")\n\t}\n\n\tif mmStorage.defaultExpectation == nil {\n\t\tmmStorage.defaultExpectation = &JetKeeperMockStorageExpectation{}\n\t}\n\n\treturn mmStorage\n}", "title": "" }, { "docid": "d22547a1adcd845ee0adaecd901c275e", "score": "0.551711", "text": "func (mmGetState *mNetworkMockGetState) Expect() *mNetworkMockGetState {\n\tif mmGetState.mock.funcGetState != nil {\n\t\tmmGetState.mock.t.Fatalf(\"NetworkMock.GetState mock is already set by Set\")\n\t}\n\n\tif mmGetState.defaultExpectation == nil {\n\t\tmmGetState.defaultExpectation = &NetworkMockGetStateExpectation{}\n\t}\n\n\treturn mmGetState\n}", "title": "" }, { "docid": "7f73633552d8ccb39a9a7871dccf5aab", "score": "0.55076826", "text": "func Expect(t TestingT, expect string, actual interface{}, args ...int) bool {\n\tcall := 3\n\tif len(args) > 0 {\n\t\tcall = args[0]\n\t}\n\n\tactualStr := fmt.Sprint(actual)\n\tif expect != actualStr {\n\t\terr := FmtErr(call)\n\t\tt.Errorf(err, expect, actualStr)\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b3c06db3fccbfb18dff22d73db23a571", "score": "0.54939115", "text": "func (mmStart *mHostNetworkMockStart) Expect(ctx context.Context) *mHostNetworkMockStart {\n\tif mmStart.mock.funcStart != nil {\n\t\tmmStart.mock.t.Fatalf(\"HostNetworkMock.Start mock is already set by Set\")\n\t}\n\n\tif mmStart.defaultExpectation == nil {\n\t\tmmStart.defaultExpectation = &HostNetworkMockStartExpectation{}\n\t}\n\n\tmmStart.defaultExpectation.params = &HostNetworkMockStartParams{ctx}\n\tfor _, e := range mmStart.expectations {\n\t\tif minimock.Equal(e.params, mmStart.defaultExpectation.params) {\n\t\t\tmmStart.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmStart.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmStart\n}", "title": "" }, { "docid": "0cd29bf1e830b3f362080932f59d29dd", "score": "0.54901713", "text": "func (mmStartWorker *mStaterMockStartWorker) Expect() *mStaterMockStartWorker {\n\tif mmStartWorker.mock.funcStartWorker != nil {\n\t\tmmStartWorker.mock.t.Fatalf(\"StaterMock.StartWorker mock is already set by Set\")\n\t}\n\n\tif mmStartWorker.defaultExpectation == nil {\n\t\tmmStartWorker.defaultExpectation = &StaterMockStartWorkerExpectation{}\n\t}\n\n\treturn mmStartWorker\n}", "title": "" }, { "docid": "3881f42cf99f96acb222d0c70724f800", "score": "0.5490054", "text": "func (_m *MockStager) EXPECT() *MockStagerMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "3881f42cf99f96acb222d0c70724f800", "score": "0.5490054", "text": "func (_m *MockStager) EXPECT() *MockStagerMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "3881f42cf99f96acb222d0c70724f800", "score": "0.5490054", "text": "func (_m *MockStager) EXPECT() *MockStagerMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "569ff5b6f5631e1b228457e2af5cd45f", "score": "0.5489935", "text": "func (mmRead *mSignatureHolderMockRead) Expect(p []byte) *mSignatureHolderMockRead {\n\tif mmRead.mock.funcRead != nil {\n\t\tmmRead.mock.t.Fatalf(\"SignatureHolderMock.Read mock is already set by Set\")\n\t}\n\n\tif mmRead.defaultExpectation == nil {\n\t\tmmRead.defaultExpectation = &SignatureHolderMockReadExpectation{}\n\t}\n\n\tmmRead.defaultExpectation.params = &SignatureHolderMockReadParams{p}\n\tfor _, e := range mmRead.expectations {\n\t\tif minimock.Equal(e.params, mmRead.defaultExpectation.params) {\n\t\t\tmmRead.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmRead.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmRead\n}", "title": "" }, { "docid": "858cfe719c7fbb03df94c8867dc232ee", "score": "0.54896104", "text": "func mockAmount() *Amount {\n\ta := NewAmount()\n\ta.Amount = \"000001234567\"\n\treturn a\n}", "title": "" }, { "docid": "858cfe719c7fbb03df94c8867dc232ee", "score": "0.54896104", "text": "func mockAmount() *Amount {\n\ta := NewAmount()\n\ta.Amount = \"000001234567\"\n\treturn a\n}", "title": "" }, { "docid": "903ac115c3a6dbc7f1cbbb9654ae7ad8", "score": "0.5481215", "text": "func (m *Mockcodestar) EXPECT() *MockcodestarMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "d770632d8c73de7373e8b18ecca3d610", "score": "0.54753727", "text": "func Expect(err error, msg string) {\n\tif err != nil {\n\t\tpanic(msg)\n\t}\n}", "title": "" }, { "docid": "2e6108dab77afb0efc61d119db3440be", "score": "0.5471378", "text": "func (mmSender *mMessageMockSender) Expect() *mMessageMockSender {\n\tif mmSender.mock.funcSender != nil {\n\t\tmmSender.mock.t.Fatalf(\"MessageMock.Sender mock is already set by Set\")\n\t}\n\n\tif mmSender.defaultExpectation == nil {\n\t\tmmSender.defaultExpectation = &MessageMockSenderExpectation{}\n\t}\n\n\treturn mmSender\n}", "title": "" }, { "docid": "7deab9278cba09c041ea98122d095104", "score": "0.54697037", "text": "func (mmCopyOfSignature *mSignatureHolderMockCopyOfSignature) Expect() *mSignatureHolderMockCopyOfSignature {\n\tif mmCopyOfSignature.mock.funcCopyOfSignature != nil {\n\t\tmmCopyOfSignature.mock.t.Fatalf(\"SignatureHolderMock.CopyOfSignature mock is already set by Set\")\n\t}\n\n\tif mmCopyOfSignature.defaultExpectation == nil {\n\t\tmmCopyOfSignature.defaultExpectation = &SignatureHolderMockCopyOfSignatureExpectation{}\n\t}\n\n\treturn mmCopyOfSignature\n}", "title": "" }, { "docid": "3e873dcabdf1ae312f4df652c53b4af5", "score": "0.54573005", "text": "func (m *MockStorable) EXPECT() *MockStorableMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "64e46fc0d22e8ebb26b76b6c0f0f5c15", "score": "0.5455639", "text": "func (m *MockSomethingUseCase) EXPECT() *MockSomethingUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "eb36b8d58f1da7de8d25b3aa0ac944b2", "score": "0.5454312", "text": "func (m *MockMaker) EXPECT() *MockMakerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "9676a270dddb8f896660bc388670ac8c", "score": "0.5449962", "text": "func (m *MockinstanceMetadata) EXPECT() *MockinstanceMetadataMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "e36866b373868647589cda37902c8517", "score": "0.5442097", "text": "func (m *MockProviders) EXPECT() *MockProvidersMockRecorder {\r\n\treturn m.recorder\r\n}", "title": "" }, { "docid": "98842eb6b5743f386ca1ff98f6fe2cf6", "score": "0.5440795", "text": "func (m *MockenvironmentCreator) EXPECT() *MockenvironmentCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bee9a4103ff0babde1fa4fcfd506d6db", "score": "0.54278576", "text": "func (m *MockExternalIssueParser) EXPECT() *MockExternalIssueParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "5be5c08c31ef72bd3d9d26452a686a69", "score": "0.5423497", "text": "func (m *MockapplicationCreator) EXPECT() *MockapplicationCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "346e12f057d9ea860fad425e838523a9", "score": "0.5419243", "text": "func (mmGetSignatureVerifier *mLocalNodeMockGetSignatureVerifier) Expect() *mLocalNodeMockGetSignatureVerifier {\n\tif mmGetSignatureVerifier.mock.funcGetSignatureVerifier != nil {\n\t\tmmGetSignatureVerifier.mock.t.Fatalf(\"LocalNodeMock.GetSignatureVerifier mock is already set by Set\")\n\t}\n\n\tif mmGetSignatureVerifier.defaultExpectation == nil {\n\t\tmmGetSignatureVerifier.defaultExpectation = &LocalNodeMockGetSignatureVerifierExpectation{}\n\t}\n\n\treturn mmGetSignatureVerifier\n}", "title": "" }, { "docid": "7d0ea3e1ec648dc04e117ab2070be8f4", "score": "0.54186547", "text": "func (_m *MockExample) EXPECT() *MockExampleMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "c4e5318bd99adaf2a94b55428439b89c", "score": "0.54165655", "text": "func (m *MockfsCreator) EXPECT() *MockfsCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "39dda80493fa584c31f5ece56d6b8ec1", "score": "0.541504", "text": "func (mmStart *mOpentelemetryTracerMockStart) Expect(ctx context.Context, spanName string, opts ...mm_trace.SpanStartOption) *mOpentelemetryTracerMockStart {\n\tif mmStart.mock.funcStart != nil {\n\t\tmmStart.mock.t.Fatalf(\"OpentelemetryTracerMock.Start mock is already set by Set\")\n\t}\n\n\tif mmStart.defaultExpectation == nil {\n\t\tmmStart.defaultExpectation = &OpentelemetryTracerMockStartExpectation{}\n\t}\n\n\tmmStart.defaultExpectation.params = &OpentelemetryTracerMockStartParams{ctx, spanName, opts}\n\tfor _, e := range mmStart.expectations {\n\t\tif minimock.Equal(e.params, mmStart.defaultExpectation.params) {\n\t\t\tmmStart.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmStart.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmStart\n}", "title": "" }, { "docid": "f6fea4bb8eac8ac6a154fb9129b35eed", "score": "0.54148346", "text": "func (m *MockLambdaAPI) EXPECT() *MockLambdaAPIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "f6fea4bb8eac8ac6a154fb9129b35eed", "score": "0.54148346", "text": "func (m *MockLambdaAPI) EXPECT() *MockLambdaAPIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "246f528603a0478293c790d4d3e17174", "score": "0.5411769", "text": "func (m *MockResourceManager) EXPECT() *MockResourceManagerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "246f528603a0478293c790d4d3e17174", "score": "0.5411769", "text": "func (m *MockResourceManager) EXPECT() *MockResourceManagerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "246f528603a0478293c790d4d3e17174", "score": "0.5411769", "text": "func (m *MockResourceManager) EXPECT() *MockResourceManagerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "f159c24e51cbf4b728f486063adfac9d", "score": "0.5409795", "text": "func (_m *MockManifest) EXPECT() *MockManifestMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "f159c24e51cbf4b728f486063adfac9d", "score": "0.5409795", "text": "func (_m *MockManifest) EXPECT() *MockManifestMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "9cda667b4e970353045d30fe08466d30", "score": "0.5409593", "text": "func (m *MockIUsecase) EXPECT() *MockIUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "9cda667b4e970353045d30fe08466d30", "score": "0.5409593", "text": "func (m *MockIUsecase) EXPECT() *MockIUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "a48d44cd14fc094bcbc070180085952f", "score": "0.54043657", "text": "func (m *MockstackSerializer) EXPECT() *MockstackSerializerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "052b2d7f0f7f0d161e8a2ca31ecfb060", "score": "0.5404121", "text": "func expectBody(t *testing.T, got interface{}, expected interface{}) {\n\tif got != expected {\n\t\tt.Errorf(\"handler returned wrong body: got %v want %v\", got, expected)\n\t}\n}", "title": "" }, { "docid": "94e2a10fbe712626aea93a77edb6d281", "score": "0.53987134", "text": "func (m *MockTokenCreator) EXPECT() *MockTokenCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "79b25f08728b43bd3921f39b9a45ea97", "score": "0.53976524", "text": "func (m *MockCliInterface) EXPECT() *MockCliInterfaceMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "86732e4a6ff0339e9ebdfd83d5135395", "score": "0.5397504", "text": "func (m *MockUserUsecase) EXPECT() *MockUserUsecaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "f7dafa83441396025e66dd7babcddc1d", "score": "0.5396744", "text": "func (c *Challenge) Be(expected interface{}) *Challenge {\n\tc.t.Helper()\n\tif _, ok := c.v.(error); ok {\n\t\treturn c.RaiseError(expected)\n\t}\n\n\tc.expect(reflect.DeepEqual(c.v, expected), \"Expected '%v' to equal '%v'\", c.v, expected)\n\treturn c\n}", "title": "" }, { "docid": "a5e89b0252616a7b800c830e51d31a5b", "score": "0.5395078", "text": "func (m *MockNAT) EXPECT() *MockNATMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.53914934", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.53914934", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.53914934", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "bfa3d8c3520eaa90ee6b8c96d89cfd7a", "score": "0.53914934", "text": "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "a65eb57cca6da1a1ae1e023132d23d92", "score": "0.53913915", "text": "func (m *MockAbillity) EXPECT() *MockAbillityMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "0426cee0d6fe36d1edf7982cadb7f1fa", "score": "0.5385288", "text": "func (m MockProvider) MockASG() *mocksv2.ASG { return m.ASG().(*mocksv2.ASG) }", "title": "" }, { "docid": "1d6591cfeb43463d8799568983335930", "score": "0.5384326", "text": "func (m *MockJSONCreator) EXPECT() *MockJSONCreatorMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "2176f8782377ba05467bec3bada7ecb0", "score": "0.53822607", "text": "func (m *MockEC2) EXPECT() *MockEC2MockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "4df3a1af6992a369483245ca3fb571d9", "score": "0.53815657", "text": "func (mmIsVoter *mLocalNodeMockIsVoter) Expect() *mLocalNodeMockIsVoter {\n\tif mmIsVoter.mock.funcIsVoter != nil {\n\t\tmmIsVoter.mock.t.Fatalf(\"LocalNodeMock.IsVoter mock is already set by Set\")\n\t}\n\n\tif mmIsVoter.defaultExpectation == nil {\n\t\tmmIsVoter.defaultExpectation = &LocalNodeMockIsVoterExpectation{}\n\t}\n\n\treturn mmIsVoter\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "78a0951eac3f13affda1c717b02f798d", "score": "0.53799736", "text": "func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "be4610eda0d6bbb63a18fe84ed75ad7c", "score": "0.5376101", "text": "func (m *MockDiagnosticBundleFactory) EXPECT() *MockDiagnosticBundleFactoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "50ba3023fc5d911395c841c0b2da3840", "score": "0.5374483", "text": "func (m *MockExternalSourceParser) EXPECT() *MockExternalSourceParserMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "7110bebe146769d704d2918fa225f000", "score": "0.5374464", "text": "func (d MyInterfaceMockDescriptor) ReturnSomethingAtLeast() *MyInterfaceReturnSomethingAtLeastMockDescriptor {\n\treturn d.newMyInterfaceReturnSomethingAtLeastMockDescriptor()\n}", "title": "" }, { "docid": "e303124c9f5ce1cff7a0404f3936bef2", "score": "0.53743094", "text": "func mockInstructedAmount() *InstructedAmount {\n\tia := NewInstructedAmount()\n\tia.CurrencyCode = \"USD\"\n\tia.Amount = \"4567,89\"\n\treturn ia\n}", "title": "" }, { "docid": "f557e879232903dc00f2d35fd6e8afec", "score": "0.53732634", "text": "func (m *MockAMI) EXPECT() *MockAMIMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "17be70a87fa908e192ca2677e63b4246", "score": "0.536799", "text": "func (m *MockStream) EXPECT() *MockStreamMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "b357c5e31e89520b9e9bb55803fb7997", "score": "0.5365062", "text": "func (_m *MockLogic) EXPECT() *MockLogicMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "2c5320f2270f605a5a7275f954fd7cba", "score": "0.5362796", "text": "func (mmUploader *mStaterMockUploader) Expect() *mStaterMockUploader {\n\tif mmUploader.mock.funcUploader != nil {\n\t\tmmUploader.mock.t.Fatalf(\"StaterMock.Uploader mock is already set by Set\")\n\t}\n\n\tif mmUploader.defaultExpectation == nil {\n\t\tmmUploader.defaultExpectation = &StaterMockUploaderExpectation{}\n\t}\n\n\treturn mmUploader\n}", "title": "" }, { "docid": "cf41e43707b22d7a56b1bcb860585f44", "score": "0.53611606", "text": "func (m *MockSerializer) EXPECT() *MockSerializerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "e347bbf039917a30b5ff944996563271", "score": "0.5360016", "text": "func (mmStart *mTransformerMockStart) Expect(ctx context.Context) *mTransformerMockStart {\n\tif mmStart.mock.funcStart != nil {\n\t\tmmStart.mock.t.Fatalf(\"TransformerMock.Start mock is already set by Set\")\n\t}\n\n\tif mmStart.defaultExpectation == nil {\n\t\tmmStart.defaultExpectation = &TransformerMockStartExpectation{}\n\t}\n\n\tmmStart.defaultExpectation.params = &TransformerMockStartParams{ctx}\n\tfor _, e := range mmStart.expectations {\n\t\tif minimock.Equal(e.params, mmStart.defaultExpectation.params) {\n\t\t\tmmStart.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmStart.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmStart\n}", "title": "" }, { "docid": "4b275b82fd7b854e480e94ec1a185e38", "score": "0.53580415", "text": "func (m *MockInstance) EXPECT() *MockInstanceMockRecorder {\n\treturn m.recorder\n}", "title": "" } ]
6b33ed091aa8dda257236c68f1ed50e8
hostsInRenterDBCheck makes sure that all the renters see numHosts hosts in their database.
[ { "docid": "ceabfd8e62d4b8117e666f4f49aae778", "score": "0.8438692", "text": "func hostsInRenterDBCheck(miner *TestNode, renters map[*TestNode]struct{}, numHosts int) error {\n\tfor renter := range renters {\n\t\terr := Retry(100, 100*time.Millisecond, func() error {\n\t\t\thdag, err := renter.HostDbActiveGet()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(hdag.Hosts) != numHosts {\n\t\t\t\tif err := miner.MineBlock(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn errors.New(\"renter doesn't have enough active hosts in hostdb\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "911ad5ff8fd8c527c0763482c882516a", "score": "0.5789536", "text": "func validateHosts(EMSClient *Client, opts *GetAllOpts) {\n\thostArr, err := EMSClient.Hosts.GetAll(opts)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error getting all hosts: %s\", err)\n\t\treturn\n\t}\n\t// Validate hosts getters:\n\tfor i, host := range hostArr {\n\t fmt.Printf(\"Host# %v: %v, Role: %v\\n\", i, host.Name, host.Role)\n\n\t // Retrieve single host:\n\t hostGetSingle, err := EMSClient.Hosts.GetHost(i+1)\n\t if (err != nil) { fmt.Printf(\"Error retrieving host information: %s\\n\", err) }\n\t\tif (hostGetSingle.ID != (i+1)) { fmt.Printf(\"Error: host ID mismatches?!\\n\") }\n\n\t fmt.Printf(\"Host %s: cores=%d, device count=%d, memory=%d\\n\",\n\t \thostGetSingle.Name, hostGetSingle.Cores, hostGetSingle.DevicesCount, hostGetSingle.Memory)\n\t}\n}", "title": "" }, { "docid": "21a80b4239d1ecd05b6767e44f6d2107", "score": "0.55273753", "text": "func (r *Renter) AllHosts() []modules.HostDBEntry { return r.hostDB.AllHosts() }", "title": "" }, { "docid": "d481e7a436a86140dca4250cc376b00f", "score": "0.5507556", "text": "func CheckStuckHosts() ([]StuckHostInconsistency, error) {\n\t// find all hosts with tasks that are completed\n\tpipeline := []bson.M{\n\t\t{\"$match\": bson.M{host.RunningTaskKey: bson.M{\"$exists\": true}}},\n\t\t{\"$lookup\": bson.M{\"from\": task.Collection, \"localField\": host.RunningTaskKey,\n\t\t\t\"foreignField\": task.IdKey, \"as\": HostTaskKey}},\n\t\t{\"$unwind\": \"$\" + HostTaskKey},\n\t\t{\"$match\": bson.M{HostTaskKey + \".\" + task.StatusKey: bson.M{\"$in\": task.CompletedStatuses}}},\n\t\t{\"$project\": bson.M{\n\t\t\tStuckHostKey: \"$\" + host.IdKey,\n\t\t\tStuckHostRunningTaskKey: \"$\" + host.RunningTaskKey,\n\t\t\tStuckHostTaskStatusKey: \"$\" + HostTaskKey + \".\" + task.StatusKey,\n\t\t}},\n\t}\n\tstuckHosts := []StuckHostInconsistency{}\n\terr := db.Aggregate(host.Collection, pipeline, &stuckHosts)\n\treturn stuckHosts, err\n}", "title": "" }, { "docid": "ef414c23e0e84523a7a6b4adf542eeb4", "score": "0.54053605", "text": "func (m *Matcher) HasEnoughHosts() bool {\n\treturn uint32(len(m.hostOffers)) >= effectiveHostLimit(m.hostFilter)\n}", "title": "" }, { "docid": "55ceca787f9c29ecf670b43df20627d9", "score": "0.52506846", "text": "func TestGetHosts(t *testing.T) {\n\n\t_ = os.Setenv(\"DEPLOYMENT_COLOR\", \"RED\")\n\t// confusing entry that might kinda look like ust because of the USERNAME suffix\n\t// but doesn't begin with a client type\n\t_ = os.Setenv(\"SOME_NON_HOST_BUNCH_OF_STUFF_USERNAME\", \"garbage\")\n\t// set some host stuff for the MY_EXPIRED_IDENTITES db\n\t_ = os.Setenv(\"POSTGRES10_MY_EXPIRED_IDENTITIES_USERNAME\", \"jdoe\")\n\t_ = os.Setenv(\"POSTGRES10_MY_EXPIRED_IDENTITIES_PASSWORD\", \"bad_password\")\n\t_ = os.Setenv(\"POSTGRES10_MY_EXPIRED_IDENTITIES_ADDRESS\", \"db.domain.invalid_tld\")\n\t_ = os.Setenv(\"POSTGRES10_MY_EXPIRED_IDENTITIES_PORT\", \"5432\")\n\n\tv := []string{\n\t\t\"DEPLOYMENT_COLOR\",\n\t\t\"SOME_NON_HOST_BUNCH_OF_STUFF_USERNAME\",\n\t\t\"POSTGRES10_MY_EXPIRED_IDENTITIES_USERNAME\",\n\t\t\"POSTGRES10_MY_EXPIRED_IDENTITIES_PASSWORD\",\n\t\t\"POSTGRES10_MY_EXPIRED_IDENTITIES_ADDRESS\",\n\t\t\"POSTGRES10_MY_EXPIRED_IDENTITIES_PORT\",\n\t}\n\n\tvMap, _ := CheckVars(v)\n\thostMap := GetHosts(vMap)\n\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"ID\"] != \"MY_EXPIRED_IDENTITIES\" {\n\t\tt.Fail()\n\t}\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"CLIENT\"] != \"POSTGRES10\" {\n\t\tt.Fail()\n\t}\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"PORT\"] != \"5432\" {\n\t\tt.Fail()\n\t}\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"USERNAME\"] != \"jdoe\" {\n\t\tt.Fail()\n\t}\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"PASSWORD\"] != \"bad_password\" {\n\t\tt.Fail()\n\t}\n\tif hostMap[\"MY_EXPIRED_IDENTITIES\"][\"ADDRESS\"] != \"db.domain.invalid_tld\" {\n\t\tt.Fail()\n\t}\n\n}", "title": "" }, { "docid": "29690bab6b7f764a5247343b531451c1", "score": "0.52464366", "text": "func (s *commonDevopsSimulator) adjustNumHostsForEpoch() {\n\ts.epoch++\n\tmissingScale := float64(uint64(len(s.hosts)) - s.initHosts)\n\ts.epochHosts = s.initHosts + uint64(missingScale*float64(s.epoch)/float64(s.epochs-1))\n}", "title": "" }, { "docid": "d67e894c1e8838339ea7105849adfdb1", "score": "0.5149961", "text": "func (r *Renter) ActiveHosts() []modules.HostDBEntry { return r.hostDB.ActiveHosts() }", "title": "" }, { "docid": "4e3537981b9fb123c1471c22c76edad9", "score": "0.4968027", "text": "func (exec *Executor) HostCount() int {\n\tif exec.Parameter.HostInfoList != nil {\n\t\treturn len(exec.Parameter.HostInfoList)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "ec136bb82a8ae6cbab8b91fb810d58bf", "score": "0.4956916", "text": "func CheckHashes(hashes, dbs []byte, dbLen, myNum int) bool {\n \n resChan := make(chan bool)\n res := true\n \n for i:=0; i < len(hashes)/32; i++ {\n if i == myNum {\n continue\n }\n go func(index int) {\n hash := Hash(dbs[dbLen*index:dbLen*(index+1)])\n if bytes.Equal(hashes[32*index:32*(index+1)], hash[:]) {\n resChan <- true\n } else {\n resChan <- false\n }\n }(i)\n }\n \n for i:=1; i < len(hashes)/32; i++ {\n res = res && <- resChan\n }\n return res\n}", "title": "" }, { "docid": "201e98086f50088dbbd0e7710599d50f", "score": "0.4918599", "text": "func CheckProxyDB() {\n\tconn := NewStorage()\n\tx := conn.Count()\n\tlog.Println(\"Before check, DB has:\", x, \"records.\")\n\tips, err := conn.GetAll()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn\n\t}\n\tvar wg sync.WaitGroup\n\tfor _, v := range ips {\n\t\twg.Add(1)\n\t\tgo func(v *models.IP) {\n\t\t\tif !CheckIP(v) {\n\t\t\t\tProxyDel(v)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(v)\n\t}\n\twg.Wait()\n\tx = conn.Count()\n\tlog.Println(\"After check, DB has:\", x, \"records.\")\n}", "title": "" }, { "docid": "e6a3d6dbd76490764798b57527094e2c", "score": "0.49057218", "text": "func (h *hostSorter) Len() int {\n\treturn len(h.Hosts.Hosts)\n}", "title": "" }, { "docid": "ab2bc953b3214499d885e2995e069907", "score": "0.48603845", "text": "func checkServerTunnels(t *testing.T) {\n\n\tres := models.InitTestResult(runID)\n\tdefer res.CheckTestAndSave(t, time.Now())\n\n\tlog.AuctaLogger.Info(\"TUNNEL: checking the tunnel addresses for the servers\")\n\n\tif invaders, err := Pcc.GetInvadersFromDB(); err == nil {\n\t\tif nodes, err := Pcc.GetServers(); err == nil {\n\t\tloopServer:\n\t\t\tfor i := range *nodes {\n\t\t\t\tnode := (*nodes)[i]\n\t\t\t\tnodeId := node.Id\n\t\t\t\taddress := checkEnvironmentForNode(t, &node) // Check for the environment address\n\n\t\t\t\tif node, err := Pcc.GetNodeFromDB(nodeId); err == nil { // Check the DB. The address should be blank\n\t\t\t\t\taddress := node.TunnelServerAddress\n\t\t\t\t\tif len(strings.TrimSpace(address)) != 0 {\n\t\t\t\t\t\tmsg := fmt.Sprintf(\"The tunnel address for the server %d:%s should be blank instead of %s\", nodeId, node.Name, node.TunnelServerAddress)\n\t\t\t\t\t\tres.SetTestFailure(msg)\n\t\t\t\t\t\tlog.AuctaLogger.Error(msg)\n\t\t\t\t\t\tt.FailNow()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmsg := fmt.Sprintf(\"%v\", err)\n\t\t\t\t\tres.SetTestFailure(msg)\n\t\t\t\t\tlog.AuctaLogger.Error(msg)\n\t\t\t\t\tt.FailNow()\n\t\t\t\t}\n\n\t\t\t\tfor j := range *invaders { // Check if the address is associated to one Invader\n\t\t\t\t\tinvader := (*invaders)[j]\n\t\t\t\t\tif strings.Compare(address, invader.Host) == 0 {\n\t\t\t\t\t\tlog.AuctaLogger.Info(fmt.Sprintf(\"The node %d:%s is reaching the pcc through the invader %d:%s:%s\", nodeId, node.Name, invader.Id, invader.Name, invader.Host))\n\t\t\t\t\t\tcontinue loopServer\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmsg := fmt.Sprintf(\"Unable to find the invader associated to the server %d:%s\", nodeId, node.Name)\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} else {\n\t\t\tmsg := fmt.Sprintf(\"%v\", err)\n\t\t\tres.SetTestFailure(msg)\n\t\t\tlog.AuctaLogger.Error(msg)\n\t\t\tt.FailNow()\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": "ff0a2d776eb470c5d4b708ac63ad433e", "score": "0.480829", "text": "func checkInvaderTunnels(t *testing.T) {\n\n\tres := models.InitTestResult(runID)\n\tdefer res.CheckTestAndSave(t, time.Now())\n\n\tlog.AuctaLogger.Info(\"TUNNEL: checking the tunnel addresses for the invaders\")\n\n\tif nodes, err := Pcc.GetInvaders(); err == nil {\n\n\t\tfor i := range *nodes {\n\t\t\tnode := (*nodes)[i]\n\t\t\tnodeId := node.Id\n\n\t\t\tcheckEnvironmentForNode(t, &node) // Check for the environment address\n\n\t\t\tif node, err := Pcc.GetNodeFromDB(nodeId); err == nil { // Check the DB\n\t\t\t\taddress := node.TunnelServerAddress\n\t\t\t\tif len(strings.TrimSpace(address)) == 0 {\n\t\t\t\t\tmsg := fmt.Sprintf(\"The tunnel address for the invader %d:%s is blank\", nodeId, node.Name)\n\t\t\t\t\tres.SetTestFailure(msg)\n\t\t\t\t\tlog.AuctaLogger.Error(msg)\n\t\t\t\t\tt.FailNow()\n\t\t\t\t} else {\n\t\t\t\t\tlog.AuctaLogger.Info(fmt.Sprintf(\"The invader %d:%s is reaching the PCC through the tunnel %s\", nodeId, node.Name, address))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmsg := fmt.Sprintf(\"%v\", err)\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": "2afb22059820216f4958228b9db67f1a", "score": "0.47997186", "text": "func (hosts *Hosts) CountConnectedHosts() int {\n\n\t// init the counter\n\tcounter := 0\n\n\t// loop over host and increment a counter when connected\n\tfor _, host := range hosts.Hosts {\n\n\t\t// check the field for connected\n\t\tif host.Connected {\n\t\t\tcounter++\n\t\t}\n\t}\n\n\t// return the number of connected machines\n\treturn counter\n}", "title": "" }, { "docid": "387bc8054d559ec1f1083152fcbc8e6b", "score": "0.47892857", "text": "func (hdb *HostDB) loadHostTrees(allHosts []modules.HostDBEntry) (err error) {\n\thdbp := hdb.hostdbProfiles.HostDBProfiles()\n\tfor name := range hdbp {\n\t\tnewTree := hosttree.NewHostTree(hdb.calculateHostWeight, name)\n\t\tfor _, host := range allHosts {\n\t\t\t// COMPATv1.1.0\n\t\t\t//\n\t\t\t// The host did not always track its block height correctly, meaning\n\t\t\t// that previously the FirstSeen values and the blockHeight values\n\t\t\t// could get out of sync.\n\t\t\tif hdb.blockHeight < host.FirstSeen {\n\t\t\t\thost.FirstSeen = hdb.blockHeight\n\t\t\t}\n\n\t\t\terr := newTree.Insert(host)\n\t\t\tif err != nil {\n\t\t\t\thdb.log.Debugln(\"ERROR: could not insert host while loading:\", host.NetAddress)\n\t\t\t}\n\t\t}\n\t\terr := hdb.hostTrees.AddHostTree(name, *newTree)\n\n\t\t// Make sure that all hosts have gone through the initial scanning.\n\t\t// A new iteration over the tree is necessary as queueScan() which is\n\t\t// called below needs a loaded and written back to the variable host tree.\n\t\tfor _, host := range hdb.hostTrees.All(name) {\n\t\t\tif len(host.ScanHistory) < 2 {\n\t\t\t\thdb.mu.Lock()\n\t\t\t\thdb.queueScan(host)\n\t\t\t\thdb.mu.Unlock()\n\t\t\t}\n\t\t}\n\n\t\thdb.mu.Lock()\n\t\terr = hdb.saveSync()\n\t\thdb.mu.Unlock()\n\t\tif err != nil {\n\t\t\thdb.log.Println(\"Unable to save the host tree:\", err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "589d4a5042a26cdd6a025ce05b68f20d", "score": "0.47825968", "text": "func CheckArchiveConflicts() int {\n\tif Tiukudb == nil {\n\t\tConnectToDB()\n\t}\n\tvar numberOfFixes int\n\n\treturn numberOfFixes\n}", "title": "" }, { "docid": "b0c93c6bbc014e985e928b113bb4b3cb", "score": "0.47607872", "text": "func (hm *HostMonitor) CleanupHosts(ctx context.Context, distros []distro.Distro, settings *evergreen.Settings) []error {\n\n\t// used to store any errors that occur\n\tvar errs []error\n\n\tfor _, flagger := range hm.flaggingFuncs {\n\t\tif ctx.Err() != nil {\n\t\t\treturn append(errs, errors.New(\"host monitor canceled\"))\n\t\t}\n\n\t\tgrip.Info(message.Fields{\n\t\t\t\"runner\": RunnerName,\n\t\t\t\"message\": \"Running flagging function for hosts\",\n\t\t\t\"reason\": flagger.Reason,\n\t\t})\n\t\t// find the next batch of hosts to terminate\n\t\thostsToTerminate, err := flagger.hostFlaggingFunc(distros, settings)\n\t\thostIdsToTerminate := []string{}\n\t\tfor _, h := range hostsToTerminate {\n\t\t\thostIdsToTerminate = append(hostIdsToTerminate, h.Id)\n\t\t}\n\t\tgrip.Info(message.Fields{\n\t\t\t\"runner\": RunnerName,\n\t\t\t\"message\": \"found hosts for termination\",\n\t\t\t\"reason\": flagger.Reason,\n\t\t\t\"count\": len(hostIdsToTerminate),\n\t\t\t\"hosts\": hostIdsToTerminate,\n\t\t})\n\t\t// continuing on error so that one wonky flagging function doesn't\n\t\t// stop others from running\n\t\tif err != nil {\n\t\t\terrs = append(errs, errors.Wrap(err, \"error flagging hosts to be terminated\"))\n\t\t\tcontinue\n\t\t}\n\n\t\t// terminate all of the dead hosts. continue on error to allow further\n\t\t// termination to work\n\t\tif err = terminateHosts(ctx, hostsToTerminate, settings, flagger.Reason); err != nil {\n\t\t\terrs = append(errs, errors.Wrap(err, \"error terminating host\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tgrip.Info(message.Fields{\n\t\t\t\"runner\": RunnerName,\n\t\t\t\"message\": \"terminated flagged hosts\",\n\t\t\t\"reason\": flagger.Reason,\n\t\t\t\"count\": len(hostIdsToTerminate),\n\t\t\t\"hosts\": hostIdsToTerminate,\n\t\t})\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "a25ff59ddf19b8505eac025edaa1e36d", "score": "0.47605383", "text": "func (init *HostInit) setupReadyHosts(ctx context.Context) error {\n\t// find all hosts in the uninitialized state\n\tuninitializedHosts, err := host.Find(host.NeedsProvisioning())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error fetching starting hosts\")\n\t}\n\n\tgrip.Info(message.Fields{\n\t\t\"message\": \"uninitialized hosts\",\n\t\t\"number\": len(uninitializedHosts),\n\t\t\"GUID\": init.GUID,\n\t\t\"runner\": RunnerName,\n\t})\n\n\t// used for making sure we don't exit before a setup script is done\n\twg := &sync.WaitGroup{}\n\tcatcher := grip.NewSimpleCatcher()\n\thosts := make(chan host.Host, len(uninitializedHosts))\n\tfor _, idx := range rand.Perm(len(uninitializedHosts)) {\n\t\thosts <- uninitializedHosts[idx]\n\t}\n\tclose(hosts)\n\n\tnumThreads := 24\n\tif len(uninitializedHosts) < numThreads {\n\t\tnumThreads = len(uninitializedHosts)\n\t}\n\n\thostsProvisioned := &util.SafeCounter{}\n\tstartAt := time.Now()\n\tfor i := 0; i < numThreads; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer recovery.LogStackTraceAndContinue(\"setupReadyHosts\")\n\t\t\tdefer wg.Done()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tcatcher.Add(errors.New(\"hostinit run canceled\"))\n\t\t\t\t\treturn\n\t\t\t\tcase h, ok := <-hosts:\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tgrip.Info(message.Fields{\n\t\t\t\t\t\t\"GUID\": init.GUID,\n\t\t\t\t\t\t\"message\": \"attempting to setup host\",\n\t\t\t\t\t\t\"distro\": h.Distro.Id,\n\t\t\t\t\t\t\"hostid\": h.Id,\n\t\t\t\t\t\t\"DNS\": h.Host,\n\t\t\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\t})\n\n\t\t\t\t\t// check whether or not the host is ready for its setup script to be run\n\t\t\t\t\t// if the host isn't ready (for instance, it might not be up yet), skip it\n\t\t\t\t\tif ready, err := init.IsHostReady(ctx, &h); !ready {\n\t\t\t\t\t\tm := message.Fields{\n\t\t\t\t\t\t\t\"GUID\": init.GUID,\n\t\t\t\t\t\t\t\"message\": \"host not ready for setup\",\n\t\t\t\t\t\t\t\"hostid\": h.Id,\n\t\t\t\t\t\t\t\"DNS\": h.Host,\n\t\t\t\t\t\t\t\"distro\": h.Distro.Id,\n\t\t\t\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tgrip.Error(message.WrapError(err, m))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tgrip.Info(m)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif ctx.Err() != nil {\n\t\t\t\t\t\tcatcher.Add(errors.New(\"hostinit run canceled\"))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tsetupStartTime := time.Now()\n\t\t\t\t\tgrip.Info(message.Fields{\n\t\t\t\t\t\t\"GUID\": init.GUID,\n\t\t\t\t\t\t\"message\": \"provisioning host\",\n\t\t\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\t\t\"distro\": h.Distro.Id,\n\t\t\t\t\t\t\"hostid\": h.Id,\n\t\t\t\t\t\t\"DNS\": h.Host,\n\t\t\t\t\t})\n\n\t\t\t\t\tif err := init.ProvisionHost(ctx, &h); err != nil {\n\t\t\t\t\t\tevent.LogHostProvisionError(h.Id)\n\n\t\t\t\t\t\tgrip.Error(message.WrapError(err, message.Fields{\n\t\t\t\t\t\t\t\"GUID\": init.GUID,\n\t\t\t\t\t\t\t\"message\": \"provisioning host encountered error\",\n\t\t\t\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\t\t\t\"distro\": h.Distro.Id,\n\t\t\t\t\t\t\t\"hostid\": h.Id,\n\t\t\t\t\t\t}))\n\n\t\t\t\t\t\t// notify the admins of the failure\n\t\t\t\t\t\tsubject := fmt.Sprintf(\"%v Evergreen provisioning failure on %v\",\n\t\t\t\t\t\t\tnotify.ProvisionFailurePreface, h.Distro.Id)\n\t\t\t\t\t\thostLink := fmt.Sprintf(\"%v/host/%v\", init.Settings.Ui.Url, h.Id)\n\t\t\t\t\t\tmessage := fmt.Sprintf(\"Provisioning failed on %v host -- %v: see %v\",\n\t\t\t\t\t\t\th.Distro.Id, h.Id, hostLink)\n\t\t\t\t\t\tif err := notify.NotifyAdmins(subject, message, init.Settings); err != nil {\n\t\t\t\t\t\t\terr = errors.Wrap(err, \"problem sending host init error email\")\n\t\t\t\t\t\t\tcatcher.Add(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// ProvisionHost allows hosts to fail provisioning a few\n\t\t\t\t\t// times during host start up, to account for the fact\n\t\t\t\t\t// that hosts often need extra time to come up.\n\t\t\t\t\t//\n\t\t\t\t\t// In these cases, ProvisionHost returns a nil error but\n\t\t\t\t\t// does not change the host status.\n\t\t\t\t\tif h.Status == evergreen.HostStarting {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tgrip.Info(message.Fields{\n\t\t\t\t\t\t\"GUID\": init.GUID,\n\t\t\t\t\t\t\"message\": \"successfully finished provisioning host\",\n\t\t\t\t\t\t\"hostid\": h.Id,\n\t\t\t\t\t\t\"DNS\": h.Host,\n\t\t\t\t\t\t\"distro\": h.Distro.Id,\n\t\t\t\t\t\t\"runner\": RunnerName,\n\t\t\t\t\t\t\"attempts\": h.ProvisionAttempts,\n\t\t\t\t\t\t\"runtime\": time.Since(setupStartTime),\n\t\t\t\t\t})\n\t\t\t\t\thostsProvisioned.Inc()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\t// let all setup routines finish\n\twg.Wait()\n\tgrip.Info(message.Fields{\n\t\t\"GUID\": init.GUID,\n\t\t\"duration_secs\": time.Since(startAt).Seconds(),\n\t\t\"runner\": RunnerName,\n\t\t\"num_hosts\": len(uninitializedHosts),\n\t\t\"num_errors\": catcher.Len(),\n\t\t\"provisioned_hosts\": hostsProvisioned.Value(),\n\t\t\"workers\": numThreads,\n\t})\n\n\treturn catcher.Resolve()\n}", "title": "" }, { "docid": "485f0456c112a45f66aabf58c3cb1fd8", "score": "0.4759614", "text": "func (hdb *HostDB) AllHosts(tree string) (allHosts []modules.HostDBEntry) {\n\treturn hdb.hostTrees.All(tree)\n}", "title": "" }, { "docid": "16c6e5a7bda5ca6517423831b1573084", "score": "0.47551146", "text": "func loadChecks(cf config) []check {\n\n\tdb, err := sql.Open(\"sqlite3\", cf.expath+\"/ipvshc.db\") // connect to DB\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.Close()\n\t//rows, err := db.Query(\"SELECT healthcheck.*, state.status, MAX(state.changed) FROM healthcheck LEFT JOIN state ON healthcheck.raddr=state.raddr GROUP BY healthcheck.id;\") // select HC\n\trows, err := db.Query(\"SELECT healthcheck.id, healthcheck.vs, healthcheck.vaddr, healthcheck.raddr, healthcheck.caddr, healthcheck.path, healthcheck.mode, healthcheck.weight, healthcheck.tgid, state.status, MAX(state.changed) FROM healthcheck LEFT JOIN state ON healthcheck.raddr=state.raddr WHERE healthcheck.state='enable' GROUP BY healthcheck.id ;\") // select HC\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer rows.Close()\n\tchecks := []check{}\n\n\tfor rows.Next() {\n\t\thc := check{}\n\t\terr := rows.Scan(&hc.id, &hc.vs, &hc.vaddr, &hc.raddr, &hc.caddr, &hc.path, &hc.mode, &hc.weight, &hc.tgid, &hc.status, &hc.changed) //get\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tchecks = append(checks, hc)\n\t}\n\treturn checks\n}", "title": "" }, { "docid": "479bc2eb0eaf9da73833c76b8432e6f9", "score": "0.4739831", "text": "func uniqueHosts(client db.Client) ([]string, error) {\n\tvar (\n\t\thostsMap = map[string]struct{}{}\n\t\tn = 0\n\t)\n\tif err := client.EachRow(db.TablePackages, func(k []byte, _ []byte) {\n\t\tif n > 0 && n%10000 == 0 {\n\t\t\tlog.WithField(\"n\", n).Debug(\"Processed chunk\")\n\t\t}\n\t\tn++\n\t\tif !bytes.Contains(k, []byte{'.'}) {\n\t\t\treturn\n\t\t}\n\t\th := string(bytes.Split(k, []byte{'/'})[0])\n\t\tif _, ok := hostsMap[h]; !ok {\n\t\t\thostsMap[h] = struct{}{}\n\t\t}\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\thosts := make([]string, 0, len(hostsMap))\n\tfor host, _ := range hostsMap {\n\t\thosts = append(hosts, host)\n\t}\n\tsort.Strings(hosts)\n\treturn hosts, nil\n}", "title": "" }, { "docid": "855a5c3856ae492f45441119c3d4f3d3", "score": "0.4736172", "text": "func (m *IpSecurityProfile) SetCountHosts(value *int32)() {\n err := m.GetBackingStore().Set(\"countHosts\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "98680efd11a9fce163f8efeac081e37c", "score": "0.47283334", "text": "func scanHosts(ctx context.Context, rows *sql.Rows) (*crimson.HostList, error) {\n\thostList := crimson.HostList{}\n\n\tfor rows.Next() {\n\t\tvar ipString, macString string\n\t\tvar hw net.HardwareAddr\n\t\tvar ip net.IP\n\t\tvar bootClass sql.NullString\n\n\t\thost := crimson.Host{}\n\t\terr := rows.Scan(&host.Site, &host.Hostname, &macString, &ipString,\n\t\t\t&bootClass)\n\t\tif bootClass.Valid {\n\t\t\thost.BootClass = bootClass.String\n\t\t}\n\t\tif err != nil { // Users can't trigger that.\n\t\t\tlogging.Errorf(ctx, \"scanHost: didn't match columns: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif macString != \"\" {\n\t\t\thw, err = netutil.HexStringToHardwareAddr(macString)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\thost.MacAddr = hw.String()\n\t\t}\n\n\t\tif ipString != \"\" {\n\t\t\tip, err = netutil.HexStringToIP(ipString)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\thost.Ip = ip.String()\n\t\t}\n\t\thostList.Hosts = append(hostList.Hosts, &host)\n\t}\n\terr := rows.Err()\n\tif err != nil {\n\t\tlogging.Errorf(ctx, \"scanHosts: error iterating over rows: %s\", err)\n\t\treturn nil, err\n\t}\n\treturn &hostList, nil\n}", "title": "" }, { "docid": "8337fd6e846ff2de9a43c17103729d4e", "score": "0.46585903", "text": "func (r *Renter) managedRefreshHostsAndWorkers() map[string]struct{} {\n\t// Grab the current set of contracts and use them to build a list of hosts\n\t// that are currently active. The hosts are assembled into a map where the\n\t// key is the String() representation of the host's SiaPublicKey.\n\t//\n\t// TODO / NOTE: This code can be removed once files store the HostPubKey\n\t// of the hosts they are using, instead of just the FileContractID.\n\tcurrentContracts := r.hostContractor.Contracts()\n\thosts := make(map[string]struct{})\n\tfor _, contract := range currentContracts {\n\t\thosts[contract.HostPublicKey.String()] = struct{}{}\n\t}\n\t// Refresh the worker pool as well.\n\tr.managedUpdateWorkerPool()\n\treturn hosts\n}", "title": "" }, { "docid": "f931ff68e3501665920536b56ecff6c1", "score": "0.4656865", "text": "func compareHost(x, y string) int {\n\ttrace_util_0.Count(_cache_00000, 60)\n\t// The more-specific, the smaller it is.\n\t// The pattern '%' means “any host” and is least specific.\n\tif y == `%` {\n\t\ttrace_util_0.Count(_cache_00000, 65)\n\t\tif x == `%` {\n\t\t\ttrace_util_0.Count(_cache_00000, 67)\n\t\t\treturn 0\n\t\t}\n\t\ttrace_util_0.Count(_cache_00000, 66)\n\t\treturn -1\n\t}\n\n\t// The empty string '' also means “any host” but sorts after '%'.\n\ttrace_util_0.Count(_cache_00000, 61)\n\tif y == \"\" {\n\t\ttrace_util_0.Count(_cache_00000, 68)\n\t\tif x == \"\" {\n\t\t\ttrace_util_0.Count(_cache_00000, 70)\n\t\t\treturn 0\n\t\t}\n\t\ttrace_util_0.Count(_cache_00000, 69)\n\t\treturn -1\n\t}\n\n\t// One of them end with `%`.\n\ttrace_util_0.Count(_cache_00000, 62)\n\txEnd := strings.HasSuffix(x, `%`)\n\tyEnd := strings.HasSuffix(y, `%`)\n\tif xEnd || yEnd {\n\t\ttrace_util_0.Count(_cache_00000, 71)\n\t\tswitch {\n\t\tcase !xEnd && yEnd:\n\t\t\ttrace_util_0.Count(_cache_00000, 73)\n\t\t\treturn -1\n\t\tcase xEnd && !yEnd:\n\t\t\ttrace_util_0.Count(_cache_00000, 74)\n\t\t\treturn 1\n\t\tcase xEnd && yEnd:\n\t\t\ttrace_util_0.Count(_cache_00000, 75)\n\t\t\t// 192.168.199.% smaller than 192.168.%\n\t\t\t// A not very accurate comparison, compare them by length.\n\t\t\tif len(x) > len(y) {\n\t\t\t\ttrace_util_0.Count(_cache_00000, 76)\n\t\t\t\treturn -1\n\t\t\t}\n\t\t}\n\t\ttrace_util_0.Count(_cache_00000, 72)\n\t\treturn 0\n\t}\n\n\t// For other case, the order is nondeterministic.\n\ttrace_util_0.Count(_cache_00000, 63)\n\tswitch x < y {\n\tcase true:\n\t\ttrace_util_0.Count(_cache_00000, 77)\n\t\treturn -1\n\tcase false:\n\t\ttrace_util_0.Count(_cache_00000, 78)\n\t\treturn 1\n\t}\n\ttrace_util_0.Count(_cache_00000, 64)\n\treturn 0\n}", "title": "" }, { "docid": "81c821a94d214b9bd210747d30596077", "score": "0.46519512", "text": "func (c *Client) HealthCheckVirtualHosts() (rec HealthCheckStatus, err error) {\n\terr = c.executeCheck(\"health/checks/virtual-hosts\", &rec)\n\treturn rec, err\n}", "title": "" }, { "docid": "a956db995751f121b8ee958efe55de4d", "score": "0.4641418", "text": "func reconcileHosts(existingHosts []baremetalHost, newHosts ...baremetalHost) []baremetalHost {\n\tif len(existingHosts) == 0 {\n\t\treturn newHosts\n\t}\n\n\t// Create a map of host document names for efficient filtering\n\thostMap := make(map[string]bool)\n\tfor _, host := range existingHosts {\n\t\thostMap[host.HostName] = true\n\t}\n\n\tvar reconciledHosts []baremetalHost\n\tfor _, host := range newHosts {\n\t\tif _, exists := hostMap[host.HostName]; exists {\n\t\t\treconciledHosts = append(reconciledHosts, host)\n\t\t}\n\t}\n\n\treturn reconciledHosts\n}", "title": "" }, { "docid": "0a0d6131f20bbac244ac17090340edd9", "score": "0.46393755", "text": "func (h *hnsw) ValidateLinkIntegrity() {\n\th.RLock()\n\tdefer h.RUnlock()\n\n\tfor i, node := range h.nodes {\n\t\tif node == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor level, conns := range node.connections {\n\t\t\tm := h.maximumConnections\n\t\t\tif level == 0 {\n\t\t\t\tm = h.maximumConnectionsLayerZero\n\t\t\t}\n\n\t\t\tif len(conns) > m {\n\t\t\t\th.logger.Warnf(\"node %d at level %d has %d connections\", i, level, len(conns))\n\t\t\t}\n\n\t\t}\n\t}\n\n\th.logger.Infof(\"completed link integrity check\")\n}", "title": "" }, { "docid": "f1f4d5e86b40bab96549ca636254307f", "score": "0.4621842", "text": "func (o *HyperflexHxapDvswitchAllOf) HasMemberHosts() bool {\n\tif o != nil && o.MemberHosts != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "de9a94cc0380b547063048e7755759d9", "score": "0.4614631", "text": "func checkTunnelConnection(t *testing.T) {\n\n\tres := models.InitTestResult(runID)\n\tdefer res.CheckTestAndSave(t, time.Now())\n\n\tlog.AuctaLogger.Info(\"TUNNEL: checking invaders connection\")\n\n\tif nodes, err := Pcc.GetInvadersFromDB(); err == nil {\n\t\tfor i := range *nodes {\n\t\t\tnode := (*nodes)[i]\n\n\t\t\tif err = tunnelPing(&node, true); err != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"%v\", err)\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": "0d47ebb2df6a429092f359660276ab3d", "score": "0.46107185", "text": "func quickFixDuplicateHosts(nn *MinerNode, allNodes []*MinerNode) error {\n\tlocalhost := regexp.MustCompile(`^(?:(?:https|http)\\:\\/\\/)?(?:localhost|127\\.0\\.0\\.1)(?:\\:\\d+)?(?:\\/.*)?$`)\n\thost := strings.TrimSpace(nn.Host)\n\tn2nhost := strings.TrimSpace(nn.N2NHost)\n\tport := nn.Port\n\tif n2nhost == \"\" || localhost.MatchString(n2nhost) {\n\t\treturn fmt.Errorf(\"invalid n2nhost: '%v'\", n2nhost)\n\t}\n\tif host == \"\" || localhost.MatchString(host) {\n\t\thost = n2nhost\n\t}\n\tfor _, n := range allNodes {\n\t\tif n.ID != nn.ID && n2nhost == n.N2NHost && n.Port == port {\n\t\t\treturn fmt.Errorf(\"n2nhost:port already exists: '%v:%v'\", n2nhost, port)\n\t\t}\n\t\tif n.ID != nn.ID && host == n.Host && n.Port == port {\n\t\t\treturn fmt.Errorf(\"host:port already exists: '%v:%v'\", host, port)\n\t\t}\n\t}\n\tnn.Host, nn.N2NHost, nn.Port = host, n2nhost, port\n\treturn nil\n}", "title": "" }, { "docid": "06d41485cab3ce6cdb0149da38e406ec", "score": "0.45991197", "text": "func (c *TestRaftCluster) CheckShardCount(t *testing.T, count int) {\n\tfor idx := range c.stores {\n\t\tassert.Equal(t, count, c.GetPRCount(idx))\n\t}\n}", "title": "" }, { "docid": "bd3a4faa17eb260b0a8ef9c5fd317304", "score": "0.45829716", "text": "func (s *Server) loadHostEntries() error {\n\ts.m.RLock()\n\tpath := s.hostsFile.path\n\ts.m.RUnlock()\n\n\tif path == \"\" {\n\t\treturn nil\n\t}\n\n\thosts := hosts{}\n\thostsRX := hostsRX{}\n\n\tif err := readHosts(path, func(host string) {\n\t\tif host[len(host)-1] != '.' {\n\t\t\thost += \".\"\n\t\t}\n\n\t\tif !strings.ContainsRune(host, '*') {\n\t\t\t// Plain host string:\n\t\t\thosts[hash(host)] = struct{}{}\n\t\t} else if rx := compilePattern(host); rx != nil {\n\t\t\t// Host pattern (regex):\n\t\t\thostsRX[hash(rx.String())] = rx\n\t\t}\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\ts.m.Lock()\n\ts.hosts = hosts\n\ts.hostsRX = hostsRX\n\ts.m.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "3775c83ddf18a276bf54a964b3798ee0", "score": "0.45827544", "text": "func (s *Server) CheckHealth(traceOn bool, logger Logger) {\n\tvar secondsBehindMaster, openConnections, runningConnections *int\n\n\t// prevent concurrently checks on same server (slow queries/network)\n\tif atomic.LoadInt32(&s.isChecking) == 1 {\n\t\treturn\n\t}\n\n\tatomic.StoreInt32(&s.isChecking, 1)\n\tdefer func() {\n\t\tatomic.StoreInt32(&s.isChecking, 0)\n\t}()\n\n\tif err := s.connectReadUser(traceOn, logger); err != nil {\n\t\ts.health.setDown(\n\t\t\terr, false, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\tif err := s.connectReplicationUser(traceOn, logger); err != nil {\n\t\ts.health.setUP(\n\t\t\terr, false, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\tioRunning := false\n\tioRunningResult, err := s.rawQuery(\"SHOW STATUS LIKE 'Slave_running'\", logger)\n\tif err == nil && strings.EqualFold(ioRunningResult[\"Value\"], \"ON\") {\n\t\tioRunning = true\n\t}\n\n\tthreadsConnectedResult, err := s.rawQuery(\"SHOW STATUS LIKE 'Threads_connected'\", logger)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"failed acquiring MySQL thread connected status: %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\tthreadsConnected := threadsConnectedResult[\"Value\"]\n\ttmp2, err := strconv.Atoi(threadsConnected)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"unexpected value for Threads_connected returned from MySQL: %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\topenConnections = &tmp2\n\n\tthreadsRunningResult, err := s.rawQuery(\"SHOW STATUS LIKE 'Threads_running'\", logger)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"failed acquiring MySQL thread running status: %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\tthreadsRunning := threadsRunningResult[\"Value\"]\n\ttmp3, err := strconv.Atoi(threadsRunning)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"unexpected value for Threads_running returned from MySQL: %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\trunningConnections = &tmp3\n\n\tslaveStatusResult, err := s.rawQuery(\"SHOW SLAVE STATUS\", logger)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\terr, ioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\trawSecondsBehindMaster := strings.TrimSpace(slaveStatusResult[\"Seconds_Behind_Master\"])\n\tif rawSecondsBehindMaster == \"\" || strings.ToLower(rawSecondsBehindMaster) == \"null\" {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"empty or null value for Seconds_Behind_Master returned from MySQL: %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\ttmp, err := strconv.Atoi(rawSecondsBehindMaster)\n\tif err != nil {\n\t\ts.health.setUP(\n\t\t\tfmt.Errorf(\"unexpected value for Seconds_Behind_Master returned from MySQL (conversion error): %s\", err),\n\t\t\tioRunning, secondsBehindMaster, openConnections, runningConnections,\n\t\t)\n\t\treturn\n\t}\n\n\tsecondsBehindMaster = &tmp\n\n\ts.health.setUP(nil, ioRunning, secondsBehindMaster, openConnections, runningConnections)\n}", "title": "" }, { "docid": "dda52bc5c5c470ae463357f475944e5c", "score": "0.45825088", "text": "func (s *server) healthCheck(\n\tctx context.Context,\n\tconnection db.Connection,\n\tidlenessThreshold time.Duration,\n\tauth *db.ReAuthToken,\n\tboltLogger log.BoltLogger) (healthy bool, _ error) {\n\n\tconnection.SetBoltLogger(boltLogger)\n\tif time.Since(connection.IdleDate()) > idlenessThreshold {\n\t\tconnection.ForceReset(ctx)\n\t\tif !connection.IsAlive() {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\tif err := connection.ReAuth(ctx, auth); err != nil {\n\t\treturn false, err\n\t}\n\tif !connection.IsAlive() {\n\t\treturn false, nil\n\t}\n\t// Update round-robin counter every time we give away a connection and keep track\n\t// of our own round-robin index\n\tatomic.StoreUint32(&s.roundRobin, atomic.AddUint32(&sharedRoundRobin, 1))\n\treturn true, nil\n}", "title": "" }, { "docid": "9eb52d85d6dd610cad2b5e1dfa5984ed", "score": "0.45744032", "text": "func (s *Server) hostCounter(tasks []*crawlerdb.Task, crawlRequestID int, originalURL string) (map[string]int, error) {\n\thosts := make(map[string]int, 0)\n\to, err := url.Parse(originalURL)\n\tif err != nil {\n\t\ts.Logger.Printf(\"CrawlRequest %d: Error parsing original url %s: %v\", crawlRequestID, originalURL, err.Error())\n\t}\n\toriginalHost := o.Hostname()\n\tfor _, t := range tasks {\n\t\tif t.Status == \"IN_PROGRESS\" || t.Status == \"NOT_STARTED\" {\n\t\t\treturn hosts, errors.New(`{\"error\": \"crawl request not yet completed\"}`)\n\t\t}\n\t\tu, err := url.Parse(t.PageURL)\n\t\tif err != nil {\n\t\t\ts.Logger.Printf(\"CrawlRequest %d: Error parsing url %s for task %d: %v\", t.CrawlRequestID, t.PageURL, t.ID, err.Error())\n\t\t}\n\t\t// don't add to results count if the host is the same as the original given host\n\t\tif host := u.Hostname(); host != originalHost {\n\t\t\tif _, ok := hosts[host]; ok {\n\t\t\t\thosts[host]++\n\t\t\t} else {\n\t\t\t\thosts[host] = 1\n\t\t\t}\n\t\t}\n\t}\n\treturn hosts, nil\n}", "title": "" }, { "docid": "1b266e7b78626963b995651543725558", "score": "0.45735976", "text": "func (c Config) hasHosts() bool {\n\treturn len(c.Hosts) > 0 || len(c.AuthoritativeSuffixes) > 0\n}", "title": "" }, { "docid": "102a532b13314fca6f20c091eba6877e", "score": "0.45683625", "text": "func (dB DB) NumRowsDB(name string) (nRows int, err error) {\n\t// Recover from db.Exec() panic\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\t// e := \"dbAddr: can't load addr array from database\"\n\t\t\t// err = errors.New(e)\n\t\t}\n\t}()\n\n\t// Allocate addrArr in single step\n\trow := dB.db.QueryRow(`SELECT COUNT(*) FROM ` + name + `;`)\n\terr = row.Scan(&nRows)\n\treturn\n}", "title": "" }, { "docid": "d8959d96550c117d38aa55c0b11ea642", "score": "0.45669597", "text": "func healthcheck(hc check, cf config, wg *sync.WaitGroup) { // add parametr hc, cf, wg\n\tdefer wg.Done()\n\n\tthold := cf.thold // update thold\n\n\tfor ; thold > 0; thold-- { //loop thold\n\n\t\t// Send http Check IPVS instance\n\t\tok := true\n\t\t// /usr/bin/curl hc.caddr/hc.path --interface cf.host --connect-timeout 5 -k -s -f -o /dev/null && echo 'SUCCESS' || echo 'ERROR'\n\t\tresp := exec.Command(\"/usr/bin/curl\", hc.caddr+\"/\"+hc.path, \"--interface\", cf.host, \"--connect-timeout\", \"5\", \"-k\", \"-s\", \"-f\")\n\t\t_, err := resp.Output()\n\t\tif err != nil {\n\t\t\t//fmt.Println(err.Error())\n\t\t\tok = false\n\t\t}\n\t\t//fmt.Println(ok)\n\n\t\t// Send http Check IPVS instance ( defferent version)\n\t\t// resp, err := http.Get(\"http://\" + hc.caddr + \"/\" + hc.path)\n\t\t// if err != nil {\n\t\t// \t//fmt.Println(\"error\", err, resp)\n\t\t// \tok = false\n\t\t// }\n\t\t// if ok { // condition result\n\t\t// \tdefer resp.Body.Close()\n\t\t// \t//fmt.Println(resp.StatusCode)\n\t\t// \tif resp.StatusCode != 200 {\n\t\t// \t\tok = false\n\t\t// \t}\n\t\t// }\n\n\t\t// conditions:\n\t\tif ok && hc.status == \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: PASS STILL\", hc.raddr)\n\t\t\tbreak\n\t\t} else if ok && hc.status != \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: PASS and ADD\", hc.raddr)\n\n\t\t\t// set IPVS instance\n\t\t\tcmd := exec.Command(\"/usr/sbin/ipvsadm\", \"-e\", \"-\"+hc.vs, hc.vaddr, \"-r\", hc.raddr, \"-\"+hc.mode, \"-w\", hc.weight)\n\t\t\tstdout, err := cmd.Output()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(string(stdout)) // Print the output\n\n\t\t\t// write to DB status\n\t\t\tdb, err := sql.Open(\"sqlite3\", cf.expath+\"/ipvshc.db\") // connect to DB\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tdefer db.Close()\n\t\t\t//result, err := db.Exec(\"INSERT INTO state (raddr, status) VALUES ('\" + hc.raddr + \"', 'OK'); DELETE FROM state WHERE id IN (SELECT id FROM state WHERE raddr='\" + hc.raddr + \"' ORDER BY id DESC LIMIT 10 OFFSET 10);\") // insert OK status and remove oldest status then 10 last\n\t\t\t_, err = db.Exec(\"INSERT INTO state (raddr, status) VALUES ('\" + hc.raddr + \"', 'OK'); DELETE FROM state WHERE id IN (SELECT id FROM state WHERE raddr='\" + hc.raddr + \"' ORDER BY id DESC LIMIT 10 OFFSET 10);\") // insert OK status and remove oldest status then 10 last\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\t//fmt.Println(result.LastInsertId()) // id last add object\n\t\t\t//fmt.Println(result.RowsAffected()) // count add string\n\n\t\t\t// send alert\n\t\t\tcmdcurl := exec.Command(\"/usr/bin/curl\", \"-s\", \"-X\", \"POST\", \"https://api.telegram.org/bot\"+cf.tgtoken+\"/sendMessage\", \"-d\", \"chat_id=\"+hc.tgid, \"-d\", \"text= ✅ \"+cf.hostname+\": src ip \"+cf.host+\":\"+\" LB \"+hc.raddr+\" changed state to UP\")\n\t\t\t_, err = cmdcurl.Output()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// send alert ( defferent version)\n\t\t\t// _, alertErr := http.PostForm(\n\t\t\t// \t\"https://api.telegram.org/bot\"+cf.tgtoken+\"/sendMessage\",\n\t\t\t// \turl.Values{\n\t\t\t// \t\t\"chat_id\": {hc.tgid},\n\t\t\t// \t\t\"text\": {\" ✅ \" + cf.hostname + \"|\" + cf.host + \":\" + \" LB \" + hc.raddr + \" changed state to DOWN\"},\n\t\t\t// \t},\n\t\t\t// )\n\t\t\t// if err != nil {\n\t\t\t// \tfmt.Println(alertErr.Error())\n\t\t\t// \treturn\n\t\t\t// }\n\n\t\t\tbreak\n\t\t} else if thold != 1 && hc.status == \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: FAIL\", hc.raddr)\n\t\t} else if thold != 1 && hc.status != \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: FAIL STILL\", hc.raddr)\n\t\t} else if thold == 1 && hc.status != \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: FAIL STILL... \", hc.raddr)\n\t\t} else if thold == 1 && hc.status == \"OK\" {\n\t\t\tfmt.Println(cf.host, \"IPVSHealthCheck: FAIL and DELETE\", hc.raddr)\n\n\t\t\t// set IPVS instance\n\t\t\tcmd := exec.Command(\"/usr/sbin/ipvsadm\", \"-e\", \"-\"+hc.vs, hc.vaddr, \"-r\", hc.raddr, \"-\"+hc.mode, \"-w 0\")\n\t\t\tstdout, err := cmd.Output()\n\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(string(stdout)) // Print the output\n\n\t\t\t// write to DB status\n\t\t\tdb, err := sql.Open(\"sqlite3\", cf.expath+\"/ipvshc.db\") // connect to DB\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tdefer db.Close()\n\t\t\t//result, err := db.Exec(\"INSERT INTO state (raddr, status) VALUES ('\" + hc.raddr + \"', 'ERROR'); DELETE FROM state WHERE id IN (SELECT id FROM state WHERE raddr='\" + hc.raddr + \"' ORDER BY id DESC LIMIT 10 OFFSET 10);\") // insert ERROR status and remove oldest status then 10 last\n\t\t\t_, err = db.Exec(\"INSERT INTO state (raddr, status) VALUES ('\" + hc.raddr + \"', 'ERROR'); DELETE FROM state WHERE id IN (SELECT id FROM state WHERE raddr='\" + hc.raddr + \"' ORDER BY id DESC LIMIT 10 OFFSET 10);\") // insert ERROR status and remove oldest status then 10 last\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\t//fmt.Println(result.LastInsertId()) // id last add object\n\t\t\t//fmt.Println(result.RowsAffected()) // count add string\n\n\t\t\t//send alert\n\t\t\tcmdcurl := exec.Command(\"/usr/bin/curl\", \"-s\", \"-X\", \"POST\", \"https://api.telegram.org/bot\"+cf.tgtoken+\"/sendMessage\", \"-d\", \"chat_id=\"+hc.tgid, \"-d\", \"text= ⚠️️ \"+cf.hostname+\": src ip \"+cf.host+\":\"+\" LB \"+hc.raddr+\" changed state to DOWN\")\n\t\t\t_, err = cmdcurl.Output()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// send alert ( defferent version)\n\t\t\t// _, alertErr := http.PostForm(\n\t\t\t// \t\"https://api.telegram.org/bot\"+cf.tgtoken+\"/sendMessage\",\n\t\t\t// \turl.Values{\n\t\t\t// \t\t\"chat_id\": {hc.tgid},\n\t\t\t// \t\t\"text\": {\"⚠️️\" + cf.hostname + \"|\" + cf.host + \":\" + \" LB \" + hc.raddr + \" changed state to DOWN\"},\n\t\t\t// \t},\n\t\t\t// )\n\t\t\t// if err != nil {\n\t\t\t// \tfmt.Println(alertErr.Error())\n\t\t\t// \treturn\n\t\t\t// }\n\n\t\t}\n\t\tif thold > 1 { // for last loop exit\n\t\t\ttime.Sleep(time.Duration(cf.interval) * time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0f33ca79f69831463724dc4bd3e2382c", "score": "0.45509177", "text": "func (sm *Statemgr) CheckHostMigrationCompliance(hostName string) error {\n\thostState := sm.FindHost(hostName)\n\tif hostState == nil {\n\t\treturn fmt.Errorf(\"could not find host %v in ctkit\", hostName)\n\t}\n\n\t_, isHostOrchhubManaged := hostState.Host.Labels[utils.OrchNameKey]\n\tif !isHostOrchhubManaged {\n\t\treturn fmt.Errorf(\"host %v is not managed by orchhub\", hostName)\n\t}\n\n\tvar snic *DistributedServiceCardState\n\tfor jj := range hostState.Host.Spec.DSCs {\n\t\tsnic = sm.FindDSC(hostState.Host.Spec.DSCs[jj].MACAddress, hostState.Host.Spec.DSCs[jj].ID)\n\t\tif snic != nil {\n\t\t\t// We look for the first DSC in the list of DSCs\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif snic == nil || snic.DistributedServiceCard.Status.AdmissionPhase != cluster.DistributedServiceCardStatus_ADMITTED.String() {\n\t\tsm.logger.Infof(\"DSC for host %v is not admitted\", hostState.Host.Name)\n\t\treturn fmt.Errorf(\"DSC for host %v is not admitted\", hostState.Host.Name)\n\t}\n\n\tif err := snic.isOrchestratorCompatible(); err != nil {\n\t\tsm.logger.Infof(\"DSC %v is not orchestration compatible. Err : %v\", snic.DistributedServiceCard.Name, err)\n\t\treturn fmt.Errorf(\"dsc %v is not orchestration compatible\", snic.DistributedServiceCard.Name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "82443473deb35a82ada407a0b2b69879", "score": "0.45480955", "text": "func (hosts *Hosts) CountWorkers() int {\n\n\t// init the counter\n\tcounter := 0\n\n\t// loop over hosts\n\tfor _, host := range hosts.Hosts {\n\t\t// increment if the host is a worker as defined before.\n\t\tif host.IsWorker() {\n\t\t\tcounter++\n\t\t}\n\t}\n\n\t// return the counter\n\treturn counter\n}", "title": "" }, { "docid": "76405fc3e7e490eb0606fea6d97639e9", "score": "0.45448843", "text": "func InsertHost(ctx context.Context, req *crimson.HostList) (err error) {\n\tif len(req.Hosts) == 0 {\n\t\tlogging.Errorf(ctx, \"Received empty list of hosts to create.\")\n\t\treturn UserErrorf(InvalidArgument,\n\t\t\t\"Received empty list of hosts to create.\")\n\t}\n\n\tif err = checkInsertHostArgs(req); err != nil {\n\t\treturn\n\t}\n\n\t// Need a transaction to guarantee the same connection for multiple\n\t// SQL statements.\n\treturn withLockedTable(ctx, \"host\", func(tx *sql.Tx) error {\n\t\t// Check for duplicate entries in the input.\n\t\t// TODO(sergeyberezin): make it return a single error with all the\n\t\t// duplicates listed.\n\t\tif errs := datautil.CheckDuplicateHosts(req); len(errs) > 0 {\n\t\t\terr = errors.NewMultiError(errs...)\n\t\t\treturn UserErrorf(InvalidArgument, err.Error())\n\t\t}\n\n\t\t// Check for duplicate entries in the database.\n\t\terr := checkDuplicateIPs(ctx, req, tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = checkDuplicateMACs(ctx, req, tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = checkDuplicateHostnames(ctx, req, tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Compose query\n\t\tquery, params, err := insertHostQuery(req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = tx.Exec(query, params...)\n\t\tif err != nil {\n\t\t\t// MySQL error 1062 is 'duplicate entry'.\n\t\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok && mysqlErr.Number == 1062 {\n\t\t\t\tlogging.Warningf(ctx, \"Insertion of new hosts failed. %s\", err)\n\t\t\t\terr = UserErrorf(AlreadyExists,\n\t\t\t\t\t\"Hosts couldn't be created because some entries already exist.\")\n\t\t\t}\n\t\t\tlogging.Errorf(ctx, \"Insertion of new hosts failed. %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err != nil {\n\t\t\tlogging.Errorf(ctx, \"Opening transaction failed. %s\", err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "40468bc2c672bccf125dc8c6e9cf3add", "score": "0.45159134", "text": "func checkDatabaseFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[string]string, ignoreFields map[string]struct{}) error {\n\ttotalInstances, err := strconv.Atoi(dsAttr[\"databases.#\"])\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't convert length of instances list to integer\")\n\t}\n\tindex := \"-1\"\n\tfor i := 0; i < totalInstances; i++ {\n\t\tif dsAttr[\"databases.\"+strconv.Itoa(i)+\".name\"] == rsAttr[\"name\"] {\n\t\t\tindex = strconv.Itoa(i)\n\t\t}\n\t}\n\n\tif index == \"-1\" {\n\t\treturn errors.New(\"The newly created instance is not found in the data source\")\n\t}\n\n\terrMsg := \"\"\n\t// Data sources are often derived from resources, so iterate over the resource fields to\n\t// make sure all fields are accounted for in the data source.\n\t// If a field exists in the data source but not in the resource, its expected value should\n\t// be checked separately.\n\tfor k := range rsAttr {\n\t\tif _, ok := ignoreFields[k]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tif k == \"%\" {\n\t\t\tcontinue\n\t\t}\n\t\tif dsAttr[\"databases.\"+index+\".\"+k] != rsAttr[k] {\n\t\t\t// ignore data sources where an empty list is being compared against a null list.\n\t\t\tif k[len(k)-1:] == \"#\" && (dsAttr[\"databases.\"+index+\".\"+k] == \"\" || dsAttr[\"databases.\"+index+\".\"+k] == \"0\") && (rsAttr[k] == \"\" || rsAttr[k] == \"0\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrMsg += fmt.Sprintf(\"%s is %s; want %s\\n\", k, dsAttr[\"databases.\"+index+\".\"+k], rsAttr[k])\n\t\t}\n\t}\n\n\tif errMsg != \"\" {\n\t\treturn errors.New(errMsg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b9ed8f56353a54bf8613680126cc152", "score": "0.45141608", "text": "func (hdb *HostDB) RandomHosts(tree string, n int, excludeKeys []types.SiaPublicKey) ([]modules.HostDBEntry, error) {\n\thdb.mu.RLock()\n\tinitialScanComplete := hdb.initialScanComplete\n\thdb.mu.RUnlock()\n\tif !initialScanComplete {\n\t\treturn []modules.HostDBEntry{}, ErrInitialScanIncomplete\n\t}\n\treturn hdb.hostTrees.SelectRandom(tree, n, excludeKeys), nil\n}", "title": "" }, { "docid": "c76e036d28a3dc8a6c7993005db4a518", "score": "0.4504523", "text": "func SyncForHosts(syncData *cmdbModel.SyncForAdding) {\n\t// sync Hosts\n\ttxProcessorHost := &syncHostTx{\n\t\thosts: api2tuple(syncData.Hosts),\n\t}\n\n\tDbFacade.NewSqlxDbCtrl().InTx(txProcessorHost)\n\n\t// sync HostGroups\n\n\ttxProcessorGroup := &syncHostGroupTx{\n\t\tgroups: syncData.Hostgroups,\n\t}\n\n\tDbFacade.NewSqlxDbCtrl().InTx(txProcessorGroup)\n\n\t// sync Relations\n\n\ttxProcessorRel := &syncHostgroupContaining{\n\t\trelations: syncData.Relations,\n\t}\n\n\tDbFacade.NewSqlxDbCtrl().InTx(txProcessorRel)\n}", "title": "" }, { "docid": "dd12cd21e75b291f06b0afdd1493e79f", "score": "0.44890296", "text": "func checkTables(t *testing.T, showTableName string, expectCount int) {\n\tfor i := range clusterInstance.Keyspaces[0].Shards {\n\t\tcheckTablesCount(t, clusterInstance.Keyspaces[0].Shards[i].Vttablets[0], showTableName, expectCount)\n\t}\n}", "title": "" }, { "docid": "148f72d69d2b5cbe429222e619edeaf0", "score": "0.4483075", "text": "func (m *IpSecurityProfile) GetCountHosts()(*int32) {\n val, err := m.GetBackingStore().Get(\"countHosts\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "b746d91fa4d418246282d725fdf80b6c", "score": "0.44703194", "text": "func (c *Cluster) CheckHostport(hostport int) error {\n\tfor _, nodevalue := range c.Nodes {\n\t\tfor _, hostportvalue := range nodevalue.Ports {\n\t\t\tif hostportvalue == hostport {\n\t\t\t\treturn errPortHostPortAlreadyUsed\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c5ecdf377045e571dfc60396500b6ed", "score": "0.44597685", "text": "func (g *Granter) groupAllDatabasesByHost(reqLogger logr.Logger, hosts HostAccess, host string, namespace string, access lunarwayv1alpha1.AccessSpec, privilege postgres.Privilege) error {\n\tdatabases, err := g.AllDatabases(namespace)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get all databases: %w\", err)\n\t}\n\tif len(databases) == 0 {\n\t\treqLogger.WithValues(\"spec\", access, \"privilege\", privilege, \"host\", host, \"namespace\", namespace).Info(fmt.Sprintf(\"Flag allDatabases results in no privileges granted: no PostgreSQLDatabase resources found on host '%s'\", host))\n\t\treturn nil\n\t}\n\treqLogger.Info(fmt.Sprintf(\"Found %d PostgreSQLDatabase resources in namespace '%s'\", len(databases), namespace))\n\tvar errs error\n\tfor _, databaseResource := range databases {\n\t\tdatabase := databaseResource.Spec.Name\n\t\tif databaseResource.Status.Phase != lunarwayv1alpha1.PostgreSQLDatabasePhaseRunning {\n\t\t\treqLogger.Info(fmt.Sprintf(\"Skipping resource '%s' as it is not in phase running\", database))\n\t\t\tcontinue\n\t\t}\n\t\tdatabaseHost, err := g.ResourceResolver(databaseResource.Spec.Host, namespace)\n\t\tif err != nil {\n\t\t\terrs = multierr.Append(errs, fmt.Errorf(\"resolve database '%s' host name: %w\", databaseResource.Spec.Name, err))\n\t\t\tcontinue\n\t\t}\n\t\tif host != databaseHost {\n\t\t\treqLogger.Info(fmt.Sprintf(\"Skipping resource '%s' as it is on another host (%s)\", database, databaseHost))\n\t\t\tcontinue\n\t\t}\n\t\tschema, err := g.ResourceResolver(databaseResource.Spec.User, namespace)\n\t\tif err != nil && !errors.Is(err, kube.ErrNoValue) {\n\t\t\terrs = multierr.Append(errs, fmt.Errorf(\"resolve database '%s' user name: %w\", databaseResource.Spec.Name, err))\n\t\t\tcontinue\n\t\t}\n\t\tif schema == \"\" {\n\t\t\tschema = database\n\t\t}\n\t\treqLogger.Info(fmt.Sprintf(\"Resolved database '%s' with schema '%s'\", database, schema))\n\t\thosts[host] = append(hosts[host], ReadWriteAccess{\n\t\t\tHost: host,\n\t\t\tDatabase: postgres.DatabaseSchema{\n\t\t\t\tName: database,\n\t\t\t\tSchema: schema,\n\t\t\t\tPrivileges: privilege,\n\t\t\t},\n\t\t\tAccess: access,\n\t\t})\n\t}\n\tif errs != nil {\n\t\treturn errs\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d94b7121f0dbece7c7eddbe46535aa68", "score": "0.44565022", "text": "func check_all(c appengine.Context, w http.ResponseWriter, r *http.Request) error {\n sites, keys, err := get_sites_with_status_error_or_ok(c)\n \n if err != nil {\n return err\n }\n for index, site := range sites {\n \tcheck_site_status(&site, r)\n \n key := keys[index]\n err := update_site (key, &site, c)\n \tif err != nil {\n \t\treturn err\n \t}\n }\n return nil\n}", "title": "" }, { "docid": "0c7787aa31cceaf3f01c481726a41240", "score": "0.44564852", "text": "func DbChecker(db *sql.DB, dir string) {\n\ttickChan := time.NewTicker(time.Second * 5).C\n\tfor {\n\t\tselect {\n\t\tcase <-tickChan:\n\t\t\trows, err := db.Query(fmt.Sprintf(\"SELECT hash, expires FROM ttl WHERE expires < %d\", time.Now().Unix()))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error: \", err.Error())\n\t\t\t}\n\t\t\tdefer rows.Close()\n\n\t\t\t// iterate though selected rows\n\t\t\t// tried to wrap this inside (if rows != nil) but seems rows has value even if no entries meet condition. Thoughts?\n\t\t\tfor rows.Next() {\n\t\t\t\tvar expHash string\n\t\t\t\tvar expires int64\n\n\t\t\t\terr = rows.Scan(&expHash, &expires)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"Error: \", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// delete file on local machine\n\t\t\t\terr = pstore.Delete(expHash, dir)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"Error: \", err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfmt.Println(\"Deleted file: \", expHash)\n\t\t\t}\n\n\t\t\t// getting error when attempting to delete DB entry while inside it, so deleting outside for loop. Thoughts?\n\t\t\t_, err = db.Exec(fmt.Sprintf(\"DELETE FROM ttl WHERE expires < %d\", time.Now().Unix()))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error: \", err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8ffd4e21803005e4855b54f78101817", "score": "0.4455759", "text": "func (hr *HostRegistry) Contains(address string) bool {\n\n\thr.boltDbCtx = NewBoltDbContext(hr.boltDbFile)\n\t_, err := hr.boltDbCtx.GetHost(address)\n\thr.boltDbCtx.Close()\n\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "01b471ce5f9fc2950a8bdf91f44899db", "score": "0.4454451", "text": "func (c Checker) doChecks() types.Attempts {\n\tvar conn net.Conn\n\n\ttimeout := c.Timeout\n\tif timeout == 0 {\n\t\ttimeout = time.Second\n\t}\n\n\tchecks := make(types.Attempts, c.Attempts)\n\tfor i := 0; i < c.Attempts; i++ {\n\t\tvar err error\n\t\tstart := time.Now()\n\n\t\tif c.Host != \"\" {\n\t\t\thostname := c.Host\n\t\t\tm1 := new(dns.Msg)\n\t\t\tm1.Id = dns.Id()\n\t\t\tm1.RecursionDesired = true\n\t\t\tm1.Question = make([]dns.Question, 1)\n\t\t\tm1.Question[0] = dns.Question{Name: hostname, Qtype: dns.TypeA, Qclass: dns.ClassINET}\n\t\t\td := new(dns.Client)\n\t\t\t_, _, err := d.Exchange(m1, c.URL)\n\t\t\tif err != nil {\n\t\t\t\tchecks[i].Error = err.Error()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif conn, err = net.DialTimeout(\"tcp\", c.URL, timeout); err != nil {\n\t\t\tchecks[i].Error = err.Error()\n\t\t} else {\n\t\t\tconn.Close()\n\t\t}\n\t\tchecks[i].RTT = time.Since(start)\n\t}\n\treturn checks\n}", "title": "" }, { "docid": "16d0c5c1124359c1d8ddf8f836462b6d", "score": "0.4449371", "text": "func (repo *DBRepo) AllHosts(w http.ResponseWriter, r *http.Request) {\n\thosts, err := repo.DB.AllHosts()\n\tif err != nil {\n\t\tServerError(w, r, err)\n\t\treturn\n\t}\n\tvars := make(jet.VarMap)\n\tvars.Set(\"hosts\", hosts)\n\terr = helpers.RenderPage(w, r, \"hosts\", vars, nil)\n\tif err != nil {\n\t\tprintTemplateError(w, err)\n\t}\n}", "title": "" }, { "docid": "b6a11b3e07e309286a113d9fb780cde7", "score": "0.44475976", "text": "func uniqueHostsExtended(client db.Client) (map[string]map[string]int, error) {\n\tvar (\n\t\thosts = map[string]map[string]int{}\n\t\tn = 0\n\t)\n\tif err := client.EachPackage(func(pkg *domain.Package) {\n\t\tif n > 0 && n%10000 == 0 {\n\t\t\tlog.WithField(\"n\", n).Debug(\"Processed chunk\")\n\t\t}\n\t\tn++\n\t\tif !strings.Contains(pkg.Path, \".\") {\n\t\t\treturn\n\t\t}\n\t\th := strings.Split(pkg.Path, \"/\")[0]\n\t\tif _, ok := hosts[h]; !ok {\n\t\t\thosts[h] = map[string]int{}\n\t\t}\n\n\t\tif _, ok := hosts[h][\"repos\"]; !ok {\n\t\t\thosts[h][\"repos\"] = 0\n\t\t}\n\t\thosts[h][\"repos\"]++\n\n\t\tif _, ok := hosts[h][\"packages\"]; !ok {\n\t\t\thosts[h][\"packages\"] = 0\n\t\t}\n\t\thosts[h][\"packages\"] += len(pkg.Data.SubPackages)\n\t}); err != nil {\n\t\treturn hosts, err\n\t}\n\treturn hosts, nil\n}", "title": "" }, { "docid": "fd74a440b66ad67b2270f68e066b1854", "score": "0.44441023", "text": "func (r *Reconciler) checkConnection(ctx context.Context, src *v1alpha1.MongoDbSource) reconciler.Event {\n\t// Try to connect to the database and see if it works.\n\tsecret, err := r.secretLister.Secrets(src.Namespace).Get(src.Spec.Secret.Name)\n\tif err != nil {\n\t\tlogging.FromContext(ctx).Desugar().Error(\"Unable to read MongoDb credentials secret\", zap.Error(err))\n\t\treturn err\n\t}\n\trawURI, ok := secret.Data[\"URI\"]\n\tif !ok {\n\t\treturn errors.New(\"Unable to get MongoDb URI field\")\n\t}\n\tURI := string(rawURI)\n\n\t// Connect to the MongoDb replica-set.\n\tclient, err := r.createClientFn(options.Client().ApplyURI(URI))\n\tif err != nil {\n\t\tlogging.FromContext(ctx).Desugar().Error(\"Error creating mongo client\", zap.Error(err))\n\t\treturn err\n\t}\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlogging.FromContext(ctx).Desugar().Error(\"Error connecting to mongo client\", zap.Error(err))\n\t\treturn err\n\t}\n\tdefer client.Disconnect(ctx)\n\n\t// See if database exists in available databases.\n\tdatabases, err := client.ListDatabaseNames(ctx, bson.M{})\n\tif err != nil {\n\t\tlogging.FromContext(ctx).Desugar().Error(\"Error listing databases\", zap.Error(err))\n\t\treturn err\n\t}\n\tif !stringInSlice(src.Spec.Database, databases) {\n\t\terr = fmt.Errorf(\"database %q not found in available databases\", src.Spec.Database)\n\t\tlogging.FromContext(ctx).Desugar().Error(\"Database not found in available databases\", zap.Any(\"database\", src.Spec.Database), zap.Any(\"availableDatabases\", fmt.Sprint(databases)), zap.Error(err))\n\t\treturn err\n\t}\n\n\t// See if collection exists in available collections.\n\tif src.Spec.Collection != \"\" {\n\t\tcollections, err := client.Database(src.Spec.Database).ListCollectionNames(ctx, bson.M{})\n\t\tif err != nil {\n\t\t\tlogging.FromContext(ctx).Desugar().Error(\"Error listing collections\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t\tif !stringInSlice(src.Spec.Collection, collections) {\n\t\t\terr = fmt.Errorf(\"collection %q not found in available collections\", src.Spec.Collection)\n\t\t\tlogging.FromContext(ctx).Desugar().Error(\"Collection not found in available collections\", zap.Any(\"collection\", src.Spec.Collection), zap.Any(\"availableCollections\", fmt.Sprint(collections)), zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a8d3f9656b918cf3ef2f514e3f174b0d", "score": "0.44359335", "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": "5fa958b585cec54c00d2ec3e1245d6d6", "score": "0.4424338", "text": "func HostListSize(list []Host) int {\n\tsize := 0\n\tfor _, item := range list {\n\t\tsize += (4 + xgb.Pad((int(item.AddressLen) * 1)))\n\t}\n\treturn size\n}", "title": "" }, { "docid": "e229ff2ff5c1f5cc0ba62f5d4235eb17", "score": "0.44168094", "text": "func (hm *HostManager) AddHost(hosts ...string) int {\n\tvar addedHosts int\n\tfor item := range hosts {\n\t\thm.Hosts = append(hm.Hosts, net.ParseIP(hosts[item]))\n\t\taddedHosts = addedHosts + 1\n\t}\n\treturn addedHosts\n}", "title": "" }, { "docid": "f286094f220e6577e5d5aab2626bf584", "score": "0.44132727", "text": "func (o *ApplianceAllOfNetworking) HasHosts() bool {\n\tif o != nil && o.Hosts != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "4b0b7a550af297003bd3f6a154d2db0d", "score": "0.44124576", "text": "func (db *LevelDb) checkAddrIndexVersion() error {\n\n\tdata, err := db.lDb.Get(addrIndexVersionKey, db.ro)\n\tif err != nil {\n\t\treturn database.ErrAddrIndexDoesNotExist\n\t}\n\n\tindexVersion := binary.LittleEndian.Uint16(data)\n\n\tif indexVersion != uint16(addrIndexCurrentVersion) {\n\t\treturn database.ErrAddrIndexDoesNotExist\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3fa81e26bcc95e37aa044679d9534b6c", "score": "0.44093084", "text": "func checkRetryMigration(t *testing.T, uuid string, expectRetryPossible bool) {\n\tresult, err := clusterInstance.VtctlclientProcess.OnlineDDLRetryMigration(keyspaceName, uuid)\n\tfmt.Println(\"# 'vtctlclient OnlineDDL retry <uuid>' output (for debug purposes):\")\n\tfmt.Println(result)\n\tassert.NoError(t, err)\n\n\tvar r *regexp.Regexp\n\tif expectRetryPossible {\n\t\tr = fullWordRegexp(\"1\")\n\t} else {\n\t\tr = fullWordRegexp(\"0\")\n\t}\n\tm := r.FindAllString(result, -1)\n\tassert.Equal(t, len(clusterInstance.Keyspaces[0].Shards), len(m))\n}", "title": "" }, { "docid": "4a2646b8dcbd4b3b5b0e23d8941cf82b", "score": "0.44045115", "text": "func announceHosts(hosts map[*TestNode]struct{}) error {\n\tfor host := range hosts {\n\t\tif err := host.HostAcceptingContractsPost(true); err != nil {\n\t\t\treturn errors.AddContext(err, \"failed to set host to accepting contracts\")\n\t\t}\n\t\tif err := host.HostAnnouncePost(); err != nil {\n\t\t\treturn errors.AddContext(err, \"failed to announce host\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3165b7193acc0babc2b4dd361ced338", "score": "0.44028562", "text": "func (p *ProxySQLMock) AddHosts(hosts ...*Host) error {\n\tfor _, host := range hosts {\n\t\tlog.Println(host)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d83924f64fafe991ffe4b0d7bdfe2373", "score": "0.44014734", "text": "func updateHosts() {\n\n\t// get hostfile handle\n\thosts, err := hostsfile.NewHosts()\n\tif err != nil {\n\t\tlog.Fatal(\"[FATAL] simplecert: could not open hostsfile: \", err)\n\t}\n\n\t// check if all domains from config are present\n\tfor _, d := range c.Domains {\n\t\tif !hosts.Has(localhost, d) {\n\t\t\thosts.Add(localhost, d)\n\t\t}\n\t}\n\n\t// write changes to disk\n\tif err := hosts.Flush(); err != nil {\n\t\tlog.Fatal(\"[FATAL] simplecert: could not update /etc/hosts: \", err)\n\t}\n}", "title": "" }, { "docid": "968118aed9b3e48297966fda5b84b0f1", "score": "0.4386565", "text": "func aggregateNodesByHost(hosts []string) (map[string]int, error) {\n\tcoll := collection()\n\tdefer coll.Close()\n\tpipe := coll.Pipe([]bson.M{\n\t\t{\"$match\": bson.M{\"hostaddr\": bson.M{\"$in\": hosts}}},\n\t\t{\"$group\": bson.M{\"_id\": \"$hostaddr\", \"count\": bson.M{\"$sum\": 1}}},\n\t})\n\tvar results []nodeAggregate\n\terr := pipe.All(&results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcountMap := make(map[string]int)\n\tfor _, result := range results {\n\t\tcountMap[result.HostAddr] = result.Count\n\t}\n\treturn countMap, nil\n}", "title": "" }, { "docid": "3d37133881d9b55213f6cb2ab690fbcd", "score": "0.4380157", "text": "func (c Checks) Hosts() []*Host {\n\treturn c.hosts\n}", "title": "" }, { "docid": "ff5757d908cebfe29d8310a3bbc36c89", "score": "0.4378688", "text": "func checkReferences(volumeName string) int {\n\n\tcli, err := client.NewEnvClient()\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tvar counter = 0\n\tContainerListResponse, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true}) // All : true will return the stopped containers as well.\n\tif err != nil {\n\t\tlog.Fatal(err, \". Use -a flag to setup the DOCKER_API_VERSION. Run 'docker-volume-netshare --help' for usage.\")\n\t}\n\n\tfor _, container := range ContainerListResponse {\n\t\tif len(container.Mounts) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, mounts := range container.Mounts {\n\t\t\tif !(mounts.Name == volumeName) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcounter++\n\t\t}\n\t}\n\treturn counter\n}", "title": "" }, { "docid": "f6044285c2c80b73286323e83f50b6c8", "score": "0.43584067", "text": "func checkdb(newd string) {\r\n\r\n\t// Sleep in order for goroutines to work\r\n\ttime.Sleep(time.Millisecond * 10)\r\n\r\n\tendpoints := getEndpoints(newd)\r\n\r\n\t// Read all the files in the directory \"db\"\r\n\tfiles, err := ioutil.ReadDir(\"db\")\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\t// If there are no files save them first\r\n\tif len(files) == 0 {\r\n\t\tfor _, e := range endpoints {\r\n\t\t\tfmt.Println(e)\r\n\t\t\twriteEndpoint(e)\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n\r\n\t// Open all the files in the \"db\" dir\r\n\tfor _, file := range files {\r\n\t\tf, err := os.Open(\"db/\" + file.Name())\r\n\t\tif err != nil {\r\n\t\t\tlog.Fatal(err)\r\n\t\t}\r\n\r\n\t\tdefer f.Close()\r\n\r\n\t\t// Reads the file in the db and compares it with the endpoint discovered\r\n\t\tfScanner := bufio.NewScanner(f)\r\n\t\tfor fScanner.Scan() {\r\n\t\t\tfor _, e := range endpoints {\r\n\t\t\t\tif e != fScanner.Text() {\r\n\t\t\t\t\tfmt.Println(e)\r\n\t\t\t\t\t//writeEndpoint(e)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "1c94acb9db0eff6dee015c8a1893f322", "score": "0.43540344", "text": "func (v HostsValidator) Validate() error {\n\t//nolint:godox\n\t// FIXME: How do we validate a hosts file?\n\treturn nil\n}", "title": "" }, { "docid": "893d15e35793fd33a2b11ce64ba12724", "score": "0.43408754", "text": "func (r *Renter) Host(spk types.SiaPublicKey) (modules.HostDBEntry, bool) { return r.hostDB.Host(spk) }", "title": "" }, { "docid": "fa8b5260bc425a7ce3929ed3ceda2b50", "score": "0.43395972", "text": "func (r *Root) Import(db *pg.DB, ws uint64) error {\n\tat := time.Time(r.Start)\n\tused := map[int]int{} // used hosts indexes\n\tvar (\n\t\thosts []interface{} // *models.Host\n\t\tservices []interface{} // *models.Service\n\t\tissues []interface{} // *models.Issue\n\t)\n\n\terr := db.RunInTransaction(func(tx *pg.Tx) error {\n\t\t// generate source entry\n\t\tsource := models.Source{\n\t\t\tWorkspaceID: ws,\n\t\t\tGenerator: fmt.Sprintf(\"%s %s\", r.Scanner, r.Version),\n\t\t\tGeneratedAt: &at,\n\t\t\tSourceInfo: &models.JSON{\n\t\t\t\t\"arguments\": r.Args,\n\t\t\t\t\"type\": r.ScanInfo.Type,\n\t\t\t\t\"verbose\": r.Verbose.Level,\n\t\t\t\t\"debug\": r.Debugging.Level,\n\t\t\t},\n\t\t}\n\t\tif err := tx.Insert(&source); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// import hosts\n\t\tfor i, host := range r.Hosts {\n\t\t\tif len(host.Addresses) < 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// parse address\n\t\t\tvar ip net.IP\n\t\t\tfor _, addr := range host.Addresses {\n\t\t\t\tip = net.ParseIP(addr.Addr)\n\t\t\t\tif ip != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ip == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thosts = append(hosts, &models.Host{\n\t\t\t\tSourceID: source.ID,\n\t\t\t\tAddress: ip,\n\t\t\t\tState: host.Status.State,\n\t\t\t})\n\t\t\tused[i] = len(hosts) - 1\n\t\t}\n\n\t\t// abort if no hosts\n\t\tif len(hosts) < 1 {\n\t\t\treturn nil\n\t\t}\n\t\tif _, err := tx.Model(hosts...).Insert(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// parse services and issues\n\t\tfor i := range r.Hosts {\n\t\t\tidx, ok := used[i]\n\t\t\tif !ok {\n\t\t\t\t// skip\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thost := hosts[idx].(*models.Host)\n\t\t\tvar wg sync.WaitGroup\n\t\t\twg.Add(2)\n\n\t\t\t// services\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\n\t\t\t\tfor _, port := range r.Hosts[i].Ports {\n\t\t\t\t\tservice := port.Service.String()\n\t\t\t\t\tservices = append(services, &models.Service{\n\t\t\t\t\t\tHostID: host.ID,\n\t\t\t\t\t\tProtocol: port.Protocol,\n\t\t\t\t\t\tPort: port.PortID,\n\t\t\t\t\t\tState: port.State.State,\n\t\t\t\t\t\tService: &service,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t// generate issue of the host\n\t\t\tgo func(host Host, mhost *models.Host) {\n\t\t\t\tdefer wg.Done()\n\n\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\tif err := ourTemplate.Execute(buf, host); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tissues = append(issues, &models.Issue{\n\t\t\t\t\tHostID: mhost.ID,\n\t\t\t\t\tLevel: models.InfoIssue,\n\t\t\t\t\tTitle: \"Nmap Scan\",\n\t\t\t\t\tContent: buf.String(),\n\t\t\t\t})\n\t\t\t}(r.Hosts[i], host)\n\t\t\twg.Wait()\n\t\t}\n\n\t\t// insert all\n\t\tif len(services) > 1 {\n\t\t\tif err := tx.Insert(services...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn tx.Insert(issues...)\n\t})\n\n\treturn err\n}", "title": "" }, { "docid": "9fcf3ad2810de79542be2608460b7087", "score": "0.43371034", "text": "func dbContentValidation() {\n\n\tl.Lock()\n\tdefer l.Unlock()\n\tws, err := GetAll()\n\tif err == nil {\n\t\tfor _, singleWorkload := range ws {\n\t\t\t// validation only for workloads/policies related with taskID/processID\n\t\t\tif len(singleWorkload.TaskIDs) != 0 {\n\t\t\t\t// remove from DB workloads which are related with not existing\n\t\t\t\t// any more tasks/processes in the system (remove when all tasks doesn't exist)\n\t\t\t\tif shouldRemoveWorkload(&singleWorkload) {\n\t\t\t\t\terr := Delete(&singleWorkload)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// just log here\n\t\t\t\t\t\tlog.Errorf(\"dbContentValidation failed to delete invalid workload from db: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t\t// inform about deleted workloads\n\t\t\t\t\tlog.Infof(\"Workload %v deleted by DBValidator\", singleWorkload)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Errorf(\"dbContentValidation failed to validate DB for outdated workloads\")\n\t}\n}", "title": "" }, { "docid": "8ed8eefe8c2f1e12d9ec11fde614a269", "score": "0.43367207", "text": "func CheckMembersHealth(m *client.Member) error {\n\t// check for available client urls\n\tif len(m.ClientURLs) == 0 {\n\t\tfmt.Printf(\"member %s is unreachable: no available published client urls\\n\", m.ID)\n\t\treturn nil\n\t}\n\n\tdialTimeout := 30 * time.Second\n\ttr, err := transport.NewTransport(transport.TLSInfo{}, dialTimeout)\n\t// check for nil\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\t// http client\n\thc := http.Client{\n\t\tTransport: tr,\n\t}\n\n\t// checked := false\n\tfor _, url := range m.ClientURLs {\n\t\t// check for health route\n\t\tif _, err := hc.Get(url + \"/health\"); err != nil {\n\t\t\treturn ErrEtcdMemberUnhealty\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a17bdd25b8e9a9f6b3b3f54c585fa09c", "score": "0.43355262", "text": "func (db *nodeDB) ensureExpirer() {\n\tdb.runner.Do(func() { go db.expirer() })\n}", "title": "" }, { "docid": "d7915ea688f899e68c892417fdfd85d1", "score": "0.43352687", "text": "func HostReadList(buf []byte, dest []Host) int {\n\tb := 0\n\tfor i := 0; i < len(dest); i++ {\n\t\tdest[i] = Host{}\n\t\tb += HostRead(buf[b:], &dest[i])\n\t}\n\treturn xgb.Pad(b)\n}", "title": "" }, { "docid": "ae1120ce1b7b9b6b36af8e54c506d654", "score": "0.43340912", "text": "func (hjr *hostJobRunner) managedCheckStorageRevenueNotDecreased() error {\n\thostInfo, err := hjr.staticClient.HostGet()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Print an error if storage revenue has decreased\n\thjr.mu.Lock()\n\tr := hjr.lastStorageRevenue\n\thjr.mu.Unlock()\n\n\tif hostInfo.FinancialMetrics.StorageRevenue.Cmp(r) < 0 {\n\t\t// Storage revenue has decreased!\n\t\thjr.staticLogger.Errorf(\"%v: storage revenue decreased! Was %v, is now %v\", hjr.staticDataDir, hjr.lastStorageRevenue, hostInfo.FinancialMetrics.StorageRevenue)\n\t}\n\n\t// Update previous revenue to new amount\n\thjr.mu.Lock()\n\thjr.lastStorageRevenue = hostInfo.FinancialMetrics.StorageRevenue\n\thjr.mu.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "ffbab96ea6f94897d74b15e9a5be164d", "score": "0.43319386", "text": "func (sh *SeparatedCertHosts) Validate() error {\n\tif len(sh.WildCardHosts) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, wildCardHost := range sh.WildCardHosts {\n\t\thostWithoutWildCard := strings.ReplaceAll(wildCardHost, \"*\", \"\")\n\t\tfor _, host := range sh.Hosts {\n\t\t\tif strings.Contains(host, hostWithoutWildCard) {\n\t\t\t\tif !strings.Contains(strings.ReplaceAll(host, hostWithoutWildCard, \"\"), \".\") {\n\t\t\t\t\treturn errors.WithStack(InvalidHostNameError)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "82aa6916255d77defd7572d0ed654cc3", "score": "0.43266866", "text": "func (ds *DNSServer) qualifySrvHosts(srvs []SRVRecord) []SRVRecord {\n\tnewsrvs := []SRVRecord{}\n\n\tfor _, srv := range srvs {\n\t\tnewsrvs = append(newsrvs, SRVRecord{\n\t\t\tHost: ds.qualifyHost(srv.Host),\n\t\t\tPort: srv.Port,\n\t\t})\n\t}\n\n\treturn newsrvs\n}", "title": "" }, { "docid": "ca5d92f9f7c9b959405c9aec56d15d8a", "score": "0.43223652", "text": "func readHosts() {\n\tfile, err := os.Open(\"/etc/hosts\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tresolve = make(map[string]string)\n\n\t// Match only IPv4 addresses\n\tr, err := regexp.Compile(`\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b`)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif len(line) == 0 || line[0] == '#' {\n\t\t\tcontinue\n\t\t}\n\n\t\tfields := strings.Fields(line)\n\n\t\t// If the first field is an IPv4 address\n\t\tif r.MatchString(fields[0]) {\n\t\t\tfor _, field := range fields[1:] {\n\t\t\t\tresolve[field+\".\"] = fields[0]\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "05f8c73b4a0613dafcc6511b374c84a5", "score": "0.43214363", "text": "func (r Repo) CheckNodes(checkNodesClose chan struct{}) error {\n\tticker := time.NewTicker(1 * time.Second)\n\tgo func() {\n\t\tfor range ticker.C {\n\t\t\tnodes, _ := r.s.GetAllNodes()\n\t\t\tfor _, n := range nodes {\n\t\t\t\t// r.logger.Log(\"method\", \"CheckNodes\", \"node\", n.ID.String()+\" \"+n.IP+n.Port)\n\n\t\t\t\tgrpcAddr := n.IP + n.Port\n\t\t\t\tctx, close := context.WithTimeout(context.Background(), time.Second)\n\t\t\t\tdefer close()\n\t\t\t\tconn, err := grpc.DialContext(ctx, grpcAddr, grpc.WithInsecure(), grpc.WithBlock())\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"err\", err)\n\t\t\t\t\tr.s.DeleteNode(n.ID)\n\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"action\", \"node deleted from the repository\")\n\t\t\t\t} else {\n\t\t\t\t\tdefer conn.Close()\n\t\t\t\t\totTracer := stdopentracing.GlobalTracer() // no-op\n\t\t\t\t\tsvc := workertransport.NewGRPCClient(conn, otTracer, r.logger)\n\n\t\t\t\t\tjobsCount, err := svc.Ping(ctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"err\", err)\n\t\t\t\t\t\tr.s.DeleteNode(n.ID)\n\t\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"action\", \"node deleted from the repository\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// r.logger.Log(\"method\", \"CheckNodes\", \"jobsCount\", jobsCount)\n\t\t\t\t\t\t// save a updated node\n\t\t\t\t\t\tn.JobsCount = jobsCount\n\t\t\t\t\t\tr.s.SaveNode(n)\n\t\t\t\t\t}\n\t\t\t\t\tjobs, err := svc.GetJobs(ctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"err\", err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tr.logger.Log(\"method\", \"CheckNodes\", \"jobs\", len(jobs))\n\t\t\t\t\t\tjs := make([]model.Job, 0)\n\t\t\t\t\t\tfor _, j := range jobs {\n\t\t\t\t\t\t\tid, _ := uuid.Parse(j.ID.String())\n\t\t\t\t\t\t\tjob := model.Job{\n\t\t\t\t\t\t\t\tID: model.JobID{id},\n\t\t\t\t\t\t\t\tPer: j.Per,\n\t\t\t\t\t\t\t\tDuration: float32(j.Duration.Seconds()),\n\t\t\t\t\t\t\t\tStartTime: j.StartTime,\n\t\t\t\t\t\t\t\tFinishTime: j.FinishTime,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjs = append(js, job)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn.Jobs = js\n\t\t\t\t\t\tr.s.SaveNode(n)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\t<-checkNodesClose\n\tticker.Stop()\n\treturn nil\n}", "title": "" }, { "docid": "fae5ab33daa99ead38716bf1a4304b4e", "score": "0.43195856", "text": "func (c *Cluster) BrokenHosts() []string {\n\tbrokenNodes := []string{}\n\tfor i := range c.ControlPlane {\n\t\tif c.ControlPlane[i].IsInCluster && !c.ControlPlane[i].ControlPlaneHealthy() {\n\t\t\tbrokenNodes = append(brokenNodes, c.ControlPlane[i].Config.Hostname)\n\t\t}\n\t}\n\tfor i := range c.StaticWorkers {\n\t\tif c.StaticWorkers[i].IsInCluster && !c.StaticWorkers[i].WorkerHealthy() {\n\t\t\tbrokenNodes = append(brokenNodes, c.StaticWorkers[i].Config.Hostname)\n\t\t}\n\t}\n\n\treturn brokenNodes\n}", "title": "" }, { "docid": "4d5f496388cbd310b2babfaa1b244dc6", "score": "0.43183625", "text": "func checkHostPortConflicts(containers []api.Container) errs.ValidationErrorList {\n\tallPorts := map[int]bool{}\n\treturn AccumulateUniquePorts(containers, allPorts, func(p *api.ContainerPort) int { return p.HostPort })\n}", "title": "" }, { "docid": "34a50fb5c34fdcc4d916a929293fa6d8", "score": "0.4317418", "text": "func (g *Granter) groupReadsByHosts(log logr.Logger, hosts HostAccess, namespace string, accesses []lunarwayv1alpha1.AccessSpec) error {\n\treturn g.groupByHosts(log, hosts, namespace, accesses, func(_ int) postgres.Privilege { return postgres.PrivilegeRead }, g.AllDatabasesReadEnabled)\n}", "title": "" }, { "docid": "d053fbc3ffdd706625102c3223cda0aa", "score": "0.4313344", "text": "func (r *MariaDBConsumerReconciler) checkMariaDBProviders(provider *mariadbv1.MariaDBProviderSpec, mariaDBConsumer *mariadbv1.MariaDBConsumer, namespaceName types.NamespacedName) error {\n\topLog := r.Log.WithValues(\"mariadbconsumer\", namespaceName)\n\tproviders := &mariadbv1.MariaDBProviderList{}\n\tsrc := providers.DeepCopyObject()\n\tif err := r.List(context.TODO(), src.(*mariadbv1.MariaDBProviderList)); err != nil {\n\t\treturn fmt.Errorf(\"Unable to list providers in the cluster, there may be none or something went wrong: %v\", err)\n\t}\n\tprovidersList := src.(*mariadbv1.MariaDBProviderList)\n\n\t// We need to loop around all available providers to check their current\n\t// usage.\n\t// @TODO make this more complex and use more usage data in the calculation.\n\t// @TODO use the name of the provider in the log statement (not just the\n\t// hostname).\n\tvar bestHostname string\n\tvar nameSpaceName string\n\tlowestTableCount := -1\n\tfor _, v := range providersList.Items {\n\t\tif v.Spec.Environment == mariaDBConsumer.Spec.Environment {\n\t\t\t// Form a temporary connection object.\n\t\t\tmDBProvider := mariadbv1.MariaDBProviderSpec{\n\t\t\t\tHostname: v.Spec.Hostname,\n\t\t\t\tUsername: v.Spec.Username,\n\t\t\t\tPassword: v.Spec.Password,\n\t\t\t\tPort: v.Spec.Port,\n\t\t\t\tName: v.ObjectMeta.Name,\n\t\t\t\tNamespace: v.ObjectMeta.Namespace,\n\t\t\t\tType: v.Spec.Type,\n\t\t\t}\n\t\t\tcurrentUsage, err := getMariaDBUsage(mDBProvider, r.Log.WithValues(\"mariadbconsumer\", namespaceName))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Unable to get provider usage, something went wrong: %v\", err)\n\t\t\t}\n\n\t\t\tif lowestTableCount < 0 || currentUsage.TableCount < lowestTableCount {\n\t\t\t\tbestHostname = v.Spec.Hostname\n\t\t\t\tnameSpaceName = mDBProvider.Namespace + \"/\" + mDBProvider.Name\n\t\t\t\tlowestTableCount = currentUsage.TableCount\n\t\t\t}\n\t\t}\n\t}\n\n\topLog.Info(fmt.Sprintf(\"Best database hostname %s has the lowest table count %v - %s\", bestHostname, lowestTableCount, nameSpaceName))\n\n\t// After working out the lowest usage database, return it.\n\tif bestHostname != \"\" {\n\t\tfor _, v := range providersList.Items {\n\t\t\tif v.Spec.Environment == mariaDBConsumer.Spec.Environment {\n\t\t\t\tif bestHostname == v.Spec.Hostname {\n\t\t\t\t\tprovider.Hostname = v.Spec.Hostname\n\t\t\t\t\tprovider.ReadReplicaHostnames = v.Spec.ReadReplicaHostnames\n\t\t\t\t\tprovider.Username = v.Spec.Username\n\t\t\t\t\tprovider.Password = v.Spec.Password\n\t\t\t\t\tprovider.Port = v.Spec.Port\n\t\t\t\t\tprovider.Name = v.ObjectMeta.Name\n\t\t\t\t\tprovider.Namespace = v.ObjectMeta.Namespace\n\t\t\t\t\tprovider.Type = v.Spec.Type\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors.New(\"No suitable usable database servers\")\n}", "title": "" }, { "docid": "642c3725dcd4cb8e5e6dfc8d87c8a6a8", "score": "0.43072367", "text": "func (ms *MonitorServer) CheckAllNodesRegistered(args *monitorproto.RegisterArgs, reply *monitorproto.RegisterReply) bool {\n\treply.Ready = false\n\t// If all storage nodes are registered, set ready status to true\n\tif ms.storageCnt >= ms.numstorage {\n\t\treply.Ready = true\n\t\ttargetNode := args.NodeInfo\n\t\tswitch targetNode.Type {\n\t\tcase monitorproto.STORAGE:\n\n\t\tcase monitorproto.BRIDGE:\n\t\t\t// reply.list of storages\n\t\t\tnewStorageMap := make(map[uint32] string)\n\t\t\tfor currentHP := range(ms.servers) {\n\t\t\t\ttargetServer := ms.servers[currentHP]\n\t\t\t\tif targetServer.Type == monitorproto.STORAGE {\n\t\t\t\t\tnewStorageMap[targetServer.ID] = targetServer.Hostport\n\t\t\t\t}\n\t\t\t}\n\t\t\treply.StorageMap = newStorageMap\n\t\t}\n\t}\n\treturn reply.Ready\n}", "title": "" }, { "docid": "a138ed1ef72ac53ed4c1e48454d743e8", "score": "0.43037695", "text": "func checkServers() {\n\tfor server, _ := range Servers {\n\t\tstatus := server.Ping()\n\t\tif Debug {\n\t\t\tInfoLog.Printf(\"Mail Server: %s status: %t\\n\", server.GetName(), status)\n\t\t}\n\t\tServers[server] = status\n\t}\n}", "title": "" }, { "docid": "8577905667629010b58e7ad0d499ddae", "score": "0.43031457", "text": "func UpdateUptimeChecks(ctx context.Context, c *Config) error {\n\thosts := []string{}\n\thosts = append(hosts, ExtraHosts...)\n\tfor _, s := range sites.All {\n\t\thosts = append(hosts, s.Host)\n\t}\n\tsort.Strings(hosts)\n\n\texistingChecks, err := c.list(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"list checks\")\n\t}\n\tcheckHostMap := map[string]string{}\n\n\tfor _, check := range existingChecks {\n\t\tmr := check.GetMonitoredResource()\n\t\thost := mr.Labels[\"host\"]\n\t\tcheckHostMap[host] = check.Name\n\t}\n\tc.Log.WithFields(logrus.Fields{\n\t\t\"hosts\": hosts,\n\t\t\"existing-checks\": checkHostMap,\n\t}).Debug(\"hosts to check\")\n\n\thostConfigMap := map[string]*monitoringpb.UptimeCheckConfig{}\n\tfor _, host := range hosts {\n\n\t\tif val, ok := checkHostMap[host]; ok {\n\t\t\tcfg, err := c.update(ctx, host, val)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"update check %s\", host)\n\t\t\t}\n\n\t\t\tc.Log.WithFields(logrus.Fields{\"job\": \"uptime\", \"host\": host}).Debug(\"updated uptime check\")\n\t\t\thostConfigMap[host] = cfg\n\t\t} else {\n\t\t\tcfg, err := c.create(ctx, host)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"create check %s\", host)\n\t\t\t}\n\n\t\t\tc.Log.WithFields(logrus.Fields{\"job\": \"uptime\", \"host\": host}).Debug(\"created uptime check\")\n\t\t\thostConfigMap[host] = cfg\n\t\t}\n\t}\n\n\tc.Log.WithFields(logrus.Fields{\"hosts\": hostConfigMap}).Debugf(\"uptime configs\")\n\n\treturn nil\n}", "title": "" }, { "docid": "03e15b800eaa2d39579d25f24975140c", "score": "0.43030864", "text": "func (c *cluster) refreshHealthHosts(host Host) {\n\tif host.Health() {\n\t\tlog.Println(\"Add health host to cluster's healthHostSet by refreshHealthHosts:\", host.AddressString())\n\t\taddHealthyHost(c.prioritySet.hostSets, host)\n\t} else {\n\t\tlog.Println(\"Del host from cluster's healthHostSet by refreshHealthHosts:\", host.AddressString())\n\t\tdelHealthHost(c.prioritySet.hostSets, host)\n\t}\n}", "title": "" }, { "docid": "b14142d187742700822a66195ebc086a", "score": "0.4298159", "text": "func shouldAllowHost(host string, acceptedHosts []string) bool {\n\tif dashstrings.Contains(\"0.0.0.0\", acceptedHosts) {\n\t\treturn true\n\t}\n\treturn dashstrings.Contains(host, acceptedHosts)\n}", "title": "" }, { "docid": "2735291e0f3d7b3d905af9e4ffc5c49f", "score": "0.42951882", "text": "func TestGetReachableHosts(t *testing.T) {\n\tvar testMap = map[string]map[string]string{}\n\n\ttestMap[\"google\"] = map[string]string{}\n\ttestMap[\"unresolveable\"] = map[string]string{}\n\ttestMap[\"badport\"] = map[string]string{}\n\n\ttestMap[\"google\"][\"ID\"] = \"google\"\n\ttestMap[\"google\"][\"ADDRESS\"] = \"www.google.com\"\n\ttestMap[\"google\"][\"PORT\"] = \"80\"\n\n\ttestMap[\"unresolveable\"][\"ID\"] = \"unresolveable\"\n\ttestMap[\"unresolveable\"][\"ADDRESS\"] = \"unreasolvable.name.garbagetld\"\n\ttestMap[\"unresolveable\"][\"PORT\"] = \"80\"\n\n\ttestMap[\"badport\"][\"ID\"] = \"badport\"\n\ttestMap[\"badport\"][\"ADDRESS\"] = \"www.google.com\"\n\ttestMap[\"badport\"][\"PORT\"] = \"40444\"\n\n\tres, ok := GetReachableHosts(testMap)\n\tif len(res) != 1 {\n\t\tt.Fail()\n\t}\n\tif ok {\n\t\tt.Fail()\n\t}\n\n}", "title": "" }, { "docid": "f37eda93e64f5829d42468ab8f716015", "score": "0.4290769", "text": "func RcpthostList() (hosts []core.RcptHost, err error) {\n\treturn core.RcpthostGetAll()\n}", "title": "" }, { "docid": "e9f08c1ebf2d0865684f1be4ea8a32c1", "score": "0.428265", "text": "func (o *VirtualizationBaseDatastoreClusterAllOf) GetHostCountOk() (*int64, bool) {\n\tif o == nil || o.HostCount == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HostCount, true\n}", "title": "" }, { "docid": "e8fe47d35124c1d5b77c9615bc2cdc27", "score": "0.427518", "text": "func ensureCharterContentRevisions(newsroomAddr common.Address, newsroom *contract.NewsroomContract,\n\tpersister *persistence.PostgresPersister, wetRun bool) error {\n\trevs, err := newsroom.RevisionCount(&bind.CallOpts{}, big.NewInt(0))\n\tif err != nil {\n\t\tfmt.Printf(\"err c: %v\", err)\n\t\treturn err\n\t}\n\n\tcrevs, err := persister.ContentRevisionsByCriteria(&model.ContentRevisionCriteria{\n\t\tListingAddress: newsroomAddr.Hex(),\n\t})\n\tif err != nil {\n\t\tfmt.Printf(\"err e: %v\", err)\n\t\treturn err\n\t}\n\n\trevMap := map[int]*model.ContentRevision{}\n\tfor ind, crev := range crevs {\n\t\trevMap[ind] = crev\n\t}\n\n\tfor i := 0; i < int(revs.Int64()); i++ {\n\t\t_, ok := revMap[i]\n\t\tif !ok {\n\t\t\trev, err := newsroom.GetRevision(&bind.CallOpts{}, big.NewInt(0), big.NewInt(int64(i)))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"err d: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcontentHash := cbytes.Byte32ToHexString(rev.ContentHash)\n\t\t\trevision := model.NewContentRevision(\n\t\t\t\tnewsroomAddr,\n\t\t\t\tmodel.ArticlePayload{},\n\t\t\t\tcontentHash,\n\t\t\t\trev.Author,\n\t\t\t\tbig.NewInt(0),\n\t\t\t\tbig.NewInt(int64(i)),\n\t\t\t\trev.Uri,\n\t\t\t\trev.Timestamp.Int64(),\n\t\t\t)\n\n\t\t\tfmt.Printf(\n\t\t\t\t\"add missing revision:\\naddr: %v\\nuri: %v\\nts: %v\\ncontentid: %v\\nrevid: %v\\n\",\n\t\t\t\tnewsroomAddr.Hex(),\n\t\t\t\trevision.RevisionURI(),\n\t\t\t\trevision.RevisionDateTs(),\n\t\t\t\trevision.ContractContentID(),\n\t\t\t\trevision.ContractRevisionID(),\n\t\t\t)\n\t\t\tif wetRun {\n\t\t\t\terr = persister.CreateContentRevision(revision)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"WetRun = false, did not update in db\\n\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "88b504186da8f51a6c62ec3b31858423", "score": "0.4268412", "text": "func (o *HyperflexHxapDvswitchAllOf) GetMemberHostsOk() (*[]HyperflexHxapHostRelationship, bool) {\n\tif o == nil || o.MemberHosts == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.MemberHosts, true\n}", "title": "" }, { "docid": "0e1f106709dbbed11fb8a851246864c4", "score": "0.42657375", "text": "func (hdb *HostDB) ActiveHosts(tree string) (activeHosts []modules.HostDBEntry) {\n\tallHosts := hdb.hostTrees.All(tree)\n\tfor _, entry := range allHosts {\n\t\tif len(entry.ScanHistory) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif !entry.ScanHistory[len(entry.ScanHistory)-1].Success {\n\t\t\tcontinue\n\t\t}\n\t\tif !entry.AcceptingContracts {\n\t\t\tcontinue\n\t\t}\n\t\tactiveHosts = append(activeHosts, entry)\n\t}\n\treturn activeHosts\n}", "title": "" }, { "docid": "d1c6f2f1bd9fa70b63de8b96d9001a90", "score": "0.4262363", "text": "func (o *VirtualizationBaseDatastoreClusterAllOf) HasHostCount() bool {\n\tif o != nil && o.HostCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e53af87b7f6a8d861d2fc3c0c867acf3", "score": "0.42610916", "text": "func (h *HostHandler) getHosts(ctx *gin.Context) {\n\thosts, err := h.HostService.Hosts()\n\tif err == pub.ErrHostSetEmpty {\n\t\tError(ctx, err, http.StatusNotFound, nil)\n\t} else if err != nil {\n\t\tError(ctx, err, http.StatusInternalServerError, h.Logger)\n\t} else {\n\t\tctx.IndentedJSON(http.StatusOK, hosts)\n\t}\n}", "title": "" }, { "docid": "8bf8dac89d36ddaefe8ee54b14a176eb", "score": "0.42588133", "text": "func findHostnames() {\n\treg := regexp.MustCompile(`[A-z0-9\\.\\-%]+\\.` + PROJECT_NAME)\n\tfor _, v := range reg.FindAllString(RESULTS.Pages, -1) {\n\t\tuniq(&RESULTS.HostNames, v)\n\t}\n}", "title": "" }, { "docid": "68f0f48b31bf325dbf3a6a0f903c246e", "score": "0.42585033", "text": "func (td *SendgridDataSource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {\n\n var status = backend.HealthStatusOk\n var message = \"Data source is working\"\n\n configBytes, _ := req.PluginContext.DataSourceInstanceSettings.JSONData.MarshalJSON()\n var config SendgridPluginConfig\n err := json.Unmarshal(configBytes, &config)\n if err != nil {\n log.DefaultLogger.Error(fmt.Sprintf(\"Cannot get healthcheck query : %s\", err.Error()))\n status = backend.HealthStatusError\n message = \"Unable to contact Sendgrid\"\n }\n\n td.sendgridApiKey = config.SendgridAPIKey\n\tfrom := time.Now().UTC().Add(-24*time.Hour)\n to := time.Now().UTC()\n\n _, err = td.querySendGrid(from, to)\n if err != nil {\n log.DefaultLogger.Error(fmt.Sprintf(\"Cannot query sendgrid for healthcheck: %s\", err.Error()))\n status = backend.HealthStatusError\n message = \"Unable to contact Sendgrid\"\n }\n\n\treturn &backend.CheckHealthResult{\n\t\tStatus: status,\n\t\tMessage: message,\n\t}, nil\n}", "title": "" } ]
76909943fa242755f38b65cd48101dda
RegisterHandlers registers HTTP handlers for firmware transparency endpoints.
[ { "docid": "2bebb9e3e5b1c532a3c085fb520ddff1", "score": "0.6680098", "text": "func (s *Server) RegisterHandlers(r *mux.Router) {\n\tr.HandleFunc(fmt.Sprintf(\"/%s\", api.HTTPAddFirmware), s.addFirmware).Methods(\"POST\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s\", api.HTTPAddAnnotationMalware), s.addAnnotationMalware).Methods(\"POST\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/from/{from:[0-9]+}/to/{to:[0-9]+}\", api.HTTPGetConsistency), s.getConsistency).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/for-leaf-hash/{hash}/in-tree-of/{treesize:[0-9]+}\", api.HTTPGetInclusion), s.getInclusionByHash).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/at/{index:[0-9]+}/in-tree-of/{treesize:[0-9]+}\", api.HTTPGetManifestEntryAndProof), s.getManifestEntryAndProof).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s/with-hash/{hash}\", api.HTTPGetFirmwareImage), s.getFirmwareImage).Methods(\"GET\")\n\tr.HandleFunc(fmt.Sprintf(\"/%s\", api.HTTPGetRoot), s.getRoot).Methods(\"GET\")\n}", "title": "" } ]
[ { "docid": "137ff970f95dd6e650ee53aee9dca2e4", "score": "0.67071", "text": "func registerAPIHandlers(api *rest.APISurface) http.Handler {\n\trouter := mux.NewRouter()\n\tif api.EnableCORS {\n\t\trouter.Methods(\"OPTIONS\").HandlerFunc(api.OptionsHandler)\n\t}\n\trouter.HandleFunc(\"/v2/catalog\", api.GetCatalogHandler).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}/last_operation\", api.LastOperationHandler).Methods(\"GET\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}\", api.ProvisionHandler).Methods(\"PUT\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}\", api.DeprovisionHandler).Methods(\"DELETE\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}\", api.UpdateHandler).Methods(\"PATCH\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}/service_bindings/{binding_id}\", api.BindHandler).Methods(\"PUT\")\n\trouter.HandleFunc(\"/v2/service_instances/{instance_id}/service_bindings/{binding_id}\", api.UnbindHandler).Methods(\"DELETE\")\n\treturn router\n}", "title": "" }, { "docid": "6cdf966e529d14038a56aeef89c5e40e", "score": "0.6591924", "text": "func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger) {\n\tres := resource{service, logger}\n\n\tr.Get(\"/<code>\", res.get)\n}", "title": "" }, { "docid": "5dabe79d02ec4083e3a6772c4bd0fae3", "score": "0.6525991", "text": "func (api *API) registerHTTPHandlers() {\n\n\t// WS UPGRADE\n\tapi.registerHTTPHandler(\"/ws\", api.wsUpgradeHandler)\n\n\t// GET /login\n\tapi.registerHTTPHandler(\"/oauth/login\", api.discordAuthFE.HandlerInit)\n\n\t// GET /login/authorize\n\tapi.registerHTTPHandler(\"/login/authorize\", api.discordAuthFE.HandlerCallback)\n\n\t// GET /logout\n\tapi.registerHTTPHandler(\"/logout\", api.logoutHandler)\n\n\t/////////////\n\t// REST API\n\n\t// GET /token\n\tapi.registerHTTPHandler(\"/token\", api.discordAuthAPI.HandlerInit)\n\n\t// GET /token/authorize\n\tapi.registerHTTPHandler(\"/token/authorize\", api.discordAuthAPI.HandlerCallback)\n\n\t// GET /api/localsounds\n\tapi.registerHTTPHandler(\"/api/localsounds\", api.restGetLocalSounds)\n\n\t// GET /api/logs/:GUILDID\n\tapi.registerHTTPHandler(\"/api/logs/\", api.restGetLogs)\n\n\t// GET /api/stats/:GUILDID\n\tapi.registerHTTPHandler(\"/api/stats/\", api.restGetStats)\n\n\t// GET /api/favorites\n\tapi.registerHTTPHandler(\"/api/favorites\", api.restGetFavorites)\n\n\t// POST /api/favorites/:SOUND\n\t// DELETE /api/favorites/:SOUND\n\tapi.registerHTTPHandler(\"/api/favorites/\", api.restPostDeleteFavorites)\n\n\t// GET /api/settings/fasttrigger\n\t// POST /api/settings/fasttrigger\n\tapi.registerHTTPHandler(\"/api/settings/fasttrigger\", api.restSettingFastTrigger)\n\n\t// GET /api/admin/stats\n\tapi.registerHTTPHandler(\"/api/admin/stats\", api.restGetAdminStats)\n\n\t// GET /api/admin/soundstats\n\tapi.registerHTTPHandler(\"/api/admin/soundstats\", api.restGetAdminSoundStats)\n\n\t// POST /api/admin/restart\n\tapi.registerHTTPHandler(\"/api/admin/restart\", api.restPostAdminRestart)\n\n\t// POST /api/admin/refetch\n\tapi.registerHTTPHandler(\"/api/admin/refetch\", api.restPostAdminRefetch)\n\n\t// POST /api/admin/refetch\n\tapi.registerHTTPHandler(\"/api/info\", api.restGetInfo)\n\n\t// Static File Server\n\tapi.registerHTTPHandler(\"/\", api.fileHandler)\n}", "title": "" }, { "docid": "4034832e8c0174f36136cd4611e8891f", "score": "0.64844984", "text": "func (s *HTTPServer) registerHandlers(serviceProvider string, enableDebug bool) {\n\n\t// NOTE - The curried func (due to wrap) is set as mux handler\n\t// NOTE - The original handler is passed as a func to the wrap method\n\ts.mux.HandleFunc(\"/latest/meta-data/\", s.wrap(s.MetaSpecificRequest))\n\n\t// Can be a GET, PUT, or POST.\n\t// Handler has the intelligence to cater to various http methods.\n\ts.mux.HandleFunc(\"/latest/volumes/\", s.wrap(s.VolumesRequest))\n\n\t// A particular volume specific request is handled here\n\ts.mux.HandleFunc(\"/latest/volume/\", s.wrap(s.VolumeSpecificRequest))\n}", "title": "" }, { "docid": "ef52c71d853264bc63ead1540249bd99", "score": "0.63031036", "text": "func RegisterHandlers(ctx context.Context, svc FacebookFriendsService, serverOpts *kitworker.ServerOption, logger log.Logger) {\n\thttp.Handle(NewCreateHandler(ctx, svc, serverOpts, logger))\n\thttp.Handle(NewDeleteHandler(ctx, svc, serverOpts, logger))\n\thttp.Handle(NewMutualsHandler(ctx, svc, serverOpts, logger))\n\thttp.Handle(NewOneHandler(ctx, svc, serverOpts, logger))\n}", "title": "" }, { "docid": "deb831f2e471763c35385a474fe3c5e7", "score": "0.62815136", "text": "func registerHandlers() {\n\thttp.HandleFunc(\"/\", makeHandler(indexHandler))\n\thttp.HandleFunc(\"/view/\", makeHandler(viewHandler))\n\thttp.HandleFunc(\"/edit/\", makeHandler(editHandler))\n\thttp.HandleFunc(\"/save/\", makeHandler(saveHandler))\n\thttp.HandleFunc(\"/styles/\", makeHandler(styleHandler))\n\thttp.HandleFunc(\"/favicon.ico\", makeHandler(faviconHandler))\n\thttp.HandleFunc(\"/error/\", makeHandler(errorHandler))\n}", "title": "" }, { "docid": "db9f6993164f905c6da606ba0d24f9c0", "score": "0.615656", "text": "func RegisterHandlers() {\n\tr := &Router{}\n\tr.getRoutes()\n\n\trouter := mux.NewRouter().StrictSlash(true)\n\tfor _, route := range r.routes {\n\t\thandler := route.HandlerFunc\n\n\t\trouter.\n\t\t\tMethods(route.Method).\n\t\t\tPath(route.Pattern).\n\t\t\tName(route.Name).\n\t\t\tHandler(handler)\n\t}\n\n\tc := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"https://frank.gairal.com\", \"http://frank.gairal.com\", \"http://localhost:3000\"},\n\t})\n\n\thandler := c.Handler(router)\n\n\thttp.Handle(\"/\", handlers.CombinedLoggingHandler(os.Stderr, handler))\n}", "title": "" }, { "docid": "4084ee525ffab8291949b0250ee135fa", "score": "0.61509895", "text": "func (s *server) registerHandlers() {\n\thttpMux := http.NewServeMux()\n\tmetricsMux := http.NewServeMux()\n\n\t// Register the default notFoundHandler, statusCodeHandler, healthz with the main http server\n\thttpMux.HandleFunc(\"/\", s.notFoundHandler())\n\t// enable shutdown handler only for non-prod environments\n\tif *isProd == false {\n\t\thttpMux.HandleFunc(\"/shutdown\", s.shutdownHandler())\n\t}\n\thttpMux.HandleFunc(statusCodePrefix, s.statusCodeHandler())\n\thttpMux.HandleFunc(\"/healthz\", s.healthzHandler())\n\n\t// Register the healthz and metrics handlers with the metrics server\n\tmetricsMux.Handle(\"/metrics\", promhttp.Handler())\n\n\ts.mux = httpMux\n\ts.httpServer.Handler = httpMux\n\ts.metricsServer.Handler = metricsMux\n}", "title": "" }, { "docid": "92f893b9c896fb00549fd7ecf6ce6ab7", "score": "0.6136533", "text": "func AddHandlers(\n\tsettingsFile string,\n\tswanAccess Access,\n\tswiftAccess swift.Access,\n\towidAccess owid.Access,\n\thtmlTemplate string,\n\tmalformedHandler func(w http.ResponseWriter, r *http.Request)) error {\n\n\t// Create the new set of services.\n\ts := newServices(settingsFile, swanAccess, swiftAccess, owidAccess)\n\n\t// Add the SWIFT handlers.\n\tswift.AddHandlers(s.swift, malformedHandler)\n\n\t// Add the OWID handlers.\n\towid.AddHandlers(s.owid)\n\n\t// Add the SWAN handlers.\n\thttp.HandleFunc(\"/swan/api/v1/fetch\", handlerFetch(s))\n\thttp.HandleFunc(\"/swan/api/v1/update\", handlerUpdate(s))\n\thttp.HandleFunc(\"/swan/api/v1/decode-as-json\", handlerDecodeAsJSON(s))\n\thttp.HandleFunc(\"/swan/api/v1/create-offer-id\", handlerCreateOfferID(s))\n\th, err := handlerCapture(s, htmlTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\thttp.HandleFunc(\"/swan/preferences/\", h)\n\treturn nil\n}", "title": "" }, { "docid": "c6c07e890a3b21e378d02d1d7905993c", "score": "0.60934174", "text": "func RegisterHandlers(clientCtx client.Context, r *mux.Router) {\n\tdr := rest.WithHTTPDeprecationHeaders(r)\n\tregisterQueryRoutes(clientCtx, dr)\n\tregisterTxHandlers(clientCtx, dr)\n\n}", "title": "" }, { "docid": "c6c07e890a3b21e378d02d1d7905993c", "score": "0.60934174", "text": "func RegisterHandlers(clientCtx client.Context, r *mux.Router) {\n\tdr := rest.WithHTTPDeprecationHeaders(r)\n\tregisterQueryRoutes(clientCtx, dr)\n\tregisterTxHandlers(clientCtx, dr)\n\n}", "title": "" }, { "docid": "4ea1221e752ec29f86180c9eeb7a974d", "score": "0.6087929", "text": "func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler,\n\tlogger log.Logger) {\n\tres := resource{service, logger}\n\n\tr.Get(\"/books/<id>\", res.get)\n\tr.Get(\"/books\", res.query)\n\n\tr.Use(authHandler)\n\n\t// the following endpoints requires a valid JWT\n\tr.Post(\"/books\", res.create)\n\tr.Put(\"/books/<id>\", res.update)\n\tr.Delete(\"/books/<id>\", res.delete)\n}", "title": "" }, { "docid": "7da3c88d228510707bb0e0d05677d003", "score": "0.60314596", "text": "func RegisterHTTPHandlers(http *http.ServeMux) {\n\thttp.Handle(\"/metrics\", promhttp.Handler())\n}", "title": "" }, { "docid": "e3b65d1a31c8f13d14262294c7be1a67", "score": "0.60112286", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []Handler{\n\t\tsupport.NewHTTPHandler(login, http.MethodGet, c.login),\n\t\tsupport.NewHTTPHandler(getCreditScore, http.MethodGet, c.getCreditScore),\n\t\tsupport.NewHTTPHandler(callback, http.MethodGet, c.callback),\n\n\t\t// chapi\n\t\tsupport.NewHTTPHandler(revoke, http.MethodPost, c.revokeVC),\n\t\tsupport.NewHTTPHandler(generate, http.MethodPost, c.generateVC),\n\n\t\t// didcomm\n\t\tsupport.NewHTTPHandler(didcommToken, http.MethodPost, c.didcommTokenHandler),\n\t\tsupport.NewHTTPHandler(didcommCallback, http.MethodGet, c.didcommCallbackHandler),\n\t\tsupport.NewHTTPHandler(didcommCredential, http.MethodPost, c.didcommCredentialHandler),\n\t\tsupport.NewHTTPHandler(didcommAssuranceData, http.MethodPost, c.didcommAssuraceHandler),\n\n\t\t// oidc\n\t\tsupport.NewHTTPHandler(oauth2GetRequestPath, http.MethodGet, c.createOIDCRequest),\n\t\tsupport.NewHTTPHandler(oauth2CallbackPath, http.MethodGet, c.handleOIDCCallback),\n\t}\n}", "title": "" }, { "docid": "a0eb6769b5512b801f7d151b3589ef01", "score": "0.60031116", "text": "func RegisterHandlers(r *routing.RouteGroup, service Service, logger log.Logger) {\n\tres := resource{service, logger}\n\n\tr.Post(\"/idea\", res.create)\n\tr.Get(\"/idea/<id>\", res.get)\n\tr.Put(\"/idea/<id>\", res.update)\n\tr.Delete(\"/idea/<id>\", res.delete)\n\tr.Post(\"/getIdeas\", res.query)\n\tr.Post(\"/voteAnIdea\", res.vote)\n}", "title": "" }, { "docid": "0214aaa2685c048eafd0412be588382c", "score": "0.5987399", "text": "func (a *authenticator) RegisterHandlers(router *mux.Router) {\n\tadd := func(r *mux.Route) {\n\t\tpath, err := r.URLPath()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\ta.urlPaths = append(a.urlPaths, path.Path)\n\t}\n\n\tadd(router.HandleFunc(login, a.loginHandler).Methods(http.MethodGet, http.MethodPost))\n\tadd(router.HandleFunc(authenticate, a.authenticationHandler).Methods(http.MethodPost))\n\tadd(router.HandleFunc(logout, a.logoutHandler).Methods(http.MethodPost))\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "5be0520c6bff072b8277f45832696876", "score": "0.5975745", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\tRegisterHandlersWithBaseURL(router, si, \"\")\n}", "title": "" }, { "docid": "7002a72054bf0ed53c06e18264a148f9", "score": "0.5963213", "text": "func (env *Env) RegisterHandlers(router *mux.Router) {\n\t// /hello -- ping and hello\n\trouter.HandleFunc(\"/hello\", env.helloHandler).Methods(\"GET\")\n\n\t// /auth -- authentication / OAuth flow\n\trouter.HandleFunc(\"/auth/login\", env.authLoginHandler).Methods(\"GET\")\n\trouter.HandleFunc(\"/auth/redirect\", env.authGithubCallbackHandler).Methods(\"GET\")\n\n\t// /admin -- administrative actions\n\trouter.HandleFunc(\"/admin/db\", env.validateTokenMiddleware(env.adminDBHandler)).Methods(\"POST\")\n\n\t// /users -- user data\n\trouter.HandleFunc(\"/users\", env.validateTokenMiddleware(env.usersHandler)).Methods(\"GET\", \"POST\")\n\trouter.HandleFunc(\"/users/{id:[0-9]+}\", env.validateTokenMiddleware(env.usersOneHandler)).Methods(\"GET\", \"PUT\")\n\n\t// /projects -- project data\n\trouter.HandleFunc(\"/projects\", env.validateTokenMiddleware(env.projectsHandler)).Methods(\"GET\", \"POST\")\n\trouter.HandleFunc(\"/projects/{id:[0-9]+}\", env.validateTokenMiddleware(env.projectsOneHandler)).Methods(\"GET\", \"PUT\", \"DELETE\")\n\t// and subprojects within a project\n\trouter.HandleFunc(\"/projects/{id:[0-9]+}/subprojects\", env.validateTokenMiddleware(env.subprojectsSubHandler)).Methods(\"GET\", \"POST\")\n\n\t// /subprojects -- subproject data\n\trouter.HandleFunc(\"/subprojects\", env.validateTokenMiddleware(env.subprojectsHandler)).Methods(\"GET\", \"POST\")\n\trouter.HandleFunc(\"/subprojects/{id:[0-9]+}\", env.validateTokenMiddleware(env.subprojectsOneHandler)).Methods(\"GET\", \"PUT\", \"DELETE\")\n\t// and repos within a subproject\n\trouter.HandleFunc(\"/subprojects/{id:[0-9]+}/repos\", env.validateTokenMiddleware(env.reposSubHandler)).Methods(\"GET\", \"POST\")\n\n\t// /repos -- repo data\n\trouter.HandleFunc(\"/repos\", env.validateTokenMiddleware(env.reposHandler)).Methods(\"GET\", \"POST\")\n\trouter.HandleFunc(\"/repos/{id:[0-9]+}\", env.validateTokenMiddleware(env.reposOneHandler)).Methods(\"GET\", \"PUT\", \"DELETE\")\n\t// and a repo's branches\n\trouter.HandleFunc(\"/repos/{id:[0-9]+}/branches\", env.validateTokenMiddleware(env.repoBranchesSubHandler)).Methods(\"GET\", \"POST\")\n\t// and a specific branch, to POST a new repo pull\n\t// FIXME the pattern here does not sync with the various rules for branch naming in git\n\trouter.HandleFunc(`/repos/{id:[0-9]+}/branches/{branch:[0-9a-zA-Z_\\-\\.]+}`, env.validateTokenMiddleware(env.repoPullsSubHandler)).Methods(\"GET\", \"POST\")\n\n\t// /repopulls -- repo pull data\n\trouter.HandleFunc(\"/repopulls/{id:[0-9]+}\", env.validateTokenMiddleware(env.repoPullsOneHandler)).Methods(\"GET\", \"DELETE\")\n\t// and a repopull's jobs\n\trouter.HandleFunc(\"/repopulls/{id:[0-9]+}/jobs\", env.validateTokenMiddleware(env.jobsSubHandler)).Methods(\"GET\", \"POST\")\n\n\t// /agents -- registered peridot agents\n\trouter.HandleFunc(\"/agents\", env.validateTokenMiddleware(env.agentsHandler)).Methods(\"GET\", \"POST\")\n\trouter.HandleFunc(\"/agents/{id:[0-9]+}\", env.validateTokenMiddleware(env.agentsOneHandler)).Methods(\"GET\", \"PUT\", \"DELETE\")\n\n\t// /jobs -- job data\n\trouter.HandleFunc(\"/jobs/{id:[0-9]+}\", env.validateTokenMiddleware(env.jobsOneHandler)).Methods(\"GET\", \"PUT\", \"DELETE\")\n}", "title": "" }, { "docid": "84c302fa4d1faed30fa339984ab860cd", "score": "0.59501624", "text": "func (p *Plugin) registerHTTPHandler(key, method string, f func() (interface{}, error)) {\n\thandlerFunc := func(formatter *render.Render) http.HandlerFunc {\n\t\treturn func(w http.ResponseWriter, req *http.Request) {\n\n\t\t\tres, err := f()\n\t\t\tif err != nil {\n\t\t\t\terrMsg := fmt.Sprintf(\"500 Internal server error: request failed: %v\\n\", err)\n\t\t\t\tp.Log.Error(errMsg)\n\t\t\t\tp.logError(formatter.JSON(w, http.StatusInternalServerError, errMsg))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.Deps.Log.Debugf(\"Rest uri: %s, data: %v\", key, res)\n\t\t\tp.logError(formatter.JSON(w, http.StatusOK, res))\n\t\t}\n\t}\n\tp.HTTPHandlers.RegisterHTTPHandler(key, handlerFunc, method)\n}", "title": "" }, { "docid": "a308c3ce4c9cb2ad1e74a76a9828c4c5", "score": "0.5946175", "text": "func RegisterHandlers(r *routing.RouteGroup, service UserService, logger log.Logger) {\n\tres := resource{service, logger}\n\n\tr.Get(\"/user/<email>\", res.get)\n\tr.Post(\"/user\", res.create)\n\tr.Put(\"/user/<email>\", res.update)\n\tr.Delete(\"/user/<email>\", res.delete)\n\tr.Post(\"/userSignup/<email>/<code>\", res.UserSignUp)\n\tr.Get(\"/userEmailConfirm/<email>/<code>\", res.AuthenticateUser)\n}", "title": "" }, { "docid": "567844ae33b697a45032f5e5467cea30", "score": "0.59446704", "text": "func RegisterHandlers(r pure.IRouteGroup) {\n\tlog.Println(\"Registering Task module API handlers...\")\n\n\tr.Post(\"\", taskNew)\n\tr.Get(\"\", tasksGet)\n\n\tt := r.Group(\"/:task\")\n\tt.Get(\"\", taskGet)\n}", "title": "" }, { "docid": "2a5817a71adcd6256a87b4309782e185", "score": "0.5930274", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []Handler{\n\t\tsupport.NewHTTPHandler(createVaultEndpoint, http.MethodPost, c.createDataVaultHandler),\n\t\tsupport.NewHTTPHandler(createDocumentEndpoint, http.MethodPost, c.createDocumentHandler),\n\t\tsupport.NewHTTPHandler(readDocumentEndpoint, http.MethodGet, c.readDocumentHandler),\n\t}\n}", "title": "" }, { "docid": "9513c4d808d52a31ea28f42e79bb0613", "score": "0.5925668", "text": "func RegisterHanders(router *httptreemux.TreeMux) {\n\trouter.MethodNotAllowedHandler = func(w http.ResponseWriter, r *http.Request, _ map[string]httptreemux.HandlerFunc) {\n\t\tviews.RenderErrorResponse(w, r, session.NotFoundError(r.Context()))\n\t}\n\trouter.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) {\n\t\tviews.RenderErrorResponse(w, r, session.NotFoundError(r.Context()))\n\t}\n\trouter.PanicHandler = func(w http.ResponseWriter, r *http.Request, rcv interface{}) {\n\t\terr, _ := rcv.(error)\n\t\tviews.RenderErrorResponse(w, r, session.ServerError(r.Context(), err))\n\t}\n}", "title": "" }, { "docid": "bba3cb7c521ee6be34ca13c85b8dc6cb", "score": "0.5921342", "text": "func (s *Server) createHTTPHandlers(ctx context.Context, configuration *config.RuntimeConfiguration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) {\n\tserviceManager := service.NewManager(configuration.Services, s.defaultRoundTripper)\n\tmiddlewaresBuilder := middleware.NewBuilder(configuration.Middlewares, serviceManager)\n\tresponseModifierFactory := responsemodifiers.NewBuilder(configuration.Middlewares)\n\trouterManager := router.NewManager(configuration, serviceManager, middlewaresBuilder, responseModifierFactory)\n\n\thandlersNonTLS := routerManager.BuildHandlers(ctx, entryPoints, false)\n\thandlersTLS := routerManager.BuildHandlers(ctx, entryPoints, true)\n\n\trouterHandlers := make(map[string]http.Handler)\n\tfor _, entryPointName := range entryPoints {\n\t\tinternalMuxRouter := mux.NewRouter().SkipClean(true)\n\n\t\tctx = log.With(ctx, log.Str(log.EntryPointName, entryPointName))\n\n\t\tfactory := s.entryPointsTCP[entryPointName].RouteAppenderFactory\n\t\tif factory != nil {\n\t\t\t// FIXME remove currentConfigurations\n\t\t\tappender := factory.NewAppender(ctx, middlewaresBuilder, configuration)\n\t\t\tappender.Append(internalMuxRouter)\n\t\t}\n\n\t\tif h, ok := handlersNonTLS[entryPointName]; ok {\n\t\t\tinternalMuxRouter.NotFoundHandler = h\n\t\t} else {\n\t\t\tinternalMuxRouter.NotFoundHandler = buildDefaultHTTPRouter()\n\t\t}\n\n\t\trouterHandlers[entryPointName] = internalMuxRouter\n\n\t\tchain := alice.New()\n\n\t\tif s.accessLoggerMiddleware != nil {\n\t\t\tchain = chain.Append(accesslog.WrapHandler(s.accessLoggerMiddleware))\n\t\t}\n\n\t\tif s.tracer != nil {\n\t\t\tchain = chain.Append(tracing.WrapEntryPointHandler(ctx, s.tracer, entryPointName))\n\t\t}\n\n\t\tchain = chain.Append(requestdecorator.WrapHandler(s.requestDecorator))\n\n\t\thandler, err := chain.Then(internalMuxRouter.NotFoundHandler)\n\t\tif err != nil {\n\t\t\tlog.FromContext(ctx).Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tinternalMuxRouter.NotFoundHandler = handler\n\n\t\thandlerTLS, ok := handlersTLS[entryPointName]\n\t\tif ok {\n\t\t\thandlerTLSWithMiddlewares, err := chain.Then(handlerTLS)\n\t\t\tif err != nil {\n\t\t\t\tlog.FromContext(ctx).Error(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thandlersTLS[entryPointName] = handlerTLSWithMiddlewares\n\t\t}\n\t}\n\n\treturn routerHandlers, handlersTLS\n}", "title": "" }, { "docid": "69772b96c4b98ed8c66b8cf9700e1496", "score": "0.59160405", "text": "func registerLockRESTHandlers(router *mux.Router, endpointZones EndpointZones) {\n\tqueries := restQueries(lockRESTUID, lockRESTSource, lockRESTResource)\n\tfor _, ep := range endpointZones {\n\t\tfor _, endpoint := range ep.Endpoints {\n\t\t\tif !endpoint.IsLocal {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlockServer := &lockRESTServer{\n\t\t\t\tll: newLocker(endpoint),\n\t\t\t}\n\n\t\t\tsubrouter := router.PathPrefix(path.Join(lockRESTPrefix, endpoint.Path)).Subrouter()\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodLock).HandlerFunc(httpTraceHdrs(lockServer.LockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodRLock).HandlerFunc(httpTraceHdrs(lockServer.RLockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodUnlock).HandlerFunc(httpTraceHdrs(lockServer.UnlockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodRUnlock).HandlerFunc(httpTraceHdrs(lockServer.RUnlockHandler)).Queries(queries...)\n\n\t\t\tglobalLockServers[endpoint] = lockServer.ll\n\t\t}\n\t}\n\n\t// If none of the routes match add default error handler routes\n\trouter.NotFoundHandler = http.HandlerFunc(httpTraceAll(errorResponseHandler))\n\trouter.MethodNotAllowedHandler = http.HandlerFunc(httpTraceAll(errorResponseHandler))\n}", "title": "" }, { "docid": "945309ab07f9f40923e80d4b9b5c64ab", "score": "0.59085757", "text": "func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *baseapp.AuthMiddleware) {\n\t// note: add ee override methods first\n\n\t// routes available only in ee version\n\trouter.HandleFunc(\"/api/v1/licenses\",\n\t\tam.AdminAccess(ah.listLicenses)).\n\t\tMethods(http.MethodGet)\n\n\trouter.HandleFunc(\"/api/v1/licenses\",\n\t\tam.AdminAccess(ah.applyLicense)).\n\t\tMethods(http.MethodPost)\n\n\trouter.HandleFunc(\"/api/v1/featureFlags\",\n\t\tam.OpenAccess(ah.getFeatureFlags)).\n\t\tMethods(http.MethodGet)\n\n\trouter.HandleFunc(\"/api/v1/loginPrecheck\",\n\t\tam.OpenAccess(ah.precheckLogin)).\n\t\tMethods(http.MethodGet)\n\n\t// paid plans specific routes\n\trouter.HandleFunc(\"/api/v1/complete/saml\",\n\t\tam.OpenAccess(ah.receiveSAML)).\n\t\tMethods(http.MethodPost)\n\n\trouter.HandleFunc(\"/api/v1/complete/google\",\n\t\tam.OpenAccess(ah.receiveGoogleAuth)).\n\t\tMethods(http.MethodGet)\n\n\trouter.HandleFunc(\"/api/v1/orgs/{orgId}/domains\",\n\t\tam.AdminAccess(ah.listDomainsByOrg)).\n\t\tMethods(http.MethodGet)\n\n\trouter.HandleFunc(\"/api/v1/domains\",\n\t\tam.AdminAccess(ah.postDomain)).\n\t\tMethods(http.MethodPost)\n\n\trouter.HandleFunc(\"/api/v1/domains/{id}\",\n\t\tam.AdminAccess(ah.putDomain)).\n\t\tMethods(http.MethodPut)\n\n\trouter.HandleFunc(\"/api/v1/domains/{id}\",\n\t\tam.AdminAccess(ah.deleteDomain)).\n\t\tMethods(http.MethodDelete)\n\n\t// base overrides\n\trouter.HandleFunc(\"/api/v1/version\", am.OpenAccess(ah.getVersion)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/api/v1/invite/{token}\", am.OpenAccess(ah.getInvite)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/api/v1/register\", am.OpenAccess(ah.registerUser)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/api/v1/login\", am.OpenAccess(ah.loginUser)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/api/v1/traces/{traceId}\", am.ViewAccess(ah.searchTraces)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/api/v2/metrics/query_range\", am.ViewAccess(ah.queryRangeMetricsV2)).Methods(http.MethodPost)\n\n\t// PAT APIs\n\trouter.HandleFunc(\"/api/v1/pat\", am.OpenAccess(ah.createPAT)).Methods(http.MethodPost)\n\trouter.HandleFunc(\"/api/v1/pat\", am.OpenAccess(ah.getPATs)).Methods(http.MethodGet)\n\trouter.HandleFunc(\"/api/v1/pat/{id}\", am.OpenAccess(ah.deletePAT)).Methods(http.MethodDelete)\n\n\tah.APIHandler.RegisterRoutes(router, am)\n\n}", "title": "" }, { "docid": "7cc0356448ef7beafab5f3496ca7871c", "score": "0.58856344", "text": "func RegisterAutomationHandlers(r *mux.Router, s *Server) {\n\tr.HandleFunc(\"/v1/automations\", apiAutomationHandler(s.system)).Methods(\"GET\")\n\tr.HandleFunc(\"/v1/automations/{ID}/test\", apiAutomationTestHandler(s.system)).Methods(\"POST\")\n}", "title": "" }, { "docid": "d1fb8f60d32a537c5e3c37f5ca1c194a", "score": "0.58743733", "text": "func RegisterHandlers(r *mux.Router, opts *HandlerOpts) {\n\t// If true, this would only panic at boot time, static nil checks anyone?\n\tif opts == nil || opts.Protocol == nil || opts.Logger == nil {\n\t\tpanic(\"absolutely unacceptable handler opts\")\n\t}\n\n\tr.Handle(PathPut, LogEntryHandler(Put, opts)).Methods(http.MethodPut)\n\tr.Handle(PathGet, LogEntryHandler(Get, opts)).Methods(http.MethodGet)\n\tr.Handle(PathDel, LogEntryHandler(Del, opts)).Methods(http.MethodDelete)\n\tr.Handle(PathList, LogEntryHandler(List, opts)).Methods(http.MethodGet)\n\tr.Handle(PathExists, LogEntryHandler(Exists, opts)).Methods(http.MethodGet)\n}", "title": "" }, { "docid": "bef73db881c5215c9870b783426c0f0b", "score": "0.5864199", "text": "func RegisterHandlers(router runtime.EchoRouter, si ServerInterface) {\n\n}", "title": "" }, { "docid": "d6076c5fd932efb633165be60fcbca7e", "score": "0.5839706", "text": "func (svc Service) RegisterHTTPServices(ctx context.Context, mux *mux.Router, addr string, opts []grpc.DialOption, jwtMiddleware *jwtmiddleware.JWTMiddleware) {\n\t// get server mux\n\tgwmux := runtime.NewServeMux()\n\terr := pb.RegisterProfileHandlerFromEndpoint(ctx, gwmux, addr, opts)\n\tif err != nil {\n\t\tlog.Fatalf(\"RegisterGRPCGateway error : %s\\n\", err)\n\t}\n\n\t// prometheus instrument handler\n\tinstrf := prometheus.InstrumentHandlerFunc\n\n\t// HTTP/1.1 routes\n\t// status handler\n\tmux.\n\t\tHandleFunc(\"/status\", instrf(\"Http.Status\", controller.Status))\n\n\tmux.\n\t\tHandleFunc(\"/version\", instrf(\"Http.Version\", controller.Version))\n\n\tmux.\n\t\tHandleFunc(\"/\", instrf(\"Http.Root\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\t// The \"/\" pattern matches everything not matched by previous handlers\n\t\t\tfmt.Fprintf(w, \"%s-%s OK\", svc.Name, svc.Version)\n\t\t}))\n\n\t// swagger doc handler\n\tmux.\n\t\tPathPrefix(\"/api/v1/swagger.json\").\n\t\tHandler(instrf(\"Api.Swagger\", controller.Swagger))\n\n\t// to declare an authenticated handler do something like this\n\t// if jwtMiddleware == nil {\n\t// mux.\n\t// PathPrefix(\"/<URL>\").\n\t// Handler(instrf(\"<METRICS_KEY>\", controller.<HTTP_HANDLER>))\n\t// } else {\n\t// mux.\n\t// PathPrefix(\"/<URL>\").\n\t// Handler(negroni.New(\n\t// negroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t// negroni.Wrap(instrf(\"<METRICS_KEY>\", controller.<HTTP_HANDLER>)),\n\t// ))\n\t// }\n\n\t// it's not necessary to use secure middleware for gRPC calls\n\t// api gateway handlers with metrics instrumentations\n\trouteMap := map[string]string{\n\t\t\"/api/v1/services/status\": \"Api.ServicesStatus\",\n\t\t\"/api/v1/create\": \"Api.Create\",\n\t\t\"/api/v1/read\": \"Api.Read\",\n\t\t\"/api/v1/list\": \"Api.List\",\n\t\t\"/api/v1/update\": \"Api.Update\",\n\t\t\"/api/v1/soft_delete\": \"Api.SoftDelete\",\n\t\t\"/api/v1/hard_delete\": \"Api.HardDelete\",\n\t\t\"/api/v1/version\": \"Api.Version\",\n\t}\n\tfor route, label := range routeMap {\n\t\tmux.PathPrefix(route).Handler(instrf(label, gwmux.ServeHTTP))\n\t}\n\n\t// prometheus metrics handler\n\tmux.\n\t\tHandle(\"/metrics\", prometheus.Handler())\n}", "title": "" }, { "docid": "013f87f40bde12439f97ce4dcf8b4354", "score": "0.58257073", "text": "func RegisterHandlers(r chi.Router) {\n\tr.Get(\"/health\", Check)\n}", "title": "" }, { "docid": "faba2fb16ec2913a82d79ec59c1a6fca", "score": "0.58192796", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []operation.Handler{\n\t\tsupport.NewHTTPHandler(createInvitationPath, http.MethodGet, c.CreateInvitation),\n\t\tsupport.NewHTTPHandler(receiveInvtiationPath, http.MethodPost, c.ReceiveInvitation),\n\t\tsupport.NewHTTPHandler(acceptInvitationPath, http.MethodGet, c.AcceptInvitation),\n\t}\n}", "title": "" }, { "docid": "44f5d823c22bc582471243056b9d9dce", "score": "0.5807183", "text": "func RegisterHTTPProbes(r *mux.Router, c conditions) {\n\tr.HandleFunc(\"/alive\", conditionHandler(c.IsAlive)).Methods(http.MethodGet)\n\tr.HandleFunc(\"/ready\", conditionHandler(c.IsReady)).Methods(http.MethodGet)\n}", "title": "" }, { "docid": "0f01305146be0665dae51ccfe2d8d6b3", "score": "0.5804206", "text": "func SetupHandlers(router *http.ServeMux, app aedmz.AppContext) {\n\t// Namespace can be letters, numbers and '-'.\n\t// Do not enforce a length limit to support different hashing algorithm. This\n\t// should represent a valid hex value.\n\tnamespace := \"{namespace:[a-z0-9A-Z\\\\-]+}\"\n\thashKey := \"{hashkey:[a-f0-9]{4,}}\"\n\tnamespaceHash := namespace + \"/\" + hashKey\n\n\t// Route through Gorilla mux for native regexp and named route support.\n\tr := mux.NewRouter()\n\t{\n\t\tcontent := r.PathPrefix(\"/content-gs\").Subrouter()\n\t\thandle(content, \"/handshake\", \"handshake\", handshakeHandler, \"POST\")\n\t\thandle(content, \"/pre-upload/\"+namespace, \"pre-upload\", ACL(preUploadContentHandler), \"POST\")\n\t\thandle(content, \"/retrieve/\"+namespaceHash, \"retrieve\", ACL(retrieveContentHandler), \"GET\", \"HEAD\")\n\t\thandle(content, \"/store/\"+namespaceHash, \"store\", ACL(storeContentHandler), \"POST\", \"PUT\")\n\t}\n\thandle(r, \"/internal/taskqueue/verify/\"+namespaceHash, \"\", internalVerifyWorkerHandler, \"POST\")\n\thandle(r, \"/_ah/warmup\", \"\", warmUpHandler, \"GET\")\n\thandle(r, \"/\", \"root\", rootHandler, \"GET\")\n\n\th := app.InjectContext(r.ServeHTTP)\n\n\t// Set our router as the sole handler to 'router'.\n\trouter.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n\t\tgorillaContext.Set(req, routerKey, r)\n\t\th.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "3fbc90aeb1af8d53c06cae25e414258f", "score": "0.57980186", "text": "func (impl *repoImpl) InstallHandlers(r *router.Router, base router.MiddlewareChain) {\n\tr.GET(\"/client\", base, adaptGrpcErr(impl.handleClientBootstrap))\n\tr.GET(\"/dl/*path\", base, adaptGrpcErr(impl.handlePackageDownload))\n\tr.GET(\"/bootstrap/*path\", base, adaptGrpcErr(impl.handleBootstrapDownload))\n\n\tr.GET(\"/_ah/api/repo/v1/client\", base, adaptGrpcErr(impl.handleLegacyClientInfo))\n\tr.GET(\"/_ah/api/repo/v1/instance\", base, adaptGrpcErr(impl.handleLegacyInstance))\n\tr.GET(\"/_ah/api/repo/v1/instance/resolve\", base, adaptGrpcErr(impl.handleLegacyResolve))\n\n\t// All other legacy endpoints (/_ah/api/repo/v1/*) just return an error asking\n\t// the client to update.\n\tr.NotFound(base, func(ctx *router.Context) {\n\t\tif strings.HasPrefix(ctx.Request.URL.Path, \"/_ah/api/repo/v1/\") {\n\t\t\t// Note: can't use http.Error here because it appends '\\n' that renders\n\t\t\t// ugly by the client.\n\t\t\tctx.Writer.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\t\t\tctx.Writer.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\tfmt.Fprintf(ctx.Writer, \"This version of CIPD client is no longer supported, please upgrade\")\n\t\t} else {\n\t\t\thttp.Error(ctx.Writer, \"No such page\", http.StatusNotFound)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "48f82122b84fcc31dcbc4bc27149beeb", "score": "0.57806104", "text": "func prepHandlers(){\n http.HandleFunc(\"/\", RootHandler)\n http.HandleFunc(\"/signup\", SignUpHandler)\n}", "title": "" }, { "docid": "44ce157f49f42f8b820c3c7d3d6a99e5", "score": "0.57669365", "text": "func SetupHandlers() {\n\thttp.HandleFunc(\"/annotate\", Annotate)\n\thttp.HandleFunc(\"/batch_annotate\", BatchAnnotate)\n\tgo waitForDownloaderMessages()\n}", "title": "" }, { "docid": "ac1f23f5f61ce29ac55180e337da26f0", "score": "0.57598597", "text": "func RegisterHandlers(router runtime.EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(\"/pets\", wrapper.FindPets)\n\trouter.POST(\"/pets\", wrapper.AddPet)\n\trouter.DELETE(\"/pets/:id\", wrapper.DeletePet)\n\trouter.GET(\"/pets/:id\", wrapper.FindPetById)\n\n}", "title": "" }, { "docid": "d1851b6ab7faaff18ab2c29769cdcfef", "score": "0.5756846", "text": "func RegisterHandlers(router EchoRouter, si ServerInterface) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(\"/organizations\", wrapper.Create)\n\trouter.DELETE(\"/organizations/:organizationId\", wrapper.Delete)\n\trouter.GET(\"/organizations/:organizationId\", wrapper.Get)\n\trouter.PUT(\"/organizations/:organizationId\", wrapper.Update)\n\trouter.GET(\"/organizations/:organizationId/activity\", wrapper.Activity1)\n\trouter.GET(\"/organizations/:organizationId/apis\", wrapper.ListApis1)\n\trouter.POST(\"/organizations/:organizationId/apis\", wrapper.CreateApi1)\n\trouter.DELETE(\"/organizations/:organizationId/apis/:apiId\", wrapper.DeleteApi1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId\", wrapper.GetApi1)\n\trouter.PUT(\"/organizations/:organizationId/apis/:apiId\", wrapper.UpdateApi1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/activity\", wrapper.GetApiActivity1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions\", wrapper.ListApiVersions1)\n\trouter.POST(\"/organizations/:organizationId/apis/:apiId/versions\", wrapper.CreateApiVersion1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version\", wrapper.GetApiVersion1)\n\trouter.PUT(\"/organizations/:organizationId/apis/:apiId/versions/:version\", wrapper.UpdateApiVersion1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/activity\", wrapper.GetApiVersionActivity1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/contracts\", wrapper.GetApiVersionContracts1)\n\trouter.DELETE(\"/organizations/:organizationId/apis/:apiId/versions/:version/definition\", wrapper.DeleteApiDefinition1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/definition\", wrapper.GetApiDefinition1)\n\trouter.POST(\"/organizations/:organizationId/apis/:apiId/versions/:version/definition\", wrapper.UpdateApiDefinitionFromURL1)\n\trouter.PUT(\"/organizations/:organizationId/apis/:apiId/versions/:version/definition\", wrapper.UpdateApiDefinition1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/endpoint\", wrapper.GetApiVersionEndpointInfo1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/clientResponseStats\", wrapper.GetResponseStatsPerClient1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/clientUsage\", wrapper.GetUsagePerClient1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/planResponseStats\", wrapper.GetResponseStatsPerPlan1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/planUsage\", wrapper.GetUsagePerPlan1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/responseStats\", wrapper.GetResponseStats1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/summaryResponseStats\", wrapper.GetResponseStatsSummary1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/metrics/usage\", wrapper.GetUsage1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/plans\", wrapper.GetApiVersionPlans1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/plans/:planId/policyChain\", wrapper.GetApiPolicyChain1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/policies\", wrapper.ListApiPolicies1)\n\trouter.POST(\"/organizations/:organizationId/apis/:apiId/versions/:version/policies\", wrapper.CreateApiPolicy1)\n\trouter.DELETE(\"/organizations/:organizationId/apis/:apiId/versions/:version/policies/:policyId\", wrapper.DeleteApiPolicy1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/policies/:policyId\", wrapper.GetApiPolicy1)\n\trouter.PUT(\"/organizations/:organizationId/apis/:apiId/versions/:version/policies/:policyId\", wrapper.UpdateApiPolicy1)\n\trouter.POST(\"/organizations/:organizationId/apis/:apiId/versions/:version/reorderPolicies\", wrapper.ReorderApiPolicies1)\n\trouter.GET(\"/organizations/:organizationId/apis/:apiId/versions/:version/status\", wrapper.GetApiVersionStatus1)\n\trouter.GET(\"/organizations/:organizationId/clients\", wrapper.ListClients1)\n\trouter.POST(\"/organizations/:organizationId/clients\", wrapper.CreateClient1)\n\trouter.DELETE(\"/organizations/:organizationId/clients/:clientId\", wrapper.DeleteClient1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId\", wrapper.GetClient1)\n\trouter.PUT(\"/organizations/:organizationId/clients/:clientId\", wrapper.UpdateClient1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/activity\", wrapper.GetClientActivity1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions\", wrapper.ListClientVersions1)\n\trouter.POST(\"/organizations/:organizationId/clients/:clientId/versions\", wrapper.CreateClientVersion1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version\", wrapper.GetClientVersion1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/activity\", wrapper.GetClientVersionActivity1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/apikey\", wrapper.GetClientApiKey1)\n\trouter.PUT(\"/organizations/:organizationId/clients/:clientId/versions/:version/apikey\", wrapper.UpdateClientApiKey1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/apiregistry/json\", wrapper.GetApiRegistryJSON1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/apiregistry/xml\", wrapper.GetApiRegistryXML1)\n\trouter.DELETE(\"/organizations/:organizationId/clients/:clientId/versions/:version/contracts\", wrapper.DeleteAllContracts1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/contracts\", wrapper.GetClientVersionContracts1)\n\trouter.POST(\"/organizations/:organizationId/clients/:clientId/versions/:version/contracts\", wrapper.CreateContract1)\n\trouter.DELETE(\"/organizations/:organizationId/clients/:clientId/versions/:version/contracts/:contractId\", wrapper.DeleteContract1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/contracts/:contractId\", wrapper.GetContract1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/metrics/apiUsage\", wrapper.GetClientUsagePerApi1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/policies\", wrapper.ListClientPolicies1)\n\trouter.POST(\"/organizations/:organizationId/clients/:clientId/versions/:version/policies\", wrapper.CreateClientPolicy1)\n\trouter.DELETE(\"/organizations/:organizationId/clients/:clientId/versions/:version/policies/:policyId\", wrapper.DeleteClientPolicy1)\n\trouter.GET(\"/organizations/:organizationId/clients/:clientId/versions/:version/policies/:policyId\", wrapper.GetClientPolicy1)\n\trouter.PUT(\"/organizations/:organizationId/clients/:clientId/versions/:version/policies/:policyId\", wrapper.UpdateClientPolicy1)\n\trouter.POST(\"/organizations/:organizationId/clients/:clientId/versions/:version/reorderPolicies\", wrapper.ReorderClientPolicies1)\n\trouter.GET(\"/organizations/:organizationId/members\", wrapper.ListMembers1)\n\trouter.DELETE(\"/organizations/:organizationId/members/:userId\", wrapper.RevokeAll1)\n\trouter.GET(\"/organizations/:organizationId/plans\", wrapper.ListPlans1)\n\trouter.POST(\"/organizations/:organizationId/plans\", wrapper.CreatePlan1)\n\trouter.DELETE(\"/organizations/:organizationId/plans/:planId\", wrapper.DeletePlan1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId\", wrapper.GetPlan1)\n\trouter.PUT(\"/organizations/:organizationId/plans/:planId\", wrapper.UpdatePlan1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/activity\", wrapper.GetPlanActivity1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/versions\", wrapper.ListPlanVersions1)\n\trouter.POST(\"/organizations/:organizationId/plans/:planId/versions\", wrapper.CreatePlanVersion1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/versions/:version\", wrapper.GetPlanVersion1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/versions/:version/activity\", wrapper.GetPlanVersionActivity1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/versions/:version/policies\", wrapper.ListPlanPolicies1)\n\trouter.POST(\"/organizations/:organizationId/plans/:planId/versions/:version/policies\", wrapper.CreatePlanPolicy1)\n\trouter.DELETE(\"/organizations/:organizationId/plans/:planId/versions/:version/policies/:policyId\", wrapper.DeletePlanPolicy1)\n\trouter.GET(\"/organizations/:organizationId/plans/:planId/versions/:version/policies/:policyId\", wrapper.GetPlanPolicy1)\n\trouter.PUT(\"/organizations/:organizationId/plans/:planId/versions/:version/policies/:policyId\", wrapper.UpdatePlanPolicy1)\n\trouter.POST(\"/organizations/:organizationId/plans/:planId/versions/:version/reorderPolicies\", wrapper.ReorderPlanPolicies1)\n\trouter.POST(\"/organizations/:organizationId/roles\", wrapper.Grant1)\n\trouter.DELETE(\"/organizations/:organizationId/roles/:roleId/:userId\", wrapper.Revoke1)\n\n}", "title": "" }, { "docid": "94cdbf80482527e0970046a9fb046d6a", "score": "0.57300025", "text": "func (monitor *Monitor) initHTTPHandlers() {\n\thttp.Handle(\"/api/stats.json\", jsonResponse(monitor.renderStats))\n\n\thttp.HandleFunc(\"/\", func(writer http.ResponseWriter, request *http.Request) {\n\t\twriter.Write([]byte(\"<a href='api/stats.json'>stats_json</a>\"))\n\t})\n}", "title": "" }, { "docid": "247b126c38a2e35514084805943fafe3", "score": "0.5726913", "text": "func Serve(handlers *types.FaaSHandlers, config *types.FaaSConfig) {\n\n\tif config.EnableBasicAuth {\n\t\treader := auth.ReadBasicAuthFromDisk{\n\t\t\tSecretMountPath: config.SecretMountPath,\n\t\t}\n\n\t\tcredentials, err := reader.Read()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\thandlers.FunctionLister = auth.DecorateWithBasicAuth(handlers.FunctionLister, credentials)\n\t\thandlers.DeployFunction = auth.DecorateWithBasicAuth(handlers.DeployFunction, credentials)\n\t\thandlers.DeleteFunction = auth.DecorateWithBasicAuth(handlers.DeleteFunction, credentials)\n\t\thandlers.UpdateFunction = auth.DecorateWithBasicAuth(handlers.UpdateFunction, credentials)\n\t\thandlers.FunctionStatus = auth.DecorateWithBasicAuth(handlers.FunctionStatus, credentials)\n\t\thandlers.ScaleFunction = auth.DecorateWithBasicAuth(handlers.ScaleFunction, credentials)\n\t\thandlers.Info = auth.DecorateWithBasicAuth(handlers.Info, credentials)\n\t\thandlers.Secrets = auth.DecorateWithBasicAuth(handlers.Secrets, credentials)\n\t\thandlers.Logs = auth.DecorateWithBasicAuth(handlers.Logs, credentials)\n\t}\n\n\thm := newHttpMetrics()\n\n\t// System (auth) endpoints\n\tr.HandleFunc(\"/system/functions\", hm.InstrumentHandler(handlers.FunctionLister, \"\")).Methods(http.MethodGet)\n\tr.HandleFunc(\"/system/functions\", hm.InstrumentHandler(handlers.DeployFunction, \"\")).Methods(http.MethodPost)\n\tr.HandleFunc(\"/system/functions\", hm.InstrumentHandler(handlers.DeleteFunction, \"\")).Methods(http.MethodDelete)\n\tr.HandleFunc(\"/system/functions\", hm.InstrumentHandler(handlers.UpdateFunction, \"\")).Methods(http.MethodPut)\n\n\tr.HandleFunc(\"/system/function/{name:[\"+NameExpression+\"]+}\",\n\t\thm.InstrumentHandler(handlers.FunctionStatus, \"/system/function\")).Methods(http.MethodGet)\n\tr.HandleFunc(\"/system/scale-function/{name:[\"+NameExpression+\"]+}\",\n\t\thm.InstrumentHandler(handlers.ScaleFunction, \"/system/scale-function\")).Methods(http.MethodPost)\n\n\tr.HandleFunc(\"/system/info\",\n\t\thm.InstrumentHandler(handlers.Info, \"\")).Methods(http.MethodGet)\n\n\tr.HandleFunc(\"/system/secrets\",\n\t\thm.InstrumentHandler(handlers.Secrets, \"\")).Methods(http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete)\n\n\tr.HandleFunc(\"/system/logs\",\n\t\thm.InstrumentHandler(handlers.Logs, \"\")).Methods(http.MethodGet)\n\n\tr.HandleFunc(\"/system/namespaces\", hm.InstrumentHandler(handlers.ListNamespaces, \"\")).Methods(http.MethodGet)\n\n\t// Only register the mutate namespace handler if it is defined\n\tif handlers.MutateNamespace != nil {\n\t\tr.HandleFunc(\"/system/namespace/{name:[\"+NameExpression+\"]*}\",\n\t\t\thm.InstrumentHandler(handlers.MutateNamespace, \"\")).Methods(http.MethodPost, http.MethodDelete, http.MethodPut, http.MethodGet)\n\t} else {\n\t\tr.HandleFunc(\"/system/namespace/{name:[\"+NameExpression+\"]*}\",\n\t\t\thm.InstrumentHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\thttp.Error(w, \"Feature not implemented in this version of OpenFaaS\", http.StatusNotImplemented)\n\t\t\t}), \"\")).Methods(http.MethodGet)\n\t}\n\n\tproxyHandler := handlers.FunctionProxy\n\n\t// Open endpoints\n\tr.HandleFunc(\"/function/{name:[\"+NameExpression+\"]+}\", proxyHandler)\n\tr.HandleFunc(\"/function/{name:[\"+NameExpression+\"]+}/\", proxyHandler)\n\tr.HandleFunc(\"/function/{name:[\"+NameExpression+\"]+}/{params:.*}\", proxyHandler)\n\n\tif handlers.Health != nil {\n\t\tr.HandleFunc(\"/healthz\", handlers.Health).Methods(http.MethodGet)\n\t}\n\n\tr.HandleFunc(\"/metrics\", promhttp.Handler().ServeHTTP)\n\n\treadTimeout := config.ReadTimeout\n\twriteTimeout := config.WriteTimeout\n\n\tport := 8080\n\tif config.TCPPort != nil {\n\t\tport = *config.TCPPort\n\t}\n\n\ts := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tReadTimeout: readTimeout,\n\t\tWriteTimeout: writeTimeout,\n\t\tMaxHeaderBytes: http.DefaultMaxHeaderBytes, // 1MB - can be overridden by setting Server.MaxHeaderBytes.\n\t\tHandler: r,\n\t}\n\n\tlog.Fatal(s.ListenAndServe())\n}", "title": "" }, { "docid": "8423adb8872cca24538ce184346dab87", "score": "0.57173496", "text": "func (s *HTTPd) RegisterSiteHandlers(site site.API, cache *util.Cache) {\n\trouter := s.Server.Handler.(*mux.Router)\n\n\t// api\n\tapi := router.PathPrefix(\"/api\").Subrouter()\n\tapi.Use(jsonHandler)\n\tapi.Use(handlers.CompressHandler)\n\tapi.Use(handlers.CORS(\n\t\thandlers.AllowedHeaders([]string{\"Content-Type\"}),\n\t))\n\n\t// site api\n\troutes := map[string]route{\n\t\t\"health\": {[]string{\"GET\"}, \"/health\", healthHandler(site)},\n\t\t\"state\": {[]string{\"GET\"}, \"/state\", stateHandler(cache)},\n\t\t\"config\": {[]string{\"GET\"}, \"/config/templates/{class:[a-z]+}\", templatesHandler},\n\t\t\"products\": {[]string{\"GET\"}, \"/config/products/{class:[a-z]+}\", productsHandler},\n\t\t\"device\": {[]string{\"GET\"}, \"/config/devices/{class:[a-z]+}/{id:[0-9.]+}\", deviceHandler},\n\t\t\"devices\": {[]string{\"GET\"}, \"/config/devices/{class:[a-z]+}\", devicesHandler},\n\t\t\"newdevice\": {[]string{\"POST\", \"OPTIONS\"}, \"/config/devices/{class:[a-z]+}\", newDeviceHandler},\n\t\t\"updatedevice\": {[]string{\"PUT\", \"OPTIONS\"}, \"/config/devices/{class:[a-z]+}/{id:[0-9.]+}\", updateDeviceHandler},\n\t\t\"deletedevice\": {[]string{\"DELETE\", \"OPTIONS\"}, \"/config/devices/{class:[a-z]+}/{id:[0-9.]+}\", deleteDeviceHandler},\n\t\t\"testconfig\": {[]string{\"POST\", \"OPTIONS\"}, \"/config/test/{class:[a-z]+}\", testHandler},\n\t\t\"testdevice\": {[]string{\"POST\", \"OPTIONS\"}, \"/config/test/{class:[a-z]+}/{id:[0-9.]+}\", testHandler},\n\t\t\"buffersoc\": {[]string{\"POST\", \"OPTIONS\"}, \"/buffersoc/{value:[0-9.]+}\", floatHandler(site.SetBufferSoc, site.GetBufferSoc)},\n\t\t\"bufferstartsoc\": {[]string{\"POST\", \"OPTIONS\"}, \"/bufferstartsoc/{value:[0-9.]+}\", floatHandler(site.SetBufferStartSoc, site.GetBufferStartSoc)},\n\t\t\"prioritysoc\": {[]string{\"POST\", \"OPTIONS\"}, \"/prioritysoc/{value:[0-9.]+}\", floatHandler(site.SetPrioritySoc, site.GetPrioritySoc)},\n\t\t\"residualpower\": {[]string{\"POST\", \"OPTIONS\"}, \"/residualpower/{value:[-0-9.]+}\", floatHandler(site.SetResidualPower, site.GetResidualPower)},\n\t\t\"smartcost\": {[]string{\"POST\", \"OPTIONS\"}, \"/smartcostlimit/{value:[-0-9.]+}\", floatHandler(site.SetSmartCostLimit, site.GetSmartCostLimit)},\n\t\t\"tariff\": {[]string{\"GET\"}, \"/tariff/{tariff:[a-z]+}\", tariffHandler(site)},\n\t\t\"sessions\": {[]string{\"GET\"}, \"/sessions\", sessionHandler},\n\t\t\"session1\": {[]string{\"PUT\", \"OPTIONS\"}, \"/session/{id:[0-9]+}\", updateSessionHandler},\n\t\t\"session2\": {[]string{\"DELETE\", \"OPTIONS\"}, \"/session/{id:[0-9]+}\", deleteSessionHandler},\n\t\t\"telemetry\": {[]string{\"GET\"}, \"/settings/telemetry\", boolGetHandler(telemetry.Enabled)},\n\t\t\"telemetry2\": {[]string{\"POST\", \"OPTIONS\"}, \"/settings/telemetry/{value:[a-z]+}\", boolHandler(telemetry.Enable, telemetry.Enabled)},\n\t}\n\n\tfor _, r := range routes {\n\t\tapi.Methods(r.Methods...).Path(r.Pattern).Handler(r.HandlerFunc)\n\t}\n\n\t// loadpoint api\n\tfor id, lp := range site.Loadpoints() {\n\t\tloadpoint := api.PathPrefix(fmt.Sprintf(\"/loadpoints/%d\", id+1)).Subrouter()\n\n\t\troutes := map[string]route{\n\t\t\t\"mode\": {[]string{\"POST\", \"OPTIONS\"}, \"/mode/{value:[a-z]+}\", chargeModeHandler(lp)},\n\t\t\t\"minsoc\": {[]string{\"POST\", \"OPTIONS\"}, \"/minsoc/{value:[0-9]+}\", intHandler(pass(lp.SetMinSoc), lp.GetMinSoc)},\n\t\t\t\"mincurrent\": {[]string{\"POST\", \"OPTIONS\"}, \"/mincurrent/{value:[0-9.]+}\", floatHandler(pass(lp.SetMinCurrent), lp.GetMinCurrent)},\n\t\t\t\"maxcurrent\": {[]string{\"POST\", \"OPTIONS\"}, \"/maxcurrent/{value:[0-9.]+}\", floatHandler(pass(lp.SetMaxCurrent), lp.GetMaxCurrent)},\n\t\t\t\"phases\": {[]string{\"POST\", \"OPTIONS\"}, \"/phases/{value:[0-9]+}\", phasesHandler(lp)},\n\t\t\t\"targetenergy\": {[]string{\"POST\", \"OPTIONS\"}, \"/target/energy/{value:[0-9.]+}\", floatHandler(pass(lp.SetTargetEnergy), lp.GetTargetEnergy)},\n\t\t\t\"targetsoc\": {[]string{\"POST\", \"OPTIONS\"}, \"/target/soc/{value:[0-9]+}\", intHandler(pass(lp.SetTargetSoc), lp.GetTargetSoc)},\n\t\t\t\"targettime\": {[]string{\"POST\", \"OPTIONS\"}, \"/target/time/{time:[0-9TZ:.-]+}\", targetTimeHandler(lp)},\n\t\t\t\"targettime2\": {[]string{\"DELETE\", \"OPTIONS\"}, \"/target/time\", targetTimeRemoveHandler(lp)},\n\t\t\t\"plan\": {[]string{\"GET\"}, \"/target/plan\", planHandler(lp)},\n\t\t\t\"vehicle\": {[]string{\"POST\", \"OPTIONS\"}, \"/vehicle/{vehicle:[1-9][0-9]*}\", vehicleHandler(site, lp)},\n\t\t\t\"vehicle2\": {[]string{\"DELETE\", \"OPTIONS\"}, \"/vehicle\", vehicleRemoveHandler(lp)},\n\t\t\t\"vehicleDetect\": {[]string{\"PATCH\", \"OPTIONS\"}, \"/vehicle\", vehicleDetectHandler(lp)},\n\t\t\t\"remotedemand\": {[]string{\"POST\", \"OPTIONS\"}, \"/remotedemand/{demand:[a-z]+}/{source::[0-9a-zA-Z_-]+}\", remoteDemandHandler(lp)},\n\t\t\t\"enableThreshold\": {[]string{\"POST\", \"OPTIONS\"}, \"/enable/threshold/{value:-?[0-9.]+}\", floatHandler(pass(lp.SetEnableThreshold), lp.GetEnableThreshold)},\n\t\t\t\"disableThreshold\": {[]string{\"POST\", \"OPTIONS\"}, \"/disable/threshold/{value:-?[0-9.]+}\", floatHandler(pass(lp.SetDisableThreshold), lp.GetDisableThreshold)},\n\t\t}\n\n\t\tfor _, r := range routes {\n\t\t\tloadpoint.Methods(r.Methods...).Path(r.Pattern).Handler(r.HandlerFunc)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b18cccce323cf02ec5016b152a154802", "score": "0.5715203", "text": "func (h *Handler) AddRoutes(apply func(m, p string, h http.Handler, mws ...func(http.Handler) http.Handler)) {\n\tapply(http.MethodPost, \"data\", newDataHandler(h.Devices))\n\tapply(http.MethodGet, \"\", newClientHandler(h.indexFile), basicAuth(h.Username, h.Password))\n}", "title": "" }, { "docid": "390a4c817f60cfc6f0f960f60c8ac805", "score": "0.5678738", "text": "func MakeHttpHandler(ctx context.Context, endpoints endpts.SkAdminEndpoints, zipkinTracer *gozipkin.Tracer, logger log.Logger) http.Handler {\n\tr := mux.NewRouter()\n\tzipkinServer := zipkin.HTTPServerTrace(zipkinTracer, zipkin.Name(\"http-transport\"))\n\n\toptions := []kithttp.ServerOption{\n\t\t//kithttp.ServerErrorLogger(logger),\n\t\tkithttp.ServerErrorHandler(transport.NewLogErrorHandler(logger)),\n\t\t//kithttp.ServerErrorEncoder(kithttp.DefaultErrorEncoder),\n\t\tkithttp.ServerErrorEncoder(encodeError),\n\t\tzipkinServer,\n\t}\n\n\tr.Methods(\"GET\").Path(\"/product/list\").Handler(kithttp.NewServer(\n\t\tendpoints.GetProductEndpoint,\n\t\tdecodeGetListRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/product/create\").Handler(kithttp.NewServer(\n\t\tendpoints.GetProductEndpoint,\n\t\tdecodeCreateProductCheckRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/activity/create\").Handler(kithttp.NewServer(\n\t\tendpoints.CreateActivityEndpoint,\n\t\tdecodeCreateActivityCheckRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/activity/list\").Handler(kithttp.NewServer(\n\t\tendpoints.GetActivityEndpoint,\n\t\tdecodeGetListRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tr.Path(\"/metrics\").Handler(promhttp.Handler())\n\n\t// create health check handler\n\tr.Methods(\"GET\").Path(\"/health\").Handler(kithttp.NewServer(\n\t\tendpoints.HealthCheckEndpoint,\n\t\tdecodeHealthCheckRequest,\n\t\tencodeResponse,\n\t\toptions...,\n\t))\n\n\tloggedRouter := handlers.LoggingHandler(os.Stdout, r)\n\n\treturn loggedRouter\n}", "title": "" }, { "docid": "78bdcc691cc11762a658ab37495901dd", "score": "0.56755173", "text": "func RegisterRoutes(h http.HandlerAcceptor) {\n\th.HandleFunc(\"/debug/requests\", Traces)\n\th.HandleFunc(\"/debug/events\", Events)\n}", "title": "" }, { "docid": "338ee9cf387148f7f38a56a9f6f31e89", "score": "0.5674984", "text": "func RegisterHandlers(r *mux.Router) {\n\tr.StrictSlash(true)\n\n\t// feed routes\n\tr.HandleFunc(\"/feeds/\", controller.FetchAllFeeds).Methods(\"GET\")\n\tr.HandleFunc(\"/feeds/\", controller.CreateFeed).Methods(\"POST\")\n\tr.HandleFunc(\"/feeds/{id}\", controller.FetchSingleFeed).Methods(\"GET\")\n\tr.HandleFunc(\"/feeds/{id}\", controller.UpdateFeed).Methods(\"PUT\")\n\t//r.HandleFunc(\"/feeds/{id}/feedEntries\", controller.FetchAllFeedEntries).Methods(\"GET\")\n}", "title": "" }, { "docid": "3c91ca76eaca997830ee3bde92a29a76", "score": "0.5671488", "text": "func registerRoutes(conf *Config, proxy *httputil.ReverseProxy) {\n\t// handle all requests read + write\n\tif conf.EnableWrite {\n\t\thttp.HandleFunc(\"/\", handleRequest(conf, proxy))\n\t\treturn\n\t}\n\n\t// white-listed read-only routes handled by proxy\n\thttp.HandleFunc(\"/server/change_password\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/databases\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/info\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/licenses\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/login\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/logout\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/server/user_info\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/database/cubes\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/database/dimensions\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/database/info\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/dimension/cubes\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/dimension/dfilter\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/dimension/element\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/dimension/elements\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/dimension/info\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/element/info\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/cube/holds\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cube/info\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cube/locks\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cube/rules\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/cell/area\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cell/drillthrough\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cell/export\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/cell/value\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/cell/values\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/rule/functions\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/rule/info\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/rule/parse\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/svs/info\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/view/calculate\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/meta-sp\", handleRequest(conf, proxy))\n\n\thttp.HandleFunc(\"/api\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/inc/\", handleRequest(conf, proxy))\n\thttp.HandleFunc(\"/favicon.ico\", handleRequest(conf, proxy))\n\n\t// default block of all non-white-listed routes\n\thttp.HandleFunc(\"/\", blockRequest(conf))\n}", "title": "" }, { "docid": "33b14ba732bca41b357cc2da0d9bbf20", "score": "0.5657806", "text": "func GetRESTHandlers() []Handler {\n\treturn []Handler{\n\t\tsupport.NewHTTPHandler(logSpecEndpoint, http.MethodPut, logSpecPutHandler),\n\t\tsupport.NewHTTPHandler(logSpecEndpoint, http.MethodGet, logSpecGetHandler),\n\t}\n}", "title": "" }, { "docid": "7bdd8341d65afd42efcbdac9c797e688", "score": "0.56557107", "text": "func registerLockRESTHandlers(router *mux.Router, endpointZones EndpointZones) {\n\tqueries := restQueries(lockRESTUID, lockRESTSource)\n\tfor _, ep := range endpointZones {\n\t\tfor _, endpoint := range ep.Endpoints {\n\t\t\tif !endpoint.IsLocal {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlockServer := &lockRESTServer{\n\t\t\t\tll: newLocker(endpoint),\n\t\t\t}\n\n\t\t\tsubrouter := router.PathPrefix(path.Join(lockRESTPrefix, endpoint.Path)).Subrouter()\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodLock).HandlerFunc(httpTraceHdrs(lockServer.LockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodRLock).HandlerFunc(httpTraceHdrs(lockServer.RLockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodUnlock).HandlerFunc(httpTraceHdrs(lockServer.UnlockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodRUnlock).HandlerFunc(httpTraceHdrs(lockServer.RUnlockHandler)).Queries(queries...)\n\t\t\tsubrouter.Methods(http.MethodPost).Path(lockRESTVersionPrefix + lockRESTMethodExpired).HandlerFunc(httpTraceAll(lockServer.ExpiredHandler)).Queries(queries...)\n\n\t\t\tglobalLockServers[endpoint] = lockServer.ll\n\t\t}\n\t}\n\n\tgo startLockMaintenance(GlobalContext)\n}", "title": "" }, { "docid": "5f6264dee354b8c37cee9d6847870f41", "score": "0.56506604", "text": "func RegisterAPIHandler(\n\tsystem *actor.System,\n\techo *echo.Echo,\n\tdb *db.PgDB,\n\trm rm.ResourceManager,\n\tmiddleware ...echo.MiddlewareFunc,\n) {\n\tcommandManagerRef, _ := system.ActorOf(\n\t\tactor.Addr(CommandActorPath),\n\t\t&commandManager{db: db, rm: rm},\n\t)\n\tnotebookManagerRef, _ := system.ActorOf(\n\t\tactor.Addr(NotebookActorPath),\n\t\t&notebookManager{db: db, rm: rm},\n\t)\n\tshellManagerRef, _ := system.ActorOf(\n\t\tactor.Addr(ShellActorPath),\n\t\t&shellManager{db: db, rm: rm},\n\t)\n\ttensorboardManagerRef, _ := system.ActorOf(\n\t\tactor.Addr(TensorboardActorPath),\n\t\t&tensorboardManager{db: db, rm: rm},\n\t)\n\n\t// Wait for all managers to initialize.\n\trefs := []*actor.Ref{commandManagerRef, notebookManagerRef, shellManagerRef, tensorboardManagerRef}\n\tsystem.AskAll(actor.Ping{}, refs...).GetAll()\n\n\tif echo != nil {\n\t\techo.Any(\"/commands*\", api.Route(system, nil), middleware...)\n\t\techo.Any(\"/notebooks*\", api.Route(system, nil), middleware...)\n\t\techo.Any(\"/shells*\", api.Route(system, nil), middleware...)\n\t\techo.Any(\"/tensorboard*\", api.Route(system, nil), middleware...)\n\t}\n}", "title": "" }, { "docid": "6a4d58c02b5c3e7250a491157e8b5709", "score": "0.5643498", "text": "func RegisterHandlers(state *stateful.State, so socketio.Socket) {\n\troutes := []handlerRoute{\n\t\t//Login Handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.LOGIN_REQUEST,\n\t\t\tenums.CLIENT_EVENTS.LOGIN_RESPONSE,\n\t\t\tloginHandler(state, so),\n\t\t},\n\t\t//Disconnection / Logout Handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.DISCONNECTION,\n\t\t\tenums.CLIENT_EVENTS.NO_REPLY,\n\t\t\tdisconnectionHandler(state, so),\n\t\t},\n\t\t//Create New Character Handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.CREATE_CHARACTER_REQUEST,\n\t\t\tenums.CLIENT_EVENTS.CREATE_CHARACTER_RESPONSE,\n\t\t\tcreateCharacterHandler(state, so),\n\t\t},\n\t\t//Delete charcter handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.DELETE_CHARACTER_REQUEST,\n\t\t\tenums.CLIENT_EVENTS.DELETE_CHARACTER_RESPONSE,\n\t\t\tdeleteCharacterHandler(state, so),\n\t\t},\n\t\t//Play character handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.PLAY_CHARACTER_REQUEST,\n\t\t\tenums.CLIENT_EVENTS.PLAY_CHARACTER_RESPONSE,\n\t\t\tplayCharacterHandler(state, so),\n\t\t},\n\t\t//Input Handler\n\t\t{\n\t\t\tenums.SERVER_EVENTS.MOVEMENT_REQUEST,\n\t\t\tenums.CLIENT_EVENTS.NO_REPLY,\n\t\t\tmoveRequestHandler(state, so),\n\t\t},\n\t}\n\n\tfor _, route := range routes {\n\t\tutils.AddHandler(\n\t\t\tso,\n\t\t\troute.ServerEvent,\n\t\t\troute.ClientEvent,\n\t\t\troute.HandleFunc,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "2fac6efbbfca959dde66886c876bc7f0", "score": "0.5633753", "text": "func (ns *NetworkServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn) {\n\tttnpb.RegisterNsEndDeviceRegistryHandler(ns.Context(), s, conn)\n\tttnpb.RegisterNsHandler(ns.Context(), s, conn)\n}", "title": "" }, { "docid": "995f68cfb231f265115c8c12546e862c", "score": "0.56212896", "text": "func (c *URLShortener) SetupHandlerFunctions() {\n\thttp.HandleFunc(c.shortenRoute, c.shortenHandler)\n\thttp.HandleFunc(c.statisticsRoute, c.statisticsHandler)\n\thttp.HandleFunc(c.expanderRoute, c.expanderHandler)\n}", "title": "" }, { "docid": "4e4aef5761e422d18d687b580b6ea753", "score": "0.5613465", "text": "func RegisterHandlers(cliCtx client.Context, r *mux.Router) {\n\tregisterQueryRoutes(cliCtx, r)\n\tregisterTxRoutes(cliCtx, r)\n}", "title": "" }, { "docid": "1eadabbc5e5cae430bca12e3ed9f6c67", "score": "0.5612029", "text": "func (o *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\to.handlers = []Handler{support.NewHTTPHandler(resolveDIDEndpoint, http.MethodGet, o.resolveDIDHandler)}\n}", "title": "" }, { "docid": "3f9ad9f5f6d0d7e7518f440a2c8e480a", "score": "0.5611374", "text": "func (s *Server) APIHandlers() http.Handler {\n\tmux := http.NewServeMux()\n\n\tmux.HandleFunc(\"/api/v1/status\", s.handleAPI(s.handleStatus, \"GET\"))\n\tmux.HandleFunc(\"/api/v1/sources\", s.handleAPI(s.handleSourcesList, \"GET\"))\n\tmux.HandleFunc(\"/api/v1/snapshots\", s.handleAPI(s.handleSourceSnapshotList, \"GET\"))\n\tmux.HandleFunc(\"/api/v1/policies\", s.handleAPI(s.handlePolicyList, \"GET\"))\n\tmux.HandleFunc(\"/api/v1/refresh\", s.handleAPI(s.handleRefresh, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/flush\", s.handleAPI(s.handleFlush, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/shutdown\", s.handleAPI(s.handleShutdown, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/sources/pause\", s.handleAPI(s.handlePause, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/sources/resume\", s.handleAPI(s.handleResume, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/sources/upload\", s.handleAPI(s.handleUpload, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/sources/cancel\", s.handleAPI(s.handleCancel, \"POST\"))\n\tmux.HandleFunc(\"/api/v1/objects/\", s.handleObjectGet)\n\n\treturn mux\n}", "title": "" }, { "docid": "6f9452b95343cf37cc025963ef7d7ca5", "score": "0.56057125", "text": "func RegisterWebAPI(debug bool, db bool) (err error) {\n\t// start / stop debug\n\n\t// with / without db\n\tlist := []httpHandlePair{\n\t\t{\"/block/height\", makeBlockHeight},\n\t\t{\"/block/info\", makeBlockInfo},\n\t\t{\"/block/range\", makeBlockRange},\n\t\t{\"/tran/detail\", makeTranscationDetail},\n\t\t{\"/peers\", makePeers},\n\t\t{\"/channel\", makeChannel},\n\t\t{\"/chaincode\", makeChainCode},\n\t\t{\"/test\", makeTest},\n\n\t\t{\"/report/peer\", makePeerReport},\n\n\t\t{\"/trace/user\", makeUserTrace},\n\t}\n\n\tif db {\n\t\tlist = append(list, httpHandlePair{\"/block/sync\", makeBlockSync})\n\t}\n\n\tif debug {\n\t\terr = web.AddDebugServer(\"\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// API\n\tfor _, one := range list {\n\t\tf := one.f(debug, db)\n\t\tif f == nil {\n\t\t\tcontinue\n\t\t}\n\t\terr = web.PushHandleFunc(one.p, f)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d9f9bfb48725f86475f84f5c1568bf37", "score": "0.56012636", "text": "func (app *HTTPApplication) RegisterBlueprint(blueprint *Blueprint) {\n\tfor _, handler := range blueprint.Handlers {\n\t\t// Create middleware chain\n\t\tmiddleware_count := len(handler.Middleware) + len(blueprint.Middleware) + len(app.middleware)\n\t\tmiddleware_chain := make([]Middleware, middleware_count)\n\t\ti := 0\n\t\tfor _, middleware := range app.middleware {\n\t\t\tmiddleware_chain[i] = middleware\n\t\t\ti++\n\t\t}\n\t\tfor _, middleware := range blueprint.Middleware {\n\t\t\tmiddleware_chain[i] = middleware\n\t\t\ti++\n\t\t}\n\t\tfor _, middleware := range handler.Middleware {\n\t\t\tmiddleware_chain[i] = middleware\n\t\t\ti++\n\t\t}\n\n\t\trequest_handler := handler.RequestHandler.withMiddlewareChain(middleware_chain)\n\t\trequest_path := path.Join(app.configuration.Root, blueprint.Path, handler.Path)\n\t\troute := newRoute(request_path, request_handler, handler.HTTPMethods)\n\t\tapp.routes = append(app.routes, route)\n\t}\n}", "title": "" }, { "docid": "104fd6b5e233e724261673393b26e69a", "score": "0.5596796", "text": "func AddStandardHandlers(r chi.Router, c *app.Container) {\n\tlogger := c.Logger()\n\n\t// HelloWorld\n\tr.Get(\"/\", func(rw http.ResponseWriter, _ *http.Request) {\n\t\trw.Header().Set(\"content-type\", \"text/html\")\n\t\t_, err := rw.Write([]byte(\"Welcome to \" + c.Cfg().ServiceName +\n\t\t\t`. Please read API <a href=\"/docs/api.html\">documentation</a>.`))\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Error(\"failed to write response\")\n\t\t}\n\t})\n\tlogger.Debug(\"added `/` route\")\n\n\t// Endpoint shows the version of the api\n\tr.Get(\"/version\", func(w http.ResponseWriter, r *http.Request) {\n\t\trender.JSON(w, r, version.Info())\n\t})\n\tlogger.Debug(\"added `/version` route\")\n\n\t// Endpoint check the health of the api\n\tr.Get(\"/status\", func(w http.ResponseWriter, _ *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t})\n\tlogger.Debug(\"added `/status` route\")\n\n\t// Endpoint shows current status\n\tr.Method(http.MethodGet, \"/health\", health.Handler())\n\tlogger.Debug(\"added `/health` route\")\n\n\t// Endpoint shows API documentation\n\tr.Method(http.MethodGet, \"/docs/*\", httpHandler.NewDocsHandler(\"/docs\", \"/resources/docs\"))\n\tlogger.Debug(\"added `/docs` route\")\n}", "title": "" }, { "docid": "859a8462c7c92d6454a0b7a199b34b3f", "score": "0.55870694", "text": "func (s *HTTPd) RegisterShutdownHandler(callback func()) {\n\trouter := s.Server.Handler.(*mux.Router)\n\n\t// api\n\tapi := router.PathPrefix(\"/api\").Subrouter()\n\tapi.Use(jsonHandler)\n\tapi.Use(handlers.CompressHandler)\n\tapi.Use(handlers.CORS(\n\t\thandlers.AllowedHeaders([]string{\"Content-Type\"}),\n\t))\n\n\t// site api\n\troutes := map[string]route{\n\t\t\"shutdown\": {[]string{\"POST\", \"OPTIONS\"}, \"/shutdown\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\tcallback()\n\t\t\tw.WriteHeader(http.StatusNoContent)\n\t\t}},\n\t}\n\n\tfor _, r := range routes {\n\t\tapi.Methods(r.Methods...).Path(r.Pattern).Handler(r.HandlerFunc)\n\t}\n}", "title": "" }, { "docid": "ae284034ebc1e42571e6e15ac86596c0", "score": "0.5586086", "text": "func (o *Operation) registerHandler() {\n\to.handlers = []rest.Handler{\n\t\tcmdutil.NewHTTPHandler(validateCredentialPath, http.MethodPost, o.ValidateCredential),\n\t}\n}", "title": "" }, { "docid": "52fc232ee9a11b92987e95c9e3c76b25", "score": "0.55815595", "text": "func initApiHandlers(router *itineris.ApiRouter) {\n\trouter.SetHandler(\"info\", apiInfo)\n\trouter.SetHandler(\"login\", apiLogin)\n\trouter.SetHandler(\"checkLoginToken\", apiCheckLoginToken)\n\trouter.SetHandler(\"systemInfo\", apiSystemInfo)\n\n\trouter.SetHandler(\"groupList\", apiGroupList)\n\trouter.SetHandler(\"getGroup\", apiGetGroup)\n\trouter.SetHandler(\"createGroup\", apiCreateGroup)\n\trouter.SetHandler(\"deleteGroup\", apiDeleteGroup)\n\trouter.SetHandler(\"updateGroup\", apiUpdateGroup)\n\n\trouter.SetHandler(\"userList\", apiUserList)\n\trouter.SetHandler(\"getUser\", apiGetUser)\n\trouter.SetHandler(\"createUser\", apiCreateUser)\n\trouter.SetHandler(\"deleteUser\", apiDeleteUser)\n\trouter.SetHandler(\"updateUser\", apiUpdateUser)\n}", "title": "" }, { "docid": "3e91e54002d8e8a407042e9106f344ad", "score": "0.55763364", "text": "func authRegisterHandlerEndpoints(authAgent *auth.AuthAgent){\n //Initiate auth services with system database\n authAgent = auth.NewAuthenticationAgent(\"ao_auth\", key, sysdb)\n\n //Handle auth API\n http.HandleFunc(\"/system/auth/login\", authAgent.HandleLogin)\n http.HandleFunc(\"/system/auth/logout\", authAgent.HandleLogout)\n http.HandleFunc(\"/system/auth/checkLogin\", authAgent.CheckLogin)\n http.HandleFunc(\"/system/auth/register\", authAgent.HandleRegister) //Require implemtantion of group check\n http.HandleFunc(\"/system/auth/unregister\", authAgent.HandleUnregister) //Require implementation of admin check\n \n //Handle other related APUs\n http.HandleFunc(\"/system/auth/reflectIP\", system_auth_getIPAddress)\n http.HandleFunc(\"/system/auth/checkPublicRegister\", system_auth_checkPublicRegister)\n log.Println(\"ArOZ Online Authentication Service Loaded\");\n\n\n if (*allow_public_registry){\n //Allow public registry. Create setting interface for this page\n registerSetting(settingModule{\n Name: \"Public Register\",\n Desc: \"Settings for public registration\",\n IconPath: \"SystemAO/auth/img/small_icon.png\",\n Group: \"Users\",\n StartDir: \"SystemAO/auth/regsetting.html\",\n RequireAdmin: true,\n })\n\n\n //Register the direct link for template serving\n http.HandleFunc(\"/public/register\", system_auth_serveRegisterInterface);\n http.HandleFunc(\"/public/register/settings\", system_auth_handleRegisterInterfaceUpdate);\n }\n}", "title": "" }, { "docid": "a8c5a0b04702948e8c02daeb33f2b3bf", "score": "0.55751526", "text": "func RegisterHttpServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HttpServiceServer) error {\n\n\tmux.Handle(\"GET\", pattern_HttpService_Genesis_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Genesis_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Genesis_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_MinGasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_MinGasPrice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_MinGasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_NetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_NetInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_NetInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Status_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Status_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Address_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Address_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Address_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Addresses_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Addresses_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Addresses_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Block_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Block_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Block_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Candidate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Candidate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Candidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Candidates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Candidates_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Candidates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_CoinInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_CoinInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_CoinInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_EstimateCoinBuy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_EstimateCoinBuy_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_EstimateCoinBuy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_EstimateCoinSell_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_EstimateCoinSell_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_EstimateCoinSell_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_EstimateCoinSellAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_EstimateCoinSellAll_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_EstimateCoinSellAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_EstimateTxCommission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_EstimateTxCommission_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_EstimateTxCommission_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Events_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Events_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Events_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_MaxGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_MaxGas_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_MaxGas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_MissedBlocks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_MissedBlocks_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_MissedBlocks_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_SendTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_SendTransaction_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_SendTransaction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Transaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Transaction_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Transaction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Transactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Transactions_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Transactions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_UnconfirmedTxs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_UnconfirmedTxs_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_UnconfirmedTxs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HttpService_Validators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HttpService_Validators_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HttpService_Validators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "12c149ab42a4dc9db135de8c5bdb130a", "score": "0.5572324", "text": "func registerHandler(path string, handler http.Handler) {\n\thttp.Handle(path, promhttp.InstrumentHandlerDuration(\n\t\trequestDuration.MustCurryWith(prometheus.Labels{\n\t\t\t\"path\": path,\n\t\t}),\n\t\thandler,\n\t))\n}", "title": "" }, { "docid": "d20f7ecd861a0ae75866af2266b65981", "score": "0.5565456", "text": "func (c *Operation) registerHandler() {\n\t// Add more protocol endpoints here to expose them as controller API endpoints\n\tc.handlers = []rest.Handler{\n\t\tcmdutil.NewHTTPHandler(Connections, http.MethodGet, c.QueryConnections),\n\t\tcmdutil.NewHTTPHandler(ConnectionsByID, http.MethodGet, c.QueryConnectionByID),\n\t\tcmdutil.NewHTTPHandler(CreateInvitationPath, http.MethodPost, c.CreateInvitation),\n\t\tcmdutil.NewHTTPHandler(CreateImplicitInvitationPath, http.MethodPost, c.CreateImplicitInvitation),\n\t\tcmdutil.NewHTTPHandler(ReceiveInvitationPath, http.MethodPost, c.ReceiveInvitation),\n\t\tcmdutil.NewHTTPHandler(AcceptInvitationPath, http.MethodPost, c.AcceptInvitation),\n\t\tcmdutil.NewHTTPHandler(AcceptExchangeRequest, http.MethodPost, c.AcceptExchangeRequest),\n\t\tcmdutil.NewHTTPHandler(CreateConnection, http.MethodPost, c.CreateConnection),\n\t\tcmdutil.NewHTTPHandler(RemoveConnection, http.MethodPost, c.RemoveConnection),\n\t}\n}", "title": "" }, { "docid": "f79c78bbe59ff9a771351610bb174e94", "score": "0.55640876", "text": "func AddHandlers(handlers ...Handler) error {\n\treturn fManager.AddHandlers(handlers...)\n}", "title": "" }, { "docid": "a028646aafc0afa0ec97d67d145c62ee", "score": "0.55353284", "text": "func (r *Router) Register(handlers ...core.APIService) {\n\tfor _, handler := range handlers {\n\t\tr.register(handler)\n\t}\n}", "title": "" }, { "docid": "043d8d0f7b6cdaf483b001c4d9e70348", "score": "0.55342865", "text": "func InstallHandlers(r *router.Router, dispatcher *tq.Dispatcher, m router.MiddlewareChain) {\n\tregisterTaskHandlers(dispatcher)\n\n\t// install the dispatcher and RPC clients into the context so that\n\t// they can be accessed via the context and overwritten in unit tests.\n\tm = m.Extend(func(rc *router.Context, next router.Handler) {\n\t\trc.Context = util.SetDispatcher(rc.Context, dispatcher)\n\n\t\tmonorailClient, err := createMonorailClient(rc.Context)\n\t\tif err != nil {\n\t\t\tutil.ErrStatus(\n\t\t\t\trc, http.StatusInternalServerError,\n\t\t\t\t\"failed to create an RPC channel for Monorail: %s\", err,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\trc.Context = setMonorailClient(rc.Context, monorailClient)\n\n\t\trotaNGClient, err := createRotaNGClient(rc.Context)\n\t\tif err != nil {\n\t\t\tutil.ErrStatus(\n\t\t\t\trc, http.StatusInternalServerError,\n\t\t\t\t\"failed to create an RPC channel for RotaNG: %s\", err,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\trc.Context = setRotaNGClient(rc.Context, rotaNGClient)\n\t\tnext(rc)\n\t})\n\tdispatcher.InstallRoutes(r, m)\n}", "title": "" }, { "docid": "f6f37257c6d7c4d6c9fb643c7423c4fd", "score": "0.5516376", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.DELETE(baseURL+\"/url/del/:hash\", wrapper.DeleteUrl)\n\trouter.GET(baseURL+\"/url/:hash\", wrapper.GetUrl)\n\trouter.GET(baseURL+\"/urls\", wrapper.GetUrlsWidthHash)\n\trouter.POST(baseURL+\"/urls/new\", wrapper.MakeUrlHash)\n\n}", "title": "" }, { "docid": "d64e65f9e3cb1d4ec89ee1a3cbd38214", "score": "0.55044967", "text": "func (ps *PhishingServer) registerRoutes() {\n\trouter := mux.NewRouter()\n\tfileServer := http.FileServer(unindexed.Dir(\"./static/endpoint/\"))\n\trouter.PathPrefix(\"/static/\").Handler(http.StripPrefix(\"/static/\", fileServer))\n\trouter.HandleFunc(\"/track\", ps.TrackHandler)\n\trouter.HandleFunc(\"/robots.txt\", ps.RobotsHandler)\n\trouter.HandleFunc(\"/{path:.*}/track\", ps.TrackHandler)\n\trouter.HandleFunc(\"/{path:.*}/report\", ps.ReportHandler)\n\trouter.HandleFunc(\"/report\", ps.ReportHandler)\n\trouter.HandleFunc(\"/{path:.*}\", ps.PhishHandler)\n\n\t// Setup GZIP compression\n\tgzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression)\n\tphishHandler := gzipWrapper(router)\n\n\t// Respect X-Forwarded-For and X-Real-IP headers in case we're behind a\n\t// reverse proxy.\n\tphishHandler = handlers.ProxyHeaders(phishHandler)\n\n\t// Setup logging\n\tphishHandler = handlers.CombinedLoggingHandler(log.Writer(), phishHandler)\n\tps.server.Handler = phishHandler\n}", "title": "" }, { "docid": "e28d0196f65a9dbd2863fd2b6a1528af", "score": "0.5502782", "text": "func InstallHandlers(reg Registry, r *router.Router, base router.MiddlewareChain) {\n\tr.POST(handlerPattern, base.Extend(gaemiddleware.RequireTaskQueue(\"\"), func(c *router.Context, next router.Handler) {\n\t\tc.Context = WithRegistry(c.Context, reg)\n\t\tnext(c)\n\t}), TaskQueueHandler)\n\n\tr.POST(\"/_ah/push-handlers/\"+notifyTopicSuffix, base.Extend(func(c *router.Context, next router.Handler) {\n\t\tc.Context = WithRegistry(c.Context, reg)\n\t\tnext(c)\n\t}), PubsubReceiver)\n}", "title": "" }, { "docid": "bb889e34a8aff34d75bbdaf2d0e75d99", "score": "0.55015284", "text": "func Handlers() *nrhttprouter.Router {\r\n\r\n\t// Create a new router\r\n\tr := apirouter.New()\r\n\r\n\t// Turned off all CORs - should be accessed outside a browser\r\n\tr.CrossOriginEnabled = false\r\n\tr.CrossOriginAllowCredentials = false\r\n\tr.CrossOriginAllowOriginAll = false\r\n\r\n\t// Register basic server routes\r\n\tregisterBasicRoutes(r)\r\n\r\n\t// Register paymail routes\r\n\tregisterPaymailRoutes(r)\r\n\r\n\t// Return the router\r\n\treturn r.HTTPRouter\r\n}", "title": "" }, { "docid": "f5c8512fcab16e6cc9bda18156c0ae83", "score": "0.54968554", "text": "func (r *kfctlRouter) RegisterEndpoints() {\n\tcreateHandler := httptransport.NewServer(\n\t\tmakeRouterCreateRequestEndpoint(r),\n\t\tfunc(_ context.Context, r *http.Request) (interface{}, error) {\n\t\t\tvar request kfdefs.KfDef\n\t\t\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\t\t\tlog.Info(\"Err decoding create request: \" + err.Error())\n\t\t\t\tdeployReqCounter.WithLabelValues(\"INVALID_ARGUMENT\").Inc()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn request, nil\n\t\t},\n\t\tencodeResponse,\n\t)\n\n\t// TODO(jlewi): We probably want to fix the URL we are serving on.\n\t// There are a variety of changes in flight\n\t// 1. Migrating click to deploy to use kfctl logic\n\t// 2. Migrating to a new REST API for deployments\n\t// 3. This PR aimed at running the deployment in each pod.\n\t// Depending on how we stage these changes we might need to change these URLs.\n\thttp.Handle(\"/kfctl/apps/v1alpha2/create\", optionsHandler(createHandler))\n\thttp.Handle(\"/\", optionsHandler(GetHealthzHandler()))\n}", "title": "" }, { "docid": "cdbe85b93754e8a17247c307ca3dc1c4", "score": "0.5493183", "text": "func newHttpHandler(ctx context.Context, endpoint endpoints) http.Handler {\n\tr := mux.NewRouter()\n\tr.UseEncodedPath()\n\toptions := []httptransport.ServerOption{\n\t\t//httptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeError),\n\t}\n\tr.Methods(\"GET\").Path(\"/ping\").HandlerFunc(healthCheckHandler)\n\tr.Methods(\"POST\").Path(\"/fetch\").Handler(httptransport.NewServer(\n\t\tendpoint.fetchEndpoint,\n\t\tdecodeRequest,\n\t\tencodeFetcherContent,\n\t\toptions...,\n\t))\n\treturn r\n}", "title": "" }, { "docid": "1a01e14040aee7f883d68bb175e1d3ed", "score": "0.54856133", "text": "func (s *Server) registerHandlers(\n\tctx context.Context,\n\tcfg config.Config,\n\tstor storage.Storage,\n\tpub pubsub.Publisher,\n\tsub pubsub.Subscriber,\n\tpublicDir string,\n\trdb *redis.Client,\n\tregistry *prometheus.Registry,\n) error {\n\tif err := s.registerWebHookHandlers(ctx, cfg, stor, pub, registry); err != nil {\n\t\treturn err\n\t}\n\n\ts.registerAPIHandlers(cfg, stor, pub)\n\n\tif err := s.registerWebsocketHandlers(ctx, cfg, stor, pub, sub, registry); err != nil {\n\t\treturn err\n\t}\n\n\ts.registerServiceHandlers(ctx, rdb, registry)\n\n\tif publicDir != \"\" {\n\t\tif err := s.registerFileServerHandler(publicDir); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a8de6933285afff198b334e7ffa33aa", "score": "0.54825157", "text": "func Handlers() *http.ServeMux {\n\tcontext := &AppContext{DB: GetDB(), Apikey: \"15c035e1cd738ee91910a3d19f93cb92\"}\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/signup\", AppHandler{context, PostOnly(Signup)})\n\tmux.Handle(\"/signin\", AppHandler{context, PostOnly(BasicAuth(Signin))})\n\tmux.Handle(\"/clearToken\", AppHandler{context, PostOnly(authenticateAuthToken(clearToken))})\n\treturn mux\n}", "title": "" }, { "docid": "3d7618fc9abc7a9597faee4ad617f737", "score": "0.54780304", "text": "func CreateHTTPHandler(walletEndpoints *v1wallet.Endpoints, lgr *zap.Logger) http.Handler {\n\t// Build the service HTTP request multiplexer and configure it to serve\n\t// HTTP requests to the service endpoints.\n\t// Provide the transport specific request decoder and response encoder.\n\t// The goa http package has built-in support for JSON, XML and gob.\n\t// Other encodings can be used by providing the corresponding functions,\n\t// see goa.design/implement/encoding.\n\tmux := goahttp.NewMuxer()\n\tdec := goahttp.RequestDecoder\n\tenc := httputil.JSONResponseEncoder\n\n\t// Wrap the services in endpoints that can be invoked from other services\n\t// potentially running in different processes.\n\t// Setup logger. Replace logger with your own log package of choice.\n\teh := httputil.ErrorHandler(lgr)\n\n\twalletServer := server.New(walletEndpoints, mux, dec, enc, eh, nil)\n\tserver.Mount(mux, walletServer)\n\tfor _, m := range walletServer.Mounts {\n\t\tlgr.Info(fmt.Sprintf(\"HTTP %q mounted on %s %s\", m.Method, m.Verb, m.Pattern))\n\t}\n\n\treturn httputil.CreateHTTPHandler(mux, lgr)\n}", "title": "" }, { "docid": "36cf39aff166950eb43c36630eba1355", "score": "0.54751086", "text": "func MountFirmwareController(service *goa.Service, ctrl FirmwareController) {\n\tinitService(service)\n\tvar h goa.Handler\n\tservice.Mux.Handle(\"OPTIONS\", \"/firmware\", ctrl.MuxHandler(\"preflight\", handleFirmwareOrigin(cors.HandlePreflight()), nil))\n\tservice.Mux.Handle(\"OPTIONS\", \"/firmware/:firmwareId\", ctrl.MuxHandler(\"preflight\", handleFirmwareOrigin(cors.HandlePreflight()), nil))\n\tservice.Mux.Handle(\"OPTIONS\", \"/firmware/:firmwareId/download\", ctrl.MuxHandler(\"preflight\", handleFirmwareOrigin(cors.HandlePreflight()), nil))\n\n\th = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\t// Check if there was an error loading the request\n\t\tif err := goa.ContextError(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the context\n\t\trctx, err := NewAddFirmwareContext(ctx, req, service)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the payload\n\t\tif rawPayload := goa.ContextRequest(ctx).Payload; rawPayload != nil {\n\t\t\trctx.Payload = rawPayload.(*AddFirmwarePayload)\n\t\t} else {\n\t\t\treturn goa.MissingPayloadError()\n\t\t}\n\t\treturn ctrl.Add(rctx)\n\t}\n\th = handleSecurity(\"jwt\", h, \"api:admin\")\n\th = handleFirmwareOrigin(h)\n\tservice.Mux.Handle(\"PATCH\", \"/firmware\", ctrl.MuxHandler(\"add\", h, unmarshalAddFirmwarePayload))\n\tservice.LogInfo(\"mount\", \"ctrl\", \"Firmware\", \"action\", \"Add\", \"route\", \"PATCH /firmware\", \"security\", \"jwt\")\n\n\th = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\t// Check if there was an error loading the request\n\t\tif err := goa.ContextError(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the context\n\t\trctx, err := NewDeleteFirmwareContext(ctx, req, service)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ctrl.Delete(rctx)\n\t}\n\th = handleSecurity(\"jwt\", h, \"api:admin\")\n\th = handleFirmwareOrigin(h)\n\tservice.Mux.Handle(\"DELETE\", \"/firmware/:firmwareId\", ctrl.MuxHandler(\"delete\", h, nil))\n\tservice.LogInfo(\"mount\", \"ctrl\", \"Firmware\", \"action\", \"Delete\", \"route\", \"DELETE /firmware/:firmwareId\", \"security\", \"jwt\")\n\n\th = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\t// Check if there was an error loading the request\n\t\tif err := goa.ContextError(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the context\n\t\trctx, err := NewDownloadFirmwareContext(ctx, req, service)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ctrl.Download(rctx)\n\t}\n\th = handleFirmwareOrigin(h)\n\tservice.Mux.Handle(\"GET\", \"/firmware/:firmwareId/download\", ctrl.MuxHandler(\"download\", h, nil))\n\tservice.LogInfo(\"mount\", \"ctrl\", \"Firmware\", \"action\", \"Download\", \"route\", \"GET /firmware/:firmwareId/download\")\n\n\th = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\t// Check if there was an error loading the request\n\t\tif err := goa.ContextError(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the context\n\t\trctx, err := NewListFirmwareContext(ctx, req, service)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ctrl.List(rctx)\n\t}\n\th = handleFirmwareOrigin(h)\n\tservice.Mux.Handle(\"GET\", \"/firmware\", ctrl.MuxHandler(\"list\", h, nil))\n\tservice.LogInfo(\"mount\", \"ctrl\", \"Firmware\", \"action\", \"List\", \"route\", \"GET /firmware\")\n}", "title": "" }, { "docid": "d96f9ac1b1e4adb1ad45935824226712", "score": "0.5472912", "text": "func Register(prod bool) {\n\tisProd = prod\n\thttp.HandleFunc(\"/keybase.txt\", keybaseHandler)\n\tif isProd {\n\t\tlog.Println(\"We're in prod, remapping some paths\")\n\t\thttp.HandleFunc(\"/\", nakedIndexHandler)\n\t} else {\n\t\tlog.Println(\"We're not in prod, remapping some paths\")\n\t\thttp.HandleFunc(\"/nakedindex\", nakedIndexHandler)\n\t}\n\tfor uri, newUri := range redirects {\n\t\tweb.AddRedirect(uri, newUri)\n\t}\n\n\tweb.Register()\n}", "title": "" }, { "docid": "ecb6983d74b440f6cee29f5144cb67b6", "score": "0.54710555", "text": "func RegisterKeyTransparencyHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KeyTransparencyServer) error {\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_GetDirectory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_GetDirectory_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_GetDirectory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_GetRevision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_GetRevision_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_GetRevision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_GetLatestRevision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_GetLatestRevision_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_GetLatestRevision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_GetRevisionStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\terr := status.Error(codes.Unimplemented, \"streaming calls are not yet supported in the in-process transport\")\n\t\t_, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\treturn\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_ListMutations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_ListMutations_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_ListMutations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_ListMutationsStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\terr := status.Error(codes.Unimplemented, \"streaming calls are not yet supported in the in-process transport\")\n\t\t_, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\treturn\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_GetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_GetUser_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_GetUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_BatchGetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_BatchGetUser_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_BatchGetUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_BatchGetUserIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_BatchGetUserIndex_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_BatchGetUserIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_KeyTransparency_ListEntryHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_ListEntryHistory_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_ListEntryHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_KeyTransparency_ListUserRevisions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_ListUserRevisions_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_ListUserRevisions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_KeyTransparency_BatchListUserRevisions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_BatchListUserRevisions_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_BatchListUserRevisions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_KeyTransparency_QueueEntryUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_QueueEntryUpdate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_QueueEntryUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_KeyTransparency_BatchQueueUserUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_KeyTransparency_BatchQueueUserUpdate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_KeyTransparency_BatchQueueUserUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "d9dc59afae86733f9ed501d211e36a81", "score": "0.546656", "text": "func Handlers() request.Handlers {\n\tvar handlers request.Handlers\n\n\thandlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler)\n\thandlers.Validate.AfterEachFn = request.HandlerListStopOnError\n\thandlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler)\n\thandlers.Build.PushBackNamed(corehandlers.AddHostExecEnvUserAgentHander)\n\thandlers.Build.AfterEachFn = request.HandlerListStopOnError\n\thandlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)\n\thandlers.Send.PushBackNamed(corehandlers.ValidateReqSigHandler)\n\thandlers.Send.PushBackNamed(corehandlers.SendHandler)\n\thandlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler)\n\thandlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler)\n\n\treturn handlers\n}", "title": "" }, { "docid": "ae310d61b44093e296e1542cfb3f3d46", "score": "0.5462101", "text": "func RegisterRoutes(serv service.Service) {\n\thttp.HandleFunc(\"/replay\", WebSocketController(serv))\n}", "title": "" }, { "docid": "bd8387f05c0a17808cc070dae6d46be2", "score": "0.54592264", "text": "func (h *restHandlers) HTTPHandlers() []common.HTTPHandler {\n\treturn h.httpHandlers\n}", "title": "" }, { "docid": "b1f4c847ae88e9a8b8be9a03a97225ea", "score": "0.5443187", "text": "func (b *bot) registerHandlers() {\n\tchat := b.chatHandler\n\tconv := b.convHandler\n\twallet := b.walletHandler\n\terr := b.errHandler\n\n\tb.handlers = keybase.Handlers{\n\t\tChatHandler: &chat,\n\t\tConversationHandler: &conv,\n\t\tWalletHandler: &wallet,\n\t\tErrorHandler: &err,\n\t}\n}", "title": "" }, { "docid": "49af4a286618e5144da4d84a546ece05", "score": "0.5428928", "text": "func addHandleHandler(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tif r.Method != \"POST\" {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tauthToken := r.FormValue(\"auth\")\n\tloginID, err := getFirebaseUserFromToken(ctx, authToken)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"failed to validate firebase token: %v\", err)\n\t\treturn\n\t}\n\tdataClient, err := newFirestoreClient(ctx)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"failed to load firestore: %v\", err)\n\t\treturn\n\t}\n\tdefer dataClient.Close()\n\tclient, err := newUserTwitterClient(ctx, dataClient, loginID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"failed to connect Twitter: %v\", err)\n\t\treturn\n\t}\n\t_, err = enqueueHandle(ctx, client, dataClient, loginID, r.FormValue(\"handle\"))\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"failed to load handle: %v\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a0e08307506506ea8a017e88e88ff1b9", "score": "0.5406909", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/v1/clinicians\", wrapper.ListAllClinicians)\n\trouter.GET(baseURL+\"/v1/clinicians/:userId/clinics\", wrapper.ListClinicsForClinician)\n\trouter.POST(baseURL+\"/v1/clinicians/:userId/migrate\", wrapper.EnableNewClinicExperience)\n\trouter.GET(baseURL+\"/v1/clinics\", wrapper.ListClinics)\n\trouter.POST(baseURL+\"/v1/clinics\", wrapper.CreateClinic)\n\trouter.GET(baseURL+\"/v1/clinics/share_code/:shareCode\", wrapper.GetClinicByShareCode)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId\", wrapper.DeleteClinic)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId\", wrapper.GetClinic)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId\", wrapper.UpdateClinic)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/clinicians\", wrapper.ListClinicians)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/clinicians\", wrapper.CreateClinician)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId/clinicians/:clinicianId\", wrapper.DeleteClinician)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/clinicians/:clinicianId\", wrapper.GetClinician)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/clinicians/:clinicianId\", wrapper.UpdateClinician)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/ehr/sync\", wrapper.SyncEHRData)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId/invites/clinicians/:inviteId/clinician\", wrapper.DeleteInvitedClinician)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/invites/clinicians/:inviteId/clinician\", wrapper.GetInvitedClinician)\n\trouter.PATCH(baseURL+\"/v1/clinics/:clinicId/invites/clinicians/:inviteId/clinician\", wrapper.AssociateClinicianToUser)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/membership_restrictions\", wrapper.ListMembershipRestrictions)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/membership_restrictions\", wrapper.UpdateMembershipRestrictions)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/migrate\", wrapper.TriggerInitialMigration)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/migrations\", wrapper.ListMigrations)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/migrations\", wrapper.MigrateLegacyClinicianPatients)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/migrations/:userId\", wrapper.GetMigration)\n\trouter.PATCH(baseURL+\"/v1/clinics/:clinicId/migrations/:userId\", wrapper.UpdateMigration)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patient_tags\", wrapper.CreatePatientTag)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId/patient_tags/:patientTagId\", wrapper.DeletePatientTag)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/patient_tags/:patientTagId\", wrapper.UpdatePatientTag)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/patients\", wrapper.ListPatients)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients\", wrapper.CreatePatientAccount)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients/assign_tag/:patientTagId\", wrapper.AssignPatientTagToClinicPatients)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients/delete_tag/:patientTagId\", wrapper.DeletePatientTagFromClinicPatients)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId/patients/:patientId\", wrapper.DeletePatient)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/patients/:patientId\", wrapper.GetPatient)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients/:patientId\", wrapper.CreatePatientFromUser)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/patients/:patientId\", wrapper.UpdatePatient)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/patients/:patientId/permissions\", wrapper.UpdatePatientPermissions)\n\trouter.DELETE(baseURL+\"/v1/clinics/:clinicId/patients/:patientId/permissions/:permission\", wrapper.DeletePatientPermission)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients/:patientId/send_dexcom_connect_request\", wrapper.SendDexcomConnectRequest)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/patients/:patientId/upload_reminder\", wrapper.SendUploadReminder)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/settings/ehr\", wrapper.GetEHRSettings)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/settings/ehr\", wrapper.UpdateEHRSettings)\n\trouter.GET(baseURL+\"/v1/clinics/:clinicId/settings/mrn\", wrapper.GetMRNSettings)\n\trouter.PUT(baseURL+\"/v1/clinics/:clinicId/settings/mrn\", wrapper.UpdateMRNSettings)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/suppressed_notifications\", wrapper.UpdateSuppressedNotifications)\n\trouter.POST(baseURL+\"/v1/clinics/:clinicId/tier\", wrapper.UpdateTier)\n\trouter.POST(baseURL+\"/v1/patients/:patientId/summary\", wrapper.UpdatePatientSummary)\n\trouter.GET(baseURL+\"/v1/patients/:userId/clinics\", wrapper.ListClinicsForPatient)\n\trouter.PUT(baseURL+\"/v1/patients/:userId/data_sources\", wrapper.UpdatePatientDataSources)\n\trouter.POST(baseURL+\"/v1/redox\", wrapper.ProcessEHRMessage)\n\trouter.POST(baseURL+\"/v1/redox/match\", wrapper.MatchClinicAndPatient)\n\trouter.POST(baseURL+\"/v1/redox/verify\", wrapper.VerifyEndpoint)\n\trouter.DELETE(baseURL+\"/v1/users/:userId/clinics\", wrapper.DeleteUserFromClinics)\n\trouter.POST(baseURL+\"/v1/users/:userId/clinics\", wrapper.UpdateClinicUserDetails)\n\n}", "title": "" }, { "docid": "23425de778f38f076985185998452329", "score": "0.5404521", "text": "func (d *DefaultServerImpl) AddHTTPHandler(serviceName string, method string, path string, handler handlers.HTTPHandler) {\n\tif d.encoders == nil {\n\t\td.encoders = make(map[string]*encoderInfo)\n\t}\n\tkey := getSvcKey(serviceName, method)\n\tei := new(encoderInfo)\n\tif info, ok := d.encoders[key]; ok {\n\t\tei = info\n\t} else {\n\t\td.encoders[key] = ei\n\t}\n\tei.serviceName = serviceName\n\tei.method = method\n\tei.path = path\n\tei.handler = handler\n}", "title": "" }, { "docid": "e0a31950f4ae04571ac3b15aa762348e", "score": "0.5400575", "text": "func Register() error {\n\thttp.Handle(\"/healthz\", constHandler(\"ok\"))\n\thttp.Handle(\"/metrics\", promhttp.Handler())\n\treturn nil\n}", "title": "" }, { "docid": "80d001a577f82dc66c8f496884ee3b53", "score": "0.53963363", "text": "func (g *Glutton) registerHandlers() {\n\tfor _, rule := range g.rules {\n\t\tif rule.Type == \"conn_handler\" && rule.Target != \"\" {\n\t\t\tvar handler string\n\n\t\t\tswitch rule.Name {\n\t\t\tcase \"proxy_tcp\":\n\t\t\t\thandler = rule.Name\n\t\t\t\tg.protocolHandlers[rule.Target] = g.protocolHandlers[handler]\n\t\t\t\tdelete(g.protocolHandlers, handler)\n\t\t\t\thandler = rule.Target\n\t\t\tcase \"proxy_ssh\":\n\t\t\t\thandler = rule.Name\n\t\t\t\tif err := g.NewSSHProxy(rule.Target); err != nil {\n\t\t\t\t\tg.Logger.Error(\"failed to initialize SSH proxy\", zap.Error(err))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\trule.Target = handler\n\t\t\tcase \"proxy_telnet\":\n\t\t\t\thandler = rule.Name\n\t\t\t\tif err := g.NewTelnetProxy(rule.Target); err != nil {\n\t\t\t\t\tg.Logger.Error(\"failed to initialize TELNET proxy\", zap.Error(err))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\trule.Target = handler\n\t\t\tdefault:\n\t\t\t\thandler = rule.Target\n\t\t\t}\n\n\t\t\tif g.protocolHandlers[handler] == nil {\n\t\t\t\tg.Logger.Warn(fmt.Sprintf(\"no handler found for '%s' protocol\", handler))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tg.registerConnHandler(handler, func(conn net.Conn, md *connection.Metadata) error {\n\t\t\t\thost, port, err := net.SplitHostPort(conn.RemoteAddr().String())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to split remote address: %w\", err)\n\t\t\t\t}\n\n\t\t\t\tif md == nil {\n\t\t\t\t\tg.Logger.Debug(fmt.Sprintf(\"connection not tracked: %s:%s\", host, port))\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tg.Logger.Debug(\n\t\t\t\t\tfmt.Sprintf(\"new connection: %s:%s -> %d\", host, port, md.TargetPort),\n\t\t\t\t\tzap.String(\"host\", host),\n\t\t\t\t\tzap.String(\"src_port\", port),\n\t\t\t\t\tzap.String(\"dest_port\", strconv.Itoa(int(md.TargetPort))),\n\t\t\t\t\tzap.String(\"handler\", handler),\n\t\t\t\t)\n\n\t\t\t\tmatched, name, err := scanner.IsScanner(net.ParseIP(host))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tg.Logger.Info(\"IP from a known scanner\", zap.String(\"host\", host), zap.String(\"scanner\", name), zap.String(\"dest_port\", strconv.Itoa(int(md.TargetPort))))\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\tdone := make(chan struct{})\n\t\t\t\tgo g.closeOnShutdown(conn, done)\n\t\t\t\tif err = conn.SetDeadline(time.Now().Add(time.Duration(viper.GetInt(\"conn_timeout\")) * time.Second)); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to set connection deadline: %w\", err)\n\t\t\t\t}\n\t\t\t\tctx := g.contextWithTimeout(72)\n\t\t\t\terr = g.protocolHandlers[handler](ctx, conn)\n\t\t\t\tdone <- struct{}{}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"protocol handler error: %w\", err)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63ad4366f5aeb6a77be0a5bbcef78e9e", "score": "0.539611", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.GET(baseURL+\"/pets\", wrapper.FindPets)\n\trouter.POST(baseURL+\"/pets\", wrapper.AddPet)\n\trouter.DELETE(baseURL+\"/pets/:id\", wrapper.DeletePet)\n\trouter.GET(baseURL+\"/pets/:id\", wrapper.FindPetById)\n\n}", "title": "" }, { "docid": "e436e257951ab08d864275396b484c76", "score": "0.53954804", "text": "func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {\n\n\twrapper := ServerInterfaceWrapper{\n\t\tHandler: si,\n\t}\n\n\trouter.POST(baseURL+\"/amazon\", wrapper.AddAmazon)\n\trouter.PATCH(baseURL+\"/amazon/active/:asin\", wrapper.UndeleteAmazon)\n\trouter.DELETE(baseURL+\"/amazon/:asin\", wrapper.DeleteAmazon)\n\trouter.GET(baseURL+\"/amazon/:asin\", wrapper.FindAmazonById)\n\trouter.PATCH(baseURL+\"/amazon/:asin\", wrapper.PatchAmazon)\n\trouter.PUT(baseURL+\"/amazon/:asin\", wrapper.UpdateAmazon)\n\n}", "title": "" }, { "docid": "43a43245eaf577cdb23b8eb092f4a620", "score": "0.5390846", "text": "func init() {\n\thttp.HandleFunc(\"/resource2\", resource2)\n\thttp.HandleFunc(\"/resource3\", resource3)\n\thttp.HandleFunc(\"/resource4\", resource4)\n\thttp.HandleFunc(\"/resource5\", resource5)\n\thttp.HandleFunc(\"/resource6\", resource6)\n\thttp.HandleFunc(\"/resource7\", resource7)\n}", "title": "" }, { "docid": "ecd3f3f34c5cc617e88c38b45a6d5dca", "score": "0.53890145", "text": "func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tfor _, re := range s.routes {\n\t\tif matches := re.pattern.MatchString(r.URL.Path); matches {\n\t\t\tre.handler(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\tw.WriteHeader(http.StatusBadRequest)\n}", "title": "" } ]
5829e83c798ac04bc7eceb9150c3f00d
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
[ { "docid": "49ecbfd2a25195039b593915464796da", "score": "0.6676173", "text": "func (bss *BucketSecretSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = bss.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{bucketsecret.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BucketSecretSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "0df1e9b0d82737c27d825f7c35211528", "score": "0.73784375", "text": "func (is *ImplementSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = is.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{implement.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ImplementSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "49c465dff17d5929884a67476d1769bc", "score": "0.7365836", "text": "func (ks *KqiSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ks.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqi.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "658312c7d2259310f49ed0045ffe2862", "score": "0.7343533", "text": "func (res *RawEventSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = res.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{rawevent.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RawEventSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "093b80840e8ed705a18be1208fb5e218", "score": "0.73220307", "text": "func (bs *BeerSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = bs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{beer.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BeerSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "659c8b3573bb2fab286f2ef9375e7b41", "score": "0.72791666", "text": "func (vs *VeterinarianSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = vs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{veterinarian.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VeterinarianSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "0553ca39e4a610027037c99a1e2e19bf", "score": "0.7265508", "text": "func (cfs *CounterFamilySelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = cfs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{counterfamily.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CounterFamilySelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "d02f5ac4a9036323a3db18095a5c7dbf", "score": "0.72642314", "text": "func (ksss *K8sStatefulSetSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ksss.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{k8sstatefulset.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: K8sStatefulSetSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "153328e4926986f7a06a0c88d3c2cd6a", "score": "0.7263552", "text": "func (es *EmployeeSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = es.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{employee.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EmployeeSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "eb1d06a7ab69c67ab0ea52e19379b81b", "score": "0.726325", "text": "func (pts *PropertyTypeSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = pts.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{propertytype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: PropertyTypeSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "35ec0d6ee99264a80c3fa647e0c55860", "score": "0.7253852", "text": "func (kps *K8sPodSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = kps.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{k8spod.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: K8sPodSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "fb749200803edad893b978f044455092", "score": "0.7223537", "text": "func (fs *FilmSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = fs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{film.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"entc: FilmSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "36cb48a3049d17a8fbdca5545fd26e2b", "score": "0.71525586", "text": "func (grs *GrpcRuleSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = grs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{grpcrule.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: GrpcRuleSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "6bb0e88270d70ca4667e28bdee8ca8b2", "score": "0.71502626", "text": "func (mwis *MessageWithIDSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = mwis.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{messagewithid.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: MessageWithIDSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "c6401935dfbff11ced18ceeeaa30a546", "score": "0.71386", "text": "func (kps *KqiPerspectiveSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = kps.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqiperspective.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiPerspectiveSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ab22efaf6285e297612a767c4551a173", "score": "0.71212155", "text": "func (as *AddressSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = as.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{address.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: AddressSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3a9225faabccabaa5bb857af70af9594", "score": "0.7094756", "text": "func (ms *ModuleSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ms.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{module.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ModuleSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cdaf99e64473950d68822ad26131e34e", "score": "0.70813566", "text": "func (ers *EventRSVPSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ers.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{eventrsvp.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EventRSVPSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cc6b6a382d0f61380fea864afbe4b49c", "score": "0.70689356", "text": "func SelectFloat(e SqlExecutor, query string, args ...interface{}) (float64, error) {\n\tvar h float64\n\terr := selectVal(e, &h, query, args...)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn 0, err\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "0dca99f013ed4f13247bdedea137532e", "score": "0.70124835", "text": "func (t *Transaction) SelectFloat(query string, args ...interface{}) (float64, error) {\n\treturn SelectFloat(t, query, args...)\n}", "title": "" }, { "docid": "c4c4f187acb8eba5fd743ee440bd84af", "score": "0.7001829", "text": "func (kcs *K8sClusterSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = kcs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{k8scluster.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: K8sClusterSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "39e69cb962e866029ca3d08c3066917b", "score": "0.6987544", "text": "func (cus *CarUtilitySelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = cus.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{carutility.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CarUtilitySelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "af77d4e12627b0cd827ac25eb17587c5", "score": "0.69868785", "text": "func (os *OrganizationSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = os.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{organization.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OrganizationSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "edba17239025107114ca738052d00e6f", "score": "0.697795", "text": "func (bfs *BinaryFileSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = bfs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{binaryfile.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BinaryFileSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cca1872e106d02024ac2bbaf461357ee", "score": "0.6953441", "text": "func (vms *ValidMessageSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = vms.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{validmessage.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ValidMessageSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "401dbf16a11ca00329dcfd16fbadbd62", "score": "0.69488144", "text": "func (vms *VehicleMakeSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = vms.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{vehiclemake.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VehicleMakeSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "8427453d6a3171d20f1a79223b18f1b3", "score": "0.69397014", "text": "func (tb *TableBSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = tb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{tableb.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: TableBSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "22041c1e0ae163c8e242a56b5bfc7a0f", "score": "0.69282407", "text": "func (irs *ImageRepoSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = irs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{imagerepo.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ImageRepoSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "80c71e7626f15f53f51c728e895cca78", "score": "0.6926845", "text": "func (ps *PatientroomSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ps.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{patientroom.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: PatientroomSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "4b93b3638022cd8b70c0d73e3935c37b", "score": "0.69262815", "text": "func (ss *SystemequipmentSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ss.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{systemequipment.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: SystemequipmentSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "78e2257eb7effa9084d461e9d66d87a4", "score": "0.69183713", "text": "func (ms *MerchantSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ms.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{merchant.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: MerchantSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "5a2a512bb62d12cc59d35f2426c43c53", "score": "0.6916768", "text": "func (sls *SysLoggingSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = sls.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{syslogging.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: SysLoggingSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "b69188de07911cee0b62a2bf4ce4cae0", "score": "0.68987894", "text": "func (m *DbMap) SelectFloat(query string, args ...interface{}) (float64, error) {\n\treturn SelectFloat(m, query, args...)\n}", "title": "" }, { "docid": "babfeb1cb2e5d9c9fc9e0e8c4f16d7b5", "score": "0.6884797", "text": "func (dms *DispenseMedicineSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = dms.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{dispensemedicine.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: DispenseMedicineSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "88ad6c8c0cb73cef240e344f7bd062ea", "score": "0.6854592", "text": "func (rs *RentalstatusSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = rs.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{rentalstatus.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RentalstatusSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "1af52bad9dfd71c56bcd2f1960763caa", "score": "0.6839589", "text": "func (t *Transaction) SelectFloat(query string, args ...interface{}) (float64, error) {\n\tif t.dbmap.ExpandSliceArgs {\n\t\texpandSliceArgs(&query, args...)\n\t}\n\n\treturn SelectFloat(t, query, args...)\n}", "title": "" }, { "docid": "8ce3a1f9a49da2290e3486e3cb85c129", "score": "0.67842597", "text": "func (uss *UserSessionSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = uss.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{usersession.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: UserSessionSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "144c2f4587354782ecbf0a78610a6499", "score": "0.6780149", "text": "func (mps *MedicalProcedureSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = mps.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{medicalprocedure.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: MedicalProcedureSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9d78fae60fb4665416d085b295c3eb87", "score": "0.6760194", "text": "func (ews *EndWorkSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ews.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{endwork.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: EndWorkSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "203864702a5770ba7fce6febd72f7f9f", "score": "0.6745516", "text": "func (ods *OutboundDealSelect) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ods.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{outbounddeal.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: OutboundDealSelect.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "c4c13c81ed24ff5a7ed80a067afc27f7", "score": "0.6701864", "text": "func (is *ImplementSelect) Float64X(ctx context.Context) float64 {\n\tv, err := is.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "61235339acfb8a5b52cee87f6f916122", "score": "0.67011106", "text": "func (res *RawEventSelect) Float64X(ctx context.Context) float64 {\n\tv, err := res.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "65993cf80c26502d02f5227d53da3e51", "score": "0.66563547", "text": "func (f GetterTypedFunc) Float64() float64 {\n\treturn cast.ToFloat64(f())\n}", "title": "" }, { "docid": "baac6941f7434d670918e1bce73fc65e", "score": "0.6635494", "text": "func SelectNullFloat(e SqlExecutor, query string, args ...interface{}) (sql.NullFloat64, error) {\n\tvar h sql.NullFloat64\n\terr := selectVal(e, &h, query, args...)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn h, err\n\t}\n\treturn h, nil\n}", "title": "" }, { "docid": "a768784c80adf041abd479799ef76f18", "score": "0.65616095", "text": "func (es *EmployeeSelect) Float64X(ctx context.Context) float64 {\n\tv, err := es.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "7ddf5f680480ebe6ea90b644e25d2ae9", "score": "0.6534003", "text": "func (fs *FilmSelect) Float64X(ctx context.Context) float64 {\n\tv, err := fs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9f736c27b7508568c5a3eb2c59177db0", "score": "0.65077245", "text": "func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {\n\treturn SelectNullFloat(t, query, args...)\n}", "title": "" }, { "docid": "08228cec6b4a0d45db34420b185bb118", "score": "0.65020347", "text": "func (ks *KqiSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ks.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "90039432977758d8492a21b281a29b58", "score": "0.65006924", "text": "func (ptgb *PropertyTypeGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = ptgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{propertytype.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: PropertyTypeGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "76937d586acc989d22f1ca5130130410", "score": "0.6500283", "text": "func (t *Transaction) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {\n\tif t.dbmap.ExpandSliceArgs {\n\t\texpandSliceArgs(&query, args...)\n\t}\n\n\treturn SelectNullFloat(t, query, args...)\n}", "title": "" }, { "docid": "c7b2a5cd84153ee40999cc9c43dd6df9", "score": "0.6498412", "text": "func (vs *VeterinarianSelect) Float64X(ctx context.Context) float64 {\n\tv, err := vs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "75c572f921ba98f5f85cb513bb63fa06", "score": "0.64942473", "text": "func (val *Value) Float64() float64 {\n switch val.Data.(type) {\n case int:\n return float64(val.Data.(int))\n case int8:\n return float64(val.Data.(int8))\n case int16:\n return float64(val.Data.(int16))\n case int32:\n return float64(val.Data.(int32))\n case int64:\n return float64(val.Data.(int64))\n case uint:\n return float64(val.Data.(uint))\n case uint8:\n return float64(val.Data.(uint8))\n case uint16:\n return float64(val.Data.(uint16))\n case uint32:\n return float64(val.Data.(uint32))\n case uint64:\n return float64(val.Data.(uint64))\n case float32:\n return float64(val.Data.(float32))\n case float64:\n return float64(val.Data.(float64))\n case string:\n n, err := strconv.ParseFloat(string(val.Data.(string)), 64)\n if err != nil {\n return 0\n }\n return n\n case []byte:\n n, err := strconv.ParseFloat(string(val.Data.([]byte)), 64)\n if err != nil {\n return 0\n }\n return n\n case []rune:\n n, err := strconv.ParseFloat(string(val.Data.([]rune)), 64)\n if err != nil {\n return 0\n }\n return n\n case bool:\n n := float64(0)\n if val.Data.(bool) {\n n = 1\n }\n return n\n default:\n return 0\n }\n return 0\n}", "title": "" }, { "docid": "de6926c3484bd519ac2e36b06651111b", "score": "0.6479298", "text": "func (ksss *K8sStatefulSetSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ksss.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bb1117596eb4a826f96a6f898ada2f6f", "score": "0.6473409", "text": "func (m *DbMap) SelectNullFloat(query string, args ...interface{}) (sql.NullFloat64, error) {\n\treturn SelectNullFloat(m, query, args...)\n}", "title": "" }, { "docid": "61bad552ca2a9047ed8051648210b68f", "score": "0.6459299", "text": "func (pts *PropertyTypeSelect) Float64X(ctx context.Context) float64 {\n\tv, err := pts.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f06a6f7f4e291ce25824397a21dc6af9", "score": "0.64534104", "text": "func (bs *BeerSelect) Float64X(ctx context.Context) float64 {\n\tv, err := bs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b0be8fc8d871f8d955e676f876a491fe", "score": "0.6445818", "text": "func (ms *ModuleSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ms.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "c42bae502d3a469c82844f190da915ed", "score": "0.64444524", "text": "func (cfgb *CounterFamilyGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = cfgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{counterfamily.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: CounterFamilyGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2cd85d681846e3f5125290f8efad4539", "score": "0.6432874", "text": "func (v Value) Float() float64", "title": "" }, { "docid": "5580dc3911f7722c521a17555484ce41", "score": "0.6419064", "text": "func Float64(v float64) *float64 { return &v }", "title": "" }, { "docid": "6839dc0a71349d88494cadb6e6fecc16", "score": "0.6416715", "text": "func (mwis *MessageWithIDSelect) Float64X(ctx context.Context) float64 {\n\tv, err := mwis.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "7c28d79aaaa26882239e63ea5e282e25", "score": "0.64139205", "text": "func (kpgb *KqiPerspectiveGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = kpgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqiperspective.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiPerspectiveGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "10561ad9a99d3eaefa9b5370c0f3004b", "score": "0.64132833", "text": "func (a *okxNumericalValue) Float64() float64 { return float64(*a) }", "title": "" }, { "docid": "6ca406576960dcaa2a55db731606db2a", "score": "0.64071316", "text": "func (regb *RawEventGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = regb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{rawevent.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: RawEventGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3bb571e9d6988e47ae578d326baef76e", "score": "0.6402821", "text": "func (r ReqValue) Float64() float64 {\n\tv, _ := strconv.ParseFloat(string(r), 64)\n\treturn v\n}", "title": "" }, { "docid": "e80bba7e4b7fd72ee8fe7c8d2bb36fde", "score": "0.6400838", "text": "func GetFloat64(key string) float64 { return g2.GetFloat64(key) }", "title": "" }, { "docid": "37dd937af903ebb859c8e35418f57717", "score": "0.6397244", "text": "func (mwis *MessageWithIDSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(mwis.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: MessageWithIDSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := mwis.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "51ecc13db469236c9774409fb39010a3", "score": "0.63909614", "text": "func (grs *GrpcRuleSelect) Float64X(ctx context.Context) float64 {\n\tv, err := grs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d809fb5faa70c585f1c0230af67c7baf", "score": "0.63747394", "text": "func (as *AddressSelect) Float64X(ctx context.Context) float64 {\n\tv, err := as.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3155c0b4a1c53119647e913e5f7537c5", "score": "0.63745654", "text": "func (fgb *FilmGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = fgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{film.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"entc: FilmGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "30e3aaed3f370c01faef2250149200c9", "score": "0.6371381", "text": "func (ksss *K8sStatefulSetSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(ksss.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: K8sStatefulSetSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := ksss.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "def1453f27d21bd41ae998a373b2b306", "score": "0.63692784", "text": "func (vs *VeterinarianSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(vs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: VeterinarianSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := vs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "c1859f951a1425393a9d0e0d56c482dc", "score": "0.63688314", "text": "func asFloat64(v uint64) float64 { return float64(v) }", "title": "" }, { "docid": "30d5e4a3b4421cecc8d3d549bbfb3102", "score": "0.63651836", "text": "func (kgb *KqiGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = kgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{kqi.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: KqiGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "5d718ebf0aa4f290019c4c860992c507", "score": "0.63633776", "text": "func (kps *K8sPodSelect) Float64X(ctx context.Context) float64 {\n\tv, err := kps.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ea0ce4e8e1cb41f322fc5749e16d72a2", "score": "0.63607556", "text": "func (cfs *CounterFamilySelect) Float64X(ctx context.Context) float64 {\n\tv, err := cfs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "930a083cad99625403832d777ccb0df6", "score": "0.6359389", "text": "func (is *ImplementSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(is.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: ImplementSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := is.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "935a3be3ff356d850eba2630d64c0cf1", "score": "0.6355773", "text": "func (os *OrganizationSelect) Float64X(ctx context.Context) float64 {\n\tv, err := os.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b6cf5eb4dba8d4cea3e81050ef75cb41", "score": "0.63505846", "text": "func GetFloat64(v interface{}) float64 {\n\tswitch result := v.(type) {\n\tcase float64:\n\t\treturn result\n\tdefault:\n\t\tif d := GetString(v); d != \"\" {\n\t\t\tvalue, err := strconv.ParseFloat(d, 64)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err.Error())\n\t\t\t}\n\t\t\treturn value\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "b039922d7663634d7b54ab1ef06f0c43", "score": "0.6346406", "text": "func Float64(value reflect.Value) float64 {\n\treturn value.Interface().(float64)\n}", "title": "" }, { "docid": "0b88086ff501e9f2bc516abcc4b45e3a", "score": "0.6339282", "text": "func (bfs *BinaryFileSelect) Float64X(ctx context.Context) float64 {\n\tv, err := bfs.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9fef27f7c8d54a570d011d72de86fa16", "score": "0.6329026", "text": "func (fs *FilmSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(fs.fields) > 1 {\n\t\treturn nil, errors.New(\"entc: FilmSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := fs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "08b59cac5da56b06e7c5023a55c35dbe", "score": "0.63252836", "text": "func (bs *BeerSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(bs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: BeerSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := bs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "9d16ce0295a4f556e44d50625d4ace5e", "score": "0.6322757", "text": "func (vgb *VeterinarianGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = vgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{veterinarian.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: VeterinarianGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "2d1e3c6e9b6d1c613e5a0b6eebdb7479", "score": "0.6319876", "text": "func (kps *K8sPodSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(kps.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: K8sPodSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := kps.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "08a63a1480363ec1da5f1bbcaefc4c74", "score": "0.6314686", "text": "func ToFloat64(field string) float64 {\n\treturn ToFloat6Default(field, 0.0)\n}", "title": "" }, { "docid": "9e9180162b5eef07d83bcc7ab82c8291", "score": "0.6306065", "text": "func (igb *ImplementGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = igb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{implement.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: ImplementGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "6b3dbf413cf3e4ab618c1117fddec150", "score": "0.6305921", "text": "func (ms *MerchantSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ms.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "20bf8326e291a83ee7396fd256f18b9c", "score": "0.6303334", "text": "func (cfs *CounterFamilySelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(cfs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: CounterFamilySelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := cfs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "53770fb6ef45939b444fdbf302e37a7f", "score": "0.6294525", "text": "func (p *PodmanCommand) Float64(opt string) float64 {\n\tflag := p.Flags().Lookup(opt)\n\tif flag == nil {\n\t\treturn 0\n\t}\n\tval, _ := p.Flags().GetFloat64(opt)\n\treturn val\n}", "title": "" }, { "docid": "8a60c11669119fb262a2e13e693f0a8f", "score": "0.6286897", "text": "func (vms *VehicleMakeSelect) Float64X(ctx context.Context) float64 {\n\tv, err := vms.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "52da317414afa37ad65855e92f740edf", "score": "0.62867665", "text": "func (ss *SystemequipmentSelect) Float64X(ctx context.Context) float64 {\n\tv, err := ss.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8c96bb8b708d259c44d9c6283407eb50", "score": "0.6284203", "text": "func (tr *Reader) Float64() float64 {\n\tif tr.err != nil {\n\t\treturn 0\n\t}\n\tb, err := tr.nextCol()\n\tif err != nil {\n\t\ttr.setColError(\"cannot read `float64`\", err)\n\t\treturn 0\n\t}\n\ts := b2s(b)\n\n\tf64, err := strconv.ParseFloat(s, 64)\n\tif err != nil {\n\t\ttr.setColError(\"cannot parse `float64`\", err)\n\t\treturn 0\n\t}\n\treturn f64\n}", "title": "" }, { "docid": "4aa00f71def77526d2285625e9eb3fa4", "score": "0.62799543", "text": "func (es *EmployeeSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(es.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: EmployeeSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := es.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "534a1ff61c10d6a3363378b61f4e4f44", "score": "0.6276289", "text": "func (tools *Tools) GetValueFloat64(element js.Value) float64 {\n\treturn element.Get(\"value\").Float()\n}", "title": "" }, { "docid": "00e9e39f6019c4e5c05d55b18d436989", "score": "0.6275985", "text": "func Float64(key string) (float64, error) {\n\tloadDriver()\n\tv, e := driver.Buffer().GetFloat64(key, \"\")\n\tif e != nil {\n\t\treturn 0, errors.New(e.Error())\n\t} else {\n\t\treturn v, nil\n\t}\n}", "title": "" }, { "docid": "155f277d3b46140da5032b3a2fde6e3d", "score": "0.62748766", "text": "func (ks *KqiSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(ks.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: KqiSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := ks.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "e4ee98e82e715b6604280b7c51a6c0e3", "score": "0.62721497", "text": "func (pts *PropertyTypeSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(pts.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: PropertyTypeSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := pts.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "a35e2448bb6603335b27ae98f06eb259", "score": "0.6267501", "text": "func (dms *DispenseMedicineSelect) Float64X(ctx context.Context) float64 {\n\tv, err := dms.Float64(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "46c4ea264f20b4a5f6f4ccda85b2feb4", "score": "0.6263417", "text": "func (bfgb *BinaryFileGroupBy) Float64(ctx context.Context) (_ float64, err error) {\n\tvar v []float64\n\tif v, err = bfgb.Float64s(ctx); err != nil {\n\t\treturn\n\t}\n\tswitch len(v) {\n\tcase 1:\n\t\treturn v[0], nil\n\tcase 0:\n\t\terr = &NotFoundError{binaryfile.Label}\n\tdefault:\n\t\terr = fmt.Errorf(\"ent: BinaryFileGroupBy.Float64s returned %d results when one was expected\", len(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "f395e96e5d3546a3e15167655d42b851", "score": "0.6262282", "text": "func (s *Store) Float64(r interface{}, err error) (float64, error) {\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tv, ok := r.(float64)\n\tif !ok {\n\t\terr = simplesessions.ErrAssertType\n\t}\n\n\treturn v, err\n}", "title": "" } ]
225a0b22879f53488515c07b812427e2
NewAPIServiceAddressParams creates a new APIServiceAddressParams object with the default values initialized.
[ { "docid": "6e136aaa2b75ab78149fd8e61921a0c6", "score": "0.87587154", "text": "func NewAPIServiceAddressParams() *APIServiceAddressParams {\n\tvar ()\n\treturn &APIServiceAddressParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" } ]
[ { "docid": "f9cb9e45c10f357f5629032cf136e509", "score": "0.7295238", "text": "func NewAPIServiceAddressParamsWithHTTPClient(client *http.Client) *APIServiceAddressParams {\n\tvar ()\n\treturn &APIServiceAddressParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "290a85ccf7ef2a3efccd73183805eed1", "score": "0.72561604", "text": "func NewAPIServiceAddressParamsWithTimeout(timeout time.Duration) *APIServiceAddressParams {\n\tvar ()\n\treturn &APIServiceAddressParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "e2070c100563853364645ca02b64dc44", "score": "0.65003556", "text": "func (o *APIServiceAddressParams) WithContext(ctx context.Context) *APIServiceAddressParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "d82643b56ed24dea16b053c038ebd6b4", "score": "0.6439004", "text": "func NewAPIServiceAddressParamsWithContext(ctx context.Context) *APIServiceAddressParams {\n\tvar ()\n\treturn &APIServiceAddressParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "818467791cf0e8598f8fa2230b7be440", "score": "0.64042044", "text": "func (o *APIServiceAddressParams) WithTimeout(timeout time.Duration) *APIServiceAddressParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "5f1bdf3bb030b3743017227ca88a9cc4", "score": "0.6152553", "text": "func (o *APIServiceAddressParams) WithHTTPClient(client *http.Client) *APIServiceAddressParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "166ef518a3349b38d98478ba8df549c0", "score": "0.6143964", "text": "func (o *APIServiceAddressParams) WithAddress(address string) *APIServiceAddressParams {\n\to.SetAddress(address)\n\treturn o\n}", "title": "" }, { "docid": "bf13b7be861ae5998228cfe57500cb7c", "score": "0.61187696", "text": "func (o *APIServiceAddressParams) WithHeight(height *string) *APIServiceAddressParams {\n\to.SetHeight(height)\n\treturn o\n}", "title": "" }, { "docid": "827e5bd3c5b8d168ad2f821e15d64dc3", "score": "0.58868396", "text": "func (s IpNetwork_getRemoteHost_Params) NewAddress() (IpAddress, error) {\n\tss, err := NewIpAddress(s.Struct.Segment())\n\tif err != nil {\n\t\treturn IpAddress{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "6a5a8760b9af1b97614f9e4e200f9dba", "score": "0.55930746", "text": "func (o *APIServiceAddressParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param address\n\tif err := r.SetPathParam(\"address\", o.Address); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Delegated != nil {\n\n\t\t// query param delegated\n\t\tvar qrDelegated bool\n\t\tif o.Delegated != nil {\n\t\t\tqrDelegated = *o.Delegated\n\t\t}\n\t\tqDelegated := swag.FormatBool(qrDelegated)\n\t\tif qDelegated != \"\" {\n\t\t\tif err := r.SetQueryParam(\"delegated\", qDelegated); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight string\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := qrHeight\n\t\tif qHeight != \"\" {\n\t\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07c6abb54635bf69012487678dd330b2", "score": "0.5560866", "text": "func CreateAddress() *addresspb.Address {\n\ta := addresspb.Address{\n\t\tCorrespondanceAddr: &addresspb.Location{\n\t\t\tLocation: \"loc 1\",\n\t\t\tCity: &addresspb.City{\n\t\t\t\tName: \"Mumbai\",\n\t\t\t\tZipCode: \"400005\",\n\t\t\t\tRegion: addresspb.Division_WEST,\n\t\t\t},\n\t\t},\n\n\t\tAdditionalAddr: []*addresspb.Location{\n\t\t\t{\n\t\t\t\tLocation: \"loc 2\",\n\t\t\t\tCity: &addresspb.City{\n\t\t\t\t\tName: \"Srinagar\",\n\t\t\t\t\tZipCode: \"190001\",\n\t\t\t\t\tRegion: addresspb.Division_NORTH,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tLocation: \"loc 3\",\n\t\t\t\tCity: &addresspb.City{\n\t\t\t\t\tName: \"Imphal\",\n\t\t\t\t\tZipCode: \"795001\",\n\t\t\t\t\tRegion: addresspb.Division_EAST,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tLocation: \"loc 4\",\n\t\t\t\tCity: &addresspb.City{\n\t\t\t\t\tName: \"Mysore\",\n\t\t\t\t\tZipCode: \"570001\",\n\t\t\t\t\tRegion: addresspb.Division_SOUTH,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\treturn &a\n}", "title": "" }, { "docid": "7a4cc897daa72aeebcc44a682f679e78", "score": "0.554043", "text": "func NewAddress(pk ctypes.PubKey) *Address {\n\ta := Address{pk}\n\treturn &a\n}", "title": "" }, { "docid": "32b41a44aeebc11c1601ea853ebc61b1", "score": "0.5496679", "text": "func WithMakeDefault(makeDefault bool) NewAddressOption {\n\treturn func(r *rpc.NewAddrRequest) {\n\t\tr.MakeDefault = makeDefault\n\t}\n}", "title": "" }, { "docid": "d813b6659df9a50da91bc37df9cfbe76", "score": "0.5491356", "text": "func NewGetAddressAgentParams() *GetAddressAgentParams {\n\tvar ()\n\treturn &GetAddressAgentParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "897ae0c0112a537f7c984411d60b1a7d", "score": "0.54828084", "text": "func NewParams(communityTax sdk.Dec, withdrawAddrEnabled bool) Params {\n\treturn Params{\n\t\tCommunityTax: communityTax,\n\t\tWithdrawAddrEnabled: withdrawAddrEnabled,\n\t}\n}", "title": "" }, { "docid": "58350b7a95c8b3625a55cd24076c8eba", "score": "0.54789835", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv4_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv4_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv4_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv4_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "afc5812489fb8f90a432e4849bcac785", "score": "0.5478483", "text": "func NewAddress() platformservices.Address {\n\n\tvar lat = 37.7917146\n\tvar lng = -122.397054\n\n\treturn platformservices.Address{\n\t\tAddressType: platformservices.AddressTypeLegal,\n\t\tStreetAddress: \"100 Main Street\",\n\t\tCity: \"San Francisco\",\n\t\tState: \"CA\",\n\t\tCountry: \"US\",\n\t\tPostalCode: \"94100\",\n\t\tLatitude: &lat,\n\t\tLongitude: &lng,\n\t}\n}", "title": "" }, { "docid": "c1da8f3a42ccdc7511420928335685fc", "score": "0.5346524", "text": "func NewAPIServiceHaltsParams() *APIServiceHaltsParams {\n\tvar ()\n\treturn &APIServiceHaltsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "a8e258bce8bd68983b04c92df543e318", "score": "0.5329579", "text": "func (x *fastReflection_QueryAccountAddressByIDRequest) New() protoreflect.Message {\n\treturn new(fastReflection_QueryAccountAddressByIDRequest)\n}", "title": "" }, { "docid": "03e773f204b56fc7cd055e4822556019", "score": "0.5296433", "text": "func NewUpdateOrganizationBillingAddressParams() *UpdateOrganizationBillingAddressParams {\n\tvar ()\n\treturn &UpdateOrganizationBillingAddressParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "0862da99fd3ccf012c473847fbbc44c3", "score": "0.52896225", "text": "func NewPostGenerateAddressesParams() *PostGenerateAddressesParams {\n\tvar ()\n\treturn &PostGenerateAddressesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "fa44f3a8527c4314f3c6600d5abd690f", "score": "0.5270887", "text": "func (x *fastReflection_AddressBytesToStringRequest) New() protoreflect.Message {\n\treturn new(fastReflection_AddressBytesToStringRequest)\n}", "title": "" }, { "docid": "be54c521b1c2b137162bf7f5f0c80c36", "score": "0.52638984", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "be54c521b1c2b137162bf7f5f0c80c36", "score": "0.52638984", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv4_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "44c9be596a0cf6aa41f743ee3330c353", "score": "0.52606523", "text": "func NewUpdateOrganizationBillingAddressParamsWithHTTPClient(client *http.Client) *UpdateOrganizationBillingAddressParams {\n\tvar ()\n\treturn &UpdateOrganizationBillingAddressParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "a2f94452fa1e4ba60422ccfc71b63ac4", "score": "0.52418715", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "a2f94452fa1e4ba60422ccfc71b63ac4", "score": "0.52418715", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv4_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "c1447565551cb6def04d3ab6d399332e", "score": "0.52308744", "text": "func NewAddress(city, state string) *Address {\n\treturn &Address{\n\t\tCity: city,\n\t\tState: state,\n\t}\n}", "title": "" }, { "docid": "711e6571ab8b07d62b52556f640e13d7", "score": "0.5186676", "text": "func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) {\n\tcontract, err := bindAddress(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "711e6571ab8b07d62b52556f640e13d7", "score": "0.5186676", "text": "func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) {\n\tcontract, err := bindAddress(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "711e6571ab8b07d62b52556f640e13d7", "score": "0.5186676", "text": "func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) {\n\tcontract, err := bindAddress(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "711e6571ab8b07d62b52556f640e13d7", "score": "0.5186676", "text": "func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) {\n\tcontract, err := bindAddress(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "711e6571ab8b07d62b52556f640e13d7", "score": "0.5186676", "text": "func NewAddress(address common.Address, backend bind.ContractBackend) (*Address, error) {\n\tcontract, err := bindAddress(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Address{AddressCaller: AddressCaller{contract: contract}, AddressTransactor: AddressTransactor{contract: contract}, AddressFilterer: AddressFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "4dd02bfba396b6106bd0442494a45ea9", "score": "0.5169941", "text": "func NewParams(acl ACL, daoOwner sdk.Address) Params {\n\treturn Params{\n\t\tACL: acl,\n\t\tDAOOwner: daoOwner,\n\t}\n}", "title": "" }, { "docid": "519f5543d85c4faebba0a9115fc11347", "score": "0.5163522", "text": "func (o *APIServiceAddressParams) WithDelegated(delegated *bool) *APIServiceAddressParams {\n\to.SetDelegated(delegated)\n\treturn o\n}", "title": "" }, { "docid": "1002aa39e73a60fad280f672969a127e", "score": "0.51529175", "text": "func NewAddress(i, ii int) *Address {\n\tn := strconv.Itoa(i)\n\treturn &Address{\n\t\tId: time.Now().UnixNano(),\n\t\tStreet: \"10\" + n + \" Somewhere Lane\",\n\t\tCity: \"Awesome City \" + n,\n\t\tState: func() string {\n\t\t\tif i%2 == 0 {\n\t\t\t\treturn \"PA\"\n\t\t\t}\n\t\t\treturn \"CA\"\n\t\t}(),\n\t\tZip: ii,\n\t}\n}", "title": "" }, { "docid": "e60f67c12d80540453ee94b5de302881", "score": "0.5145576", "text": "func (x *fastReflection_AddressStringToBytesRequest) New() protoreflect.Message {\n\treturn new(fastReflection_AddressStringToBytesRequest)\n}", "title": "" }, { "docid": "61665cb25cd525c9736d1a0781d2897d", "score": "0.5130056", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv6_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv6_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv6_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Tunnel_Ipv6_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "358e62976bc4ad3711459ef6a5724053", "score": "0.51198", "text": "func NewAddress(pk signature.PublicKey) (a Address) {\n\tvar (\n\t\tctx address.Context\n\t\tpkData []byte\n\t)\n\tswitch pk := pk.(type) {\n\tcase ed25519.PublicKey:\n\t\tctx = AddressV0Ed25519Context\n\t\tpkData, _ = pk.MarshalBinary()\n\tcase secp256k1.PublicKey:\n\t\tctx = AddressV0Secp256k1Context\n\t\tpkData, _ = pk.MarshalBinary()\n\tcase sr25519.PublicKey:\n\t\tctx = AddressV0Sr25519Context\n\t\tpkData, _ = pk.MarshalBinary()\n\tdefault:\n\t\tpanic(\"address: unsupported public key type\")\n\t}\n\treturn (Address)(address.NewAddress(ctx, pkData))\n}", "title": "" }, { "docid": "58493d883912ea412655e0d9204733fd", "score": "0.50956416", "text": "func (b *Backend) NewAddress() wallet.Address {\n\taddr := Address{}\n\treturn &addr\n}", "title": "" }, { "docid": "47dc9e6956886002eb723c00b34632d7", "score": "0.5070007", "text": "func (h *Harness) NewAddress() (btcaddr.Address, error) {\n\treturn h.wallet.NewAddress()\n}", "title": "" }, { "docid": "b53609abddb2d8146f9b5539e44a7524", "score": "0.5034216", "text": "func (addressManager *AddressManager) NewAddress() address.Address {\n\treturn addressManager.Address(addressManager.lastAddressIndex + 1)\n}", "title": "" }, { "docid": "607add70b13955f50c9b51972755321d", "score": "0.50104624", "text": "func (as *ApiService) CreateDepositAddress(currency string) (*ApiResponse, error) {\n\treq := NewRequest(http.MethodPost, \"/api/v1/deposit-addresses\", map[string]string{\"currency\": currency})\n\treturn as.Call(req)\n}", "title": "" }, { "docid": "b7d116096a30902273ecddffce8a61aa", "score": "0.50065666", "text": "func NewAddressHelper(AddressHelperURL, jumpHost, jumpPort string) (*AddressHelper, error) {\n\ta, e := NewAddressHelperFromOptions(\n\t\tSetAddressHelperHost(jumpHost),\n\t\tSetAddressHelperPort(jumpPort),\n\t)\n\treturn a, e\n}", "title": "" }, { "docid": "0090451a2e3c4867de3622722b5eb522", "score": "0.49991173", "text": "func NewPostGenerateAddressesParamsWithHTTPClient(client *http.Client) *PostGenerateAddressesParams {\n\tvar ()\n\treturn &PostGenerateAddressesParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "5f140c9ed7c0a64a19f1f143097e0581", "score": "0.49902028", "text": "func NewParams(createWhoisPrice string, updateWhoisPrice string, deleteWhoisPrice string) Params {\n\treturn Params{\n\t\tCreateWhoisPrice: createWhoisPrice,\n\t\tUpdateWhoisPrice: updateWhoisPrice,\n\t\tDeleteWhoisPrice: deleteWhoisPrice,\n\t}\n}", "title": "" }, { "docid": "52ad8f30246c10975eae2b23fcaa60d2", "score": "0.49708536", "text": "func NewParams(defaultSendEnabled bool) Params {\n\treturn Params{\n\t\tSendEnabled: nil,\n\t\tDefaultSendEnabled: defaultSendEnabled,\n\t}\n}", "title": "" }, { "docid": "0c9c7b60f1c520c7a1d52f59c9b89253", "score": "0.4969853", "text": "func NewAddress(street string) *Address {\n // Just return a dummy for STUB\n return &Address{}\n}", "title": "" }, { "docid": "371d792d6be7b69f5bae765aebc566b0", "score": "0.49597535", "text": "func NewParams(tokenCourse, subscriptionPrice, VPNGBPrice,\n\tstorageGBPrice, baseVPNGb, baseStorageGb uint32, courseSigners []sdk.AccAddress) Params {\n\treturn Params{\n\t\tTokenCourse: tokenCourse,\n\t\tSubscriptionPrice: subscriptionPrice,\n\t\tVPNGBPrice: VPNGBPrice,\n\t\tStorageGBPrice: storageGBPrice,\n\t\tBaseVPNGb: baseVPNGb,\n\t\tBaseStorageGb: baseStorageGb,\n\t\tCourseChangeSigners: courseSigners[:],\n\t}\n}", "title": "" }, { "docid": "4625ca1846259114397691c4c1712d3e", "score": "0.49484316", "text": "func (lu *litUiClient) NewAddress() (string, error) {\n\n\t// cointype of 0 means default, not mainnet.\n\t// this is ugly but does prevent mainnet use for now.\n\n\tvar cointype, numadrs uint32\n\n\t// if no arguments given, generate 1 new address.\n\t// if no cointype given, assume type 1 (testnet)\n\n\tnumadrs = 1\n\n\treply := new(litrpc.AddressReply)\n\n\targs := new(litrpc.AddressArgs)\n\targs.CoinType = cointype\n\targs.NumToMake = numadrs\n\n\tfmt.Printf(\"adr cointye: %d num:%d\\n\", args.CoinType, args.NumToMake)\n\terr := lu.rpccon.Call(\"LitRPC.Address\", args, reply)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresponse := reply.WitAddresses[0]\n\t//\tfmt.Fprintf(color.Output, \"new adr(s): %s\\nold: %s\\n\",\n\t//\t\tlnutil.Address(reply.WitAddresses), lnutil.Address(reply.LegacyAddresses))\n\treturn response, nil // reply.WitAddresses[]\n\n}", "title": "" }, { "docid": "e6ed8fa0d06049632676473646359df9", "score": "0.49478227", "text": "func (o *APIServiceAddressParams) SetAddress(address string) {\n\to.Address = address\n}", "title": "" }, { "docid": "127c8cf0a62f905eef3ee293877bf92d", "score": "0.49363875", "text": "func NewAddressGenerator(chainID ChainID) *AddressGenerator {\n\treturn &AddressGenerator{\n\t\tchainID: chainID,\n\t\tstate: zeroAddressState,\n\t}\n}", "title": "" }, { "docid": "40815cf434112f2b3d6bc340361e4499", "score": "0.49304146", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "40815cf434112f2b3d6bc340361e4499", "score": "0.49304146", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_RoutedVlan_Ipv6_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "ed8fd99fcedf879f26dd978ac58b8ad9", "score": "0.49106592", "text": "func NewPostGenerateAddressesParamsWithTimeout(timeout time.Duration) *PostGenerateAddressesParams {\n\tvar ()\n\treturn &PostGenerateAddressesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "557d3407ffa18a076f02dca0d9d4085c", "score": "0.4906653", "text": "func NewAddress(tt btcaddr.Address, forNet *chaincfg.Params) *Address {\n\tt := atomic.NewString(tt.EncodeAddress())\n\treturn &Address{String: t, ForNet: forNet}\n}", "title": "" }, { "docid": "18b1d4c404ae8d4475d48bdbe091e855", "score": "0.4905217", "text": "func (x *fastReflection_Params) New() protoreflect.Message {\n\treturn new(fastReflection_Params)\n}", "title": "" }, { "docid": "e96d3ffb62b75375bfa0775144f0af21", "score": "0.48902068", "text": "func (dcr *ExchangeWallet) NewAddress() (string, error) {\n\treturn dcr.DepositAddress()\n}", "title": "" }, { "docid": "80f1a29443443b8fe401994dcebfcb09", "score": "0.48848626", "text": "func (client *PublicIPAddressesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, options *PublicIPAddressesClientBeginCreateOrUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif publicIPAddressName == \"\" {\n\t\treturn nil, errors.New(\"parameter publicIPAddressName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{publicIpAddressName}\", url.PathEscape(publicIPAddressName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, parameters)\n}", "title": "" }, { "docid": "bfb7a926b2a5b3558d71b252744b0902", "score": "0.48754004", "text": "func WithAddressType(addressType string) NewAddressOption {\n\treturn func(r *rpc.NewAddrRequest) {\n\t\tr.AddressType = addressType\n\t}\n}", "title": "" }, { "docid": "eb87ff75fd371d74bb9c9a551a60d2cd", "score": "0.48725468", "text": "func NewGetAddressAgentParamsWithHTTPClient(client *http.Client) *GetAddressAgentParams {\n\tvar ()\n\treturn &GetAddressAgentParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "a5e376d315e8f584c597e02a6c59cba1", "score": "0.4860307", "text": "func NewAddressGroup(ctx *pulumi.Context,\n\tname string, args *AddressGroupArgs, opts ...pulumi.ResourceOption) (*AddressGroup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AddressGroupId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AddressGroupId'\")\n\t}\n\tif args.Capacity == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Capacity'\")\n\t}\n\tif args.Type == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Type'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"addressGroupId\",\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource AddressGroup\n\terr := ctx.RegisterResource(\"google-native:networksecurity/v1beta1:AddressGroup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d769e1f66a5f992cf2b0f1445dafefed", "score": "0.48548052", "text": "func NewAPI(endpoint, from, accessKeyID, secretAccessKey string) *Option {\n\top := new(Option)\n\n\top.endpoint = endpoint\n\top.source = from\n\top.accessKeyID = accessKeyID\n\top.secretAccessKey = []byte(secretAccessKey)\n\n\treturn op\n}", "title": "" }, { "docid": "0108bf886c1de1cdb07663562a5a8bf1", "score": "0.48492298", "text": "func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *PublicIPAddressesClientGetCloudServicePublicIPAddressOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif roleInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter roleInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{roleInstanceName}\", url.PathEscape(roleInstanceName))\n\tif networkInterfaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter networkInterfaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{networkInterfaceName}\", url.PathEscape(networkInterfaceName))\n\tif ipConfigurationName == \"\" {\n\t\treturn nil, errors.New(\"parameter ipConfigurationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{ipConfigurationName}\", url.PathEscape(ipConfigurationName))\n\tif publicIPAddressName == \"\" {\n\t\treturn nil, errors.New(\"parameter publicIPAddressName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{publicIpAddressName}\", url.PathEscape(publicIPAddressName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\tif options != nil && options.Expand != nil {\n\t\treqQP.Set(\"$expand\", *options.Expand)\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "39eaa4198d3cc00f492c889fa624cbcb", "score": "0.48457786", "text": "func (w *Wallet) NewAddress(s *aklib.DBConfig, pwd []byte, isPublic bool) (*address.Address, error) {\n\tadrmap := w.AddressPublic\n\tvar idx uint32\n\tif !isPublic {\n\t\tadrmap = w.AddressChange\n\t\tidx = 1\n\t}\n\tmaster, err := address.DecryptSeed(w.EncSeed, pwd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tseed := address.HDseed(master, idx, uint32(len(adrmap)))\n\ta, err := address.New(s.Config, seed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tadr := &Address{\n\t\tAddress: a,\n\t\tAdrstr: a.Address58(s.Config),\n\t\tNo: len(adrmap),\n\t}\n\tif err := w.PutAddress(s, pwd, adr, true); err != nil {\n\t\treturn nil, err\n\t}\n\tadrmap[a.Address58(s.Config)] = struct{}{}\n\treturn a, w.put(s)\n}", "title": "" }, { "docid": "4862cd5471687fec87cf08fde3dc9f44", "score": "0.48365244", "text": "func New(svc *svcdef.Service) *ClientServiceArgs {\n\tsvcArgs := ClientServiceArgs{\n\t\tMethArgs: make(map[string]*MethodArgs),\n\t}\n\tfor _, meth := range svc.Methods {\n\t\tm := MethodArgs{}\n\t\t// TODO implement correct map support in client argument generation\n\t\tfor _, field := range meth.RequestType.Message.Fields {\n\t\t\tif field.Type.Map != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewArg := newClientArg(meth.Name, field)\n\t\t\tm.Args = append(m.Args, newArg)\n\t\t}\n\t\tsvcArgs.MethArgs[meth.Name] = &m\n\t}\n\n\treturn &svcArgs\n}", "title": "" }, { "docid": "4dfbf1c77db79b67dadc94553e7dc232", "score": "0.48135123", "text": "func (a *Account) NewAddress() (btcutil.Address, error) {\n\t// Get current block's height and hash.\n\tbs, err := GetCurBlock()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get next address from wallet.\n\taddr, err := a.Wallet.NextChainedAddress(&bs, cfg.KeypoolSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Immediately write updated wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn nil, fmt.Errorf(\"account write failed: %v\", err)\n\t}\n\n\t// Mark this new address as belonging to this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\t// Request updates from btcd for new transactions sent to this address.\n\ta.ReqNewTxsForAddress(addr)\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "c216e00f850f79a8cc1f5053075190d8", "score": "0.48127082", "text": "func NewServiceBindingBindingParams() *ServiceBindingBindingParams {\n\treturn &ServiceBindingBindingParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "c16ab6844a8f935990af612f7c635dbf", "score": "0.4803021", "text": "func (a *Account) NewAddress() (btcutil.Address, error) {\n\t// Get current block's height and hash.\n\trpcc, err := accessClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbs, err := rpcc.BlockStamp()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get next address from wallet.\n\taddr, err := a.KeyStore.NextChainedAddress(&bs, cfg.KeypoolSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Immediately write updated wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn nil, fmt.Errorf(\"account write failed: %v\", err)\n\t}\n\n\t// Mark this new address as belonging to this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\t// Request updates from btcd for new transactions sent to this address.\n\tif err := rpcc.NotifyReceived([]btcutil.Address{addr}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "50043d6def00881c3049ef058a50cdda", "score": "0.4783341", "text": "func NewCreatePublicIPAdressUsingPOSTParams() *CreatePublicIPAdressUsingPOSTParams {\n\tvar ()\n\treturn &CreatePublicIPAdressUsingPOSTParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "2a663c67891591b021a7eff9fbdd2ee7", "score": "0.47762343", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "b118ecf6c0b029f021dc52d5bb2ad93b", "score": "0.4773711", "text": "func NewGetAddressAgentParamsWithTimeout(timeout time.Duration) *GetAddressAgentParams {\n\tvar ()\n\treturn &GetAddressAgentParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "2a663c67891591b021a7eff9fbdd2ee7", "score": "0.47734186", "text": "func (t *OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses) NewAddress(Ip string) (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Address == nil {\n\t\tt.Address = make(map[string]*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address)\n\t}\n\n\tkey := Ip\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.Address[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Address\", key)\n\t}\n\n\tt.Address[key] = &OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_Ipv6_Addresses_Address{\n\t\tIp: &Ip,\n\t}\n\n\treturn t.Address[key], nil\n}", "title": "" }, { "docid": "0f92841675a6744da4f7b112f8b071df", "score": "0.47677585", "text": "func NewGetDepositAddressRequest(server string, currency CurrencyParam) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"currency\", runtime.ParamLocationPath, currency)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/deposits/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = operationPath[1:]\n\t}\n\toperationURL := url.URL{\n\t\tPath: operationPath,\n\t}\n\n\tqueryURL := serverURL.ResolveReference(&operationURL)\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "79961e159525407289e8c49fb111a8f7", "score": "0.4746654", "text": "func NewAPIServiceEstimateCoinBuyParams() *APIServiceEstimateCoinBuyParams {\n\tvar ()\n\treturn &APIServiceEstimateCoinBuyParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5518c79428d4f8d27a99497fa96e0a1b", "score": "0.47447157", "text": "func NewAddressDeriver(network Network, xpubs []string, m int, singleAddress string) *AddressDeriver {\n\treturn &AddressDeriver{\n\t\tnetwork: network,\n\t\txpubs: xpubs,\n\t\tm: m,\n\t\tsingleAddress: singleAddress,\n\t}\n}", "title": "" }, { "docid": "f1dc39116ebab835b5345168f80c8a44", "score": "0.47437236", "text": "func CreateQueryCustomerAddressListRequest() (request *QueryCustomerAddressListRequest) {\nrequest = &QueryCustomerAddressListRequest{\nRpcRequest: &requests.RpcRequest{},\n}\nrequest.InitWithApiInfo(\"BssOpenApi\", \"2017-12-14\", \"QueryCustomerAddressList\", \"\", \"\")\nreturn\n}", "title": "" }, { "docid": "8ec3f082688fd674489e51b8d251da1f", "score": "0.474318", "text": "func (w *Wallet) NewAddress(account uint32,\n\tscope waddrmgr.KeyScope) (btcutil.Address, er.R) {\n\n\tchainClient, err := w.requireChainClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar (\n\t\taddr btcutil.Address\n\t\tprops *waddrmgr.AccountProperties\n\t)\n\terr = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) er.R {\n\t\taddrmgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tvar err er.R\n\t\taddr, props, err = w.newAddress(addrmgrNs, account, scope)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Notify the rpc server about the newly created address.\n\terr = chainClient.NotifyReceived([]btcutil.Address{addr})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tw.NtfnServer.notifyAccountProperties(props)\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "f28073e271b6c118960587e6a7527292", "score": "0.4741903", "text": "func NewAPIServiceHaltsParamsWithTimeout(timeout time.Duration) *APIServiceHaltsParams {\n\tvar ()\n\treturn &APIServiceHaltsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "e523f5aa9248606a64e2fd15657b18ae", "score": "0.47203833", "text": "func New(log *logrus.Entry, db *sqlx.DB, postcodeAPI postcodenl.API, molliePaymentService *mollieServices.PaymentService, selfHTTPAddress string) *API {\n\treturn &API{\n\t\tlog: log,\n\t\tdb: db,\n\t\tpostcodeAPI: postcodeAPI,\n\t\tmolliePaymentService: molliePaymentService,\n\t\tselfHTTPAddress: selfHTTPAddress,\n\t}\n}", "title": "" }, { "docid": "fff2492bf98d356e80c9cfb0a60bc493", "score": "0.47192526", "text": "func NewAPIServiceHaltsParamsWithHTTPClient(client *http.Client) *APIServiceHaltsParams {\n\tvar ()\n\treturn &APIServiceHaltsParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "76b7d7914f6144bfdde519e3bd826758", "score": "0.4715691", "text": "func (s RealmGateway_export_Params) NewParams() (Persistent_SaveParams, error) {\n\tss, err := NewPersistent_SaveParams(s.Struct.Segment())\n\tif err != nil {\n\t\treturn Persistent_SaveParams{}, err\n\t}\n\terr = s.Struct.SetPtr(1, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "76b7d7914f6144bfdde519e3bd826758", "score": "0.4715691", "text": "func (s RealmGateway_export_Params) NewParams() (Persistent_SaveParams, error) {\n\tss, err := NewPersistent_SaveParams(s.Struct.Segment())\n\tif err != nil {\n\t\treturn Persistent_SaveParams{}, err\n\t}\n\terr = s.Struct.SetPtr(1, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "2a6c8aa486736bbc596c697973b82d6e", "score": "0.47060454", "text": "func NewGetPrivateToggleDepositAddressCreationParamsWithHTTPClient(client *http.Client) *GetPrivateToggleDepositAddressCreationParams {\n\tvar ()\n\treturn &GetPrivateToggleDepositAddressCreationParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "4b2ba4a5c7f5936754a62fb10f685490", "score": "0.46941173", "text": "func NewUpdateOrganizationBillingAddressParamsWithTimeout(timeout time.Duration) *UpdateOrganizationBillingAddressParams {\n\tvar ()\n\treturn &UpdateOrganizationBillingAddressParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "d414f4babc42ab2095f7ce0ce419abff", "score": "0.46836075", "text": "func (o *IpamIPAddressesListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "6596b36828ea86bccd99cf0842123d5a", "score": "0.4681565", "text": "func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *PublicIPAddressesClientListCloudServicePublicIPAddressesOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif cloudServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter cloudServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{cloudServiceName}\", url.PathEscape(cloudServiceName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "cc3b7ead4f24c8921300f45eeab68271", "score": "0.46700436", "text": "func NewAddress(path, addr string, net Network, change, addrIndex uint32) *Address {\n\treturn &Address{path: path, addr: addr, net: net, change: change, addrIndex: addrIndex}\n}", "title": "" }, { "docid": "3e4a8f294e19600e99582dda18ea8d60", "score": "0.46644175", "text": "func (wt *Wallet) NewAddress(\n\tscope waddrmgr.KeyScope, account uint32) (types.Address, error) {\n\tvar (\n\t\taddr types.Address\n\t)\n\terr := walletdb.Update(wt.db, func(tx walletdb.ReadWriteTx) error {\n\t\taddrMgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tvar err error\n\t\taddr, _, err = wt.newAddress(addrMgrNs, account, scope)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn addr, nil\n}", "title": "" }, { "docid": "acfb5f1882e572015be8efaeb2c8ecf7", "score": "0.46539158", "text": "func (o *ServiceBindingBindingParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "title": "" }, { "docid": "ad039a81bb3d1d0a97cdda139102e4f7", "score": "0.46350607", "text": "func NewParams(pricePerByte abi.TokenAmount, paymentInterval uint64, paymentIntervalIncrease uint64) (Params, error) {\n\treturn Params{\n\t\tPricePerByte: pricePerByte,\n\t\tPaymentInterval: paymentInterval,\n\t\tPaymentIntervalIncrease: paymentIntervalIncrease,\n\t}, nil\n}", "title": "" }, { "docid": "646ac00a2989fd9ae4d93c35a5acbc7b", "score": "0.46292463", "text": "func configureAddresses(cfg *config.ApplicationConfiguration) {\n\tif cfg.Address != \"\" {\n\t\tif cfg.RPC.Address == \"\" {\n\t\t\tcfg.RPC.Address = cfg.Address\n\t\t}\n\t\tif cfg.Prometheus.Address == \"\" {\n\t\t\tcfg.Prometheus.Address = cfg.Address\n\t\t}\n\t\tif cfg.Pprof.Address == \"\" {\n\t\t\tcfg.Pprof.Address = cfg.Address\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5fbe721ec3291f3992e4af84481b4aa9", "score": "0.461541", "text": "func (x *fastReflection_QueryAccountAddressByIDResponse) New() protoreflect.Message {\n\treturn new(fastReflection_QueryAccountAddressByIDResponse)\n}", "title": "" }, { "docid": "cba9f6fcc307b2688dd2592a6424d375", "score": "0.46116185", "text": "func DefaultParams() Params {\n\treturn Params{\n\t\tCommunityTax: sdk.NewDecWithPrec(2, 2), // 2%\n\t\tWithdrawAddrEnabled: true,\n\t}\n}", "title": "" }, { "docid": "bff39de13e8c68bc918645ce8936ef3e", "score": "0.46082544", "text": "func (walletAPI *WalletAPI) WalletNewAddress(protocol address.Protocol) (address.Address, error) {\n\treturn wallet.NewAddress(walletAPI.wallet.Wallet, protocol)\n}", "title": "" }, { "docid": "5e3668f4369664e4388600b2921db35c", "score": "0.46079788", "text": "func CreateAddress(b types.Address, nonce *big.Int) types.Address {\n\tdata, _ := rlp.EncodeToBytes([]interface{}{b, nonce})\n\treturn types.BytesToAddress(keccak.Keccak256(data)[12:])\n}", "title": "" }, { "docid": "236035b88b7610d0ea1fa058daaa141e", "score": "0.46078137", "text": "func (o *GetRestapiV10AccountAccountIDBusinessAddressDefaultBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateBusinessAddress(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCompany(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateEmail(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateURI(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8ee84d9938aad7dbee66cd8ef895064", "score": "0.46071213", "text": "func NewSearchAbsoluteParams() *SearchAbsoluteParams {\n\tvar (\n\t\tdecorateDefault = bool(true)\n\t)\n\treturn &SearchAbsoluteParams{\n\t\tDecorate: &decorateDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "df4b8041b7596038d59a3a11999bf95a", "score": "0.45939994", "text": "func NewCustomerAccountManagementV1GetDefaultShippingAddressGetParamsWithHTTPClient(client *http.Client) *CustomerAccountManagementV1GetDefaultShippingAddressGetParams {\n\tvar ()\n\treturn &CustomerAccountManagementV1GetDefaultShippingAddressGetParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "78f994ee71dfa8399d146bf60ca4b293", "score": "0.45771167", "text": "func NewQueryByAddressRequest() *QueryByAddressRequest {\n\treturn &QueryByAddressRequest{\n\t\tIndex: \"mapbox.places-v1\",\n\t}\n}", "title": "" } ]
aad4f4fd4bc38ac8c4a1d85192a701af
/ SendFilelist(processNodePtr nd.Node) send current node's filelist to the leader for update
[ { "docid": "e9ea47ed4565d318b22fc85b857cd781", "score": "0.87302226", "text": "func SendFilelist(processNodePtr *nd.Node) {\n\tleaderService := *processNodePtr.LeaderServicePtr\n\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\tcheckError(err)\n\n\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\tcheckError(err)\n\n\tvar buf [512]byte\n\n\t// fmt.Println(\"Send File List's Service:\", leaderService)\n\n\tfor _, filename := range *(*processNodePtr).DistributedFilesPtr {\n\t\t// fmt.Println(\"sending:\", filename)\n\t\tputPacket := pk.EncodePut(pk.Putpacket{processNodePtr.Id, filename})\n\t\t_, err := conn.Write(pk.EncodePacket(\"updateFileList\", putPacket))\n\t\tcheckError(err)\n\n\t\t_, err = conn.Read(buf[0:])\n\t\tcheckError(err)\n\t\t// fmt.Println(\"seding done\")\n\t}\n}", "title": "" } ]
[ { "docid": "34eccdcfa7825552c60a5c9b66c040b8", "score": "0.6714049", "text": "func sendNSPList(fileList []string, out io.Writer, length int) {\n\n\tbuf := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(buf, uint32(length)) // NSP list length\n\tout.Write(buf)\n\n\tfmt.Printf(\"Sending NSP list: %v\\n\", fileList)\n\n\tfor _, path := range fileList {\n\t\tbuf = make([]byte, len(path))\n\t\tcopy(buf, path) // File path followed by newline\n\t\tout.Write(buf)\n\t}\n}", "title": "" }, { "docid": "39ca3da43806c8953dab58a7528e2044", "score": "0.64442784", "text": "func UpdateLeader(fileName string, processNodePtr *nd.Node) {\n\n\tif *processNodePtr.IsLeaderPtr {\n\t\tprocessNodePtr.LeaderPtr.FileList[fileName] = append(processNodePtr.LeaderPtr.FileList[fileName], processNodePtr.Id)\n\t\tprocessNodePtr.LeaderPtr.IdList[processNodePtr.Id] = append(processNodePtr.LeaderPtr.IdList[processNodePtr.Id], fileName)\n\t} else {\n\t\t//fmt.Println(\"UpdateLeader-------\")\n\t\tmyID := processNodePtr.Id\n\t\t//fromPath := (*processNodePtr).LocalPath\n\t\t//toPath := (*processNodePtr).DistributedPath\n\n\t\tleaderService := *processNodePtr.LeaderServicePtr\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\t\tcheckError(err)\n\n\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\tcheckError(err)\n\n\t\tputPacket := pk.EncodePut(pk.Putpacket{myID, fileName})\n\t\t_, err = conn.Write(pk.EncodePacket(\"updateFileList\", putPacket))\n\t\tcheckError(err)\n\n\t\tvar response [128]byte\n\t\t_, err = conn.Read(response[0:])\n\t\tcheckError(err)\n\t}\n}", "title": "" }, { "docid": "6137efff27d66e9b67fac0c1beea436e", "score": "0.6412939", "text": "func (l *InfoList) sendFile2PIDs(lc chan *File2PIDs) {\n\tfor _, val := range l.files {\n\t\tlc <- val\n\t}\n\tclose(lc)\n\treturn\n}", "title": "" }, { "docid": "3654c7ca03fac52be8c0352cb68a40e3", "score": "0.6324023", "text": "func sendPublicFileServers(file FileData) {\n\tserverListMutex.Lock()\n\tnext := serverList\n\tsize := sizeOfServerList()\n\tserverListMutex.Unlock()\n\tvar wg sync.WaitGroup\n\n\twg.Add(size)\n\n\tfor next != nil {\n\t\tgo func(next *ServerItem, file FileData) {\n\t\t\tdefer wg.Done()\n\t\t\tif (*next).UDP_IPPORT != RECEIVE_PING_ADDR {\n\t\t\t\tsystemService, err := rpc.Dial(\"tcp\", (*next).RPC_SERVER_IPPORT)\n\t\t\t\t//checkError(err)\n\t\t\t\tif err != nil {\n\t\t\t\t\tprintln(\"SendPublicMsg To Servers: Server \", (*next).UDP_IPPORT, \" isn't accepting tcp conns so skip it...\")\n\t\t\t\t\t//it's dead but the ping will eventually take care of it\n\t\t\t\t} else {\n\t\t\t\t\tvar reply ServerReply\n\t\t\t\t\toutbuf := Logger.PrepareSend(\"transfer public file\", file)\n\t\t\t\t\terr = systemService.Call(\"NodeService.SendPublicFile\", outbuf, &reply)\n\t\t\t\t\tcheckError(err)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tfmt.Println(\"sent file to server: \", reply.Message)\n\t\t\t\t\t}\n\t\t\t\t\tsystemService.Close()\n\t\t\t\t}\n\t\t\t}\n\t\t}(next, file)\n\t\tnext = (*next).NextServer\n\t}\n\twg.Wait()\n\treturn\n}", "title": "" }, { "docid": "56d7a5c373523a9e9becf287abc4bac4", "score": "0.6309321", "text": "func (manager *ServerManager) SendServerList(session *NetSession.NetSession) {\n\n}", "title": "" }, { "docid": "58a628ce683e7e0187b15ae9cb37973b", "score": "0.6306125", "text": "func GetFileList(processNodePtr *nd.Node) map[string][]ms.Id {\n\t//fmt.Println(\"get file list\")\n\n\tif (*processNodePtr.IsLeaderPtr) == true {\n\t\treturn processNodePtr.LeaderPtr.FileList\n\t}\n\tleaderService := *processNodePtr.LeaderServicePtr\n\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\tcheckError(err)\n\n\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\tcheckError(err)\n\n\t_, err = conn.Write(pk.EncodePacket(\"get filelist\", nil))\n\n\tvar buf [4096 * 5]byte\n\tn, err := conn.Read(buf[0:])\n\tcheckError(err)\n\treceivedPacket := pk.DecodePacket(buf[0:n])\n\n\t// target processes to store replicas\n\tFileList := pk.DecodeFileList(receivedPacket).FileList\n\n\treturn FileList\n\n}", "title": "" }, { "docid": "59e713d9e28de7febba10b5e393b1f0d", "score": "0.6280069", "text": "func Put(processNodePtr *nd.Node, filename string, N int) {\n\tvar idList []ms.Id\n\n\t//fmt.Println(\"PUT--------------------------\")\n\tmyID := (*processNodePtr).Id\n\n\t// local_files -> distributed_files\n\tfrom := processNodePtr.LocalPath + filename\n\tto := processNodePtr.DistributedPath + filename\n\t_, err := copy(from, to)\n\tcheckError(err)\n\n\t*processNodePtr.DistributedFilesPtr = append(*processNodePtr.DistributedFilesPtr, filename)\n\n\tleaderService := *processNodePtr.LeaderServicePtr\n\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\tcheckError(err)\n\n\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\tcheckError(err)\n\n\t// request leader about the destinations to send the replica\n\tpacket := pk.EncodeIdList(pk.IdListpacket{N, myID, []ms.Id{}, filename})\n\t_, err = conn.Write(pk.EncodePacket(\"ReplicaList\", packet))\n\tcheckError(err)\n\n\tvar buf [512]byte\n\tn, err := conn.Read(buf[0:])\n\tcheckError(err)\n\treceivedPacket := pk.DecodePacket(buf[0:n])\n\n\t// target processes to store replicas\n\tidList = pk.DecodeIdList(receivedPacket).List\n\n\t// send file replica to the idLists\n\t// go func() {\n\tSend(processNodePtr, filename, idList, false)\n\n\tputPacket := pk.EncodePut(pk.Putpacket{myID, filename})\n\t_, err = conn.Write(pk.EncodePacket(\"updateFileList\", putPacket))\n\tcheckError(err)\n\n\t_, err = conn.Read(buf[0:])\n\tcheckError(err)\n\n\t// }()\n\n\t//fmt.Println(\"Put Done\")\n}", "title": "" }, { "docid": "4c97bc709b36dbefd04395398aad42a9", "score": "0.6228709", "text": "func Send(processNodePtr *nd.Node, filename string, idList []ms.Id, IsPull bool) {\n\tfor _, id := range idList {\n\t\t//fmt.Println(\"picked desination:\", i)\n\t\t// fmt.Println(\"Sending to\")\n\t\t// id.Print()\n\n\t\tRequestTCP(\"put\", id.IPAddress, filename, processNodePtr, id, IsPull)\n\t}\n}", "title": "" }, { "docid": "5e2d89b70364ac58d120ce3a0e0178f1", "score": "0.6167629", "text": "func updateList(ip string) {\n\tvar lFiles []File_s\n\tconnection, err := net.DialTimeout(\"tcp\", ip+\":3333\", time.Duration(5)*time.Second)\n\tif err != nil {\n\t\treturn\n\t\t//\tpanic(err)\n\t}\n\tdefer connection.Close()\n\tfmt.Fprintf(connection, \"1\\n\")\n\tmessage, _ := bufio.NewReader(connection).ReadString('\\n')\n\n\tjson.Unmarshal([]byte(message), &lFiles)\n\tfor i, _ := range lFiles {\n\t\tlFiles[i].ip = ip\n\t}\n\tfiles = append(files, lFiles...)\n}", "title": "" }, { "docid": "5bba35ea98a3d851c35d9f34d0b8f8b4", "score": "0.6047642", "text": "func (l *InfoList) sendPID2Files(lc chan *PID2Files) {\n\tfor _, val := range l.pids {\n\t\tlc <- val\n\t}\n\tclose(lc)\n\treturn\n}", "title": "" }, { "docid": "7396d187cf0d8b2490ee9fa5b38b4d5d", "score": "0.58777416", "text": "func sendPublicFileClients(file FileData) {\n\tclientListMutex.Lock()\n\tnext := clientList\n\tsize := sizeOfClientList()\n\tclientListMutex.Unlock()\n\tvar wg sync.WaitGroup\n\twg.Add(size)\n\n\tfor next != nil {\n\t\tgo func(next *ClientItem, file FileData) {\n\t\t\tdefer wg.Done()\n\t\t\tif (*next).Username != file.Username {\n\t\t\t\tsystemService, err := rpc.Dial(\"tcp\", (*next).RPC_IPPORT)\n\t\t\t\t//checkError(err)\n\t\t\t\tif err != nil {\n\t\t\t\t\tprintln(\"SendPublicMsg To Clients: Client \", (*next).Username, \" isn't accepting tcp conns so skip it... \")\n\t\t\t\t\t//DELETE CLIENT IF CONNECTION NO LONGER ACCEPTING\n\t\t\t\t\tclientListMutex.Lock()\n\t\t\t\t\tdeleteClientFromList((*next).Username)\n\t\t\t\t\tclientListMutex.Unlock()\n\t\t\t\t} else {\n\t\t\t\t\tvar reply ServerReply\n\t\t\t\t\toutbuf := Logger.PrepareSend(\"transfer public file\", file)\n\t\t\t\t\terr = systemService.Call(\"ClientMessageService.TransferFile\", outbuf, &reply)\n\t\t\t\t\tcheckError(err)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tfmt.Println(\"sent file to client: \", reply.Message)\n\t\t\t\t\t}\n\t\t\t\t\tsystemService.Close()\n\t\t\t\t}\n\t\t\t}\n\t\t}(next, file)\n\n\t\tnext = (*next).NextClient\n\t}\n\n\twg.Wait()\n\treturn\n}", "title": "" }, { "docid": "9c8ff2cc89828b842bce5b0c88c08462", "score": "0.57030326", "text": "func LeaderInit(node *nd.Node, failedLeader string) {\n\ttime.Sleep(time.Second * 5) // 5 == timeOut\n\tmembers := node.AliveMembers()\n\t*node.IsLeaderPtr = true\n\n\tfor _, member := range members {\n\t\tService := member.ID.IPAddress + \":\" + strconv.Itoa(node.DestPortNum)\n\t\tif Service == failedLeader || Service == node.MyService {\n\t\t\tcontinue\n\t\t}\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", Service)\n\t\tcheckError(err)\n\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\tcheckError(err)\n\n\t\t_, err = conn.Write(pk.EncodePacket(\"send a filelist\", nil))\n\t\tcheckError(err)\n\n\t\tvar buf [512]byte\n\t\tn, err := conn.Read(buf[0:])\n\t\tpacket := pk.DecodePacket(buf[:n])\n\t\tdecodedPacket := pk.DecodeFilesPacket(packet)\n\t\tcheckError(err)\n\n\t\tidInfo := decodedPacket.Id\n\t\tfilenames := decodedPacket.FileName\n\t\tfor _, filename := range filenames {\n\t\t\tnode.LeaderPtr.FileList[filename] = append(node.LeaderPtr.FileList[filename], idInfo)\n\n\t\t\t// update IdList\n\t\t\tnode.LeaderPtr.IdList[idInfo] = append(node.LeaderPtr.IdList[idInfo], filename)\n\t\t}\n\t}\n\t// for file, list := range node.LeaderPtr.FileList {\n\t// \tfmt.Println(\"File \", file, \"is stored in the following Addresses:\")\n\t// \tfor i, ID := range list {\n\t// \t\tfmt.Println(\"\t\", i, \":\", ID.IPAddress)\n\t// \t}\n\t// }\n\n\t// store the info about its distributed files\n\tfor _, file := range *node.DistributedFilesPtr {\n\t\tnode.LeaderPtr.FileList[file] = append(node.LeaderPtr.FileList[file], node.Id)\n\t\tnode.LeaderPtr.IdList[node.Id] = append(node.LeaderPtr.IdList[node.Id], file)\n\t}\n\n\tfor file, list := range node.LeaderPtr.FileList {\n\n\t\tif len(list) < node.MaxFail+1 {\n\t\t\tfileOwners := node.LeaderPtr.FileList[file]\n\t\t\tfmt.Println(file)\n\n\t\t\tN := node.MaxFail - len(fileOwners) + 1\n\n\t\t\tdestinations := node.PickReplicas(N, fileOwners)\n\t\t\tfrom := fileOwners[0]\n\n\t\t\tService := from.IPAddress + \":\" + strconv.Itoa(node.DestPortNum)\n\t\t\tfmt.Println(\"Service: \", Service)\n\n\t\t\tif Service == node.MyService { // if the sender is the current node (Leader)\n\t\t\t\tSend(node, file, destinations, false)\n\n\t\t\t} else {\n\t\t\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", Service)\n\t\t\t\tcheckError(err)\n\t\t\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\t\t\tcheckError(err)\n\t\t\t\tpacket := pk.EncodeTCPsend(pk.TCPsend{destinations, file, false})\n\t\t\t\t_, err = conn.Write(pk.EncodePacket(\"send\", packet))\n\t\t\t\tcheckError(err)\n\t\t\t\tvar buf [512]byte\n\t\t\t\t_, err = conn.Read(buf[0:])\n\t\t\t\tcheckError(err)\n\t\t\t}\n\t\t\t//fmt.Println(\"number of\", file, \"replica is balanced now\")\n\t\t}\n\n\t\t//fmt.Println(file, \"list updated\")\n\t}\n\n\tfmt.Println(\"Leader Init completed\")\n}", "title": "" }, { "docid": "1afc8143e02c4dd27f615a89cd02859b", "score": "0.5672411", "text": "func (m *Master) RPCList(args gfs.ListArg, reply *gfs.ListReply) error {\n\tlog.Infof(\"master[%v], RPCList, args[%+v]\", m.address, args)\n\n\tpathInfo, err := m.nm.List(args.Path)\n\treply.Files = pathInfo\n\treply.Error = err\n\treturn nil\n}", "title": "" }, { "docid": "970f5d47ff9b1d9e5c27468dd9fd649e", "score": "0.56157535", "text": "func Pull(processNodePtr *nd.Node, filename string, N int) {\n\t// fmt.Println(\"PULL---------------\")\n\n\tfiles, err := ioutil.ReadDir(processNodePtr.DistributedPath)\n\tcheckError(err)\n\n\t// if the file is inside the distributed folder of the process, just move it\n\tfor _, file := range files {\n\t\tif file.Name() == filename {\n\t\t\tsrc := processNodePtr.DistributedPath + filename\n\t\t\tdest := processNodePtr.LocalPath + filename\n\t\t\tcopy(src, dest)\n\t\t\tfmt.Println(\"Received a file:\", filename)\n\t\t\treturn\n\t\t}\n\t}\n\n\tmyID := processNodePtr.Id\n\n\tleaderService := *processNodePtr.LeaderServicePtr\n\n\t// process is not the leader, send a request to the leader\n\tif *processNodePtr.IsLeaderPtr == false {\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\t\tcheckError(err)\n\n\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\tcheckError(err)\n\n\t\tpacket := pk.EncodeTCPsend(pk.TCPsend{[]ms.Id{myID}, filename, true})\n\t\t_, _ = conn.Write(pk.EncodePacket(\"request\", packet))\n\t\tcheckError(err)\n\n\t\tvar buf [512]byte\n\t\tn, err := conn.Read(buf[0:])\n\t\tcheckError(err)\n\t\treceivedPacket := pk.DecodePacket(buf[0:n])\n\t\tfmt.Println(receivedPacket.Ptype)\n\t} else { // process is the leader, DIY\n\t\tdestinations := []ms.Id{myID}\n\t\tfileOwners, exists := processNodePtr.LeaderPtr.FileList[filename]\n\t\tfrom := fileOwners[0]\n\t\tService := from.IPAddress + \":\" + strconv.Itoa(processNodePtr.DestPortNum)\n\n\t\tif !exists {\n\t\t\tfmt.Println(filename + \" is not found in the system\")\n\t\t} else {\n\t\t\t// fmt.Println(\"telling DFs to send a file to you...\", nil)\n\t\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", Service)\n\t\t\tcheckError(err)\n\t\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\t\tcheckError(err)\n\t\t\tpacket := pk.EncodeTCPsend(pk.TCPsend{destinations, filename, true})\n\t\t\t_, err = conn.Write(pk.EncodePacket(\"send\", packet))\n\t\t\tcheckError(err)\n\t\t\tvar buf [512]byte\n\t\t\t_, err = conn.Read(buf[0:])\n\t\t\tcheckError(err)\n\t\t}\n\t}\n\n\t// fmt.Println(\"pull Done\")\n}", "title": "" }, { "docid": "3d6c61f011a071594dce5a718900ae22", "score": "0.56052256", "text": "func syncFileMap(filename string, new_status []string, master_call bool) {\n\tif !master_call {\n\t\tcheck_list := make(map[string]int)\n\t\tfor _, v := range new_status {\n\t\t\tpair := strings.Split(v, \" \")\n\t\t\tver, _ := strconv.Atoi(pair[1])\n\t\t\tcheck_list[pair[0]] = ver\n\t\t}\n\t\tif val, exist := fileMap[filename]; exist {\n\t\t\told_info := true\n\t\t\tfor _, status := range val {\n\t\t\t\tif v, ok := check_list[status.ip]; ok {\n\t\t\t\t\tif status.version != v {\n\t\t\t\t\t\tcheck_list[status.ip] = int(math.Max(float64(v), float64(status.version)))\n\t\t\t\t\t\told_info = false\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\told_info = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(val) != len(new_status) {\n\t\t\t\told_info = false\n\t\t\t}\n\t\t\tif old_info {\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tif len(new_status) == 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfmt.Println(\"syncFileMap: member:\\n\")\n\t\tfmt.Println(new_status)\n\t\tupdate := []fileStatus{}\n\t\tfor key, val := range check_list {\n\t\t\tupdate = append(update, fileStatus{key, val})\n\t\t}\n\t\tfileMap[filename] = update\n\n\t\tif len(new_status) == 0 {\n\t\t\tdelete(fileMap, filename)\n\t\t}\n\n\t}\n\n\tnew_status = []string{}\n\tfor _, status := range fileMap[filename] {\n\t\ttemp := status.ip + \" \" + strconv.Itoa(status.version)\n\t\tnew_status = append(new_status, temp)\n\t}\n\tif master_call {\n\t\tfmt.Println(\"syncFileMap: master:\\n\")\n\t\tfmt.Println(new_status)\n\t}\n\n\tmsg := \"FileUpdate\\n\" + filename + \"\\n\"\n\tfor _, str := range new_status {\n\t\tmsg += str + \"\\n\"\n\t}\n\tchannel <- msg\n}", "title": "" }, { "docid": "c4c36661be2093c4e41ae15904fa7c33", "score": "0.5602344", "text": "func handleSendNodeList(rw *bufio.ReadWriter) {\n\n\ts := \"START handleSendNodeList() - SEND-NODELIST (SNL) - Sends the nodeList to another Node\"\n\tlog.Debug(\"ROUTINGNODE: HDLR \" + s)\n\n\t// GET nodeList\n\tsendNodeList := GetNodeList()\n\n\t// SENT - RESPOND - SEND NODELIST\n\tjs, _ := json.Marshal(sendNodeList)\n\ts = string(js)\n\t_, err := rw.WriteString(s + \"\\n\")\n\tcheckErr(err)\n\terr = rw.Flush()\n\tcheckErr(err)\n\ts = \"Sent Nodelist to another node\"\n\tlog.Info(\"ROUTINGNODE: HDLR -H sent \" + s)\n\n\t// RCVD - THANK YOU\n\tmsgThankYou, err := rw.ReadString('\\n')\n\tcheckErr(err)\n\tmsgThankYou = strings.Trim(msgThankYou, \"\\n \")\n\ts = \"-H rcvd - \" + msgThankYou\n\tlog.Info(\"ROUTINGNODE: HDLR \" + s)\n\n\ts = \"END handleSendNodeList() - SEND-NODELIST (SNL) - Sends the nodeList to another Node\"\n\tlog.Debug(\"ROUTINGNODE: HDLR \" + s)\n\n}", "title": "" }, { "docid": "547426bd1ae94e6c19db51bc3c52c753", "score": "0.55737585", "text": "func (ftp *FTP)List()(file []string){\n\tpassp := ftp.Passive()\n\tftp.Request(\"LIST\")\n\tnwcon := ftp.NewCon(passp)\n\tftp.Response()\n\treader := bufio.NewReader(nwcon)\n\tftp.Response()\n\tfor{\n\tline,err := reader.ReadString('\\n')\n\tif err == io.EOF{\n\t\tbreak\n\t}else if err != nil{\n\t\treturn\n\t}\n\tfile = append(file,string(line))\n\tnwcon.Close()\n\t}\n\treturn \n}", "title": "" }, { "docid": "2ee7c1c644032eea1b28370b7d9c4931", "score": "0.5541722", "text": "func (u *FileHandler) Send() error {\n\tlog.Println(\"Folder:\", u.FileFolder, \"Address:\", u.Address)\n\tserver, err := net.Dial(\"tcp\", u.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer server.Close()\n\n\tlog.Println(\"Connected.\")\n\n\tfiles, err := CHashFile(u.FileFolder)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilesInByte, err := json.Marshal(files)\n\tif err != nil {\n\t\tlog.Println(\"File in bytes:\", err)\n\t\treturn err\n\t}\n\n\t_, err = server.Write(filesInByte)\n\tif err != nil {\n\t\tlog.Println(\"write server :\", err)\n\t\treturn err\n\t}\n\n\tfdec := json.NewDecoder(server) // fdec buffering\n\tfor {\n\t\tvar req File\n\t\t// decode to File object (from fdec buffering)\n\t\tif err := fdec.Decode(&req); err != nil {\n\t\t\treturn errors.New(\"Decoding error: EOF\")\n\t\t}\n\n\t\t// check if no files found in (fdec buffering)\n\t\tif req.Name == \"\" {\n\t\t\tlog.Println(\"done!\")\n\t\t\treturn nil\n\t\t}\n\n\t\tvar found bool\n\t\tfor _, f := range files {\n\t\t\tif f == req {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\treturn errors.New(\"requested file not found\")\n\t\t}\n\n\t\tlog.Println(\"sending: \", req.Name)\n\t\tfi, err := os.Open(filepath.Join(u.FileFolder, req.Name)) // get specific path file name\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbytechunk := make([]byte, BUFFERSIZE)\n\t\t// run to goroutine\n\t\tgo func(server net.Conn, bc []byte) {\n\t\t\tfor {\n\t\t\t\t_, err = fi.Read(bytechunk)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tlog.Println(\"end:\", err) // indicate read end of file.\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\tserver.Write(bytechunk)\n\t\t\t}\n\t\t\tlog.Println(\"File has been sent!\")\n\t\t}(server, bytechunk)\n\t}\n}", "title": "" }, { "docid": "506cfd34b3e46fce48ca1b4310d800d2", "score": "0.55404085", "text": "func (p *peer) sendPeerList() {\n\tpeers, err := p.net.validatorIPs()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tmsg, err := p.net.b.PeerList(peers)\n\tif err != nil {\n\t\tp.net.log.Warn(\"failed to send PeerList message due to %s\", err)\n\t\treturn\n\t}\n\n\tlenMsg := len(msg.Bytes())\n\tsent := p.Send(msg, true)\n\tif sent {\n\t\tp.net.peerList.numSent.Inc()\n\t\tp.net.peerList.sentBytes.Add(float64(lenMsg))\n\t\tp.net.sendFailRateCalculator.Observe(0, p.net.clock.Time())\n\t\tp.peerListSent.SetValue(true)\n\t} else {\n\t\tp.net.peerList.numFailed.Inc()\n\t\tp.net.sendFailRateCalculator.Observe(1, p.net.clock.Time())\n\t}\n}", "title": "" }, { "docid": "d5a73bb11ac80c47d456ca4015761763", "score": "0.5496203", "text": "func (self *NotificationReader) sendMessageList(\n\tctx context.Context, message_list *crypto_proto.MessageList) {\n\tfor {\n\t\tif atomic.LoadInt32(&self.IsPaused) == 0 {\n\t\t\terr := self.sendToURL(ctx, message_list)\n\t\t\t// Success!\n\t\t\tif err == nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Failed to fetch the URL - This could happen because\n\t\t\t// the server is overloaded, or the client is off the\n\t\t\t// network. We need to back right off and retry the\n\t\t\t// POST again.\n\t\t\tself.logger.Info(\"Failed to fetch URL %v: %v\",\n\t\t\t\tself.connector.GetCurrentUrl()+self.handler, err)\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\n\t\t\t// Wait for the maximum length of time\n\t\t\t// and try to rekey the next URL.\n\t\tcase <-time.After(self.maxPoll):\n\t\t\tself.connector.ReKeyNextServer()\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0214b80d8c17e74d7adcd2d6c0c596f", "score": "0.54633456", "text": "func (c *Config) List(fileID int64) (*jason.Object, error) {\n\tv, err := send(c.token, \"/files/list\", \"parent_id=\"+strconv.FormatInt(fileID, 10))\n\treturn v, err\n}", "title": "" }, { "docid": "18e6bbbf40b769632dabb4170f6c0014", "score": "0.5373802", "text": "func addFileToFileList(file tasks.FileCopyEnvelope) {\n\tf, err := os.OpenFile(config.Flags.OutputPath+\"/nrdiag-filelist.txt\", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)\n\tif err != nil {\n\t\tlog.Info(\"Error writing output file\", err)\n\t\tlog.Info(permissionsError)\n\t}\n\tdefer f.Close()\n\n\tif _, err = f.WriteString(\"\\nStored file name:\" + file.StoreName() + \"\\nOriginal path:\" + file.Path + \"\\r\\n\"); err != nil {\n\t\tlog.Info(\"Error writing output file\", err)\n\t}\n}", "title": "" }, { "docid": "bd1c0bd9e9b3d528dc1ebbfb3d5b7c23", "score": "0.53734195", "text": "func updFileNameList(fl *[]*spdx.File) updater {\n\treturn func(tok *Token) error {\n\t\tfile := &spdx.File{Name: spdx.Str(tok.Value, tok.Meta)}\n\t\t*fl = append(*fl, file)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "5a6af91fe263d2b4f3de52247b84b397", "score": "0.53489745", "text": "func (m Matcher) sendListResponse(requestMessage telegram.RequestMessage) error {\n\tfiles := fortune.GetList()\n\n\tresponseText := \"```\"\n\n\t// Add one line per file\n\tfor _, file := range files {\n\t\tresponseText = responseText + fmt.Sprintf(\"\\n%s\", file)\n\t}\n\n\tresponseText = responseText + \"```\"\n\n\tresponseMessage := telegram.Message{\n\t\tText: responseText,\n\t\tParseMode: \"Markdown\",\n\t}\n\n\treturn telegram.SendMessage(requestMessage, responseMessage)\n}", "title": "" }, { "docid": "a8b2b4d3a80c1758d556b86b68e98cc2", "score": "0.5343069", "text": "func (n *Node) SendAppendEntriesToPeers(peerList []uint32) {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\t// the maximum number of LogEntries appended each time\n\tmaximumEntryListLength := uint64(n.NodeConfigInstance.Parameters.MaxLogUnitsRecover)\n\t// local term when begin to send AppendEntries\n\tstartCurrentTerm:= n.NodeContextInstance.CurrentTerm\n\n\tfor i, peer := range n.PeerList {\n\t\t// peerList == nil means send to all peers\n\t\t// if peerList != nil, only send to peers in peerList\n\t\tif peerList != nil && !utils.NumberInUint32List(peerList, peer.PeerId) {\n\t\t\tn.NodeLogger.Debugf(\"When sending AppendEntries, Node %d is skipped.\", peer.PeerId)\n\t\t\tcontinue\n\t\t}\n\t\tindexIntermediate := i\n\t\tn.NodeLogger.Debugf(\"Trigger a goroutine for AppendEntries to node %d at Term %d\",\n\t\t\tpeer.PeerId, startCurrentTerm)\n\t\tgo func() {\n\t\t\tn.mutex.Lock()\n\t\t\t// get out of the module when finding that the node is not leader\n\t\t\tif n.NodeContextInstance.NodeState != Leader {\n\t\t\t\tn.NodeLogger.Debugf(\"Before sending AppendEntries to %d, state has changed to %d.\",\n\t\t\t\t\tn.PeerList[indexIntermediate].PeerId, n.NodeContextInstance.NodeState)\n\t\t\t\tn.mutex.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// for this time, begin from index of nextIndex - 1\n\t\t\tnextIndexRecord := n.PeerList[indexIntermediate].NextIndex\n\t\t\tprevIndexRecord := nextIndexRecord - 1\n\t\t\tmaximumIndex := n.LogEntryInMemory.MaximumIndex()\n\t\t\t// note that entry list begins from nextIndex, and length new never exceeds maximumEntryListLength\n\t\t\tentryLength := utils.Uint64Min(maximumEntryListLength, maximumIndex - prevIndexRecord)\n\t\t\tn.NodeLogger.Debugf(\"Before sending AppendEntries to peer %d, nextIndex: %d,\" +\n\t\t\t\t\" prevIndex: %d, maximumIndex: %d, length of entry to be attached: %d\",\n\t\t\t\tn.PeerList[indexIntermediate].PeerId, nextIndexRecord, prevIndexRecord, maximumIndex, entryLength)\n\n\t\t\t// fill in the entry list for append\n\t\t\tentryList := make([]*protobuf.Entry, entryLength)\n\t\t\tfor j := prevIndexRecord + 1; j <= prevIndexRecord + entryLength; j ++ {\n\t\t\t\tlogEntry, err := n.LogEntryInMemory.FetchLogEntry(j)\n\t\t\t\tif err != nil {\n\t\t\t\t\tn.NodeLogger.Errorf(\"Error happens when fetching LogEntry %d, error: %s\", j, err)\n\t\t\t\t\tn.mutex.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tentryList[j - prevIndexRecord - 1] = logEntry.Entry\n\t\t\t}\n\n\t\t\t// get prevTerm\n\t\t\tprevEntryTerm := uint64(0)\n\t\t\tif prevIndexRecord != 0{\n\t\t\t\tlogEntryPrev, err := n.LogEntryInMemory.FetchLogEntry(prevIndexRecord)\n\t\t\t\tif err != nil {\n\t\t\t\t\tn.NodeLogger.Errorf(\"Error happens when fetching LogEntry %d, error: %s\", prevIndexRecord, err)\n\t\t\t\t\tn.mutex.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tprevEntryTerm = logEntryPrev.Entry.Term\n\t\t\t}\n\n\t\t\t// construct the request\n\t\t\trequest := &protobuf.AppendEntriesRequest{\n\t\t\t\tTerm: n.NodeContextInstance.CurrentTerm,\n\t\t\t\tNodeId: n.NodeConfigInstance.Id.SelfId,\n\t\t\t\tPrevEntryIndex: prevIndexRecord,\n\t\t\t\tPrevEntryTerm: prevEntryTerm,\n\t\t\t\tCommitEntryIndex: n.NodeContextInstance.CommitIndex,\n\t\t\t\tEntryList: entryList,\n\t\t\t}\n\t\t\t// unlock before send the request by GRPC\n\t\t\tn.mutex.Unlock()\n\n\t\t\tn.NodeLogger.Debugf(\"Sending AppendEntries to peer %d, %+v.\",\n\t\t\t\tn.PeerList[indexIntermediate].PeerId, request)\n\t\t\tresponse, err := n.PeerList[indexIntermediate].GrpcClient.SendGrpcAppendEntries(request)\n\t\t\tif err != nil {\n\t\t\t\tn.NodeLogger.Errorf(\"Send GRPC AppendEntries fails, error: %s.\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tn.NodeLogger.Debugf(\"Get response from AppendEntries, %+v.\", response)\n\n\t\t\t// now begin to process the response\n\t\t\tn.mutex.Lock()\n\t\t\t// get out of the leader module when finding that the node is not leader\n\t\t\tif n.NodeContextInstance.NodeState != Leader {\n\t\t\t\tn.NodeLogger.Debugf(\"Before getting AppendEntries response from %d, state has changed to %d.\",\n\t\t\t\t\tn.PeerList[indexIntermediate].PeerId, n.NodeContextInstance.NodeState)\n\t\t\t\tn.mutex.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// become follower if the remote has higher term number\n\t\t\tif response.Term > startCurrentTerm {\n\t\t\t\tn.NodeLogger.Debugf(\"Receiving AppendEntries response, but remote term of %d has changed to %d.\",\n\t\t\t\t\tresponse.NodeId, response.Term)\n\t\t\t\tn.NodeContextInstance.HopToCurrentLeaderId = 0\n\t\t\t\tn.BecomeFollower(response.Term)\n\t\t\t\tn.mutex.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// if still a valid leader, then process the response\n\t\t\tif response.Term == startCurrentTerm {\n\n\t\t\t\tif response.Success {\n\t\t\t\t\tif prevIndexRecord+1 <= prevIndexRecord+entryLength {\n\t\t\t\t\t\tn.NodeLogger.Debugf(\"Peer %d append entry from %d to %d succeeded.\", response.NodeId,\n\t\t\t\t\t\t\tprevIndexRecord+1, prevIndexRecord+entryLength)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tn.NodeLogger.Debugf(\"Peer %d append no entries (for heartbeat).\", response.NodeId)\n\t\t\t\t\t}\n\n\t\t\t\t\t// update nextIndex\n\t\t\t\t\tn.PeerList[indexIntermediate].NextIndex = nextIndexRecord + entryLength\n\t\t\t\t\t// if prevIndex matches in peers' local LogMemory (Success == true)\n\t\t\t\t\t// then update matchIndex equal to the index of the last appended LogEntry\n\t\t\t\t\tif n.PeerList[indexIntermediate].NextIndex-1 > n.PeerList[indexIntermediate].MatchIndex {\n\t\t\t\t\t\tn.PeerList[indexIntermediate].MatchIndex = n.PeerList[indexIntermediate].NextIndex - 1\n\t\t\t\t\t}\n\n\t\t\t\t\torigCommitIndex := n.NodeContextInstance.CommitIndex\n\t\t\t\t\t// find whether there is an LogEntry that has been logged in LogMemory by majority of peers\n\t\t\t\t\tfor k := origCommitIndex + 1; k <= n.LogEntryInMemory.MaximumIndex(); k++ {\n\t\t\t\t\t\t// count itself first\n\t\t\t\t\t\tmatchedPeers := 1\n\t\t\t\t\t\t// count the followers\n\t\t\t\t\t\tfor _, peerInstance := range n.PeerList {\n\t\t\t\t\t\t\tif peerInstance.MatchIndex >= k {\n\t\t\t\t\t\t\t\tmatchedPeers += 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if majority (>n/2+1) of peers commit, then itself commit\n\t\t\t\t\t\tif 2*matchedPeers > len(n.NodeConfigInstance.Id.PeerId)+1 {\n\t\t\t\t\t\t\tn.NodeContextInstance.CommitIndex = k\n\t\t\t\t\t\t\tn.NodeLogger.Infof(\"Majority of peers append LogEntry \"+\n\t\t\t\t\t\t\t\t\"with index %d, now can commit it.\", k)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some update to commitIndex happened, then start the commit goroutine\n\t\t\t\t\tif n.NodeContextInstance.CommitIndex > origCommitIndex {\n\t\t\t\t\t\tn.NodeLogger.Debugf(\"Commitment is to be triggered by AppendEntries success in term %d, \"+\n\t\t\t\t\t\t\t\"original commit index %d, to be committed index %d.\",\n\t\t\t\t\t\t\tstartCurrentTerm, origCommitIndex, n.NodeContextInstance.CommitIndex)\n\t\t\t\t\t\t// begin to update statemap\n\t\t\t\t\t\tn.NodeContextInstance.TriggerCommitChannel()\n\t\t\t\t\t\t// tell other followers for commitIndex update\n\t\t\t\t\t\tn.NodeContextInstance.TriggerAEChannel()\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\t// if appending LogEntry does not succeed, decrease nextIndex\n\t\t\t\t\tif response.ConflictEntryTerm > 0 {\n\t\t\t\t\t\tlastIndexOfTerm, err := n.LogEntryInMemory.FetchLastIndexOfTerm(response.ConflictEntryTerm)\n\t\t\t\t\t\tif err == storage.InMemoryNoSpecificTerm {\n\t\t\t\t\t\t\tn.PeerList[indexIntermediate].NextIndex = response.ConflictEntryIndex\n\t\t\t\t\t\t} else if err != nil {\n\t\t\t\t\t\t\tn.NodeLogger.Errorf(\"Error happens when searching certain term %d, error: %s\",\n\t\t\t\t\t\t\t\tresponse.ConflictEntryTerm, err)\n\t\t\t\t\t\t\tn.mutex.Unlock()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tn.PeerList[indexIntermediate].NextIndex = lastIndexOfTerm + 1\n\t\t\t\t\t\t\tn.NodeLogger.Debugf(\"Set NextIndex of peer %d as lastIndexOfTerm + 1 (%d)\",\n\t\t\t\t\t\t\t\tindexIntermediate, lastIndexOfTerm+1)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// note that conflict entry index is often the first LogEntry leader sends\n\t\t\t\t\t\t// thus, setting it as nextIndex is a kind of decrement (NextIndex--)\n\t\t\t\t\t\tn.PeerList[indexIntermediate].NextIndex = response.ConflictEntryIndex\n\t\t\t\t\t\t// meaning the remote node has no LogEntries\n\t\t\t\t\t\tif response.ConflictEntryIndex == 0 {\n\t\t\t\t\t\t\tn.PeerList[indexIntermediate].NextIndex = 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tn.NodeLogger.Debugf(\"Set NextIndex of peer %d as ConflictEntryIndex (%d)\",\n\t\t\t\t\t\t\tindexIntermediate, response.ConflictEntryIndex)\n\t\t\t\t\t}\n\t\t\t\t\tn.NodeLogger.Debugf(\"The nextIndex of node %d has changed to %d\",\n\t\t\t\t\t\tn.PeerList[indexIntermediate].PeerId, n.PeerList[indexIntermediate].NextIndex)\n\n\t\t\t\t\t// start a new goroutine to process remaining entry append work\n\t\t\t\t\tappendAgainList := []uint32{n.PeerList[indexIntermediate].PeerId}\n\t\t\t\t\tgo n.SendAppendEntriesToPeers(appendAgainList)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// don't forget to unlock mutex\n\t\t\tn.mutex.Unlock()\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "83b2701dc58a9b08df71c7acc65517e5", "score": "0.53311074", "text": "func SendList(boardID, count, eotMode int, addrlist []int16, data []byte) {\n\tn := append(addrlist, NOADDR)\n\tC.SendList(C.int(boardID), (*C.short)(&n[0]),\n\t\tunsafe.Pointer(&data[0]), C.size_g(count), C.int(eotMode))\n}", "title": "" }, { "docid": "39e5569f8a3dc71ef2c6eec54d99811c", "score": "0.521386", "text": "func RemoveFile(nodePtr *nd.Node, filename string) {\n\tleaderService := *nodePtr.LeaderServicePtr\n\n\t// if the processor is not the leader, request the leader to distribute the messages\n\tif leaderService != nodePtr.MyService {\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", leaderService)\n\t\tcheckError(err)\n\n\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\tcheckError(err)\n\n\t\t// send the leader about the remove request\n\t\t_, err = conn.Write(pk.EncodePacket(\"Remove\", []byte(filename)))\n\n\t\tvar buf [4096]byte\n\t\tn, err := conn.Read(buf[0:])\n\t\tcheckError(err)\n\t\treceivedPacket := pk.DecodePacket(buf[0:n])\n\t\tfmt.Println(receivedPacket.Ptype)\n\t} else { // if the processor is the leader, DIY\n\t\tfileOwners, exists := nodePtr.LeaderPtr.FileList[filename]\n\t\t//udate filelist\n\t\tdelete(nodePtr.LeaderPtr.FileList, filename)\n\n\t\t//update idlist\n\t\tfor id, filelist := range nodePtr.LeaderPtr.IdList {\n\t\t\tfor i, file := range filelist {\n\t\t\t\tif file == filename {\n\t\t\t\t\t(*nodePtr.LeaderPtr).IdList[id] = append((*nodePtr.LeaderPtr).IdList[id][:i], (*nodePtr.LeaderPtr).IdList[id][i+1:]...)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif exists {\n\t\t\tfmt.Println(\"File Found and removed it\")\n\t\t} else {\n\t\t\tfmt.Println(\"File not found\")\n\t\t}\n\n\t\t// make each file owner to remove the file\n\t\tfor _, fileOwner := range fileOwners {\n\t\t\tService := fileOwner.IPAddress + \":\" + strconv.Itoa(nodePtr.DestPortNum)\n\t\t\tif Service == nodePtr.MyService { // if leader have the file, remove it\n\t\t\t\tRemove(nodePtr, filename)\n\t\t\t} else {\n\t\t\t\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", Service)\n\t\t\t\tcheckError(err)\n\t\t\t\tconn, err := net.DialUDP(\"udp\", nil, udpAddr)\n\t\t\t\tcheckError(err)\n\n\t\t\t\t_, err = conn.Write(pk.EncodePacket(\"RemoveFile\", []byte(filename)))\n\t\t\t\tcheckError(err)\n\t\t\t\tvar buf [512]byte\n\t\t\t\t_, err = conn.Read(buf[0:])\n\t\t\t\tcheckError(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "400e38943af04950a51bde7279c389b3", "score": "0.5213647", "text": "func SendData(filepath, sdfsFileName, dstFileName, dstID string) {\n\tstartTime := time.Now()\n\tconn, err := net.Dial(\"tcp\", leader.IDtoIP(dstID))\n\tif err != nil {\n\t\tlog.Fatal(\"could not connect to server\", err)\n\t}\n\n\t// send a byte with the command\n\tconn.Write([]byte{SEND})\n\n\t//open file\n\tfile, err := os.Open(filepath)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatal(\"Could not open the file\", err)\n\t}\n\n\tfileInfo, err := file.Stat()\n\tif err != nil {\n\t\tlog.Fatal(\"Could not get file info\", err)\n\t}\n\n\tfileInfoBuffer := fileNameBuffer(sdfsFileName + \">>\" + dstFileName)\n\n\tfileSizeBuf := make([]byte, binary.MaxVarintLen64)\n\tbinary.PutVarint(fileSizeBuf, fileInfo.Size())\n\tcopy(fileInfoBuffer[1016:1024], fileSizeBuf)\n\n\tif len(fileInfoBuffer) != 1024 {\n\t\tlog.Fatal(\"File info buffer not 1024 bytes\")\n\t}\n\t_, err = conn.Write(fileInfoBuffer)\n\tif err != nil {\n\t\tlog.Fatal(\"Could not write fileinformation\", err)\n\t}\n\n\t//send the file in chunks of 65535 bytes\n\taccumulatedBytes := 0\n\tfileBuffer := make([]byte, 65535)\n\tfor {\n\n\t\tn, err := file.Read(fileBuffer)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Something went wrong!\", err)\n\t\t}\n\t\ttransferChunk(fileBuffer[:n], conn)\n\t\taccumulatedBytes += n\n\t}\n\n\tlog.Println(\"Sent\", accumulatedBytes/1000000, \"MB. Transfer time\", time.Now().Sub(startTime))\n\tconn.Close()\n}", "title": "" }, { "docid": "626ba03d1872eb4284d70fe55b89571e", "score": "0.5170633", "text": "func (g *Gossiper) clientFileShareListenRoutine(cFileShareUI chan string, cFileNaming chan *dto.PacketAddressPair) {\n\tfor fileName := range cFileShareUI {\n\t\tfmt.Printf(\"Share request for file: %s\\n\", fileName)\n\n\t\tchunks, size, err := fileparsing.ReadChunks(fileName)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tchunksMap, metafile, metahash := fileparsing.CreateChunksMap(chunks)\n\t\tg.fileMap.AddEntry(fileName, size, metafile, metahash)\n\n\t\tg.chunkMap.AddChunk(metahash, metafile)\n\t\tfor checksum, chunk := range chunksMap {\n\t\t\tg.chunkMap.AddChunk(checksum, chunk)\n\t\t}\n\n\t\tfmt.Printf(\"Share request COMPLETED. File checksum: %x\\n\", metahash)\n\n\t\t//blockchain\n\t\tfile := dto.File{Name: fileName, Size: int64(size), MetafileHash: metahash[:]}\n\t\ttxPub := &dto.TxPublish{File: file, HopLimit: defaultHopLimit}\n\t\tpacket := &dto.GossipPacket{TxPublish: txPub}\n\t\tpap := &dto.PacketAddressPair{Packet: packet, SenderAddress: \"\"}\n\t\tcFileNaming <- pap\n\t}\n}", "title": "" }, { "docid": "8d398e3fc69aa53857a32f14a314f032", "score": "0.51652247", "text": "func (tnt *TnTServer) FST_watch_files(dirname string){\n //First initialize the watch\n\n watcher, err := inotify.NewWatcher()\n if err != nil {\n log.Fatal(err)\n }\n fmt.Println(dirname)\n //Set watch on /tmp folder for transfers\n tnt.FST_set_watch(tnt.tmp, watcher)\n tnt.FST_set_watch(dirname, watcher)\n\n fst := tnt.Tree.MyTree\n\n for {\n select {\n case ev := <-watcher.Event:\n //fmt.Println(\"I see event: \", ev)\n //This if statement causes us to avoid taking into account swap files used to keep \n //track of file modifications\n if(!strings.Contains(ev.Name, \".swp\") && !strings.Contains(ev.Name, \".swx\") && !strings.Contains(ev.Name, \"~\") && !strings.Contains(ev.Name, \".goutputstream\") && !strings.Contains(ev.Name,strings.TrimSuffix(tnt.tmp, \"/\"))) {\n if(ev.Mask != IN_CLOSE && ev.Mask != IN_OPEN && ev.Mask != IN_OPEN_ISDIR && ev.Mask != IN_CLOSE_ISDIR){\n\t\t\t\t\t\tfmt.Println(\"event: \", ev)\n\t\t\t\t\t\tfi, err := os.Lstat(ev.Name)\n\t\t\t\t\t\tkey_path := \"./\"+strings.TrimPrefix(ev.Name,tnt.root)\n\n\t\t\t\t\t\t//fmt.Println(\"ev: \", ev, key_path)\n\n\t\t\t\t\t\tupdate := true\n\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tif fi.IsDir(){\n\t\t\t\t\t\t\t\ttnt.FST_set_watch(ev.Name, watcher)\n\t\t\t\t\t\t\t\tkey_path = key_path + \"/\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if fst[key_path + \"/\"] != nil {\n\t\t\t\t\t\t\tkey_path = key_path + \"/\"\n\t\t\t\t\t\t} else if fst[key_path] != nil{\n\t\t\t\t\t\t\t//fmt.Println(\"this is a file\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//fmt.Println(\"what am i doing\", err, fst[key_path])\n\t\t\t\t\t\t\tupdate = false\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif update {\n\t\t\t\t\t\t\ttnt.mu.Lock()\n\t\t\t\t\t\t\ttnt.UpdateTreeWrapper(key_path)\n\t\t\t\t\t\t\ttnt.mu.Unlock()\n\t }\n }\n }\n\n case err := <-watcher.Error:\n log.Println(\"error:\", err)\n\n }\n }\n}", "title": "" }, { "docid": "22444dfc5aa7005c3e0352a72ded7017", "score": "0.5150529", "text": "func (a *FileClient) ListHere() {\n\tlog.Printf(\"************** START COMMAND LSHERE.\\n\")\n\n\tlog.Printf(\"All local replicated files on folder %s are: \\n\", configuration.Fs533FilePath)\n\tfilenames := fileHandler.ListHere(configuration.Fs533FilePath)\n\tfor idx, file := range filenames {\n\t\tlog.Printf(\"File %d: %s\\n\", idx, file)\n\t}\n\n\tlog.Printf(\"All local files on folder %s are: \\n\", configuration.LocalFilePath)\n\tlocalFilenames := fileHandler.ListHere(configuration.LocalFilePath)\n\tfor idx, file := range localFilenames {\n\t\tlog.Printf(\"File %d: %s\\n\", idx, file)\n\t}\n}", "title": "" }, { "docid": "e3f4d15596736900f9b176da3bef27cc", "score": "0.51226413", "text": "func sendMembershipListToPinger() {\n\n\tsize := len(lst)\n\tfmt.Fprintln(logWriter, \"length of membership list: \", size)\n\tmemLst := \"LIST \" + self\n\tif size == 1 {\n\t\twriteToPinger(lst[0], memLst)\n\t} else if size == 2 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s\", memLst, lst[1]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s\", memLst, lst[0]))\n\t} else if size == 3 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s\", memLst, lst[1]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s\", memLst, lst[2]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s\", memLst, lst[0]))\n\t} else if size == 4 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s\", memLst, lst[1], lst[2]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s\", memLst, lst[2], lst[3]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s\", memLst, lst[3], lst[0]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s\", memLst, lst[0], lst[1]))\n\t} else if size == 5 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s\", memLst, lst[1], lst[2]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s\", memLst, lst[2], lst[3]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s\", memLst, lst[3], lst[4]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s\", memLst, lst[4], lst[0]))\n\t\t//5\n\t\twriteToPinger(lst[4], fmt.Sprintf(\"%s %s %s\", memLst, lst[0], lst[1]))\n\t} else if size == 6 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s\", memLst, lst[1], lst[2]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s\", memLst, lst[2], lst[3]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s\", memLst, lst[3], lst[4]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s\", memLst, lst[4], lst[5]))\n\t\t//5\n\t\twriteToPinger(lst[4], fmt.Sprintf(\"%s %s %s\", memLst, lst[5], lst[0]))\n\t\t//6\n\t\twriteToPinger(lst[5], fmt.Sprintf(\"%s %s %s\", memLst, lst[0], lst[1]))\n\t} else if size == 7 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[1], lst[2], lst[3]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[2], lst[3], lst[4]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[3], lst[4], lst[5]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[4], lst[5], lst[6]))\n\t\t//5\n\t\twriteToPinger(lst[4], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[5], lst[6], lst[0]))\n\t\t//6\n\t\twriteToPinger(lst[5], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[6], lst[0], lst[1]))\n\t\t//7\n\t\twriteToPinger(lst[6], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[0], lst[1], lst[2]))\n\t} else if size == 8 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[1], lst[2], lst[3]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[2], lst[3], lst[4]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[3], lst[4], lst[5]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[4], lst[5], lst[6]))\n\t\t//5\n\t\twriteToPinger(lst[4], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[5], lst[6], lst[7]))\n\t\t//6\n\t\twriteToPinger(lst[5], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[6], lst[7], lst[0]))\n\t\t//7\n\t\twriteToPinger(lst[6], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[7], lst[0], lst[1]))\n\t\t//8\n\t\twriteToPinger(lst[7], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[0], lst[1], lst[2]))\n\t} else if size == 9 {\n\t\t//1\n\t\twriteToPinger(lst[0], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[1], lst[2], lst[3]))\n\t\t//2\n\t\twriteToPinger(lst[1], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[2], lst[3], lst[4]))\n\t\t//3\n\t\twriteToPinger(lst[2], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[3], lst[4], lst[5]))\n\t\t//4\n\t\twriteToPinger(lst[3], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[4], lst[5], lst[6]))\n\t\t//5\n\t\twriteToPinger(lst[4], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[5], lst[6], lst[7]))\n\t\t//6\n\t\twriteToPinger(lst[5], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[6], lst[7], lst[8]))\n\t\t//7\n\t\twriteToPinger(lst[6], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[7], lst[8], lst[0]))\n\t\t//8\n\t\twriteToPinger(lst[7], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[8], lst[0], lst[1]))\n\t\t//9\n\t\twriteToPinger(lst[8], fmt.Sprintf(\"%s %s %s %s\", memLst, lst[0], lst[1], lst[2]))\n\t}\n\t\n}", "title": "" }, { "docid": "1ebe13f9215ff9a08d0377b50077606c", "score": "0.5118541", "text": "func sendFiles(dir string, jobQueue chan<- string) error {\n\treturn filepath.Walk(dir, func(path string, _ os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif strings.HasSuffix(path, fileExtension) {\n\t\t\tjobQueue <- path\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "73158cb6958e57a8483afa31b33155d8", "score": "0.51160437", "text": "func (cl *cidLists) AppendList(chid datatransfer.ChannelID, c cid.Cid) (err error) {\n\tf, err := os.OpenFile(transferFilename(cl.baseDir, chid), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tcloseErr := f.Close()\n\t\tif err == nil {\n\t\t\terr = closeErr\n\t\t}\n\t}()\n\treturn cbg.WriteCid(f, c)\n}", "title": "" }, { "docid": "fb3ad81736828722213942499bea1536", "score": "0.5099263", "text": "func (s *Server) List(msg *broker.Msg) {\n\n}", "title": "" }, { "docid": "cf994a8971878ea78f7b3a81bf8e7805", "score": "0.509874", "text": "func (p *List) WriteListFile() {\n\tb, err := json.MarshalIndent(p.ItemList, \"\", \"\\t\")\n\tmsg.FatalOnErr(\"\", err)\n\tmsg.FatalOnErr(\"\", ioutil.WriteFile(p.FnJSON, b, 0644))\n}", "title": "" }, { "docid": "e9493ddead41d44bf7fa79e9ea278e4e", "score": "0.5097747", "text": "func updateMirrorList() (err error) {\n\tresp, err := httpGet(mirrorListURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\ttmpList, err := ioutil.TempFile(\"/tmp\", \"mirrorlist\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif cerr := tmpList.Close(); err == nil {\n\t\t\terr = cerr\n\t\t}\n\t}()\n\n\terr = uncommentMirrors(tmpList, resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn rankMirrors(tmpList.Name())\n}", "title": "" }, { "docid": "45bd9e95bb42309d6c218a577dcb87a1", "score": "0.5094868", "text": "func FileList(ids ***C.char, names ***C.char) C.size_t {\n\tres := fs.List()\n\tidsWrap := C.malloc(C.size_t(len(res)) * C.size_t(unsafe.Sizeof(uintptr(0))))\n\tnamesWrap := C.malloc(C.size_t(len(res)) * C.size_t(unsafe.Sizeof(uintptr(0))))\n\tpIDsWrap := (*[1<<30 - 1]*C.char)(idsWrap)\n\tpNamesWrap := (*[1<<30 - 1]*C.char)(namesWrap)\n\tidx := 0\n\tfor id, name := range res {\n\t\tpIDsWrap[idx] = C.CString(id)\n\t\tpNamesWrap[idx] = C.CString(name)\n\t\tidx++\n\t}\n\t*ids = (**C.char)(idsWrap)\n\t*names = (**C.char)(namesWrap)\n\treturn C.size_t(len(res))\n}", "title": "" }, { "docid": "ede56aee7262af999422af020e674d6c", "score": "0.5078926", "text": "func SendUnsyncedFiles(tlsConn *tls.Conn, last_accessed int64, private_key []byte) {\n\tfiles, err := GBClientWatch.CheckForFilesToSendToServerOnInit(last_accessed)\n\tcheckErr(err, tlsConn)\n\n\tfor _, fileData := range files {\n\t\tlog.Println(fileData)\n\t\tGBClientNetworkTools.SendDataEncrypted(tlsConn, fileData, GBClientNetworkTools.FILE_ADDED_CONST, private_key)\n\t}\n}", "title": "" }, { "docid": "7065b9cbf02b5f07ac4e5d8dcacc522b", "score": "0.50424266", "text": "func (m *Mega) processAddNode(evRaw []byte) error {\n\tm.FS.mutex.Lock()\n\tdefer m.FS.mutex.Unlock()\n\n\tvar ev FSEvent\n\terr := json.Unmarshal(evRaw, &ev)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, itm := range ev.T.Files {\n\t\t_, err = m.addFSNode(itm)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c060ee37dd80472a8f5784c95ca8c94b", "score": "0.50414944", "text": "func List() string {\n\treturn listFile.path\n}", "title": "" }, { "docid": "e2a27192ec40f7f44ea72be4923a1b35", "score": "0.5028643", "text": "func SendLogList(w http.ResponseWriter, r *http.Request){\n\tsetHeader(w)\n\tif r.Method != \"GET\" {\n\t\treturn\n\t}\n\tvars := r.URL.Query()\n\tpage := vars[\"page\"]\n\tif len(page)==0 {\n\t\treturn\n\t}\n\tdata := Readloglist()\n\twriteJson(w, data)\n}", "title": "" }, { "docid": "f556140b0a887dd0131ad2749fcc3bc4", "score": "0.5028117", "text": "func getFileMsgHandlerNormalNode(msg FileTransferMessage, conn *net.Conn) {\n\tfmt.Println(\"Member (as replica) \", NodeName, \" received the getFileMsg for file \", msg.Info.SdfsFileName)\n\t//logger.Println(\"Member (as replica) \", NodeName, \" received the getFileMsg for file \", msg.Info.SdfsFileName)\n\tsendFileToSocket(conn, msg.Info.SdfsFileName)\n\tfmt.Println(\"get request handle complete, send file complete\")\n\t//logger.Println(NodeName, \" (as replica) sent file \", msg.Info.SdfsFileName, \" to the request node\")\n}", "title": "" }, { "docid": "25fbb3aa2a43d5481ee9ed99e6f3069f", "score": "0.50271404", "text": "func (c *Corpus) sendPermanodes(ctx context.Context, ch chan<- camtypes.BlobMeta, pns []pnAndTime) error {\n\tfor _, cand := range pns {\n\t\tbm := c.blobs[cand.pn]\n\t\tif bm == nil {\n\t\t\tcontinue\n\t\t}\n\t\tselect {\n\t\tcase ch <- *bm:\n\t\t\tcontinue\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b9c84ff811415492fa0271d3b37138b4", "score": "0.5024335", "text": "func (rf *Raft) SendHeartbeatToPeers() {\n\t//Send heartbeat to each server;\n\tfor i := 0; i < len(rf.peers); i++ {\n\t\tif i == rf.me {\n\t\t\tcontinue\n\t\t}\n\t\tif rf.nextIndex[i] <= rf.LastIncludedIndex {\n\t\t\t//Send InstallSnapshot to the follower\n\t\t\targs := new(InstallSnapshotArgs)\n\t\t\targs.Term = rf.CurrentTerm\n\t\t\targs.LeaderId = rf.me\n\t\t\targs.LastIncludedIndex = rf.LastIncludedIndex\n\t\t\targs.LastIncludedTerm = rf.LastIncludedTerm\n\t\t\targs.Offset = 0\n\t\t\targs.Data = make([]byte,len(rf.currentSnapshot.SnapshotData))\n\t\t\tcopy(args.Data,rf.currentSnapshot.SnapshotData)\n\t\t\targs.Done = true\n\n\t\t\treply := new(InstallSnapshotReply)\n\n\t\t\trf.peerIsReqMutex[i].Lock()\n\t\t\trf.peerIsReqs[i].PushBack(IsGroup{args, reply, i})\n\t\t\t//DPrintf(\"{%d term %d} send IS to %d number %d LeaderCommit %d myindex %d nextIndex[%d] %d\",\n\t\t\t//\trf.me, rf.CurrentTerm, i, args.Number, args.LeaderCommit, rf.LogLength()-1, i, rf.nextIndex[i])\n\n\t\t\trf.peerIsReqMutex[i].Unlock()\n\t\t\trf.peerIsReqCondition[i].Signal()\t\n\t\t}else{\n\t\t\targs := new(AppendEntriesArgs)\n\t\t\targs.Term = rf.CurrentTerm\n\t\t\targs.LeaderId = rf.me\n\t\t\targs.PrevLogIndex = rf.nextIndex[i] - 1\n\t\t\targs.PrevLogTerm = rf.LogAt(args.PrevLogIndex).Term\n\t\t\targs.Entries = nil\n\t\t\targs.LeaderCommit = rf.commitIndex\n\t\t\targs.Number = rf.number\n\t\t\trf.number++\n\t\t\treply := new(AppendEntriesReply)\n\t\n\t\t\t//DPrintf(\"{%d Term %d}heartbeat to %d number %d \",rf.me,rf.CurrentTerm ,i, args.Number)\n\t\n\t\t\trf.peerAeReqMutex[i].Lock()\n\t\t\trf.peerAeReqs[i].PushBack(AeGroup{args, reply, i})\n\t\t\trf.peerAeReqMutex[i].Unlock()\n\t\t\trf.peerAeReqCondition[i].Signal()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7e50319c5252635d3a13f97be53850eb", "score": "0.5019569", "text": "func (h *Handler) HandleLIST(args []string) {\n\tlog.Printf(\"%s: HandleList\", h.Clnt)\n\tvar directory string\n\tif len(args) == 0 {\n\t\tdirectory = h.Path\n\t} else {\n\t\tdirectory = args[0]\n\t}\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\th.WriteMessage(550, \"Unable to list directory: %s.\", directory)\n\t\treturn\n\t}\n\n\tfor _, file := range files {\n\t\th.WriteLine(file.Name())\n\t}\n\th.WriteMessage(226, \"Done\")\n}", "title": "" }, { "docid": "c7234a91920c85046e8454576355ea33", "score": "0.5004032", "text": "func (h *StreamService) handleStreamBlockList(env *pb.Envelope, pid peer.ID) (*pb.Envelope, error) {\n\t//fmt.Printf(\"StreamService: New stream blk list receive from %s\\n\", pid.Pretty())\n streams := make(map[string]int)\n blks := new(pb.StreamBlockContentList)\n err := ptypes.UnmarshalAny(env.Message.Payload, blks)\n if err != nil {\n return nil, err\n }\n for _, blk := range blks.Blocks {\n size := 0\n fmt.Printf(\"size: %d\\n\", len(blk.Data))\n var cid string\n if len(blk.Data) != 0 {\n m := make(map[string]string)\n err := json.Unmarshal(blk.Description, &m)\n if err != nil{\n return nil, err\n }\n cid = m[\"CID\"]\n\n err = util.WriteFileByPath(h.repoPath+\"/blocks/\"+cid, blk.Data)\n if err != nil {\n fmt.Printf(\"error occur when store file\")\n return nil, err\n }\n } else {\n cid = \"\"\n }\n model := &pb.StreamBlock {\n Id: cid, //get id from description\n Streamid: blk.StreamID,\n Index: blk.Index,\n Size: int32(size),\n IsRoot: blk.IsRoot,\n Description: string(blk.Description),\n }\n fmt.Printf(\"[BLKRECV] Block %s, Stream %s, Index %d, From %s, Size %d\", model.Id, blk.StreamID, blk.Index, pid.Pretty(), size)\n err = h.datastore.StreamBlocks().Add(model)\n if err != nil {\n return nil, err\n }\n\n if blk.IsRoot {\n fmt.Print(\"It is a root node of a merkle-DAG!\\n\")\n err = h.handleRootBlk(pid, model)\n if err != nil {\n fmt.Printf(\"Handle root file failed\\n\")\n return nil, err\n }\n }\n streams[blk.StreamID] = 1\n }\n for id := range streams {\n\t h.activeWorkers.newFileAdd(id)\n }\n return nil, nil\n}", "title": "" }, { "docid": "576bf7a731514264208a3b54a8faa324", "score": "0.4995948", "text": "func (n *NodeCall) UpdateNodeList(nodeList *[]string) (int64, *tp.Status) {\n\tfor _, value := range *nodeList {\n\t\tsess, stat := nodeInfo.transPeer.Dial(value)\n\t\tif !stat.OK() {\n\t\t\ttp.Fatalf(\"%v\", stat)\n\t\t}\n\n\t\tvar result int\n\t\tauth := &Auth{\n\t\t\tPassword: nodeInfo.nodeConf.Password,\n\t\t\tTransAddress: nodeInfo.transAddress,\n\t\t}\n\t\tstat = sess.Call(\"/node_call/auth\",\n\t\t\tauth,\n\t\t\t&result,\n\t\t).Status()\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "c87fa3e2e49f6ad2e44d9f4498d59110", "score": "0.49950778", "text": "func (node *SdfsNode) RpcListIPs(fname string) {\n\tvar res SdfsResponse\n\treq := SdfsRequest{LocalFName: \"\", RemoteFName: fname, Type: GetReq}\n\n\terr := client.Call(\"SdfsNode.HandleGetRequest\", req, &res)\n\tif err != nil {\n\t\tfmt.Println(\"Failed ls. \", err)\n\t} else {\n\t\tfmt.Print(fname, \" => \")\n\t\tfor _, ip := range res.IPList {\n\t\t\tfmt.Print(ip.String(), \", \")\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "80d1fd7159aed95f49c8d2a0b126cdd9", "score": "0.4975315", "text": "func (ftp *JoeFtp) List() (int, string, []byte, error) {\n\treturn ftp.passive(\"LIST\", nil)\n}", "title": "" }, { "docid": "fd461d4b7b805dd14cfcb921e5828c38", "score": "0.4958149", "text": "func (ep *OCITransportMethod) processList(req *DronaRequest) ([]string, error) {\n\tprgChan := make(ociutil.NotifChan)\n\tdefer close(prgChan)\n\tif req.ackback {\n\t\tgo func(req *DronaRequest, prgNotif ociutil.NotifChan) {\n\t\t\tticker := time.NewTicker(StatsUpdateTicker)\n\t\t\tvar stats ociutil.UpdateStats\n\t\t\tvar ok bool\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase stats, ok = <-prgNotif:\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\tep.ctx.postSize(req, stats.Size, stats.Asize)\n\t\t\t\t}\n\t\t\t}\n\t\t}(req, prgChan)\n\t}\n\treturn ociutil.Tags(ep.registry, ep.path, ep.uname, ep.apiKey, ep.hClient, prgChan)\n}", "title": "" }, { "docid": "315bc2d66db1d0c72dd294a8e9cf94a5", "score": "0.49434093", "text": "func (rf *Raft) sendAppendEntries(server int) {\n\trf.mu.Lock()\n\tif rf.state != LEADER {\n\t\trf.mu.Unlock()\n\t\treturn\n\t}\n\tDPrintf(\"(info) (%d) send LogEntry[%d - %d] to (%d) at term[%d]\", rf.me, rf.nextIndex[server], rf.lastLogIndex, server, rf.currentTerm)\n\targs := AppendEntriesArgs{\n\t\trf.currentTerm,\n\t\trf.me,\n\t\trf.nextIndex[server] - 1,\n\t\trf.logs[rf.nextIndex[server]-1].LogTerm,\n\t\t[]LogEntry{},\n\t\trf.commitIndex,\n\t}\n\tfor j := rf.nextIndex[server]; j <= rf.lastLogIndex; j++ {\n\t\targs.Entries = append(args.Entries, rf.logs[j])\n\t}\n\trf.mu.Unlock()\n\n\treply := AppendEntriesReply{}\n\tok := rf.peers[server].Call(\"Raft.HandleAppendEntries\", &args, &reply)\n\tif !ok {\n\t\treturn\n\t}\n\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tif reply.Success {\n\t\tprevLogInd := args.PrevLogIndex\n\t\tentryLen := len(args.Entries)\n\t\tif prevLogInd + entryLen >= rf.nextIndex[server] { \t// in case that the reply come out of order\n\t\t\trf.nextIndex[server] = prevLogInd + entryLen + 1\n\t\t\trf.matchIndex[server] = prevLogInd + entryLen\n\t\t}\n\t\tif rf.canCommit(prevLogInd + entryLen) {\t\t\t// check whether the logs have existed in a majority of servers\n\t\t\tDPrintf(\"(info) (%d) commit index from [%d] to [%d]\", rf.me, rf.commitIndex, prevLogInd+entryLen)\n\t\t\trf.commitIndex = prevLogInd + entryLen\n\t\t\trf.persist()\n\t\t\trf.applyNotify <- struct{}{}\n\t\t}\n\t} else {\n\t\tif reply.Term > rf.currentTerm { \t\t\t\t\t// the leader is out of date\n\t\t\trf.currentTerm = reply.Term\n\t\t\trf.state = FOLLOWER\n\t\t\trf.votedFor = -1\n\t\t\trf.resetElectionTimer(randTimeoutDuration())\n\t\t\treturn\n\t\t}\n\t\t// if leaderTerm != currentTerm, then this is an old reply for the RPC sent from this server's old term\n\t\t// which means this server was a leader at an early term, sent the RPC and failed\n\t\tif reply.LeaderTerm == rf.currentTerm && rf.state == LEADER {\t// fails because of log inconsistency\n\t\t\trf.nextIndex[server] = Max(1, reply.HintIndex)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e271647ae73f96d2392710e5c26d606", "score": "0.49420407", "text": "func ProcessFilesChannel(zipfile *zip.Writer, wg *sync.WaitGroup) {\n\t//Create output file and wipe out if it already exists\n\terr := ioutil.WriteFile(config.Flags.OutputPath+\"/nrdiag-filelist.txt\", []byte(\"\"), 0644)\n\tif err != nil {\n\t\tlog.Debug(\"Error creating filelist\", err)\n\t} else {\n\t\tioutil.WriteFile(config.Flags.OutputPath+\"/nrdiag-filelist.txt\", []byte(\"List of files in zipfile\"), 0644)\n\t}\n\n\t// This is how we track the file names going into to zip file to prevent duplicates\n\t// map of [string]struct is used because empty struct takes no memory\n\tfileList := make(map[string]struct{})\n\tpathList := make(map[string]struct{})\n\tvar taskFiles []tasks.FileCopyEnvelope\n\n\tfor result := range registration.Work.FilesChannel {\n\t\tlog.Debug(\"Copying files from result: \", result.Task.Identifier().String())\n\n\t\tfor _, envelope := range result.Result.FilesToCopy {\n\t\t\t// check for duplicate file paths\n\t\t\tif envelope.Stream == nil && mapContains(pathList, envelope.Path) {\n\t\t\t\tlog.Debugf(\"Already added '%s' to the file list. Skipping.\\n\", envelope.Path)\n\n\t\t\t} else {\n\t\t\t\tfor i := 1; i < 50; i++ { //if we can't find a unique name in 50 tries, give up!\n\t\t\t\t\tif !mapContains(fileList, envelope.StoreName()) {\n\t\t\t\t\t\tlog.Debug(\"file name is \", envelope.StoreName(), \" for \", envelope.Path)\n\t\t\t\t\t\tfileList[envelope.StoreName()] = struct{}{}\n\t\t\t\t\t\tpathList[envelope.Path] = struct{}{}\n\t\t\t\t\t\t// Set the identifier if not previously set\n\t\t\t\t\t\tif envelope.Identifier == \"\" {\n\t\t\t\t\t\t\tenvelope.Identifier = result.Task.Identifier().String()\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttaskFiles = append(taskFiles, envelope)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Debug(\"tried \", envelope.StoreName(), \"... keep looking.\")\n\t\t\t\t\t\tenvelope.IncrementDuplicateCount()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\tcopyFilesToZip(zipfile, taskFiles)\n\n\tlog.Debug(\"Files channel closed\")\n\tcopyFileListToZip(zipfile)\n\tlog.Debug(\"Decrementing wait group in processFilesChannel.\")\n\twg.Done()\n}", "title": "" }, { "docid": "5ca2962f9a5af0d8c51b36e24930d809", "score": "0.49332824", "text": "func (p *peer) sendGetPeerList() {\n\tmsg, err := p.net.b.GetPeerList()\n\tp.net.log.AssertNoError(err)\n\tlenMsg := len(msg.Bytes())\n\tsent := p.Send(msg, true)\n\tif sent {\n\t\tp.net.getPeerlist.numSent.Inc()\n\t\tp.net.getPeerlist.sentBytes.Add(float64(lenMsg))\n\t\tp.net.sendFailRateCalculator.Observe(0, p.net.clock.Time())\n\t} else {\n\t\tp.net.getPeerlist.numFailed.Inc()\n\t\tp.net.sendFailRateCalculator.Observe(1, p.net.clock.Time())\n\t}\n}", "title": "" }, { "docid": "7f2884b5d4ad73c8622334c42a169a31", "score": "0.49313897", "text": "func (client ProcessPluginClient) ListSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "title": "" }, { "docid": "ba0db40e7a0041812dd0999c7eb50cfc", "score": "0.4918187", "text": "func (a *FileClient) ListAllFiles() []string {\n\tlog.Printf(\"************** START COMMAND LIST ALL: request sent to master node at '%s'.\\n\", masterNode)\n\n\t//gRPC call\n\tlistAllRequest := &fs533pb.Empty{}\n\n\tcc, err := grpc.Dial(fmt.Sprintf(\"%s:%d\", masterNode, configuration.TCPPort), grpc.WithInsecure())\n\tif err != nil {\n\t\terrorMessage := fmt.Sprintf(\"could not connect to target node at %s due to error: %v\\n\", masterNode, err.Error())\n\t\tlog.Printf(\"Cannot query all files. Error: %s\\n\", errorMessage)\n\t\treturn []string{}\n\t}\n\n\tdefer cc.Close()\n\n\t//set a deadline to gRPC call to make sure that it will be timeout if the target agent failed by some reasons\n\tduration := time.Duration(configuration.Timeout) * time.Second\n\tctx, cancel := context.WithTimeout(context.Background(), duration)\n\tdefer cancel()\n\n\tc := fs533pb.NewFileServiceClient(cc)\n\n\tres, err1 := c.ListAll(ctx, listAllRequest)\n\n\tif err1 != nil {\n\t\tlog.Println(\"Error: It is unable read the response for listall command due to error \", err)\n\t\treturn []string{}\n\t}\n\n\tallfiles := []string{}\n\n\tfor _, file := range res.GetFiles() {\n\t\tfileMetadata := Fs533FileMetadata{\n\t\t\tFs533FileName: file.GetFs533Filename(),\n\t\t\tFs533FileSize: file.GetFs533FileSize(),\n\t\t\tFs533FileVersion: file.GetFs533FileVersion(),\n\t\t}\n\t\tallfiles = append(allfiles, fileMetadata.Fs533FileName)\n\t}\n\treturn allfiles\n}", "title": "" }, { "docid": "2247fdc232e7cb1c3fdb8658578f9e3f", "score": "0.49102536", "text": "func (nodeSvc *NodeService) SendPublicFile(inbuf []byte, /*args *FileData,*/ reply *ServerReply) error {\n\tprintln(\"We received a new File\")\n\t\n\tvar args = new(FileData)\n\tLogger.UnpackReceive(\"received new public file\", inbuf, &args)\n\n\tfile := FileData{\n\t\tUsername: args.Username,\n\t\tFileName: args.FileName,\n\t\tFileSize: args.FileSize,\n\t\tData: args.Data}\n\n\tsendPublicFileClients(file)\n\n\treply.Message = \"success\"\n\treturn nil\n}", "title": "" }, { "docid": "88de8ca1691ccec793b656fe8e4d6d99", "score": "0.49054518", "text": "func (n *Node) serveSendData(msg nodeMsg) {\n\tif n.hasJob(msg) {\n\t\tjob := n.getJob(msg)\n\t\t// Only forward if we did not start off this whole request\n\t\tif job.from != n {\n\t\t\tn.send(msg, job.from)\n\t\t}\n\t\t// Cache this file\n\t\tn.addFileFromMsg(msg)\n\t\tn.deleteJob(msg)\n\t}\n}", "title": "" }, { "docid": "ab2f108ba8cfc86af435fba1f04b6e37", "score": "0.49028513", "text": "func (ms *MessageService) SendPublicFile(inbuf []byte, /*args *FileData,*/ reply *ServerReply) error {\n\tprintln(\"File Received.\")\n\tvar args = new(FileData)\n\tLogger.UnpackReceive(\"received new file\", inbuf, &args)\n\n\tfile := FileData{\n\t\tUsername: args.Username,\n\t\tFileName: args.FileName,\n\t\tFileSize: args.FileSize,\n\t\tData: args.Data}\n\n\tvar hinder sync.WaitGroup\n\thinder.Add(2)\n\tgo func() {\n\t\tdefer hinder.Done()\n\t\tsendPublicFileServers(file)\n\t}()\n\tgo func() {\n\t\tdefer hinder.Done()\n\t\tsendPublicFileClients(file)\n\t}()\n\n\tstoreFile(file)\n\n\t//Send LB Filename to LB\n\tvar rep string\n\tsystemService, err := rpc.Dial(\"tcp\", LOAD_BALANCER_IPPORT)\n\tcheckError(err)\n\n\toutbuf := Logger.PrepareSend(\"notify lb of new file\", args.FileName)\n\terr = systemService.Call(\"NodeService.NewFile\", outbuf, &rep)\n\tcheckError(err)\n\tprintln(rep)\n\tsystemService.Close()\n\n\thinder.Wait()\n\treply.Message = \"success\"\n\treturn nil\n}", "title": "" }, { "docid": "6655c6bb8e7fc696b775a29600bd94fa", "score": "0.48932922", "text": "func ListFiles(cData CommandData, name string, id uint, sOrder string) {\n\t// Convert input\n\tname, id = getFileCommandData(name, id)\n\n\tvar filesResponse server.FileListResponse\n\tresponse, err := server.NewRequest(server.EPFileList, &server.FileListRequest{\n\t\tFileID: id,\n\t\tName: name,\n\t\tAllNamespaces: cData.AllNamespaces,\n\t\tAttributes: cData.FileAttributes,\n\t\tOptionalParams: server.OptionalRequetsParameter{\n\t\t\tVerbose: cData.Details,\n\t\t},\n\t}, cData.Config).WithAuth(server.Authorization{\n\t\tType: server.Bearer,\n\t\tPalyoad: cData.Config.User.SessionToken,\n\t}).WithBenchCallback(cData.BenchDone).Do(&filesResponse)\n\n\tif err != nil {\n\t\tif response != nil {\n\t\t\tfmt.Println(\"http:\", response.HTTPCode)\n\t\t\treturn\n\t\t}\n\t\tlog.Fatalln(err)\n\t}\n\n\tif response.Status == server.ResponseError {\n\t\tprintResponseError(response, \"listing files\")\n\t\treturn\n\t}\n\n\tif uint16(len(filesResponse.Files)) > cData.Config.Client.MinFilesToDisplay && !cData.Yes {\n\t\ty, _ := gaw.ConfirmInput(\"Do you want to view all? (y/n) > \", bufio.NewReader(os.Stdin))\n\t\tif !y {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Print as json if desired\n\tif cData.OutputJSON {\n\t\tfmt.Println(toJSON(filesResponse.Files))\n\t} else {\n\t\tif len(filesResponse.Files) == 0 {\n\t\t\tfmt.Printf(\"No files in namespace %s\\n\", cData.Namespace)\n\t\t\treturn\n\t\t}\n\n\t\theadingColor := color.New(color.FgHiGreen, color.Underline, color.Bold)\n\n\t\t// Table setup\n\t\ttable := clitable.New()\n\t\ttable.ColSeparator = \" \"\n\t\ttable.Padding = 4\n\n\t\tvar hasPublicFile, hasTag, hasGroup bool\n\n\t\t// scan for availability of attributes\n\t\tfor _, file := range filesResponse.Files {\n\t\t\tif !hasPublicFile && file.IsPublic && len(file.PublicName) > 0 {\n\t\t\t\thasPublicFile = true\n\t\t\t}\n\n\t\t\t// only need to do if requested more details\n\t\t\tif cData.Details > 1 {\n\t\t\t\t// Has tag\n\t\t\t\tif !hasTag && len(file.Attributes.Tags) > 0 {\n\t\t\t\t\thasTag = true\n\t\t\t\t}\n\n\t\t\t\t// Has group\n\t\t\t\tif !hasGroup && len(file.Attributes.Groups) > 0 {\n\t\t\t\t\thasGroup = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Order output\n\t\tif len(sOrder) > 0 {\n\t\t\tif order := models.FileOrderFromString(sOrder); order != nil {\n\t\t\t\t// Sort\n\t\t\t\tmodels.\n\t\t\t\t\tNewFileSorter(filesResponse.Files).\n\t\t\t\t\tReversed(models.IsOrderReversed(sOrder)).\n\t\t\t\t\tSortBy(*order)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Error: Sort by '%s' not supporded\", sOrder)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\t// By default sort by creation desc\n\t\t\tmodels.NewFileSorter(filesResponse.Files).Reversed(true).SortBy(models.CreatedOrder)\n\t\t}\n\n\t\theader := []interface{}{\n\t\t\theadingColor.Sprint(\"ID\"), headingColor.Sprint(\"Name\"), headingColor.Sprint(\"Size\"),\n\t\t}\n\n\t\t// Add public name\n\t\tif hasPublicFile {\n\t\t\theader = append(header, headingColor.Sprint(\"Public name\"))\n\t\t}\n\n\t\t// Add created\n\t\theader = append(header, headingColor.Sprint(\"Created\"))\n\n\t\t// Show namespace on -dd\n\t\tif cData.Details > 2 || cData.AllNamespaces {\n\t\t\theader = append(header, headingColor.Sprintf(\"Namespace\"))\n\t\t}\n\n\t\t// Show groups and tags on -d\n\t\tif cData.Details > 1 {\n\t\t\tif hasGroup {\n\t\t\t\theader = append(header, headingColor.Sprintf(\"Groups\"))\n\t\t\t}\n\n\t\t\tif hasTag {\n\t\t\t\theader = append(header, headingColor.Sprintf(\"Tags\"))\n\t\t\t}\n\t\t}\n\n\t\ttable.AddRow(header...)\n\n\t\tfor _, file := range filesResponse.Files {\n\t\t\t// Colorize private pubNames if not public\n\t\t\tpubname := file.PublicName\n\t\t\tif len(pubname) > 0 && !file.IsPublic {\n\t\t\t\tpubname = color.HiMagentaString(pubname)\n\t\t\t}\n\n\t\t\t// Add items\n\t\t\trowItems := []interface{}{\n\t\t\t\tfile.ID,\n\t\t\t\tformatFilename(&file, cData.NameLen, &cData),\n\t\t\t\tunits.BinarySuffix(float64(file.Size)),\n\t\t\t}\n\n\t\t\t// Append public file\n\t\t\tif hasPublicFile {\n\t\t\t\trowItems = append(rowItems, pubname)\n\t\t\t}\n\n\t\t\t// Append time\n\t\t\trowItems = append(rowItems, humanTime.Difference(time.Now(), file.CreationDate))\n\n\t\t\t// Show namespace on -dd\n\t\t\tif cData.Details > 2 || cData.AllNamespaces {\n\t\t\t\trowItems = append(rowItems, file.Attributes.Namespace)\n\t\t\t}\n\n\t\t\t// Show groups and tags on -d\n\t\t\tif cData.Details > 1 {\n\t\t\t\tif hasGroup {\n\t\t\t\t\trowItems = append(rowItems, strings.Join(file.Attributes.Groups, \", \"))\n\t\t\t\t}\n\n\t\t\t\tif hasTag {\n\t\t\t\t\trowItems = append(rowItems, strings.Join(file.Attributes.Tags, \", \"))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttable.AddRow(rowItems...)\n\t\t}\n\n\t\tfmt.Println(table.String())\n\t}\n}", "title": "" }, { "docid": "ecabc1db924b17424a1be58ceed42547", "score": "0.48877135", "text": "func ReceiveFile(connection net.Conn, path string, processNodePtr *nd.Node) {\n\tdefer connection.Close()\n\n\t//fmt.Println(\"receiving file...\")\n\n\tbufferFileName := make([]byte, 64)\n\tbufferFileSize := make([]byte, 10)\n\n\tconnection.Read(bufferFileSize)\n\tfileSize, _ := strconv.ParseInt(strings.Trim(string(bufferFileSize), \":\"), 10, 64)\n\n\tconnection.Read(bufferFileName)\n\tfileName := strings.Trim(string(bufferFileName), \":\")\n\n\tfmt.Println(\"create new file, path:\", path+fileName)\n\tnewFile, err := os.Create(path + fileName)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer newFile.Close()\n\tvar receivedBytes int64\n\n\tfor {\n\t\tif (fileSize - receivedBytes) < BUFFERSIZE {\n\t\t\tio.CopyN(newFile, connection, (fileSize - receivedBytes))\n\t\t\tconnection.Read(make([]byte, (receivedBytes+BUFFERSIZE)-fileSize))\n\t\t\tbreak\n\t\t}\n\t\tio.CopyN(newFile, connection, BUFFERSIZE)\n\t\treceivedBytes += BUFFERSIZE\n\t}\n\n\tfmt.Println(\"Received file:\", fileName)\n\n\t// if received file is stored into distributed file system\n\t// alert leader of this udpate\n\tif path == processNodePtr.DistributedPath {\n\t\t*processNodePtr.DistributedFilesPtr = append(*processNodePtr.DistributedFilesPtr, fileName)\n\t\tUpdateLeader(fileName, processNodePtr)\n\t}\n}", "title": "" }, { "docid": "17daaf1e822eee2a5eda7e300ebe3bc5", "score": "0.4840157", "text": "func (rf *Raft) broadcastHeartbeat() {\n\tfor i := range rf.peers {\n\t\t// skip itself\n\t\tif i == rf.me {\n\t\t\tcontinue\n\t\t}\n\t\tgo func(server int) {\n\t\t\t// it needs lock, because it will read the date from rf in case the rf's date will change when define the args\n\t\t\trf.mu.Lock()\n\t\t\tif rf.state != Leader {\n\t\t\t\trf.mu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tprevLogIndex := rf.nextIndex[server] - 1\n\t\t\t// prepare the append rpc args\n\t\t\tentries := make([]LogEntry, len(rf.log[prevLogIndex+1:]))\n\t\t\tcopy(entries, rf.log[prevLogIndex+1:])\n\n\t\t\targs := AppendEntriesArgs{\n\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\tLeaderId: rf.me,\n\t\t\t\tPreLogIndex: prevLogIndex,\n\t\t\t\tPreLogTerm: rf.log[prevLogIndex].Term,\n\t\t\t\tEntries: entries,\n\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t}\n\t\t\trf.mu.Unlock()\n\n\t\t\tvar reply AppendEntriesReply\n\t\t\tif rf.sendAppendEntries(server, &args, &reply) {\n\t\t\t\trf.mu.Lock()\n\t\t\t\t//if success to update the follower's entries, update the matchIndex and the nextIndex\n\t\t\t\tif reply.Success {\n\t\t\t\t\trf.matchIndex[server] = args.PreLogIndex + len(args.Entries)\n\t\t\t\t\trf.nextIndex[server] = rf.matchIndex[server] + 1\n\n\t\t\t\t\t// if major followers have received the log entry, the leader will update the commitIndex\n\t\t\t\t\tfor i := len(rf.log) - 1; i > rf.commitIndex; i-- {\n\t\t\t\t\t\tcount := 0\n\t\t\t\t\t\tfor _, followerMatchIndex := range rf.matchIndex {\n\t\t\t\t\t\t\tif followerMatchIndex >= i {\n\t\t\t\t\t\t\t\tcount++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if the count larger than half of the follower, leader will update the commitIndex\n\t\t\t\t\t\tif count > len(rf.peers)/2 {\n\t\t\t\t\t\t\trf.commitIndex = i\n\t\t\t\t\t\t\t// whenever the commitIndex change, the raft server must check the lastApplied and the commitIndex\n\t\t\t\t\t\t\t// to determine whether send the applyCh\n\t\t\t\t\t\t\trf.sendApplyMsg()\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif reply.Term > rf.currentTerm {\n\t\t\t\t\t\trf.currentTerm = reply.Term\n\t\t\t\t\t\trf.convertTo(Follower)\n\t\t\t\t\t\trf.persist()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// when the nextIndex is mismatch\n\t\t\t\t\t\trf.nextIndex[server] = reply.ConflictIndex\n\n\t\t\t\t\t\tif reply.ConflictTerm != -1 {\n\t\t\t\t\t\t\t// if ConflictTerm isn't in the leader, set the nextIndex[server] to ConflictIndex\n\t\t\t\t\t\t\t// else it shouldn't skip\n\t\t\t\t\t\t\tfor i := args.PreLogIndex; i >= 1; i-- {\n\t\t\t\t\t\t\t\tif rf.log[i-1].Term == reply.ConflictTerm {\n\t\t\t\t\t\t\t\t\trf.nextIndex[server] = i\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trf.mu.Unlock()\n\t\t\t}\n\t\t}(i)\n\t}\n}", "title": "" }, { "docid": "5b5565761b50dc9f4084d95e50c13f56", "score": "0.48318896", "text": "func fileChangeBroadCast(sdfsFile FileInfo, put bool) {\n\tmsg := makeSDFSMessage(GlobalFileAddMsg, sdfsFile, []FileInfo{})\n\tif !put {\n\t\tmsg = makeSDFSMessage(GlobalFileRemoveMsg, sdfsFile, []FileInfo{})\n\t}\n\tbroadcastMessage(normalNodeListenPort, msg)\n}", "title": "" }, { "docid": "af4ba315de69f3fd0442b3a66c5050dc", "score": "0.4830358", "text": "func (ftpp *FTPProxy) sendDirectory(w http.ResponseWriter, r *http.Request,\n\tpath string, files []*ftp.Entry) {\n\n\t// Prepare list of files\n\tsort.Slice(files, func(i, j int) bool {\n\t\tf1 := files[i]\n\t\tf2 := files[j]\n\n\t\t// Directories first\n\t\tswitch {\n\t\tcase f1.Type == ftp.EntryTypeFolder && f2.Type != ftp.EntryTypeFolder:\n\t\t\treturn true\n\t\tcase f1.Type != ftp.EntryTypeFolder && f2.Type == ftp.EntryTypeFolder:\n\t\t\treturn false\n\t\t}\n\n\t\t// Special folders first\n\t\tswitch {\n\t\tcase f1.Name == \".\" && f2.Name != \".\":\n\t\t\treturn true\n\t\tcase f1.Name != \".\" && f2.Name == \".\":\n\t\t\treturn false\n\t\tcase f1.Name == \"..\" && f2.Name != \"..\":\n\t\t\treturn true\n\t\tcase f1.Name != \"..\" && f2.Name == \"..\":\n\t\t\treturn false\n\t\t}\n\n\t\t// Then sort by name\n\t\treturn f1.Name < f2.Name\n\t})\n\n\t// Make sure we have parent directory\n\tswitch {\n\tcase len(files) > 0 && files[0].Name == \"..\":\n\tcase len(files) > 1 && files[1].Name == \"..\":\n\tdefault:\n\t\tfiles = append([]*ftp.Entry{{Name: \"..\", Type: ftp.EntryTypeFolder}}, files...)\n\t}\n\n\t// Format HTML head\n\tfavicon := ftpp.froxy.BaseURL() + \"icons/froxy.png\"\n\n\tw.Write([]byte(\"<html>\"))\n\tw.Write([]byte(`<head><meta charset=\"utf-8\">` + \"\\n\"))\n\tfmt.Fprintf(w, `<link rel=\"icon\" type=\"image/png\" href=\"%s\">`+\"\\n\", favicon)\n\tw.Write([]byte(\"<style>\\n\"))\n\tw.Write([]byte(\"th, td {\\n\"))\n\tw.Write([]byte(\" padding-right: 15px;\\n\"))\n\tw.Write([]byte(\"}\\n\"))\n\tw.Write([]byte(\"</style>\\n\"))\n\tw.Write([]byte(\"</head>\\n\"))\n\n\tw.Write([]byte(\"<title>\"))\n\ttemplate.HTMLEscape(w, []byte(r.URL.String()))\n\tw.Write([]byte(\"</title>\\n\"))\n\tw.Write([]byte(\"<body>\\n\"))\n\n\t// Format table of files\n\tw.Write([]byte(`<fieldset style=\"border-radius:10px\">`))\n\tfmt.Fprintf(w, \"<legend>Listing of %s</legend>\\n\", template.HTMLEscapeString(path))\n\tw.Write([]byte(\"<table><tbody>\\n\"))\n\n\tfor _, f := range files {\n\t\tvar href, name, symbol string\n\n\t\tswitch f.Name {\n\t\tcase \".\":\n\t\t\tcontinue\n\n\t\tcase \"..\":\n\t\t\thref = path\n\t\t\ti := 0\n\t\t\tswitch i = strings.LastIndexByte(href, '/'); {\n\t\t\tcase i > 0:\n\t\t\t\thref = href[:i] + \"/\"\n\t\t\tcase i == 0:\n\t\t\t\thref = \"/\"\n\t\t\t}\n\t\t\tname = \"Parent directory\"\n\t\t\tsymbol = \"&#x1f8a0;\"\n\n\t\tdefault:\n\t\t\thref = path\n\t\t\tif len(href) > 1 {\n\t\t\t\thref += \"/\"\n\t\t\t}\n\t\t\thref += f.Name\n\n\t\t\tname = template.HTMLEscapeString(f.Name)\n\n\t\t\tswitch f.Type {\n\t\t\tcase ftp.EntryTypeFolder:\n\t\t\t\tsymbol = \"&#x1f4c2;\"\n\t\t\t\thref += \"/\"\n\t\t\tdefault:\n\t\t\t\tsymbol = \"&#x1f4c4;\"\n\t\t\t}\n\t\t}\n\n\t\t// Format file time and size\n\t\ttime := \"\"\n\t\tsize := \"\"\n\t\tif f.Type != ftp.EntryTypeFolder {\n\t\t\tswitch {\n\t\t\tcase f.Size < 1024:\n\t\t\t\tsize = fmt.Sprintf(\"%d\", f.Size)\n\t\t\tcase f.Size < 1024*1024:\n\t\t\t\tsize = fmt.Sprintf(\"%.1fK\", float64(f.Size)/1024)\n\t\t\tcase f.Size < 1024*1024*1024:\n\t\t\t\tsize = fmt.Sprintf(\"%.1fM\", float64(f.Size)/(1024*1024))\n\t\t\tcase f.Size < 1024*1024*1024*1024:\n\t\t\t\tsize = fmt.Sprintf(\"%.1fG\", float64(f.Size)/(1024*1024*1024))\n\t\t\t}\n\n\t\t\ttime = fmt.Sprintf(\"%.2d-%.2d-%.4d %.2d:%.2d\",\n\t\t\t\tf.Time.Day(),\n\t\t\t\tf.Time.Month(),\n\t\t\t\tf.Time.Year(),\n\t\t\t\tf.Time.Hour(),\n\t\t\t\tf.Time.Minute(),\n\t\t\t)\n\t\t}\n\n\t\t// Create table row\n\t\tw.Write([]byte(\"<tr>\"))\n\t\tfmt.Fprintf(w, `<td>%s&nbsp;<a href=%q>%s</a></td>`, symbol, href, name)\n\t\tfmt.Fprintf(w, `<td>%s</td>`, size)\n\t\tfmt.Fprintf(w, `<td>%s</td>`, time)\n\t\tw.Write([]byte(\"</tr>\\n\"))\n\t}\n\n\tw.Write([]byte(\"</tbody></table>\\n\"))\n\tw.Write([]byte(\"</fieldset></body></html>\\n\"))\n}", "title": "" }, { "docid": "6e42d72215f5edbcb5dbd67aa4bc8a88", "score": "0.4822924", "text": "func send_hlist_agent( hlist *string ) {\n\ttmsg := ipc.Mk_chmsg( )\n\ttmsg.Send_req( am_ch, nil, REQ_CHOSTLIST, hlist, nil )\t\t\t// push the list; does not expect response back\n}", "title": "" }, { "docid": "9aa79d0070afca7ddcc0013ffcc89ee4", "score": "0.482124", "text": "func PrefetchList(bp BaseParams, bck cmn.Bck, fileslist []string) (string, error) {\n\tbp.Method = http.MethodPost\n\tq := bck.AddToQuery(nil)\n\tmsg := apc.ListRange{ObjNames: fileslist}\n\treturn dolr(bp, bck, apc.ActPrefetchObjects, msg, q)\n}", "title": "" }, { "docid": "cf067d168a6acd472a46bf762adcefb8", "score": "0.48142344", "text": "func (k *SimpleFS) SimpleFSList(ctx context.Context, arg keybase1.SimpleFSListArg) error {\n\treturn k.startAsync(ctx, arg.OpID, keybase1.NewOpDescriptionWithList(\n\t\tkeybase1.ListArgs{\n\t\t\tOpID: arg.OpID, Path: arg.Path,\n\t\t}), func(ctx context.Context) (err error) {\n\t\tvar res []keybase1.Dirent\n\n\t\trawPath := stdpath.Clean(arg.Path.Kbfs())\n\t\tswitch {\n\t\tcase rawPath == \"/\":\n\t\t\tres = []keybase1.Dirent{\n\t\t\t\t{Name: \"private\", DirentType: deTy2Ty(libkbfs.Dir)},\n\t\t\t\t{Name: \"public\", DirentType: deTy2Ty(libkbfs.Dir)},\n\t\t\t\t{Name: \"team\", DirentType: deTy2Ty(libkbfs.Dir)},\n\t\t\t}\n\t\tcase rawPath == `/public`:\n\t\t\tres, err = k.favoriteList(ctx, arg.Path, tlf.Public)\n\t\tcase rawPath == `/private`:\n\t\t\tres, err = k.favoriteList(ctx, arg.Path, tlf.Private)\n\t\tcase rawPath == `/team`:\n\t\t\tres, err = k.favoriteList(ctx, arg.Path, tlf.SingleTeam)\n\t\tdefault:\n\t\t\tfs, finalElem, err := k.getFS(ctx, arg.Path)\n\t\t\tswitch err.(type) {\n\t\t\tcase nil:\n\t\t\tcase libfs.TlfDoesNotExist:\n\t\t\t\t// TLF doesn't exist yet; just return an empty result.\n\t\t\t\tk.setResult(arg.OpID, keybase1.SimpleFSListResult{})\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfi, err := fs.Stat(finalElem)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvar fis []os.FileInfo\n\t\t\tif fi.IsDir() {\n\t\t\t\tfis, err = fs.ReadDir(finalElem)\n\t\t\t} else {\n\t\t\t\tfis = append(fis, fi)\n\t\t\t}\n\t\t\tfor _, fi := range fis {\n\t\t\t\tvar d keybase1.Dirent\n\t\t\t\tsetStat(&d, fi)\n\t\t\t\td.Name = fi.Name()\n\t\t\t\tres = append(res, d)\n\t\t\t}\n\t\t}\n\t\tk.setResult(arg.OpID, keybase1.SimpleFSListResult{Entries: res})\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "9693c9370e9a4dd679891ba68735e932", "score": "0.4802432", "text": "func List() string {\n\treq, _ := http.NewRequest(http.MethodGet, ServerUrl+\"/ls\", nil)\n\tvar netClient = &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\tresp, _ := netClient.Do(req)\n\tif resp.StatusCode == http.StatusOK {\n\t\tbody := &bytes.Buffer{}\n\t\t_, err := body.ReadFrom(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn fmt.Sprintf(err.Error())\n\t\t} else {\n\t\t\treturn fmt.Sprintf(body.String())\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"Failed to list files\")\n}", "title": "" }, { "docid": "4acf8fb7507cea20439e9cac3c23f3dc", "score": "0.47939637", "text": "func SendFile(file string)(data map[string]string, err error){\n sendBackArray := make(map[string]string)\n var key string\n var fileName string\n if file == \"node.cfg\" || file == \"networks.cfg\" || file == \"zeekctl.cfg\" {\n if file == \"node.cfg\"{\n key = \"nodeconfig\"\n }else if file == \"networks.cfg\"{\n key = \"networkconfig\"\n }else{\n key = \"zeekctlconfig\"\n }\n\n fileName, err = utils.GetKeyValueString(\"zeek\", key)\n if err != nil { logs.Error(\"SendFile Error getting data from main.conf\"); return nil,err}\n }else{\n //create map and obtain file\n fileName, err = utils.GetKeyValueString(\"files\", file)\n if err != nil { logs.Error(\"SendFile Error getting data from main.conf\"); return nil,err}\n }\n \n //save url from file selected and open file\n fileReaded, err := ioutil.ReadFile(fileName) // just pass the file name\n if err != nil {\n logs.Error(\"Error reading file for path: \"+fileName)\n return nil,err\n }\n \n sendBackArray[\"fileContent\"] = string(fileReaded)\n sendBackArray[\"fileName\"] = file\n\n return sendBackArray, nil\n}", "title": "" }, { "docid": "a094e2e0cb0d7205aa73a205f66e67e8", "score": "0.47930923", "text": "func (ms *MessageService) GetFile(inbuf []byte, /*filename *string,*/ reply *FileData) error {\n\tvar filename = new(string)\n\tLogger.UnpackReceive(\"received file request\", inbuf, &filename)\n\n\tserverListMutex.Lock()\n\tnext := serverList\n\tserverListMutex.Unlock()\n\n\tfor next != nil {\n\n\t\tif (*next).UDP_IPPORT != RECEIVE_PING_ADDR {\n\t\t\tsystemService, err := rpc.Dial(\"tcp\", (*next).RPC_SERVER_IPPORT)\n\t\t\t//checkError(err)\n\t\t\tif err != nil {\n\t\t\t\tprintln(\"SendPublicMsg To Servers: Server \", (*next).UDP_IPPORT, \" isn't accepting tcp conns so skip it...\")\n\t\t\t\treply.Username = \"404\"\n\t\t\t} else {\n\t\t\t\tvar rep FileData\n\t\t\t\toutbuf := Logger.PrepareSend(\"requesting a file\", *filename)\n\t\t\t\terr = systemService.Call(\"NodeService.GetFile\", outbuf, &rep)\n\t\t\t\tcheckError(err)\n\t\t\t\tif err == nil && rep.Username != \"404\" {\n\t\t\t\t\tfmt.Println(\"sent file to client: \", rep.FileName)\n\t\t\t\t\treply.Username = \"202\"\n\t\t\t\t\treply.FileName = rep.FileName\n\t\t\t\t\treply.FileSize = rep.FileSize\n\t\t\t\t\treply.Data = rep.Data\n\t\t\t\t\t\n\t\t\t\t\tLogger.LogLocalEvent(\"sending file to client\")\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treply.Username = \"404\"\n\t\t\t\t}\n\t\t\t\tsystemService.Close()\n\t\t\t}\n\t\t} else {\n\t\t\tresp := possessFile(*filename)\n\t\t\tif resp.Username != \"404\" {\n\t\t\t\treply.Username = resp.Username\n\t\t\t\treply.FileName = resp.FileName\n\t\t\t\treply.FileSize = resp.FileSize\n\t\t\t\treply.Data = resp.Data\n\t\t\t\t\n\t\t\t\tLogger.LogLocalEvent(\"sending file to client\")\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treply.Username = \"404\"\n\t\t\t}\n\t\t}\n\t\tnext = (*next).NextServer\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f4d3af8b83c981e57a2b604102c44d5", "score": "0.4789781", "text": "func run_simulation(data []byte, nodeList []node) {\n\tif(len(nodeList) == 0){\n\t\tfmt.Printf(\"Error: No nodes on network\");\n\t\treturn;\n\t}\n\tsplit := len(data)/len(nodeList);\n\tremainder := len(data) % len(nodeList);\n\tvar nodeData []byte;\n\n\tnodeChan := make(chan fdata, len(nodeList));\n\tallData := make([]fdata, len(nodeList));\n\n\t// bar := pb.StartNew(len(nodeList))\n\t\n\tfor i := range nodeList {\n\t\twg.Add(1);\n\t\t// bar.Increment()\n\t\tif (i != 0) {\n\t\t\tnodeData = data[0+i*split:split+i*split];\n\t\t} else {\n\t\t\tnodeData = data[0+i*split:split+i*split + remainder];\n\t\t}\n\t\tgo uploadFile(nodeList, i, nodeData, nodeChan);\n\t\t// time.Sleep(time.Millisecond)\n\t\t//INSERT SIMULATION HERE\n\t}\n\twg.Wait();\n\n\tfor i := range allData {\n\t\tallData[i] = <- nodeChan;\n\t}\n\n\tf, err := os.Create(\"out/stats.csv\");\n\tif err != nil {\n\t\tfmt.Println(\"Error creating stats csv: \\n\", err);\n\t}\n\n\toutput_f, err := os.Create(\"out/output.txt\");\n\n\tif err != nil {\n\t\tfmt.Println(\"Error creating output file: \\n\", err);\n\t}\n\n\tsort.Slice (allData[:], func(i, j int) bool {\n\t\treturn allData[i].nodeID < allData[j].nodeID;\n\t})\n\n\t// fmt.Println(allData);\n\n\tf.WriteString(\"len(data), nodeID, runtime, downTime, uploadSpeed \" + strconv.FormatFloat(slRatio, 'f', -1, 64) + \"\\n\");\n\tfor i := range allData {\n\t\ts := strconv.Itoa(len(allData[i].data)) + \", \"+ strconv.Itoa(allData[i].nodeID )+ \", \" + strconv.Itoa(allData[i].runtime) + \", \" + strconv.Itoa(nodeList[allData[i].nodeID].downTime) + \", \" + strconv.Itoa(nodeList[allData[i].nodeID].uploadSpd) + \"\\n\";\n\n\t\tfmt.Print(s);\n\t\tf.WriteString(s);\n\t\toutput_f.WriteString(string(allData[i].data));\n\t}\n\t// bar.FinishPrint(\"The End!\")\n\t// fmt.Println(split, \" \", remainder);\n}", "title": "" }, { "docid": "4637df26bdb334b35665cc4e80861b9f", "score": "0.47859558", "text": "func GetFileList(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"I have 10 files\")\n\tw.Write([]byte(\"I have 10 files\"))\n}", "title": "" }, { "docid": "1174e2a1ffaca7dc890bd986469796ab", "score": "0.47789553", "text": "func (h *HashTreeProto) List(path string) ([]*NodeProto, error) {\n\treturn list(h.Fs, path)\n}", "title": "" }, { "docid": "7830ee10f3e8a4a7eec0169734fe3c73", "score": "0.47717896", "text": "func (api *PublicFileSystemAPI) FileList() []storage.FileBriefInfo {\n\tfileList, err := api.fs.fileList()\n\tif err != nil {\n\t\tapi.fs.getLogger().Warn(\"cannot get the file list\", \"error\", err)\n\t\treturn []storage.FileBriefInfo{}\n\t}\n\treturn fileList\n}", "title": "" }, { "docid": "4e2351aa395cccb84aa433ea44dd1b1d", "score": "0.47707698", "text": "func (sp *serverPeer) OnSnodeListPing(_ *peer.Peer, msg *wire.MsgSnodeListPing) {\n\tif msg == nil || msg.MsgSnodePing == nil {\n\t\treturn\n\t}\n\tif snode, err := sn.NewServiceNode(msg.PingPubkey, msg.Config); err == nil {\n\t\tsp.server.AddServiceNode(snode)\n\t}\n}", "title": "" }, { "docid": "e7e3c319e1d73be32ea2e0523d6eacf7", "score": "0.47578737", "text": "func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, error) {\n\tctx, span := tracer.Start(ctx, \"ListFolder\")\n\tdefer span.End()\n\tdir := n.InternalPath()\n\n\t_, subspan := tracer.Start(ctx, \"os.Open\")\n\tf, err := os.Open(dir)\n\tsubspan.End()\n\tif err != nil {\n\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\treturn nil, errtypes.NotFound(dir)\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"tree: error listing \"+dir)\n\t}\n\tdefer f.Close()\n\n\t_, subspan = tracer.Start(ctx, \"f.Readdirnames\")\n\tnames, err := f.Readdirnames(0)\n\tsubspan.End()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnumWorkers := t.options.MaxConcurrency\n\tif len(names) < numWorkers {\n\t\tnumWorkers = len(names)\n\t}\n\twork := make(chan string)\n\tresults := make(chan *node.Node)\n\n\tg, ctx := errgroup.WithContext(ctx)\n\n\t// Distribute work\n\tg.Go(func() error {\n\t\tdefer close(work)\n\t\tfor _, name := range names {\n\t\t\tselect {\n\t\t\tcase work <- name:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn ctx.Err()\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\t// Spawn workers that'll concurrently work the queue\n\tfor i := 0; i < numWorkers; i++ {\n\t\tg.Go(func() error {\n\t\t\tfor name := range work {\n\t\t\t\tpath := filepath.Join(dir, name)\n\t\t\t\tnodeID := getNodeIDFromCache(ctx, path, t.idCache)\n\t\t\t\tif nodeID == \"\" {\n\t\t\t\t\tnodeID, err = readChildNodeFromLink(ctx, path)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\terr = storeNodeIDInCache(ctx, path, nodeID, t.idCache)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tchild, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, false, n.SpaceRoot, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// prevent listing denied resources\n\t\t\t\tif !child.IsDenied(ctx) {\n\t\t\t\t\tif child.SpaceRoot == nil {\n\t\t\t\t\t\tchild.SpaceRoot = n.SpaceRoot\n\t\t\t\t\t}\n\t\t\t\t\tselect {\n\t\t\t\t\tcase results <- child:\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\treturn ctx.Err()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\t// Wait for things to settle down, then close results chan\n\tgo func() {\n\t\t_ = g.Wait() // error is checked later\n\t\tclose(results)\n\t}()\n\n\tretNodes := []*node.Node{}\n\tfor n := range results {\n\t\tretNodes = append(retNodes, n)\n\t}\n\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn retNodes, nil\n}", "title": "" }, { "docid": "b9acb4d8e914fa36a9abb710efe092ea", "score": "0.4751826", "text": "func SaveList(list HostList, filename string) {\r\n\tfile, _ := json.MarshalIndent(list, \"\", \" \")\r\n\t_ = ioutil.WriteFile(filename, file, 0644)\r\n}", "title": "" }, { "docid": "eb0aa5ad2aaf9e8a35b418ce46bf28f2", "score": "0.47432375", "text": "func (m *MockEnqueuerGitserverClient) ListFiles(v0 context.Context, v1 int, v2 string, v3 *regexp.Regexp) ([]string, error) {\n\tr0, r1 := m.ListFilesFunc.nextHook()(v0, v1, v2, v3)\n\tm.ListFilesFunc.appendCall(EnqueuerGitserverClientListFilesFuncCall{v0, v1, v2, v3, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "43eac7b978d6098dd2c39abb63102d06", "score": "0.47396764", "text": "func (f *Fs) list(ctx context.Context, dir *mega.Node, fn listFn) (found bool, err error) {\n\tnodes, err := f.srv.FS.GetChildren(dir)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"list failed: %w\", err)\n\t}\n\tfor _, item := range nodes {\n\t\tif fn(item) {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e6389944452c9754122225543b638c90", "score": "0.47268742", "text": "func (n *DFINode) Process() {\n\tvar filepath string\n\tif str, ok := n.Config[\"filename\"]; ok {\n\t\tfilepath = str\n\t}\n\n\tif str, ok := n.Config[\"filename\"]; ok {\n\t\tfileContents, _ := ioutil.ReadFile(str)\n\t\tstat, err := os.Stat(str)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Could not stat file for node \"+n.UUID, err)\n\t\t}\n\t\tn.OutputChannels[0] <- n.createDocument(n, fileContents, stat)\n\t}\n\n\twatcher, _ := fsnotify.NewWatcher()\n\tdefer watcher.Close()\n\twatcher.Add(filepath)\n\tlog.Info(\"node \" + n.UUID + \" is watching file/directory \" + filepath)\n\tfor {\n\t\tselect {\n\t\tcase command := <-n.ControlChannel:\n\t\t\tif command == \"exit\" {\n\t\t\t\tlog.Info(\"exiting node \" + n.UUID)\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase event := <-watcher.Events:\n\t\t\tlog.Debug(\"Found change in watched file\")\n\t\t\tswitch {\n\t\t\tcase event.Op == fsnotify.Write:\n\t\t\t\tfileContents, _ := ioutil.ReadFile(event.Name)\n\t\t\t\tstat, err := os.Stat(event.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"Could not stat file for node \"+n.UUID, err)\n\t\t\t\t}\n\t\t\t\tn.OutputChannels[0] <- n.createDocument(n, fileContents, stat)\n\t\t\tcase event.Op == fsnotify.Create:\n\t\t\t\tlog.Debug(\"created a file in watched directory\")\n\t\t\tdefault:\n\n\t\t\t}\n\t\t\tlog.Debug(event.String())\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond * 100) // dictates responsiveness\n\t\t}\n\t}\n}", "title": "" }, { "docid": "81634bf3ef02c576886fff3630047fcd", "score": "0.47255254", "text": "func (h *hashtree) List(path string) ([]*NodeProto, error) {\n\treturn list(h.fs, path)\n}", "title": "" }, { "docid": "506dffbbc91b8c7083289219e0b4cd30", "score": "0.47239083", "text": "func (c *Collection) AddList(fc *FileContext, list []os.FileInfo) {\n\tfor _, fi := range list {\n\t\tnode := Node{\n\t\t\tfc: fc,\n\t\t\tinfo: fi,\n\t\t}\n\t\tif !c.accept(&node) {\n\t\t\tcontinue\n\t\t}\n\t\tname := strings.ToUpper(fi.Name())\n\n\t\told := c.nodes[name]\n\n\t\t/*\n\t\t\tconflict resolution matrix\n\t\t\told only checks last element in nodes list\n\n\t\t\told: | dif folder| same folder | empty\n\t\t\t\t\t\t\t | file | del | dir |\n\t\t\tnew:\n\t\t\tfile | R | A | R | A | R\n\t\t\tdel | R | X | A | A | R\n\t\t\tdir | A | A | A | A | R\n\n\t\t\tR : replace with new list\n\t\t\tA : use addNode function\n\t\t\tX : no-op\n\t\t*/\n\n\t\tif len(old) == 0 { //empty case\n\t\t\tc.nodes[name] = []Node{node}\n\t\t\tcontinue\n\t\t}\n\t\tindex := len(old) - 1\n\t\tlast := old[index]\n\n\t\tif !node.IsDir() && !node.SameDir(last) {\n\t\t\tc.nodes[name] = []Node{node}\n\t\t\tcontinue\n\t\t}\n\t\tif !node.IsDir() && !last.IsDir() && node.SameDir(last) {\n\t\t\tif node.IsDelete() && !last.IsDelete() {\n\t\t\t\tcontinue //no-op\n\t\t\t}\n\t\t\tif !node.IsDelete() && last.IsDelete() {\n\t\t\t\tc.nodes[name] = []Node{node}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tc.nodes[name] = addNode(c.nodes[name], node)\n\t}\n}", "title": "" }, { "docid": "1b8856b17425f30a3650fbc583ba3480", "score": "0.47204092", "text": "func ListFilesHandler(handlerData web.HandlerData, w http.ResponseWriter, r *http.Request) {\n\tvar request models.FileListRequest\n\tif !readRequestLimited(w, r, &request, handlerData.Config.Webserver.MaxRequestBodyLength) {\n\t\treturn\n\t}\n\n\tvar namespace *models.Namespace\n\n\tif !request.AllNamespaces {\n\t\t// Select namespace\n\t\tnamespace = models.FindNamespace(handlerData.Db, request.Attributes.Namespace, handlerData.User)\n\n\t\t// Handle namespace errors (not found || no access)\n\t\tif !handleNamespaceErorrs(namespace, handlerData.User, w) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar foundFiles []models.File\n\n\tloaded := handlerData.Db.Model(&foundFiles)\n\tif len(request.Attributes.Tags) > 0 || request.OptionalParams.Verbose > 1 {\n\t\tloaded = loaded.Preload(\"Tags\")\n\t}\n\n\tif len(request.Attributes.Groups) > 0 || request.OptionalParams.Verbose > 1 {\n\t\tloaded = loaded.Preload(\"Groups\")\n\t}\n\n\tif request.OptionalParams.Verbose > 2 || request.AllNamespaces {\n\t\tloaded = loaded.Preload(\"Namespace\")\n\t}\n\n\tif len(request.Name) > 0 {\n\t\tloaded = loaded.Where(\"files.name LIKE ?\", \"%\"+request.Name+\"%\")\n\t}\n\n\tif request.AllNamespaces {\n\t\t// Join to filter by namespace creator\n\t\tloaded = loaded.\n\t\t\tJoins(\"INNER JOIN namespaces ON namespaces.id = files.namespace_id\").\n\t\t\tWhere(\"namespaces.creator = ?\", handlerData.User.ID)\n\t} else {\n\t\t// Just select the specified namespace\n\t\tloaded = loaded.Where(\"namespace_id = ?\", namespace.ID)\n\t}\n\n\t// Search\n\terr := loaded.Find(&foundFiles).Error\n\tif LogError(err) {\n\t\tsendServerError(w)\n\t\treturn\n\t}\n\n\t// Convert to ResponseFile\n\tvar retFiles []models.FileResponseItem\n\tfor _, file := range foundFiles {\n\t\t// Filter tags\n\t\tif (len(request.Attributes.Tags) == 0 || (len(request.Attributes.Tags) > 0 && file.IsInTagList(request.Attributes.Tags))) &&\n\t\t\t// Filter groups\n\t\t\t(len(request.Attributes.Groups) == 0 || (len(request.Attributes.Groups) > 0 && file.IsInGroupList(request.Attributes.Groups))) {\n\t\t\trespItem := models.FileResponseItem{\n\t\t\t\tID: file.ID,\n\t\t\t\tName: file.Name,\n\t\t\t\tCreationDate: file.CreatedAt,\n\t\t\t\tSize: file.FileSize,\n\t\t\t\tIsPublic: file.IsPublic,\n\t\t\t}\n\n\t\t\t// Set encryption\n\t\t\tif file.Encryption.Valid && constants.EncryptionIValid(file.Encryption.Int32) {\n\t\t\t\trespItem.Encryption = constants.ChiperToString(file.Encryption.Int32)\n\t\t\t}\n\n\t\t\t// Append public name if available\n\t\t\tif file.PublicFilename.Valid && len(file.PublicFilename.String) > 0 {\n\t\t\t\trespItem.PublicName = file.PublicFilename.String\n\t\t\t}\n\n\t\t\t// Return attributes on verbose\n\t\t\tif request.OptionalParams.Verbose > 1 || request.AllNamespaces {\n\t\t\t\trespItem.Attributes = file.GetAttributes()\n\t\t\t}\n\n\t\t\t// Add if matching filter\n\t\t\tretFiles = append(retFiles, respItem)\n\t\t}\n\t}\n\n\tsendResponse(w, models.ResponseSuccess, \"\", models.ListFileResponse{\n\t\tFiles: retFiles,\n\t})\n}", "title": "" }, { "docid": "7abfca2f4bd2315047cc2e20021ed827", "score": "0.4717084", "text": "func UpdatePlayerList() {\n\tbuf := bytes.NewBuffer(nil)\n\tfor i, player := range players {\n\t\tbuf.WriteByte(i)\n\t\tbuf.Write([]byte(player.Name))\n\t\tbuf.WriteByte(0x00)\n\t}\n\tp := packet.New(packet.PacketTypeUDP, 0x06)\n\tbufferBytes := buf.Bytes()\n\tp.AddField(bufferBytes)\n\tfor _, player := range players {\n\t\tplayer.Send(p)\n\t}\n}", "title": "" }, { "docid": "18fcc5e815a23de7ad875c00b07e59b6", "score": "0.47162738", "text": "func (p *proxyrunner) collectCachedFileList(bucket, bckProvider string, fileList *cmn.BucketList, getmsgjson []byte) (err error) {\n\treqParams := &cmn.GetMsg{}\n\terr = jsoniter.Unmarshal(getmsgjson, reqParams)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbucketMap := make(map[string]*cmn.BucketEntry, initialBucketListSize)\n\tfor _, entry := range fileList.Entries {\n\t\tbucketMap[entry.Name] = entry\n\t}\n\n\tsmap := p.smapowner.get()\n\tdataCh := make(chan *localFilePage, smap.CountTargets())\n\terrCh := make(chan error, 1)\n\twgConsumer := &sync.WaitGroup{}\n\twgConsumer.Add(1)\n\tgo func() {\n\t\tp.consumeCachedList(bucketMap, dataCh, errCh)\n\t\twgConsumer.Done()\n\t}()\n\n\t// since cached file page marker is not compatible with any cloud\n\t// marker, it should be empty for the first call\n\treqParams.GetPageMarker = \"\"\n\n\twg := &sync.WaitGroup{}\n\tfor _, daemon := range smap.Tmap {\n\t\twg.Add(1)\n\t\t// without this copy all goroutines get the same pointer\n\t\tgo func(d *cluster.Snode) {\n\t\t\tp.generateCachedList(bucket, bckProvider, d, dataCh, reqParams)\n\t\t\twg.Done()\n\t\t}(daemon)\n\t}\n\twg.Wait()\n\tclose(dataCh)\n\twgConsumer.Wait()\n\n\tselect {\n\tcase err = <-errCh:\n\t\treturn\n\tdefault:\n\t}\n\n\tfileList.Entries = make([]*cmn.BucketEntry, 0, len(bucketMap))\n\tfor _, entry := range bucketMap {\n\t\tfileList.Entries = append(fileList.Entries, entry)\n\t}\n\n\t// sort the result to be consistent with other API\n\tifLess := func(i, j int) bool {\n\t\treturn fileList.Entries[i].Name < fileList.Entries[j].Name\n\t}\n\tsort.Slice(fileList.Entries, ifLess)\n\n\treturn\n}", "title": "" }, { "docid": "2efbfd37795e4b75528a3f8bf383439f", "score": "0.4715301", "text": "func (s *Handler) ListNodes(ctx context.Context, req *tree.ListNodesRequest, resp tree.NodeProvider_ListNodesStream) error {\n\n\tclient, e := s.IndexClient.ListNodes(ctx, req)\n\tif e != nil {\n\t\treturn e\n\t}\n\tdefer client.Close()\n\tfor {\n\t\tnodeResp, re := client.Recv()\n\t\tif nodeResp == nil {\n\t\t\tbreak\n\t\t}\n\t\tif re != nil {\n\t\t\treturn e\n\t\t}\n\t\tse := resp.Send(nodeResp)\n\t\tif se != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3220108d3c164eeae550a5eef9dfb2b0", "score": "0.47145948", "text": "func listen(path string) error {\n\tmsgs, err := messaging.ClientListen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tfor d := range msgs {\n\t\t\t\t// log.Printf(\"< Received message: %s\", d.Type)\n\n\t\t\t\tif d.Type == \"GET_FILELIST\" {\n\t\t\t\t\tfilelist, err := getFilelist(path)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(\"Error getting list of files: \", err)\n\t\t\t\t\t}\n\t\t\t\t\tif len(filelist) > 0 {\n\t\t\t\t\t\tsendFilelist(filelist)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "056844b7ef708873e614393e1f2fb7e7", "score": "0.47139573", "text": "func AppendFolderList(filename string, toappend string) {\n\tdata := DecodeFolderList(filename)\n\tdata = append(data, toappend)\n\tdata = jbasefuncs.ArrayStringUnique(data)\n\tjbasefuncs.FilePutContents(filename, ToJson(data))\n}", "title": "" }, { "docid": "3619c7885764ce85c24072bff5b581a3", "score": "0.47122982", "text": "func (s Server) checkFileList(fname string) bool {\n\t_, present := s.FileList[fname]\n\treturn present\n}", "title": "" }, { "docid": "47f2f180d05cfab1b51b7d8a0485ff83", "score": "0.47118267", "text": "func (p *Pledge_bw) Set_path_list( pl []*Path ) {\n\tp.path_list = pl\n}", "title": "" }, { "docid": "bdcc1fcd0fe8451b2633aece515d1021", "score": "0.47113612", "text": "func watchDir(done chan bool, deviceID string, baseDir string, dirs ...string) {\n\twatcher, err := fsnotify.NewWatcher()\n\tutil.HandleErr(err)\n\tdefer watcher.Close()\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev := <-watcher.Event:\n\t\t\t\teventFile := ev.Name\n\t\t\t\tlog.Println(\"event:\", ev)\n\n\t\t\t\tif ev.IsCreate() {\n\t\t\t\t\ttempFile, err := os.Open(eventFile)\n\t\t\t\t\tutil.HandleErr(err)\n\n\t\t\t\t\tfi, err := tempFile.Stat()\n\t\t\t\t\tutil.HandleErr(err)\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase fi.IsDir():\n\t\t\t\t\t\terr = watcher.Watch(eventFile)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif fi.IsDir() == false {\n\t\t\t\t\t\t_, exist := (*fs.GetFileDBInstance())[eventFile]\n\t\t\t\t\t\tif exist == false {\n\t\t\t\t\t\t\tfs.GetFileDBInstance().AddFileDir(eventFile)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ev.IsDelete() {\n\t\t\t\t\twatcher.RemoveWatch(eventFile)\n\t\t\t\t\t// TODO: let server delete the file\n\t\t\t\t\t// requestDel(eventFile)\n\t\t\t\t}\n\n\t\t\t\tif ev.IsModify() {\n\t\t\t\t}\n\n\t\t\t\tif ev.IsRename() {\n\t\t\t\t}\n\n\t\t\t\tif ev.IsAttrib() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\trelativePath, err := filepath.Rel(baseDir, path.Dir(eventFile))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalln(\"can not get relative path of the file\", eventFile)\n\t\t\t\t}\n\n\t\t\t\tfileDb := fs.GetFileDBInstance()\n\t\t\t\t_, exist := (*fileDb)[eventFile]\n\n\t\t\t\tif exist == false {\n\t\t\t\t\tlog.Println(\"doesn't exist\")\n\t\t\t\t\terr = sync.SendFile(eventFile, relativePath, deviceID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Can not send file %v: %v\", eventFile, err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tele := (*fileDb)[eventFile]\n\t\t\t\t\tif ele.Incoming == false {\n\t\t\t\t\t\tlog.Println(\"incoming is false\", eventFile)\n\t\t\t\t\t\terr = sync.SendFile(eventFile, relativePath, deviceID)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"Can not send file %v: %v\", eventFile, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// set Incoming to false\n\t\t\t\t\t\tfs.GetFileDBInstance().UnsetIncoming(eventFile)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase err := <-watcher.Error:\n\t\t\t\tlog.Println(\"error\", err)\n\t\t\t\tdone <- true\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor _, dir := range dirs {\n\t\terr = watcher.Watch(dir)\n\t\tdefer watcher.RemoveWatch(dir)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\tdone <- true\n\t\t}\n\t}\n\n\t<-done\n}", "title": "" }, { "docid": "f3b98616339efe07e6abbc9dbb26e4e8", "score": "0.47106463", "text": "func AppendToList(serverName string, dbNum uint8, key, listValue string) error {\n\tconn, err := connector.GetByName(serverName, dbNum)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = conn.Do(\"RPUSH\", key, listValue)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fa96812dac02b1f3d04ea83ceccaecf5", "score": "0.4700514", "text": "func sendPublicMsgServers(message ClientMessage) {\n\n\tserverListMutex.Lock()\n\tnext := serverList\n\tsize := sizeOfServerList()\n\tserverListMutex.Unlock()\n\tvar wg sync.WaitGroup\n\twg.Add(size)\n\n\tclockedMsg := ClockedClientMsg{\n\t\tClientMsg: message,\n\t\tServerId: RECEIVE_PING_ADDR,\n\t\tClock: thisClock}\n\n\ttoHistoryBuf[numMsgsRcvd-1] = clockedMsg\n\n\tfor next != nil {\n\t\tgo func(next *ServerItem, clockedMsg ClockedClientMsg) {\n\t\t\tdefer wg.Done()\n\t\t\tif (*next).UDP_IPPORT != RECEIVE_PING_ADDR {\n\t\t\t\tsystemService, err := rpc.Dial(\"tcp\", (*next).RPC_SERVER_IPPORT)\n\t\t\t\t//checkError(err)\n\t\t\t\tif err != nil {\n\t\t\t\t\tprintln(\"SendPublicMsg To Servers: Server \", (*next).UDP_IPPORT, \" isn't accepting tcp conns so skip it...\")\n\t\t\t\t\t//it's dead but the ping will eventually take care of it\n\t\t\t\t} else {\n\t\t\t\t\tvar reply ServerReply\n\t\t\t\t\tlogMutex.Lock()\n\t\t\t\t\toutbuf := Logger.PrepareSend(\"broadcasting public message\", clockedMsg)\n\t\t\t\t\tlogMutex.Unlock()\n\t\t\t\t\terr = systemService.Call(\"NodeService.SendPublicMsg\", outbuf, &reply)\n\t\t\t\t\t//checkError(err)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tfmt.Println(\"we sent a message to a server: \", reply.Message)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprintln(\"SendPublicMsg To Servers: Server \", (*next).UDP_IPPORT, \" error on call.\")\n\t\t\t\t\t}\n\t\t\t\t\tsystemService.Close()\n\t\t\t\t}\n\t\t\t}\n\n\t\t}(next, clockedMsg)\n\t\tnext = (*next).NextServer\n\t}\n\n\twg.Wait()\n\treturn\n}", "title": "" }, { "docid": "fc93e6f0fc2cf64cce94412aa9bf96c5", "score": "0.4700468", "text": "func (bw *blobWriter) PrepareForward(ctx context.Context, serverForwardMap map[string][]string, gid float64) ([]string, error) {\n\tvar serverFiles []Pair\n\tlimChan := make(chan bool, len(serverForwardMap))\n\tdefer close(limChan)\n\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareForward: [len(serverForwardMap)]=>%d\", len(serverForwardMap))\n\tfor i := 0; i < len(serverForwardMap); i++ {\n\t\tlimChan <- true\n\t}\n\t//\tmvtarpathall := path.Join(\"/var/lib/registry\", server)\n\tfor server, fpathlst := range serverForwardMap {\n\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: serverForwardMap: [%s]=>%\", server, fpathlst)\n\t\tfor _, fpath := range fpathlst {\n\t\t\tsftmp := Pair{\n\t\t\t\tfirst: server,\n\t\t\t\tsecond: fpath,\n\t\t\t}\n\t\t\tserverFiles = append(serverFiles, sftmp)\n\t\t}\n\t}\n\n\ttmp_dir := fmt.Sprintf(\"%f\", gid)\n\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareForward: the gid for this goroutine: =>%\", tmp_dir)\n\n\tfor _, sftmp := range serverFiles {\n\t\t<-limChan\n\t\tgo func(sftmp Pair) {\n\t\t\tserver := sftmp.first\n\t\t\t//\t\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareForward: cping files to server [%s]\", server)\n\t\t\tfpath := sftmp.second\n\t\t\ttmpath := path.Join(server, tmp_dir, \"NANNAN_NO_NEED_TO_DEDUP_THIS_TARBALL\")\n\t\t\t//192.168.210/tmp_dir/NANNAN_NO_NEED_TO_DEDUP_THIS_TARBALL/\n\t\t\t//898c46f3b1a1f39827ed135f020c32e2038c87ae0690a8fe73d94e5df9e6a2d6/\n\t\t\t//diff/bin/1c48ade64b96409e6773d2c5c771f3b3c5acec65a15980d8dca6b1efd3f95969\n\t\t\twithtmptarfpath := path.Join(tmpath, strings.TrimPrefix(fpath, \"/var/lib/registry\"))\n\t\t\t//\t\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: withtmptarfpath: [%v]\", withtmptarfpath)\n\n\t\t\tdestfpath := path.Join(\"/docker/registry/v2/mv_tmp_serverfiles/\", withtmptarfpath)\n\t\t\t//\t\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareForward: cping files to server [%s], destfpath: [%s]\", server, destfpath)\n\n\t\t\tcontents, err := bw.driver.GetContent(ctx, strings.TrimPrefix(fpath, \"/var/lib/registry\"))\n\t\t\tif err != nil {\n\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: CANNOT READ File FOR SENDING TO OTHER SERVER %s, \", err)\n\t\t\t} else {\n\t\t\t\terr = bw.driver.PutContent(ctx, destfpath, contents)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: CANNOT WRITE FILE TO DES DIR FOR SENDING TO OTHER SERVER %s, \", err)\n\t\t\t\t}\n\t\t\t\t//delete the old one\n\t\t\t\terr = bw.driver.Delete(ctx, strings.TrimPrefix(fpath, \"/var/lib/registry\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: CANNOT DELETE THE ORGINIAL File FOR SENDING TO OTHER SERVER %s, \", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlimChan <- true\n\t\t}(sftmp)\n\t}\n\t// leave the errChan\n\tfor i := 0; i < cap(limChan); i++ {\n\t\t<-limChan\n\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: FORWARD <copy files> [%d th] goroutine is joined \", i)\n\t}\n\t// all goroutines finished here\n\n\tcontext.GetLogger(ctx).Debug(\"NANNAN: FORWARD <copy files> all goroutines finished here\") // not locally available\n\n\tfor i := 0; i < len(serverForwardMap); i++ {\n\t\tlimChan <- true\n\t}\n\n\ttarpathChan := make(chan string, len(serverForwardMap))\n\terrChan := make(chan error, len(serverForwardMap))\n\tdefer close(tarpathChan)\n\tdefer close(errChan)\n\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareCompress: [len(serverForwardMap)]=>%d\", len(serverForwardMap))\n\tfor server, _ := range serverForwardMap {\n\t\t<-limChan\n\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareCompress: compress files before sending to server [%s] \", server)\n\t\tgo func(server string) {\n\t\t\tpackpath := path.Join(\"/var/lib/registry\", \"/docker/registry/v2/mv_tmp_serverfiles\", server, tmp_dir) //tmp_dir is with gid\n\t\t\tcontext.GetLogger(ctx).Debug(\"NANNAN: PrepareCompress <COMPRESS> packpath: %s\", packpath)\n\n\t\t\tdata, err := archive.Tar(packpath, archive.Gzip)\n\t\t\tif err != nil {\n\t\t\t\t//TODO: process manifest file\n\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: Compress <COMPRESS tar> %s, \", err)\n\t\t\t\terrChan <- err\n\t\t\t} else {\n\t\t\t\tdefer data.Close()\n\t\t\t\tnewtardir := path.Join(\"/var/lib/registry\", \"/docker/registry/v2/mv_tmp_servertars\", server)\n\t\t\t\tif os.MkdirAll(newtardir, 0666) != nil {\n\t\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: PrepareCopy <COMPRESS create dir for tarfile> %s, \", err)\n\t\t\t\t\terrChan <- err\n\t\t\t\t} else {\n\t\t\t\t\tpackFile, err := os.Create(path.Join(\"/var/lib/registry\", \"/docker/registry/v2/mv_tmp_servertars\", server, tmp_dir)) // added a tmp_dir\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: PrepareCopy <COMPRESS create file> %s, \", err)\n\t\t\t\t\t\terrChan <- err\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdefer packFile.Close()\n\n\t\t\t\t\t\t_, err := io.Copy(packFile, data)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tcontext.GetLogger(ctx).Errorf(\"NANNAN: Copy compress file <COMPRESS copy to desfile> %s, \", err)\n\t\t\t\t\t\t\terrChan <- err\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarpathChan <- packFile.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\t\tlimChan <- true\n\t\t}(server)\n\t}\n\n\tmvtarpaths := []string{}\n\tfor {\n\t\tselect {\n\t\tcase err := <-errChan:\n\t\t\treturn []string{}, err\n\t\tcase res := <-tarpathChan:\n\t\t\tmvtarpaths = append(mvtarpaths, res)\n\t\t}\n\n\t\tif len(serverForwardMap) == len(mvtarpaths) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn mvtarpaths, nil\n}", "title": "" }, { "docid": "12072c185d64cb730fbb0be7ef9a0324", "score": "0.46961975", "text": "func (rf *Raft) sendAllLog() { //检测是否为leader\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tfor k := range rf.peers {\n\t\tif k != rf.me && rf.currentState == \"leader\" {\n\t\t\tfmt.Printf(\"from leader %d heartBeat to %d\\n\", rf.me, k)\n\t\t\targs := &AppendEntriesArgs{}\n\t\t\targs.Term = rf.currentTerm\n\t\t\targs.LeaderId = rf.me\n\t\t\targs.PrevLogIndex = rf.NextIndex[k] - 1\n\t\t\tif args.PrevLogIndex >= 0 {\n\t\t\t\targs.PrevLogTerm = rf.log[args.PrevLogIndex].Term\n\t\t\t}\n\t\t\tif rf.getLastLogIndex() >= rf.NextIndex[k] {\n\t\t\t\targs.Enteries = rf.log[rf.NextIndex[k]:]\n\t\t\t}\n\t\t\targs.LeaderCommit = rf.commitIndex\n\t\t\treply := &AppendEntriesReply{}\n\t\t\tgo rf.sendAppendEntries(k, args, reply)\n\t\t\t//rf.mu.Lock()\n\t\t\t//if heartBeatReply.Term > rf.currentTerm{\n\t\t\t//\trf.currentTerm = heartBeatReply.Term\n\t\t\t//\trf.currentState = \"follower\"\n\t\t\t//}\n\t\t\t//rf.mu.Unlock()\n\n\t\t}\n\t}\n\trf.persist()\n\n}", "title": "" }, { "docid": "2aeb20993973e531209f0e159566505b", "score": "0.46880913", "text": "func List(ctx context.Context, f fs.Fs, w io.Writer) error {\n\tci := fs.GetConfig(ctx)\n\treturn ListFn(ctx, f, func(o fs.Object) {\n\t\tsyncFprintf(w, \"%s %s\\n\", SizeStringField(o.Size(), ci.HumanReadable, 9), o.Remote())\n\t})\n}", "title": "" }, { "docid": "200f366da1751d7b4a750d80baed82ce", "score": "0.46823525", "text": "func (c *Consul) List(ch chan *model.Server) (err error) {\n\tdefer close(ch)\n\n\tnodes, _, err := c.catalog.Nodes(nil)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, v := range nodes {\n\t\tch <- &model.Server{\n\t\t\tName: c.Prefix + v.Node,\n\t\t\tAddress: v.Address,\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "71181929de83cb0d56a566e9eb42fcf1", "score": "0.46806538", "text": "func rewriteVersionList(dir string) {\n\tif filepath.Base(dir) != \"@v\" {\n\t\tbase.Fatalf(\"go: internal error: misuse of rewriteVersionList\")\n\t}\n\n\tlistFile := filepath.Join(dir, \"list\")\n\n\t// We use a separate lockfile here instead of locking listFile itself because\n\t// we want to use Rename to write the file atomically. The list may be read by\n\t// a GOPROXY HTTP server, and if we crash midway through a rewrite (or if the\n\t// HTTP server ignores our locking and serves the file midway through a\n\t// rewrite) it's better to serve a stale list than a truncated one.\n\tunlock, err := lockedfile.MutexAt(listFile + \".lock\").Lock()\n\tif err != nil {\n\t\tbase.Fatalf(\"go: can't lock version list lockfile: %v\", err)\n\t}\n\tdefer unlock()\n\n\tinfos, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar list []string\n\tfor _, info := range infos {\n\t\t// We look for *.mod files on the theory that if we can't supply\n\t\t// the .mod file then there's no point in listing that version,\n\t\t// since it's unusable. (We can have *.info without *.mod.)\n\t\t// We don't require *.zip files on the theory that for code only\n\t\t// involved in module graph construction, many *.zip files\n\t\t// will never be requested.\n\t\tname := info.Name()\n\t\tif strings.HasSuffix(name, \".mod\") {\n\t\t\tv := strings.TrimSuffix(name, \".mod\")\n\t\t\tif v != \"\" && module.CanonicalVersion(v) == v {\n\t\t\t\tlist = append(list, v)\n\t\t\t}\n\t\t}\n\t}\n\tSortVersions(list)\n\n\tvar buf bytes.Buffer\n\tfor _, v := range list {\n\t\tbuf.WriteString(v)\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\told, _ := renameio.ReadFile(listFile)\n\tif bytes.Equal(buf.Bytes(), old) {\n\t\treturn\n\t}\n\n\tif err := renameio.WriteFile(listFile, buf.Bytes(), 0666); err != nil {\n\t\tbase.Fatalf(\"go: failed to write version list: %v\", err)\n\t}\n}", "title": "" }, { "docid": "f547f972de394f0922c034500cb3489e", "score": "0.46806005", "text": "func (m *Monitor) ProcessFiles(fileChannel <-chan *File) {\n\tfor file := range fileChannel {\n\t\tif file != nil {\n\t\t\thashBytes := sha3.Sum256(file.Bytes)\n\t\t\tfile.Hash = hex.EncodeToString(hashBytes[:])\n\t\t\tif _, exists := m.FileHashes[file.Hash]; !exists {\n\t\t\t\tm.Mutex.Lock()\n\t\t\t\tm.FileHashes[file.Hash] = true\n\t\t\t\tm.Mutex.Unlock()\n\n\t\t\t\tfor i := 0; i < 5; i++ {\n\t\t\t\t\terr := m.UploadFile(file)\n\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\t// Handle Error\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58cc4f3dde8127d9afef33e9e520dcb7", "score": "0.46771854", "text": "func (md *Dir) List() (msgs []Message, err error) {\n\tfilenames, err := filepath.Glob(filepath.Join(md.path, \"[new,cur]\", \"*\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsgs = make([]Message, len(filenames))\n\n\tfor i, f := range filenames {\n\t\tmsgs[i].Key, _, err = splitKeyFlags(f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmsgs[i].filename = f\n\t\tmsgs[i].md = md\n\t}\n\n\treturn msgs, nil\n}", "title": "" } ]
e7aabbd3efa7cf2f025c8af5b2d4df47
RestServiceTicket returns the url for requesting an service ticket via rest api
[ { "docid": "04767ca2660dbd0cd6ee0634d0897466", "score": "0.8364244", "text": "func (scheme *DefaultURLScheme) RestServiceTicket(tgt string) (*url.URL, error) {\n\treturn scheme.createURL(path.Join(scheme.RestEndpoint, tgt))\n}", "title": "" } ]
[ { "docid": "f19c0f00ecb4a0a93db8236ab1533ca2", "score": "0.64049375", "text": "func (scheme *DefaultURLScheme) RestGrantingTicket() (*url.URL, error) {\n\treturn scheme.createURL(scheme.RestEndpoint)\n}", "title": "" }, { "docid": "e330d22c3b153954fd57bbbe7cd38cde", "score": "0.6080225", "text": "func TicketURL(endpoint string, ticketKey string) string {\n\treturn endpoint + path.Join(\"browse\", ticketKey)\n}", "title": "" }, { "docid": "0bff88b96b80c89407d5bd31ded9c3af", "score": "0.5944544", "text": "func getURL(client *golangsdk.ServiceClient, id string) string {\n\treturn client.ServiceURL(rootPath, id)\n}", "title": "" }, { "docid": "7a1302c665669c94c8f846c1a1b642f4", "score": "0.589775", "text": "func getURL(client *golangsdk.ServiceClient, id string) string {\n\treturn client.ServiceURL(resourcePath, id)\n}", "title": "" }, { "docid": "9c5f61f51c24f40b1bfa0094d68e8a30", "score": "0.5786565", "text": "func (s *Service) getTicket(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\ts.Logger.Infow(\"Received request to fetch ticket\", \"ticket\", id)\n\n\tticket, err := s.Storage.FindTicket(id)\n\tif err != nil {\n\t\ts.handleAPIError(\"Failed to find ticket\", err, w)\n\t\treturn\n\t}\n\n\tbody, err := json.Marshal(ticket)\n\tif err != nil {\n\t\ts.handleAPIError(\"Failed to marshal response\", err, w)\n\t\treturn\n\t}\n\n\tw.Write(body)\n}", "title": "" }, { "docid": "01b50ed2681277946fd2fe1987b74830", "score": "0.57453954", "text": "func GetServiceAPIURL(route *routev1.Route, serviceInstance *mobilesecurityservicev1alpha1.MobileSecurityService) string{\n\treturn GetServiceURL(route,serviceInstance) + ENDPOINT_API\n}", "title": "" }, { "docid": "5340a085617eff06af129400aec81231", "score": "0.5711915", "text": "func getURL(client *golangsdk.ServiceClient) string {\n\t// remove projectid from endpoint\n\treturn strings.Replace(client.ServiceURL(resourcePath), \"/\"+client.ProjectID, \"\", -1)\n}", "title": "" }, { "docid": "4c0ed945ce2277dbbeddca4bc2619d5f", "score": "0.5618059", "text": "func (cw *ConfigWrapper) restURL() (*cache.Session, error) {\n\tu, err := url.Parse(\"https://\" + cw.config.VSphereServer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.User = url.UserPassword(cw.config.User, cw.config.Password)\n\ts := &cache.Session{\n\t\tURL: u,\n\t\tInsecure: cw.config.InsecureFlag,\n\t}\n\treturn s, err\n}", "title": "" }, { "docid": "92f18f34a19a53c40839e4d425ff6f24", "score": "0.55795264", "text": "func getURL(sc *golangsdk.ServiceClient, serverID string) string {\n\treturn sc.ServiceURL(\"cloudservers\", serverID)\n}", "title": "" }, { "docid": "b9a8b9f3a4035b002665f2c0d3a4f0ab", "score": "0.5547028", "text": "func (nalogruClient *Client) GetTicketId(queryString string) (string, error) {\n\tclient := createHttpClient()\n\tpayload := TicketIdRequest{Qr: queryString}\n\n\treq, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treader := bytes.NewReader(req)\n\turl := nalogruClient.BaseAddress + \"/v2/ticket\"\n\trequest, err := http.NewRequest(http.MethodPost, url, reader)\n\taddHeaders(request, nalogruClient.device.Id.Hex())\n\taddAuth(request, nalogruClient.device.SessionId)\n\tres, err := sendRequest(request, client)\n\n\tif err != nil {\n\t\tlog.Printf(\"Can't POST %s\\n\", url)\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := readBody(res)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif res.StatusCode == http.StatusTooManyRequests {\n\t\tlog.Printf(\"Too Many Requests : %d\\n\", res.StatusCode)\n\t\treturn \"\", errors.New(DailyLimitReached)\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\tlog.Printf(\"Get ticket id(%s) error: %d\\n\", queryString, res.StatusCode)\n\t\tfile, err := os.CreateTemp(\"/var/lib/receipts/error/\", \"*.err\")\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to create error response file\")\n\t\t\treturn \"\", err\n\t\t}\n\t\tdefer dispose.Dispose(file.Close, \"failed to close error file.\")\n\t\t_, err = file.Write(body)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to write response to file\")\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tif res.StatusCode == http.StatusUnauthorized {\n\t\t\terr = AuthError\n\t\t} else {\n\t\t\terr = InternalError\n\t\t}\n\n\t\treturn \"\", err\n\t}\n\n\tticketIdResp := &TicketIdResponse{}\n\terr = json.Unmarshal(body, ticketIdResp)\n\tif err != nil {\n\t\tlog.Println(\"Can't unmarshal response\")\n\t\treturn \"\", err\n\t}\n\treturn ticketIdResp.Id, nil\n}", "title": "" }, { "docid": "23c7a22fc55504403da2b01c4043b01c", "score": "0.5522306", "text": "func extendURL(client *golangsdk.ServiceClient, id string) string {\n\treturn client.ServiceURL(resourcePath, id, extendPath)\n}", "title": "" }, { "docid": "53a24ab89d302afe3458336dae7a43ed", "score": "0.54203963", "text": "func LinkNintendoServiceAccount(settings *playfab.Settings, postData *LinkNintendoServiceAccountRequestModel, clientSessionTicket string) (*EmptyResultModel, error) {\r\n if clientSessionTicket == \"\" {\n return nil, playfab.NewCustomError(\"clientSessionTicket should not be an empty string\", playfab.ErrorGeneric)\n }\r\n b, errMarshal := json.Marshal(postData)\r\n if errMarshal != nil {\r\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\r\n }\r\n\r\n sourceMap, err := playfab.Request(settings, b, \"/Client/LinkNintendoServiceAccount\", \"X-Authentication\", clientSessionTicket)\r\n if err != nil {\r\n return nil, err\r\n }\r\n \r\n result := &EmptyResultModel{}\r\n\r\n config := mapstructure.DecoderConfig{\r\n DecodeHook: playfab.StringToDateTimeHook,\r\n Result: result,\r\n }\r\n \r\n decoder, errDecoding := mapstructure.NewDecoder(&config)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n \r\n errDecoding = decoder.Decode(sourceMap)\r\n if errDecoding != nil {\r\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\r\n }\r\n\r\n return result, nil\r\n}", "title": "" }, { "docid": "c75a53ca653c9a5ea77b2017ca2057b3", "score": "0.5376827", "text": "func (c *CASProxy) ValidateTicket(w http.ResponseWriter, r *http.Request) {\n\tcasURL, err := url.Parse(c.casBase)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to parse CAS base URL %s\", c.casBase)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Make sure the path in the CAS params is the same as the one that was\n\t// requested.\n\tsvcURL, err := url.Parse(c.frontendURL)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to parse the frontend URL %s\", c.frontendURL)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Make sure the serivce path and the query params are set to the incoming\n\t// requests values for those fields.\n\tsvcURL.Path = r.URL.Path\n\tsq := r.URL.Query()\n\tsq.Del(\"ticket\") // Remove the ticket from the service URL. Redirection loops occur otherwise.\n\tsvcURL.RawQuery = sq.Encode()\n\n\t// The request URL for cas validation needs to have the service and ticket in\n\t// it.\n\tcasURL.Path = path.Join(casURL.Path, c.casValidate)\n\tq := casURL.Query()\n\tq.Add(\"service\", svcURL.String())\n\tq.Add(\"ticket\", r.URL.Query().Get(\"ticket\"))\n\tcasURL.RawQuery = q.Encode()\n\n\t// Actually validate the ticket.\n\tresp, err := http.Get(casURL.String())\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"ticket validation error\")\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// If this happens then something went wrong on the CAS side of things. Doesn't\n\t// mean the ticket is invalid, just that the CAS server is in a state where\n\t// we can't trust the response.\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\terr = errors.Wrapf(err, \"ticket validation status code was %d\", resp.StatusCode)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error reading body of CAS response\")\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// This is where the actual ticket validation happens. If the CAS server\n\t// returns 'no\\n\\n' in the body, then the validation was not successful. The\n\t// HTTP status code will be in the 200 range regardless if the validation\n\t// status.\n\tif bytes.Equal(b, []byte(\"no\\n\\n\")) {\n\t\terr = fmt.Errorf(\"ticket validation response body was %s\", b)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// Store a session, hopefully to short circuit the CAS redirect dance in later\n\t// requests. The max age of the cookie should be less than the lifetime of\n\t// the CAS ticket, which is around 10+ hours. This means that we'll be hitting\n\t// the CAS server fairly often, but it shouldn't be an issue.\n\tsession, err := c.cookies.Get(r, sessionName)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed get session %s\", sessionName)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tsession.Values[sessionKey] = 1\n\tsession.Options.MaxAge = c.maxAge\n\tc.cookies.Save(r, w, session)\n\n\thttp.Redirect(w, r, svcURL.String(), http.StatusTemporaryRedirect)\n}", "title": "" }, { "docid": "4ae3fae3d9b6359bbca42d59b2b12136", "score": "0.5339141", "text": "func (ibmAnalyticsEngineApi *IbmAnalyticsEngineApiV3) GetServiceURL() string {\n\treturn ibmAnalyticsEngineApi.Service.GetServiceURL()\n}", "title": "" }, { "docid": "684cabdf4a6460ca74cbd3fcc7e79657", "score": "0.5330318", "text": "func (c *CASProxy) ValidateTicket(w http.ResponseWriter, r *http.Request) {\n\tcasURL, err := url.Parse(c.casBase)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to parse CAS base URL %s\", c.casBase)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Make sure the path in the CAS params is the same as the one that was\n\t// requested.\n\tfrontendURL := c.FrontendAddress(r)\n\tsvcURL, err := url.Parse(frontendURL)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"failed to parse the frontend URL %s\", frontendURL)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Ensure that the service path and the query params are set to the incoming\n\t// request's values for those fields.\n\tsvcURL.Path = r.URL.Path\n\tsq := r.URL.Query()\n\tsq.Del(\"ticket\") // Remove the ticket from the service URL. Redirection loops occur otherwise.\n\tsvcURL.RawQuery = sq.Encode()\n\n\t// The request URL for CAS ticket validation needs to have the service and\n\t// ticket in it.\n\tcasURL.Path = path.Join(casURL.Path, c.casValidate)\n\tq := casURL.Query()\n\tq.Add(\"service\", svcURL.String())\n\tq.Add(\"ticket\", r.URL.Query().Get(\"ticket\"))\n\tcasURL.RawQuery = q.Encode()\n\n\t// Actually validate the ticket.\n\tresp, err := http.Get(casURL.String())\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"ticket validation error\")\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// If this happens then something went wrong on the CAS side of things. Doesn't\n\t// mean the ticket is invalid, just that the CAS server is in a state where\n\t// we can't trust the response.\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\terr = errors.Wrapf(err, \"ticket validation status code was %d\", resp.StatusCode)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error reading body of CAS response\")\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// This is where the actual ticket validation happens. If the CAS server\n\t// returns 'no\\n\\n' in the body, then the validation was not successful. The\n\t// HTTP status code will be in the 200 range regardless of the validation\n\t// status.\n\tif bytes.Equal(b, []byte(\"no\\n\\n\")) {\n\t\terr = fmt.Errorf(\"ticket validation response body was %s\", b)\n\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\treturn\n\t}\n\n\tfields := bytes.Fields(b)\n\tif len(fields) < 2 {\n\t\terr = errors.New(\"not enough fields in ticket validation response body\")\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tusername := string(fields[1])\n\n\t// Store a session, hopefully to short-circuit the CAS redirect dance in later\n\t// requests. The max age of the cookie should be less than the lifetime of\n\t// the CAS ticket, which is around 10+ hours. This means that we'll be hitting\n\t// the CAS server fairly often. Adjust the max age to rate limit requests to\n\t// CAS.\n\tvar s *sessions.Session\n\ts, err = c.sessionStore.Get(r, sessionName)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error getting session\")\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\ts.Values[sessionKey] = username\n\ts.Save(r, w)\n\n\thttp.Redirect(w, r, svcURL.String(), http.StatusFound)\n}", "title": "" }, { "docid": "b37751f526c6a4f318eb9f3514a6ed98", "score": "0.5321212", "text": "func (cli *RegistryClient) URL() string {\n\treturn cli.webScheme() + cli.registry + \"/v2/\"\n}", "title": "" }, { "docid": "68e6ca72d5aa8762f717f9d45f6a1341", "score": "0.5305218", "text": "func (validator *ServiceTicketValidator) ValidateTicket(serviceURL *url.URL, ticket string) (*AuthenticationResponse, error) {\n\tif validator.validationType == \"CAS1\" {\n\t\treturn validator.validateTicketCas1(serviceURL, ticket)\n\t} else if validator.validationType == \"CAS2\" {\n\t\treturn validator.validateTicketCas2(serviceURL, ticket)\n\t}\n\treturn validator.validateTicketCas3(serviceURL, ticket)\n}", "title": "" }, { "docid": "d80cf99e7f7df131dc88c7ff1ed0186e", "score": "0.5300811", "text": "func createURL(client *golangsdk.ServiceClient) string {\n\treturn client.ServiceURL(resourcePath)\n}", "title": "" }, { "docid": "69c87894d3c2e418d0c94c5dfecfe2a1", "score": "0.5285307", "text": "func (service *Service) RegTicket(ctx context.Context, RegTXID string) (*pastel.RegTicket, error) {\n\tregTicket, err := service.pastelClient.RegTicket(ctx, RegTXID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fetch: %s\", err)\n\t}\n\n\tarticketData, err := pastel.DecodeNFTTicket(regTicket.RegTicketData.NFTTicket)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"failed to convert NFT ticket: %w\", err)\n\t}\n\tregTicket.RegTicketData.NFTTicketData = *articketData\n\n\treturn &regTicket, nil\n}", "title": "" }, { "docid": "fdf151384661ff0a508e67a57461788b", "score": "0.5274847", "text": "func TestGetTicketURL(t *testing.T) {\n\toutput := GetTicketURL(1)\n\texpected := \"https://zccrossj.zendesk.com/api/v2/tickets/1.json\"\n\tif output != expected {\n\t\tt.Errorf(\"Output: %s, did not equal expected: %s.\", output, expected)\n\t}\n}", "title": "" }, { "docid": "bd5920925d475a049cebd89fc25071cd", "score": "0.5273188", "text": "func createURL(client *golangsdk.ServiceClient) string {\n\treturn client.ServiceURL(rootPath)\n}", "title": "" }, { "docid": "d96c77e606b719dc7b89f7b7f3b263c2", "score": "0.5254719", "text": "func (c *CAS) makeNewTicketForService(service *CASService) (string, *CASServerError) {\n\treturn \"123456\", nil\n}", "title": "" }, { "docid": "01358270151d82200596526c0b3f5d82", "score": "0.5235449", "text": "func getToService(qs string) {\n\tfmt.Printf(\"%s is being used to service this request.\\n\", scan.ServiceAppName)\n\tresp, err := http.Get(fmt.Sprintf(\"%s?%s\", serviceurl, qs))\n\tif err != nil {\n\t\tfmt.Printf(\"ERROR: error GETting url: %s, error: %+v\\n\", qs, err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tvar body []byte\n\tbody, err = ioutil.ReadAll(resp.Body)\n\tif body == nil || err != nil {\n\t\tfmt.Printf(\"ERROR: getting body: %+v\\n\", err)\n\t}\n\n\tid := scan.ID{}\n\tjson.Unmarshal(body, &id)\n\tif id.ID != \"\" {\n\t\tpendingResultID = id.ID\n\t\treturn\n\t}\n\n\tif len(body) != 0 && strings.TrimSpace(string(body)) != \"\" {\n\t\tfmt.Printf(\"%s\\n\", body)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9093e51b22174608cc2bc5aef506939a", "score": "0.5234923", "text": "func (contextBasedRestrictions *ContextBasedRestrictionsV1) GetServiceURL() string {\n\treturn contextBasedRestrictions.Service.GetServiceURL()\n}", "title": "" }, { "docid": "a1e9c3a57176993946224d8c773ab56c", "score": "0.5224288", "text": "func (client JiraClient) RESTGet(endpoint string, params map[string]string, dest interface{}) error {\n\tendpointURL, err := endpointURL(endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq, err := client.Jira.NewRequest(\"GET\", endpointURL, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tq := req.URL.Query()\n\tfor k, v := range params {\n\t\tq.Add(k, v)\n\t}\n\treq.URL.RawQuery = q.Encode()\n\n\tresp, err := client.Jira.Do(req, dest)\n\tif err != nil {\n\t\terr = userFriendlyJiraError(resp, err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "28e93c9b045cf04b183b16dca212e421", "score": "0.5201303", "text": "func formatUri(realm string, ssl bool) string {\n protocol := \"https://\"\n if (!ssl) {\n protocol = \"http://\"\n }\n return protocol + \"api.fanout.io/realm/\" + realm\n}", "title": "" }, { "docid": "129bd78eba95833ded9828660dfc729c", "score": "0.5200048", "text": "func GetServiceURL(route *routev1.Route, serviceInstance *mobilesecurityservicev1alpha1.MobileSecurityService) string{\n\treturn serviceInstance.Spec.ClusterProtocol + \"://\" + route.Status.Ingress[0].Host\n}", "title": "" }, { "docid": "ef678f54fca6b1e5bc1f1a682fc286ac", "score": "0.5180857", "text": "func getURL(c *gophercloud.ServiceClient, id string) string {\n\treturn c.ServiceURL(\"types\", id)\n}", "title": "" }, { "docid": "d31b474d7f418b9e65bae5e84303875f", "score": "0.5167463", "text": "func (gcp *GoogleCloudPrint) Ticket(gcpJobID string) (cdd.CloudJobTicket, error) {\n\tform := url.Values{}\n\tform.Set(\"jobid\", gcpJobID)\n\tform.Set(\"use_cjt\", \"true\")\n\n\tresponseBody, _, httpStatusCode, err := postWithRetry(gcp.robotClient, gcp.baseURL+\"ticket\", form)\n\t// The /ticket API is different than others, because it only returns the\n\t// standard GCP error information on success=false.\n\tif httpStatusCode != 200 {\n\t\treturn cdd.CloudJobTicket{}, err\n\t}\n\n\td := json.NewDecoder(bytes.NewReader(responseBody))\n\td.UseNumber() // Force large numbers not to be formatted with scientific notation.\n\n\tvar ticket cdd.CloudJobTicket\n\terr = d.Decode(&ticket)\n\tif err != nil {\n\t\treturn cdd.CloudJobTicket{}, fmt.Errorf(\"Failed to unmarshal ticket: %s\", err)\n\t}\n\n\treturn ticket, nil\n}", "title": "" }, { "docid": "234e7c7bdfe8ddcd9f8ae2aa3454a720", "score": "0.51664317", "text": "func updateURL(c *golangsdk.ServiceClient, id string) string {\n\treturn c.ServiceURL(resourcePath, id)\n}", "title": "" }, { "docid": "4f8685b84eb48a651cf6c552dc10f3ee", "score": "0.516477", "text": "func getAPIServerURL(verbose bool, kubectx string) string {\n\tclustername := clusterfromcontext(kubectx)\n\tprobeURL, err := kubecuddler.Kubectl(false, false, kubectlbin, \"config\", \"view\",\n\t\t\"--output=jsonpath='{.clusters[?(@.name == \\\"\"+clustername+\"\\\")]..server}'\")\n\tif err != nil {\n\t\tif verbose {\n\t\t\tdisplayerr(\"Can't cuddle the cluster\", err)\n\t\t}\n\t}\n\tprobeURL = strings.Trim(probeURL, \"'\")\n\treturn probeURL\n}", "title": "" }, { "docid": "94de3f27dc68d6c991acd682f6d3c1cf", "score": "0.515156", "text": "func (car *CreateSSPRequest) URL() string {\n\treturn `/v1/ssps/`\n}", "title": "" }, { "docid": "dd145c411827228deb9a104b8200b05c", "score": "0.51466596", "text": "func (routing *RoutingV1) GetServiceURL() string {\n\treturn routing.Service.GetServiceURL()\n}", "title": "" }, { "docid": "502184cab529cf88344db5b1d71fb91f", "score": "0.51252633", "text": "func mAPIRESTClient(mAPISvcIP string) (*rest.RESTClient, error) {\n\tbaseURL, err := url.Parse(\"http://\" + mAPISvcIP + \":5656\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := rest.NewRESTClient(baseURL, \"/latest/\", mAPIReqContentConfig(), 0, 0, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "502184cab529cf88344db5b1d71fb91f", "score": "0.51252633", "text": "func mAPIRESTClient(mAPISvcIP string) (*rest.RESTClient, error) {\n\tbaseURL, err := url.Parse(\"http://\" + mAPISvcIP + \":5656\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := rest.NewRESTClient(baseURL, \"/latest/\", mAPIReqContentConfig(), 0, 0, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "b58f50dc7a06a06204d29ab30234a239", "score": "0.5082967", "text": "func (a SimpleAuthenticator) GetServiceURL(serviceType string, version string) (string, error) {\n\treturn a.ServiceURL, a.Error\n}", "title": "" }, { "docid": "df7611685e1f3c153a3b66329ce89601", "score": "0.50706214", "text": "func (c *Client) getURL(api string) string {\n\treturn makeURL(\"https\", c.Opt.Hosts[c.host], api)\n}", "title": "" }, { "docid": "9550cd8ffc1124501f1fc7dc24be1b38", "score": "0.5054508", "text": "func (mtls *MtlsV1) GetServiceURL() string {\n\treturn mtls.Service.GetServiceURL()\n}", "title": "" }, { "docid": "82233816e838600dedbc4e0714d79f04", "score": "0.5028244", "text": "func (g *globalFlag) getServiceEndPoint(serviceName string) (string, error) {\n\n\tvar (\n\t\tserviceOBJ service\n\t\tendpoints []endpoint\n\t\tcurrentVersion version\n\t)\n\n\tc := g.getKeystoneClient()\n\n\t// get the service_id by service name\n\trequest := Request{\n\t\tURL: fmt.Sprintf(\"%s/services\", c.URL),\n\t\tMethod: http.MethodGet,\n\t\tOkStatusCode: http.StatusOK,\n\t}\n\n\tresp, err := c.DoRequest(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\titer := jsoniter.ParseBytes(resp.Body)\n\tfor l1Field := iter.ReadObject(); l1Field != \"\"; l1Field = iter.ReadObject() {\n\t\tswitch l1Field {\n\t\tcase \"services\":\n\t\t\tfor iter.ReadArray() {\n\t\t\t\ts := service{}\n\t\t\t\tfor l2Field := iter.ReadObject(); l2Field != \"\"; l2Field = iter.ReadObject() {\n\t\t\t\t\tswitch l2Field {\n\t\t\t\t\tcase \"description\":\n\t\t\t\t\t\titer.Skip()\n\t\t\t\t\tcase \"links\":\n\t\t\t\t\t\titer.Skip()\n\t\t\t\t\tcase \"enabled\":\n\t\t\t\t\t\ts.Enabled = iter.ReadBool()\n\t\t\t\t\tcase \"type\":\n\t\t\t\t\t\ts.Type = iter.ReadString()\n\t\t\t\t\tcase \"id\":\n\t\t\t\t\t\ts.ID = iter.ReadString()\n\t\t\t\t\tcase \"name\":\n\t\t\t\t\t\ts.Name = iter.ReadString()\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn \"\", fmt.Errorf(\"Get Keystone service error, Unkwon field: %s\", l2Field)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif s.Enabled && s.Name == serviceName {\n\t\t\t\t\tserviceOBJ = s\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"links\":\n\t\t\titer.Skip()\n\t\t}\n\t}\n\n\t// get this service's all endpoints\n\tif serviceOBJ.ID != \"\" {\n\t\trequest := Request{\n\t\t\tURL: fmt.Sprintf(\"%s/endpoints?service_id=%s\", c.URL, serviceOBJ.ID),\n\t\t\tMethod: http.MethodGet,\n\t\t\tOkStatusCode: http.StatusOK,\n\t\t}\n\n\t\trespEP, err := c.DoRequest(request)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\titer := jsoniter.ParseBytes(respEP.Body)\n\t\tfor l1Field := iter.ReadObject(); l1Field != \"\"; l1Field = iter.ReadObject() {\n\t\t\tswitch l1Field {\n\t\t\tcase \"endpoints\":\n\t\t\t\tfor iter.ReadArray() {\n\t\t\t\t\tep := endpoint{}\n\t\t\t\t\tfor l2Field := iter.ReadObject(); l2Field != \"\"; l2Field = iter.ReadObject() {\n\t\t\t\t\t\tswitch l2Field {\n\t\t\t\t\t\tcase \"region_id\":\n\t\t\t\t\t\t\titer.Skip()\n\t\t\t\t\t\tcase \"links\":\n\t\t\t\t\t\t\titer.Skip()\n\t\t\t\t\t\tcase \"url\":\n\t\t\t\t\t\t\tep.URL = iter.ReadString()\n\t\t\t\t\t\tcase \"region\":\n\t\t\t\t\t\t\tep.Region = iter.ReadString()\n\t\t\t\t\t\tcase \"enabled\":\n\t\t\t\t\t\t\tep.Enable = iter.ReadBool()\n\t\t\t\t\t\tcase \"interface\":\n\t\t\t\t\t\t\tep.Interface = iter.ReadString()\n\t\t\t\t\t\tcase \"service_id\":\n\t\t\t\t\t\t\tep.ServiceID = iter.ReadString()\n\t\t\t\t\t\tcase \"id\":\n\t\t\t\t\t\t\tep.ID = iter.ReadString()\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn \"\", fmt.Errorf(\"Get Keystone endpoint error, Unkwon field: %s\", l2Field)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ep.Enable {\n\t\t\t\t\t\tendpoints = append(endpoints, ep)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase \"links\":\n\t\t\t\titer.Skip()\n\t\t\t}\n\t\t}\n\t}\n\n\t// if have many versin choice the current one\n\trequestROOT := Request{\n\t\tURL: fmt.Sprintf(\"%s/versions\", endpoints[0].URL),\n\t\tMethod: http.MethodGet,\n\t\tOkStatusCode: http.StatusOK,\n\t}\n\n\trespROOT, err := c.DoRequest(requestROOT)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\titer = jsoniter.ParseBytes(respROOT.Body)\n\tfor l1Field := iter.ReadObject(); l1Field != \"\"; l1Field = iter.ReadObject() {\n\t\tswitch l1Field {\n\t\tcase \"versions\":\n\t\t\tfor iter.ReadArray() {\n\t\t\t\tv := version{}\n\t\t\t\tfor l2Field := iter.ReadObject(); l2Field != \"\"; l2Field = iter.ReadObject() {\n\t\t\t\t\tswitch l2Field {\n\t\t\t\t\tcase \"status\":\n\t\t\t\t\t\tv.Status = iter.ReadString()\n\t\t\t\t\tcase \"id\":\n\t\t\t\t\t\tv.ID = iter.ReadString()\n\t\t\t\t\tcase \"links\":\n\t\t\t\t\t\tfor iter.ReadArray() {\n\t\t\t\t\t\t\tfor l3Field := iter.ReadObject(); l3Field != \"\"; l3Field = iter.ReadObject() {\n\t\t\t\t\t\t\t\tswitch l3Field {\n\t\t\t\t\t\t\t\tcase \"href\":\n\t\t\t\t\t\t\t\t\tv.URL = append(v.URL, iter.ReadString())\n\t\t\t\t\t\t\t\tcase \"rel\":\n\t\t\t\t\t\t\t\t\titer.Skip()\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\tdefault:\n\t\t\t\t\t\treturn \"\", fmt.Errorf(\"Get service current version error, Unkwon field: %s\", l2Field)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif v.Status == \"CURRENT\" {\n\t\t\t\t\tcurrentVersion = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(currentVersion.URL) != 0 {\n\t\treturn currentVersion.URL[0], nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"not endpoint find for %s\", serviceName)\n}", "title": "" }, { "docid": "c7a504b9db3c3b012eba54680695330a", "score": "0.50157076", "text": "func (p *proxy) getService(r *http.Request) (string, error) {\n\tparts := strings.Split(r.URL.Path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", nil\n\t}\n\n\tvar service string\n\tvar alias string\n\n\t// /[service]/methods\n\tif len(parts) > 2 {\n\t\t// /v1/[service]\n\t\tif versionRe.MatchString(parts[1]) {\n\t\t\tservice = parts[1] + \".\" + parts[2]\n\t\t\talias = parts[2]\n\t\t} else {\n\t\t\tservice = parts[1]\n\t\t\talias = parts[1]\n\t\t}\n\t\t// /[service]\n\t} else {\n\t\tservice = parts[1]\n\t\talias = parts[1]\n\t}\n\n\t// check service name is valid\n\tif !p.re.MatchString(alias) {\n\t\treturn \"\", nil\n\t}\n\n\t// get the service\n\tnext, err := p.Selector.Select(p.Namespace + \".\" + service)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\t// get the next node\n\ts, err := next()\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\treturn fmt.Sprintf(\"http://%s:%d\", s.Address, s.Port), nil\n}", "title": "" }, { "docid": "f25899fa3c310aa5b3d7d0547db2510a", "score": "0.5001283", "text": "func (service *ContrailService) RESTGetE2ServiceProvider(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &models.GetE2ServiceProviderRequest{\n\t\tID: id,\n\t}\n\tctx := c.Request().Context()\n\tresponse, err := service.GetE2ServiceProvider(ctx, request)\n\tif err != nil {\n\t\treturn common.ToHTTPError(err)\n\t}\n\treturn c.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "44b873599d28bf486c0eaac766bcd98f", "score": "0.49874303", "text": "func putURL(sc *gophercloud.ServiceClient, nicId string) string {\n\treturn sc.ServiceURL(\"cloudservers\", \"nics\", nicId)\n}", "title": "" }, { "docid": "8b24983fe4bd4eb85ca0f2dcd946168d", "score": "0.4967437", "text": "func (a *Client) ShowTicket(params *ShowTicketParams, authInfo runtime.ClientAuthInfoWriter) (*ShowTicketOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewShowTicketParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"showTicket\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/oauth/tickets/{ticket_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ShowTicketReader{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.(*ShowTicketOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ShowTicketDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "cf082be0de99907c3f4661fcd9efabd7", "score": "0.49469158", "text": "func (validator *ServiceTicketValidator) ServiceValidateUrl(serviceURL *url.URL, ticket string) (string, error) {\n\tu, err := validator.casURL.Parse(path.Join(validator.casURL.Path, \"serviceValidate\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tq := u.Query()\n\tq.Add(\"service\", sanitisedURLString(serviceURL))\n\tq.Add(\"ticket\", ticket)\n\tu.RawQuery = q.Encode()\n\n\treturn u.String(), nil\n}", "title": "" }, { "docid": "7406afdcbdd734d0785cdaa9b74c59e5", "score": "0.49458572", "text": "func (c *bitbucketServerAPIComment) URL(apiURL string, prNumber int) string {\n\treturn fmt.Sprintf(\"%spull-requests/%d/comments/%d\", apiURL, prNumber, c.ID)\n}", "title": "" }, { "docid": "beb92918507b74d6419022c1eeca2542", "score": "0.49401468", "text": "func (cs *CatalogService) GetURL() string {\n\turl := fmt.Sprintf(\"http://%s.botsunit.io:8087/v2/servers/_defaultServer_/status\", cs.Cs.Node)\n\treturn url\n}", "title": "" }, { "docid": "e14c56cd6385b2f84d67e28b055c2a67", "score": "0.49175495", "text": "func (o *UcsdconnectorRestClientMessage) GetRestUrl() string {\n\tif o == nil || o.RestUrl == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RestUrl\n}", "title": "" }, { "docid": "3c8fb35f1c99d664e7f2d734e640a5b4", "score": "0.49017885", "text": "func updateURL(sc *golangsdk.ServiceClient, serverID string) string {\n\treturn sc.ServiceURL(\"cloudservers\", serverID)\n}", "title": "" }, { "docid": "4ace9d54406838667f27e3ac799c3518", "score": "0.48961475", "text": "func curlESService(clusterName, namespace string, payload *esCurlStruct, client client.Client) {\n\n\turlString := fmt.Sprintf(\"https://%s.%s.svc:9200/%s\", clusterName, namespace, payload.URI)\n\turlURL, err := url.Parse(urlString)\n\n\tif err != nil {\n\t\tlogrus.Warnf(\"Unable to parse URL %v: %v\", urlString, err)\n\t\treturn\n\t}\n\n\trequest := &http.Request{\n\t\tMethod: payload.Method,\n\t\tURL: urlURL,\n\t}\n\n\tswitch payload.Method {\n\tcase http.MethodGet:\n\t\t// no more to do to request...\n\tcase http.MethodPost:\n\t\tif payload.RequestBody != \"\" {\n\t\t\t// add to the request\n\t\t\trequest.Header = map[string][]string{\n\t\t\t\t\"Content-Type\": []string{\n\t\t\t\t\t\"application/json\",\n\t\t\t\t},\n\t\t\t}\n\t\t\trequest.Body = ioutil.NopCloser(bytes.NewReader([]byte(payload.RequestBody)))\n\t\t}\n\n\tcase http.MethodPut:\n\t\tif payload.RequestBody != \"\" {\n\t\t\t// add to the request\n\t\t\trequest.Header = map[string][]string{\n\t\t\t\t\"Content-Type\": []string{\n\t\t\t\t\t\"application/json\",\n\t\t\t\t},\n\t\t\t}\n\t\t\trequest.Body = ioutil.NopCloser(bytes.NewReader([]byte(payload.RequestBody)))\n\t\t}\n\n\tdefault:\n\t\t// unsupported method -- do nothing\n\t\treturn\n\t}\n\n\thttpClient := getClient(clusterName, namespace, client)\n\tresp, err := httpClient.Do(request)\n\n\tif resp != nil {\n\t\tpayload.StatusCode = resp.StatusCode\n\t\tpayload.ResponseBody = getMapFromBody(resp.Body)\n\t}\n\tpayload.Error = err\n}", "title": "" }, { "docid": "c9dac73db6651ca2132c103f0e963142", "score": "0.48929927", "text": "func (is *instrumentedService) GetTicket(ctx context.Context, id string) (*pb.Ticket, error) {\n\ttelemetry.IncrementCounter(ctx, mStateStoreGetTicket)\n\treturn is.s.GetTicket(ctx, id)\n}", "title": "" }, { "docid": "3e14e0e3d6703aaab646ba5166fc540b", "score": "0.48709792", "text": "func (m mapping) relFromTicket(ticket kytheuri.URI) (string, error) {\n\tcv, err := m.corpus.Parse(ticket.Corpus)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpv, err := m.path.Parse(ticket.Path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trv, err := m.root.Parse(ticket.Root)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar vals = make(map[string]string)\n\tfor k, v := range cv {\n\t\tvals[k] = v\n\t}\n\tfor k, v := range pv {\n\t\tvals[k] = v\n\t}\n\tfor k, v := range rv {\n\t\tvals[k] = v\n\t}\n\n\treturn m.local.Generate(vals)\n}", "title": "" }, { "docid": "74366986588d2b8cd7e97cb1b296ee21", "score": "0.48682603", "text": "func (s *Service) URL() string {\n\treturn fmt.Sprintf(\"http://%s:%d\", s.Ip, s.Port)\n}", "title": "" }, { "docid": "422e382af41ddc66951061d67965a0ab", "score": "0.4850654", "text": "func getCheckoutURL(i genericInvoice, route string) (string, error) {\n\t// Request\n\tmarshaledJSON, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq, err := http.NewRequest(\n\t\t\"POST\",\n\t\tBaseURL+route,\n\t\tbytes.NewReader(marshaledJSON),\n\t)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.SetBasicAuth(i.authInfo())\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tres, err := HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Response\n\tbodyContents, err := ioutil.ReadAll(res.Body)\n\tdefer res.Body.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tparsedResponse := &struct {\n\t\tSuccess bool\n\t\tMessage string\n\t\tURL string\n\t}{}\n\tif err := json.Unmarshal(bodyContents, parsedResponse); err != nil {\n\t\treturn \"\", err\n\t} else if res.StatusCode != 200 || !parsedResponse.Success {\n\t\treturn \"\", errors.New(parsedResponse.Message)\n\t}\n\n\treturn parsedResponse.URL, nil\n}", "title": "" }, { "docid": "e58801fe4bd612ab63f46c03c618f395", "score": "0.4838895", "text": "func (ipfs *IPFSHTTPConnector) apiURL() string {\n\treturn fmt.Sprintf(\"http://%s:%d/api/v0\",\n\t\tipfs.destHost,\n\t\tipfs.destPort)\n}", "title": "" }, { "docid": "0795fa27ad421745ecec254aed22605b", "score": "0.48388898", "text": "func (zoneRateLimits *ZoneRateLimitsV1) GetServiceURL() string {\n\treturn zoneRateLimits.Service.GetServiceURL()\n}", "title": "" }, { "docid": "1bb7a0987c2f273a686da31e2abfc3e2", "score": "0.482334", "text": "func getTickerEndPoint(start, limit int, config MktcapConfig) string {\n\tendpoint := \"https://\" + config.MktCapEndpoint + \"/\" + config.MktAPIVer + \"/\" + config.MktAPITicker\n\n\tif start > 0 || limit > 0 {\n\t\tif start > 0 && limit > 0 {\n\t\t\tendpoint = endpoint + \"/?start=\" + strconv.Itoa(start) + \"&limit=\" + strconv.Itoa(limit)\n\t\t} else if start > 0 {\n\t\t\tendpoint = endpoint + \"/?start=\" + strconv.Itoa(start)\n\t\t} else {\n\t\t\tendpoint = endpoint + \"/?limit=\" + strconv.Itoa(limit)\n\t\t}\n\t}\n\treturn endpoint\n}", "title": "" }, { "docid": "fddebf8753b5e510ce7751550d075b99", "score": "0.4818235", "text": "func getPatternForRestEndpoint(pattern string) string {\n\tfirstIndex := strings.Index(pattern, \"/{\")\n\tif firstIndex == -1 {\n\t\treturn pattern\n\t}\n\n\treturn strings.TrimRight(pattern[:firstIndex], \"/\") + \"/\"\n}", "title": "" }, { "docid": "a09f340b1505961bbf5729746e85abbd", "score": "0.48158976", "text": "func passwordURL(client *golangsdk.ServiceClient, id string) string {\n\treturn client.ServiceURL(resourcePath, id, passwordPath)\n}", "title": "" }, { "docid": "c62e7877b38dd261038bd4f870253357", "score": "0.48112592", "text": "func EfaasApiUrl(baseUrl string) string {\n\tif baseUrl == \"\" {\n\t\tpanic(\"Got empty base URL\")\n\t}\n\n\treturn baseUrl + \"/api/v2\"\n}", "title": "" }, { "docid": "9cb1d248834eb361ede2cf27466dc294", "score": "0.48007897", "text": "func (r *Res) URL() string {\n\treturn fmt.Sprintf(\"http://localhost:%d/json\", r.port)\n}", "title": "" }, { "docid": "059a0d171935d6cb264898d38ae3ceef", "score": "0.47952664", "text": "func HclServiceEndpointServiceFabricResource(projectName string, serviceEndpointName string, authorizationType string) string {\n\tvar serviceEndpointResource string\n\tswitch authorizationType {\n\tcase \"Certificate\":\n\t\tserviceEndpointResource = fmt.Sprintf(`\nresource \"azuredevops_serviceendpoint_servicefabric\" \"serviceendpoint\" {\n project_id = azuredevops_project.project.id\n service_endpoint_name = \"%s\"\n cluster_endpoint = \"tcp://test\"\n certificate {\n server_certificate_lookup = \"Thumbprint\"\n server_certificate_thumbprint = \"test\"\n client_certificate = \"test\"\n client_certificate_password = \"test\"\n }\n}`, serviceEndpointName)\n\tcase \"UsernamePassword\":\n\t\tserviceEndpointResource = fmt.Sprintf(`\nresource \"azuredevops_serviceendpoint_servicefabric\" \"serviceendpoint\" {\n project_id = azuredevops_project.project.id\n service_endpoint_name = \"%s\"\n cluster_endpoint = \"tcp://test\"\n azure_active_directory {\n server_certificate_lookup = \"Thumbprint\"\n server_certificate_thumbprint = \"test\"\n username = \"test\"\n password = \"test\"\n }\n}`, serviceEndpointName)\n\tcase \"None\":\n\t\tserviceEndpointResource = fmt.Sprintf(`\nresource \"azuredevops_serviceendpoint_servicefabric\" \"serviceendpoint\" {\n project_id = azuredevops_project.project.id\n service_endpoint_name = \"%s\"\n cluster_endpoint = \"tcp://test\"\n none {\n unsecured = false\n cluster_spn = \"test\"\n }\n}`, serviceEndpointName)\n\t}\n\tprojectResource := HclProjectResource(projectName)\n\treturn fmt.Sprintf(\"%s\\n%s\", projectResource, serviceEndpointResource)\n}", "title": "" }, { "docid": "91e5a674ddb4e59321ca09bb0703ad66", "score": "0.47918734", "text": "func volRESTClient(volSvcIP string) (*rest.RESTClient, error) {\n\tbaseURL, err := url.Parse(\"http://\" + volSvcIP + \":9501\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := rest.NewRESTClient(baseURL, \"\", mAPIReqContentConfig(), 0, 0, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "91e5a674ddb4e59321ca09bb0703ad66", "score": "0.47918734", "text": "func volRESTClient(volSvcIP string) (*rest.RESTClient, error) {\n\tbaseURL, err := url.Parse(\"http://\" + volSvcIP + \":9501\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := rest.NewRESTClient(baseURL, \"\", mAPIReqContentConfig(), 0, 0, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "a8c8efee9af1e2b21691a42f337720f4", "score": "0.47812113", "text": "func (a *SupportProjectTicketApiService) SupportProjectTicketGetExecute(r ApiSupportProjectTicketGetRequest) (*Ticket, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *Ticket\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"SupportProjectTicketApiService.SupportProjectTicketGet\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/support/project/{projectId}/ticket/{ticketId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"projectId\"+\"}\", url.PathEscape(parameterToString(r.projectId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ticketId\"+\"}\", url.PathEscape(parameterToString(r.ticketId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v InlineResponseDefault\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\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": "8a6e5e93d5d3edef65e2f1e12376850a", "score": "0.47712085", "text": "func (cdToolchain *CdToolchainV2) GetServiceURL() string {\n\treturn cdToolchain.Service.GetServiceURL()\n}", "title": "" }, { "docid": "91a35d45efea32a0a4914ce8b3e7e47e", "score": "0.4770894", "text": "func (nalogruClient *Client) GetTicketById(id string) (*TicketDetails, error) {\n\tclient := createHttpClient()\n\n\turl := nalogruClient.BaseAddress + \"/v2/tickets/\" + id\n\trequest, err := http.NewRequest(http.MethodGet, url, nil)\n\taddHeaders(request, nalogruClient.device.Id.Hex())\n\taddAuth(request, nalogruClient.device.SessionId)\n\tres, err := sendRequest(request, client)\n\n\tif err != nil {\n\t\tlog.Printf(\"Can't GET %s\\n\", url)\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tall, err := readBody(res)\n\tif err != nil {\n\t\tlog.Printf(\"failed to read response body. status code %d\\n\", res.StatusCode)\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode == http.StatusUnauthorized {\n\t\treturn nil, AuthError\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\tlog.Printf(\"GET receipt error: %d\\n\", res.StatusCode)\n\t\terr = os.WriteFile(\"/var/lib/receipts/error/\"+id+\".json\", all, 0644)\n\t\treturn nil, err\n\t}\n\n\tdetails := &TicketDetails{}\n\n\terr = os.WriteFile(\"/var/lib/receipts/raw/\"+id+\".json\", all, 0644)\n\n\terr = json.Unmarshal(all, details)\n\tif err != nil {\n\t\tlog.Println(\"Can't decode response body\")\n\n\t\treturn nil, err\n\t}\n\n\treturn details, nil\n}", "title": "" }, { "docid": "a7c1a1201a1a881ed86248cff4d7e94d", "score": "0.4754703", "text": "func rest(method, route, data string) ([]byte, error) {\n\tbody := bytes.NewBuffer([]byte(data))\n\n\treq, _ := http.NewRequest(method, fmt.Sprintf(\"%s%s\", config.ApiAddress, route), body)\n\treq.Header.Add(\"X-AUTH-TOKEN\", \"\")\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to %v %v - %v\", method, route, err)\n\t}\n\tdefer res.Body.Close()\n\n\tb, _ := ioutil.ReadAll(res.Body)\n\n\treturn b, nil\n}", "title": "" }, { "docid": "69ecc0dcb855e255d68159963b0a1828", "score": "0.47454423", "text": "func NewTicketService(ticketRepo Repository) Service {\n\treturn &ticketService{\n\t\tticketRepo,\n\t}\n}", "title": "" }, { "docid": "5c15c3947d3672714fb4b0014e0b099f", "score": "0.47433043", "text": "func (api *Tickets) Get(id int64) (interface{}, error) {\n\tresponse, err := api.rest.Get(fmt.Sprintf(\"crm-objects/v1/objects/tickets/%d\", id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn api.toEntity(response), nil\n}", "title": "" }, { "docid": "6795b4c0a4634ae935beef82c44c412c", "score": "0.47390684", "text": "func (c *AuthConfiguration) GetAuthServiceURL() string {\n\treturn c.URI\n}", "title": "" }, { "docid": "cf5e444eb97959c2ef977726ee5171cd", "score": "0.47383127", "text": "func (h *Handler) Ticketcreate(w http.ResponseWriter, r *http.Request) {\n\n\t//ReadAll reads from response until an error or EOF and returns the data it read.\n\tbodyVal, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\tlogger.Error(\"Error Occured with Reading Body\")\n\t\tlogger.Error(err.Error())\n\t}\n\n\tbodyValStrg := string(bodyVal)\n\n\t//Function call to create ticket and get the response\n\tcreatorOfTickets(bodyValStrg, w, r)\n\n\t/*var jsonReturn = []byte(jsonReturnString)\n\t //Decode JSON response\n\t jsonRetVal, _ := json.Marshal(jsonReturn)\n\t var byteArr []byte\n\t //Display the response\n\t base64.StdEncoding.Decode(byteArr, jsonRetVal)\n\t fmt.Fprintf(w, string(byteArr))\n\t //json.NewEncoder(w).Encode(Tick)*/\n}", "title": "" }, { "docid": "b656d6884274613e29c3f1db18aac3d3", "score": "0.4729437", "text": "func ViewUSerDetailsByTicketIDHandler(w http.ResponseWriter, r *http.Request) {\n\tts := service.TicketService{}\n\ttId := r.FormValue(\"ticket_id\")\n\n\tgr := ts.ViewUSerDetailsByTicketID(tId)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(gr.StatusCode)\n\tb, err := json.Marshal(gr.Data)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(constants.MARSHAL_ERROR))\n\t\treturn\n\t}\n\tw.Write(b)\n}", "title": "" }, { "docid": "b07291bbbbe435df932c3b841cef9a20", "score": "0.47255635", "text": "func (s ServiceURL) URL() url.URL {\n\treturn s.client.URL()\n}", "title": "" }, { "docid": "6d01011b4f350d1e62a17b5d1996d419", "score": "0.47246084", "text": "func HclServiceEndpointGenericResource(projectName string, serviceEndpointName string, serverUrl string, username string, password string) string {\n\tserviceEndpointResource := fmt.Sprintf(`\nresource \"azuredevops_serviceendpoint_generic\" \"test\" {\n\tproject_id = azuredevops_project.project.id\n\tservice_endpoint_name = \"%s\"\n\tdescription = \"test\"\n\tserver_url = \"%s\"\n\tusername = \"%s\"\n\tpassword = \"%s\"\n}`, serviceEndpointName, serverUrl, username, password)\n\n\tprojectResource := HclProjectResource(projectName)\n\treturn fmt.Sprintf(\"%s\\n%s\", projectResource, serviceEndpointResource)\n}", "title": "" }, { "docid": "baba35c387436628eb1c726fbcfec019", "score": "0.4721973", "text": "func RequestTicketMessage(roomID string, identifier string) string {\n\tticket_link_url := fmt.Sprintf(\"%v/patbot/ticket_link?r=%v&roomID=%v\", redphoneUrl, identifier, roomID)\n\n\tresp, err := http.Get(ticket_link_url)\n\tif err != nil {\n\t\tm := fmt.Sprintf(\"Redphone Ticket %s: %s\", identifier, redphoneEndpoint+identifier)\n\t\treturn fmt.Sprintf(\"%v — Couldn't reach Redphone with error: %v\", m, err)\n\t}\n\tdefer resp.Body.Close()\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7638edb9a95f442fc66f8814a6e1037d", "score": "0.4717661", "text": "func (rv *redisValues) generateSendBackURL(jwt string, port string) (string, error) {\n\tstringToken, err := rv.generateToken(jwt)\n\tif err != nil {\n\t\tlog.Printf(\"Error when setting token in database\")\n\t\treturn \"\", err\n\t}\n\tsendBackURL := \"http://localhost:\" + port + \"/exchange/client?token=\" + stringToken\n\treturn sendBackURL, nil\n}", "title": "" }, { "docid": "9878053a01fc5243577733d683b2f3ee", "score": "0.47110885", "text": "func (h *TestHelper) GetRGWServiceURL() (string, error) {\n\tswitch h.platform {\n\tcase enums.Kubernetes:\n\t\thostip, err := h.GetPodHostID(\"rook-ceph-rgw\", h.namespace)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"RGW pods not found/object store possibly not started\"))\n\t\t}\n\t\tendpoint := hostip + \":30001\"\n\t\treturn endpoint, err\n\tcase enums.StandAlone:\n\t\treturn \"NEED TO IMPLEMENT\", fmt.Errorf(\"NOT YET IMPLEMENTED\")\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Unsupported Rook Platform Type\")\n\n\t}\n}", "title": "" }, { "docid": "edf011aa50588fc8025eb73e9eb22349", "score": "0.47008273", "text": "func (service *ContrailService) RESTGetServiceHealthCheck(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &models.GetServiceHealthCheckRequest{\n\t\tID: id,\n\t}\n\tctx := c.Request().Context()\n\tresponse, err := service.GetServiceHealthCheck(ctx, request)\n\tif err != nil {\n\t\treturn common.ToHTTPError(err)\n\t}\n\treturn c.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "f4f05ad21d879067ae0023bc1b99c8bb", "score": "0.46952906", "text": "func (t *ticket) encodeTicket() string {\n\treturn fmt.Sprintf(\"%s.%s\", t.id, base64.RawURLEncoding.EncodeToString(t.secret))\n}", "title": "" }, { "docid": "bc92f3b95633ff7f99f183713722b366", "score": "0.46842825", "text": "func HclServiceEndpointAzureCRResource(projectName string, serviceEndpointName string) string {\n\tserviceEndpointResource := fmt.Sprintf(`\nresource \"azuredevops_serviceendpoint_azurecr\" \"serviceendpoint\" {\n\tproject_id = azuredevops_project.project.id\n\tservice_endpoint_name = \"%s\"\n\tazurecr_spn_tenantid = \"9c59cbe5-2ca1-4516-b303-8968a070edd2\"\n\tazurecr_subscription_id = \"3b0fee91-c36d-4d70-b1e9-fc4b9d608c3d\"\n\tazurecr_subscription_name = \"Microsoft Azure DEMO\"\n\tresource_group = \"testrg\"\n\tazurecr_name = \"testacr\"\n}`, serviceEndpointName)\n\n\tprojectResource := HclProjectResource(projectName)\n\treturn fmt.Sprintf(\"%s\\n%s\", projectResource, serviceEndpointResource)\n}", "title": "" }, { "docid": "d19f67d3eeae37da2e10717ff11752cf", "score": "0.46777844", "text": "func Ticket(cfg config.View) *pb.Ticket {\n\tcharacters := cfg.GetStringSlice(\"testConfig.characters\")\n\tregions := cfg.GetStringSlice(\"testConfig.regions\")\n\tmin := cfg.GetFloat64(\"testConfig.minRating\")\n\tmax := cfg.GetFloat64(\"testConfig.maxRating\")\n\tlatencyMap := latency(regions)\n\tticket := &pb.Ticket{\n\t\tSearchFields: &pb.SearchFields{\n\t\t\tDoubleArgs: map[string]float64{\n\t\t\t\te2e.DoubleArgMMR: normalDist(40, min, max, 20),\n\t\t\t},\n\t\t\tStringArgs: map[string]string{\n\t\t\t\te2e.Role: characters[rand.Intn(len(characters))],\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, r := range regions {\n\t\tticket.SearchFields.DoubleArgs[r] = latencyMap[r]\n\t}\n\n\treturn ticket\n}", "title": "" }, { "docid": "8b14472fed478e0f8c258029ac1d102f", "score": "0.46741676", "text": "func getAuthURL() string {\n\treturn defaultProto + \"://\" + DefaultHost + DefaultBasePath + \"tokens?owner_type=\" + DefaultOwnerType\n}", "title": "" }, { "docid": "0e88eb2edd33dd7224f38295b1dfb39e", "score": "0.46702906", "text": "func (irc *IdaxRestConn) Ticker(reqParam TickerReq) (TickerResp, Error) {\n\trespByte, err := irc.IdaxHttp(\"GET\", irc.Url+REST_TICKER, reqParam)\n\tvar tickerResp TickerResp\n\tjson.Unmarshal(respByte, &tickerResp)\n\treturn tickerResp, err\n}", "title": "" }, { "docid": "9c22e2e816dda4037291fff06cf6fb48", "score": "0.4665606", "text": "func (o BackendServiceDefinitionResponseOutput) ServiceUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BackendServiceDefinitionResponse) *string { return v.ServiceUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "bb755838dc4f927f9a5f543264d25138", "score": "0.46654105", "text": "func getServiceURL(data keptnv2.TestTriggeredEventData) (*url.URL, error) {\n\tif len(data.Deployment.DeploymentURIsLocal) > 0 && data.Deployment.DeploymentURIsLocal[0] != \"\" {\n\t\tnewurl, err := url.Parse(data.Deployment.DeploymentURIsLocal[0])\n\t\tif newurl.Path == \"\" {\n\t\t\tnewurl.Path += \"/\"\n\t\t}\n\t\treturn newurl, err\n\n\t} else if len(data.Deployment.DeploymentURIsPublic) > 0 && data.Deployment.DeploymentURIsPublic[0] != \"\" {\n\t\tnewurl, err := url.Parse(data.Deployment.DeploymentURIsPublic[0])\n\t\tif newurl.Path == \"\" {\n\t\t\tnewurl.Path += \"/\"\n\t\t}\n\t\treturn newurl, err\n\t}\n\n\treturn nil, errors.New(\"no deployment URI included in event\")\n}", "title": "" }, { "docid": "31bdb562be7822c04af5d39c47ae3b94", "score": "0.46612164", "text": "func getLicenseManagerURL(cr splcommon.MetaObject, spec *enterpriseApi.CommonSplunkSpec) []corev1.EnvVar {\n\tif spec.LicenseManagerRef.Name != \"\" {\n\t\tlicenseManagerURL := GetSplunkServiceName(SplunkLicenseManager, spec.LicenseManagerRef.Name, false)\n\t\tif spec.LicenseManagerRef.Namespace != \"\" {\n\t\t\tlicenseManagerURL = splcommon.GetServiceFQDN(spec.LicenseManagerRef.Namespace, licenseManagerURL)\n\t\t}\n\t\treturn []corev1.EnvVar{\n\t\t\t{\n\t\t\t\tName: splcommon.LicenseManagerURL,\n\t\t\t\tValue: licenseManagerURL,\n\t\t\t},\n\t\t}\n\t}\n\treturn []corev1.EnvVar{\n\t\t{\n\t\t\tName: splcommon.LicenseManagerURL,\n\t\t\tValue: GetSplunkServiceName(SplunkLicenseManager, cr.GetName(), false),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "cc9983437effee3704b8f8303cd1d0a3", "score": "0.46513963", "text": "func (h *Host) ServiceURL(id string) (*url.URL, error) {\n\tsvc, ver, err := parseServiceID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// No services supported for an empty Host.\n\tif h == nil || h.services == nil {\n\t\treturn nil, &ErrServiceNotProvided{service: svc}\n\t}\n\n\turlStr, ok := h.services[id].(string)\n\tif !ok {\n\t\t// See if we have a matching service as that would indicate\n\t\t// the service is supported, but not the requested version.\n\t\tfor serviceID := range h.services {\n\t\t\tif strings.HasPrefix(serviceID, svc+\".\") {\n\t\t\t\treturn nil, &ErrVersionNotSupported{\n\t\t\t\t\thostname: h.hostname,\n\t\t\t\t\tservice: svc,\n\t\t\t\t\tversion: ver.Original(),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// No discovered services match the requested service.\n\t\treturn nil, &ErrServiceNotProvided{hostname: h.hostname, service: svc}\n\t}\n\n\tu, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse service URL: %v\", err)\n\t}\n\n\t// Make relative URLs absolute using our discovery URL.\n\tif !u.IsAbs() {\n\t\tu = h.discoURL.ResolveReference(u)\n\t}\n\n\tif u.Scheme != \"https\" && u.Scheme != \"http\" {\n\t\treturn nil, fmt.Errorf(\"Service URL is using an unsupported scheme: %s\", u.Scheme)\n\t}\n\tif u.User != nil {\n\t\treturn nil, fmt.Errorf(\"Embedded username/password information is not permitted\")\n\t}\n\n\t// Fragment part is irrelevant, since we're not a browser.\n\tu.Fragment = \"\"\n\n\treturn h.discoURL.ResolveReference(u), nil\n}", "title": "" }, { "docid": "7099c14b1a4a248a0cc773aac015ad7c", "score": "0.46443072", "text": "func (s Service) GetURL() string {\n\treturn s.BaseURL\n}", "title": "" }, { "docid": "06a9fc68d903858d8fce7f02a536b775", "score": "0.46383584", "text": "func (s *Service) postTicket(w http.ResponseWriter, r *http.Request) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\ts.handleAPIError(\"Failed to read request body\", err, w)\n\t\treturn\n\t}\n\n\tresponse, err := s.prepareTicket(body)\n\tif err != nil {\n\t\ts.handleAPIError(\"Failed to create order\", err, w)\n\t\treturn\n\t}\n\n\tw.Write(response)\n}", "title": "" }, { "docid": "38c5e5e3fc5a7ba276a55d32aa907ffc", "score": "0.46346003", "text": "func (s *backendImplementation) oAuthURL() string { return s.authURL }", "title": "" }, { "docid": "4e59077ff7717cdee018060dec6c4fff", "score": "0.46316183", "text": "func APIIssueLinkToService(m APIIssueLink) *annotations.IssueLink {\n\tout := &annotations.IssueLink{}\n\tout.URL = StringPtrString(m.URL)\n\tout.IssueKey = StringPtrString(m.IssueKey)\n\tout.Source = APISourceToService(m.Source)\n\treturn out\n}", "title": "" }, { "docid": "4635ee14bcfe8649996adbd1ed7e21d4", "score": "0.46307886", "text": "func getRouteSpec(routeParams RouteSpecParams) *routev1.RouteSpec {\n\troutePath := \"/\"\n\tif routeParams.Path != \"\" {\n\t\troutePath = routeParams.Path\n\t}\n\trouteSpec := &routev1.RouteSpec{\n\t\tTo: routev1.RouteTargetReference{\n\t\t\tKind: \"Service\",\n\t\t\tName: routeParams.ServiceName,\n\t\t},\n\t\tPort: &routev1.RoutePort{\n\t\t\tTargetPort: routeParams.PortNumber,\n\t\t},\n\t\tPath: routePath,\n\t}\n\n\tif routeParams.Secure {\n\t\trouteSpec.TLS = &routev1.TLSConfig{\n\t\t\tTermination: routev1.TLSTerminationEdge,\n\t\t\tInsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,\n\t\t}\n\t}\n\n\treturn routeSpec\n}", "title": "" }, { "docid": "2e6ea48dad3e6c3c9a78218a8ebcfd8f", "score": "0.4628153", "text": "func GetAuthTicket(username string, password string) (string, error) {\n\tjar, err := cookiejar.New(nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tauthTicketClient := &http.Client{Jar: jar}\n\tcsrfRequest, err := http.NewRequest(\"POST\", \"https://auth.roblox.com\", nil)\n\n\tresp, err := authTicketClient.Do(csrfRequest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresp.Body.Close()\n\n\tvar csrfToken string\n\tif resp.StatusCode == 403 {\n\t\tcsrfToken = resp.Header.Get(\"X-CSRF-Token\")\n\t\tif csrfToken == \"\" {\n\t\t\treturn \"\", errors.New(\"empty CSRF token while trying to authenticate\")\n\t\t}\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"wrong status code \\\"%d %s\\\" when trying to authenticate\", resp.StatusCode, resp.Status)\n\t}\n\n\tauthCredentials, err := json.Marshal(map[string]string{\n\t\t\"ctype\": \"Username\",\n\t\t\"cvalue\": username,\n\t\t\"password\": password,\n\t})\n\tif err != nil {\n\t\treturn \"\", errors.New(\"failed to construct JSON credentials\")\n\t}\n\n\tloginRequest, err := http.NewRequest(\"POST\", \"https://auth.roblox.com/v2/login\", bytes.NewReader(authCredentials))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tloginRequest.Header.Set(\"X-CSRF-Token\", csrfToken)\n\tloginRequest.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err = authTicketClient.Do(loginRequest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp.StatusCode != 200 {\n\t\tjsonResp, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tresp.Body.Close()\n\t\tprintln(\"failed to auth: \", string(jsonResp))\n\t\treturn \"\", errors.New(\"failed to authenticate\")\n\t}\n\n\tticketRequest, err := http.NewRequest(\"GET\", \"https://www.roblox.com/game-auth/getauthticket\", nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tticketRequest.Header.Set(\"RBX-For-Gameauth\", \"true\")\n\tticketRequest.Header.Set(\"Referer\", \"https://www.roblox.com/home\")\n\n\tresp, err = authTicketClient.Do(ticketRequest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tticketResp, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\tprintln(\"failed to get authticket: \", resp.Status, string(ticketResp))\n\t\treturn \"\", errors.New(\"failed to authenticate\")\n\t}\n\n\treturn string(ticketResp), nil\n}", "title": "" }, { "docid": "18af825d37d4bd6221c1694d001af039", "score": "0.4624386", "text": "func (r *RESTClient) Get(uri string) (string, error) {\n return r.callAPI(http.MethodGet, uri, \"\")\n}", "title": "" }, { "docid": "03b572edfe55703339b9e2b5a316b2b6", "score": "0.46219268", "text": "func goLookup(host string, port string, tk string) {\n\turl := fmt.Sprintf(\"http://%s:%s/restricted/tasks\", host, port)\n\n\tid := uuid{viper.GetString(\"uuid\")}\n\tjsonStr, _ := json.Marshal(id)\n\n\tauth := fmt.Sprintf(\"Bearer %s\", tk)\n\n\treq, _ := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonStr))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", auth)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tfmt.Println(string(body))\n}", "title": "" }, { "docid": "f77937a940fa0b107c21d16ca4682edd", "score": "0.46171093", "text": "func buildURL(req APIClient) string {\n\tvar apiURL bytes.Buffer\n\n\tapiURL.WriteString(url + \"/\")\n\tapiURL.WriteString(req.Key + \"/\")\n\tapiURL.WriteString(req.Lat + \",\")\n\tapiURL.WriteString(req.Long)\n\n\tif len(req.Units) > 0 {\n\t\tapiURL.WriteString(\"?units=\" + req.Units)\n\t} else {\n\t\tapiURL.WriteString(\"?units=auto\")\n\t}\n\n\tif len(req.Exclude) > 0 {\n\t\tapiURL.WriteString(\"&exclude=\" + strings.Join(req.Exclude, \",\"))\n\t}\n\n\tif len(req.Lang) > 0 {\n\t\tapiURL.WriteString(\"&lang=\" + req.Lang)\n\t}\n\n\treturn apiURL.String()\n}", "title": "" }, { "docid": "ec19b812e133330016c9f9adacf00701", "score": "0.46115792", "text": "func (c *Client) url(apiRouteName string, opt interface{}) (*url.URL, error) {\n route := apiRouter.Get(apiRouteName)\n if route == nil {\n return nil, fmt.Errorf(\"no API route named %q\", apiRouteName)\n }\n\n url, err := route.URL()\n if err != nil {\n return nil, err\n }\n\n // Make the route URL path relative to BaseURL by trimming the lead \"/\"\n url.Path = strings.TrimPrefix(url.Path, \"/\")\n\n if opt != nil {\n err = addOptions(url, opt)\n if err != nil {\n return nil, err\n }\n }\n\n return url, nil\n}", "title": "" }, { "docid": "00d63f899ab06f959f8d89b41a0ac45b", "score": "0.46093214", "text": "func ServiceInstanceURI(instance string, query *url.Values) string {\n\turi := \"/v2/service_instances/\" + instance\n\n\tif query != nil {\n\t\turi = uri + \"?\" + query.Encode()\n\t}\n\n\treturn uri\n}", "title": "" }, { "docid": "9a9c5b894ca919d88caa41876dd76365", "score": "0.46045017", "text": "func CreateAPIRestCreator(resConf config.RextResourceDef, srvConf config.RextServiceDef, dataSourceResponseDurationDesc *prometheus.Desc) (cf CacheableFactory, err error) {\n\tresOptions := resConf.GetOptions()\n\thttpMethod, err := resOptions.GetString(config.OptKeyRextResourceDefHTTPMethod)\n\tif err != nil {\n\t\tlog.WithError(err).Errorln(\"Can not find httpMethod\")\n\t\treturn cf, err\n\t}\n\tresURI := strings.TrimPrefix(resConf.GetResourcePATH(srvConf.GetBasePath()), srvConf.GetBasePath())\n\tauth := resConf.GetAuth(srvConf.GetAuthForBaseURL())\n\tvar tkHeaderKey, tkKeyFromEndpoint, tkKeyGenEndpoint string\n\tif auth != nil {\n\t\tauthOpts := auth.GetOptions()\n\t\ttkHeaderKey, err = authOpts.GetString(config.OptKeyRextAuthDefTokenHeaderKey)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorln(\"Can not find tokenHeaderKey\")\n\t\t\treturn cf, err\n\t\t}\n\t\ttkKeyFromEndpoint, err = authOpts.GetString(config.OptKeyRextAuthDefTokenKeyFromEndpoint)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorln(\"Can not find tokenKeyFromEndpoint\")\n\t\t\treturn cf, err\n\t\t}\n\t\ttkKeyGenEndpoint, err = authOpts.GetString(config.OptKeyRextAuthDefTokenGenEndpoint)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Errorln(\"Can not find tkKeyGenEndpoint\")\n\t\t\treturn cf, err\n\t\t}\n\t} else {\n\t\tlog.Warnln(\"you have an empty auth\")\n\t}\n\tsrvOpts := srvConf.GetOptions()\n\tjobName, err := srvOpts.GetString(config.OptKeyRextServiceDefJobName)\n\tif err != nil {\n\t\tlog.WithError(err).Errorln(\"Can not find jobName\")\n\t\treturn cf, err\n\t}\n\tinstanceName, err := srvOpts.GetString(config.OptKeyRextServiceDefInstanceName)\n\tif err != nil {\n\t\tlog.WithError(err).Errorln(\"Can not find instanceName\")\n\t\treturn cf, err\n\t}\n\tcf = APIRestCreator{\n\t\tbaseFactory: baseFactory{\n\t\t\tjobName: jobName,\n\t\t\tinstanceName: instanceName,\n\t\t\tdataSource: resURI,\n\t\t\tdataSourceResponseDurationDesc: dataSourceResponseDurationDesc,\n\t\t},\n\t\thttpMethod: httpMethod,\n\t\tdataPath: resConf.GetResourcePATH(srvConf.GetBasePath()),\n\t\ttokenPath: srvConf.GetBasePath() + tkKeyGenEndpoint,\n\t\ttokenHeaderKey: tkHeaderKey,\n\t\ttokenKeyFromEndpoint: tkKeyFromEndpoint,\n\t}\n\treturn cf, err\n}", "title": "" }, { "docid": "565141fae12e804b44254a358c07f3d9", "score": "0.45971537", "text": "func (s *Service) RequestURL(action string, params interface{}) (string, error) {\n\tif len(s.BaseUrl) == 0 {\n\t\treturn \"\", errors.New(\"baseUrl is not set\")\n\t}\n\n\tcommonRequest := ucloud.CommonRequest{\n\t\tAction: action,\n\t\tPublicKey: s.Config.Credentials.PublicKey,\n\t\tProjectId: s.Config.ProjectID,\n\t}\n\n\tvalues := url.Values{}\n\tutils.ConvertParamsToValues(commonRequest, &values)\n\tutils.ConvertParamsToValues(params, &values)\n\n\turl, err := utils.UrlWithSignature(&values, s.BaseUrl, s.Config.Credentials.PrivateKey)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"convert params error: %s\", err)\n\t}\n\n\treturn url, nil\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "21bb450f62f91ff9d487e45c910a0b62", "score": "0.0", "text": "func (s Bucket) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "4ef987fe3192563c6dca972fb1a50812", "score": "0.6263458", "text": "func (v *ParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", v.UserUUID)\n\ti++\n\n\treturn fmt.Sprintf(\"ParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "242e82a0a19dcbc9b6c9d9c9435dd219", "score": "0.58659637", "text": "func (p Param) String() string {\n\treturn p.name\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.5857128", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "01aa6964793db8db3a8d2bb1e94f5a82", "score": "0.5750877", "text": "func (p InvParam) String() string {\n\tswitch p {\n\tcase BytesSize:\n\t\treturn \"BytesSize\"\n\tcase KeysCount:\n\t\treturn \"KeysCount\"\n\t}\n\n\tpanic(\"Unknown InvParam: \" + strconv.Itoa(int(p)))\n}", "title": "" }, { "docid": "2719e5463c4a14b720950dc7b5311de5", "score": "0.57394546", "text": "func (c SandstormApi) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "a38e5940fa335dd8c89de4e6f6fe0c13", "score": "0.57180357", "text": "func (p *param) string() string {\n\tres := []byte(p.name + \" \")\n\n\tres = append(res, p.typ()...)\n\n\treturn string(res)\n}", "title": "" }, { "docid": "e988010bbe0a9e1db934209b8b5bcc6f", "score": "0.56788254", "text": "func (v *QueryParamsOptsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [4]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"QueryParamsOptsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "8a5a12466c6811f56a7bcda917f55a4a", "score": "0.5655431", "text": "func (s *Systemmember) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Systemmember(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", s.ID))\n\tbuilder.WriteString(\", Systemmember_Name=\")\n\tbuilder.WriteString(s.SystemmemberName)\n\tbuilder.WriteString(\", Password=\")\n\tbuilder.WriteString(s.Password)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.56473684", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.5629922", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "1050fda86d17f688f12ea9cf1ca474f4", "score": "0.5625698", "text": "func (s StringParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cfc98ba8f406e0de96c081f52e983752", "score": "0.56062156", "text": "func (a Args) String() string {\n\tdata, _ := json.Marshal(a)\n\treturn string(data)\n}", "title": "" }, { "docid": "3818edbf94c07e4b9093a385052a9d8e", "score": "0.5538469", "text": "func (s KeyUsagePropertyFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5521042", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "612662a0b4743ca8d4d9be2102cb5d6b", "score": "0.55157673", "text": "func (o SnapmirrorInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "34f1f867fecec19b72af28de6ea47689", "score": "0.5511995", "text": "func (*cmdParams) String() string { return \"\\\"key=value\\\"\" }", "title": "" }, { "docid": "a98344e2ba45867a1c7a2aba22eb9436", "score": "0.54968584", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, strings.Join(i.allArgs(), \" \"))\n}", "title": "" }, { "docid": "2537643a4d071d1910ad417707ce36dd", "score": "0.5485769", "text": "func (s DecimalParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7cf6afcaafed5a4baa194589343e9b35", "score": "0.54831284", "text": "func wktgoogleProtobufString(pname, gname, ftype string) *Field {\n\tg := strcase.ToCamel(strings.Replace(ftype, \".\", \"\", -1))\n\tp := \"StringValue\"\n\n\treturn &Field{\n\t\tName: gname,\n\t\tProtoName: pname,\n\t\tProtoToGoType: fmt.Sprintf(\"%sTo%s\", p, g),\n\t\tGoToProtoType: fmt.Sprintf(\"%sTo%s\", g, p),\n\t\tUsePackage: true,\n\t}\n}", "title": "" }, { "docid": "e08907aa8e2343abbd146a2fa2d11ddd", "score": "0.54701525", "text": "func (v *Bar_ArgNotStruct_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\ti++\n\n\treturn fmt.Sprintf(\"Bar_ArgNotStruct_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d4b2d1752651c430f389fb8fdb8d0625", "score": "0.5466986", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Bonded Coin Denom: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.BondDenom)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54616547", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54616547", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "76891d2ef105ca81babcca9ea7376bca", "score": "0.54569954", "text": "func (v ParamType) String() string {\n\tswitch v {\n\tcase ParamBody:\n\t\treturn \"body\"\n\tcase ParamParam:\n\t\treturn \"param\"\n\tcase ParamQuery:\n\t\treturn \"query\"\n\tcase ParamHeader:\n\t\treturn \"header\"\n\tcase ParamCookie:\n\t\treturn \"cookie\"\n\t}\n\treturn \"unknown\"\n}", "title": "" }, { "docid": "e70264b5141f287728d8cca08f161d9f", "score": "0.5445653", "text": "func (o NvmeInterfaceInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.54385954", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "a102628683574cfd3b9b626c5ef060f3", "score": "0.54280484", "text": "func (v *QueryParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [5]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Foo: %v\", v.Foo)\n\ti++\n\n\treturn fmt.Sprintf(\"QueryParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ea98e45b6b5627266bea3540df3580ff", "score": "0.5422338", "text": "func (api *API) String() string {\n\treturn fmt.Sprintf(\"API(ID=%v, URL=%v, APIVerb=%v)\", api.ID, api.URL, api.APIVerb)\n}", "title": "" }, { "docid": "4955b421d876a48729de174a3ae9599e", "score": "0.5420889", "text": "func (c Checkpoints) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "b94dc708cf884aaff1358adbf52dc726", "score": "0.540274", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version,\n\t\tprotocol.ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "f1b758e5865c8ab1a46d5df02c34efbf", "score": "0.5400963", "text": "func (af additionalField) String() string {\n\tkey := strings.TrimPrefix(af.key, \"_\")\n\treturn fmt.Sprintf(\"%s=%v\", color.MagentaString(key), af.value)\n}", "title": "" }, { "docid": "cf2556e7d19d4db94ba897ec78eb8ce8", "score": "0.540071", "text": "func (s BackendAPIAuthType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1562905de983ed2b0459de7a2f88a77", "score": "0.5398489", "text": "func (v value) String() string {\n\tif v.ptr {\n\t\treturn \"*\" + v.name\n\t} else {\n\t\treturn v.name\n\t}\n}", "title": "" }, { "docid": "286064e80913533aad7620158553a8ab", "score": "0.53949976", "text": "func (k *StructMapKey) String() string {\n var sb strings.Builder\n sb.WriteString(\"StructMapKey(\")\n sb.WriteString(\")\")\n return sb.String()\n}", "title": "" }, { "docid": "e727fa0658f75ea852d6b58e960ddaa3", "score": "0.53942287", "text": "func (o AggrCheckAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "d030f6c1af52051a810bef1a6952ce4b", "score": "0.5394042", "text": "func (v Value) String() string {\n\tif sp, ok := v.any.(stringptr); ok {\n\t\t// Inlining this code makes a huge difference.\n\t\tvar s string\n\t\thdr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\t\thdr.Data = uintptr(sp)\n\t\thdr.Len = int(v.num)\n\t\treturn s\n\t}\n\treturn string(v.append(nil))\n}", "title": "" }, { "docid": "7bf2142dd8fe6027f4df2f44dfc5a04d", "score": "0.5390635", "text": "func (params Params) String() string {\n\tbuf := bufferPool.Get().(*bytes.Buffer)\n\tbuf.Reset()\n\tdefer bufferPool.Put(buf)\n\tparams.toBuffer(buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "7176b5fbd92b92fb6d7692b988128610", "score": "0.5386099", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n UnbondingTime: %s\n MaxValidators: %d\n MaxKeyNodes: %d\n MaxEntries: %d\n MaxCandidateKeyNodeHeartbeatInterval: %d\n BondDenom: %s\n MinValidatorDelegation: %s\n MinKeyNodeDelegation: %s`,\n\t\tp.UnbondingTime, p.MaxValidators, p.MaxKeyNodes, p.MaxEntries, p.MaxCandidateKeyNodeHeartbeatInterval,\n\t\tp.BondDenom, p.MinValidatorDelegation.String(), p.MinKeyNodeDelegation.String())\n}", "title": "" }, { "docid": "3a3390315c93355349074eda135b0709", "score": "0.53837657", "text": "func (m Metadata) String() string {\n\treturn pointer.DumpPStruct(m, false)\n}", "title": "" }, { "docid": "34860eac8f0530c1a711a521f26b0e04", "score": "0.53833956", "text": "func String() string {\n\treturn fmt.Sprintf(\"release=%s, revision=%s, user=%s, build=%s, go=%s\",\n\t\trelease, revision, buildUser, buildDate, goVersion)\n}", "title": "" }, { "docid": "107d9ae25b5bb5f0efc1b21eb657e2e8", "score": "0.5381341", "text": "func (s ServiceNowParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "715791314bd9e0366f195553f4c67343", "score": "0.5380047", "text": "func (req *UpdateBCSCollectorReq) String() string {\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "7184871a6ec6ae71d103531a87c02eb9", "score": "0.5372502", "text": "func (m *Message) String() string {\n\tif len(m.additional) == 0 {\n\t\tbaseMessageFields, _ := json.Marshal(m)\n\t\treturn string(baseMessageFields)\n\t}\n\n\t// Maps do not marshal to JSON as top-level objects.\n\t// To work around we marshal the map of additional fields, modify the string\n\t// and append to the outbound JSON encoded struct.\n\tadditionalFields, _ := json.Marshal(m.additional)\n\tfilteredFields := strings.Replace(string(additionalFields[1:]), \"\\\\\\\"\", \"\\\"\", -1)\n\n\tbaseMessageFields, _ := json.Marshal(m)\n\ttrimBaseMessageFields := strings.TrimRight(string(baseMessageFields), \"}\")\n\n\treturn trimBaseMessageFields + \",\" + filteredFields\n}", "title": "" }, { "docid": "3622035dd78be1c999194c94b8e448bc", "score": "0.5372242", "text": "func (o VserverPeerGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2bf29bb7788b0325d56f79f403b0399c", "score": "0.5367785", "text": "func (s GroupConfigurationParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b97895ab172f3c3bfc19eea555032fed", "score": "0.5367699", "text": "func (s VirtualGateway) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c2079aa9a43306556dcdb122c5d7a36", "score": "0.5361656", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"PeggyID: %d\\n\", p.PeggyID))\n\tsb.WriteString(fmt.Sprintf(\"ContractHash: %d\\n\", p.ContractHash))\n\tsb.WriteString(fmt.Sprintf(\"StartThreshold: %d\\n\", p.StartThreshold))\n\tsb.WriteString(fmt.Sprintf(\"BridgeContractAddress: %s\\n\", p.BridgeContractAddress.String()))\n\tsb.WriteString(fmt.Sprintf(\"BridgeChainID: %d\\n\", p.BridgeChainID))\n\treturn sb.String()\n}", "title": "" }, { "docid": "10990a926874191a7cacdf35f216c5c1", "score": "0.53602195", "text": "func (req *CreateBCSCollectorReq) String() string {\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "331e80b9a14ec326002f0a9e02dba246", "score": "0.53598624", "text": "func String(val string) *wrapperspb.StringValue {\n\treturn &wrapperspb.StringValue{Value: val}\n}", "title": "" }, { "docid": "dc759288f4083b2145ced681b7b978a8", "score": "0.5359466", "text": "func (s VpcInformation) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1caa010fbba5043ac90bdc7f9b17519", "score": "0.5356746", "text": "func (a Achievements) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "da6270b609c9eb834149433d1f7b9d17", "score": "0.53535026", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unstaking Time: %s\n Max Validators: %d\n Stake Coin Denom: %s\n Minimum Stake: \t %d\n MaxEvidenceAge: %s\n SignedBlocksWindow: %d\n MinSignedPerWindow: %s\n DowntimeJailDuration: %s\n SlashFractionDoubleSign: %s\n SlashFractionDowntime: %s\n SessionBlockFrequency %d\n Proposer Allocation %d\n DAO allocation %d`,\n\t\tp.UnstakingTime,\n\t\tp.MaxValidators,\n\t\tp.StakeDenom,\n\t\tp.StakeMinimum,\n\t\tp.MaxEvidenceAge,\n\t\tp.SignedBlocksWindow,\n\t\tp.MinSignedPerWindow,\n\t\tp.DowntimeJailDuration,\n\t\tp.SlashFractionDoubleSign,\n\t\tp.SlashFractionDowntime,\n\t\tp.SessionBlockFrequency,\n\t\tp.ProposerAllocation,\n\t\tp.DAOAllocation)\n}", "title": "" }, { "docid": "eed1c17e8f90cb82d64a1d8a2a89cdec", "score": "0.53525734", "text": "func (s ModifyVpcTenancyInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f03e58b3a35627fc881a91f47d0bca1c", "score": "0.53446585", "text": "func (s NiftyModifyCustomerGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "ea3d57b049b0b3b2861e263d7782f5f0", "score": "0.5342979", "text": "func (s VpcInterfaceRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "39f554b5c6dc2b7458bea3e14cf30e00", "score": "0.53401905", "text": "func (m *Module) String(name, value string) {\n\tm.fields[name] = lua.LString(value)\n}", "title": "" }, { "docid": "83a48869e3bb5dba0451156bdd56f062", "score": "0.5326423", "text": "func (s ApiGatewayProxyInput_) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.5324345", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "538a7916723e535a9a8227f223b9f979", "score": "0.5318617", "text": "func (c *keyValuePair) String() string {\n\treturn fmt.Sprintf(\"%v.WithValue(%#v, %#v)\", c.Config, c.key, c.val)\n}", "title": "" }, { "docid": "d570756b9c8bcdd8e9fe12ce4ea571a1", "score": "0.5314839", "text": "func (v *TransStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Message: %v\", v.Message)\n\ti++\n\tif v.Driver != nil {\n\t\tfields[i] = fmt.Sprintf(\"Driver: %v\", v.Driver)\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Rider: %v\", v.Rider)\n\ti++\n\n\treturn fmt.Sprintf(\"TransStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "4de885385fadb3f25df3d3b83ac9c3ef", "score": "0.5313324", "text": "func (v Value) String() string {\n\treturn v.Format(OutFormatDebug)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.5308054", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.5308054", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1caeb3ab683d0800086cc734d6225522", "score": "0.5307159", "text": "func (c Checkpoint) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "e55432f2b6c24b3239fe5612ab8e466f", "score": "0.5305105", "text": "func (b *binding) String() string {\n\tindex := fmt.Sprintf(\"%d\", b.Input.Index)\n\tif len(b.Input.StructFieldIndex) > 0 {\n\t\tfor j, i := range b.Input.StructFieldIndex {\n\t\t\tif j == 0 {\n\t\t\t\tindex = fmt.Sprintf(\"%d\", i)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindex += fmt.Sprintf(\".%d\", i)\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"[%s:%s] maps to [%s]\", index, b.Input.Type.String(), b.Dependency)\n}", "title": "" }, { "docid": "d8ba17d9b5ba0dc43a826e97e50277cf", "score": "0.53004575", "text": "func String(vm *otto.Otto, v otto.Value) string {\n\tif !v.IsDefined() {\n\t\treturn \"\"\n\t}\n\ts, err := v.ToString()\n\tif err != nil {\n\t\tThrow(vm, err.Error())\n\t}\n\treturn s\n}", "title": "" }, { "docid": "d527782021b072234380cbef774ba31c", "score": "0.5299042", "text": "func (s NiftyModifyCustomerGatewayAttributeInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "d2dedaf54ce114bf49126de8b61dca4d", "score": "0.52974993", "text": "func (s VpcInterface) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e53d73a1f0b48ee97950cf87755a5aa4", "score": "0.5296849", "text": "func (p MemberPhase) String() string {\n\treturn string(p)\n}", "title": "" }, { "docid": "7636368760d495cf80bff6d187b32e57", "score": "0.5292924", "text": "func (s KeyUsageFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "66ebc87b4e75eda9bf0651c1bcfe4731", "score": "0.52911496", "text": "func (s UpdateCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cca945207fb00f0f36c707031770f15c", "score": "0.5285697", "text": "func (s FindMatchesParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bee1fb6bd8a93238c04f815d04cc864e", "score": "0.5278502", "text": "func (f *Field) String() string {\n\treturn `{\"name\":\"` + f.name + `\",\"type\":` + f.typ.String() + `}`\n}", "title": "" }, { "docid": "6c28c8aaca1d6e615b02ba1a0fe23fa4", "score": "0.52746004", "text": "func (ba SettingsAttributes) String(name string) string {\n\tif val, ok := ba[name]; ok {\n\t\treturn fmt.Sprintf(\"%v\", val)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e179ec49ab8771aae98e0470b0d33256", "score": "0.5273999", "text": "func formatGoName(name string) string {\n\tvar fieldName string\n\n\tswitch strings.ToLower(name) {\n\tcase \"ids\":\n\t\t// special case to avoid the struct field Ids, and prefer IDs instead\n\t\tfieldName = \"IDs\"\n\tcase \"id\":\n\t\tfieldName = \"ID\"\n\tcase \"accountid\":\n\t\tfieldName = \"AccountID\"\n\tcase \"accountids\":\n\t\tfieldName = \"AccountIDs\"\n\tcase \"userid\":\n\t\tfieldName = \"UserID\"\n\tcase \"userids\":\n\t\tfieldName = \"UserIDs\"\n\tcase \"ingestkeyids\":\n\t\tfieldName = \"IngestKeyIDs\"\n\tcase \"userkeyids\":\n\t\tfieldName = \"UserKeyIDs\"\n\tcase \"keyid\":\n\t\tfieldName = \"KeyID\"\n\tcase \"policyid\":\n\t\tfieldName = \"PolicyID\"\n\tdefault:\n\t\tfieldName = strings.Title(name)\n\t}\n\n\tr := strings.NewReplacer(\n\t\t\"Api\", \"API\",\n\t\t\"Guid\", \"GUID\",\n\t\t\"Nrql\", \"NRQL\",\n\t\t\"Nrdb\", \"NRDB\",\n\t\t\"Url\", \"URL\",\n\t\t\"ApplicationId\", \"ApplicationID\",\n\t)\n\n\tfieldName = r.Replace(fieldName)\n\n\treturn fieldName\n}", "title": "" }, { "docid": "27cdd9d7c54d5bf70d65a87059a69fe5", "score": "0.5266813", "text": "func (p Purpose) String() string {\n\tif value, ok := purposeMarshal[p]; ok {\n\t\treturn value\n\t}\n\n\treturn purposeMarshal[PurposeVerify]\n}", "title": "" }, { "docid": "5370a3268852f6091878ea71d78f9260", "score": "0.5259071", "text": "func (o LunUnmapRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "f22d9114d24746c8de07c97a5a480a3f", "score": "0.5256905", "text": "func (s MariaDbParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4aefa73b0e0f98b281401c5b6581942e", "score": "0.5240893", "text": "func (b Base) StringParam(c buffalo.Context, name, defalt string) string {\n\tret := c.Param(name)\n\tif ret == \"\" {\n\t\treturn defalt\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.5239553", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "616c59be49cafc3f5f9f567f71123063", "score": "0.5236998", "text": "func (v *NestedStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Msg: %v\", v.Msg)\n\ti++\n\tif v.Check != nil {\n\t\tfields[i] = fmt.Sprintf(\"Check: %v\", *(v.Check))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"NestedStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d909c84ef0ccaff3dbc2199ccb600478", "score": "0.5233981", "text": "func (p Params) String(key string) string {\n\treturn p[key]\n}", "title": "" }, { "docid": "ca29fbc1a575548f44bfd0599e9b91de", "score": "0.52338755", "text": "func (s AccessPoint) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "697c9457ce5c0cd78183efeecb4cd1eb", "score": "0.5228435", "text": "func (s ModifyVpcTenancyOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14bb225a5bc3c710e0542334cfbc5d8b", "score": "0.5225906", "text": "func (msg MsgUpdateAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "8d48c57c2e39f7e817635ff89b0933c7", "score": "0.52253354", "text": "func (pv *MockPV) String() string {\n\treturn fmt.Sprintf(\"MockPV{%v}\", pv.GetAddress())\n}", "title": "" }, { "docid": "9a4007cbf4e496cd77c54b16523b199e", "score": "0.5220542", "text": "func (s ProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ebe7b2bf06a5482814588f5b15ea7df6", "score": "0.5218362", "text": "func (o Object) String() string {\n\treturn fmt.Sprintf(\"OT:%d OV:%v\", o.Type, o.Value)\n}", "title": "" }, { "docid": "a54c1f91f782c89d4393de11ade228e9", "score": "0.5217511", "text": "func String(value reflect.Value) string {\n\treturn value.Interface().(string)\n}", "title": "" }, { "docid": "2f7820e821041f9829c4fdd36133b3ae", "score": "0.52150273", "text": "func (s SnowflakeParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3bbd5dae6f605d5554fa7ae6f1b15bc", "score": "0.52122027", "text": "func (v *Field) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Value: %v\", v.Value)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Field{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "a8e39a951781efea0d9e3d980ee428a8", "score": "0.5209547", "text": "func (mt *methodType) String() string {\n\treturn maps[mt.value]\n}", "title": "" }, { "docid": "ccd77ea2aa2fce77c72da34f4e7437f2", "score": "0.52093333", "text": "func (s UpdateCaseInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3455d0387ed4cba9531b898cf0eb6319", "score": "0.5206751", "text": "func (o *Campaignruleparameters) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "f1a40ab325a6e449130e924039aa53a2", "score": "0.5203607", "text": "func (c *CachedIndividuallyMappedMessage) String() string {\n\treturn stringify.Struct(\"CachedIndividuallyMappedMessage\",\n\t\tstringify.StructField(\"CachedObject\", c.Unwrap()),\n\t)\n}", "title": "" }, { "docid": "688c90c02e605d9d4d7bd3536d8860ce", "score": "0.52034944", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Auction Params:\n\tMax Auction Duration: %s\n\tBid Duration: %s\n\tIncrement Surplus: %s\n\tIncrement Debt: %s\n\tIncrement Collateral: %s`,\n\t\tp.MaxAuctionDuration, p.BidDuration, p.IncrementSurplus, p.IncrementDebt, p.IncrementCollateral)\n}", "title": "" }, { "docid": "9ef5e2dda42ffa38cd7f17febde080e3", "score": "0.520061", "text": "func (s ModifyCacheParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9fabcb7f46be5a3190d0f03070d02857", "score": "0.5200026", "text": "func (s TeradataParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b82daa42075d9552a51df39c0b827bc3", "score": "0.51997805", "text": "func (s ActionParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7b572d1dd548d4ba49cc430ebe9d6ad1", "score": "0.5186661", "text": "func String(name string, value string) FieldString {\n\treturn FieldString{Name: name, Value: value}\n}", "title": "" }, { "docid": "09f7ce18aea17bf1bcad8ac40763016b", "score": "0.51862735", "text": "func (v *Bar_ArgWithParams_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"UUID: %v\", v.UUID)\n\ti++\n\tif v.Params != nil {\n\t\tfields[i] = fmt.Sprintf(\"Params: %v\", v.Params)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Bar_ArgWithParams_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" } ]
500cc83b9af07e794b48c7da2bfc0fe3
Manufacture the ordered items.
[ { "docid": "40da605d1fde1715503c26004314e8b3", "score": "0.6569707", "text": "func (b *supplyBehavior) manufacture(emitter EventEmitter) {\n\tb.orderNo++\n\torder := &Order{b.orderNo, make(map[int]*OrderItem)}\n\tfor itemNo, quantity := range b.itemQuantities {\n\t\torder.OrderItems[itemNo] = &OrderItem{b.orderNo, itemNo, quantity}\n\t}\n\temitter.EmitSimple(\"order\", order)\n\tb.itemQuantities = make(map[int]int)\n}", "title": "" } ]
[ { "docid": "e5c9249e3364357df71d200e371ba4b3", "score": "0.6129067", "text": "func generateOrder(orderNo, items int) *Order {\n\torder := &Order{\n\t\tOrderNo: orderNo,\n\t\tOrderItems: make(map[int]*OrderItem),\n\t}\n\tfor i := 0; i < rand.Intn(20)+1; i++ {\n\t\torderItem := &OrderItem{\n\t\t\tOrderNo: orderNo,\n\t\t\tItemNo: rand.Intn(items),\n\t\t\tQuantity: rand.Intn(items/100) + 1,\n\t\t}\n\t\torder.OrderItems[orderItem.ItemNo] = orderItem\n\t}\n\treturn order\n}", "title": "" }, { "docid": "34a00b4e8ad8e5fb8397fc5777fbe7c0", "score": "0.5889894", "text": "func CreateOrderItem(response http.ResponseWriter, request *http.Request) {\n\tvar ctx, cancel = context.WithTimeout(context.Background(), 100*time.Second)\n\n\tvar orderItemPack OrderItemPack\n\tvar order models.Order\n\n\torder.Order_Date, _ = time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))\n\n\torderItemsToBeInserted := []interface{}{}\n\t//set response format to JSON\n\tresponse.Header().Add(\"Content-Type\", \"application/json\")\n\n\t// check for content type existence and check for json validity\n\thelpers.ContentTypeValidator(response, request)\n\n\t// call MaxRequestValidator to enforce a maximum read of 1MB .\n\tdec := helpers.MaxRequestValidator(response, request)\n\n\t// var orderItem models.OrderItem\n\terrOrderItemPack := dec.Decode(&orderItemPack)\n\t//validate body structure of the order item pack\n\tif !helpers.PostPatchRequestValidator(response, request, errOrderItemPack) {\n\t\treturn\n\t}\n\n\torder.Table_id = orderItemPack.Table_id\n\torder_id := OrderItemOrderCreator(order)\n\n\tfor _, orderItem := range orderItemPack.Order_items {\n\t\torderItem.Order_id = order_id\n\n\t\tif v.Struct(&orderItem) != nil {\n\t\t\tresponse.Write([]byte(fmt.Sprintf(v.Struct(&orderItem).Error())))\n\t\t\treturn\n\t\t}\n\t\torderItem.ID = primitive.NewObjectID()\n\t\torderItem.Created_at, _ = time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))\n\t\torderItem.Updated_at, _ = time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))\n\t\torderItem.Order_item_id = orderItem.ID.Hex()\n\t\tvar num = toFixed(*orderItem.Unit_price, 2)\n\t\torderItem.Unit_price = &num\n\n\t\torderItemsToBeInserted = append(orderItemsToBeInserted, orderItem)\n\t}\n\n\t//validate existence of request body\n\n\t//validate body structure\n\n\tinsertedOrderItems, err := orderItemCollection.InsertMany(ctx, orderItemsToBeInserted)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer cancel()\n\n\tjson.NewEncoder(response).Encode(insertedOrderItems.InsertedIDs)\n\n\tdefer cancel()\n\n}", "title": "" }, { "docid": "097dcdb8884ec1b32231d2cd1128e7b1", "score": "0.5819017", "text": "func (o *Order) Items() map[string]*Item {\n\treturn o.items\n}", "title": "" }, { "docid": "ae0627ac31a98bd0131a2ea792f45176", "score": "0.5665015", "text": "func (o *Order) OrderItems(mods ...qm.QueryMod) orderItemQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"order_items\\\".\\\"order_id\\\"=?\", o.ID),\n\t)\n\n\tquery := OrderItems(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"order_items\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"order_items\\\".*\"})\n\t}\n\n\treturn query\n}", "title": "" }, { "docid": "13ba9273f271d8f0637a65e5b578c671", "score": "0.5638512", "text": "func AddItemToOrder(encoder *json.Encoder, decoder *json.Decoder) {\n\torderMutex.Lock()\n\torderItemMutex.Lock()\n\tfoodMutex.RLock()\n\tvar req structs.AddItemToOrderRequest\n\tdecoder.Decode(&req)\n\n\trows, err := DB.Query(\"select id from orders where personID = ? and status = 'Cart';\", req.PersonID)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tencoder.Encode(\"failure\")\n\t\torderMutex.Unlock()\n\t\torderItemMutex.Unlock()\n\t\tfoodMutex.RUnlock()\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tvar orderID int\n\tfor rows.Next() {\n\t\terr := rows.Scan(&orderID)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tencoder.Encode(\"failure\")\n\t\t\torderMutex.Unlock()\n\t\t\torderItemMutex.Unlock()\n\t\t\tfoodMutex.RUnlock()\n\t\t\treturn\n\t\t}\n\t}\n\n\t_, err = DB.Query(\"insert into OrderItem (foodID, orderID, Customization, payWithSwipe) values(?,?,?,?);\", req.Item.FoodID, orderID, req.Item.Customization, req.Item.PayWithSwipe)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tencoder.Encode(\"failure\")\n\t\torderMutex.Unlock()\n\t\torderItemMutex.Unlock()\n\t\tfoodMutex.RUnlock()\n\t\treturn\n\t}\n\n\tif req.Item.PayWithSwipe {\n\t\t_, err := DB.Query(\"update Orders set swipeCost = swipeCost + 1 where id = ?;\", orderID)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tencoder.Encode(\"failure\")\n\t\t\torderMutex.Unlock()\n\t\t\torderItemMutex.Unlock()\n\t\t\tfoodMutex.RUnlock()\n\t\t\treturn\n\t\t}\n\t} else {\n\t\trows, err := DB.Query(\"select price from Foods where ID = ?;\", req.Item.FoodID)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tencoder.Encode(\"failure\")\n\t\t\torderMutex.Unlock()\n\t\t\torderItemMutex.Unlock()\n\t\t\tfoodMutex.RUnlock()\n\t\t\treturn\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tvar price int\n\t\tfor rows.Next() {\n\t\t\terr := rows.Scan(&price)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tencoder.Encode(\"failure\")\n\t\t\t\torderMutex.Unlock()\n\t\t\t\torderItemMutex.Unlock()\n\t\t\t\tfoodMutex.RUnlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t_, err = DB.Query(\"update Orders set centCost = centCost + ? where id = ?;\", price, orderID)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tencoder.Encode(\"failure\")\n\t\t\torderMutex.Unlock()\n\t\t\torderItemMutex.Unlock()\n\t\t\tfoodMutex.RUnlock()\n\t\t\treturn\n\t\t}\n\t}\n\tencoder.Encode(\"success\")\n\torderMutex.Unlock()\n\torderItemMutex.Unlock()\n\tfoodMutex.RUnlock()\n}", "title": "" }, { "docid": "4417241b7dedc36a43b3ad1758d970ca", "score": "0.5553883", "text": "func (ois *OrderItemsStatus) CreateOrderItems(orderID int64, orderItems []OrderItems, tx *sql.Tx) error {\n\n\tvar err error\n\n\tlocalCommit := false\n\tcheckOrder := false\n\n\tif tx == nil {\n\t\tctx := context.Background()\n\t\ttx, err = db.BeginTx(ctx, nil)\n\t\tif err != nil {\n\t\t\tlog.Println(\"(CreateOrderItem:CreateTransaction)\", err)\n\t\t\treturn err\n\t\t}\n\t\tdefer tx.Rollback()\n\t\tlocalCommit = true\n\t\tcheckOrder = true\n\t}\n\n\tif checkOrder {\n\t\torderExist := orderExists(orderID)\n\t\tif !orderExist {\n\t\t\terr := fmt.Errorf(\"order %d doesn't exist\", orderID)\n\t\t\tlog.Println(\"(CreateOrderItem:GetOrder)\", err)\n\t\t\ttx.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\n\tinsertQuery := app.SQLCache[\"orders_orderItems_insert.sql\"]\n\tfor _, item := range orderItems {\n\t\tstmt, err := tx.Prepare(insertQuery)\n\t\tif err != nil {\n\t\t\tlog.Println(\"(CreateOrderItem:Prepare)\", err)\n\t\t\ttx.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\terr = stmt.QueryRow(&orderID, &item.Product.ID, &item.Fruit.ID, &item.Quantity, &item.UnitPrice).Scan(&item.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"(CreateOrderItem:Exec)\", err)\n\t\t\ttx.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif localCommit {\n\t\terr = tx.Commit()\n\t\tif err != nil {\n\t\t\tlog.Println(\"(CreateOrderItem:Commit)\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7e616b59c60abb99f5797dec1bd781da", "score": "0.53473043", "text": "func (b *stockItemBehavior) deliver(emitter EventEmitter) {\n\t// Deliver to orders.\n\tfor len(b.orderItems) > 0 && b.quantity >= b.orderItems[0].Quantity {\n\t\temitter.EmitSimple(\"order-item\", b.orderItems[0])\n\t\tb.quantity -= b.orderItems[0].Quantity\n\t\tb.orderItems = b.orderItems[1:]\n\t}\n\t// If more items needed call supply.\n\tif len(b.orderItems) > 0 {\n\t\tquantity := 0\n\t\tfor _, orderItem := range b.orderItems {\n\t\t\tquantity += orderItem.Quantity\n\t\t}\n\t\tif quantity > 0 {\n\t\t\tb.env.EmitSimple(\"supply\", \"order-item\", &OrderItem{0, b.itemNo, quantity})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "47b6eafa859ad1cf9b3c7c58ef3f2605", "score": "0.53187245", "text": "func GetOrderItemsByOrder(response http.ResponseWriter, request *http.Request) {\n\n\tresponse.Header().Add(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(request)\n\n\tallOrderItems, err := ItemsByOrder(params[\"id\"])\n\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(err.Error()))\n\t}\n\n\tresponse.Header().Add(\"Content-Type\", \"application/json\")\n\tresponse.WriteHeader(http.StatusOK)\n\n\tjson.NewEncoder(response).Encode(allOrderItems)\n\n\t// response.Write(jsonBytes)\n}", "title": "" }, { "docid": "86db32689f19cccd39747f92bad53cc0", "score": "0.5285518", "text": "func (m *Memory) IncreaseOrderAfter(item *entity.Item) error {\n\titems, _ := m.GetItemsByParentID(item.ParentItemID)\n\tfor _, it := range items {\n\t\tif it.ID == item.ID {\n\t\t\tcontinue\n\t\t}\n\t\tif it.Order >= item.Order {\n\t\t\tit.Order++\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2a16ed5659950c82e2cdc86990f1417f", "score": "0.52299076", "text": "func add_orders(orders OrderType) {\n\t//fmt.Println(orders)\n\tfor i := 0; i < len(orders.Pedidos); i++ {\n\t\t//SE SEPARA LA FECHA POR DIA, MES Y ANIO\n\t\tfecha := strings.Split(orders.Pedidos[i].Fecha, \"-\")\n\t\tdia, err := strconv.Atoi(fecha[0])\n\t\tm, err := strconv.Atoi(fecha[1])\n\t\tmes := Structs.Get_month(m)\n\t\tanio, err := strconv.Atoi(fecha[2])\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error al ingresar fecha de pedido\")\n\t\t}\n\n\t\tcategoria := orders.Pedidos[i].Departamento\n\n\t\tmatriz := list.NewMatriz()\n\t\tsoloMes := &list.Month{mes, matriz}\n\t\tmesActual := list.NewListMes()\n\t\tmesActual.Insertar(soloMes)\n\t\tanioActual := list.Year{anio, mesActual}\n\n\t\tfor j := 0; j < len(orders.Pedidos[i].Productos); j++ {\n\t\t\tcola := list.NewQueue()\n\t\t\tcola.Add(&Structs.CodeProduct{orders.Pedidos[i].Productos[j].Codigo})\n\t\t\tmatriz.Insert(cola, dia, categoria)\n\t\t}\n\t\tPedidos.Add(&anioActual)\n\t}\n\n\t//Pedidos.Preorder(Pedidos.Raiz)\n}", "title": "" }, { "docid": "41774c6d4ea250094b88462a3cabbc04", "score": "0.5228181", "text": "func Cleanup() {\n\tfor _, item := range items {\n\t\titem.BuyOrders = []int64{}\n\t\titem.SellOrders = []int64{}\n\t}\n}", "title": "" }, { "docid": "b6446d12eb0bad37508349513ef9cbfa", "score": "0.52142626", "text": "func (ois *OrderItemsStatus) UpdateOrder(orderID int64, oi []OrderItems) error {\n\n\tvar err error\n\n\tctx := context.Background()\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\tlog.Println(\"(UpdateOrder:CreateTransaction)\", err)\n\t\treturn err\n\t}\n\tdefer tx.Rollback()\n\n\tif exists := orderExists(orderID) && orderHasStatus(orderID, OrderCreated); !exists {\n\t\terr := fmt.Errorf(\"order %d doesn't exist\", orderID)\n\t\tlog.Println(\"(UpdateOrder:GetOrder)\", err)\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\t// delete all items from an order\n\tquery := app.SQLCache[\"orders_orderItems_deleteAll.sql\"]\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\tlog.Println(\"(UpdateOrder:deleteAll:Prepare)\", err)\n\t\treturn err\n\t}\n\t_, err = stmt.Exec(&orderID)\n\tif err != nil {\n\t\tlog.Println(\"(UpdateOrder:deleteAll:exec)\", err)\n\t\treturn err\n\t}\n\n\t// insert the new provided items into the order\n\terr = ois.CreateOrderItems(orderID, oi, tx)\n\tif err != nil {\n\t\tlog.Println(\"(UpdateOrder:CreateOrderItems)\", err)\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\t// recalculate TotalPrice\n\tvar totalPrice = 0.00\n\tfor _, item := range oi {\n\t\ttotalPrice += (item.UnitPrice * float64(item.Quantity))\n\t}\n\n\tif err = updateOrderAudit(orderID, totalPrice, tx); err != nil {\n\t\ttx.Rollback()\n\t\tlog.Println(\"(UpdateOrder:UpdateOrderAudit)\", err)\n\t\treturn err\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Println(\"(UpdateOrder:Commit)\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c41c4aac596498eab3cef8e018d5a1c6", "score": "0.52090067", "text": "func (orderL) LoadOrderItems(ctx context.Context, e boil.ContextExecutor, singular bool, maybeOrder interface{}, mods queries.Applicator) error {\n\tvar slice []*Order\n\tvar object *Order\n\n\tif singular {\n\t\tobject = maybeOrder.(*Order)\n\t} else {\n\t\tslice = *maybeOrder.(*[]*Order)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &orderR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &orderR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif queries.Equal(a, obj.ID) {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\tquery := NewQuery(\n\t\tqm.From(`order_items`),\n\t\tqm.WhereIn(`order_items.order_id in ?`, args...),\n\t)\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load order_items\")\n\t}\n\n\tvar resultSlice []*OrderItem\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice order_items\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on order_items\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for order_items\")\n\t}\n\n\tif singular {\n\t\tobject.R.OrderItems = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &orderItemR{}\n\t\t\t}\n\t\t\tforeign.R.Order = object\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif queries.Equal(local.ID, foreign.OrderID) {\n\t\t\t\tlocal.R.OrderItems = append(local.R.OrderItems, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &orderItemR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Order = local\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c04687c07e3225584f38e015ea0ae634", "score": "0.51780134", "text": "func (cm *CoffeeMachineService) process(order []string) {\n for _, s := range order {\n cm.Orders <- s\n }\n\n cm.producerWg.Done()\n}", "title": "" }, { "docid": "dc86afbad6c13fbc186a7c7a86d0d846", "score": "0.51201975", "text": "func (g *orderedIDs) Clear() {\n\tg.order.Clear()\n\tg.items = map[string]ider{}\n}", "title": "" }, { "docid": "74e77a6e81de56d6f271d462ef9a5e6f", "score": "0.51163024", "text": "func (mq *ManufacturerQuery) Order(o ...OrderFunc) *ManufacturerQuery {\n\tmq.order = append(mq.order, o...)\n\treturn mq\n}", "title": "" }, { "docid": "74e77a6e81de56d6f271d462ef9a5e6f", "score": "0.51163024", "text": "func (mq *ManufacturerQuery) Order(o ...OrderFunc) *ManufacturerQuery {\n\tmq.order = append(mq.order, o...)\n\treturn mq\n}", "title": "" }, { "docid": "7a359daa5191f650c31f4e7884bf1af4", "score": "0.5102466", "text": "func (s Storage) GetOrderedItems(order core.Order) ([]core.Item, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "45af89a6f60099546a922c877c98431d", "score": "0.5086966", "text": "func (ec *executionContext) _order(sel []query.Selection, it *Order) jsonw.Writer {\n\tfields := ec.collectFields(sel, orderImplementors, map[string]bool{})\n\tout := jsonw.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\t\tout.Values[i] = jsonw.Null\n\n\t\tswitch field.Name {\n\t\tcase \"id\":\n\t\t\tres := it.ID\n\n\t\t\tout.Values[i] = jsonw.Int(res)\n\t\tcase \"date\":\n\t\t\tres := it.Date\n\n\t\t\tout.Values[i] = jsonw.Time(res)\n\t\tcase \"amount\":\n\t\t\tres := it.Amount\n\n\t\t\tout.Values[i] = jsonw.Float64(res)\n\t\tcase \"items\":\n\t\t\tec.wg.Add(1)\n\t\t\tgo func(i int, field collectedField) {\n\t\t\t\tdefer ec.wg.Done()\n\t\t\t\tres, err := ec.resolvers.Order_items(ec.ctx, it)\n\t\t\t\tif err != nil {\n\t\t\t\t\tec.Error(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tarr1 := jsonw.Array{}\n\t\t\t\tfor idx1 := range res {\n\t\t\t\t\tvar tmp1 jsonw.Writer\n\t\t\t\t\ttmp1 = ec._item(field.Selections, &res[idx1])\n\t\t\t\t\tarr1 = append(arr1, tmp1)\n\t\t\t\t}\n\t\t\t\tout.Values[i] = arr1\n\t\t\t}(i, field)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "f222a565197a99ac81933d28951c7268", "score": "0.5072998", "text": "func ExampleManagementClient_BeginCreateOrderItem() {\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 := armedgeorder.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewManagementClient().BeginCreateOrderItem(ctx, \"TestOrderItemName2\", \"YourResourceGroupName\", armedgeorder.OrderItemResource{\n\t\tLocation: to.Ptr(\"eastus\"),\n\t\tProperties: &armedgeorder.OrderItemProperties{\n\t\t\tAddressDetails: &armedgeorder.AddressDetails{\n\t\t\t\tForwardAddress: &armedgeorder.AddressProperties{\n\t\t\t\t\tContactDetails: &armedgeorder.ContactDetails{\n\t\t\t\t\t\tContactName: to.Ptr(\"XXXX XXXX\"),\n\t\t\t\t\t\tEmailList: []*string{\n\t\t\t\t\t\t\tto.Ptr(\"xxxx@xxxx.xxx\")},\n\t\t\t\t\t\tPhone: to.Ptr(\"0000000000\"),\n\t\t\t\t\t\tPhoneExtension: to.Ptr(\"\"),\n\t\t\t\t\t},\n\t\t\t\t\tShippingAddress: &armedgeorder.ShippingAddress{\n\t\t\t\t\t\tAddressType: to.Ptr(armedgeorder.AddressTypeNone),\n\t\t\t\t\t\tCity: to.Ptr(\"San Francisco\"),\n\t\t\t\t\t\tCompanyName: to.Ptr(\"Microsoft\"),\n\t\t\t\t\t\tCountry: to.Ptr(\"US\"),\n\t\t\t\t\t\tPostalCode: to.Ptr(\"94107\"),\n\t\t\t\t\t\tStateOrProvince: to.Ptr(\"CA\"),\n\t\t\t\t\t\tStreetAddress1: to.Ptr(\"16 TOWNSEND ST\"),\n\t\t\t\t\t\tStreetAddress2: to.Ptr(\"UNIT 1\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tOrderID: to.Ptr(\"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2\"),\n\t\t\tOrderItemDetails: &armedgeorder.OrderItemDetails{\n\t\t\t\tOrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase),\n\t\t\t\tPreferences: &armedgeorder.Preferences{\n\t\t\t\t\tTransportPreferences: &armedgeorder.TransportPreferences{\n\t\t\t\t\t\tPreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProductDetails: &armedgeorder.ProductDetails{\n\t\t\t\t\tHierarchyInformation: &armedgeorder.HierarchyInformation{\n\t\t\t\t\t\tConfigurationName: to.Ptr(\"edgep_base\"),\n\t\t\t\t\t\tProductFamilyName: to.Ptr(\"azurestackedge\"),\n\t\t\t\t\t\tProductLineName: to.Ptr(\"azurestackedge\"),\n\t\t\t\t\t\tProductName: to.Ptr(\"azurestackedgegpu\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.OrderItemResource = armedgeorder.OrderItemResource{\n\t// \tName: to.Ptr(\"TestOrderItemName2\"),\n\t// \tType: to.Ptr(\"Microsoft.EdgeOrder/orderItems\"),\n\t// \tID: to.Ptr(\"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName2\"),\n\t// \tLocation: to.Ptr(\"eastus\"),\n\t// \tTags: map[string]*string{\n\t// \t},\n\t// \tProperties: &armedgeorder.OrderItemProperties{\n\t// \t\tAddressDetails: &armedgeorder.AddressDetails{\n\t// \t\t\tForwardAddress: &armedgeorder.AddressProperties{\n\t// \t\t\t\tAddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid),\n\t// \t\t\t\tContactDetails: &armedgeorder.ContactDetails{\n\t// \t\t\t\t\tContactName: to.Ptr(\"XXXX XXXX\"),\n\t// \t\t\t\t\tEmailList: []*string{\n\t// \t\t\t\t\t\tto.Ptr(\"xxxx@xxxx.xxx\")},\n\t// \t\t\t\t\t\tPhone: to.Ptr(\"0000000000\"),\n\t// \t\t\t\t\t\tPhoneExtension: to.Ptr(\"\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tShippingAddress: &armedgeorder.ShippingAddress{\n\t// \t\t\t\t\t\tAddressType: to.Ptr(armedgeorder.AddressTypeNone),\n\t// \t\t\t\t\t\tCity: to.Ptr(\"San Francisco\"),\n\t// \t\t\t\t\t\tCompanyName: to.Ptr(\"Microsoft\"),\n\t// \t\t\t\t\t\tCountry: to.Ptr(\"US\"),\n\t// \t\t\t\t\t\tPostalCode: to.Ptr(\"94107\"),\n\t// \t\t\t\t\t\tStateOrProvince: to.Ptr(\"CA\"),\n\t// \t\t\t\t\t\tStreetAddress1: to.Ptr(\"16 TOWNSEND ST\"),\n\t// \t\t\t\t\t\tStreetAddress2: to.Ptr(\"UNIT 1\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t},\n\t// \t\t\t},\n\t// \t\t\tOrderID: to.Ptr(\"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName2\"),\n\t// \t\t\tOrderItemDetails: &armedgeorder.OrderItemDetails{\n\t// \t\t\t\tCancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumCancellable),\n\t// \t\t\t\tCurrentStage: &armedgeorder.StageDetails{\n\t// \t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNamePlaced),\n\t// \t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusInProgress),\n\t// \t\t\t\t\tStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-04T10:58:27.5824859+05:30\"); return t}()),\n\t// \t\t\t\t},\n\t// \t\t\t\tDeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed),\n\t// \t\t\t\tManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tResourceProviderNamespace: to.Ptr(\"Microsoft.DataBoxEdge\"),\n\t// \t\t\t\t}},\n\t// \t\t\t\tNotificationEmailList: []*string{\n\t// \t\t\t\t},\n\t// \t\t\t\tOrderItemStageHistory: []*armedgeorder.StageDetails{\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNamePlaced),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameConfirmed),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameReadyToShip),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameShipped),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameDelivered),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameInUse),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t}},\n\t// \t\t\t\tOrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase),\n\t// \t\t\t\tPreferences: &armedgeorder.Preferences{\n\t// \t\t\t\t\tTransportPreferences: &armedgeorder.TransportPreferences{\n\t// \t\t\t\t\t\tPreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesMicrosoftManaged),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t},\n\t// \t\t\t\tProductDetails: &armedgeorder.ProductDetails{\n\t// \t\t\t\t\tCount: to.Ptr[int32](0),\n\t// \t\t\t\t\tDisplayInfo: &armedgeorder.DisplayInfo{\n\t// \t\t\t\t\t\tConfigurationDisplayName: to.Ptr(\"Azure Stack Edge Pro - 1 GPU\"),\n\t// \t\t\t\t\t\tProductFamilyDisplayName: to.Ptr(\"Azure Stack Edge\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tHierarchyInformation: &armedgeorder.HierarchyInformation{\n\t// \t\t\t\t\t\tConfigurationName: to.Ptr(\"edgep_base\"),\n\t// \t\t\t\t\t\tProductFamilyName: to.Ptr(\"azurestackedge\"),\n\t// \t\t\t\t\t\tProductLineName: to.Ptr(\"azurestackedge\"),\n\t// \t\t\t\t\t\tProductName: to.Ptr(\"azurestackedgegpu\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled),\n\t// \t\t\t\t},\n\t// \t\t\t\tReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable),\n\t// \t\t\t},\n\t// \t\t\tStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-04T10:58:27.5824859+05:30\"); return t}()),\n\t// \t\t},\n\t// \t\tSystemData: &armedgeorder.SystemData{\n\t// \t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"0001-01-01T05:30:00+05:30\"); return t}()),\n\t// \t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"0001-01-01T05:30:00+05:30\"); return t}()),\n\t// \t\t},\n\t// \t}\n}", "title": "" }, { "docid": "8b2f3452f1cf50888a3b58db0c4f153e", "score": "0.50549096", "text": "func (o *Order) AddOrderItems(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OrderItem) error {\n\tvar err error\n\tfor _, rel := range related {\n\t\tif insert {\n\t\t\tqueries.Assign(&rel.OrderID, o.ID)\n\t\t\tif err = rel.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t\t}\n\t\t} else {\n\t\t\tupdateQuery := fmt.Sprintf(\n\t\t\t\t\"UPDATE \\\"order_items\\\" SET %s WHERE %s\",\n\t\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, []string{\"order_id\"}),\n\t\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, orderItemPrimaryKeyColumns),\n\t\t\t)\n\t\t\tvalues := []interface{}{o.ID, rel.ID}\n\n\t\t\tif boil.IsDebug(ctx) {\n\t\t\t\twriter := boil.DebugWriterFrom(ctx)\n\t\t\t\tfmt.Fprintln(writer, updateQuery)\n\t\t\t\tfmt.Fprintln(writer, values)\n\t\t\t}\n\t\t\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to update foreign table\")\n\t\t\t}\n\n\t\t\tqueries.Assign(&rel.OrderID, o.ID)\n\t\t}\n\t}\n\n\tif o.R == nil {\n\t\to.R = &orderR{\n\t\t\tOrderItems: related,\n\t\t}\n\t} else {\n\t\to.R.OrderItems = append(o.R.OrderItems, related...)\n\t}\n\n\tfor _, rel := range related {\n\t\tif rel.R == nil {\n\t\t\trel.R = &orderItemR{\n\t\t\t\tOrder: o,\n\t\t\t}\n\t\t} else {\n\t\t\trel.R.Order = o\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ffad801b184fa50eb2063db2ba8c7062", "score": "0.50302035", "text": "func (i *ItemManager) processItem(item Item) {\n\n}", "title": "" }, { "docid": "cbf09c7609b0a1d820fc83ad91e2a7ab", "score": "0.5023195", "text": "func (s *Service) buildOrder(orderEntry *model.Order) (Order, error) {\n\torder := Order{\n\t\tID: orderEntry.ID,\n\t\tUser: User{Name: orderEntry.User.Name},\n\t\tIsPaid: orderEntry.IsPaid,\n\t\tTotal: 0,\n\t}\n\n\tpositionEntities, err := s.positions.FindByOrder(orderEntry.ID)\n\n\tif err == sql.ErrNoRows && err != nil {\n\t\treturn Order{}, err\n\t}\n\n\tfor _, p := range positionEntities {\n\t\tdishEntity, err := s.dishes.Find(p.Dish.ID)\n\t\talternativeEntity, err := s.dishes.Find(p.Alternative.ID)\n\t\tconfigurations, err := s.loadConfigurations(p.ID)\n\n\t\tif err == sql.ErrNoRows {\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\treturn Order{}, err\n\t\t}\n\n\t\tposition := Position{\n\t\t\tID: p.ID,\n\t\t\tDish: Dish{\n\t\t\t\tID: dishEntity.ID,\n\t\t\t\tName: dishEntity.Name,\n\t\t\t\tPrice: dishEntity.Price,\n\t\t\t},\n\t\t\tAlternative: Dish{\n\t\t\t\tID: alternativeEntity.ID,\n\t\t\t\tName: alternativeEntity.Name,\n\t\t\t\tPrice: alternativeEntity.Price,\n\t\t\t},\n\t\t\tNote: p.Note,\n\t\t\tConfigurations: configurations,\n\t\t}\n\n\t\torder.Positions = append(order.Positions, position)\n\t\torder.Total += dishEntity.Price\n\t}\n\n\treturn order, nil\n}", "title": "" }, { "docid": "d83c8e6e24c4ba49444d52a03756e7ec", "score": "0.49740326", "text": "func (g *orderedIDs) Add(m ider, pos RelativePosition) error {\n\tif len(m.ID()) == 0 {\n\t\treturn fmt.Errorf(\"empty ID, ID must not be empty\")\n\t}\n\n\tif err := g.order.Add(m.ID(), pos); err != nil {\n\t\treturn err\n\t}\n\n\tg.items[m.ID()] = m\n\treturn nil\n}", "title": "" }, { "docid": "0a473e93bae0626b7de82acb057681f8", "score": "0.4968319", "text": "func (m *OrderMutation) AddOrderItemIDs(ids ...int) {\n\tif m.orderItems == nil {\n\t\tm.orderItems = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.orderItems[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "3545aece91c5802f053b2ad71852ca13", "score": "0.49637827", "text": "func (o *Order) Item(orderID string) (*OrderItem, error) {\n\tdata, err := json.Marshal(&Order{\n\t\tOrderID: orderID,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taction := \"sales.order.detail.get\"\n\tbody, err := mafengwo.NewDeals().Fetch(action, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := OrderItem{}\n\terr = json.Unmarshal(body, &result)\n\treturn &result, err\n}", "title": "" }, { "docid": "fd0f15c9eb000dc298d35121d11b1563", "score": "0.49500862", "text": "func addOrderItem(c *fiber.Ctx) error {\n\t// Process request body\n\trequest := struct {\n\t\tOrderID uint64 `json:\"orderid\"`\n\t\tProductID uint64 `json:\"product\"`\n\t\tAmount uint64 `json:\"amount\"`\n\t}{}\n\terr := c.BodyParser(&request)\n\tif err != nil {\n\t\treturn clientError(c, \"Wrong order/product ID or amount format\")\n\t}\n\n\t// Add order item\n\tvar order data.Order\n\tresult := db.Where(\"order_id = ?\", request.OrderID).First(&order)\n\tif result.Error == nil {\n\t\tvar product data.Product\n\t\tresult := db.Where(\"product_id = ?\", request.ProductID).First(&product)\n\t\tif result.Error == nil {\n\t\t\torderItem := data.OrderItem{\n\t\t\t\tProduct: product,\n\t\t\t\tProductID: product.ProductID,\n\t\t\t\tAmount: request.Amount,\n\t\t\t}\n\t\t\tdb.Model(&order).Association(\"Items\").Append(&orderItem)\n\t\t\treturn c.Status(fiber.StatusCreated).JSON(&fiber.Map{\n\t\t\t\t\"status\": fiber.StatusCreated,\n\t\t\t\t\"success\": true,\n\t\t\t\t\"orderItem\": orderItem,\n\t\t\t})\n\t\t}\n\t\treturn clientError(c, \"Product does not exist\")\n\t}\n\treturn clientError(c, \"Order does not exist\")\n}", "title": "" }, { "docid": "4efbfb22a244631bfd27b9a29f99ec87", "score": "0.4936301", "text": "func (m *OrderMutation) ResetOrderItems() {\n\tm.orderItems = nil\n\tm.removedorderItems = nil\n}", "title": "" }, { "docid": "02ceb7d967e5f6bc62ccced9df540850", "score": "0.49344173", "text": "func (s *serverState) OrderItem(\n\tctx context.Context,\n\trequest *pb.OrderItemRequest,\n) (*pb.OrderResponse, error) {\n\tvar response pb.OrderResponse\n\n\tlog.Printf(\"OrderItem: %v\", request.ItemID)\n\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tentry, ok := s.catalog[request.ItemID]\n\n\tif !ok || entry.available == 0 {\n\t\tlog.Printf(\"ItemID %s is not available\", request.ItemID)\n\t\treturn &response, nil\n\t}\n\n\tentry.available--\n\ts.catalog[request.ItemID] = entry\n\n\tlog.Printf(\"OrderItem: %v successful\", request.ItemID)\n\tresponse.Successful = true\n\n\treturn &response, nil\n}", "title": "" }, { "docid": "a9e880b9e3a97fb605589bedab26c8dd", "score": "0.4934333", "text": "func (m *OrderMutation) AddOrderItemIDs(ids ...string) {\n\tif m.order_items == nil {\n\t\tm.order_items = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.order_items[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "242757d839404cfa66bd44a8eda16801", "score": "0.49213213", "text": "func printOrderCollection(orderLines []orderStruct.OrderLine) {\n\twriter := new(tabwriter.Writer)\n\twriter.Init(os.Stdout, 10, 10, 2, ' ', tabwriter.Debug) //Debug flag for lines\n\n\tfmt.Fprintln(writer, \"Ordernummer\\tKlant\\tMedewerker\\tFiets\\tAccessoires\\tStartdatum\\tEindDatum\\tPrijs\")\n\n\tfor _, orderLine := range orderLines {\n\t\t// Explicitly retrieve all objects before using their getters because go is stupid and can't read pointers.\n\t\tcustomer := orderLine.Customer()\n\t\tcustomerName := customer.Name() + \" \" + customer.Surname()\n\n\t\temployee := orderLine.Employee()\n\t\temployeeName := employee.Name() + \" \" + employee.Surname()\n\n\t\tstartDate := orderLine.StartDate()\n\t\tdays := orderLine.Days()\n\t\tendDate := startDate.AddDate(0, 0, days)\n\n\t\taccessories := \"\"\n\t\tfor index, orderAccessory := range orderLine.OrderAccessoryCollection() {\n\t\t\taccessory := orderAccessory.Accessory()\n\t\t\taccessories += strconv.Itoa(orderAccessory.Amount()) + \"x \" + accessory.Name()\n\n\t\t\tif index != len(orderLine.OrderAccessoryCollection()) {\n\t\t\t\taccessories += \"; \"\n\t\t\t}\n\t\t}\n\n\t\tbicycle := orderLine.Bicycle()\n\n\t\toutput := fmt.Sprintf(\n\t\t\t\"%d\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%.2f\",\n\t\t\torderLine.OrderLineId(),\n\t\t\tcustomerName,\n\t\t\temployeeName,\n\t\t\tbicycle.BicycleType(),\n\t\t\taccessories,\n\t\t\tstartDate.Format(\"2006-01-02\"),\n\t\t\tendDate.Format(\"2006-01-02\"),\n\t\t\torderLine.TotalPrice())\n\n\t\tfmt.Fprintln(writer, output)\n\t}\n\n\twriter.Flush()\n}", "title": "" }, { "docid": "73764440680b94c8ae7ed0a94c33e01a", "score": "0.49137717", "text": "func insertItems(restaurantId int32, items []Item, updateRestaurants bool) []Item {\n\top := make([]Item, 0)\n\tfor _, item := range items {\n\t\topItem, err := InsertItem(\"Items\", restaurantId, item, updateRestaurants)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"REACH4\")\n\t\t\tprintError(err)\n\t\t\treturn op\n\t\t}\n\t\top = append(op, opItem)\n\t}\n\treturn op\n}", "title": "" }, { "docid": "30d5c6226aac452ed948202094c41c66", "score": "0.4891548", "text": "func ExampleManagementClient_BeginUpdateOrderItem() {\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 := armedgeorder.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewManagementClient().BeginUpdateOrderItem(ctx, \"TestOrderItemName3\", \"YourResourceGroupName\", armedgeorder.OrderItemUpdateParameter{\n\t\tProperties: &armedgeorder.OrderItemUpdateProperties{\n\t\t\tPreferences: &armedgeorder.Preferences{\n\t\t\t\tTransportPreferences: &armedgeorder.TransportPreferences{\n\t\t\t\t\tPreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesCustomerManaged),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, &armedgeorder.ManagementClientBeginUpdateOrderItemOptions{IfMatch: nil})\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.OrderItemResource = armedgeorder.OrderItemResource{\n\t// \tName: to.Ptr(\"TestOrderItemName3\"),\n\t// \tType: to.Ptr(\"Microsoft.EdgeOrder/orderItems\"),\n\t// \tID: to.Ptr(\"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/orderItems/TestOrderItemName3\"),\n\t// \tLocation: to.Ptr(\"eastus\"),\n\t// \tTags: map[string]*string{\n\t// \t},\n\t// \tProperties: &armedgeorder.OrderItemProperties{\n\t// \t\tAddressDetails: &armedgeorder.AddressDetails{\n\t// \t\t\tForwardAddress: &armedgeorder.AddressProperties{\n\t// \t\t\t\tAddressValidationStatus: to.Ptr(armedgeorder.AddressValidationStatusValid),\n\t// \t\t\t\tContactDetails: &armedgeorder.ContactDetails{\n\t// \t\t\t\t\tContactName: to.Ptr(\"XXXX XXXX\"),\n\t// \t\t\t\t\tEmailList: []*string{\n\t// \t\t\t\t\t\tto.Ptr(\"xxxx@xxxx.xxx\")},\n\t// \t\t\t\t\t\tPhone: to.Ptr(\"0000000000\"),\n\t// \t\t\t\t\t\tPhoneExtension: to.Ptr(\"\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tShippingAddress: &armedgeorder.ShippingAddress{\n\t// \t\t\t\t\t\tAddressType: to.Ptr(armedgeorder.AddressTypeNone),\n\t// \t\t\t\t\t\tCity: to.Ptr(\"San Francisco\"),\n\t// \t\t\t\t\t\tCompanyName: to.Ptr(\"Microsoft\"),\n\t// \t\t\t\t\t\tCountry: to.Ptr(\"US\"),\n\t// \t\t\t\t\t\tPostalCode: to.Ptr(\"94107\"),\n\t// \t\t\t\t\t\tStateOrProvince: to.Ptr(\"CA\"),\n\t// \t\t\t\t\t\tStreetAddress1: to.Ptr(\"16 TOWNSEND ST\"),\n\t// \t\t\t\t\t\tStreetAddress2: to.Ptr(\"UNIT 1\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t},\n\t// \t\t\t},\n\t// \t\t\tOrderID: to.Ptr(\"/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.EdgeOrder/locations/eastus/orders/TestOrderName3\"),\n\t// \t\t\tOrderItemDetails: &armedgeorder.OrderItemDetails{\n\t// \t\t\t\tCancellationStatus: to.Ptr(armedgeorder.OrderItemCancellationEnumCancellable),\n\t// \t\t\t\tCurrentStage: &armedgeorder.StageDetails{\n\t// \t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNamePlaced),\n\t// \t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusSucceeded),\n\t// \t\t\t\t\tStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-04T11:30:31.5838042+05:30\"); return t}()),\n\t// \t\t\t\t},\n\t// \t\t\t\tDeletionStatus: to.Ptr(armedgeorder.ActionStatusEnumNotAllowed),\n\t// \t\t\t\tManagementRpDetailsList: []*armedgeorder.ResourceProviderDetails{\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tResourceProviderNamespace: to.Ptr(\"Microsoft.DataBoxEdge\"),\n\t// \t\t\t\t}},\n\t// \t\t\t\tNotificationEmailList: []*string{\n\t// \t\t\t\t},\n\t// \t\t\t\tOrderItemStageHistory: []*armedgeorder.StageDetails{\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNamePlaced),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusSucceeded),\n\t// \t\t\t\t\t\tStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-04T11:30:31.5838042+05:30\"); return t}()),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameConfirmed),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameReadyToShip),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameShipped),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameDelivered),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\t{\n\t// \t\t\t\t\t\tStageName: to.Ptr(armedgeorder.StageNameInUse),\n\t// \t\t\t\t\t\tStageStatus: to.Ptr(armedgeorder.StageStatusNone),\n\t// \t\t\t\t}},\n\t// \t\t\t\tOrderItemType: to.Ptr(armedgeorder.OrderItemTypePurchase),\n\t// \t\t\t\tPreferences: &armedgeorder.Preferences{\n\t// \t\t\t\t\tTransportPreferences: &armedgeorder.TransportPreferences{\n\t// \t\t\t\t\t\tPreferredShipmentType: to.Ptr(armedgeorder.TransportShipmentTypesCustomerManaged),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t},\n\t// \t\t\t\tProductDetails: &armedgeorder.ProductDetails{\n\t// \t\t\t\t\tCount: to.Ptr[int32](0),\n\t// \t\t\t\t\tDisplayInfo: &armedgeorder.DisplayInfo{\n\t// \t\t\t\t\t\tConfigurationDisplayName: to.Ptr(\"Azure Stack Edge Pro - 1 GPU\"),\n\t// \t\t\t\t\t\tProductFamilyDisplayName: to.Ptr(\"Azure Stack Edge\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tHierarchyInformation: &armedgeorder.HierarchyInformation{\n\t// \t\t\t\t\t\tConfigurationName: to.Ptr(\"edgep_base\"),\n\t// \t\t\t\t\t\tProductFamilyName: to.Ptr(\"azurestackedge\"),\n\t// \t\t\t\t\t\tProductLineName: to.Ptr(\"azurestackedge\"),\n\t// \t\t\t\t\t\tProductName: to.Ptr(\"azurestackedgegpu\"),\n\t// \t\t\t\t\t},\n\t// \t\t\t\t\tProductDoubleEncryptionStatus: to.Ptr(armedgeorder.DoubleEncryptionStatusDisabled),\n\t// \t\t\t\t},\n\t// \t\t\t\tReturnStatus: to.Ptr(armedgeorder.OrderItemReturnEnumNotReturnable),\n\t// \t\t\t},\n\t// \t\t\tStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2022-03-04T11:29:47.3483197+05:30\"); return t}()),\n\t// \t\t},\n\t// \t\tSystemData: &armedgeorder.SystemData{\n\t// \t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"0001-01-01T05:30:00+05:30\"); return t}()),\n\t// \t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"0001-01-01T05:30:00+05:30\"); return t}()),\n\t// \t\t},\n\t// \t}\n}", "title": "" }, { "docid": "74df5786b1793a445804caee1de459e8", "score": "0.48911843", "text": "func normalizeOrders(records []Record, quote string) ([]rainbow.Order, error) {\n\toffers := make([]rainbow.Order, 0, len(records))\n\n\tfor _, r := range records {\n\t\ttakerAmount, err := strconv.ParseFloat(r.Order.TakerAmount, 64)\n\t\tif err != nil {\n\t\t\treturn []rainbow.Order{}, err\n\t\t}\n\n\t\tmakerAmount, err := strconv.ParseFloat(r.Order.MakerAmount, 64)\n\t\tif err != nil {\n\t\t\treturn []rainbow.Order{}, err\n\t\t}\n\n\t\toffers = append(\n\t\t\toffers,\n\t\t\trainbow.Order{\n\t\t\t\tPrice: makerAmount / takerAmount,\n\t\t\t\tQuantity: takerAmount * math.Pow(10, -float64(OTokensDecimals)),\n\t\t\t\tQuoteCurrency: quote,\n\t\t\t})\n\t}\n\n\treturn offers, nil\n}", "title": "" }, { "docid": "864c865224959b1b5b1881d418197662", "score": "0.48905253", "text": "func (mnq *MedicalNoteQuery) Order(o ...Order) *MedicalNoteQuery {\n\tmnq.order = append(mnq.order, o...)\n\treturn mnq\n}", "title": "" }, { "docid": "5ae81270bae05ee7b17bcb916e8c420b", "score": "0.4885072", "text": "func (ois *OrderItemsStatus) Create(order *OrderItemsStatus) (int64, error) {\n\n\tctx := context.Background()\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer tx.Rollback()\n\n\t// creates the order\n\tinsertQuery := app.SQLCache[\"orders_insert.sql\"]\n\tstmt, err := tx.Prepare(insertQuery)\n\tif err != nil {\n\t\tlog.Println(\"(CreateOrder:Prepare)\", err)\n\t\treturn -1, err\n\n\t}\n\n\tdefer stmt.Close()\n\n\t// calculates the total price before inserting the order\n\tvar totalPrice = 0.00\n\tfor _, item := range order.OrderItems {\n\t\ttotalPrice += (item.UnitPrice * float64(item.Quantity))\n\t}\n\tvar orderID int64\n\n\terr = stmt.QueryRow(&totalPrice).Scan(&orderID)\n\tif err != nil {\n\t\tlog.Println(\"(CreateOrder:Exec)\", err)\n\t\ttx.Rollback()\n\t\treturn -1, err\n\t}\n\n\t// creates all order items\n\terr = ois.CreateOrderItems(orderID, order.OrderItems, tx)\n\tif err != nil {\n\t\tlog.Println(\"(CreateOrderItems:Exec)\", err)\n\t\ttx.Rollback()\n\t\treturn -1, err\n\t}\n\n\t// creates the first status: 0 - order-created\n\tos := OrderStatus{\n\t\tStatus: OrderCreated,\n\t}\n\n\tif err = ois.CreateOrderStatus(orderID, os, tx); err != nil {\n\t\tlog.Println(\"(CreateOrderStatus:Exec)\", err)\n\t\ttx.Rollback()\n\t\treturn -1, err\n\t}\n\n\tif err = tx.Commit(); err != nil {\n\t\tlog.Println(\"(CreateOrder:Commit)\", err)\n\t\treturn -1, err\n\t}\n\n\treturn orderID, nil\n}", "title": "" }, { "docid": "4c0cc873376535fd3499d0b37d886b27", "score": "0.48740157", "text": "func (m *OrderMutation) ResetOrderItems() {\n\tm.order_items = nil\n\tm.clearedorder_items = false\n\tm.removedorder_items = nil\n}", "title": "" }, { "docid": "e1149b41171fe3fe17c1a029d92200c3", "score": "0.4869666", "text": "func (view *UtxoViewpoint) ConstructLockItems(tx *protos.MsgTx, nextHeight int32) ([]*LockItem, map[protos.Asset]*LockItem) {\n\tif len(tx.TxOut) == 0 {\n\t\treturn nil, nil\n\t}\n\ttemp := make(map[protos.Asset]*LockItem)\n\tfor _, txin := range tx.TxIn {\n\t\tentry := view.LookupEntry(txin.PreviousOutPoint)\n\t\tif entry == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif entry.LockItem() == nil || len(entry.LockItem().Entries) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttempitem, ok := temp[*entry.Asset()]\n\t\tif !ok {\n\t\t\ttempitem = NewLockItem()\n\t\t\ttemp[*entry.Asset()] = tempitem\n\t\t}\n\t\tfor _, lockentry := range entry.LockItem().Entries {\n\n\t\t\tif tempentry, ok := tempitem.Entries[lockentry.Id]; ok {\n\t\t\t\ttempentry.Amount += lockentry.Amount\n\t\t\t} else {\n\t\t\t\ttempitem.Entries[lockentry.Id] = lockentry.Clone()\n\t\t\t}\n\t\t}\n\t}\n\n\tresult := make([]*LockItem, len(tx.TxOut))\n\tfor i, txout := range tx.TxOut {\n\t\tif txout.Value == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttempitem, ok := temp[txout.Asset]\n\t\tif !ok || len(tempitem.Entries) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tcloneitem := tempitem.Clone()\n\t\tfor k, v := range cloneitem.Entries {\n\t\t\tif v.Amount > txout.Value {\n\t\t\t\ttempitem.Entries[k].Amount = v.Amount - txout.Value\n\t\t\t\tv.Amount = txout.Value\n\t\t\t} else {\n\t\t\t\tdelete(tempitem.Entries, k)\n\t\t\t}\n\t\t}\n\t\tresult[i] = cloneitem\n\t}\n\n\tfor k, item := range temp {\n\t\tif len(item.Entries) == 0 {\n\t\t\tdelete(temp, k)\n\t\t}\n\t}\n\n\t// Add self lock if it is votety\n\tfirstOut := tx.TxOut[0]\n\tscriptClass, addrs, _, _ := txscript.ExtractPkScriptAddrs(firstOut.PkScript)\n\tif scriptClass == txscript.VoteTy && len(addrs) > 0 && len(firstOut.Data) > common.HashLength && !firstOut.Asset.IsIndivisible() {\n\t\tid := PickVoteArgument(firstOut.Data)\n\t\tvoteId := NewVoteId(addrs[0].StandardAddress(), id)\n\t\tfor i, txout := range tx.TxOut {\n\t\t\tif txout.Value > 0 && txout.Asset.Equal(&firstOut.Asset) {\n\t\t\t\tif result[i] == nil {\n\t\t\t\t\tresult[i] = NewLockItem()\n\t\t\t\t}\n\t\t\t\tif lockentry, ok := result[i].Entries[*voteId]; ok {\n\t\t\t\t\tlockentry.Amount = txout.Value\n\t\t\t\t} else {\n\t\t\t\t\tresult[i].Entries[*voteId] = &LockEntry{\n\t\t\t\t\t\tId: *voteId,\n\t\t\t\t\t\tAmount: txout.Value,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn result, temp\n}", "title": "" }, { "docid": "6ab14d09635b9def5f07af9c36b8f6b9", "score": "0.48633873", "text": "func (t *SupplychainChaincode) processAddOrder(stub shim.ChaincodeStubInterface, callerDetails CallerDetails, args[]string) ([]byte, error) {\n\n fmt.Println(\"running processAddOrder)\")\n\n if len(args) != 7 {\n return nil, errors.New(\"Incorrect number of arguments. Expecting (Recipient, Address, SourceWarehouse, DeliveryCompany, Items, Client, Owner)\")\n }\n\n items, err := MarshallItems(args[4])\n\n if err != nil { return nil, LogAndError(\"Invalid items: \" + args[4] + \", error: \" + err.Error()) }\n\n timestamp, err := stub.GetTxTimestamp()\n if err != nil { return nil, LogAndError(err.Error()) }\n\n order := NewOrder(stub.GetTxID(), args[0], args[1], args[2], args[3], items, args[5], args[6], timestamp.String())\n\n return nil, AddOrder(stub, callerDetails, order)\n}", "title": "" }, { "docid": "b193c919b62265db274040ba77d67ab5", "score": "0.48612112", "text": "func (rq *ReceiptQuery) Order(o ...Order) *ReceiptQuery {\n\trq.order = append(rq.order, o...)\n\treturn rq\n}", "title": "" }, { "docid": "668c3ed1adea942b1a963906c9e1cbb3", "score": "0.48586908", "text": "func (miq *MixinIDQuery) Order(o ...OrderFunc) *MixinIDQuery {\n\tmiq.order = append(miq.order, o...)\n\treturn miq\n}", "title": "" }, { "docid": "e0b3e235e569e51a4f1f043e8b79f382", "score": "0.48576683", "text": "func HasOrderItemsWith(preds ...predicate.OrderLineItem) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(OrderItemsInverseTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, OrderItemsTable, OrderItemsColumn),\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": "4e223d4a8a32c81cf3de2ae7a0c1397c", "score": "0.48387036", "text": "func (oliq *OrderLineItemQuery) Order(o ...OrderFunc) *OrderLineItemQuery {\n\toliq.order = append(oliq.order, o...)\n\treturn oliq\n}", "title": "" }, { "docid": "f93ef62cdfb713c8781ee91b93f5dcd3", "score": "0.48352432", "text": "func (a *App) CreateOrder(userID int64, data *model.OrderRequestData) (*model.Order, *model.AppErr) {\n\t// validate order request data\n\tif err := data.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tids := make([]int64, 0)\n\tfor _, x := range data.Items {\n\t\tids = append(ids, x.ProductID)\n\t}\n\n\t// get products from given data product ids\n\tproducts, err := a.GetProductsbyIDS(ids)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get authed user\n\tuser, err := a.GetUserByID(userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// calc subtotal price (price before discount, possible taxes etc...)\n\tsubtotal := 0\n\tfor i, p := range products {\n\t\tsubtotal += p.Price * data.Items[i].Quantity\n\t}\n\n\t// calc total price (after possible discount)\n\ttotal := 0\n\tif data.PromoCode == nil {\n\t\ttotal = subtotal\n\t}\n\n\tvar promoCodeName *string\n\tvar promoCodeType *string\n\tvar promoCodeAmount *int\n\n\tif data.PromoCode != nil && *data.PromoCode != \"\" {\n\t\tif err := a.GetPromotionStatus(*data.PromoCode, userID); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpromo, err := a.GetPromotion(*data.PromoCode)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpromoCodeName = &promo.PromoCode\n\t\tpromoCodeType = &promo.Type\n\t\tpromoCodeAmount = &promo.Amount\n\n\t\tif promo.Type == \"percentage\" {\n\t\t\tt := float64(subtotal) - float64(promo.Amount)/100*float64(subtotal)\n\t\t\ttotal = int(math.Round(t*100) / 100)\n\t\t}\n\n\t\tif promo.Type == \"fixed\" {\n\t\t\tt := (subtotal - promo.Amount)\n\t\t\tif t < 0 {\n\t\t\t\tt = 0\n\t\t\t}\n\t\t\ttotal = t\n\t\t}\n\t}\n\n\tbillAddrInfo := &model.Address{}\n\n\tif data.UseExistingBillingAddress != nil && *data.UseExistingBillingAddress == true {\n\t\tif data.BillingAddressID != nil {\n\t\t\tua, err := a.GetUserAddress(userID, *data.BillingAddressID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbillAddrInfo = ua\n\t\t}\n\t} else {\n\t\tbillAddrInfo = data.BillingAddress\n\t}\n\n\t// im too lazy to handle 100% discount (free item) case, and stripe lowest is 0.5$\n\t// otherwise i would need to create invoice which cant work without invoice items etc bla bla...\n\tif total == 0 {\n\t\ttotal = 50\n\t}\n\n\to := &model.Order{\n\t\tUserID: userID,\n\t\tSubtotal: subtotal,\n\t\tTotal: total,\n\t\tStatus: model.OrderStatusSuccess.String(),\n\t\tPaymentMethodID: data.PaymentMethodID,\n\t\tPromoCode: promoCodeName,\n\t\tPromoCodeType: promoCodeType,\n\t\tPromoCodeAmount: promoCodeAmount,\n\t}\n\n\to.BillingAddressLine1 = billAddrInfo.Line1\n\to.BillingAddressLine2 = billAddrInfo.Line2\n\to.BillingAddressCity = billAddrInfo.City\n\to.BillingAddressCountry = billAddrInfo.Country\n\to.BillingAddressState = billAddrInfo.State\n\to.BillingAddressZIP = billAddrInfo.ZIP\n\to.BillingAddressLatitude = billAddrInfo.Latitude\n\to.BillingAddressLongitude = billAddrInfo.Longitude\n\n\to.PreSave()\n\n\tif data.SameShippingAsBilling != nil && *data.SameShippingAsBilling == true {\n\t\to.ShippingAddressLine1 = billAddrInfo.Line1\n\t\to.ShippingAddressLine2 = billAddrInfo.Line2\n\t\to.ShippingAddressCity = billAddrInfo.City\n\t\to.ShippingAddressCountry = billAddrInfo.Country\n\t\to.ShippingAddressState = billAddrInfo.State\n\t\to.ShippingAddressZIP = billAddrInfo.ZIP\n\t\to.ShippingAddressLatitude = billAddrInfo.Latitude\n\t\to.ShippingAddressLongitude = billAddrInfo.Longitude\n\t} else {\n\t\to.ShippingAddressLine1 = data.ShippingAddress.Line1\n\t\to.ShippingAddressLine2 = data.ShippingAddress.Line2\n\t\to.ShippingAddressCity = data.ShippingAddress.City\n\t\to.ShippingAddressCountry = data.ShippingAddress.Country\n\t\to.ShippingAddressState = data.ShippingAddress.State\n\t\to.ShippingAddressZIP = data.ShippingAddress.ZIP\n\t\to.ShippingAddressLatitude = data.ShippingAddress.Latitude\n\t\to.ShippingAddressLongitude = data.ShippingAddress.Longitude\n\t}\n\n\tif data.UseExistingBillingAddress == nil || (data.UseExistingBillingAddress != nil && *data.UseExistingBillingAddress == false) {\n\t\tbGeocode, err := a.GetAddressGeocodeResult(data.BillingAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar sGeocode *model.GeocodingResult\n\t\tif data.SameShippingAsBilling != nil && *data.SameShippingAsBilling == true {\n\t\t\tsGeocode = bGeocode\n\t\t} else {\n\t\t\tsGeocode, err = a.GetAddressGeocodeResult(data.ShippingAddress)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tbLat, _ := strconv.ParseFloat(bGeocode.Lat, 64)\n\t\tbLon, _ := strconv.ParseFloat(bGeocode.Lon, 64)\n\t\tsLat, _ := strconv.ParseFloat(sGeocode.Lat, 64)\n\t\tsLon, _ := strconv.ParseFloat(sGeocode.Lon, 64)\n\n\t\to.BillingAddressLatitude = &bLat\n\t\to.BillingAddressLongitude = &bLon\n\t\to.ShippingAddressLatitude = &sLat\n\t\to.ShippingAddressLongitude = &sLon\n\t}\n\n\tpi, cErr := a.PaymentProvider().Charge(data.PaymentMethodID, o, user, uint64(o.Total), \"usd\")\n\tif cErr != nil {\n\t\tif stripeErr, ok := cErr.(*stripe.Error); ok {\n\t\t\tif cardErr, ok := stripeErr.Err.(*stripe.CardError); ok {\n\t\t\t\tdc := \"\"\n\t\t\t\tif (string(cardErr.DeclineCode)) != \"\" {\n\t\t\t\t\tdc = \"Decline code: \" + string(cardErr.DeclineCode)\n\t\t\t\t}\n\n\t\t\t\treturn nil, model.NewAppErr(\"CreateOrder\", model.ErrInternal, locale.GetUserLocalizer(\"en\"), &i18n.Message{ID: \"app.order.create_order.app_error\", Other: fmt.Sprintf(\"%s\\n%s\", stripeErr.Msg, dc)}, http.StatusInternalServerError, nil)\n\t\t\t}\n\t\t\treturn nil, model.NewAppErr(\"CreateOrder\", model.ErrInternal, locale.GetUserLocalizer(\"en\"), &i18n.Message{ID: \"app.order.create_order.app_error\", Other: stripeErr.Msg}, http.StatusInternalServerError, nil)\n\n\t\t}\n\t\treturn nil, model.NewAppErr(\"CreateOrder\", model.ErrInternal, locale.GetUserLocalizer(\"en\"), &i18n.Message{ID: \"app.order.create_order.app_error\", Other: \"could not charge the card\"}, http.StatusInternalServerError, nil)\n\t}\n\n\to.PaymentIntentID = pi.ID\n\to.ReceiptURL = pi.Charges.Data[0].ReceiptURL\n\n\t// save actual order\n\torder, err := a.Srv().Store.Order().Save(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torderDetails := make([]*model.OrderDetail, 0)\n\tfor i, p := range products {\n\t\tdetail := &model.OrderDetail{\n\t\t\tOrderID: order.ID,\n\t\t\tProductID: p.ID,\n\t\t\tQuantity: data.Items[i].Quantity,\n\t\t\tHistoryPrice: p.Price,\n\t\t\tHistorySKU: p.SKU,\n\t\t}\n\t\torderDetails = append(orderDetails, detail)\n\t}\n\n\tif err := a.InsertOrderDetails(orderDetails); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif data.PromoCode != nil && *data.PromoCode != \"\" {\n\t\t// insert promo detail to mark the promo_code as used by the specific user\n\t\tpd := &model.PromotionDetail{UserID: userID, PromoCode: *data.PromoCode}\n\t\tif _, err := a.CreatePromotionDetail(pd); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif (data.UseExistingBillingAddress == nil || data.UseExistingBillingAddress != nil && *data.UseExistingBillingAddress == false) && (data.SaveAddress != nil && *data.SaveAddress == true) {\n\t\t\tif _, err := a.CreateUserAddress(data.BillingAddress, userID); err != nil {\n\t\t\t\ta.Log().Error(err.Error(), zlog.Err(err))\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn order, nil\n}", "title": "" }, { "docid": "bf24f8e2f7d87145dcd24df328a2f41a", "score": "0.48295835", "text": "func HasOrderItems() predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(OrderItemsTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, OrderItemsTable, OrderItemsColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "a38cf86d479e71a92ce61ecb5f7ec67c", "score": "0.48071602", "text": "func GetOrders(client *http.Client) []Order {\n\tresponse, err := client.Get(\n\t\tfmt.Sprintf(\"https://openapi.etsy.com/v2/shops/%v/receipts?was_paid=true&was_shipped=false\", config.ShopID))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif response.StatusCode == 400 {\n\t\t// Probably rate limited\n\t\treturn make([]Order, 0)\n\t}\n\tbytes, err := ioutil.ReadAll(response.Body)\n\torders := Orders{}\n\tif err := json.Unmarshal(bytes, &orders); err != nil {\n\t\tpanic(err)\n\t}\n\tvar openOrders []Order\n\n\tfor i := 0; i < len(orders.Results); i++ {\n\t\treceipts := getTransactions(client, orders.Results[i].ReceiptID)\n\n\t\tfor j := 0; j < receipts.Count; j++ {\n\t\t\tprimaryColor := \"\"\n\t\t\tsecondaryColor := \"\"\n\t\t\tslotAmount := \"\"\n\t\t\tfor k := 0; k < len(receipts.Results[j].Variations); k++ {\n\t\t\t\tswitch variation := receipts.Results[j].Variations[k].FormattedName; variation {\n\t\t\t\tcase \"Complete Comfort Grip Color\", \"Color\":\n\t\t\t\t\tprimaryColor = receipts.Results[j].Variations[k].FormattedValue\n\t\t\t\tcase \"Secondary color\":\n\t\t\t\t\tsecondaryColor = receipts.Results[j].Variations[k].FormattedValue\n\t\t\t\tcase \"Slot Amount\":\n\t\t\t\t\tslotAmount = receipts.Results[j].Variations[k].FormattedValue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\timageURL := getListingImage(client, receipts.Results[j].ListingID, receipts.Results[j].ImageListingID)\n\n\t\t\t//Make a new order for each\n\t\t\torder := Order{\n\t\t\t\treceipts.Results[j].Title,\n\t\t\t\tprimaryColor,\n\t\t\t\tsecondaryColor,\n\t\t\t\tslotAmount,\n\t\t\t\treceipts.Results[j].Quantity,\n\t\t\t\torders.Results[i].MessageFromBuyer,\n\t\t\t\torders.Results[i].GiftMessage,\n\t\t\t\treceipts.Results[j].URL,\n\t\t\t\torders.Results[i].DaysFromDueDate,\n\t\t\t\timageURL,\n\t\t\t}\n\t\t\topenOrders = append(openOrders, order)\n\t\t}\n\t}\n\tsort.Slice(openOrders, func(i, j int) bool {\n\t\treturn openOrders[i].DaysFromDueDate < openOrders[j].DaysFromDueDate\n\t})\n\treturn openOrders\n}", "title": "" }, { "docid": "cb1153dde58c74b20114a03458a55c71", "score": "0.47856316", "text": "func serializeOrderedItemsIntermediateType(t *orderedItemsIntermediateType) (i interface{}, err error) {\n\ti, err = t.Serialize()\n\treturn\n\n}", "title": "" }, { "docid": "800d8337c86e741786485415c8f808ad", "score": "0.4779517", "text": "func ExampleManagementClient_BeginReturnOrderItem() {\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 := armedgeorder.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewManagementClient().BeginReturnOrderItem(ctx, \"TestOrderName4\", \"YourResourceGroupName\", armedgeorder.ReturnOrderItemDetails{\n\t\tReturnReason: to.Ptr(\"Order returned\"),\n\t}, 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": "b9b0bc7f293727bb688355166e4c694d", "score": "0.4773878", "text": "func (iiq *InstructorInfoQuery) Order(o ...OrderFunc) *InstructorInfoQuery {\n\tiiq.order = append(iiq.order, o...)\n\treturn iiq\n}", "title": "" }, { "docid": "a30aae4e18fec63092e320f4e305404f", "score": "0.47524044", "text": "func GetOrderItems(response http.ResponseWriter, request *http.Request) {\n\tvar ctx, cancel = context.WithTimeout(context.Background(), 100*time.Second)\n\n\tresponse.Header().Add(\"Content-Type\", \"application/json\")\n\n\tresult, err := orderItemCollection.Find(context.TODO(), bson.M{})\n\n\tdefer cancel()\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(err.Error()))\n\t}\n\tvar allOrderItems []bson.M\n\tif err = result.All(ctx, &allOrderItems); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresponse.Header().Add(\"Content-Type\", \"application/json\")\n\tresponse.WriteHeader(http.StatusOK)\n\n\tjson.NewEncoder(response).Encode(allOrderItems)\n\n\t// response.Write(jsonBytes)\n}", "title": "" }, { "docid": "f641aa71c2e2f00c8beaaad4341919be", "score": "0.47518894", "text": "func (o *Order) AddOrderItemsG(ctx context.Context, insert bool, related ...*OrderItem) error {\n\treturn o.AddOrderItems(ctx, boil.GetContextDB(), insert, related...)\n}", "title": "" }, { "docid": "ba7193d487d7879ae75424ebc6041206", "score": "0.47480747", "text": "func (o *Order) Fill(quantity decimal.Decimal) {\n\to.FilledQuantity = o.FilledQuantity.Add(quantity)\n}", "title": "" }, { "docid": "0c0e7d64bf7760dca82a5eb51384c0e4", "score": "0.47424963", "text": "func buildOrderShelf(arrayCapacity uint, name string,\n\tmodifier uint) *orderShelf {\n\tshelf := new(orderShelf)\n\tshelf.name = name\n\tshelf.counter = int32(arrayCapacity)\n\tshelf.modifier = modifier\n\tshelf.contents = cmap.New()\n\tshelf.criticals = cmap.New()\n\treturn shelf\n}", "title": "" }, { "docid": "b96d0875c4bbde9bd3a5bd8d071474e0", "score": "0.4735083", "text": "func (e *Image) getMultiOrdered(ctx context.Context, keys []*datastore.Key) OrderedImages {\n\timgs := e.getMulti(ctx, keys)\n\n\torderedImgs := make(OrderedImages)\n\tfor i := 0; i < len(keys); i++ {\n\t\torderedImgs[keys[i].IntID()] = imgs[i]\n\t}\n\n\treturn orderedImgs\n}", "title": "" }, { "docid": "ee7004e4659280f6ccc6864508bb9688", "score": "0.4727217", "text": "func getitems(filerow []string) items{ \n\tdata := item{}\n\tdatas := items{}\n\tfirstitem := true\n\tvar err error \n\tfor _,dm := range filerow{\n\t\t a := strings.Split(dm,\",\")\n\t\t if a[0] != \"\" && !firstitem{ \n\t\t datas.itemarr = append(datas.itemarr,data)\n\t\t data = item{}\n\t\t data.name = a[0]\n\t\t } \n\t\t if firstitem{ \n\t\t\tdata.name = a[0]\n\t\t\tfirstitem = false\n\t\t }\n dt := details{} \n\t\t dt.personname = a[1] \n\t\t dt.amtgiven,err = strconv.ParseFloat(a[2],64) \n\t\t dt.weightage,err = strconv.Atoi(a[3]) \n if err != nil{\n\t\t\t fmt.Println(\"error\")\n\t\t }\n \t\t data.total = data.total + dt.amtgiven\n\t\t data.totweightage = data.totweightage + dt.weightage\n\t\t data.split = append(data.split,dt) \n\t}\n\tdatas.itemarr = append(datas.itemarr,data)\n return datas\n}", "title": "" }, { "docid": "5bc20ba1c53f2a540f745c9101c1e6fa", "score": "0.4722884", "text": "func (s Storage) StoreOrder(item core.Order) (int, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "b82b4ed8759c463ecdf804e5b2848c0d", "score": "0.47006422", "text": "func (s *ItemSplitter) SplitInSingleQtyItems(givenItem Item) ([]Item, error) {\n\tvar items []Item\n\t// configUseGrossPrice true then:\n\t// Given: SinglePriceGross / all AppliedDiscounts / All Taxes\n\t// Calculated: SinglePriceNet / RowPriceGross / RowPriceNet / SinglePriceNet\n\n\t// configUseGrossPrice false then:\n\t// Given: SinglePriceNez / all AppliedDiscounts / All Taxes\n\t// Calculated: SinglePriceGross / RowPriceGross / RowPriceNet / SinglePriceGross\n\tfor x := 0; x < givenItem.Qty; x++ {\n\n\t\titemBuilder := s.itemBuilderProvider()\n\t\titemBuilder.SetProductData(givenItem.MarketplaceCode, givenItem.VariantMarketPlaceCode, givenItem.ProductName)\n\t\titemBuilder.SetExternalReference(givenItem.ExternalReference)\n\t\titemBuilder.SetID(givenItem.ID)\n\t\titemBuilder.SetQty(1)\n\t\tfor _, ap := range givenItem.AppliedDiscounts {\n\t\t\tapSplitted, err := ap.Applied.SplitInPayables(givenItem.Qty)\n\t\t\t// The split adds the moving cents to the first ones, resulting in\n\t\t\t// having the smallest prices at the end but since discounts are\n\t\t\t// negative, we need to reverse it to ensure that a split of the row\n\t\t\t// totals has the rounding cents at the same positions\n\t\t\tsort.Slice(apSplitted, func(i, j int) bool {\n\t\t\t\treturn apSplitted[i].FloatAmount() > apSplitted[j].FloatAmount()\n\t\t\t})\n\t\t\tp := make([]float64, 0)\n\t\t\tfor _, i := range apSplitted {\n\t\t\t\tp = append(p, i.FloatAmount())\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewDiscount := AppliedDiscount{\n\t\t\t\tCampaignCode: ap.CampaignCode,\n\t\t\t\tCouponCode: ap.CouponCode,\n\t\t\t\tLabel: ap.Label,\n\t\t\t\tApplied: apSplitted[x],\n\t\t\t\tType: ap.Type,\n\t\t\t\tIsItemRelated: ap.IsItemRelated,\n\t\t\t\tSortOrder: ap.SortOrder,\n\t\t\t}\n\t\t\titemBuilder.AddDiscount(newDiscount)\n\t\t}\n\t\tfor _, rt := range givenItem.RowTaxes {\n\t\t\tif rt.Amount.IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trtSplitted, err := rt.Amount.SplitInPayables(givenItem.Qty)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\titemBuilder.AddTaxInfo(rt.Type, rt.Rate, &rtSplitted[x])\n\t\t}\n\t\tif s.configUseGrossPrice {\n\t\t\titemBuilder.SetSinglePriceGross(givenItem.SinglePriceGross.GetPayable())\n\t\t\titemBuilder.CalculatePricesAndTaxAmountsFromSinglePriceGross()\n\t\t} else {\n\t\t\titemBuilder.SetSinglePriceNet(givenItem.SinglePriceNet.GetPayable())\n\t\t\titemBuilder.CalculatePricesAndTaxAmountsFromSinglePriceNet()\n\t\t}\n\t\titem, err := itemBuilder.Build()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titems = append(items, *item)\n\t}\n\treturn items, nil\n}", "title": "" }, { "docid": "733bfb04daef85c2fbef83b3027cb66e", "score": "0.47000477", "text": "func (m *OrderMutation) ClearOrderItems() {\n\tm.clearedorder_items = true\n}", "title": "" }, { "docid": "31f64a93a136bb50cf6d9aca62690a4c", "score": "0.4699352", "text": "func ToOrder(om *OrderMongo) *Order {\n\tID := \"\"\n\tif !om.ID.IsZero() {\n\t\tID = om.ID.Hex()\n\t}\n\n\tIDCustomer := om.IDCustomer.Hex()\n\tIDOrganization := om.IDOrganization.Hex()\n\n\tBasket := make([]BasketItem, len(om.Basket))\n\tfor i, product := range om.Basket {\n\t\tBasket[i] = *ToBasketItem(&product)\n\t}\n\n\treturn &Order{\n\t\tID: ID,\n\t\tIDCustomer: IDCustomer,\n\t\tIDOrganization: IDOrganization,\n\t\tBasket: Basket,\n\t\tType: om.Type,\n\t\tStatus: om.Status,\n\t\tPrice: om.Price,\n\t\tDateCreate: om.DateCreate,\n\t\tComment: om.Comment,\n\t\tDateCustomerWish: om.DateCustomerWish,\n\t\tAddress: om.Address,\n\t}\n}", "title": "" }, { "docid": "d8a5a877362d0ade40feda5e7459f743", "score": "0.46809432", "text": "func (sh *Shelf) PutInOrder(ordr *GridOrder) error {\n\tsh.mu.Lock()\n\tdefer sh.mu.Unlock()\n\tif sh.capacity <= len(sh.capTable) {\n\t\treturn errors.New(\"shelf is full\")\n\t}\n\n\tsh.capTable[ordr.Odr.Id] = ordr\n\tif orderInfo, err := json.Marshal(&ordr.Odr); err == nil {\n\t\tlog.Printf(\"%s received an order %s \", sh.GetName(), string(orderInfo))\n\t\tsh.showAllOrders()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a9a02d2a315ec5c44f1ff696ee11c466", "score": "0.46565613", "text": "func (r *Replay) Process() {\n\tfor _, p := range r.ItemPurchases {\n\t\tp.GameID = r.GameID\n\t\tp.SteamID = r.Players[p.Hero]\n\t}\n}", "title": "" }, { "docid": "d0360fb200a5598a9bf37324cad7d357", "score": "0.4653635", "text": "func (o CreateACartCreatedBodyLineItemsItems0PhysicalItemsItems0) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tCouponAmount float64 `json:\"coupon_amount,omitempty\"`\n\n\t\tCoupons []*CreateACartCreatedBodyLineItemsItems0PhysicalItemsItems0CouponsItems0 `json:\"coupons\"`\n\n\t\tDiscountAmount float64 `json:\"discount_amount,omitempty\"`\n\n\t\tDiscounts []*CreateACartCreatedBodyLineItemsItems0PhysicalItemsItems0DiscountsItems0 `json:\"discounts\"`\n\n\t\tExtendedListPrice float64 `json:\"extended_list_price,omitempty\"`\n\n\t\tExtendedSalePrice float64 `json:\"extended_sale_price,omitempty\"`\n\n\t\tID string `json:\"id,omitempty\"`\n\n\t\tImageURL strfmt.URI `json:\"image_url,omitempty\"`\n\n\t\tIsTaxable bool `json:\"is_taxable,omitempty\"`\n\n\t\tListPrice float64 `json:\"list_price,omitempty\"`\n\n\t\tName string `json:\"name,omitempty\"`\n\n\t\tOptions []*CreateACartCreatedBodyLineItemsItems0PhysicalItemsItems0OptionsItems0 `json:\"options\"`\n\n\t\tProductID *float64 `json:\"product_id\"`\n\n\t\tQuantity *float64 `json:\"quantity\"`\n\n\t\tSalePrice float64 `json:\"sale_price,omitempty\"`\n\n\t\tSku string `json:\"sku,omitempty\"`\n\n\t\tURL strfmt.URI `json:\"url,omitempty\"`\n\n\t\tVariantID *float64 `json:\"variant_id\"`\n\t}\n\n\tdataAO0.CouponAmount = o.CouponAmount\n\n\tdataAO0.Coupons = o.Coupons\n\n\tdataAO0.DiscountAmount = o.DiscountAmount\n\n\tdataAO0.Discounts = o.Discounts\n\n\tdataAO0.ExtendedListPrice = o.ExtendedListPrice\n\n\tdataAO0.ExtendedSalePrice = o.ExtendedSalePrice\n\n\tdataAO0.ID = o.ID\n\n\tdataAO0.ImageURL = o.ImageURL\n\n\tdataAO0.IsTaxable = o.IsTaxable\n\n\tdataAO0.ListPrice = o.ListPrice\n\n\tdataAO0.Name = o.Name\n\n\tdataAO0.Options = o.Options\n\n\tdataAO0.ProductID = o.ProductID\n\n\tdataAO0.Quantity = o.Quantity\n\n\tdataAO0.SalePrice = o.SalePrice\n\n\tdataAO0.Sku = o.Sku\n\n\tdataAO0.URL = o.URL\n\n\tdataAO0.VariantID = o.VariantID\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\tvar dataAO1 struct {\n\t\tGiftWrapping *CreateACartCreatedBodyLineItemsItems0PhysicalItemsItems0AO1GiftWrapping `json:\"gift_wrapping,omitempty\"`\n\n\t\tIsRequireShipping bool `json:\"is_require_shipping,omitempty\"`\n\t}\n\n\tdataAO1.GiftWrapping = o.GiftWrapping\n\n\tdataAO1.IsRequireShipping = o.IsRequireShipping\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "9bf42912d72a5809f0696ce91137ae69", "score": "0.46457446", "text": "func constructMTOServiceItemModels(shipmentID uuid.UUID, mtoID uuid.UUID, reServiceCodes []models.ReServiceCode) models.MTOServiceItems {\n\tserviceItems := make(models.MTOServiceItems, len(reServiceCodes))\n\n\tfor i, reServiceCode := range reServiceCodes {\n\t\tserviceItem := models.MTOServiceItem{\n\t\t\tMoveTaskOrderID: mtoID,\n\t\t\tMTOShipmentID: &shipmentID,\n\t\t\tReService: models.ReService{Code: reServiceCode},\n\t\t\tStatus: \"APPROVED\",\n\t\t}\n\t\tserviceItems[i] = serviceItem\n\t}\n\treturn serviceItems\n}", "title": "" }, { "docid": "7e6edbe3a0e7fb60efdfeed246bc310a", "score": "0.4644559", "text": "func CreateTestItems(h storage.Storage, num int) []*models.Item {\n\n\tvar items []*models.Item\n\n\tfor i := 0; i < num; i++ {\n\t\titem := models.NewItem(fmt.Sprintf(\"A-thing-%03d\", i))\n\t\titems = append(items, item)\n\t\th.CreateItem(item)\n\t}\n\treturn items\n}", "title": "" }, { "docid": "9d981b14e057bff0274ae9c242454ff3", "score": "0.46300244", "text": "func (e engine) processOrder(state state.State, w txBuffer, order *types.Order) error {\n\n\tfulfillment, err := BestFulfillment(state, order)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif fulfillment == nil {\n\t\treturn nil\n\t}\n\n\tw.put(&types.TxCreateLease{\n\t\tLease: &types.Lease{\n\t\t\tDeployment: fulfillment.Deployment,\n\t\t\tGroup: fulfillment.Group,\n\t\t\tOrder: fulfillment.Order,\n\t\t\tProvider: fulfillment.Provider,\n\t\t\tPrice: fulfillment.Price,\n\t\t},\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "08efc88effe17c4ec734707ec1cee122", "score": "0.4629187", "text": "func TestApomoffer1(t *testing.T) {\n\tclearBasket()\n\tbasket.Basket.AddItem(\"OM1\")\n\tbasket.Basket.AddItem(\"OM1\")\n\tbasket.Basket.AddItem(\"OM1\")\n\tbasket.Basket.AddItem(\"OM1\")\n\n\tCos.PrintBills()\n\n\tvar totalItem, oatCount int64\n\n\tfor _, be := range Cos.bill {\n\t\tif be.prodCode == \"OM1\" {\n\t\t\toatCount++\n\t\t}\n\t\ttotalItem++\n\t}\n\n\tif totalItem != oatCount {\n\t\tt.Errorf(\"ordered 4 oatmeal. But found: %d oatmeal\", oatCount)\n\t}\n}", "title": "" }, { "docid": "7f7f93aaaf0d8d4d055722cead1fc5ae", "score": "0.46179906", "text": "func (i *Item) Append(x float64, highOrder uint8) {\n\tn1 := i.N\n\tif n1 == 0 {\n\t\ti.Min = x\n\t\ti.Max = x\n\t}\n\tif x < i.Min {\n\t\ti.Min = x\n\t}\n\tif x > i.Max {\n\t\ti.Max = x\n\t}\n\ti.N = i.N + 1\n\tdelta := x - i.Mean\n\tdeltaN := delta / i.N\n\tdeltaN2 := deltaN * deltaN\n\tterm1 := delta * deltaN * n1\n\ti.Mean = i.Mean + deltaN\n\n\tswitch highOrder {\n\tcase 4:\n\t\ti.M4 = i.M4 + term1*deltaN2*(i.N*i.N-3*i.N+3) + 6*deltaN2*i.M2 - 4*deltaN*i.M3\n\t\ti.M3 = i.M3 + term1*deltaN*(i.N-2) - 3*deltaN*i.M2\n\t\ti.M2 = i.M2 + term1\n\tcase 3:\n\t\ti.M3 = i.M3 + term1*deltaN*(i.N-2) - 3*deltaN*i.M2\n\t\ti.M2 = i.M2 + term1\n\tcase 2:\n\t\ti.M2 = i.M2 + term1\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "3d9baea1644cd5a36dc17d304e314e45", "score": "0.46166235", "text": "func (b *supplyBehavior) ProcessEvent(e Event, emitter EventEmitter) {\n\tswitch e.Topic() {\n\tcase \"order-item\":\n\t\t// Order item by a stock cell, add the quantity.\n\t\torderItem := e.Payload().(*OrderItem)\n\t\tb.itemQuantities[orderItem.ItemNo] += orderItem.Quantity\n\t\t// More than 10 ordered items, so let produce them.\n\t\tif len(b.itemQuantities) > 10 {\n\t\t\tb.manufacture(emitter)\n\t\t}\n\tcase \"ticker(manufacturing)\":\n\t\t// Let the manufactures produce the collected items.\n\t\tb.manufacture(emitter)\n\tcase \"shipment\":\n\t\t// Shipment of an order by the manufacturers, distribute the\n\t\t// items to the stock cells.\n\t\tshipment := e.Payload().(*Shipment)\n\t\tfor _, shipmentItem := range shipment.ShipmentItems {\n\t\t\tstockCellId := NewId(\"stock\", shipmentItem.ItemNo)\n\t\t\tb.env.EmitSimple(stockCellId, \"shipment-item\", shipmentItem)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bdc5b8b5ad7d0bd703ed9fd15993ed5", "score": "0.46138483", "text": "func (o *OrderedCollection) Append(ob as.Item) error {\n\to.OrderedItems = append(o.OrderedItems, ob)\n\treturn nil\n}", "title": "" }, { "docid": "09f2602aa7417148d023790d3ef4eb9b", "score": "0.4603856", "text": "func getItems(scanner *bufio.Scanner, maxPrice int, maxItems int) ([]item, []int, error) {\n\t// Initialize variables\n\tpathArray1 := make([][]path, maxPrice+1)\n\tpathArray2 := make([][]path, maxPrice+1)\n\tfor price := 0; price <= maxPrice; price++ {\n\t\tpathArray1[price] = make([]path, maxItems+1)\n\t\tpathArray2[price] = make([]path, maxItems+1)\n\t}\n\tvar itemList []item\n\n\tnewlineStr := getNewlineStr()\n\titemIndex := -1\n\tfor scanner.Scan() {\n\t\t// Read items\n\t\tinput := scanner.Text()\n\t\tinput = strings.TrimRight(input, newlineStr)\n\t\ts := parse(input)\n\t\titemPrice, err := strconv.Atoi(s[1])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Unknown item format in input file: %s\", input)\n\t\t}\n\t\titemIndex++\n\n\t\t// Store items in itemList\n\t\titemList = append(itemList, item{name: s[0], price: itemPrice})\n\n\t\t// Perform dynamic programming by iterating over each sub-price and sub-itemCount\n\t\tfor price := 0; price <= maxPrice; price++ {\n\t\t\tfor itemCount := 1; itemCount <= maxItems; itemCount++ {\n\t\t\t\tif itemPrice <= price {\n\t\t\t\t\tprevPath := pathArray1[price][itemCount]\n\t\t\t\t\tsubPath := pathArray1[price-itemPrice][itemCount-1]\n\t\t\t\t\tnewTot := itemPrice + subPath.total\n\t\t\t\t\tif newTot > prevPath.total {\n\t\t\t\t\t\tpathArray2[price][itemCount] = path{total: newTot, itemPicked: itemIndex}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpathArray2[price][itemCount] = pathArray1[price][itemCount]\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpathArray2[price][itemCount] = pathArray1[price][itemCount]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Swap the arrays\n\t\tpathArray1, pathArray2 = pathArray2, pathArray1\n\t}\n\n\t// Backtrack to get chosen items' indices\n\tindices, err := backtrack(itemList, pathArray1, maxItems)\n\n\treturn itemList, indices, err\n}", "title": "" }, { "docid": "0d26656e07ff9c0e7b120d0e42090914", "score": "0.4599423", "text": "func (m *OrderMutation) OrderItemsIDs() (ids []string) {\n\tfor id := range m.order_items {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e72f6799b574f1569dd61db2f988f583", "score": "0.4599199", "text": "func GenPriceBreakdown(db *gorm.DB, order Order) (breakdown PriceBreakdown) {\n\tvar orderItems []OrderItem\n\tif err := db.Where(\"order_id = ?\", order.Id).Order(\"day\").Order(\"type desc\").Find(&orderItems).Error; err != nil {\n\t\tfmt.Println(\"GenPriceBreakdown error:\", err)\n\t\treturn\n\t}\n\tfor _, item := range orderItems {\n\t\t// clean products is merged into the last breakdown item\n\t\tif item.Type == Clean {\n\t\t\tindex := len(breakdown.Items) - 1\n\t\t\tbitem := breakdown.Items[index]\n\t\t\tbitem.DayTotal += item.Price\n\t\t\tvar productName string\n\t\t\tif product := GetProductById(item.ProductId); product != nil {\n\t\t\t\tproductName = product.Name\n\t\t\t}\n\t\t\tif bitem.Description == \"—\" {\n\t\t\t\tbitem.Description = \"\"\n\t\t\t}\n\t\t\tbitem.Description += fmt.Sprintf(\"Car Detailing: %s + $%.2f; \", productName, item.Amount())\n\t\t\tbreakdown.Items[index] = bitem\n\t\t} else {\n\t\t\tdate, _ := time.Parse(\"2006-01-02\", item.Day)\n\t\t\tbitem := PriceBreakdownItem{\n\t\t\t\tday: item.Day,\n\t\t\t\tDate: date.Format(\"Mon, Jan 2\"),\n\t\t\t\tDescription: \"—\",\n\t\t\t\tRate: item.Amount(),\n\t\t\t\tDayTotal: item.Amount(),\n\t\t\t}\n\t\t\tif item.Discount != 0 {\n\t\t\t\tbitem.Description = fmt.Sprintf(\"Discount: $%.2f; \", item.Discount)\n\t\t\t}\n\t\t\tif item.SpecialPrice > 0.0 {\n\t\t\t\tbitem.Description = fmt.Sprintf(\"Special Time Surcharge + $%.2f; \", item.SpecialPrice)\n\t\t\t\tbitem.Rate -= item.SpecialPrice\n\t\t\t}\n\t\t\tbreakdown.Items = append(breakdown.Items, bitem)\n\t\t}\n\t}\n\n\tbreakdown.Total = order.Amount\n\n\tvar notes []Note\n\tif err := db.Where(\"order_id = ? and auto_generated = false\", order.Id).Find(&notes).Error; err != nil {\n\t\tprintln(\"can't retrieve notes:\", err.Error())\n\t}\n\n\tfor _, note := range notes {\n\t\tdesc := \"Note: —\"\n\t\tif note.Note != \"\" {\n\t\t\tdesc = \"Note: \" + note.Note\n\t\t}\n\t\tbreakdown.Items = append(breakdown.Items, PriceBreakdownItem{\n\t\t\tday: note.CreatedAt.Format(\"2006-01-02\"),\n\t\t\tDate: note.CreatedAt.Format(\"Mon, Jan 2\"),\n\t\t\tRate: note.ChangedAmount,\n\t\t\tDayTotal: note.ChangedAmount,\n\t\t\tDescription: desc,\n\t\t})\n\t}\n\n\tsort.Sort(&breakdown)\n\n\treturn\n}", "title": "" }, { "docid": "5b5eafe0df69f166f7c245db7de43fb1", "score": "0.45963645", "text": "func (ddq *DoseDescriptionQuery) Order(o ...OrderFunc) *DoseDescriptionQuery {\n\tddq.order = append(ddq.order, o...)\n\treturn ddq\n}", "title": "" }, { "docid": "fa955afb452b1d88955b8fa290bc9d1e", "score": "0.45897046", "text": "func createItemStats(db *database.Database, brand string, models []string) []Product{\n\tvar pList []Product\n\t\n\tvar brandNum int = 0;\n\tvar brandAverage float64 = -1\n\tvar brandLowest float64 = -1\n\tvar brandHighest float64 = -1\n\t\n\tfor _, model := range models{\n\t\t\n\t\titems, _ := db.GetItemBrandModel(brand, model)\n\t\t\n\t\tvar lowestPrice float64 = -1\n\t\tvar highestPrice float64 = -1\n\t\t\n\t\tvar averagePrice = 0.0\n\t\t\n\t\tfor _, item := range items{\n\t\t\taveragePrice += item.Price\n\t\t\tif(highestPrice < 0 || item.Price > highestPrice){\n\t\t\t\thighestPrice = item.Price\n\t\t\t}\n\t\t\tif(lowestPrice <0 || item.Price < lowestPrice){\n\t\t\t\tlowestPrice = item.Price\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(lowestPrice > 0){\n\t\t\tif(lowestPrice < brandLowest){\n\t\t\t\tbrandLowest = lowestPrice\n\t\t\t}\t\n\t\t}\n\t\t\n\t\tif(highestPrice > 0){\n\t\t\tif(highestPrice > brandHighest){\n\t\t\t\tbrandHighest = highestPrice\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\titemNum := len(items)\n\t\t\n\t\tbrandNum += itemNum\n\t\tbrandAverage += averagePrice\n\t\t\n\t\tif(itemNum > 0) {\n\t\t\taveragePrice /= float64(len(items))\n\t\t\tpList = append(pList, Product{brand+\" \"+model, brand, model, itemNum,(averagePrice), (lowestPrice), (highestPrice), fmt.Sprintf(\"%.2f\",((averagePrice )))})\n\t\t}\n\t\t\n\t}\n\tif(brandNum > 0) {\n\t\tbrandAverage /= float64(brandNum)\n\t\tBrandList = append(BrandList, Brand{brand, brandNum, (brandAverage), (brandLowest), (brandHighest), fmt.Sprintf(\"%.2f\",((brandAverage )))})\n\t}\n\t\n\t\n\t\n\treturn pList\n}", "title": "" }, { "docid": "aa902f6ad2bec49615b868328e3a0338", "score": "0.45854074", "text": "func (j *joinGen4) Order() int {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "bd009f15101cd438f3c2d7732131551e", "score": "0.4576", "text": "func (iq *InviteeQuery) Order(o ...OrderFunc) *InviteeQuery {\n\tiq.order = append(iq.order, o...)\n\treturn iq\n}", "title": "" }, { "docid": "1ae83ab9d5db2b5bb80e8f1c9d0af276", "score": "0.45723194", "text": "func (i *OrderItem) Save() {\n\t// Add a new string array type variable called categoryList\n\titemList := []string{}\n\n\t// Append every element to the categoryList array\n\tfor c := range i.ItemOption {\n\t\titemList = append(itemList, i.ItemOption[c].Name)\n\t}\n\n\t// Concatenate the categoryList to a single string separated by comma\n\tjoinList := strings.Join(itemList, \", \")\n\n\t// Store the joined string to the CategoryList field\n\ti.ItemOptionList = joinList\n\n\t// Save it to the database\n\tuadmin.Save(i)\n}", "title": "" }, { "docid": "5ae4d7ef73d473886d30eb394f441576", "score": "0.45672354", "text": "func (b StandardBag) Items() []Item {\n\treturn b.items\n}", "title": "" }, { "docid": "58821aff701d11cf105e50ad1b9ef7b4", "score": "0.4557696", "text": "func (b *orderBehavior) ProcessEvent(e Event, emitter EventEmitter) {\n\tswitch e.Topic() {\n\tcase \"order\":\n\t\t// Command to perform order received from shop.\n\t\tfor _, orderItem := range b.openItems {\n\t\t\tstockCellId := NewId(\"stock\", orderItem.ItemNo)\n\t\t\tb.env.Subscribe(stockCellId, b.id)\n\t\t\tb.env.EmitSimple(stockCellId, \"order-item\", orderItem)\n\t\t}\n\tcase \"order-item\":\n\t\t// Item received from stock.\n\t\torderItem := e.Payload().(*OrderItem)\n\t\tb.providedItems[orderItem.ItemNo] = orderItem\n\t\tdelete(b.openItems, orderItem.ItemNo)\n\t\t// Check for open items. If none start delivery.\n\t\tif len(b.openItems) == 0 {\n\t\t\t// Deliver.\n\t\t\tshipment := &Shipment{b.orderNo, make(map[int]*ShipmentItem)}\n\t\t\tfor itemNo, orderItem := range b.providedItems {\n\t\t\t\tshipment.ShipmentItems[itemNo] = &ShipmentItem{\n\t\t\t\t\tShipmentNo: b.orderNo,\n\t\t\t\t\tItemNo: orderItem.ItemNo,\n\t\t\t\t\tQuantity: orderItem.Quantity,\n\t\t\t\t}\n\t\t\t}\n\t\t\temitter.EmitSimple(\"shipment\", shipment)\n\t\t\t// Remove cell, it's needed anymore.\n\t\t\tb.env.RemoveCell(b.id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92958af0bbefa65223f2c42e624bf116", "score": "0.45553336", "text": "func createOrder(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar order Order\n\t_ = json.NewDecoder(r.Body).Decode(&order)\n\torder.ID = strconv.Itoa(rand.Intn(10000000)) // Mock ID\n\torders = append(orders, order)\n\tjson.NewEncoder(w).Encode(order)\n\n}", "title": "" }, { "docid": "07f47289a2faef0b2684995f97199698", "score": "0.45550355", "text": "func (q *Query) BuildOrder() {\n\tif q.Query.Order != \"\" {\n\t\torderMap := map[string]interface{}{}\n\t\torders := strings.Split(q.Query.Order, \",\")\n\t\tfor _, item := range orders {\n\t\t\tif strings.HasPrefix(item, \"-\") {\n\t\t\t\torderMap[item] = -1\n\t\t\t} else {\n\t\t\t\torderMap[item] = 1\n\t\t\t}\n\t\t}\n\t\tq.Order = orderMap\n\t}\n}", "title": "" }, { "docid": "3915658f97d42ab195558c3cb34ef8b8", "score": "0.4544284", "text": "func MakeMoveOrder(db *pop.Connection, assertions Assertions) models.MoveOrder {\n\tgrade := assertions.MoveOrder.Grade\n\tif grade == nil || *grade == \"\" {\n\t\tgrade = stringPointer(MakeGrade())\n\t}\n\tcustomer := assertions.Customer\n\tif isZeroUUID(customer.ID) {\n\t\tcustomer = MakeCustomer(db, assertions)\n\t}\n\tentitlement := assertions.Entitlement\n\tif isZeroUUID(entitlement.ID) {\n\t\tassertions.MoveOrder.Grade = grade\n\t\tentitlement = MakeEntitlement(db, assertions)\n\t}\n\toriginDutyStation := assertions.OriginDutyStation\n\tif isZeroUUID(originDutyStation.ID) {\n\t\toriginDutyStation = MakeDutyStation(db, assertions)\n\t}\n\tdestinationDutyStation := assertions.DestinationDutyStation\n\tif isZeroUUID(destinationDutyStation.ID) {\n\t\tdestinationDutyStation = MakeDutyStation(db, assertions)\n\t}\n\n\torderNumber := assertions.MoveOrder.OrderNumber\n\tif orderNumber == nil || *orderNumber == \"\" {\n\t\torderNumber = stringPointer(\"ORDER123\")\n\t}\n\n\torderType := assertions.MoveOrder.OrderType\n\tif orderType == nil || *orderType == \"\" {\n\t\torderType = stringPointer(\"GHC\")\n\t}\n\n\torderTypeDetail := assertions.MoveOrder.OrderTypeDetail\n\tif orderTypeDetail == nil || *orderTypeDetail == \"\" {\n\t\torderTypeDetail = stringPointer(\"TBD\")\n\t}\n\n\treportByDate := assertions.MoveOrder.ReportByDate\n\n\tif reportByDate == nil || time.Time.IsZero(*reportByDate) {\n\t\treportByDate = models.TimePointer(time.Date(2020, time.February, 15, 0, 0, 0, 0, time.UTC))\n\t}\n\n\tdateIssued := assertions.MoveOrder.DateIssued\n\n\tif dateIssued == nil || time.Time.IsZero(*dateIssued) {\n\t\tdateIssued = models.TimePointer(time.Date(2020, time.January, 15, 0, 0, 0, 0, time.UTC))\n\t}\n\n\tlinesOfAccounting := \"F8E1\"\n\n\tmoveOrder := models.MoveOrder{\n\t\tCustomer: &customer,\n\t\tCustomerID: &customer.ID,\n\t\tConfirmationNumber: stringPointer(models.GenerateLocator()),\n\t\tDateIssued: dateIssued,\n\t\tEntitlement: &entitlement,\n\t\tEntitlementID: &entitlement.ID,\n\t\tDestinationDutyStation: &destinationDutyStation,\n\t\tDestinationDutyStationID: &destinationDutyStation.ID,\n\t\tGrade: grade,\n\t\tOriginDutyStation: &originDutyStation,\n\t\tOriginDutyStationID: &originDutyStation.ID,\n\t\tOrderNumber: orderNumber,\n\t\tOrderType: orderType,\n\t\tOrderTypeDetail: orderTypeDetail,\n\t\tReportByDate: reportByDate,\n\t\tLinesOfAccounting: &linesOfAccounting,\n\t}\n\n\t// Overwrite values with those from assertions\n\tmergeModels(&moveOrder, assertions.MoveOrder)\n\n\tmustCreate(db, &moveOrder)\n\n\treturn moveOrder\n}", "title": "" }, { "docid": "49ed5ebebc6cdcedf37dc0581b934101", "score": "0.45440954", "text": "func (mc *_modelCache) allOrdered() []*modelInfo {\n\tm := make([]*modelInfo, 0, len(mc.orders))\n\tfor _, table := range mc.orders {\n\t\tm = append(m, mc.cache[table])\n\t}\n\treturn m\n}", "title": "" }, { "docid": "52a8b4b9f817296fc86087f4d3dddddd", "score": "0.45433706", "text": "func (b *AddOnRequirementListBuilder) Items(values ...*AddOnRequirementBuilder) *AddOnRequirementListBuilder {\n\tb.items = make([]*AddOnRequirementBuilder, len(values))\n\tcopy(b.items, values)\n\treturn b\n}", "title": "" }, { "docid": "607de330eae6e62df0908bcb3d498697", "score": "0.45410585", "text": "func (b *Bitflyer) GetAllOrders() {\n\t// Needs to be updated\n}", "title": "" }, { "docid": "62de96e4ed9ef96491e5debc82acad90", "score": "0.4540789", "text": "func toItemSlice(items []newhorizons.ItemEntry, db *gorm.DB) []*newhorizons.Item {\n\tdupe := make(map[string]bool, 0)\n\tvar ret []*newhorizons.Item\n\tfor _, i := range items {\n\t\tif _, ok := dupe[i.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tn := findByName(i.Name, \"item\", db)\n\t\tdupe[i.Name] = true\n\t\tret = append(ret, i.ToGraphQL(n.Variants, n.HHAConcepts))\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "fbc67f08901acbbab23477dade3bfa00", "score": "0.4531642", "text": "func (p *POSend) ProcessPackage(dealerid int, dealerkey string) ([]byte, error) {\n\tdb := p.db\n\t//10.04.2013 naj - start a transaction\n\ttransaction, err := db.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//06.02.2013 naj - make a slice to hold the purchase orders\n\tr := make([]AcceptedOrder, 0, len(p.PurchaseOrders))\n\n\t//06.05.2015 ghh -because the system has the ability to push more than one purchase\n\t//order through at the same time it will loop through our array and process each\n\t//one separately\n\tfor i := 0; i < len(p.PurchaseOrders); i++ {\n\t\t//06.02.2013 naj - stick the current PO into a new variable to keep the name short.\n\t\tc := p.PurchaseOrders[i]\n\n\t\t//10.04.2013 naj - for now Merx will not use a preloaded price file and will just accept orders\n\t\t//good := make([]Parts, 0, len(c.Items))\n\t\t//bad := make([]ItemNote, 0, len(c.Items))\n\t\t//y := 0\n\t\t//z := 0\n\t\t//for x := 0; x < len(c.Items); x++ {\n\t\t//\t//07.12.2013 naj - Get the vendorid\n\t\t//\tvendorid, err := common.GetVendorID(db, p.bsvkeyid, c.Items[x].VendorCode)\n\t\t//\tif err != nil {\n\t\t//\t\tif err.Error() == \"No VendorCode found\" {\n\t\t//\t\t\tbad = bad[0 : len(bad)+1]\n\t\t//\t\t\tbad[y].VendorCode = c.Items[x].VendorCode\n\t\t//\t\t\tbad[y].PartNumber = c.Items[x].PartNumber\n\t\t//\t\t\tbad[y].Note = err.Error()\n\t\t//\t\t\ty++\n\t\t//\t\t\tcontinue\n\t\t//\t\t} else {\n\t\t//\t\t\treturn nil, err\n\t\t//\t\t}\n\t\t//\t}\n\n\t\t//\t//07.12.2013 naj - Get the part record\n\t\t//\titemid, superseded, nla, err := common.GetPart(db, vendorid, c.Items[x].PartNumber)\n\t\t//\tif err != nil {\n\t\t//\t\tif err.Error() == \"Unable to locate part number\" {\n\t\t//\t\t\tbad = bad[0 : len(bad)+1]\n\t\t//\t\t\tbad[y].VendorCode = c.Items[x].VendorCode\n\t\t//\t\t\tbad[y].PartNumber = c.Items[x].PartNumber\n\t\t//\t\t\tbad[y].Note = err.Error()\n\t\t//\t\t\ty++\n\t\t//\t\t\tcontinue\n\t\t//\t\t} else {\n\t\t//\t\t\treturn nil, err\n\t\t//\t\t}\n\t\t//\t}\n\n\t\t//\tswitch {\n\t\t//\tcase nla:\n\t\t//\t\tbad = bad[0 : len(bad)+1]\n\t\t//\t\tbad[y].VendorCode = c.Items[x].VendorCode\n\t\t//\t\tbad[y].PartNumber = c.Items[x].PartNumber\n\t\t//\t\tbad[y].NLA = 1\n\t\t//\t\ty++\n\t\t//\tcase superseded != \"\":\n\t\t//\t\tgood = good[0 : len(bad)+1]\n\t\t//\t\tgood[z].ItemID = itemid\n\t\t//\t\tgood[z].VendorCode = c.Items[x].VendorCode\n\t\t//\t\tgood[z].PartNumber = superseded\n\t\t//\t\tgood[z].Qty = c.Items[x].Qty\n\t\t//\t\tz++\n\t\t//\t\tbad = bad[0 : len(bad)+1]\n\t\t//\t\tbad[y].VendorCode = c.Items[x].VendorCode\n\t\t//\t\tbad[y].PartNumber = c.Items[x].PartNumber\n\t\t//\t\tbad[y].Superceded = 1\n\t\t//\t\tbad[y].Note = \"Part has been superseded by \" + superseded\n\t\t//\t\ty++\n\t\t//\tdefault:\n\t\t//\t\tgood = good[0 : len(good)+1]\n\t\t//\t\tgood[z].ItemID = itemid\n\t\t//\t\tgood[z].VendorCode = c.Items[x].VendorCode\n\t\t//\t\tgood[z].PartNumber = c.Items[x].PartNumber\n\t\t//\t\tgood[z].Qty = c.Items[x].Qty\n\t\t//\t\tz++\n\n\t\t//\t}\n\n\t\t//}\n\t\t////07.09.2013 naj - if we have no good parts the we do not want to accept this purchase order.\n\t\t//if len(good) == 0 {\n\t\t//\tcontinue\n\t\t//}\n\t\t////07.09.2013 naj - if we have bad parts make sure we put the details into the response object.\n\t\t//if len(bad) > 0 {\n\t\t//\tr[i].ItemNotes = bad\n\t\t//}\n\n\t\t//06.02.2013 naj - put the current PONumber into the response\n\t\tr = r[0 : len(r)+1]\n\t\tr[i].DealerPO = c.DealerPONumber\n\n\t\t//06.10.2014 naj - check to see if the po is already in the system.\n\t\t//If it is and it's not processed yet, delete the the po and re-enter it.\n\t\t//If it is and it's processed return an error.\n\t\tvar result sql.Result\n\t\tvar temppoid int\n\t\tvar tempstatus int\n\n\t\t//06.02.2015 ghh - first we grab the Ponumber that is being sent to use and we're going to see\n\t\t//if it has already been processed by the vendor\n\t\terr = transaction.QueryRow(`select ifnull(POID, 0 ), ifnull( Status, 0 ) \n\t\t\t\t\t\t\t\t\t\t\tfrom PurchaseOrders \n\t\t\t\t\t\t\t\t\t\t\twhere DealerID = ? and DealerPONumber = ?`,\n\t\t\t\t\tdealerid, c.DealerPONumber).Scan(&temppoid, &tempstatus)\n\n\t\t//case err == sql.ErrNoRows:\n\t\t//if we have a PO already there and its not been processed yet by the vendor then we're going\n\t\t//to delete it as we're uploading it a second time.\n\t\tif temppoid > 0{ \n\t\t\tif tempstatus == 0 { //has it been processed by vendor yet?\n\t\t\t\tresult, err = transaction.Exec(`delete from PurchaseOrders \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere DealerID=? \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand DealerPONumber=? `, dealerid, c.DealerPONumber )\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\t//now delete the items from the old $_POST[\n\t\t\t\tresult, err = transaction.Exec(`delete from PurchaseOrderItems \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere POID=? `, temppoid )\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//if we get here then we must have found an existing PO so lets log it and return\n\t\tif tempstatus > 0 {\n\t\t\terr = errors.New(\"Error: 16207 Purchase order already sent and pulled by vendor.\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err != sql.ErrNoRows {\n\t\t\t//if there was an error then return it\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\n\t\t//06.02.2013 naj - create the PO record in the database.\n\t\tresult, err = transaction.Exec(`insert into PurchaseOrders (\n\t\t\tDealerID, DealerPONumber, POReceivedDate, BillToFirstName, BillToLastName, BillToCompanyName, \n\t\t\tBillToAddress1, BillToAddress2, BillToCity, BillToState, BillToZip, \n\t\t\tBillToCountry, BillToPhone, BillToEmail, \n\t\t\tShipToFirstName, ShipToLastName, ShipToCompanyName, ShipToAddress1,\n\t\t\tShipToAddress2, ShipToCity, ShipToState, ShipToZip, ShipToCountry, \n\t\t\tShipToPhone, ShipToEmail, \n\t\t\tPaymentMethod, LastFour, ShipMethod) values \n\t\t\t(?, ?, curdate(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, \n\t\t\t?, ?, ?, ?, ?, ?, ? )`, \n\t\t\tdealerid, c.DealerPONumber,\n\t\t\tc.BillToFirstName, c.BillToLastName, c.BillToCompanyName, c.BillToAddress1, \n\t\t\tc.BillToAddress2, c.BillToCity, c.BillToState, c.BillToZip, c.BillToCountry, \n\t\t\tc.BillToPhone, c.BillToEmail,\n\t\t\tc.ShipToFirstName, c.ShipToLastName, c.ShipToCompanyName, c.ShipToAddress1, \n\t\t\tc.ShipToAddress2, c.ShipToCity, c.ShipToState, c.ShipToZip, c.ShipToCountry, \n\t\t\tc.ShipToPhone, c.ShipToEmail, c.PaymentMethod, c.LastFour, c.ShipMethod )\n\n\t\tif err != nil {\n\t\t\t//10.04.2013 naj - rollback transaction\n\t\t\t_ = transaction.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//06.02.2013 naj - get the POID assigned to the PO\n\t\tpoid, err := result.LastInsertId()\n\n\t\t//06.02.2013 naj - format the POID and put the assigned POID into the response\n\t\ttemp := strconv.FormatInt(poid, 10)\n\t\tif len(temp) < 6 {\n\t\t\ttemp = strings.Repeat(\"0\", 5-len(temp)) + temp\n\t\t}\n\n\t\tr[i].MerxPO = temp\n\t\tr[i].DealerKey = dealerkey\n\n\t\tif err != nil {\n\t\t\t//10.04.2013 naj - rollback transaction\n\t\t\t_ = transaction.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//10.04.2013 naj - for now Merx will not use a preloaded price file and will just accept orders\n\t\t//for j := 0; j < len(good); j++ {\n\t\t//\t//06.02.2013 naj - attach the parts to the current PO.\n\t\t//\t_, err := db.Exec(\"insert into PurchaseOrderItems (POID, PartNumber, VendorCode, ItemID, Quantity)\"+\n\t\t//\t\t\"value (?, ?, ?, ?, ?)\", poid, good[j].PartNumber, good[j].VendorCode, good[j].ItemID, good[j].Qty)\n\t\t//\tif err != nil {\n\t\t//\t\treturn nil, err\n\t\t//\t}\n\t\t//}\n\n\t\t//06.05.2015 ghh - now loop through the items array and insert all the parts for\n\t\t//the order\n\t\tfor j := 0; j < len(c.Items); j++ {\n\t\t\t//06.02.2013 naj - attach the parts to the current PO.\n\t\t\t_, err := transaction.Exec(`insert into PurchaseOrderItems (POID, PartNumber, VendorCode, \n\t\t\t\t\t\t\t\t\t\t\t\tQuantity) value (?, ?, ?, ?)`, \n\t\t\t\t\t\t\t\t\t\t\t\tpoid, c.Items[j].PartNumber, c.Items[j].VendorCode, \n\t\t\t\t\t\t\t\t\t\t\t\tc.Items[j].Qty)\n\t\t\tif err != nil {\n\t\t\t\t//10.04.2013 naj - rollback transaction\n\t\t\t\t_ = transaction.Rollback()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t//06.05.2015 ghh - now we'll take the array and marshal it back into a json\n\t//array to be returned to client\n\tif len(r) > 0 {\n\t\t//06.02.2013 naj - JSON Encode the response data.\n\t\tresp, err := json.Marshal(r)\n\n\t\tif err != nil {\n\t\t\t//10.04.2013 naj - rollback transaction\n\t\t\t_ = transaction.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//10.04.2013 naj - commit the transaction\n\t\terr = transaction.Commit()\n\t\tif err != nil {\n\t\t\t//10.04.2013 naj - rollback transaction\n\t\t\t_ = transaction.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn resp, nil\n\t} else {\n\t\t//10.04.2013 naj - rollback transaction\n\t\t_ = transaction.Rollback()\n\t\treturn nil, errors.New(\"No valid parts were in the purchase order\")\n\t}\n\n}", "title": "" }, { "docid": "7b742c9b6d06e86ca2235f3a07d3a814", "score": "0.452955", "text": "func (ix *IssueX1355Query) Order(o ...OrderFunc) *IssueX1355Query {\n\tix.order = append(ix.order, o...)\n\treturn ix\n}", "title": "" }, { "docid": "39d5ec1c3ad035b24e4e7a9883e6d948", "score": "0.45290774", "text": "func (s *Schedule) Ordered() []*Course {\n\tlist := make([]*Course, len(*s))\n\tfor _, c := range *s {\n\t\tlist[c.order] = c\n\t}\n\treturn list\n}", "title": "" }, { "docid": "e44864b181b82b9480fabf6befd2c225", "score": "0.45268545", "text": "func newOrderItemMutation(c config, op Op, opts ...orderitemOption) *OrderItemMutation {\n\tm := &OrderItemMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeOrderItem,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "ddc97866aa24b14e446106395da06828", "score": "0.4517272", "text": "func insertOrder(\n\tdb *sql.DB,\n\tbicycle itemStruct.Bicycle,\n\tcustomer peopleStruct.Customer,\n\temployee peopleStruct.Employee,\n\tdays int,\n\ttotalPrice float64,\n\torderAccessoryCollection []orderStruct.OrderAccessory) {\n\n\tquery := \"INSERT INTO OrderLine (bicycleId, customerId, employeeId, startDate, days, totalPrice) values (?, ?, ?, NOW(), ?, ?);\"\n\t_, err := db.Query(\n\t\tquery,\n\t\tbicycle.BicycleId(),\n\t\tcustomer.CustomerId(),\n\t\temployee.EmployeeId(),\n\t\tdays,\n\t\ttotalPrice)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tquery = \"SELECT orderLineId FROM OrderLine WHERE bicycleId = ? AND customerId = ? AND employeeId = ? ORDER BY orderLineId DESC LIMIT 1\"\n\tresult, err := db.Query(\n\t\tquery,\n\t\tbicycle.BicycleId(),\n\t\tcustomer.CustomerId(),\n\t\temployee.EmployeeId())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif result.Next() {\n\t\tvar orderLineId int\n\t\terr := result.Scan(&orderLineId)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor _, orderAccessory := range orderAccessoryCollection {\n\t\t\tinsertOrderAccessory(db, orderAccessory, orderLineId)\n\t\t}\n\t}\n\tresult.Close()\n}", "title": "" }, { "docid": "c7f1a7ebcbf1e7cb5f2ecc69a892c670", "score": "0.45147127", "text": "func (p *Profile) ItemSort() error {\n\tif p.config == nil {\n\t\treturn nil\n\t}\n\tp.items = make(map[string]*ini.File)\n\tvar itemName string\n\tfor _, section := range p.config.Sections() {\n\t\tfor _, key := range section.Keys() {\n\t\t\tif section.Name() == \"main\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif section.Name() == \"DEFAULT\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif section.Name() == \"inputs\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif section.Name() == \"tip\" {\n\t\t\t\titemName = key.Value()\n\t\t\t} else {\n\t\t\t\titemQuery, err := sqlstore.GetPropertyItem(key.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"key %s is not exist in tuned_item\", key.Name())\n\t\t\t\t\titemName = \"OTHERS\"\n\t\t\t\t} else {\n\t\t\t\t\titemName = itemQuery\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif _, ok := p.items[itemName]; !ok {\n\t\t\t\tp.items[itemName] = ini.Empty()\n\t\t\t}\n\t\t\tif itemSection := p.items[itemName].Section(section.Name()); itemSection == nil {\n\t\t\t\t_, _ = p.items[itemName].NewSection(section.Name())\n\t\t\t}\n\t\t\titemSection, _ := p.items[itemName].GetSection(section.Name())\n\t\t\t_, _ = itemSection.NewKey(key.Name(), key.Value())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed4a6bcf885ca6f9243692ea0146efcf", "score": "0.45133927", "text": "func (g *orderedIDs) GetOrder() []interface{} {\n\torder := g.order.GetOrder()\n\tordered := make([]interface{}, len(order))\n\tfor i := 0; i < len(order); i++ {\n\t\tordered[i] = g.items[order[i]]\n\t}\n\n\treturn ordered\n}", "title": "" }, { "docid": "27d8ec164c8deb087a1ba5edb0eef177", "score": "0.45081282", "text": "func (c *Callback) reorder() {\n\tvar creates, updates, deletes, queries, rowQueries []*CallbackProcessor\n\n\tfor _, processor := range c.processors {\n\t\tif processor.name != \"\" {\n\t\t\tswitch processor.kind {\n\t\t\tcase \"create\":\n\t\t\t\tcreates = append(creates, processor)\n\t\t\tcase \"update\":\n\t\t\t\tupdates = append(updates, processor)\n\t\t\tcase \"delete\":\n\t\t\t\tdeletes = append(deletes, processor)\n\t\t\tcase \"query\":\n\t\t\t\tqueries = append(queries, processor)\n\t\t\tcase \"row_query\":\n\t\t\t\trowQueries = append(rowQueries, processor)\n\t\t\t}\n\t\t}\n\t}\n\n\tc.creates = sortProcessors(creates)\n\tc.updates = sortProcessors(updates)\n\tc.deletes = sortProcessors(deletes)\n\tc.queries = sortProcessors(queries)\n\tc.rowQueries = sortProcessors(rowQueries)\n}", "title": "" }, { "docid": "297c88d89bfeaf57ec05416dc3927999", "score": "0.45011854", "text": "func ItemSortImages(c *gin.Context) {\n\tid := c.Param(\"id\")\n\titem := models.NewItem()\n\tnum, _ := strconv.Atoi(id)\n\tif ok := models.GetItem(num, item); !ok {\n\t\tc.String(http.StatusNotFound, \"Not Found\")\n\t\treturn\n\t}\n\tif !auth.CheckACLAccess(c, item) {\n\t\treturn\n\t}\n\terr := c.Bind(item)\n\tcheck(err)\n\tmodels.SaveItem(item, nil)\n\tc.String(http.StatusOK, \"OK\")\n}", "title": "" }, { "docid": "3caf8a23b3288468e1027d4f13508c41", "score": "0.4496312", "text": "func (o CreateACartCreatedBodyLineItemsItems0DigitalItemsItems0) MarshalJSON() ([]byte, error) {\n\t_parts := make([][]byte, 0, 2)\n\n\tvar dataAO0 struct {\n\t\tCouponAmount float64 `json:\"coupon_amount,omitempty\"`\n\n\t\tCoupons []*CreateACartCreatedBodyLineItemsItems0DigitalItemsItems0CouponsItems0 `json:\"coupons\"`\n\n\t\tDiscountAmount float64 `json:\"discount_amount,omitempty\"`\n\n\t\tDiscounts []*CreateACartCreatedBodyLineItemsItems0DigitalItemsItems0DiscountsItems0 `json:\"discounts\"`\n\n\t\tExtendedListPrice float64 `json:\"extended_list_price,omitempty\"`\n\n\t\tExtendedSalePrice float64 `json:\"extended_sale_price,omitempty\"`\n\n\t\tID string `json:\"id,omitempty\"`\n\n\t\tImageURL strfmt.URI `json:\"image_url,omitempty\"`\n\n\t\tIsTaxable bool `json:\"is_taxable,omitempty\"`\n\n\t\tListPrice float64 `json:\"list_price,omitempty\"`\n\n\t\tName string `json:\"name,omitempty\"`\n\n\t\tOptions []*CreateACartCreatedBodyLineItemsItems0DigitalItemsItems0OptionsItems0 `json:\"options\"`\n\n\t\tProductID *float64 `json:\"product_id\"`\n\n\t\tQuantity *float64 `json:\"quantity\"`\n\n\t\tSalePrice float64 `json:\"sale_price,omitempty\"`\n\n\t\tSku string `json:\"sku,omitempty\"`\n\n\t\tURL strfmt.URI `json:\"url,omitempty\"`\n\n\t\tVariantID *float64 `json:\"variant_id\"`\n\t}\n\n\tdataAO0.CouponAmount = o.CouponAmount\n\n\tdataAO0.Coupons = o.Coupons\n\n\tdataAO0.DiscountAmount = o.DiscountAmount\n\n\tdataAO0.Discounts = o.Discounts\n\n\tdataAO0.ExtendedListPrice = o.ExtendedListPrice\n\n\tdataAO0.ExtendedSalePrice = o.ExtendedSalePrice\n\n\tdataAO0.ID = o.ID\n\n\tdataAO0.ImageURL = o.ImageURL\n\n\tdataAO0.IsTaxable = o.IsTaxable\n\n\tdataAO0.ListPrice = o.ListPrice\n\n\tdataAO0.Name = o.Name\n\n\tdataAO0.Options = o.Options\n\n\tdataAO0.ProductID = o.ProductID\n\n\tdataAO0.Quantity = o.Quantity\n\n\tdataAO0.SalePrice = o.SalePrice\n\n\tdataAO0.Sku = o.Sku\n\n\tdataAO0.URL = o.URL\n\n\tdataAO0.VariantID = o.VariantID\n\n\tjsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)\n\tif errAO0 != nil {\n\t\treturn nil, errAO0\n\t}\n\t_parts = append(_parts, jsonDataAO0)\n\tvar dataAO1 struct {\n\t\tDownloadFileUrls []string `json:\"download_file_urls\"`\n\n\t\tDownloadPageURL string `json:\"download_page_url,omitempty\"`\n\n\t\tDownloadSize string `json:\"download_size,omitempty\"`\n\t}\n\n\tdataAO1.DownloadFileUrls = o.DownloadFileUrls\n\n\tdataAO1.DownloadPageURL = o.DownloadPageURL\n\n\tdataAO1.DownloadSize = o.DownloadSize\n\n\tjsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)\n\tif errAO1 != nil {\n\t\treturn nil, errAO1\n\t}\n\t_parts = append(_parts, jsonDataAO1)\n\treturn swag.ConcatJSON(_parts...), nil\n}", "title": "" }, { "docid": "599be3d058fc1e615a8edca0a13917fa", "score": "0.4492865", "text": "func (p *Product) CanBeOrdered(quantity int) (bool, *errors.Error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tif quantity <= 0 {\n\t\treturn false, errors.Wrap(fmt.Errorf(\"Can't order product (id: %v) with quantity %d\", p.id, quantity), 0)\n\t}\n\tif p.status != StatusAvailable {\n\t\treturn false, errors.Wrap(fmt.Errorf(\"Product (id: %v) status is not available\", p.id), 0)\n\t}\n\tif p.stock-int64(quantity) < 0 {\n\t\treturn false, errors.Wrap(fmt.Errorf(\"Product (id: %v) stock %d does not have enough quantity %d\", p.id, p.stock, quantity), 0)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "dfc37756778662baf77b68617b8f6fa9", "score": "0.44908866", "text": "func (scsq *SurveyCellScanQuery) Order(o ...Order) *SurveyCellScanQuery {\n\tscsq.order = append(scsq.order, o...)\n\treturn scsq\n}", "title": "" }, { "docid": "cd29d633f0daede00df5961942f50c3b", "score": "0.4488325", "text": "func (ciq *CoinInfoQuery) Order(o ...OrderFunc) *CoinInfoQuery {\n\tciq.order = append(ciq.order, o...)\n\treturn ciq\n}", "title": "" }, { "docid": "1f4b10e3357cfb569dba92b3fb9a17eb", "score": "0.4477482", "text": "func (m *OrderMutation) OrderItemsIDs() (ids []int) {\n\tfor id := range m.orderItems {\n\t\tids = append(ids, id)\n\t}\n\treturn\n}", "title": "" } ]
a798bccb91fcaaaa3072d82aac666003
NewNiche returns an identifiable niche that's unique in this universe. Niche is considered a component of the Species.
[ { "docid": "c041b64c7c1879d3d2298048deea7cfc", "score": "0.83108425", "text": "func (univ *Universe) NewNiche() (habitat *Niche) {\r\n\tv := Niche(univ.NicheCount)\r\n\thabitat = &v\r\n\tuniv.NicheCount++\r\n\treturn habitat\r\n}", "title": "" } ]
[ { "docid": "8827af599f93b02e3799daca41f6100e", "score": "0.72318745", "text": "func (s *Species) Niche() Niche {\r\n\treturn s.ID\r\n}", "title": "" }, { "docid": "9577ce53399a2c0bbbd460322f5b0732", "score": "0.6095194", "text": "func NewSpecies(id Niche, livings []*Organism) *Species {\r\n\tif livings == nil {\r\n\t\tlivings = []*Organism{}\r\n\t}\r\n\treturn &Species{\r\n\t\tID: id,\r\n\t\tLivings: livings,\r\n\t\tStagnancy: 0,\r\n\t\tTopFitness: 0,\r\n\t}\r\n}", "title": "" }, { "docid": "50c7e7f54f959582da0acc9958c9b68f", "score": "0.57740057", "text": "func (univ *Universe) NewSpecies(livings []*Organism) *Species {\r\n\treturn NewSpecies(*univ.NewNiche(), livings)\r\n}", "title": "" }, { "docid": "367601d1b18832bbfc915a51bfe42a20", "score": "0.56968266", "text": "func NewNisInstance(basePath string, network byte) *ClientConfig {\n // create the config. It'll be used for all objects.\n newNisInstance := &ClientConfig {\n BasePath : basePath,\n Network: network,\n AccountApi: api.NewAccountApi(basePath),\n NisApi: api.NewNisApi(basePath),\n BlockchainApi: api.NewBlockchainApi(basePath),\n NamespaceMosaicsApi: api.NewNamespaceMosaicsApi(basePath),\n NodeApi: api.NewNodeApi(basePath),\n TransactionApi: api.NewTransactionApi(basePath),\n }\n return newNisInstance\n}", "title": "" }, { "docid": "827ea969417f8b146f8aa0bb9a61c7b7", "score": "0.5647222", "text": "func NewNseEquity(on time.Time) Resource { return &NseEquityResource{date: on} }", "title": "" }, { "docid": "6514d736d110c0c2242be97f4df4ecde", "score": "0.5592722", "text": "func (univ *Universe) NewInnovation() (innovation *Innovation) {\r\n\tv := Innovation(univ.Innovation)\r\n\tinnovation = &v\r\n\tuniv.Innovation++\r\n\treturn innovation\r\n}", "title": "" }, { "docid": "8af8de7ae21e5adde3d54374c0496d7d", "score": "0.5583403", "text": "func (conn *Conn) NewNick(nick, ident, name, host string) *Nick {\n\tn := &Nick{Nick: nick, Ident: ident, Name: name, Host: host, conn: conn}\n\tn.initialise()\n\tconn.nicks[n.Nick] = n\n\treturn n\n}", "title": "" }, { "docid": "053b165ed041d5164c2ea9ea4034bbac", "score": "0.5537198", "text": "func New(apiKey string) *Neis {\n\tn := Neis{\n\t\tapiKey: apiKey,\n\t}\n\n\treturn &n\n}", "title": "" }, { "docid": "bb72752525f85b4b700ed42407619c54", "score": "0.5512069", "text": "func (suite *reconUtilSuite) reconUtilSuiteNewNuxeo() *v1alpha1.Nuxeo {\n\treturn &v1alpha1.Nuxeo{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: suite.nuxeoName,\n\t\t\tNamespace: suite.namespace,\n\t\t\tUID: suite.nuxeoUID,\n\t\t},\n\t\t// whatever else is needed for the suite\n\t\tSpec: v1alpha1.NuxeoSpec{},\n\t}\n}", "title": "" }, { "docid": "26d1c3ec6f0962096cb4b20618001879", "score": "0.55005", "text": "func newNetwork(id *C.char) C.int {\n\tID := C.GoString(id)\n\treturn C.int(Iodine.NewNetwork(ID))\n}", "title": "" }, { "docid": "d11830a0b0ade225cfaf92bfca637ade", "score": "0.5471692", "text": "func (st *stateTracker) NewNick(n string) *Nick {\n\tif n == \"\" {\n\t\tlogging.Warn(\"Tracker.NewNick(): Not tracking empty nick.\")\n\t\treturn nil\n\t}\n\tst.mu.Lock()\n\tdefer st.mu.Unlock()\n\tif _, ok := st.nicks[n]; ok {\n\t\tlogging.Warn(\"Tracker.NewNick(): %s already tracked.\", n)\n\t\treturn nil\n\t}\n\tst.nicks[n] = newNick(n)\n\treturn st.nicks[n].Nick()\n}", "title": "" }, { "docid": "f3829184ad9d483a8f8df0021c90df31", "score": "0.5429543", "text": "func NewNFSe(c Cliente, s Servico, v float64, a Ambiente) *NFSe {\n\treturn &NFSe{\n\t\tIdExterno: newUUID(),\n\t\tTipo: \"NFS-e\",\n\t\tAmbiente: a,\n\t\tEnviarPorEmail: true,\n\t\tCliente: c,\n\t\tServico: s,\n\t\tValorTotal: v,\n\t}\n}", "title": "" }, { "docid": "b72674005e541f8519bd316d694f6a4b", "score": "0.53598464", "text": "func NewNutter() Nutter {\n\t// We do not need to store the key here\n\t// as we never verify the nuts encryption.\n\t//\n\t// We could in the future use a nutter that\n\t// stored some information, allowing us to\n\t// avoid unnecessary calls to the nut cache.\n\tanyKey := randBytes(56)\n\tcipher, err := blowfish.NewCipher(anyKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &blowfishNutter{\n\t\tcipher: cipher,\n\t}\n}", "title": "" }, { "docid": "0265b6c8b6bb940625641a7957978649", "score": "0.5279907", "text": "func newJuliaN() xirho.Func {\n\treturn &JuliaN{Power: 3, Dist: 1}\n}", "title": "" }, { "docid": "0ddc509674660df712eb44514fb5a294", "score": "0.52596754", "text": "func NewNonce() Nonce {\n\tnonce := make(chan int64)\n\tgo func() {\n\t\tfor i := int64(0); i < math.MaxInt64; i++ {\n\t\t\tnonce <- i\n\t\t}\n\t}()\n\treturn nonce\n}", "title": "" }, { "docid": "477ee4ddd3783064e61044224d79adc6", "score": "0.5231511", "text": "func New(n int) UF {\n\ti := 0\n\tuf := UF{ID: make([]int, n)}\n\tfor ; i < n; i++ {\n\t\tuf.ID[i] = i\n\t}\n\treturn uf\n}", "title": "" }, { "docid": "1a0ce0b8cecdfafdd60ea3417ae1d21c", "score": "0.51790756", "text": "func New(list []Poem) *Suit {\n\treturn &Suit{list: list}\n}", "title": "" }, { "docid": "eaf78b75dad05cc87c4b2a6b897e242d", "score": "0.51486087", "text": "func UINodeNew(w http.ResponseWriter, r *http.Request) {\n\tdefer common.Recover()\n\n\tp := &ui.Page{\n\t\tTitle: \"New Node\",\n\t\tURL: strings.Split(r.URL.Path, \"/\"),\n\t}\n\n\tt := ui.GetTemplate(\"nodesNew\")\n\terr := t.ExecuteTemplate(w, \"base\", p)\n\tcommon.ErrorWriter(w, err)\n}", "title": "" }, { "docid": "04cf045a98f0938f68cd14f9f4f7f02a", "score": "0.51027405", "text": "func newNginxes(c *NginxV1alpha1Client, namespace string) *nginxes {\n\treturn &nginxes{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "eeb20bb639be5f0c152dc078cce7e4d9", "score": "0.5092813", "text": "func (sg *SchnorrGroup) New(n int64) {\n\tvar ONE = new(big.Int).SetInt64(1)\n\tvar TWO = new(big.Int).SetInt64(2)\n\tnext := true\n\tfor next {\n\t\ts := big.Int{}\n\t\ts.SetInt64(n)\n\t\tq := CreateRandomPrime(s)\n\t\tp := big.Int{}\n\t\tp.Mul(TWO, &q)\n\t\tp.Add(&p, ONE)\n\n\t\tsg.p = p\n\t\tsg.q = q\n\n\t\tif p.ProbablyPrime(40) {\n\t\t\tnext = false\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2e4316895a86054dde976e29542fb179", "score": "0.50919515", "text": "func CreateNoncer(n naet.GetAccounter) Noncer {\n\treturn func(accountID string) (nextNonce uint64, err error) {\n\t\ta, err := n.GetAccount(accountID)\n\t\tif err != nil {\n\t\t\tif err.Error() == \"Account not found\" {\n\t\t\t\tnextNonce = 0\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tnextNonce = *a.Nonce + 1\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5718d52a8d7731c2a062b06e331cda26", "score": "0.50626266", "text": "func NewNitroClient(url string, username string, password string, ignoreCert bool) (*NitroClient, error) {\n\tc := new(NitroClient)\n\n\tc.url = strings.Trim(url, \" /\") + \"/nitro/v1/\"\n\n\tc.username = username\n\tc.password = password\n\n\tjar, err := cookiejar.New(nil)\n\tif err != nil {\n\t\treturn c, errors.Wrap(err, \"error creating cookiejar\")\n\t}\n\n\tc.client = &http.Client{\n\t\tTimeout: 10 * time.Second,\n\t\tJar: jar,\n\t}\n\n\tif ignoreCert {\n\t\ttranspCfg := &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t}\n\n\t\tc.client.Transport = transpCfg\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "c6f06ca488acfa2518a6b32896da96e5", "score": "0.50577456", "text": "func (t *System_Cpu) GetOrCreateNice() *System_Cpu_Nice {\n\tif t.Nice != nil {\n\t\treturn t.Nice\n\t}\n\tt.Nice = &System_Cpu_Nice{}\n\treturn t.Nice\n}", "title": "" }, { "docid": "b1df1a06b877e0f3ec47eabde41fc26c", "score": "0.5046154", "text": "func NewNetwork(id string, name string) *Network {\n\tthis := Network{}\n\tthis.Id = id\n\tthis.Name = name\n\treturn &this\n}", "title": "" }, { "docid": "f255a623b7cdfc5759db3a7487b51a46", "score": "0.50191116", "text": "func newDisc() xirho.Func {\n\treturn Disc{}\n}", "title": "" }, { "docid": "6e33cfd66a7251c1254404a6579cdc49", "score": "0.49931782", "text": "func New(cnt string) (Surefire, error) {\n\ts := Surefire{}\n\tc, err := Decode(strings.NewReader(cnt))\n\ts.Content = c\n\treturn s, err\n}", "title": "" }, { "docid": "807e4c8db27e088600365832023ac25b", "score": "0.49832487", "text": "func newParent(ident string) *ParentNode {\n\treturn &ParentNode{NodeType: NodeParent, Ident: ident}\n}", "title": "" }, { "docid": "fa7cfdeb70cb512ce49492798a1c24ba", "score": "0.49609578", "text": "func newSigNonce() (sigNonce, error) {\n\tvar n sigNonce\n\tif _, err := rand.Read(n[:]); err != nil {\n\t\treturn sigNonce{}, err\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "7fa67919d597d1e80fb3d31e706533ae", "score": "0.4954101", "text": "func newNonce(db nosql.DB) (*nonce, error) {\n\t_id, err := randID()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tid := base64.RawURLEncoding.EncodeToString([]byte(_id))\n\tn := &nonce{\n\t\tID: id,\n\t\tCreated: clock.Now(),\n\t}\n\tb, err := json.Marshal(n)\n\tif err != nil {\n\t\treturn nil, ServerInternalErr(errors.Wrap(err, \"error marshaling nonce\"))\n\t}\n\t_, swapped, err := db.CmpAndSwap(nonceTable, []byte(id), nil, b)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, ServerInternalErr(errors.Wrap(err, \"error storing nonce\"))\n\tcase !swapped:\n\t\treturn nil, ServerInternalErr(errors.New(\"error storing nonce; \" +\n\t\t\t\"value has changed since last read\"))\n\tdefault:\n\t\treturn n, nil\n\t}\n}", "title": "" }, { "docid": "87a48bc9d5409c56375f95d93fecc0d4", "score": "0.4942455", "text": "func NewNNEvo(config *Config) *NNEvo {\n\tif config.Population < config.Elites {\n\t\tpanic(\"Incapable of taking more elites than entire population.\")\n\t}\n\tnet := new(NNEvo)\n\tnet.goal = config.Goal\n\tnet.mxrt = config.Mxrt\n\tnet.elites = config.Elites\n\tnet.metric = config.Metric\n\tnet.generations = config.Generations\n\tnet.population = make([]*Network, config.Population)\n\tif !contains(validMetrics, net.metric) {\n\t\tpanic(\"Invalid metric.\")\n\t}\n\treturn net\n}", "title": "" }, { "docid": "f7116093e6ba75a713810eeb737484e9", "score": "0.49397096", "text": "func New(rater rater, closingTimeout time.Duration) *Vishnu {\n\t// TODO David: Needs default rater based on __execution_time\n\tvishnu := Vishnu{nil, rater, closingTimeout}\n\treturn &vishnu\n}", "title": "" }, { "docid": "d2b9537df02fb096db3b19b9c17fa9e9", "score": "0.49039716", "text": "func (g *Grammar) NewNonTerminal(name string) NonTerminalDefinition {\n\tn := &nonTerminal{\n\t\tname: name,\n\t\tproductions: make([]nonTerminalRHS, 0, 2),\n\t}\n\tg.nonTerminals = append(g.nonTerminals, n)\n\tg.nonTerminalsByName[n.name] = n\n\treturn n\n}", "title": "" }, { "docid": "e588b2ad7bdd0df4a7efcd61e06ca193", "score": "0.48859188", "text": "func (d *Nic) new() Device {\n\treturn &Nic{}\n}", "title": "" }, { "docid": "49320e781f4cb8b1f4a66d52eb12b001", "score": "0.48827496", "text": "func NewNonce(args ...interface{}) (n *Nonce) {\n return makeNonce(int64(time.Now().Nanosecond()), args)\n}", "title": "" }, { "docid": "4f617de7e86b616d3b6b746cb766c2ce", "score": "0.4876314", "text": "func (c *Client) NewNetwork() *Network {\n\treturn &Network{client: c}\n}", "title": "" }, { "docid": "008839f70ec30b3f059f9c5be8e021e0", "score": "0.4874206", "text": "func (p *Player) genNationality() {\n\tp.Nationality = rand.Intn(Spain) + 1\n}", "title": "" }, { "docid": "abbbdabcccadb23a48ac9fc94979f454", "score": "0.48275676", "text": "func Niladic() Signature {\n\treturn niladic{}\n}", "title": "" }, { "docid": "bcb0ce63bf7f7afe053888579a55471c", "score": "0.48092964", "text": "func NewNats() *Nats {\n\tnats := &Nats{}\n\treturn nats\n}", "title": "" }, { "docid": "2040ab9622b10c47058351f456faba46", "score": "0.47905487", "text": "func NewFenwick(n int) *Fenwick {\n\tfen := &Fenwick{\n\t\ttree: make([]int, n),\n\t}\n\tfor i := range fen.tree {\n\t\tfen.tree[i] = 1\n\t}\n\treturn fen\n}", "title": "" }, { "docid": "fdceeba7785e154a2c65d0dda025e1c0", "score": "0.47839642", "text": "func NewNintendoPresence() *NintendoPresence {\n\treturn &NintendoPresence{}\n}", "title": "" }, { "docid": "32cac2da0fa170a6b38f85a00160b41f", "score": "0.4782554", "text": "func NewIdentifier(typ NodeType, ident string) *IdentifierNode {\n\treturn &IdentifierNode{NodeType: typ, Ident: ident}\n}", "title": "" }, { "docid": "c34cfd8d3cf8904be75c2ffa82d0d749", "score": "0.4780397", "text": "func (n NicIn) CreateNIC() (nic network.Interface, err error) {\n\n\tnicParams := network.Interface{\n\t\t\tName: to.StringPtr(n.NicName),\n\t\t\tLocation: to.StringPtr(n.Location),\n\t\t\tInterfacePropertiesFormat: &network.InterfacePropertiesFormat{\n\t\t\t\tIPConfigurations: &[]network.InterfaceIPConfiguration{\n\t\t\t\t\t{\n\t\t\t\t\t\tName: to.StringPtr(n.NicName + \"-ipConfig1\"),\n\t\t\t\t\t\tInterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{\n\t\t\t\t\t\t\tSubnet: &network.Subnet{\n\t\t\t\t\t\t\t\tID: to.StringPtr(n.SubnetID),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tPrivateIPAllocationMethod: network.Dynamic,\n\t\t\t\t\t\t\tPublicIPAddress: &network.PublicIPAddress{\n\t\t\t\t\t\t\t\tID: to.StringPtr(n.IpID),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n if n.NsgID != \"\" {\n nicParams.NetworkSecurityGroup = &network.SecurityGroup{\n ID: to.StringPtr(n.NsgID),\n }\n }\n\n nicClient := getNicClient()\n future, err := nicClient.CreateOrUpdate(\n ctx,\n n.ResourceGroup,\n n.NicName,\n nicParams,\n )\n\n\tif err != nil {\n\t\treturn nic, fmt.Errorf(\"cannot create nic: %v\", err)\n\t}\n\n\terr = future.WaitForCompletion(ctx, nicClient.Client)\n\tif err != nil {\n\t\treturn nic, fmt.Errorf(\"cannot get nic create or update future response: %v\", err)\n\t}\n\n\treturn future.Result(nicClient)\n}", "title": "" }, { "docid": "1003f831bfd24d6c6910e0f1a84ae47d", "score": "0.47789234", "text": "func NewNetI(args ...interface{}) *Net {\n return &Net{js.Global.Get(\"Phaser\").Get(\"Net\").New(args)}\n}", "title": "" }, { "docid": "ee6253930e7aada8c945172de535fe0b", "score": "0.47787932", "text": "func newMockNoncer() *mockNoncer {\n\tvar n mockNoncer\n\tcopy(n.t[:], mustDecodeHex(\"646170742073696773207220776f6f742120747920412e506f656c7374726121\"))\n\tcopy(n.u[:], mustDecodeHex(\"42526f5567685420746f2075206279204465637265442b6d407468657573645f\"))\n\treturn &n\n}", "title": "" }, { "docid": "80d652eaf019849c33cbb3047d76f218", "score": "0.47718555", "text": "func (univ *Universe) NewSpeciesBasic() *Species {\r\n\treturn univ.NewSpecies(nil)\r\n}", "title": "" }, { "docid": "8560658f791fa41a8519b6bba23f612f", "score": "0.4770486", "text": "func NewID() string {\n\tonce.Do(func() {\n\t\tvar err error\n\t\tnode, err = snowflake.NewNode(1)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t})\n\n\treturn node.Generate().String()\n}", "title": "" }, { "docid": "d5b511f905e98c64a1620cf2e450bbec", "score": "0.47665197", "text": "func NewNiaapiSoftwareRegex(classId string, objectType string) *NiaapiSoftwareRegex {\n\tthis := NiaapiSoftwareRegex{}\n\tthis.ClassId = classId\n\tthis.ObjectType = objectType\n\treturn &this\n}", "title": "" }, { "docid": "1d0b68debe5ad446a7dd5ee878ba090b", "score": "0.47565758", "text": "func New(uf string) (CUF, error) {\n\tconst op = errors.Op(\"cuf.New\")\n\tufInt, err := parseUF(uf)\n\n\tif err != nil {\n\t\treturn CUF{}, errors.E(op, err)\n\t}\n\treturn CUF{true, ufInt}, nil\n}", "title": "" }, { "docid": "03621da50a5696868b339d9193ab8b85", "score": "0.47549018", "text": "func NewNHL() *NHL {\n\tcommands := []command.Command{}\n\tset, err := command.NewSet(commands)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient := nhl_client.NewHTTPClient(\"https://statsapi.web.nhl.com\")\n\treturn &NHL{\n\t\tclient: client,\n\t\tteamCache: NewTeamCache(client),\n\t\tcommands: set,\n\t}\n}", "title": "" }, { "docid": "498a5b554d1b42f48dc9c0ed743897f1", "score": "0.47522128", "text": "func (m *FormMutation) SetNationalite(s string) {\n\tm._Nationalite = &s\n}", "title": "" }, { "docid": "dcc3f3294d43778bc01103f9fa051faa", "score": "0.4732474", "text": "func NewNFInstanceID(id []byte) *IE {\n\treturn New(NFInstanceID, id[:16])\n}", "title": "" }, { "docid": "fe1624748256fefef1f0d433681bd063", "score": "0.47309694", "text": "func New(v *nvim.Nvim, name string) *Nimvle {\n\treturn &Nimvle{\n\t\tv: v,\n\t\tpluginName: name,\n\t}\n}", "title": "" }, { "docid": "46f1ccc305a5fbb41e88c888fa74579a", "score": "0.47281492", "text": "func NewIGameInventory(c *Client) (*IGameInventory, error) {\n\tsi, err := SchemaIGameInventory.Get(schema.InterfaceKey{Name: \"IGameInventory\"})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &IGameInventory{\n\t\tClient: c,\n\t\tInterface: si,\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "70819ff4db10944bf7e950177355e6cf", "score": "0.47217503", "text": "func CreateNIC(ctx context.Context, location, groupName string, subnet network.Subnet, ip network.PublicIPAddress, nicClient network.InterfacesClient) (nic network.Interface, err error) {\n\tnicName := \"bastionE2ENIC\"\n\n\tfuture, err := nicClient.CreateOrUpdate(ctx, groupName, nicName, network.Interface{\n\t\tName: to.StringPtr(nicName),\n\t\tLocation: to.StringPtr(location),\n\t\tInterfacePropertiesFormat: &network.InterfacePropertiesFormat{\n\t\t\tIPConfigurations: &[]network.InterfaceIPConfiguration{\n\t\t\t\t{\n\t\t\t\t\tName: to.StringPtr(\"ipConfig1\"),\n\t\t\t\t\tInterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{\n\t\t\t\t\t\tSubnet: &subnet,\n\t\t\t\t\t\tPrivateIPAllocationMethod: network.Dynamic,\n\t\t\t\t\t\tPublicIPAddress: &ip,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nic, fmt.Errorf(\"cannot create nic: %v\", err)\n\t}\n\n\terr = future.WaitForCompletionRef(ctx, nicClient.Client)\n\tif err != nil {\n\t\treturn nic, fmt.Errorf(\"cannot get nic create or update future response: %v\", err)\n\t}\n\n\treturn future.Result(nicClient)\n}", "title": "" }, { "docid": "7c69c03f311eca94208ac0bf65faadd3", "score": "0.47193286", "text": "func NewInterface(n string) *Iface {\n\treturn &Iface{name: n}\n}", "title": "" }, { "docid": "a4e01ead7c338ec84e7271c215036a44", "score": "0.47180718", "text": "func NewNonTerminal(name string) *NonTerminal {\n\tnt := &NonTerminal{\n\t\tName: name,\n\t\tChildren: make([]Queryable, 0),\n\t\tAttributes: make(map[string][]string),\n\t}\n\tnt.SetAttribute(\"class\", \"nonterm\")\n\treturn nt\n}", "title": "" }, { "docid": "c8689577c07edfce4c5ac6d2a4851621", "score": "0.47162628", "text": "func (cc *Chaincode) createNewCitizen(stub shim.ChaincodeStubInterface, params []string) sc.Response {\n\t// check Access\n\n\t// Check if sufficient params are passed.\n\tif len(params) != 8 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 8\")\n\t}\n\n\t// Check if params are non-empty.\n\tfor a := 0; a < 8; a++ {\n\t\tif len(params[a]) <= 0 {\n\t\t\treturn shim.Error(\"Argument must be a non-empty string\")\n\t\t}\n\t}\n\n\tid := params[0]\n\tname := strings.ToLower(params[1])\n\tage, err := strconv.Atoi(params[2])\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tdob := params[3]\n\tgender := strings.ToLower(params[4])\n\taddress := strings.ToLower(params[5])\n\tmobilenumber := strings.ToLower(params[6])\n\trationcardnumber := strings.ToLower(params[7])\n\n\t// Check if citizen exist with Key => ID.\n\tcitizenAsBytes, err := stub.GetState(id)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to check if asset exists!\")\n\t} else if citizenAsBytes != nil {\n\t\treturn shim.Error(\"citizen with ID already exists!\")\n\t}\n\n\t// Generate citizen from the information provided.\n\tNewCitizen := &citizen{id, name, strconv.Itoa(age), dob, gender, address, mobilenumber, rationcardnumber}\n\n\tcitizenJSONasBytes, err := json.Marshal(NewCitizen)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Put state of newly generated citizen with Key => Id.\n\terr = stub.PutState(rationcardnumber, citizenJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// indexName := \"citrationnumber-citid\"\n\t// rationnumbertypekey, err := stub.CreateCompositeKey(indexName, []string{NewCitizen.rationcardnumber, NewCitizen.ID})\n\t// if err != nil {\n\t// \treturn shim.Error(err.Error())\n\t// }\n\n\t// value := []byte{0x00}\n\t// compositekeyerr := stub.PutState(rationnumbertypekey, value)\n\t// if compositekeyerr != nil {\n\t// \treturn shim.Error(compositekeyerr.Error())\n\t// }\n\n\treturn shim.Success(nil)\n\n}", "title": "" }, { "docid": "aff717befd0336b5d893b42950e068f3", "score": "0.4715488", "text": "func newIPTrie(p *IPTrie) *IPTrie {\n\treturn &IPTrie{\n\t\tparent: p,\n\t\tkids: make(map[byte]*IPTrie),\n\t\tm: &sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "a3011919f0ee46330cec6f198bda363a", "score": "0.47105914", "text": "func NewPodNotForENI(name string, sa string, namespace string) *corev1.Pod {\n\tpod := &corev1.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\tNamespace: namespace,\n\t\t\tName: name,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"test_app\",\n\t\t\t},\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tServiceAccountName: sa,\n\t\t},\n\t}\n\treturn pod\n}", "title": "" }, { "docid": "646c0f017ca2f7889ee2fba546edc678", "score": "0.4709309", "text": "func NewNERTrainer(filename string) (*NERTrainer, error) {\n\tcs := C.CString(filename)\n\tdefer C.free(unsafe.Pointer(cs))\n\tx := C.mitie_create_ner_trainer(cs)\n\tif x == nil {\n\t\treturn nil, errors.New(\"unable to create NERTrainer\")\n\t}\n\tnt := &NERTrainer{x}\n\truntime.SetFinalizer(nt, freeNERTrainer)\n\treturn nt, nil\n}", "title": "" }, { "docid": "31b3fb45d20fb3c2ee8b464edc899e62", "score": "0.47017923", "text": "func (t *OpticalAmplifier) NewSupervisoryChannel(Interface string) (*OpticalAmplifier_SupervisoryChannel, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.SupervisoryChannel == nil {\n\t\tt.SupervisoryChannel = make(map[string]*OpticalAmplifier_SupervisoryChannel)\n\t}\n\n\tkey := Interface\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.SupervisoryChannel[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list SupervisoryChannel\", key)\n\t}\n\n\tt.SupervisoryChannel[key] = &OpticalAmplifier_SupervisoryChannel{\n\t\tInterface: &Interface,\n\t}\n\n\treturn t.SupervisoryChannel[key], nil\n}", "title": "" }, { "docid": "e6327d80ebbbd9b5a55f8dd1986eb140", "score": "0.47008747", "text": "func New(subdomain, key string) Noko {\n\treturn Noko{subdomain, key, false, &http.Client{}, \"https://api.nokotime.com/v2\"}\n}", "title": "" }, { "docid": "14ef0980ae91b4ac950fde6d6813bcb6", "score": "0.4700273", "text": "func NewNet(game *Game) *Net {\n return &Net{js.Global.Get(\"Phaser\").Get(\"Net\").New(game)}\n}", "title": "" }, { "docid": "1ce6de53770e925241980324582810ad", "score": "0.4685006", "text": "func _cgoexp_cf0433f838ae_GNI_NewString(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_cf0433f838ae_GNI_NewString\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "5d08748a7828e4a7df909cc265470456", "score": "0.46830982", "text": "func NewNationalityList(uuid string, country string, documentNumber string) *NationalityList {\n\tthis := NationalityList{}\n\tthis.Uuid = uuid\n\tthis.Country = country\n\tthis.DocumentNumber = documentNumber\n\treturn &this\n}", "title": "" }, { "docid": "0eac74b3bdbcf612c3023990596f87df", "score": "0.46763724", "text": "func New(clientSet *kubernetes.Clientset) INodes {\n\tnodes := Nodes{\n\t\tClientSet: clientSet,\n\n\t\tQuery: gountries.New(),\n\t\tContinentsList: gountries.NewContinents(),\n\n\t\tNodes: make([]*Node, 0),\n\t\tCities: make(map[string][]*Node),\n\t\tCountries: make(map[string][]*Node),\n\t\tContinents: make(map[string][]*Node),\n\t}\n\tutils.StartNodeInformerHandler(clientSet, nodes.addHandler, nodes.updateHandler, nodes.deleteHandler)\n\treturn &nodes\n}", "title": "" }, { "docid": "30430f19c467b9caddc32ed53a843ada", "score": "0.46622637", "text": "func New(n int) (string, error) {\n\tif n == 0 {\n\t\tn = 256\n\t}\n\tdata := make([]byte, int(n))\n\tif _, err := io.ReadFull(rand.Reader, data); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn base64.RawURLEncoding.EncodeToString(data), nil\n}", "title": "" }, { "docid": "8dcd9bbfa1a4d90fd29876c431eb755b", "score": "0.46611556", "text": "func New(s string) Ident {\n\ti := Ident{\n\t\tOriginal: s,\n\t\tParts: toParts(s),\n\t}\n\n\treturn i\n}", "title": "" }, { "docid": "d7dc01bcf8424b93de0e318f56a065a2", "score": "0.46532446", "text": "func NewCluster(n int) *pilosa.Cluster {\n\tc := pilosa.NewCluster()\n\tc.ReplicaN = 1\n\tc.Hasher = NewModHasher()\n\n\tfor i := 0; i < n; i++ {\n\t\tc.Nodes = append(c.Nodes, &pilosa.Node{\n\t\t\tHost: fmt.Sprintf(\"host%d\", i),\n\t\t})\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "ee3fde363fcc0275ff66d2cbdf23cfea", "score": "0.46511406", "text": "func NewNFT() *NFT {\n\tthis := NFT{}\n\tvar size float32 = 132614\n\tthis.Size = &size\n\tvar scope string = \"default\"\n\tthis.Scope = &scope\n\treturn &this\n}", "title": "" }, { "docid": "8f5af008f1f0a1234ecda74999dbb67e", "score": "0.46398288", "text": "func NewInf(s string) E {\n\treturn newInfrastructure(s, 1)\n}", "title": "" }, { "docid": "2aa326db27c0472781a5087f898c8b0e", "score": "0.46368337", "text": "func NewDie() ISkunkDie {\n\treturn &Die{}\n}", "title": "" }, { "docid": "cddcb27a6ec04733eae0c0758df6952c", "score": "0.462388", "text": "func (v ZamowieniaResource) New(c buffalo.Context) error {\n c.Set(\"zamowienium\", &models.Zamowienium{})\n\n return c.Render(http.StatusOK, r.HTML(\"/zamowienia/new.plush.html\"))\n}", "title": "" }, { "docid": "8a5a1b3a18022d82277bab93a2eab648", "score": "0.46169335", "text": "func (t *NetworkInstance) NewInterface(Id string) (*NetworkInstance_Interface, error) {\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_Interface)\n\t}\n\n\tkey := Id\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Interface[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Interface\", key)\n\t}\n\n\tt.Interface[key] = &NetworkInstance_Interface{\n\t\tId: &Id,\n\t}\n\n\treturn t.Interface[key], nil\n}", "title": "" }, { "docid": "a64ddf67686cda262c0edabd842443af", "score": "0.46012968", "text": "func newSentinel(part *vu.Ent, level, units int, fade float64) *sentinel {\n\ts := &sentinel{}\n\ts.part = part\n\ts.units = float64(units)\n\ts.part.SetAt(0, 0.5, 0)\n\tif level > 0 {\n\t\ts.center = s.part.AddPart().SetScale(0.125, 0.125, 0.125)\n\t\tm := s.center.MakeModel(\"flata\", \"msh:cube\", \"mat:tred\")\n\t\tm.SetUniform(\"fd\", fade)\n\t}\n\ts.model = part.AddPart()\n\tm := s.model.MakeModel(\"flata\", \"msh:cube\", \"mat:tblue\")\n\tm.SetUniform(\"fd\", fade)\n\treturn s\n}", "title": "" }, { "docid": "54f267469f06f992b23022f4040a5e04", "score": "0.4595493", "text": "func NewNHLClient(year int) *NHLClient {\n\treturn &NHLClient{year: year}\n}", "title": "" }, { "docid": "f167466d5db86c6b3f7e861c668e00f2", "score": "0.45912054", "text": "func (b *BaseImpl) New(n IO) IO {\n\treturn n\n}", "title": "" }, { "docid": "8a693f5680e163cf6a296c1b82f2cb28", "score": "0.4588421", "text": "func Nibit(chain string, days int) Scraper {\n\t// Check days.\n\tif days < 1 {\n\t\tpanic(fmt.Sprintf(\"Bad number of days: %d. Must be positive.\", days))\n\t}\n\n\treturn &nibitScraper{chain, days}\n}", "title": "" }, { "docid": "1c9530162b0c712d33a86a2cef55a920", "score": "0.45732126", "text": "func New(n int, s string) Index {\n\tx := Index{}\n\tx.Add(n, s)\n\treturn x\n}", "title": "" }, { "docid": "e56b4aa509402090b2fcd7fbe519e49b", "score": "0.45697784", "text": "func New(hosts []string) prometheus.Collector {\n\tconst namespace = \"nut\"\n\n\tdescs := map[string]*prometheus.Desc{}\n\tfor k, v := range descriptions {\n\t\tdescs[k] = prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", v.name),\n\t\t\tv.desc,\n\t\t\t[]string{\"name\", \"model\", \"mfr\", \"serial\", \"type\"},\n\t\t\tnil,\n\t\t)\n\t}\n\n\treturn &nutCollector{\n\t\thosts: hosts,\n\t\tdescs: descs,\n\t}\n}", "title": "" }, { "docid": "77aff5c558b08d1832845c1e134f1c6d", "score": "0.4563838", "text": "func NewAlien(name string, city *City) *Alien {\n\talien := &Alien{\n\t\tname: name,\n\t\tcity: city,\n\t\tdestroyed: false,\n\t}\n\n\talien.city.AddResident(alien)\n\treturn alien\n}", "title": "" }, { "docid": "7d74c1d390935cdfa680d4fe6e836c40", "score": "0.45635235", "text": "func (in *NutanixSpec) DeepCopy() *NutanixSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NutanixSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "832a95c0f4f0cc9f72364ab9c85afdd8", "score": "0.45601204", "text": "func NewMockIOne(ctrl *gomock.Controller) *MockIOne {\n\tmock := &MockIOne{ctrl: ctrl}\n\tmock.recorder = &MockIOneMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "e96edf262960ba0922d028eff5185f9c", "score": "0.455628", "text": "func NewDCT(n int) *DCT {\n\tvar t DCT\n\tt.Reset(n)\n\treturn &t\n}", "title": "" }, { "docid": "72ac12b893a7bb170c774fa36a48a310", "score": "0.45546907", "text": "func NewNodeID(data string) (ret NodeID) {\n\tdecoded, _ := hex.DecodeString(data)\n\n\tfor i := 0; i < IdLength; i++ {\n\t\tret[i] = decoded[i]\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "857d026ca8ff98ef3c963edd54c77a61", "score": "0.45522916", "text": "func NewIder(machineIndex uint) (*Ider, error) {\n\tif machineIndex > 9999 {\n\t\treturn nil, fmt.Errorf(\"The maximum machineIndex for an Ider is 9999.\")\n\t}\n\n\tider := Ider{MachineIndex: machineIndex}\n\n\tider.chanIndex = make(chan int64, 1)\n\n\tgo ider.generateIndex()\n\n\treturn &ider, nil\n}", "title": "" }, { "docid": "fef2d47039e570cbb646b414c880d90d", "score": "0.4548397", "text": "func (gen *NanoSecondUniqueIDGenerator) NewUniqueID() string {\n\treturn fmt.Sprintf(\"%d\", time.Now().Sub(nanoSince).Nanoseconds())\n}", "title": "" }, { "docid": "09201c4364858b69d37190d831619d95", "score": "0.45386237", "text": "func NewIDTest(t *testing.T) *IDTest {\n\tit := new(IDTest)\n\tit.nodes = make([]ID, 0, 4)\n\tit.nodes = append(it.nodes, CreateIDForTesting(t, \"583f\"))\n\tit.nodes = append(it.nodes, CreateIDForTesting(t, \"70d1\"))\n\tit.nodes = append(it.nodes, CreateIDForTesting(t, \"70f5\"))\n\tit.nodes = append(it.nodes, CreateIDForTesting(t, \"70fa\"))\n\n\t// objects mapping ID to index of ID they map to\n\tit.objects = make(map[ID]int)\n\tit.objects[CreateIDForTesting(t, \"3f8a\")] = 0\n\tit.objects[CreateIDForTesting(t, \"520c\")] = 0\n\tit.objects[CreateIDForTesting(t, \"58ff\")] = 0\n\tit.objects[CreateIDForTesting(t, \"70c3\")] = 1\n\tit.objects[CreateIDForTesting(t, \"60f4\")] = 2\n\tit.objects[CreateIDForTesting(t, \"70a2\")] = 1\n\tit.objects[CreateIDForTesting(t, \"6395\")] = 1\n\tit.objects[CreateIDForTesting(t, \"683f\")] = 1\n\tit.objects[CreateIDForTesting(t, \"63e5\")] = 2\n\tit.objects[CreateIDForTesting(t, \"63e9\")] = 3\n\tit.objects[CreateIDForTesting(t, \"beef\")] = 0\n\treturn it\n}", "title": "" }, { "docid": "f2e1999961af40b2e7ecefaa1908ace5", "score": "0.4531414", "text": "func newID() string {\n\treturn fmt.Sprintf(\"%x\", rand.Int63())\n}", "title": "" }, { "docid": "b037405bebfbe379498628fa328b536c", "score": "0.45291921", "text": "func (m *FormMutation) SetNiveau(s string) {\n\tm._Niveau = &s\n}", "title": "" }, { "docid": "0a16ee61a4ee6e496a2f329f086760a8", "score": "0.45264572", "text": "func (t *OpenconfigSystem_System_Cpus_Cpu_State) GetOrCreateNice() *OpenconfigSystem_System_Cpus_Cpu_State_Nice {\n\tif t.Nice != nil {\n\t\treturn t.Nice\n\t}\n\tt.Nice = &OpenconfigSystem_System_Cpus_Cpu_State_Nice{}\n\treturn t.Nice\n}", "title": "" }, { "docid": "0a16ee61a4ee6e496a2f329f086760a8", "score": "0.4526397", "text": "func (t *OpenconfigSystem_System_Cpus_Cpu_State) GetOrCreateNice() *OpenconfigSystem_System_Cpus_Cpu_State_Nice {\n\tif t.Nice != nil {\n\t\treturn t.Nice\n\t}\n\tt.Nice = &OpenconfigSystem_System_Cpus_Cpu_State_Nice{}\n\treturn t.Nice\n}", "title": "" }, { "docid": "7dae1a0c2e5cf40a817c7d8f8bd37fec", "score": "0.45254484", "text": "func NewNuki(address string, opts ...Option) *Nuki {\n\tn := &Nuki{\n\t\taddress: address,\n\t\thttp: &http.Client{\n\t\t\tTimeout: 10 * time.Second,\n\t\t},\n\t}\n\tfor _, o := range opts {\n\t\to(n)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "8525bec71fc12a365017b392c32dd075", "score": "0.45252797", "text": "func NewFakeNRTxn(t *testing.T, name string) *FakeNRTxn {\n\treturn &FakeNRTxn{\n\t\tName: name,\n\t\tAttrs: make(map[string]interface{}),\n\t\tt: t,\n\t}\n}", "title": "" }, { "docid": "d6c31d60ad25e57f980a014c1793fd92", "score": "0.45199335", "text": "func newEquipment(head, neck, torso, righthand, lefthand,\n\tpants *Item) *equipment {\n\n\t// Return the address of the new equipment object.\n\treturn &equipment{head, neck, torso, righthand, lefthand, pants}\n}", "title": "" }, { "docid": "202f2be39677fbfa08ee7a7efdb6d4cc", "score": "0.45134577", "text": "func New(handlers ...negroni.Handler) *negroni.Negroni {\n\treturn negroni.New()\n}", "title": "" }, { "docid": "0d7866332b6e7e5acc3e5c59c9af6412", "score": "0.45120132", "text": "func NewUniG(params ...ParamData) (*ManagedEntity, OmciErrors) {\n\treturn NewManagedEntity(*unigBME, params...)\n}", "title": "" }, { "docid": "b3fd4ae98462950f07596a3a226770f2", "score": "0.45114893", "text": "func NewCafe(nComp int) *Cafe {\n\tcomps := []Computer{}\n\tch := make(chan bool, nComp)\n\n\tfor i := 0; i < nComp; i++ {\n\t\tcomps = append(comps, Computer{nil})\n\t\tch <- true\n\t}\n\n\treturn &Cafe{comps, ch}\n}", "title": "" }, { "docid": "1814cef0017f61780409a9a4fbfcdb52", "score": "0.45061806", "text": "func NewNotifier() *Notifier {\n\t//TODO: create, initialize and return\n\t//a Notifier struct\n\tnBuf := 500\n\tmyNotifer := &Notifier{\n\t\tclients: make(map[*websocket.Conn]bool),\n\t\tmu: sync.RWMutex{},\n\t\teventq: make(chan *Event, nBuf),\n\t}\n\treturn myNotifer\n}", "title": "" }, { "docid": "efbf07415ef6de81e99fd3f5fed87bff", "score": "0.45026037", "text": "func NewNetwork() api.INetwork {\n\to := new(network)\n\treturn o\n}", "title": "" } ]
e77889ea779b3c0d53812ed8fc8553a9
Test upconversion from MDv2 to MDv3 for a private conflict folder. Regression test for KBFS2381.
[ { "docid": "d90726139c8f77e07fe11c1be996aa6b", "score": "0.6351211", "text": "func TestRootMetadataUpconversionPrivateConflict(t *testing.T) {\n\tctx := context.Background()\n\tconfig := MakeTestConfigOrBust(t, \"alice\", \"bob\")\n\tdefer CheckConfigAndShutdown(ctx, t, config)\n\n\ttlfID := tlf.FakeID(1, tlf.Private)\n\th := parseTlfHandleOrBust(\n\t\tt, config, \"alice,bob (conflicted copy 2017-08-24)\", tlf.Private, tlfID)\n\trmd, err := makeInitialRootMetadata(kbfsmd.InitialExtraMetadataVer, tlfID, h)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(0), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.NotNil(t, h.ConflictInfo())\n\n\t// set some dummy numbers\n\tdiskUsage, refBytes, unrefBytes :=\n\t\tuint64(12345), uint64(4321), uint64(1234)\n\trmd.SetDiskUsage(diskUsage)\n\trmd.SetRefBytes(refBytes)\n\trmd.SetUnrefBytes(unrefBytes)\n\t// Make sure the MD looks readable.\n\trmd.data.Dir.BlockPointer = data.BlockPointer{ID: kbfsblock.FakeID(1)}\n\n\t// key it once\n\tdone, _, err := config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 0, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 1, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\trequire.True(t, rmd.IsReadable())\n\n\t// override the metadata version\n\tconfig.metadataVersion = kbfsmd.SegregatedKeyBundlesVer\n\n\t// create an MDv3 successor\n\trmd2, err := rmd.MakeSuccessor(context.Background(),\n\t\tconfig.MetadataVersion(), config.Codec(),\n\t\tconfig.KeyManager(), config.KBPKI(), config.KBPKI(), config,\n\t\tkbfsmd.FakeID(1), true)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd2.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(2), rmd2.Revision())\n\trequire.Equal(t, kbfsmd.SegregatedKeyBundlesVer, rmd2.Version())\n\textra, ok := rmd2.extra.(*kbfsmd.ExtraMetadataV3)\n\trequire.True(t, ok)\n\trequire.True(t, extra.IsWriterKeyBundleNew())\n\trequire.True(t, extra.IsReaderKeyBundleNew())\n\n\t// Check the handle, but the cached handle in the MD is a direct copy...\n\trequire.Equal(\n\t\tt, h.GetCanonicalPath(), rmd2.GetTlfHandle().GetCanonicalPath())\n\t// So also check that the conflict info is set in the MD itself.\n\trequire.NotNil(t, rmd2.bareMd.(*kbfsmd.RootMetadataV3).ConflictInfo)\n}", "title": "" } ]
[ { "docid": "f255254c7447f4ba3c07c3e106b75ae5", "score": "0.54594725", "text": "func TestRootMetadataUpconversionPublic(t *testing.T) {\n\tctx := context.Background()\n\tconfig := MakeTestConfigOrBust(t, \"alice\", \"bob\")\n\tdefer CheckConfigAndShutdown(ctx, t, config)\n\n\ttlfID := tlf.FakeID(1, tlf.Public)\n\th := parseTlfHandleOrBust(\n\t\tt, config, \"alice,bob,charlie@twitter\", tlf.Public, tlfID)\n\trmd, err := makeInitialRootMetadata(kbfsmd.InitialExtraMetadataVer, tlfID, h)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.PublicKeyGen, rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\n\t// set some dummy numbers\n\tdiskUsage, refBytes, unrefBytes := uint64(12345), uint64(4321), uint64(1234)\n\trmd.SetDiskUsage(diskUsage)\n\trmd.SetRefBytes(refBytes)\n\trmd.SetUnrefBytes(unrefBytes)\n\n\t// override the metadata version\n\tconfig.metadataVersion = kbfsmd.SegregatedKeyBundlesVer\n\n\t// create an MDv3 successor\n\trmd2, err := rmd.MakeSuccessor(context.Background(),\n\t\tconfig.MetadataVersion(), config.Codec(),\n\t\tconfig.KeyManager(), config.KBPKI(), config.KBPKI(), config,\n\t\tkbfsmd.FakeID(1), true)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.PublicKeyGen, rmd2.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(2), rmd2.Revision())\n\trequire.Equal(t, kbfsmd.SegregatedKeyBundlesVer, rmd2.Version())\n\t// Do this instead of require.Nil because we want to assert\n\t// that it's untyped nil.\n\trequire.True(t, rmd2.extra == nil)\n\n\t// compare numbers\n\trequire.Equal(t, diskUsage, rmd2.DiskUsage())\n\t// we expect this and the below to be zero this time because the folder is public.\n\t// they aren't reset in the private version because the private metadata isn't\n\t// initialized therefor it's considered unreadable.\n\trequire.Equal(t, uint64(0), rmd2.RefBytes())\n\trequire.Equal(t, uint64(0), rmd2.UnrefBytes())\n\n\t// create and compare bare tlf handles (this verifies unresolved+resolved writer sets are identical)\n\trmd.tlfHandle, rmd2.tlfHandle = nil, nil // avoid a panic due to the handle already existing\n\thandle, err := rmd.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\thandle2, err := rmd2.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\trequire.Equal(t, handle, handle2)\n}", "title": "" }, { "docid": "2951e4190ac5be2cd3a88d6bd420790c", "score": "0.5377245", "text": "func (ltd *Libp2pTestData) VerifyFileTransferred(t *testing.T, link datamodel.Link, useSecondNode bool, readLen uint64) {\n\tvar dagService ipldformat.DAGService\n\tif useSecondNode {\n\t\tdagService = ltd.DagService2\n\t} else {\n\t\tdagService = ltd.DagService1\n\t}\n\tltd.verifyFileTransferred(t, link, dagService, readLen)\n}", "title": "" }, { "docid": "1fa12a120445d3c5d48505fb8964e322", "score": "0.5351757", "text": "func TestCrConflictMoveRemovedMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b\", \"a/c\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "4e57d7fdd418782883d27fa3676936b5", "score": "0.53438574", "text": "func (ltd *Libp2pTestData) VerifyFileTransferred(t *testing.T, link ipld.Link, useSecondNode bool, readLen uint64) {\n\tvar dagService ipldformat.DAGService\n\tif useSecondNode {\n\t\tdagService = ltd.DagService2\n\t} else {\n\t\tdagService = ltd.DagService1\n\t}\n\n\tc := link.(cidlink.Link).Cid\n\n\t// load the root of the UnixFS DAG from the new blockstore\n\totherNode, err := dagService.Get(ltd.Ctx, c)\n\trequire.NoError(t, err)\n\n\t// Setup a UnixFS file reader\n\tn, err := unixfile.NewUnixfsFile(ltd.Ctx, dagService, otherNode)\n\trequire.NoError(t, err)\n\n\tfn, ok := n.(files.File)\n\trequire.True(t, ok)\n\n\t// Read the bytes for the UnixFS File\n\tfinalBytes := make([]byte, readLen)\n\t_, err = fn.Read(finalBytes)\n\trequire.NoError(t, err)\n\n\t// verify original bytes match final bytes!\n\trequire.EqualValues(t, ltd.OrigBytes[:readLen], finalBytes)\n}", "title": "" }, { "docid": "a39523dcf6653ed1548ec2de6e69c55b", "score": "0.5293615", "text": "func TestRootMetadataUpconversionPrivate(t *testing.T) {\n\tconfig := MakeTestConfigOrBust(t, \"alice\", \"bob\", \"charlie\")\n\tconfig.SetKeyCache(&dummyNoKeyCache{})\n\tctx := context.Background()\n\tdefer CheckConfigAndShutdown(ctx, t, config)\n\n\ttlfID := tlf.FakeID(1, tlf.Private)\n\th := parseTlfHandleOrBust(t, config, \"alice,alice@twitter#bob,charlie@twitter,eve@reddit\", tlf.Private, tlfID)\n\trmd, err := makeInitialRootMetadata(kbfsmd.InitialExtraMetadataVer, tlfID, h)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(0), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\n\t// set some dummy numbers\n\tdiskUsage, refBytes, unrefBytes := uint64(12345), uint64(4321), uint64(1234)\n\trmd.SetDiskUsage(diskUsage)\n\trmd.SetRefBytes(refBytes)\n\trmd.SetUnrefBytes(unrefBytes)\n\t// Make sure the MD looks readable.\n\trmd.data.Dir.BlockPointer = data.BlockPointer{ID: kbfsblock.FakeID(1)}\n\n\t// key it once\n\tdone, _, err := config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 0, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\trequire.Equal(t, 1, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\n\t// revoke bob's device\n\t_, bobID, err := config.KBPKI().Resolve(\n\t\tcontext.Background(), \"bob\", keybase1.OfflineAvailability_NONE)\n\trequire.NoError(t, err)\n\tbobUID, err := bobID.AsUser()\n\trequire.NoError(t, err)\n\n\tRevokeDeviceForLocalUserOrBust(t, config, bobUID, 0)\n\n\t// rekey it\n\tdone, _, err = config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 1, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\trequire.Equal(t, 0, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\n\t// prove charlie\n\tconfig.KeybaseService().(*KeybaseDaemonLocal).AddNewAssertionForTestOrBust(\n\t\t\"charlie\", \"charlie@twitter\")\n\n\t// rekey it\n\tdone, _, err = config.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 2, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\trequire.Equal(t, 0, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\n\t// add a device for charlie and rekey as charlie\n\t_, charlieID, err := config.KBPKI().Resolve(\n\t\tcontext.Background(), \"charlie\", keybase1.OfflineAvailability_NONE)\n\trequire.NoError(t, err)\n\tcharlieUID, err := charlieID.AsUser()\n\trequire.NoError(t, err)\n\n\tconfig2 := ConfigAsUser(config, \"charlie\")\n\tconfig2.SetKeyCache(&dummyNoKeyCache{})\n\tdefer CheckConfigAndShutdown(ctx, t, config2)\n\tAddDeviceForLocalUserOrBust(t, config, charlieUID)\n\tAddDeviceForLocalUserOrBust(t, config2, charlieUID)\n\n\t// rekey it\n\tdone, _, err = config2.KeyManager().Rekey(context.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(2), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.InitialExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 2, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\trequire.Equal(t, 1, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\n\t// override the metadata version\n\tconfig.metadataVersion = kbfsmd.SegregatedKeyBundlesVer\n\n\t// create an MDv3 successor\n\trmd2, err := rmd.MakeSuccessor(context.Background(),\n\t\tconfig.MetadataVersion(), config.Codec(),\n\t\tconfig.KeyManager(), config.KBPKI(), config.KBPKI(), nil,\n\t\tkbfsmd.FakeID(1), true)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(2), rmd2.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(2), rmd2.Revision())\n\trequire.Equal(t, kbfsmd.SegregatedKeyBundlesVer, rmd2.Version())\n\textra, ok := rmd2.extra.(*kbfsmd.ExtraMetadataV3)\n\trequire.True(t, ok)\n\trequire.True(t, extra.IsWriterKeyBundleNew())\n\trequire.True(t, extra.IsReaderKeyBundleNew())\n\n\t// compare numbers\n\trequire.Equal(t, diskUsage, rmd2.DiskUsage())\n\trequire.Equal(t, rmd.data.Dir, rmd2.data.Dir)\n\n\t// These should be 0 since they are reset for successors.\n\trequire.Equal(t, uint64(0), rmd2.RefBytes())\n\trequire.Equal(t, uint64(0), rmd2.UnrefBytes())\n\n\t// create and compare bare tlf handles (this verifies unresolved+resolved writer/reader sets are identical)\n\trmd.tlfHandle, rmd2.tlfHandle = nil, nil // avoid a panic due to the handle already existing\n\thandle, err := rmd.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\thandle2, err := rmd2.MakeBareTlfHandle()\n\trequire.NoError(t, err)\n\trequire.Equal(t, handle, handle2)\n\n\t// compare tlf crypt keys\n\tkeys, err := config.KeyManager().GetTLFCryptKeyOfAllGenerations(context.Background(), rmd)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 2, len(keys))\n\n\tkeys2, err := config.KeyManager().GetTLFCryptKeyOfAllGenerations(context.Background(), rmd2)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 2, len(keys2))\n\trequire.Equal(t, keys, keys2)\n\n\t// get each key generation for alice from each version of metadata\n\taliceKeys := getAllUsersKeysForTest(t, config, rmd, \"alice\")\n\taliceKeys2 := getAllUsersKeysForTest(t, config, rmd2, \"alice\")\n\n\t// compare alice's keys\n\trequire.Equal(t, 2, len(aliceKeys))\n\trequire.Equal(t, aliceKeys, aliceKeys2)\n\n\t// get each key generation for charlie from each version of metadata\n\tcharlieKeys := getAllUsersKeysForTest(t, config2, rmd, \"charlie\")\n\tcharlieKeys2 := getAllUsersKeysForTest(t, config2, rmd2, \"charlie\")\n\n\t// compare charlie's keys\n\trequire.Equal(t, 2, len(charlieKeys))\n\trequire.Equal(t, charlieKeys, charlieKeys2)\n\n\t// compare alice and charlie's keys\n\trequire.Equal(t, aliceKeys, charlieKeys)\n\n\t// Rekeying again shouldn't change wkbNew/rkbNew.\n\terr = rmd2.finalizeRekey(config.Codec())\n\trequire.NoError(t, err)\n\textra, ok = rmd2.extra.(*kbfsmd.ExtraMetadataV3)\n\trequire.True(t, ok)\n\trequire.True(t, extra.IsWriterKeyBundleNew())\n\trequire.True(t, extra.IsReaderKeyBundleNew())\n}", "title": "" }, { "docid": "1cfaa9876ae96309bf713f72952f0abf", "score": "0.5190087", "text": "func verifyDiff(currentFile, outputPackagePath, outputBaseFileName string) error {\n\tverifyFile := filepath.Join(outputPackagePath, outputBaseFileName+\".go\")\n\n\tverifyData, err := os.ReadFile(verifyFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read generated file: %w\", err)\n\t}\n\n\tcurrentData, err := os.ReadFile(currentFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read current file: %w\", err)\n\t}\n\n\tif !bytes.Equal(currentData, verifyData) {\n\t\tdiff := utils.Diff(currentData, verifyData, currentFile)\n\n\t\treturn fmt.Errorf(\"OpenAPI schema for %s is out of date, please regenerate the OpenAPI schema:\\n%s\", currentFile, diff)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "daa720811b07fe996bc992a9063fcb2d", "score": "0.5140197", "text": "func TestCrConflictWriteToRemovedMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), blockChangeSize(100*1024), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b\", ntimesString(15, \"9876543210\")),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"9876543210\")),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"9876543210\")),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "63f86d2db8428a4f51bc1c298dd69818", "score": "0.5081094", "text": "func TestLocalMirror2_1_3(t *testing.T) {\n\ttotal, copies2, copies3 := testLocalMirror(t, 1, 3)\n\tif copies3 != total || copies2 != 0 {\n\t\tt.Fatalf(\"Expecting %d objects to have 3 replicas, got %d\", total, copies3)\n\t}\n}", "title": "" }, { "docid": "7828f25376f52eff6ce9504e03b05972", "score": "0.507629", "text": "func TestReadOffsetCorruptedProof(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\tdeps := dependencies.NewDependencyCorruptMDMOutput()\n\twt, err := newWorkerTesterCustomDependency(t.Name(), modules.ProdDependencies, deps)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\tif err := wt.Close(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\tbackup := modules.UploadedBackup{\n\t\tName: \"foo\",\n\t\tCreationDate: types.CurrentTimestamp(),\n\t\tSize: 10,\n\t\tUploadProgress: 0,\n\t}\n\n\t// Upload a snapshot to fill the first sector of the contract.\n\terr = wt.UploadSnapshot(context.Background(), backup, fastrand.Bytes(int(backup.Size)))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Download the first sector partially and then fully since both actions\n\t// require different proofs.\n\t_, err = wt.ReadOffset(context.Background(), categorySnapshotDownload, 0, modules.SectorSize/2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = wt.ReadOffset(context.Background(), categorySnapshotDownload, 0, modules.SectorSize)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Do it again but this time corrupt the output to make sure the proof\n\t// doesn't match.\n\tdeps.Fail()\n\t_, err = wt.ReadOffset(context.Background(), categorySnapshotDownload, 0, modules.SectorSize/2)\n\tif err == nil || !strings.Contains(err.Error(), \"verifying proof failed\") {\n\t\tt.Fatal(err)\n\t}\n\n\t// Retry since the worker might be on a cooldown.\n\terr = build.Retry(100, 100*time.Millisecond, func() error {\n\t\tdeps.Fail()\n\t\t_, err = wt.ReadOffset(context.Background(), categorySnapshotDownload, 0, modules.SectorSize)\n\t\tif err == nil || !strings.Contains(err.Error(), \"verifying proof failed\") {\n\t\t\treturn fmt.Errorf(\"unexpected error %v\", err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "a46933bf23d37a969d9981fb9af683c4", "score": "0.5003925", "text": "func testValidateNextManifestFixesDisturbance(t *testing.T, disturb func(*keppel.DB, []int64, []string)) {\n\tj, _, db, _, sd, clock, _ := setup(t)\n\tclock.StepBy(1 * time.Hour)\n\n\tvar (\n\t\tallBlobIDs []int64\n\t\tallManifestDigests []string\n\t)\n\n\t//setup two image manifests, both with some layers\n\timages := make([]test.Image, 2)\n\tfor idx := range images {\n\t\timage := test.GenerateImage(\n\t\t\ttest.GenerateExampleLayer(int64(10*idx+1)),\n\t\t\ttest.GenerateExampleLayer(int64(10*idx+2)),\n\t\t)\n\t\timages[idx] = image\n\n\t\tlayer1Blob := uploadBlob(t, db, sd, clock, image.Layers[0])\n\t\tlayer2Blob := uploadBlob(t, db, sd, clock, image.Layers[1])\n\t\tconfigBlob := uploadBlob(t, db, sd, clock, image.Config)\n\t\tuploadManifest(t, db, sd, clock, image.Manifest, image.SizeBytes())\n\t\tfor _, blobID := range []int64{layer1Blob.ID, layer2Blob.ID, configBlob.ID} {\n\t\t\tmustExec(t, db,\n\t\t\t\t`INSERT INTO manifest_blob_refs (blob_id, repo_id, digest) VALUES ($1, 1, $2)`,\n\t\t\t\tblobID, image.Manifest.Digest.String(),\n\t\t\t)\n\t\t}\n\t\tallBlobIDs = append(allBlobIDs, layer1Blob.ID, layer2Blob.ID, configBlob.ID)\n\t\tallManifestDigests = append(allManifestDigests, image.Manifest.Digest.String())\n\t}\n\n\t//also setup an image list manifest containing those images (so that we have\n\t//some manifest-manifest refs to play with)\n\timageList := test.GenerateImageList(images[0].Manifest, images[1].Manifest)\n\tuploadManifest(t, db, sd, clock, imageList.Manifest, imageList.SizeBytes())\n\tfor _, image := range images {\n\t\tmustExec(t, db,\n\t\t\t`INSERT INTO manifest_manifest_refs (repo_id, parent_digest, child_digest) VALUES (1, $1, $2)`,\n\t\t\timageList.Manifest.Digest.String(), image.Manifest.Digest.String(),\n\t\t)\n\t}\n\tallManifestDigests = append(allManifestDigests, imageList.Manifest.Digest.String())\n\n\t//since these manifests were just uploaded, validated_at is set to right now,\n\t//so ValidateNextManifest will report that there is nothing to do\n\texpectError(t, sql.ErrNoRows.Error(), j.ValidateNextManifest())\n\n\t//once they need validating, they validate successfully\n\tclock.StepBy(12 * time.Hour)\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectError(t, sql.ErrNoRows.Error(), j.ValidateNextManifest())\n\teasypg.AssertDBContent(t, db.DbMap.Db, \"fixtures/manifest-validate-001-before-disturbance.sql\")\n\n\t//disturb the DB state, then rerun ValidateNextManifest to fix it\n\tclock.StepBy(12 * time.Hour)\n\tdisturb(db, allBlobIDs, allManifestDigests)\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectSuccess(t, j.ValidateNextManifest())\n\texpectError(t, sql.ErrNoRows.Error(), j.ValidateNextManifest())\n\teasypg.AssertDBContent(t, db.DbMap.Db, \"fixtures/manifest-validate-002-after-fix.sql\")\n}", "title": "" }, { "docid": "8fdeee331c16b933bb84859790f6662f", "score": "0.5002444", "text": "func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 1) }", "title": "" }, { "docid": "70ec3272d3c5bed588eae3cfb345f7c2", "score": "0.50010115", "text": "func fileMgrCollectionTestSetup01() (FileMgrCollection, error) {\n ePrefix :=\n \"Src File: xt_filemgrcollection_02_test.go Function: fileMgrCollectionTestSetup01()\\n\"\n\n fh := FileHelper{}\n fMgrs := FileMgrCollection{}\n\n fPath, err := fh.MakeAbsolutePath(\n \"../filesfortest/newfilesfortest/newerFileForTest_01.txt\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/newfilesfortest/newerFileForTest_01.txt\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err := FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n fMgrs.AddFileMgr(fmgr)\n\n fPath, err = fh.MakeAbsolutePath(\n \"../filesfortest/newfilesfortest/newerFileForTest_02.txt\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/newfilesfortest/newerFileForTest_02.txt\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err = FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n\n fMgrs.AddFileMgr(fmgr)\n\n fPath, err = fh.MakeAbsolutePath(\n \"../filesfortest/newfilesfortest/newerFileForTest_03.txt\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/newfilesfortest/newerFileForTest_03.txt\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err = FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n fMgrs.AddFileMgr(fmgr)\n\n fPath, err = fh.MakeAbsolutePath(\n \"../filesfortest/oldfilesfortest/006870_ReadingFiles.htm\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/oldfilesfortest/006870_ReadingFiles.htm\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err = FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n fMgrs.AddFileMgr(fmgr)\n\n fPath, err = fh.MakeAbsolutePath(\n \"../filesfortest/oldfilesfortest/006890_WritingFiles.htm\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/oldfilesfortest/006890_WritingFiles.htm\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err = FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n fMgrs.AddFileMgr(fmgr)\n\n fPath, err = fh.MakeAbsolutePath(\n \"../filesfortest/oldfilesfortest/test.htm\")\n\n if err != nil {\n return fMgrs, fmt.Errorf(ePrefix +\n \"Error returned by fh.MakeAbsolutePath\" +\n \"(\\\"../filesfortest/oldfilesfortest/test.htm\\\")\\n\" +\n \"Error='%v'\\n\", err.Error())\n }\n\n fmgr, err = FileMgr{}.NewFromPathFileNameExtStr(fPath)\n\n if err != nil {\n return FileMgrCollection{},\n fmt.Errorf(ePrefix +\n \"Error returned by FileMgr{}.NewFromPathFileNameExtStr(fPath)\\n\" +\n \"fPath='%v'\\nError='%v'\\n\",\n fPath, err.Error())\n }\n\n fMgrs.AddFileMgr(fmgr)\n\n return fMgrs, nil\n}", "title": "" }, { "docid": "72df0b1edb41ab9837a1bbe6b82270ee", "score": "0.49957967", "text": "func verifyCL(clFiles []FileAction, clientFiles []File) error {\n\tclMap := map[string]FileAction{}\n\tfor _, file := range clFiles {\n\t\tclMap[file.DepotPath] = file\n\t}\n\tclientMap := map[string]File{}\n\tfor _, file := range clientFiles {\n\t\tclientMap[file.DepotPath] = file\n\t}\n\tfor depotPath, clFile := range clMap {\n\t\tclientFile, ok := clientMap[depotPath]\n\t\t// If we don't have information about this file, we don't bother in checking for new files.\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif clientFile.Revision > clFile.Revision {\n\t\t\treturn fmt.Errorf(\"Change contains out of date files. You must either sync/resolve or revert them before presubmit checks can run. (%s is newer than CL: rev %d vs CL %d)\",\n\t\t\t\tdepotPath, clientFile.Revision, clFile.Revision)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e395f06d39571006d0c43b80788d9285", "score": "0.4982451", "text": "func checkKeyBundlesV3(t *testing.T, expectedRekeyInfos []expectedRekeyInfoV3,\n\texpectedTLFCryptKey kbfscrypto.TLFCryptKey,\n\texpectedPubKey kbfscrypto.TLFPublicKey,\n\twkb *TLFWriterKeyBundleV3, rkb *TLFReaderKeyBundleV3) {\n\texpectedWriterPubKeys := make(UserDevicePublicKeys)\n\texpectedReaderPubKeys := make(UserDevicePublicKeys)\n\tvar expectedWriterEPublicKeys,\n\t\texpectedReaderEPublicKeys kbfscrypto.TLFEphemeralPublicKeys\n\tfor _, expected := range expectedRekeyInfos {\n\t\texpectedWriterPubKeys = accumulatePublicKeys(\n\t\t\texpectedWriterPubKeys,\n\t\t\texpected.writerPrivKeys.toPublicKeys())\n\t\texpectedReaderPubKeys = accumulatePublicKeys(\n\t\t\texpectedReaderPubKeys,\n\t\t\texpected.readerPrivKeys.toPublicKeys())\n\n\t\tif expected.writerPrivKeys.hasKeys() {\n\t\t\trequire.Equal(t, expected.writerEPubKeyIndex,\n\t\t\t\tlen(expectedWriterEPublicKeys))\n\t\t\texpectedWriterEPublicKeys = append(\n\t\t\t\texpectedWriterEPublicKeys,\n\t\t\t\texpected.ePubKey)\n\t\t}\n\n\t\tif expected.readerPrivKeys.hasKeys() {\n\t\t\trequire.Equal(t, expected.readerEPubKeyIndex,\n\t\t\t\tlen(expectedReaderEPublicKeys))\n\t\t\texpectedReaderEPublicKeys = append(\n\t\t\t\texpectedReaderEPublicKeys,\n\t\t\t\texpected.ePubKey)\n\t\t}\n\t}\n\n\twriterPubKeys := userDeviceKeyInfoMapV3ToPublicKeys(wkb.Keys)\n\treaderPubKeys := userDeviceKeyInfoMapV3ToPublicKeys(rkb.Keys)\n\n\trequire.Equal(t, expectedWriterPubKeys, writerPubKeys)\n\trequire.Equal(t, expectedReaderPubKeys, readerPubKeys)\n\n\trequire.Equal(t, expectedWriterEPublicKeys, wkb.TLFEphemeralPublicKeys)\n\trequire.Equal(t, expectedReaderEPublicKeys, rkb.TLFEphemeralPublicKeys)\n\n\trequire.Equal(t, expectedPubKey, wkb.TLFPublicKey)\n\n\tfor _, expected := range expectedRekeyInfos {\n\t\texpectedUserPubKeys := unionPublicKeyUsers(\n\t\t\texpected.writerPrivKeys.toPublicKeys(),\n\t\t\texpected.readerPrivKeys.toPublicKeys())\n\t\tuserPubKeys := userDeviceServerHalvesToPublicKeys(\n\t\t\texpected.serverHalves)\n\t\trequire.Equal(t, expectedUserPubKeys.RemoveKeylessUsersForTest(), userPubKeys)\n\t\tcheckGetTLFCryptKeyV3(t,\n\t\t\texpected, expectedTLFCryptKey, wkb, rkb)\n\t}\n}", "title": "" }, { "docid": "a209edcc50a0fc588e2cb15904a03542", "score": "0.4975842", "text": "func (t *targetrunner) doput(w http.ResponseWriter, r *http.Request, bucket, objname string) (errstr string, errcode int) {\n\tvar (\n\t\tfile *os.File\n\t\terr error\n\t\thdhobj, nhobj cksumvalue\n\t\txxhashval string\n\t\thtype, hval, nhtype, nhval string\n\t\tsgl *SGLIO\n\t\tstarted time.Time\n\t)\n\tstarted = time.Now()\n\tcksumcfg := &ctx.config.Cksum\n\tfqn := t.fqn(bucket, objname)\n\tputfqn := t.fqn2workfile(fqn)\n\thdhobj = newcksumvalue(r.Header.Get(HeaderDfcChecksumType), r.Header.Get(HeaderDfcChecksumVal))\n\tif hdhobj != nil {\n\t\thtype, hval = hdhobj.get()\n\t}\n\t// optimize out if the checksums do match\n\tif hdhobj != nil && cksumcfg.Checksum != ChecksumNone {\n\t\tfile, err = os.Open(fqn)\n\t\t// exists - compute checksum and compare with the caller's\n\t\tif err == nil {\n\t\t\tslab := selectslab(0) // unknown size\n\t\t\tbuf := slab.alloc()\n\t\t\tif htype == ChecksumXXHash {\n\t\t\t\txx := xxhash.New64()\n\t\t\t\txxhashval, errstr = ComputeXXHash(file, buf, xx)\n\t\t\t} else {\n\t\t\t\terrstr = fmt.Sprintf(\"Unsupported checksum type %s\", htype)\n\t\t\t}\n\t\t\t// not a critical error\n\t\t\tif errstr != \"\" {\n\t\t\t\tglog.Warningf(\"Warning: Bad checksum: %s: %v\", fqn, errstr)\n\t\t\t}\n\t\t\tslab.free(buf)\n\t\t\t// not a critical error\n\t\t\tif err = file.Close(); err != nil {\n\t\t\t\tglog.Warningf(\"Unexpected failure to close %s once xxhash-ed, err: %v\", fqn, err)\n\t\t\t}\n\t\t\tif errstr == \"\" && xxhashval == hval {\n\t\t\t\tglog.Infof(\"Existing %s/%s is valid: PUT is a no-op\", bucket, objname)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tinmem := (ctx.config.Experimental.AckPut == AckWhenInMem)\n\tif sgl, nhobj, _, errstr = t.receive(putfqn, inmem, objname, \"\", hdhobj, r.Body); errstr != \"\" {\n\t\treturn\n\t}\n\tif nhobj != nil {\n\t\tnhtype, nhval = nhobj.get()\n\t\tassert(hdhobj == nil || htype == nhtype)\n\t}\n\t// validate checksum when and if provided\n\tif hval != \"\" && nhval != \"\" && hval != nhval {\n\t\terrstr = fmt.Sprintf(\"Bad checksum: %s/%s %s %s... != %s...\", bucket, objname, htype, hval[:8], nhval[:8])\n\t\treturn\n\t}\n\t// commit\n\tprops := &objectProps{nhobj: nhobj}\n\tif sgl == nil {\n\t\terrstr, errcode = t.putCommit(bucket, objname, putfqn, fqn, props, false /*rebalance*/)\n\t\tif errstr == \"\" {\n\t\t\tlat := int64(time.Since(started) / 1000)\n\t\t\tt.statsif.addMany(\"numput\", int64(1), \"putlatency\", lat)\n\t\t\tif glog.V(4) {\n\t\t\t\tglog.Infof(\"PUT: %s/%s, %d µs\", bucket, objname, lat)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\t// FIXME: use xaction\n\tgo t.sglToCloudAsync(sgl, bucket, objname, putfqn, fqn, props)\n\treturn\n}", "title": "" }, { "docid": "1e127f01912b53a2e554e08a99145ef0", "score": "0.49647608", "text": "func (ltd *Libp2pTestData) VerifyFileTransferredIntoStore(t *testing.T, link datamodel.Link, bs bstore.Blockstore, readLen uint64) {\n\tbsvc := blockservice.New(bs, offline.Exchange(bs))\n\tdagService := merkledag.NewDAGService(bsvc)\n\tltd.verifyFileTransferred(t, link, dagService, readLen)\n}", "title": "" }, { "docid": "1fb44986905503bb2bd12c42d3321223", "score": "0.49487385", "text": "func checkGetTLFCryptKeyV3(t *testing.T, expected expectedRekeyInfoV3,\n\texpectedTLFCryptKey kbfscrypto.TLFCryptKey,\n\twkb *TLFWriterKeyBundleV3, rkb *TLFReaderKeyBundleV3) {\n\tfor uid, privKeys := range expected.writerPrivKeys {\n\t\tfor privKey := range privKeys {\n\t\t\tpubKey := privKey.GetPublicKey()\n\t\t\tserverHalf, ok := expected.serverHalves[uid][pubKey]\n\t\t\trequire.True(t, ok, \"writer uid=%s, key=%s\",\n\t\t\t\tuid, pubKey)\n\n\t\t\tinfo, ok := wkb.Keys[uid][pubKey]\n\t\t\trequire.True(t, ok)\n\n\t\t\tePubKey := wkb.TLFEphemeralPublicKeys[info.EPubKeyIndex]\n\n\t\t\tcheckCryptKeyInfo(t, privKey, serverHalf,\n\t\t\t\texpected.writerEPubKeyIndex, expected.ePubKey,\n\t\t\t\texpectedTLFCryptKey, info, ePubKey)\n\t\t}\n\t}\n\n\tfor uid, privKeys := range expected.readerPrivKeys {\n\t\tfor privKey := range privKeys {\n\t\t\tpubKey := privKey.GetPublicKey()\n\t\t\tserverHalf, ok := expected.serverHalves[uid][pubKey]\n\t\t\trequire.True(t, ok, \"reader uid=%s, key=%s\",\n\t\t\t\tuid, pubKey)\n\n\t\t\tinfo, ok := rkb.Keys[uid][pubKey]\n\t\t\trequire.True(t, ok)\n\n\t\t\tePubKey := rkb.TLFEphemeralPublicKeys[info.EPubKeyIndex]\n\n\t\t\tcheckCryptKeyInfo(t, privKey, serverHalf,\n\t\t\t\texpected.readerEPubKeyIndex, expected.ePubKey,\n\t\t\t\texpectedTLFCryptKey, info, ePubKey)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "20e10d6976221f7c9e75821a523633f6", "score": "0.4932963", "text": "func TestUploadAndDownload(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip()\n\t}\n\n\t// Create a server and add a host to the network.\n\tst := newServerTester(t)\n\tst.announceHost()\n\n\tfor st.hostdb.NumHosts() == 0 {\n\t\ttime.Sleep(time.Millisecond)\n\t}\n\n\t// Upload to the host.\n\tst.callAPI(\"/renter/upload?pieces=1&source=api.go&nickname=first\")\n\n\t// Wait for the upload to finish - this is necessary due to the\n\t// fact that zero-conf transactions aren't actually propagated properly.\n\t//\n\t// TODO: There should be some way to just spinblock until the download\n\t// completes. Except there's no exported function in the renter that will\n\t// indicate if a download has completed or not.\n\ttime.Sleep(consensus.RenterZeroConfDelay + time.Second*10)\n\n\tfiles := st.renter.FileList()\n\tif len(files) != 1 || !files[0].Available() {\n\t\tt.Fatal(\"file is not uploaded\")\n\t}\n\n\t// Try to download the file.\n\tst.callAPI(\"/renter/download?destination=renterTestDL_test&nickname=first\")\n\ttime.Sleep(time.Second * 2)\n\n\t// Check that the downloaded file is equal to the uploaded file.\n\tupFile, err := os.Open(\"api.go\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer upFile.Close()\n\tdownFile, err := os.Open(\"renterTestDL_test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer upFile.Close()\n\tupRoot, err := crypto.ReaderMerkleRoot(upFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdownRoot, err := crypto.ReaderMerkleRoot(downFile)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif upRoot != downRoot {\n\t\tt.Error(\"uploaded and downloaded file have a hash mismatch\")\n\t}\n}", "title": "" }, { "docid": "a26a62c8e12ca1e1a93fbf749acdaf14", "score": "0.4908866", "text": "func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) }", "title": "" }, { "docid": "60d542cb0fbd916c61ff6871bea41ba2", "score": "0.48790333", "text": "func checkPeerFile() {\n\t// logrus.Info(\"Checking peer file: \" + p2pConfigDir + \"/\" + p2pConfigFile)\n\tif !directoryMissing(p2pConfigDir) {\n\t\t// logrus.Info(p2pConfigDir + \" exists\")\n\t\tif fileExists(configPeerIDFile) {\n\t\t\t// logrus.Info(configPeerIDFile + \" exists\")\n\t\t\tpeerIdentity := readFile(configPeerIDFile)\n\t\t\tif len(peerIdentity) > 16 {\n\t\t\t\tlogrus.Debug(\"Machine identity looks ok\")\n\t\t\t\tlogrus.Info(\"Machine Identity: \" + peerIdentity)\n\t\t\t\t// TODO ADD MORE VALIDATION\n\t\t\t} else if len(peerIdentity) < 16 {\n\t\t\t\tdeleteFile(configPeerIDFile)\n\t\t\t\tgeneratePeerID()\n\t\t\t}\n\t\t} else if !fileExists(configPeerIDFile) {\n\t\t\tlogrus.Warning(\"File \" + configPeerIDFile + \" does not exist.\")\n\t\t\tcreateFile(configPeerIDFile)\n\t\t\tgeneratePeerID()\n\t\t}\n\t} else if directoryMissing(p2pConfigDir) {\n\t\tfmt.Println(\"Directory \" + p2pConfigDir + \" does not exist.\")\n\t}\n}", "title": "" }, { "docid": "14b54241b878d5e8a34950cde96d40fb", "score": "0.48784253", "text": "func CHECKFILEORDIR2(DIr string) {\n\tf, err := os.Stat(DIr)\n\tif err != nil {\n\t\ttemplate.ReD(DIr + \"is not exsit\")\n\t\tos.Exit(0)\n\t}\n\tif f != nil {\n\t\tif strings.Contains(DIr, \"\\\\\") {\n\t\t\tNewDir, FIlename := ONEFILEDISplay(DIr)\n\t\t\tDirList, _ := ioutil.ReadDir(NewDir)\n\t\t\tfor _, v := range DirList {\n\n\t\t\t\tif v.Name() == FIlename {\n\n\t\t\t\t\tSplitstrings := strings.Split(FIlename, \".\")\n\t\t\t\t\tfmt.Print(v.Mode())\n\t\t\t\t\tBZPRINT(v.ModTime().Format(\"2006-01-02 15:04:05\"), strconv.FormatInt(v.Size(), 10))\n\t\t\t\t\tDISPLAYcolor(Splitstrings[len(Splitstrings)-1], FIlename)\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\t\t\tLLONEFILECOLOR(DIr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1ab67391332bdf10ddba9ed61bc38b2d", "score": "0.48689649", "text": "func TestDependencyVersionsConsistent(t *testing.T) {\n\t// Collect the dependencies of all modules in GOROOT, indexed by module path.\n\ttype requirement struct {\n\t\tRequired module.Version\n\t\tReplacement module.Version\n\t}\n\tseen := map[string]map[requirement][]gorootModule{} // module path → requirement → set of modules with that requirement\n\tfor _, m := range findGorootModules(t) {\n\t\tif !m.hasVendor {\n\t\t\t// TestAllDependenciesVendored will ensure that the module has no\n\t\t\t// dependencies.\n\t\t\tcontinue\n\t\t}\n\n\t\t// We want this test to be able to run offline and with an empty module\n\t\t// cache, so we verify consistency only for the module versions listed in\n\t\t// vendor/modules.txt. That includes all direct dependencies and all modules\n\t\t// that provide any imported packages.\n\t\t//\n\t\t// It's ok if there are undetected differences in modules that do not\n\t\t// provide imported packages: we will not have to pull in any backports of\n\t\t// fixes to those modules anyway.\n\t\tvendor, err := ioutil.ReadFile(filepath.Join(m.Dir, \"vendor\", \"modules.txt\"))\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, line := range strings.Split(strings.TrimSpace(string(vendor)), \"\\n\") {\n\t\t\tparts := strings.Fields(line)\n\t\t\tif len(parts) < 3 || parts[0] != \"#\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// This line is of the form \"# module version [=> replacement [version]]\".\n\t\t\tvar r requirement\n\t\t\tr.Required.Path = parts[1]\n\t\t\tr.Required.Version = parts[2]\n\t\t\tif len(parts) >= 5 && parts[3] == \"=>\" {\n\t\t\t\tr.Replacement.Path = parts[4]\n\t\t\t\tif module.CheckPath(r.Replacement.Path) != nil {\n\t\t\t\t\t// If the replacement is a filesystem path (rather than a module path),\n\t\t\t\t\t// we don't know whether the filesystem contents have changed since\n\t\t\t\t\t// the module was last vendored.\n\t\t\t\t\t//\n\t\t\t\t\t// Fortunately, we do not currently use filesystem-local replacements\n\t\t\t\t\t// in GOROOT modules.\n\t\t\t\t\tt.Errorf(\"cannot check consistency for filesystem-local replacement in module %s (%s):\\n%s\", m.Path, m.Dir, line)\n\t\t\t\t}\n\n\t\t\t\tif len(parts) >= 6 {\n\t\t\t\t\tr.Replacement.Version = parts[5]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif seen[r.Required.Path] == nil {\n\t\t\t\tseen[r.Required.Path] = make(map[requirement][]gorootModule)\n\t\t\t}\n\t\t\tseen[r.Required.Path][r] = append(seen[r.Required.Path][r], m)\n\t\t}\n\t}\n\n\t// Now verify that we saw only one distinct version for each module.\n\tfor path, versions := range seen {\n\t\tif len(versions) > 1 {\n\t\t\tt.Errorf(\"Modules within GOROOT require different versions of %s.\", path)\n\t\t\tfor r, mods := range versions {\n\t\t\t\tdesc := new(strings.Builder)\n\t\t\t\tdesc.WriteString(r.Required.Version)\n\t\t\t\tif r.Replacement.Path != \"\" {\n\t\t\t\t\tfmt.Fprintf(desc, \" => %s\", r.Replacement.Path)\n\t\t\t\t\tif r.Replacement.Version != \"\" {\n\t\t\t\t\t\tfmt.Fprintf(desc, \" %s\", r.Replacement.Version)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor _, m := range mods {\n\t\t\t\t\tt.Logf(\"%s\\trequires %v\", m.Path, desc)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "516aca4d7e818358171fec413cf26873", "score": "0.48679274", "text": "func TestDoubleEntryFailure(t *testing.T) {\n\tt.Skip(\"Skipping until DAGModifier can be fixed.\")\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t_, mnt := setupIpnsTest(t, nil)\n\tdefer mnt.Close()\n\n\tdname := mnt.Dir + \"/local/thisisadir\"\n\terr := os.Mkdir(dname, 0777)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = os.Mkdir(dname, 0777)\n\tif err == nil {\n\t\tt.Fatal(\"Should have gotten error one creating new directory.\")\n\t}\n}", "title": "" }, { "docid": "12332d96590bd6bc9cd968c1c273c034", "score": "0.48623902", "text": "func TestRootMetadataReaderUpconversionPrivate(t *testing.T) {\n\tctx := context.Background()\n\tconfigWriter := MakeTestConfigOrBust(t, \"alice\", \"bob\")\n\tconfigWriter.SetKeyCache(&dummyNoKeyCache{})\n\tdefer CheckConfigAndShutdown(ctx, t, configWriter)\n\n\ttlfID := tlf.FakeID(1, tlf.Private)\n\th := parseTlfHandleOrBust(t, configWriter, \"alice#bob\", tlf.Private, tlfID)\n\trmd, err := makeInitialRootMetadata(kbfsmd.InitialExtraMetadataVer, tlfID, h)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(0), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.PreExtraMetadataVer, rmd.Version())\n\n\t// set some dummy numbers\n\tdiskUsage, refBytes, unrefBytes := uint64(12345), uint64(4321), uint64(1234)\n\trmd.SetDiskUsage(diskUsage)\n\trmd.SetRefBytes(refBytes)\n\trmd.SetUnrefBytes(unrefBytes)\n\n\t// Have the writer key it first.\n\tdone, _, err := configWriter.KeyManager().Rekey(\n\t\tcontext.Background(), rmd, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(1), rmd.Revision())\n\trequire.Equal(t, kbfsmd.PreExtraMetadataVer, rmd.Version())\n\trequire.Equal(t, 1, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).WKeys[0].TLFEphemeralPublicKeys))\n\trequire.Equal(t, 0, len(rmd.bareMd.(*kbfsmd.RootMetadataV2).RKeys[0].TLFReaderEphemeralPublicKeys))\n\n\t// Set the private MD, to make sure it gets copied properly during\n\t// upconversion.\n\t_, aliceID, err := configWriter.KBPKI().Resolve(\n\t\tcontext.Background(), \"alice\", keybase1.OfflineAvailability_NONE)\n\trequire.NoError(t, err)\n\taliceUID, err := aliceID.AsUser()\n\trequire.NoError(t, err)\n\n\terr = encryptMDPrivateData(context.Background(), configWriter.Codec(),\n\t\tconfigWriter.Crypto(), configWriter.Crypto(),\n\t\tconfigWriter.KeyManager(), aliceUID, rmd)\n\trequire.NoError(t, err)\n\n\t// add a device for bob and rekey as bob\n\t_, bobID, err := configWriter.KBPKI().Resolve(\n\t\tcontext.Background(), \"bob\", keybase1.OfflineAvailability_NONE)\n\trequire.NoError(t, err)\n\tbobUID, err := bobID.AsUser()\n\trequire.NoError(t, err)\n\n\tconfigReader := ConfigAsUser(configWriter, \"bob\")\n\tconfigReader.SetKeyCache(&dummyNoKeyCache{})\n\tdefer CheckConfigAndShutdown(ctx, t, configReader)\n\tAddDeviceForLocalUserOrBust(t, configWriter, bobUID)\n\tAddDeviceForLocalUserOrBust(t, configReader, bobUID)\n\n\t// Override the metadata version, make a successor, and rekey as\n\t// reader. This should keep the version the same, since readers\n\t// can't upconvert.\n\tconfigReader.metadataVersion = kbfsmd.SegregatedKeyBundlesVer\n\trmd2, err := rmd.MakeSuccessor(context.Background(),\n\t\tconfigReader.MetadataVersion(), configReader.Codec(),\n\t\tconfigReader.KeyManager(), configReader.KBPKI(),\n\t\tconfigReader.KBPKI(), configReader, kbfsmd.FakeID(1), false)\n\trequire.NoError(t, err)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd2.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(2), rmd2.Revision())\n\trequire.Equal(t, kbfsmd.PreExtraMetadataVer, rmd2.Version())\n\t// Do this instead of require.Nil because we want to assert\n\t// that it's untyped nil.\n\trequire.True(t, rmd2.extra == nil)\n\tdone, _, err = configReader.KeyManager().Rekey(\n\t\tcontext.Background(), rmd2, false)\n\trequire.NoError(t, err)\n\trequire.True(t, done)\n\trequire.Equal(t, kbfsmd.KeyGen(1), rmd2.LatestKeyGeneration())\n\trequire.Equal(t, kbfsmd.Revision(2), rmd2.Revision())\n\trequire.Equal(t, kbfsmd.PreExtraMetadataVer, rmd2.Version())\n\trequire.True(t, rmd2.IsWriterMetadataCopiedSet())\n\trequire.True(t, bytes.Equal(rmd.GetSerializedPrivateMetadata(),\n\t\trmd2.GetSerializedPrivateMetadata()))\n\n\trmds, err := SignBareRootMetadata(context.Background(),\n\t\tconfigReader.Codec(), configReader.Crypto(), configReader.Crypto(),\n\t\trmd2.bareMd, configReader.Clock().Now())\n\trequire.NoError(t, err)\n\terr = rmds.IsValidAndSigned(\n\t\tctx, configReader.Codec(), nil, rmd2.extra,\n\t\tkeybase1.OfflineAvailability_NONE)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "a126220ce92bb3aaa76d91de4e32cb1f", "score": "0.4853027", "text": "func checkStorageFolderEqual(t *testing.T, testName string, got, want *storageFolder) {\n\tif got.id != want.id {\n\t\tt.Errorf(\"Test %v %v: expect id %v, got %v\", t.Name(), testName, want.id, got.id)\n\t}\n\tif got.path != want.path {\n\t\tt.Errorf(\"Test %v %v: expect Path %v, got %v\", t.Name(), testName, want.path, got.path)\n\t}\n\tif got.numSectors != want.numSectors {\n\t\tt.Errorf(\"Test %v %v: expect NumSectors %v, got %v\", t.Name(), testName, want.numSectors, got.numSectors)\n\t}\n\tif len(got.usage) != len(want.usage) {\n\t\tt.Fatalf(\"Test %v %v: Usage not having the same length. expect %v, got %v\", t.Name(), testName,\n\t\t\twant.usage, got.usage)\n\t}\n\tfor i := range got.usage {\n\t\tif got.usage[i] != want.usage[i] {\n\t\t\tt.Errorf(\"Test %v %v: Usage[%d] not equal. expect %v, got %v\", t.Name(), testName, i, want.usage[i], got.usage[i])\n\t\t}\n\t}\n\tif got.storedSectors != want.storedSectors {\n\t\tt.Errorf(\"Test %v %v: expect storedSectors %v, got %v\", t.Name(), testName, want.storedSectors, got.storedSectors)\n\t}\n}", "title": "" }, { "docid": "23a500bbac8c4977bad9ae886ce476f1", "score": "0.48392364", "text": "func checkFailureAndClean(t *testing.T, buildDir string, oldPath string) {\n\tif t.Failed() {\n\t\tt.Log(\"Performing cleanup...\")\n\t\ttests.RemovePath(buildDir, t)\n\t\ttests.RenamePath(oldPath, filepath.Join(filepath.Join(\"..\", \"testdata\"), withGit), t)\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "afd5c0c2d3c8de6e104350452f780562", "score": "0.4835532", "text": "func TestCrDoubleResolutionRmTree(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\", \"charlie\"),\n\t\tas(alice,\n\t\t\twrite(\"a/b/c/d/e\", \"test1\"),\n\t\t\twrite(\"a/b/c/d/f\", \"test2\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(charlie,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"g\", \"hello\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\t// Remove a tree of files.\n\t\t\trm(\"a/b/c/d/e\"),\n\t\t\trm(\"a/b/c/d/f\"),\n\t\t\trm(\"a/b/c/d\"),\n\t\t\trm(\"a/b/c\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"\", m{\"a\": \"DIR\", \"g\": \"FILE\"}),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{}),\n\t\t\tread(\"g\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"\", m{\"a\": \"DIR\", \"g\": \"FILE\"}),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{}),\n\t\t\tread(\"g\", \"hello\"),\n\t\t),\n\t\tas(charlie, noSync(),\n\t\t\t// Touch a subdirectory that was removed by bob.\n\t\t\t// Unfortunately even though these are just rmOps, they\n\t\t\t// still re-create \"c/d\". Tracking a fix for that in\n\t\t\t// KBFS-1423.\n\t\t\trm(\"a/b/c/d/e\"),\n\t\t\trm(\"a/b/c/d/f\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"\", m{\"a\": \"DIR\", \"g\": \"FILE\"}),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c\", m{\"d\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c/d\", m{}),\n\t\t\tread(\"g\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"\", m{\"a\": \"DIR\", \"g\": \"FILE\"}),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c\", m{\"d\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c/d\", m{}),\n\t\t\tread(\"g\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tlsdir(\"\", m{\"a\": \"DIR\", \"g\": \"FILE\"}),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c\", m{\"d\": \"DIR\"}),\n\t\t\tlsdir(\"a/b/c/d\", m{}),\n\t\t\tread(\"g\", \"hello\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "78712a3191df7e2f245f559f00d68252", "score": "0.48277068", "text": "func (vcd *TestVCD) Test_UploadOvf_cleaned_extracted_files(check *C) {\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\n\tskipWhenOvaPathMissing(vcd.config.OVA.OvaPath, check)\n\n\titemName := TestUploadOvf + \"6\"\n\n\t//check existing count of folders\n\toldFolderCount := countFolders()\n\n\tcatalog, _ := findCatalog(vcd, check, vcd.config.VCD.Catalog.Name)\n\n\tuploadTask, err := catalog.UploadOvf(vcd.config.OVA.OvaPath, itemName, \"upload from test\", 1024)\n\tcheck.Assert(err, IsNil)\n\terr = uploadTask.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\tAddToCleanupList(itemName, \"catalogItem\", vcd.org.Org.Name+\"|\"+vcd.config.VCD.Catalog.Name, \"Test_UploadOvf\")\n\n\tcheck.Assert(oldFolderCount, Equals, countFolders())\n\n}", "title": "" }, { "docid": "b2182b03f8a828c120f05b13fdda608e", "score": "0.48177248", "text": "func TestCrConflictSetexToRemovedMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tskip(\"dokan\", \"SetEx is a non-op on Dokan, thus no conflict.\"),\n\t\tblockSize(20), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\tsetex(\"a/b\", true),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"b$\": \"EXEC\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"b$\": \"EXEC\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "9ff7d2cad0a5d4eda0f795e26c1a0a63", "score": "0.47995266", "text": "func TestRevoke(t *testing.T) {\n\t// Users\n\t// Alice : Creator\n\t// Bob : Shared by Alice\n\t// Carl : Shared by Bob\n\tu1, err := GetUser(\"alice\", \"fubar\")\n\tif err != nil {\n\t\tt.Error(\"Failed to reload user\", err)\n\t}\n\tt.Log(\"Loaded user\", u1)\n\tu2, err := GetUser(\"bob\", \"foobar\")\n\tif err != nil {\n\t\tt.Error(\"Failed to reload user\", err)\n\t}\n\tt.Log(\"Loaded user\", u2)\n\tu3, err := GetUser(\"carl\", \"fallbar\")\n\tif err != nil {\n\t\tt.Error(\"Failed to reload user\", err)\n\t}\n\tt.Log(\"Loaded user\", u3)\n\n\t// Init variables\n\tvar v1, v2, v3 []byte\n\tvar originText []byte\n\tvar msgid string\n\n\t// Alice load file\n\tv1, err = u1.LoadFile(\"file1\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file from alice\", err)\n\t}\n\toriginText = v1\n\tt.Log(\"Alice loaded 'file1'\")\n\n\t// Bob load file\n\tv2, err = u2.LoadFile(\"file2\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file from alice\", err)\n\t}\n\tt.Log(\"Bob loads 'file2'\")\n\n\t// Compare file of Alice's and Bob's\n\tif !reflect.DeepEqual(v1, v2) {\n\t\tt.Error(\"Shared file is not the same\", v1, v2)\n\t}\n\tt.Log(\"Alice's 'file1' and Bob's 'file2' are equal -- Correct!\")\n\n\t// Carl load file\n\tv3, err = u3.LoadFile(\"file3\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file from alice\", err)\n\t}\n\tt.Log(\"Carl loads 'file3'\")\n\n\t// Compare file of Bob's and Carl's\n\tif !reflect.DeepEqual(v2, v3) {\n\t\tt.Error(\"Shared file is not the same\", v2, v3)\n\t}\n\tt.Log(\"Bob's 'file2' and Carl's 'file3' are equal -- Correct!\")\n\n\t// Alice try revoke\n\terr = u1.RevokeFile(\"file1\")\n\tif err != nil {\n\t\tt.Error(\"Creator should be able to Revoke File\", err)\n\t}\n\tt.Log(\"Alice successfully revoked her 'file1' -- Correct!\")\n\n\t// Test Alice load file\n\tv1, err = u1.LoadFile(\"file1\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file from alice\", err)\n\t}\n\tt.Log(\"Alice loaded 'file1' -- Correct!\")\n\n\t// Compare the file with the one before revoke\n\tif !reflect.DeepEqual(originText, v1) {\n\t\tt.Error(\"File is not the same for creator after revoke\", originText, v1)\n\t}\n\tt.Log(\"Alice got same content as that before revoke -- Correct!\")\n\n\t// Test Bob load file (should return nil)\n\tv2, err = u2.LoadFile(\"file2\")\n\tif v2 != nil {\n\t\tt.Error(\"Should not be able to access the file after Alice Revoke\", err)\n\t}\n\tt.Log(\"Bob cannot load 'file2' -- Correct!\")\n\n\t// Test Carl load file (should return nil)\n\tv3, err = u3.LoadFile(\"file3\")\n\tif v3 != nil {\n\t\tt.Error(\"Should not be able to access the file after Alice Revoke\", err)\n\t}\n\tt.Log(\"Carl cannot loads 'file3' -- Correct!\")\n\n\t// Alice do some append again\n\t// Create the message to be appended\n\tappendText := []byte(\"This is append; \")\n\n\t// Call AppendFile by byte for appendText\n\tfor _, letter := range appendText {\n\t\terr = u1.AppendFile(\"file1\", []byte(string(letter)))\n\t\tif err != nil {\n\t\t\tt.Error(\"Failed to append message\", err)\n\t\t}\n\t}\n\tt.Log(\"Alice appended 'This is append; ' to 'file1'\")\n\n\t// Load for check\n\tv1, err = u1.LoadFile(\"file1\")\n\tif err != nil {\n\t\tt.Error(\"Failed to upload and download 1\", err)\n\t}\n\tt.Log(\"Alice loads 'file1'\")\n\n\t// Check correctness\n\tnewText := append(originText, appendText...)\n\tif !reflect.DeepEqual(v1, newText) {\n\t\tt.Error(\"Downloaded file is not the same: \\n\", newText, \"\\n\", v1)\n\t}\n\tt.Log(\"Alice got correct result for appending -- Correct!\")\n\n\n\t// Alice share file to Bob\n\tmsgid, err = u1.ShareFile(\"file1\", \"bob\")\n\tif err != nil {\n\t\tt.Error(\"Failed to share the a file\", err)\n\t}\n\tt.Log(\"Alice shares 'file1' as file to Bob\")\n\n\t// Bob receive the share from Alice\n\terr = u2.ReceiveFile(\"file2\", \"alice\", msgid)\n\tif err != nil {\n\t\tt.Error(\"Failed to receive the share message\", err)\n\t}\n\tt.Log(\"Bob receives file as 'file2' from Alice\" )\n\n\t// Bob loads file\n\tv2, err = u2.LoadFile(\"file2\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file after sharing\", err)\n\t}\n\tt.Log(\"Bob loads 'file2'\")\n\n\t// Compare file of Alice's and Bob's\n\tif !reflect.DeepEqual(v1, v2) {\n\t\tt.Error(\"Shared file is not the same\", v1, v2)\n\t}\n\tt.Log(\"Alice's 'file1' and Bob's 'file2' are equal -- Correct!\")\n\n\t// Bob share to Carl\n\tmsgid, err = u2.ShareFile(\"file2\", \"carl\")\n\tif err != nil {\n\t\tt.Error(\"Failed to share the a file\", err)\n\t}\n\tt.Log(\"Bob shares 'file2' as file to Carl\")\n\n\t// Carl receives the file\n\terr = u3.ReceiveFile(\"file3\", \"bob\", msgid)\n\tif err != nil {\n\t\tt.Error(\"Failed to receive the share message\", err)\n\t}\n\tt.Log(\"Carl receives file as 'file3' from Bob\" )\n\n\t// Carl loads file\n\tv3, err = u3.LoadFile(\"file3\")\n\tif err != nil {\n\t\tt.Error(\"Failed to download the file after sharing\", err)\n\t}\n\tt.Log(\"Carl loads 'file3'\")\n\n\t// Compare file of Bob's and Carl's\n\tif !reflect.DeepEqual(v2, v3) {\n\t\tt.Error(\"Shared file is not the same\", v2, v3)\n\t}\n\tt.Log(\"Bob's 'file2' and Carl's 'file3' are equal -- Correct!\")\n\n}", "title": "" }, { "docid": "277a1f691f37ca589aa8bfe0fe28867c", "score": "0.4799254", "text": "func TestDrudS3ValidDownloadObjects(t *testing.T) {\n\taccessKeyID := os.Getenv(\"DDEV_DRUD_S3_AWS_ACCESS_KEY_ID\")\n\tsecretAccessKey := os.Getenv(\"DDEV_DRUD_S3_AWS_SECRET_ACCESS_KEY\")\n\tif accessKeyID == \"\" || secretAccessKey == \"\" {\n\t\tt.Skip(\"No DDEV_DRUD_S3_AWS_ACCESS_KEY_ID and DDEV_DRUD_S3_AWS_SECRET_ACCESS_KEY env vars have been set. Skipping DrudS3 specific test.\")\n\t}\n\n\t// Set up tests and give ourselves a working directory.\n\tassert := asrt.New(t)\n\ttestDir := testcommon.CreateTmpDir(\"TestDrudS3ValidDownloadObjects\")\n\n\t// testcommon.Chdir()() and CleanupDir() checks their own errors (and exit)\n\tdefer testcommon.CleanupDir(testDir)\n\tdefer testcommon.Chdir(testDir)()\n\terr := os.MkdirAll(\"sites/default/files\", 0777)\n\tassert.NoError(err)\n\n\tprovider := ddevapp.DrudS3Provider{\n\t\tProviderType: \"drud-s3\",\n\t\tAWSSecretKey: secretAccessKey,\n\t\tAWSAccessKey: accessKeyID,\n\t\tS3Bucket: drudS3TestBucket,\n\t\tEnvironmentName: drudS3TestEnvName,\n\t}\n\n\tapp, err := ddevapp.NewApp(testDir, true, \"drud-s3\")\n\tassert.NoError(err)\n\tapp.Name = drudS3TestSiteName\n\tapp.Type = ddevapp.AppTypeDrupal7\n\n\terr = provider.Init(app)\n\tassert.NoError(err)\n\t// Write the provider config\n\terr = provider.Write(app.GetConfigPath(\"import.yaml\"))\n\tassert.NoError(err)\n\n\terr = app.WriteConfig()\n\tassert.NoError(err)\n\terr = app.Init(testDir)\n\tassert.NoError(err)\n\n\t// Ensure we can get a db backup on the happy path.\n\tbackupLink, importPath, err := provider.GetBackup(\"database\", \"\")\n\tassert.NoError(err)\n\tassert.Equal(importPath, \"\")\n\tassert.True(strings.HasSuffix(backupLink, \"sql.gz\"))\n\n\t// Ensure we can do a pull on the configured site.\n\tapp, err = ddevapp.GetActiveApp(\"\")\n\tassert.NoError(err)\n\terr = app.Pull(&provider, &ddevapp.PullOptions{})\n\tassert.NoError(err)\n\terr = app.Stop(true, false)\n\tassert.NoError(err)\n\n\t// Make sure invalid access key gets correct behavior\n\tprovider.AWSAccessKey = \"AKIAIBSTOTALLYINVALID\"\n\t_, _, err = provider.GetBackup(\"database\", \"\")\n\tassert.Error(err)\n\tif err != nil {\n\t\tassert.Contains(err.Error(), \"InvalidAccessKeyId\")\n\t}\n\n\t// Make sure invalid secret key gets correct behavior\n\tprovider.AWSAccessKey = accessKeyID\n\tprovider.AWSSecretKey = \"rweeHGZ5totallyinvalidsecretkey\"\n\t_, _, err = provider.GetBackup(\"database\", \"\")\n\tassert.Error(err)\n\tif err != nil {\n\t\tassert.Contains(err.Error(), \"SignatureDoesNotMatch\")\n\t}\n\n\t// Make sure bad environment gets correct behavior.\n\tprovider.AWSSecretKey = secretAccessKey\n\tprovider.EnvironmentName = \"someInvalidUnknownEnvironment\"\n\t_, _, err = provider.GetBackup(\"database\", \"\")\n\tassert.Error(err)\n\tif err != nil {\n\t\tassert.Contains(err.Error(), \"could not find an environment\")\n\t}\n\n\t// Make sure bad bucket gets correct behavior.\n\tprovider.S3Bucket = drudS3TestBucket\n\tprovider.S3Bucket = \"someInvalidUnknownBucket\"\n\t_, _, err = provider.GetBackup(\"database\", \"\")\n\tassert.Error(err)\n\tif err != nil {\n\t\tassert.Contains(err.Error(), \"NoSuchBucket\")\n\t}\n}", "title": "" }, { "docid": "225f5213e013f67444c5f851d5fc86bd", "score": "0.4798732", "text": "func TestCrConflictUnmergedWriteMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), blockChangeSize(20*1024), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\", crnameEsc(\"b\", bob): \"FILE\"}),\n\t\t\tread(\"a/b\", \"hello\"),\n\t\t\tread(crname(\"a/b\", bob), ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\", crnameEsc(\"b\", bob): \"FILE\"}),\n\t\t\tread(\"a/b\", \"hello\"),\n\t\t\tread(crname(\"a/b\", bob), ntimesString(15, \"0123456789\")),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "da8413a4cfa67c37e2bb9ae70be3cbb4", "score": "0.47911614", "text": "func requireRotationSuccessful(t *testing.T, repo1 *NotaryRepository, keysToRotate map[data.RoleName]bool) {\n\t// Create a new repo that is used to download the data after the rotation\n\trepo2, _ := newRepoToTestRepo(t, repo1, true)\n\tdefer os.RemoveAll(repo2.baseDir)\n\n\trepos := []*NotaryRepository{repo1, repo2}\n\n\toldRoles := make(map[string]data.BaseRole)\n\tfor roleName := range keysToRotate {\n\t\tbaseRole, err := repo1.tufRepo.GetBaseRole(roleName)\n\t\trequire.NoError(t, err)\n\t\trequire.Len(t, baseRole.Keys, 1)\n\n\t\toldRoles[roleName.String()] = baseRole\n\t}\n\n\t// Confirm no changelists get published\n\tchangesPre := getChanges(t, repo1)\n\n\t// Do rotation\n\tfor role, serverManaged := range keysToRotate {\n\t\trequire.NoError(t, repo1.RotateKey(role, serverManaged, nil))\n\t}\n\n\tchangesPost := getChanges(t, repo1)\n\trequire.Equal(t, changesPre, changesPost)\n\n\t// Download data from remote and check that keys have changed\n\tfor _, repo := range repos {\n\t\terr := repo.Update(true)\n\t\trequire.NoError(t, err)\n\n\t\tfor roleName, isRemoteKey := range keysToRotate {\n\t\t\tbaseRole, err := repo1.tufRepo.GetBaseRole(roleName)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, baseRole.Keys, 1)\n\n\t\t\t// in the new key is not the same as any of the old keys\n\t\t\tfor oldKeyID, oldPubKey := range oldRoles[roleName.String()].Keys {\n\t\t\t\t_, ok := baseRole.Keys[oldKeyID]\n\t\t\t\trequire.False(t, ok)\n\n\t\t\t\t// in the old repo, the old keys have been removed not just from\n\t\t\t\t// the TUF file, but from the cryptoservice (unless it's a root\n\t\t\t\t// key, in which case it should NOT be removed)\n\t\t\t\tif repo == repo1 {\n\t\t\t\t\tcanonicalID, err := utils.CanonicalKeyID(oldPubKey)\n\t\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\t\t_, _, err = repo.CryptoService.GetPrivateKey(canonicalID)\n\t\t\t\t\tswitch roleName {\n\t\t\t\t\tcase data.CanonicalRootRole:\n\t\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\trequire.Error(t, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// On the old repo, the new key is present in the cryptoservice, or\n\t\t\t// not present if remote.\n\t\t\tif repo == repo1 {\n\t\t\t\tpubKey := baseRole.ListKeys()[0]\n\t\t\t\tcanonicalID, err := utils.CanonicalKeyID(pubKey)\n\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\tkey, _, err := repo.CryptoService.GetPrivateKey(canonicalID)\n\t\t\t\tif isRemoteKey {\n\t\t\t\t\trequire.Error(t, err)\n\t\t\t\t\trequire.Nil(t, key)\n\t\t\t\t} else {\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\trequire.NotNil(t, key)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6ecabc89afe686bb572de36c3971c7ee", "score": "0.47887114", "text": "func TestFileRedundancy(t *testing.T) {\n\tnDatas := []int{1, 2, 10}\n\tneverOffline := make(map[types.FileContractID]bool)\n\tgoodForRenew := make(map[types.FileContractID]bool)\n\tfor i := 0; i < 5; i++ {\n\t\tneverOffline[types.FileContractID{byte(i)}] = false\n\t\tgoodForRenew[types.FileContractID{byte(i)}] = true\n\t}\n\n\tfor _, nData := range nDatas {\n\t\trsc, _ := NewRSCode(nData, 10)\n\t\tf := &file{\n\t\t\tsize: 1000,\n\t\t\tpieceSize: 100,\n\t\t\tcontracts: make(map[types.FileContractID]fileContract),\n\t\t\terasureCode: rsc,\n\t\t}\n\t\t// Test that an empty file has 0 redundancy.\n\t\tif r := f.redundancy(neverOffline, goodForRenew); r != 0 {\n\t\t\tt.Error(\"expected 0 redundancy, got\", r)\n\t\t}\n\t\t// Test that a file with 1 filecontract that has a piece for every chunk but\n\t\t// one chunk still has a redundancy of 0.\n\t\tfc := fileContract{\n\t\t\tID: types.FileContractID{0},\n\t\t}\n\t\tfor i := uint64(0); i < f.numChunks()-1; i++ {\n\t\t\tpd := pieceData{\n\t\t\t\tChunk: i,\n\t\t\t\tPiece: 0,\n\t\t\t}\n\t\t\tfc.Pieces = append(fc.Pieces, pd)\n\t\t}\n\t\tf.contracts[fc.ID] = fc\n\t\tif r := f.redundancy(neverOffline, goodForRenew); r != 0 {\n\t\t\tt.Error(\"expected 0 redundancy, got\", r)\n\t\t}\n\t\t// Test that adding another filecontract with a piece for every chunk but one\n\t\t// chunk still results in a file with redundancy 0.\n\t\tfc = fileContract{\n\t\t\tID: types.FileContractID{1},\n\t\t}\n\t\tfor i := uint64(0); i < f.numChunks()-1; i++ {\n\t\t\tpd := pieceData{\n\t\t\t\tChunk: i,\n\t\t\t\tPiece: 1,\n\t\t\t}\n\t\t\tfc.Pieces = append(fc.Pieces, pd)\n\t\t}\n\t\tf.contracts[fc.ID] = fc\n\t\tif r := f.redundancy(neverOffline, goodForRenew); r != 0 {\n\t\t\tt.Error(\"expected 0 redundancy, got\", r)\n\t\t}\n\t\t// Test that adding a file contract with a piece for the missing chunk\n\t\t// results in a file with redundancy > 0 && <= 1.\n\t\tfc = fileContract{\n\t\t\tID: types.FileContractID{2},\n\t\t}\n\t\tpd := pieceData{\n\t\t\tChunk: f.numChunks() - 1,\n\t\t\tPiece: 0,\n\t\t}\n\t\tfc.Pieces = append(fc.Pieces, pd)\n\t\tf.contracts[fc.ID] = fc\n\t\t// 1.0 / MinPieces because the chunk with the least number of pieces has 1 piece.\n\t\texpectedR := 1.0 / float64(f.erasureCode.MinPieces())\n\t\tif r := f.redundancy(neverOffline, goodForRenew); r != expectedR {\n\t\t\tt.Errorf(\"expected %f redundancy, got %f\", expectedR, r)\n\t\t}\n\t\t// Test that adding a file contract that has erasureCode.MinPieces() pieces\n\t\t// per chunk for all chunks results in a file with redundancy > 1.\n\t\tfc = fileContract{\n\t\t\tID: types.FileContractID{3},\n\t\t}\n\t\tfor iChunk := uint64(0); iChunk < f.numChunks(); iChunk++ {\n\t\t\tfor iPiece := uint64(0); iPiece < uint64(f.erasureCode.MinPieces()); iPiece++ {\n\t\t\t\tfc.Pieces = append(fc.Pieces, pieceData{\n\t\t\t\t\tChunk: iChunk,\n\t\t\t\t\t// add 1 since the same piece can't count towards redundancy twice.\n\t\t\t\t\tPiece: iPiece + 1,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tf.contracts[fc.ID] = fc\n\t\t// 1+MinPieces / MinPieces because the chunk with the least number of pieces has 1+MinPieces pieces.\n\t\texpectedR = float64(1+f.erasureCode.MinPieces()) / float64(f.erasureCode.MinPieces())\n\t\tif r := f.redundancy(neverOffline, goodForRenew); r != expectedR {\n\t\t\tt.Errorf(\"expected %f redundancy, got %f\", expectedR, r)\n\t\t}\n\n\t\t// verify offline file contracts are not counted in the redundancy\n\t\tfc = fileContract{\n\t\t\tID: types.FileContractID{4},\n\t\t}\n\t\tfor iChunk := uint64(0); iChunk < f.numChunks(); iChunk++ {\n\t\t\tfor iPiece := uint64(0); iPiece < uint64(f.erasureCode.MinPieces()); iPiece++ {\n\t\t\t\tfc.Pieces = append(fc.Pieces, pieceData{\n\t\t\t\t\tChunk: iChunk,\n\t\t\t\t\tPiece: iPiece,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tf.contracts[fc.ID] = fc\n\t\tspecificOffline := make(map[types.FileContractID]bool)\n\t\tfor fcid := range goodForRenew {\n\t\t\tspecificOffline[fcid] = false\n\t\t}\n\t\tspecificOffline[fc.ID] = true\n\t\tif r := f.redundancy(specificOffline, goodForRenew); r != expectedR {\n\t\t\tt.Errorf(\"expected redundancy to ignore offline file contracts, wanted %f got %f\", expectedR, r)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "73d81b781667e4e4c4b8dd89c0d26305", "score": "0.47883648", "text": "func TestMergeMDiffNotShownForPrim(t *testing.T) {\n\tt.Skip(\"test is not correct WIP\")\n\ttest := NewTest(t, \"merge_m_diff_not_shown_for_prim\")\n\tgot := test.Run(nil)\n\n\tc1 := \"f41bd930ef17b6d2f06eb22847bd78943464df65\"\n\tc2 := \"13dcd0e9ca3d4ed8fe62ec5ad46295eafe9a14ea\"\n\tc3 := \"4c99a9e681b9c699ee100a4311ba0a0e329ab834\"\n\tc4 := \"6b0276de4b0599f7caec246517ceeef2a58e6378\"\n\n\twant := []process.Result{\n\t\t{\n\t\t\tCommit: c1,\n\t\t\tFiles: map[string]*incblame.Blame{\n\t\t\t\t\"a.txt\": file(c1,\n\t\t\t\t\tline(`a`, c1),\n\t\t\t\t),\n\t\t\t\t\"b.txt\": file(c1,\n\t\t\t\t\tline(`b`, c1),\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCommit: c2,\n\t\t\tFiles: map[string]*incblame.Blame{\n\t\t\t\t\"c.txt\": file(c2,\n\t\t\t\t\tline(`c`, c2),\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCommit: c3,\n\t\t\tFiles: map[string]*incblame.Blame{\n\t\t\t\t\"c.txt\": file(c3,\n\t\t\t\t\tline(`c`, c3),\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCommit: c4,\n\t\t\tFiles: map[string]*incblame.Blame{\n\t\t\t\t\"c.txt\": file(c4,\n\t\t\t\t\tline(`c`, c2),\n\t\t\t\t\tline(`d`, c4),\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t}\n\tassertResult(t, want, got)\n}", "title": "" }, { "docid": "f7d02ab02eb07749049bea0df4efb4cf", "score": "0.47857428", "text": "func TestCrConflictWriteMultiblockFileDuringOtherConflict(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), blockChangeSize(100*1024), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/c\", \"foo\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/c\", \"foo\"),\n\t\t\tpwriteBS(\"a/b\", []byte(ntimesString(15, \"9876543210\")), 150),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\", \"c$\": \"FILE\", crnameEsc(\"c\", bob): \"FILE\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"0123456789\")+ntimesString(15, \"9876543210\")),\n\t\t\tread(\"a/c\", \"foo\"),\n\t\t\tread(crname(\"a/c\", bob), \"foo\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"b$\": \"FILE\", \"c$\": \"FILE\", crnameEsc(\"c\", bob): \"FILE\"}),\n\t\t\tread(\"a/b\", ntimesString(15, \"0123456789\")+ntimesString(15, \"9876543210\")),\n\t\t\tread(\"a/c\", \"foo\"),\n\t\t\tread(crname(\"a/c\", bob), \"foo\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "d5aa2d97e4684ee584f6be82c168f3c9", "score": "0.47848997", "text": "func TestFixManifestLayersBadParent(t *testing.T) {\n\tduplicateLayerManifest := schema1.Manifest{\n\t\tFSLayers: []schema1.FSLayer{\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa\")},\n\t\t},\n\t\tHistory: []schema1.History{\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ac3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ac3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:07.568027497Z\\\",\\\"container\\\":\\\"fe9e5a5264a843c9292d17b736c92dd19bdb49986a8782d7389964ddaff887cc\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"cd /go/src/github.com/tonistiigi/dnsdock \\\\u0026\\\\u0026 go get -v github.com/tools/godep \\\\u0026\\\\u0026 godep restore \\\\u0026\\\\u0026 go install -ldflags \\\\\\\"-X main.version `git describe --tags HEAD``if [[ -n $(command git status --porcelain --untracked-files=no 2\\\\u003e/dev/null) ]]; then echo \\\\\\\"-dirty\\\\\\\"; fi`\\\\\\\" ./...\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/bash\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":118430532}\\n\"},\n\t\t},\n\t}\n\n\terr := fixManifestLayers(&duplicateLayerManifest)\n\tassert.Check(t, is.ErrorContains(err, \"invalid parent ID\"))\n}", "title": "" }, { "docid": "a86d5c9d16c226fb1bf1d080699649a4", "score": "0.47824934", "text": "func TestD03(t *testing.T) {\n\tfirst := d03()\n\tif first != 993 {\n\t\tt.Fatalf(\"First Puzzle wrong with %v\\n\", first)\n\t}\n\tsecond := d03Part2()\n\tif second != 1849 {\n\t\tt.Fatalf(\"Second Puzzle wrong with %v\\n\", first)\n\t}\n}", "title": "" }, { "docid": "b04022adb043df8c3acc153a975e0c64", "score": "0.4778416", "text": "func TestCrConflictMoveAndSetMtimeWrittenFile(t *testing.T) {\n\ttargetMtime := time.Now().Add(1 * time.Minute)\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/b\", \"world\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b\", \"a/c\"),\n\t\t\tsetmtime(\"a/c\", targetMtime),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tmtime(\"a/c\", targetMtime),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tmtime(\"a/c\", targetMtime),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "cc9873535aeb5d3a74f095f10465b34c", "score": "0.47767285", "text": "func testCrDoubleResolution(t *testing.T, bSize int64) {\n\ttest(t, blockSize(bSize),\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a/b\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/b/c\", \"hello\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b/d\", \"goodbye\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(\"a/b/d\", \"goodbye\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(\"a/b/d\", \"goodbye\"),\n\t\t\t// Make a few more revisions\n\t\t\twrite(\"a/b/e\", \"hello\"),\n\t\t\twrite(\"a/b/f\", \"goodbye\"),\n\t\t),\n\t\tas(bob,\n\t\t\tread(\"a/b/e\", \"hello\"),\n\t\t\tread(\"a/b/f\", \"goodbye\"),\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b/f\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trm(\"a/b/e\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(\"a/b/d\", \"goodbye\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a\", m{\"b\": \"DIR\"}),\n\t\t\tlsdir(\"a/b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(\"a/b/d\", \"goodbye\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "25ad219be04960ba7c22aaeec72ddfbf", "score": "0.47746882", "text": "func (r *Files) checkGenProtoConflict(path string) {\n\tif r != GlobalFiles {\n\t\treturn\n\t}\n\tvar prevPath string\n\tconst prevModule = \"google.golang.org/genproto\"\n\tconst prevVersion = \"cb27e3aa (May 26th, 2020)\"\n\tswitch path {\n\tcase \"google/protobuf/field_mask.proto\":\n\t\tprevPath = prevModule + \"/protobuf/field_mask\"\n\tcase \"google/protobuf/api.proto\":\n\t\tprevPath = prevModule + \"/protobuf/api\"\n\tcase \"google/protobuf/type.proto\":\n\t\tprevPath = prevModule + \"/protobuf/ptype\"\n\tcase \"google/protobuf/source_context.proto\":\n\t\tprevPath = prevModule + \"/protobuf/source_context\"\n\tdefault:\n\t\treturn\n\t}\n\tpkgName := strings.TrimSuffix(strings.TrimPrefix(path, \"google/protobuf/\"), \".proto\")\n\tpkgName = strings.Replace(pkgName, \"_\", \"\", -1) + \"pb\" // e.g., \"field_mask\" => \"fieldmaskpb\"\n\tcurrPath := \"google.golang.org/protobuf/types/known/\" + pkgName\n\tpanic(fmt.Sprintf(\"\"+\n\t\t\"duplicate registration of %q\\n\"+\n\t\t\"\\n\"+\n\t\t\"The generated definition for this file has moved:\\n\"+\n\t\t\"\\tfrom: %q\\n\"+\n\t\t\"\\tto: %q\\n\"+\n\t\t\"A dependency on the %q module must\\n\"+\n\t\t\"be at version %v or higher.\\n\"+\n\t\t\"\\n\"+\n\t\t\"Upgrade the dependency by running:\\n\"+\n\t\t\"\\tgo get -u %v\\n\",\n\t\tpath, prevPath, currPath, prevModule, prevVersion, prevPath))\n}", "title": "" }, { "docid": "d0a048c12ec8620878ddc37dfc52dd5e", "score": "0.47711635", "text": "func TestDealVersion(t *testing.T) {\n\ttwinCloudEdgeVersion := dttype.TwinVersion{\n\t\tCloudVersion: 1,\n\t\tEdgeVersion: 1,\n\t}\n\ttwinCloudVersion := dttype.TwinVersion{\n\t\tCloudVersion: 1,\n\t\tEdgeVersion: 0,\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tversion *dttype.TwinVersion\n\t\treqVersion *dttype.TwinVersion\n\t\tdealType int\n\t\terrorWant bool\n\t\terr error\n\t}{\n\t\t{\n\t\t\tname: \"TestDealVersion(): Case 1: dealType=3\",\n\t\t\tversion: &dttype.TwinVersion{},\n\t\t\tdealType: SyncTwinDeleteDealType,\n\t\t\terrorWant: true,\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"TestDealVersion(): Case 2: dealType>=1 && version.EdgeVersion>reqVersion.EdgeVersion\",\n\t\t\tversion: &twinCloudEdgeVersion,\n\t\t\treqVersion: &twinCloudVersion,\n\t\t\tdealType: SyncDealType,\n\t\t\terrorWant: false,\n\t\t\terr: errors.New(\"not allowed to sync due to version conflict\"),\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tgot, err := dealVersion(test.version, test.reqVersion, test.dealType)\n\t\t\tif !reflect.DeepEqual(err, test.err) {\n\t\t\t\tt.Errorf(\"DTManager.TestDealVersion() case failed: got = %v, Want = %v\", err, test.err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(got, test.errorWant) {\n\t\t\t\tt.Errorf(\"DTManager.TestDealVersion() case failed: got = %v, want %v\", got, test.errorWant)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6da022054eb6ceeb1e1c604c5263a2fe", "score": "0.47664094", "text": "func TestProjectDownloadGouging(t *testing.T) {\n\tt.Parallel()\n\n\t// allowance contains only the fields necessary to test the price gouging\n\thes := modules.DefaultHostExternalSettings()\n\tallowance := modules.Allowance{\n\t\tFunds: types.SiacoinPrecision.Mul64(1e3),\n\t\tMaxDownloadBandwidthPrice: hes.DownloadBandwidthPrice.Mul64(10),\n\t\tMaxUploadBandwidthPrice: hes.UploadBandwidthPrice.Mul64(10),\n\t}\n\n\t// verify happy case\n\tpt := newDefaultPriceTable()\n\terr := checkProjectDownloadGouging(pt, allowance)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected price gouging failure\", err)\n\t}\n\n\t// verify max download bandwidth price gouging\n\tpt = newDefaultPriceTable()\n\tpt.DownloadBandwidthCost = allowance.MaxDownloadBandwidthPrice.Add64(1)\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"download bandwidth price\") {\n\t\tt.Fatalf(\"expected download bandwidth price gouging error, instead error was '%v'\", err)\n\t}\n\n\t// verify max upload bandwidth price gouging\n\tpt = newDefaultPriceTable()\n\tpt.UploadBandwidthCost = allowance.MaxUploadBandwidthPrice.Add64(1)\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"upload bandwidth price\") {\n\t\tt.Fatalf(\"expected upload bandwidth price gouging error, instead error was '%v'\", err)\n\t}\n\n\t// update the expected download to be non zero and verify the default prices\n\tallowance.ExpectedDownload = 1 << 30 // 1GiB\n\tpt = newDefaultPriceTable()\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected price gouging failure\", err)\n\t}\n\n\t// verify gouging of MDM related costs, in order to verify if gouging\n\t// detection kicks in we need to ensure the cost of executing enough PDBRs\n\t// to fulfil the expected download exceeds the allowance\n\n\t// we do this by maxing out the upload and bandwidth costs and setting all\n\t// default cost components to 250 pS, note that this value is arbitrary,\n\t// setting those costs at 250 pS simply proved to push the price per PDBR\n\t// just over the allowed limit.\n\t//\n\t// Cost breakdown:\n\t// - cost per PDBR 266.4 mS\n\t// - total cost to fulfil expected download 4.365 KS\n\t// - reduced cost after applying downloadGougingFractionDenom: 1.091 KS\n\t// - exceeding the allowance of 1 KS, which is what we are after\n\tpt.UploadBandwidthCost = allowance.MaxUploadBandwidthPrice\n\tpt.DownloadBandwidthCost = allowance.MaxDownloadBandwidthPrice\n\tpS := types.SiacoinPrecision.MulFloat(1e-12)\n\tpt.InitBaseCost = pt.InitBaseCost.Add(pS.Mul64(250))\n\tpt.ReadBaseCost = pt.ReadBaseCost.Add(pS.Mul64(250))\n\tpt.MemoryTimeCost = pt.MemoryTimeCost.Add(pS.Mul64(250))\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"combined PDBR pricing of host yields\") {\n\t\tt.Fatalf(\"expected PDBR price gouging error, instead error was '%v'\", err)\n\t}\n\n\t// verify these checks are ignored if the funds are 0\n\tallowance.Funds = types.ZeroCurrency\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected price gouging failure\", err)\n\t}\n\n\tallowance.Funds = types.SiacoinPrecision.Mul64(1e3) // reset\n\n\t// verify bumping every individual cost component to an insane value results\n\t// in a price gouging error\n\tpt = newDefaultPriceTable()\n\tpt.InitBaseCost = types.SiacoinPrecision.Mul64(100)\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"combined PDBR pricing of host yields\") {\n\t\tt.Fatalf(\"expected PDBR price gouging error, instead error was '%v'\", err)\n\t}\n\n\tpt = newDefaultPriceTable()\n\tpt.ReadBaseCost = types.SiacoinPrecision\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"combined PDBR pricing of host yields\") {\n\t\tt.Fatalf(\"expected PDBR price gouging error, instead error was '%v'\", err)\n\t}\n\n\tpt = newDefaultPriceTable()\n\tpt.ReadLengthCost = types.SiacoinPrecision\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"combined PDBR pricing of host yields\") {\n\t\tt.Fatalf(\"expected PDBR price gouging error, instead error was '%v'\", err)\n\t}\n\n\tpt = newDefaultPriceTable()\n\tpt.MemoryTimeCost = types.SiacoinPrecision\n\terr = checkProjectDownloadGouging(pt, allowance)\n\tif err == nil || !strings.Contains(err.Error(), \"combined PDBR pricing of host yields\") {\n\t\tt.Fatalf(\"expected PDBR price gouging error, instead error was '%v'\", err)\n\t}\n}", "title": "" }, { "docid": "1aa6ef8c1f6736c4cd59a47a3cc9167d", "score": "0.47588295", "text": "func recoverFromDriveFailure(driveID int, offendingFile *os.File, \n offendingFileLocation string, outputFile *os.File, \n isParityDisk bool, hadPadding bool, diskLocations []string,\n username string, configs * types.Config) {\n /*\n Fix the drive, if appropriate\n TODO: this is also not entirely geeneral yet, need to do this for\n other types of systems too - note: the diskLocation passed in here is\n probably not the broken one (we could have fetched this file from\n some other disk, so should fix that external drive too)\n */\n // if storageType == EBS {\n // driveName := fmt.Sprintf(\"drive%d\", driveID + 1)\n // cmd := exec.Command(\"fsck\", driveName)\n\n // var out bytes.Buffer\n // cmd.Stdout = &out\n // err := cmd.Run()\n // check(err)\n\n // fmt.Printf(\"Fsck stdout: %q\\n\", out.String())\n // }\n\n dataDiskCount := len(diskLocations) - configs.ParityDiskCount\n\n /*\n Delete the offending file, and recreate it with the correct data\n */\n oName := offendingFile.Name()\n offendingFile.Close()\n os.Remove(offendingFileLocation)\n // fmt.Printf(\"Offending file location %s\\n\", offendingFileLocation)\n fixedFile, err := openFile(offendingFileLocation); check(err)\n\n rawFileName := oName\n lastIndex := strings.LastIndex(rawFileName, \"_\")\n rawFileName = rawFileName[:lastIndex] // cut off the _driveID part\n x := strings.Split(rawFileName, \"/\")\n rawFileName = x[len(x) - 1] // get the last part of the path, if name = path\n\n if !isParityDisk {\n // read all of the other disks besides this one, and XOR with the parity\n // disk bit by bit and reconstruct the file\n // NOTE: this can be done much more efficiently by issuing more IO requests\n // and using a similar approach as the original saving of the file, but\n // when recovering the file, performance isn't as big of an issue because\n // of the rarity of the occasion (temporary implementation)\n\n otherDriveFiles := make([]*os.File, dataDiskCount - 1)\n\n parityDriveFileName := fmt.Sprintf(\"%s/%s/%s_p\", diskLocations[len(diskLocations) - 1],\n username, rawFileName)\n\n parityDriveFile, err := os.Open(parityDriveFileName)\n check(err)\n \n count := 0\n for i := 0; i < dataDiskCount; i++ {\n if i != driveID {\n tmpName := fmt.Sprintf(\"%s/%s/%s_%d\", diskLocations[i],\n username, rawFileName, i)\n otherDriveFiles[count], err = os.Open(tmpName); check(err)\n\n count++\n }\n }\n\n fileStat, err := parityDriveFile.Stat(); check(err);\n rawSize := fileStat.Size(); // in bytes\n rawSize -= types.MD5_SIZE\n size := rawSize // subtract size for hash at end\n\n trueParityStrip := make([]byte, types.MAX_BUFFER_SIZE)\n buf := make([]byte, types.MAX_BUFFER_SIZE)\n\n var currentLocation int64 = 0\n lastBuffer := false\n currentHash := md5.New()\n\n for currentLocation != size {\n // check if need to resize the buffers\n if (size - currentLocation) < int64(types.MAX_BUFFER_SIZE) {\n lastBuffer = true\n newSize := size - currentLocation\n\n trueParityStrip = make([]byte, newSize)\n buf = make([]byte, newSize)\n } else {\n trueParityStrip = make([]byte, types.MAX_BUFFER_SIZE)\n }\n\n // true parity strip\n _, err = parityDriveFile.ReadAt(trueParityStrip, currentLocation)\n check(err)\n\n // compute the missing piece by XORing all of the other strips\n for i := 0; i < len(otherDriveFiles); i++ {\n file := otherDriveFiles[i]\n\n _, err = file.ReadAt(buf, currentLocation)\n check(err)\n\n for j := 0; j < len(trueParityStrip); j++ {\n trueParityStrip[j] ^= buf[j]\n }\n }\n\n // write missing piece into the fixed file\n _, err = fixedFile.WriteAt(trueParityStrip, currentLocation)\n check(err) // NOTE: THIS ERROR CHECK WASN'T HERE BEFORE\n\n // update fixed hash\n currentHash.Write(trueParityStrip)\n\n // also write into the outputfile we were supposed to return\n // make sure not to write the padding in here, though\n if hadPadding && lastBuffer {\n truePaddingSize := 0\n for i := len(trueParityStrip) - 1; i >= len(trueParityStrip) - dataDiskCount; i-- {\n if trueParityStrip[i] == 0x80 {\n truePaddingSize = len(trueParityStrip) - i\n break\n }\n }\n\n // fmt.Printf(\"True padding size in fix = %d\\n\", truePaddingSize)\n // fmt.Printf(\"length before trim: %d\\n\", len(trueParityStrip))\n\n // resize the size of the true raw data\n trueParityStrip = append([]byte(nil), trueParityStrip[:len(trueParityStrip) - truePaddingSize]...)\n\n // fmt.Printf(\"length after trim: %d\\n\", len(trueParityStrip))\n\n // update \"size\" of the file\n size -= int64(truePaddingSize)\n }\n\n outputFile.WriteAt(trueParityStrip, rawSize * int64(driveID) + currentLocation)\n\n // update location\n currentLocation += int64(len(trueParityStrip))\n }\n\n fixedHash := currentHash.Sum(nil)\n // fmt.Printf(\"Fixed hash ID %d: %x, length = %d\\n\", driveID, fixedHash, len(fixedHash))\n _, err = fixedFile.WriteAt(fixedHash, currentLocation)\n check(err)\n\n for i := 0; i < len(otherDriveFiles); i++ {\n otherDriveFiles[i].Close()\n }\n parityDriveFile.Close()\n\n /*\n File is fixed! Maybe should be fixing other files at the same time\n as fixing this one, or could just be realizing that later when you try\n to read one of those broken files (not immediately clear which\n one is better because we are running fsck to fix anyway, and will\n realize that the fix caused some of the file data to change)\n */\n } else {\n /*\n Read all of the other drive files, XOR them together, and write them\n to the parity drive\n */\n otherDriveFiles := make([]*os.File, dataDiskCount)\n\n for i := 0; i < dataDiskCount; i++ {\n tmpName := fmt.Sprintf(\"%s/%s/%s_%d\", diskLocations[i],\n username, rawFileName, i)\n otherDriveFiles[i], err = os.Open(tmpName); check(err)\n }\n\n fileStat, err := otherDriveFiles[0].Stat(); check(err);\n size := fileStat.Size(); // in bytes\n size -= types.MD5_SIZE // chop off the hash\n\n filesParityStrip := make([]byte, types.MAX_BUFFER_SIZE)\n buf := make([]byte, types.MAX_BUFFER_SIZE)\n\n var currentLocation int64 = 0\n currentHash := md5.New()\n for currentLocation != size {\n // check if need to resize the buffers\n if (size - currentLocation) < int64(types.MAX_BUFFER_SIZE) {\n newSize := size - currentLocation\n\n filesParityStrip = make([]byte, newSize)\n buf = make([]byte, newSize)\n } else {\n filesParityStrip = make([]byte, types.MAX_BUFFER_SIZE)\n }\n\n // compute the missing piece by XORing all of the other strips\n for i := 0; i < len(otherDriveFiles); i++ {\n file := otherDriveFiles[i]\n\n _, err = file.ReadAt(buf, currentLocation)\n check(err)\n\n for j := 0; j < len(filesParityStrip); j++ {\n filesParityStrip[j] ^= buf[j]\n }\n }\n\n // write missing piece into the fixed file\n fixedFile.WriteAt(filesParityStrip, currentLocation)\n\n // update fixed hash\n currentHash.Write(filesParityStrip)\n\n // update location\n currentLocation += int64(len(filesParityStrip))\n }\n\n fixedHash := currentHash.Sum(nil)\n // fmt.Printf(\"Fixed hash ID %d: %x, length = %d\\n\", driveID, fixedHash, len(fixedHash))\n _, err = fixedFile.WriteAt(fixedHash, currentLocation)\n check(err)\n for i := 0; i < len(otherDriveFiles); i++ {\n otherDriveFiles[i].Close()\n }\n\n // File is fixed!\n }\n\n fixedFile.Close()\n\n // TODO: print some useful success message here\n}", "title": "" }, { "docid": "ae6df24059a755dcb02d516a67ee61c3", "score": "0.4756512", "text": "func TestLightSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 0) }", "title": "" }, { "docid": "e2615889cc815c02fc4f73c1e48c2400", "score": "0.47495311", "text": "func TestCrConflictMoveAndSetexRemovedFile(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b\", \"a/c\"),\n\t\t\tsetex(\"a/c\", true),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"EXEC\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c$\": \"EXEC\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "e1a583de0f4ba091cda9a2a05cf85c9d", "score": "0.47433788", "text": "func (vcd *TestVCD) Test_UploadOvf_error_withSameItem(check *C) {\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\n\tskipWhenOvaPathMissing(vcd.config.OVA.OvaPath, check)\n\n\titemName := TestUploadOvf + \"5\"\n\n\tcatalog, _ := findCatalog(vcd, check, vcd.config.VCD.Catalog.Name)\n\n\t//add item\n\tuploadTask, err2 := catalog.UploadOvf(vcd.config.OVA.OvaPath, itemName, \"upload from test\", 1024)\n\tcheck.Assert(err2, IsNil)\n\terr2 = uploadTask.WaitTaskCompletion()\n\tcheck.Assert(err2, IsNil)\n\n\tAddToCleanupList(itemName, \"catalogItem\", vcd.org.Org.Name+\"|\"+vcd.config.VCD.Catalog.Name, \"Test_UploadOvf\")\n\n\tcatalog, _ = findCatalog(vcd, check, vcd.config.VCD.Catalog.Name)\n\t_, err3 := catalog.UploadOvf(vcd.config.OVA.OvaPath, itemName, \"upload from test\", 1024)\n\tcheck.Assert(err3.Error(), Matches, \".*already exists. Upload with different name.*\")\n}", "title": "" }, { "docid": "dfc8682567704143aa3386b5a2e74fd8", "score": "0.47306585", "text": "func TestLutFileTransfer(t *testing.T) { // Anti-Virus issue\n\twr := sampleLut0()\n\texp := sampleLutMap0\n\tfSys := &afero.Afero{Fs: afero.NewMemMapFs()}\n\tfn := \"TestWriteLutToFile.JSON\"\n\tassert.Nil(t, wr.toFile(fSys, fn))\n\trd := make(TriceIDLookUp)\n\tassert.Nil(t, rd.fromFile(fSys, fn))\n\tact := fmt.Sprint(rd)\n\tassert.Equal(t, exp, act)\n}", "title": "" }, { "docid": "3349b3fc7b1025eaf7aecdaf3cf5220c", "score": "0.47303292", "text": "func verifyRsync(localPath, remotePath string, pull bool) bool {\n\tlocalPathIsDir := strings.HasSuffix(localPath, \"/\")\n\tremotePathIsDir := strings.HasSuffix(remotePath, \"/\")\n\n\tif localPathIsDir && !pull {\n\t\tok := confirm(fmt.Sprintf(\"The local directory '%s' will overwrite any existing contents in the remote directory '%s'. Continue?\", localPath, remotePath), false)\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\tif remotePathIsDir && pull {\n\t\tok := confirm(fmt.Sprintf(\"The remote directory '%s' will overwrite any existing contents in the local directory '%s'. Continue?\", remotePath, localPath), false)\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0a71f99b84b2763d65531f67a2a8a19b", "score": "0.472739", "text": "func (p *portdbapi) fetch_check(mypkg string, useflags []string, mysettings *config.Config, all bool, myrepo string) bool {\n\tif all {\n\t\tuseflags = nil\n\t} else if useflags == nil {\n\t\tif mysettings != nil {\n\t\t\tuseflags = strings.Fields(mysettings.ValueDict[\"USE\"])\n\t\t}\n\t}\n\tmytree := \"\"\n\tif myrepo != \"\" {\n\t\tmytree := p.treemap[myrepo]\n\t\tif mytree == \"\" {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tmyfiles := p.getFetchMap(mypkg, useflags, mytree)\n\tmyebuild := p.findname(mypkg, \"\", myrepo)\n\tif myebuild == \"\" {\n\t\t//raise AssertionError(_(\"ebuild not found for '%s'\") % mypkg)\n\t}\n\tpkgdir := filepath.Dir(myebuild)\n\tmf1 := p.repositories.GetRepoForLocation(filepath.Dir(filepath.Dir(pkgdir)))\n\tmf := mf1.load_manifest(pkgdir, p.settings.ValueDict[\"DISTDIR\"], nil, false)\n\tmysums := mf.getDigests()\n\n\tfailures := map[string]string{}\n\tfor _, x := range myfiles {\n\n\t\tok := false\n\t\treason := \"\"\n\t\tif len(mysums) == 0 || !myutil.Inmsmss(mysums, x) {\n\t\t\tok = false\n\t\t\treason = \"digest missing\"\n\t\t} else {\n\t\t\t//try:\n\t\t\tok, reason, _, _ = checksum.verifyAll(\n\t\t\t\tfilepath.Join(p.settings.ValueDict[\"DISTDIR\"], x), mysums[x], false, 0)\n\t\t\t//except FileNotFound as e:\n\t\t\t//ok = false\n\t\t\t//reason = fmt.Sprintf(\"File Not Found: '%s'\", e, )\n\t\t}\n\t\tif !ok {\n\t\t\tfailures[x] = reason\n\t\t}\n\t}\n\tif len(failures) > 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "707e9fd9d4c565864241ecf3af638b41", "score": "0.4704773", "text": "func CheckMkData(root []byte, path [][]byte, oriData []byte) bool {\n\ttmpRoot := OfflineRootCalc(path, oriData)\n\treturn bytes.Equal(tmpRoot, root)\n}", "title": "" }, { "docid": "21b87bef0b2cdfff3ad9e4b6a9e284f0", "score": "0.4698962", "text": "func TestCrUnmergedMakeFilesInRenamedDir(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a/b\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trename(\"a/b\", \"b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b/c\", \"hello\"),\n\t\t\twrite(\"a/b/d\", \"goodbye\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a\", m{}),\n\t\t\tlsdir(\"b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"b/c\", \"hello\"),\n\t\t\tread(\"b/d\", \"goodbye\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a\", m{}),\n\t\t\tlsdir(\"b\", m{\"c\": \"FILE\", \"d\": \"FILE\"}),\n\t\t\tread(\"b/c\", \"hello\"),\n\t\t\tread(\"b/d\", \"goodbye\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "e56db5995508027544ef686f8b3d52b7", "score": "0.46952423", "text": "func (s *mountinfoSuite) TestLoadMountInfo2(c *C) {\n\tfname := filepath.Join(c.MkDir(), \"mountinfo\")\n\t_, err := osutil.LoadMountInfo(fname)\n\tc.Assert(err, ErrorMatches, \"*. no such file or directory\")\n}", "title": "" }, { "docid": "702a5a4770eff3e50ec8decbe74b75fa", "score": "0.4693181", "text": "func Test_Maintained(t *testing.T) {\n\tt.Parallel()\n\tthreeHundredDaysAgo := time.Now().AddDate(0, 0, -300)\n\ttwoHundredDaysAgo := time.Now().AddDate(0, 0, -200)\n\tfiveDaysAgo := time.Now().AddDate(0, 0, -5)\n\toneDayAgo := time.Now().AddDate(0, 0, -1)\n\townerAssociation := clients.RepoAssociationOwner\n\tnoneAssociation := clients.RepoAssociationNone\n\t// fieldalignment lint issue. Ignoring it as it is not important for this test.\n\tsomeone := clients.User{\n\t\tLogin: \"someone\",\n\t}\n\totheruser := clients.User{\n\t\tLogin: \"someone-else\",\n\t}\n\t//nolint\n\ttests := []struct {\n\t\terr error\n\t\tname string\n\t\tisarchived bool\n\t\tarchiveerr error\n\t\tcommits []clients.Commit\n\t\tcommiterr error\n\t\tissues []clients.Issue\n\t\tissueerr error\n\t\tcreatedat time.Time\n\t\texpected checker.CheckResult\n\t}{\n\t\t{\n\t\t\tname: \"archived\",\n\t\t\tisarchived: true,\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"archived\",\n\t\t\tisarchived: true,\n\t\t\tarchiveerr: errors.New(\"error\"),\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: -1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"commit lookup error\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tcommiterr: errors.New(\"error\"),\n\t\t\tissues: []clients.Issue{},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: -1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"issue lookup error\",\n\t\t\tisarchived: false,\n\t\t\tissueerr: errors.New(\"error\"),\n\t\t\tissues: []clients.Issue{},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: -1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"repo with no commits or issues\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"repo with valid commits\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -1),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -10),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -11),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -12),\n\t\t\t\t},\n\t\t\t},\n\t\t\tissues: []clients.Issue{},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 3,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"old issues, no comments\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &threeHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &twoHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"new issues by non-associated users\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &fiveDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"new issues with comments by non-associated users\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &fiveDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\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\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"old issues with old comments by owner\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &twoHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &twoHundredDaysAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &threeHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &twoHundredDaysAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\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\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"old issues with new comments by owner\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &twoHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &fiveDaysAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &threeHundredDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tComments: []clients.IssueComment{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\t\t\tAuthor: &someone,\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\texpected: checker.CheckResult{\n\t\t\t\tScore: 1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"new issues by owner\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &fiveDaysAgo,\n\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\tAuthorAssociation: &ownerAssociation,\n\t\t\t\t\tAuthor: &someone,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 1,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"new issues by non-owner\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{},\n\t\t\tissues: []clients.Issue{\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &fiveDaysAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tAuthor: &otheruser,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCreatedAt: &oneDayAgo,\n\t\t\t\t\tAuthorAssociation: &noneAssociation,\n\t\t\t\t\tAuthor: &otheruser,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"recently created repo\",\n\t\t\tisarchived: false,\n\t\t\tcommits: []clients.Commit{\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -1),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -10),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -11),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tCommittedDate: time.Now().AddDate(0, 0, -12),\n\t\t\t\t},\n\t\t\t},\n\t\t\tissues: []clients.Issue{},\n\t\t\tcreatedat: time.Now().AddDate(0, 0, -1),\n\t\t\texpected: checker.CheckResult{\n\t\t\t\tScore: 0,\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt // Re-initializing variable so it is not changed while executing the closure below\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\n\t\t\tctrl := gomock.NewController(t)\n\n\t\t\tmockRepo := mockrepo.NewMockRepoClient(ctrl)\n\n\t\t\tmockRepo.EXPECT().IsArchived().DoAndReturn(func() (bool, error) {\n\t\t\t\tif tt.archiveerr != nil {\n\t\t\t\t\treturn false, tt.archiveerr\n\t\t\t\t}\n\t\t\t\treturn tt.isarchived, nil\n\t\t\t})\n\n\t\t\tif tt.archiveerr == nil {\n\t\t\t\tmockRepo.EXPECT().ListCommits().DoAndReturn(\n\t\t\t\t\tfunc() ([]clients.Commit, error) {\n\t\t\t\t\t\tif tt.commiterr != nil {\n\t\t\t\t\t\t\treturn nil, tt.commiterr\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn tt.commits, tt.err\n\t\t\t\t\t},\n\t\t\t\t).MinTimes(1)\n\n\t\t\t\tif tt.commiterr == nil {\n\t\t\t\t\tmockRepo.EXPECT().ListIssues().DoAndReturn(\n\t\t\t\t\t\tfunc() ([]clients.Issue, error) {\n\t\t\t\t\t\t\tif tt.issueerr != nil {\n\t\t\t\t\t\t\t\treturn nil, tt.issueerr\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tt.issues, tt.err\n\t\t\t\t\t\t},\n\t\t\t\t\t).MinTimes(1)\n\n\t\t\t\t\tif tt.issueerr == nil {\n\t\t\t\t\t\tmockRepo.EXPECT().GetCreatedAt().DoAndReturn(func() (time.Time, error) {\n\t\t\t\t\t\t\tif tt.createdat.IsZero() {\n\t\t\t\t\t\t\t\treturn time.Now().AddDate(0, 0, -365), nil\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn tt.createdat, nil\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treq := checker.CheckRequest{\n\t\t\t\tRepoClient: mockRepo,\n\t\t\t}\n\t\t\treq.Dlogger = &scut.TestDetailLogger{}\n\t\t\tres := Maintained(&req)\n\n\t\t\tif tt.err != nil {\n\t\t\t\tif res.Error == nil {\n\t\t\t\t\tt.Errorf(\"Expected error %v, got nil\", tt.err)\n\t\t\t\t}\n\t\t\t\t// return as we don't need to check the rest of the fields.\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif res.Score != tt.expected.Score {\n\t\t\t\tt.Errorf(\"Expected score %d, got %d for %v\", tt.expected.Score, res.Score, tt.name)\n\t\t\t}\n\t\t\tctrl.Finish()\n\t\t})\n\t}\n}", "title": "" }, { "docid": "41399fe3824a1c4caab2bae4a474ad92", "score": "0.4692816", "text": "func TestExecute_DQ_members12_cannotDecryptTheirShares_phase9(t *testing.T) {\n\tt.Parallel()\n\n\tgroupSize := 6\n\thonestThreshold := 3\n\tseed := dkgtest.RandomSeed(t)\n\n\tmanInTheMiddle, err := newManInTheMiddle(\n\t\tgroup.MemberIndex(1), // sender\n\t\tgroupSize,\n\t\thonestThreshold,\n\t\tseed,\n\t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tinterceptor := func(msg net.TaggedMarshaler) net.TaggedMarshaler {\n\t\tpointsAccusationsMessage, ok := msg.(*gjkr.PointsAccusationsMessage)\n\t\t// Modify default man-in-the-middle behavior: accuser performs\n\t\t// accusation against the member only in phase 8 using the ephemeral\n\t\t// private key generated before.\n\t\tif ok && pointsAccusationsMessage.SenderID() == group.MemberIndex(1) {\n\t\t\taccusedMembersKeys := make(map[group.MemberIndex]*ephemeral.PrivateKey)\n\t\t\taccusedMembersKeys[group.MemberIndex(2)] =\n\t\t\t\tmanInTheMiddle.ephemeralKeyPairs[group.MemberIndex(2)].PrivateKey\n\t\t\tpointsAccusationsMessage.SetAccusedMemberKeys(accusedMembersKeys)\n\t\t\treturn pointsAccusationsMessage\n\t\t}\n\n\t\tmanInTheMiddle.interceptCommunication(msg)\n\n\t\tsharesMessage, ok := msg.(*gjkr.PeerSharesMessage)\n\t\t// Accused member misbehaves by sending shares which cannot be\n\t\t// decrypted by the accuser.\n\t\tif ok && sharesMessage.SenderID() == group.MemberIndex(2) {\n\t\t\tsharesMessage.SetShares(\n\t\t\t\t1,\n\t\t\t\t[]byte{0x00},\n\t\t\t\t[]byte{0x00},\n\t\t\t)\n\t\t\treturn sharesMessage\n\t\t}\n\n\t\treturn msg\n\t}\n\n\tresult, err := dkgtest.RunTest(groupSize, honestThreshold, seed, interceptor)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdkgtest.AssertDkgResultPublished(t, result)\n\tdkgtest.AssertSuccessfulSignersCount(t, result, groupSize-2)\n\tdkgtest.AssertSuccessfulSigners(t, result, []group.MemberIndex{3, 4, 5, 6}...)\n\tdkgtest.AssertMemberFailuresCount(t, result, 2)\n\tdkgtest.AssertSamePublicKey(t, result)\n\tdkgtest.AssertMisbehavingMembers(t, result, []group.MemberIndex{1, 2}...)\n\tdkgtest.AssertValidGroupPublicKey(t, result)\n\tdkgtest.AssertResultSupportingMembers(t, result, []group.MemberIndex{3, 4, 5, 6}...)\n}", "title": "" }, { "docid": "4c1faddecef1c3ceb03d416ff3b4f216", "score": "0.46902588", "text": "func TestNewMembershipFromInitialPeerURLsMap_Multi(t *testing.T) {\n\n\tinitialURLsMap, _ := types.NewURLsMap(InitialPeerURLsMapMulti)\n\texpectMembers := getExpectMembersMulti()\n\tdoTestNewMembershipFromInitialPeerURLsMap(initialURLsMap, \"raftgroup_multi\", expectMembers, t)\n\n}", "title": "" }, { "docid": "8fb84b1c1816edfbcf174a7be9e60523", "score": "0.46901608", "text": "func testDriftCorrection(t *testing.T, testContext testrunner.TestContext, systemContext testrunner.SystemContext, resourceContext contexts.ResourceContext) {\n\tif shouldSkipDriftDetection(t, resourceContext, systemContext.SMLoader, systemContext.DCLConverter.MetadataLoader, testContext.CreateUnstruct) {\n\t\treturn\n\t}\n\tkubeClient := systemContext.Manager.GetClient()\n\ttestUnstruct := testContext.CreateUnstruct.DeepCopy()\n\tif err := kubeClient.Get(context.TODO(), testContext.NamespacedName, testUnstruct); err != nil {\n\t\tt.Fatalf(\"unexpected error getting k8s resource: %v\", err)\n\t}\n\t// For test cases with `cnrm.cloud.google.com/reconcile-interval-in-seconds` annotation set to 0, we should skip drift correction test.\n\tif skip, _ := resourceactuation.ShouldSkip(testUnstruct); skip {\n\t\treturn\n\t}\n\t// Delete all events for the resource so that we can check later at the end\n\t// of this test that the right events are recorded.\n\ttestcontroller.DeleteAllEventsForUnstruct(t, kubeClient, testUnstruct)\n\n\tif err := resourceContext.Delete(t, testUnstruct, systemContext.TFProvider, systemContext.Manager.GetClient(), systemContext.SMLoader, systemContext.DCLConfig, systemContext.DCLConverter); err != nil {\n\t\tt.Fatalf(\"error deleting: %v\", err)\n\t}\n\t// Underlying APIs may not have strongly-consistent reads due to caching. Sleep before attempting a re-reconcile, to\n\t// give the underlying system some time to propagate the deletion info.\n\ttime.Sleep(time.Second * 10)\n\n\t// get the current state\n\tt.Logf(\"reconcile with %v\\r\", testUnstruct)\n\tsystemContext.Reconciler.Reconcile(testUnstruct, testreconciler.ExpectedSuccessfulReconcileResultFor(systemContext.Reconciler, testUnstruct), nil)\n\tt.Logf(\"reconciled with %v\\r\", testUnstruct)\n\tvalidateCreate(t, testContext, systemContext, resourceContext, testUnstruct.GetGeneration())\n}", "title": "" }, { "docid": "a6e29b3044396657863f09e40ac768fc", "score": "0.4689137", "text": "func TestCheck(t *testing.T) {\n\ttests := map[string]struct {\n\t\tgomod string\n\t\trelease string\n\t\tmoduleRelease string\n\t\tdomain string\n\t\trule git.RulesetType\n\t\twantErr bool\n\t}{\n\t\t\"demo1, v0.15, knative.dev, any rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v0.15\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t},\n\t\t\"demo1, v0.15, knative.dev, release rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v0.15\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.ReleaseRule,\n\t\t\twantErr: true,\n\t\t},\n\t\t\"demo1, v0.15, knative.dev, release branch rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v0.15\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.ReleaseBranchRule,\n\t\t},\n\t\t\"demo1, v99.99, knative.dev, release branch or release rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v99.99\",\n\t\t\tmoduleRelease: \"v99.99\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.ReleaseOrReleaseBranchRule,\n\t\t\twantErr: true,\n\t\t},\n\t\t\"demo1, v0.16, knative.dev, any rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v0.16\",\n\t\t\tmoduleRelease: \"v0.16\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t},\n\t\t\"demo1, v0.16, v0.15 mods, knative.dev, any rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v0.16\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t},\n\t\t\"demo1, v99.99, knative.dev, any rule\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"v99.99\",\n\t\t\tmoduleRelease: \"v99.99\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t},\n\t\t\"bad release\": {\n\t\t\tgomod: \"./testdata/gomod.check1\",\n\t\t\trelease: \"not gonna work\",\n\t\t\tmoduleRelease: \"not gonna work\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t\twantErr: true,\n\t\t},\n\t\t\"bad go module\": {\n\t\t\tgomod: \"./testdata/gomod.float1\",\n\t\t\trelease: \"v0.15\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"does-not-exist.nope\",\n\t\t\trule: git.AnyRule,\n\t\t\twantErr: true,\n\t\t},\n\t\t\"bad go mod file\": {\n\t\t\tgomod: \"./testdata/bad.example\",\n\t\t\trelease: \"v0.15\",\n\t\t\tmoduleRelease: \"v0.15\",\n\t\t\tdomain: \"knative.dev\",\n\t\t\trule: git.AnyRule,\n\t\t\twantErr: true,\n\t\t},\n\t}\n\tfor name, tt := range tests {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tselector, err := DefaultSelector(tt.domain)\n\t\t\trequire.NoError(t, err)\n\t\t\terr = Check(tt.gomod, tt.release, tt.moduleRelease, selector, tt.rule, os.Stdout)\n\t\t\tif (tt.wantErr && err == nil) || (!tt.wantErr && err != nil) {\n\t\t\t\tt.Errorf(\"unexpected error state, want error == %t, got %v\", tt.wantErr, err)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "66118f7be5ff913ee313eb7f2bcc8e2e", "score": "0.4688456", "text": "func (s *OssDownloadSuite) TestDownloadObjectChange(c *C) {\n\tobjectName := objectNamePrefix + RandStr(8)\n\tfileName := \"../sample/BingWallpaper-2015-11-07.jpg\"\n\tnewFile := RandStr(8) + \".jpg\"\n\n\t// Upload a file\n\terr := s.bucket.UploadFile(objectName, fileName, 100*1024, Routines(3))\n\tc.Assert(err, IsNil)\n\n\t// Download with default checkpoint\n\tdownloadPartHooker = DownErrorHooker\n\terr = s.bucket.DownloadFile(objectName, newFile, 100*1024, Checkpoint(true, newFile+\".cp\"))\n\tc.Assert(err, NotNil)\n\tc.Assert(err.Error(), Equals, \"ErrorHooker\")\n\tdownloadPartHooker = defaultDownloadPartHook\n\n\terr = s.bucket.UploadFile(objectName, fileName, 100*1024, Routines(3))\n\tc.Assert(err, IsNil)\n\n\terr = s.bucket.DownloadFile(objectName, newFile, 100*1024, Checkpoint(true, newFile+\".cp\"))\n\tc.Assert(err, IsNil)\n\n\teq, err := compareFiles(fileName, newFile)\n\tc.Assert(err, IsNil)\n\tc.Assert(eq, Equals, true)\n}", "title": "" }, { "docid": "bb796a89e8d93291e55a630a81a28f21", "score": "0.46819463", "text": "func shouldUpdateOVNKonUpgrade(ovn bootstrap.OVNBootstrapResult, masterOrControlPlaneStatus *bootstrap.OVNUpdateStatus, releaseVersion string) (updateNode, updateMaster bool) {\n\t// Fresh cluster - full steam ahead!\n\tif ovn.NodeUpdateStatus == nil || masterOrControlPlaneStatus == nil {\n\t\treturn true, true\n\t}\n\n\tnodeVersion := ovn.NodeUpdateStatus.Version\n\tmasterVersion := masterOrControlPlaneStatus.Version\n\n\t// shortcut - we're all rolled out.\n\t// Return true so that we reconcile any changes that somehow could have happened.\n\tif nodeVersion == releaseVersion && masterVersion == releaseVersion {\n\t\tklog.V(2).Infof(\"OVN-Kubernetes master/control-plane and node already at release version %s; no changes required\", releaseVersion)\n\t\treturn true, true\n\t}\n\n\t// compute version delta\n\t// versionUpgrade means the existing daemonSet needs an upgrade.\n\tmasterDelta := compareVersions(masterVersion, releaseVersion)\n\tnodeDelta := compareVersions(nodeVersion, releaseVersion)\n\n\tif masterDelta == versionUnknown || nodeDelta == versionUnknown {\n\t\tklog.Warningf(\"could not determine ovn-kubernetes daemonset update directions; node: %s, master/control-plane: %s, release: %s\",\n\t\t\tnodeVersion, masterVersion, releaseVersion)\n\t\treturn true, true\n\t}\n\n\tklog.V(2).Infof(\"OVN-Kubernetes master/control-plane version %s -> latest %s; delta %s\", masterVersion, releaseVersion, masterDelta)\n\tklog.V(2).Infof(\"OVN-Kubernetes node version %s -> latest %s; delta %s\", nodeVersion, releaseVersion, nodeDelta)\n\n\t// 9 cases\n\t// +-------------+---------------+-----------------+------------------+\n\t// | Delta | master upg. | master OK | master downg. |\n\t// +-------------+---------------+-----------------+------------------+\n\t// | node upg. | upgrade node | error | error |\n\t// | node OK | wait for node | done | error |\n\t// | node downg. | error | wait for master | downgrade master |\n\t// +-------------+---------------+-----------------+------------------++\n\n\t// both older (than CNO)\n\t// Update node only.\n\tif masterDelta == versionUpgrade && nodeDelta == versionUpgrade {\n\t\tklog.V(2).Infof(\"Upgrading OVN-Kubernetes node before master/control-plane\")\n\t\treturn true, false\n\t}\n\n\t// master older, node updated\n\t// update master if node is rolled out\n\tif masterDelta == versionUpgrade && nodeDelta == versionSame {\n\t\tif ovn.NodeUpdateStatus.Progressing {\n\t\t\tklog.V(2).Infof(\"Waiting for OVN-Kubernetes node update to roll out before updating master/control-plane\")\n\t\t\treturn true, false\n\t\t}\n\t\tklog.V(2).Infof(\"OVN-Kubernetes node update rolled out; now updating master/control-plane\")\n\t\treturn true, true\n\t}\n\n\t// both newer\n\t// downgrade master before node\n\tif masterDelta == versionDowngrade && nodeDelta == versionDowngrade {\n\t\tklog.V(2).Infof(\"Downgrading OVN-Kubernetes master/control-plane before node\")\n\t\treturn false, true\n\t}\n\n\t// master same, node needs downgrade\n\t// wait for master rollout\n\tif masterDelta == versionSame && nodeDelta == versionDowngrade {\n\t\tif masterOrControlPlaneStatus.Progressing {\n\t\t\tklog.V(2).Infof(\"Waiting for OVN-Kubernetes master/control-plane downgrade to roll out before downgrading node\")\n\t\t\treturn false, true\n\t\t}\n\t\tklog.V(2).Infof(\"OVN-Kubernetes master/control-plane update rolled out; now downgrading node\")\n\t\treturn true, true\n\t}\n\n\t// unlikely, should be caught above\n\tif masterDelta == versionSame && nodeDelta == versionSame {\n\t\treturn true, true\n\t}\n\n\tklog.Warningf(\"OVN-Kubernetes daemonset versions inconsistent. node: %s, master/control-plane: %s, release: %s\",\n\t\tnodeVersion, masterVersion, releaseVersion)\n\treturn true, true\n}", "title": "" }, { "docid": "85717301dabf6488d5ad092cde33136b", "score": "0.46794933", "text": "func TestCrMergedCreateInRemovedDir(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkfile(\"a/b/c/d/e\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/b/c/d/f\", \"goodbye\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trm(\"a/b/c/d/e\"),\n\t\t\trmdir(\"a/b/c/d\"),\n\t\t\trmdir(\"a/b/c\"),\n\t\t\trmdir(\"a/b\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/b/c/d\", m{\"f\": \"FILE\"}),\n\t\t\tread(\"a/b/c/d/f\", \"goodbye\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/b/c/d\", m{\"f\": \"FILE\"}),\n\t\t\tread(\"a/b/c/d/f\", \"goodbye\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "30f4922bd36d89959e04312f053f901b", "score": "0.4676545", "text": "func CheckFileValidity(id string, data []byte) bool{\n\thash := sha256.Sum256(data)\n\tidFile := NewKademliaIDFromBytes(hash[:IDLength])\n\tif !idFile.Equals(NewKademliaID(id)){\n\t\tfmt.Println(id + \" : WARNING ! Modification have been made on this file, it is not valid anymore !\")\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "315e09ccbb8f94cbb77519ea00093df6", "score": "0.46716446", "text": "func TestCrUnmergedRenameIntoNewDir(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkfile(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/c\", \"world\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b\", \"d/e\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c\": \"FILE\"}),\n\t\t\tlsdir(\"d/\", m{\"e\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tread(\"d/e\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c\": \"FILE\"}),\n\t\t\tlsdir(\"d/\", m{\"e\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tread(\"d/e\", \"hello\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "13fb4c4764ed95ef0ac085710c2d1858", "score": "0.4662308", "text": "func TestInteg_ConsensusFailure(t *testing.T) {\n\tconst script = `\n\t\tscript {\n\t\t\tuse 0x1::Account;\n\t\t\tuse 0x1::XFI;\n\t\t\t\n\t\t\tfun main(account: &signer, recipient: address, amount: u128) {\n\t\t\t\tAccount::pay_from_sender<XFI::T>(account, recipient, amount);\n\t\t\t}\n\t\t}\n\t`\n\n\tct := cliTester.New(t, false)\n\tdefer ct.Close()\n\n\t// Start DVM compiler container (runtime also, but we don't want for dnode to connect to DVM runtime)\n\t_, vmCompilerPort, err := server.FreeTCPAddr()\n\trequire.NoError(t, err, \"FreeTCPAddr for DVM compiler port\")\n\tcompilerStop := tests.LaunchDVMWithNetTransport(t, vmCompilerPort, ct.VMConnection.ListenPort, false)\n\tdefer compilerStop()\n\n\tct.SetVMCompilerAddressNet(\"tcp://127.0.0.1:\"+vmCompilerPort, false)\n\n\tsenderAddr := ct.Accounts[\"validator1\"].Address\n\tmovePath := path.Join(ct.Dirs.RootDir, \"script.move\")\n\tcompiledPath := path.Join(ct.Dirs.RootDir, \"script.move.json\")\n\n\t// Create .move script file\n\tmoveFile, err := os.Create(movePath)\n\trequire.NoError(t, err, \"creating script file\")\n\t_, err = moveFile.WriteString(script)\n\trequire.NoError(t, err, \"write script file\")\n\trequire.NoError(t, moveFile.Close(), \"close script file\")\n\t// Compile .move script file\n\tct.QueryVmCompile(movePath, compiledPath, senderAddr).CheckSucceeded()\n\t// Execute .json script file\n\t// Should panic as there is no local VM running\n\tct.TxVmExecuteScript(senderAddr, compiledPath, senderAddr, \"100\").DisableBroadcastMode().CheckSucceeded()\n\n\t// Check CONSENSUS FAILURE did occur\n\t{\n\t\tconsensusFailure := false\n\t\tfor i := 0; i < 10; i++ {\n\t\t\tif ct.DaemonLogsContain(\"CONSENSUS FAILURE\") {\n\t\t\t\tconsensusFailure = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t}\n\t\trequire.True(t, consensusFailure, \"CONSENSUS FAILURE not occurred\")\n\t}\n\n\t// Check restarted application panics\n\t{\n\t\tct.RestartDaemon(false, false)\n\n\t\tretCode, daemonLogs := ct.CheckDaemonStopped(5 * time.Second)\n\n\t\trequire.NotZero(t, retCode, \"daemon exitCode\")\n\t\trequire.Contains(t, strings.Join(daemonLogs, \",\"), \"panic\", \"daemon didn't panic\")\n\t}\n}", "title": "" }, { "docid": "6e0e10ea5138bb0b43f1219772c187a5", "score": "0.4656114", "text": "func TestFullRemoveDelegationChangefileApplicable(t *testing.T) {\n\tgun := \"docker.com/notary\"\n\tts, _, _ := simpleTestServer(t)\n\tdefer ts.Close()\n\n\trepo, rootKeyID := initializeRepo(t, data.ECDSAKey, gun, ts.URL, false)\n\tdefer os.RemoveAll(repo.baseDir)\n\trootPubKey := repo.CryptoService.GetKey(rootKeyID)\n\trequire.NotNil(t, rootPubKey)\n\n\tkey2, err := repo.CryptoService.Create(\"user\", repo.gun, data.ECDSAKey)\n\trequire.NoError(t, err)\n\tkey2CanonicalID, err := utils.CanonicalKeyID(key2)\n\trequire.NoError(t, err)\n\n\tvar delegationName data.RoleName = \"targets/a\"\n\n\trequire.NoError(t, repo.AddDelegation(delegationName, []data.PublicKey{rootPubKey, key2}, []string{\"abc\", \"123\"}))\n\tchanges := getChanges(t, repo)\n\trequire.Len(t, changes, 2)\n\trequire.NoError(t, applyTargetsChange(repo.tufRepo, nil, changes[0]))\n\trequire.NoError(t, applyTargetsChange(repo.tufRepo, nil, changes[1]))\n\n\ttargetRole := repo.tufRepo.Targets[data.CanonicalTargetsRole]\n\trequire.Len(t, targetRole.Signed.Delegations.Roles, 1)\n\trequire.Len(t, targetRole.Signed.Delegations.Keys, 2)\n\n\t// manually create the changelist object to load multiple keys\n\ttdJSON, err := json.Marshal(&changelist.TUFDelegation{\n\t\tRemoveKeys: []string{key2CanonicalID},\n\t\tRemovePaths: []string{\"abc\", \"123\"},\n\t})\n\trequire.NoError(t, err)\n\tchange := newUpdateDelegationChange(delegationName, tdJSON)\n\tcl, err := changelist.NewFileChangelist(\n\t\tfilepath.Join(repo.baseDir, tufDir, filepath.FromSlash(gun), \"changelist\"),\n\t)\n\trequire.NoError(t, err)\n\taddChange(cl, change, delegationName)\n\n\tchanges = getChanges(t, repo)\n\trequire.Len(t, changes, 3)\n\trequire.NoError(t, applyTargetsChange(repo.tufRepo, nil, changes[2]))\n\n\tdelgRoles := repo.tufRepo.Targets[data.CanonicalTargetsRole].Signed.Delegations.Roles\n\trequire.Len(t, delgRoles, 1)\n\trequire.Len(t, delgRoles[0].Paths, 0)\n\trequire.Len(t, delgRoles[0].KeyIDs, 1)\n}", "title": "" }, { "docid": "4519bd13da8bf89cda36049c4573b8ca", "score": "0.46550673", "text": "func TestTransferHouse_NG2(t *testing.T) {\n\tstub := shim.NewMockStub(\"housecontract\", new(cc.HouseContractCC))\n\tif assert.NotNil(t, stub) &&\n\t\tassert.Condition(t, responseOK(stub.MockInit(util.GenerateUUID(), nil))) {\n\t\tres := stub.MockInvoke(util.GenerateUUID(), getBytes(\"AddOwner\", alice))\n\t\tres = stub.MockInvoke(util.GenerateUUID(), getBytes(\"AddHouse\", house1))\n\n\t\tres = stub.MockInvoke(util.GenerateUUID(), getBytes(\"TransferHouse\", one, bobid))\n\t\tassert.Condition(t, responseFail(res))\n\t}\n}", "title": "" }, { "docid": "32cad968d4ec93f65df80b35b107eeef", "score": "0.46535408", "text": "func TestCrConflictWriteMoveAndSetMtimeFollowedByNewConflict(t *testing.T) {\n\ttargetMtime := time.Now().Add(1 * time.Minute)\n\ttest(t,\n\t\tusers(\"alice\", \"bob\", \"charlie\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t),\n\t\tas(bob,\n\t\t\twrite(\"a/b\", \"hello\"),\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(charlie,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/c\", \"hello\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b\", \"hello world\"),\n\t\t\tsetmtime(\"a/b\", targetMtime),\n\t\t\trename(\"a/b\", \"a/d\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\", \"d$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t\tread(\"a/d\", \"hello world\"),\n\t\t\tmtime(\"a/d\", targetMtime),\n\t\t),\n\t\tas(charlie, noSync(),\n\t\t\twrite(\"a/e\", \"hello too\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\", \"d$\": \"FILE\", \"e$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t\tread(\"a/d\", \"hello world\"),\n\t\t\tmtime(\"a/d\", targetMtime),\n\t\t\tread(\"a/e\", \"hello too\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\", \"d$\": \"FILE\", \"e$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t\tread(\"a/d\", \"hello world\"),\n\t\t\tmtime(\"a/d\", targetMtime),\n\t\t\tread(\"a/e\", \"hello too\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "3b9d5368607b484f48e4e7438257defe", "score": "0.4652822", "text": "func TestCrUnmergedMoveOfRemovedFile(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t\twrite(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b\", \"a/c\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c$\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"hello\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "0c5bd86ad99a020590926adfa834c08f", "score": "0.4652742", "text": "func TestDeterministicNames(t *testing.T) {\n\t// \"foo\" should encrypt to the same name in both directories\n\tif err := os.MkdirAll(pDir+\"/x/foo\", 0700); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := os.MkdirAll(pDir+\"/y/foo\", 0700); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tmatches, err := filepath.Glob(cDir + \"/*/*\")\n\tif err != nil || len(matches) != 2 {\n\t\tt.Fatal(matches, err)\n\t}\n\tif filepath.Base(matches[0]) != filepath.Base(matches[1]) {\n\t\tt.Error(matches)\n\t}\n\tfooEncrypted := filepath.Base(matches[0])\n\n\t// \"foo\" should also encrypt to the same name in the root directory\n\tif err := os.Mkdir(pDir+\"/foo\", 0700); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = os.Stat(cDir + \"/\" + fooEncrypted)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Replace directory with file\n\tif err := os.RemoveAll(pDir + \"/foo\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := ioutil.WriteFile(pDir+\"/foo\", nil, 0700); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = os.Stat(cDir + \"/\" + fooEncrypted)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Rename back and forth, name should stay the same\n\tif err := os.Rename(pDir+\"/foo\", pDir+\"/foo.tmp\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := os.Rename(pDir+\"/foo.tmp\", pDir+\"/foo\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif _, err := os.Stat(cDir + \"/\" + fooEncrypted); err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "4a7420f8811dfb8437e81e7584405c1f", "score": "0.4635816", "text": "func TestPackBitmarkTransferTwo(t *testing.T) {\n\n\townerOneAddress := makeAddress(&ownerOne.publicKey)\n\townerTwoAddress := makeAddress(&ownerTwo.publicKey)\n\n\tvar link transaction.Link\n\t_, err := fmt.Sscan(\"BMK00bfd865e4c76c6c56babffe4c275578d6410818634afc20bde0ee5a1e312c901\", &link)\n\tif nil != err {\n\t\tt.Errorf(\"hex to link error: %v\", err)\n\t\treturn\n\t}\n\n\tr := transaction.BitmarkTransfer{\n\t\tLink: link,\n\t\tOwner: ownerTwoAddress,\n\t}\n\n\texpected := []byte{\n\t\t0x03, 0x20, 0x01, 0xc9, 0x12, 0xe3, 0xa1, 0xe5,\n\t\t0x0e, 0xde, 0x0b, 0xc2, 0xaf, 0x34, 0x86, 0x81,\n\t\t0x10, 0x64, 0x8d, 0x57, 0x75, 0xc2, 0xe4, 0xff,\n\t\t0xab, 0x6b, 0xc5, 0xc6, 0x76, 0x4c, 0x5e, 0x86,\n\t\t0xfd, 0x0b, 0x21, 0x13, 0xa1, 0x36, 0x32, 0xd5,\n\t\t0x42, 0x5a, 0xed, 0x3a, 0x6b, 0x62, 0xe2, 0xbb,\n\t\t0x6d, 0xe4, 0xc9, 0x59, 0x48, 0x41, 0xc1, 0x5b,\n\t\t0x70, 0x15, 0x69, 0xec, 0x99, 0x99, 0xdc, 0x20,\n\t\t0x1c, 0x35, 0xf7, 0xb3,\n\t}\n\n\texpectedTxId := transaction.Link{\n\t\t0x6c, 0x5c, 0x0e, 0x43, 0xf5, 0x98, 0x06, 0xe5,\n\t\t0x19, 0x79, 0x3d, 0xd6, 0x16, 0x48, 0x73, 0x18,\n\t\t0x43, 0x06, 0x8a, 0x00, 0x93, 0xdb, 0x7b, 0x07,\n\t\t0x76, 0x6f, 0x7f, 0x7f, 0x2d, 0x18, 0xb9, 0x19,\n\t}\n\n\t// manually sign the record and attach signature to \"expected\"\n\tsignature := ed25519.Sign(&ownerOne.privateKey, expected)\n\tr.Signature = signature[:]\n\tl := util.ToVarint64(uint64(len(signature)))\n\texpected = append(expected, l...)\n\texpected = append(expected, signature[:]...)\n\n\t// test the packer\n\tpacked, err := r.Pack(ownerOneAddress)\n\tif nil != err {\n\t\tt.Errorf(\"pack error: %v\", err)\n\t}\n\n\t// if either of above fail we will have the message _without_ a signature\n\tif !bytes.Equal(packed, expected) {\n\t\tt.Errorf(\"pack record: %x expected: %x\", packed, expected)\n\t\tt.Errorf(\"*** GENERATED Packed:\\n%s\", formatBytes(\"expected\", packed))\n\t\treturn\n\t}\n\n\t// check txId\n\ttxId := packed.MakeLink()\n\n\tif txId != expectedTxId {\n\t\tt.Errorf(\"pack txId: %#v expected: %x\", txId, expectedTxId)\n\t\tt.Errorf(\"*** GENERATED txId:\\n%s\", formatBytes(\"expectedTxId\", txId.Bytes()))\n\t\treturn\n\t}\n\n\t// test the unpacker\n\tunpacked, err := packed.Unpack()\n\tif nil != err {\n\t\tt.Errorf(\"unpack error: %v\", err)\n\t\treturn\n\t}\n\n\tbmt, ok := unpacked.(*transaction.BitmarkTransfer)\n\tif !ok {\n\t\tt.Errorf(\"did not unpack to BitmarkTransfer\")\n\t\treturn\n\t}\n\n\t// display a JSON version for information\n\titem := struct {\n\t\tHexTxId string\n\t\tTxId transaction.Link\n\t\tBitmarkTransfer *transaction.BitmarkTransfer\n\t}{\n\t\ttxId.String(),\n\t\ttxId,\n\t\tbmt,\n\t}\n\tb, err := json.MarshalIndent(item, \"\", \" \")\n\tif nil != err {\n\t\tt.Errorf(\"json error: %v\", err)\n\t\treturn\n\t}\n\n\tt.Logf(\"Bitmark Transfer: JSON: %s\", b)\n\n\t// check that structure is preserved through Pack/Unpack\n\t// note reg is a pointer here\n\tif !reflect.DeepEqual(r, *bmt) {\n\t\tt.Errorf(\"different, original: %v recovered: %v\", r, *bmt)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "07a581f12e4f107241f030edf5aa51dc", "score": "0.46336496", "text": "func TestSearch_ChangelistResults_ChangelistIndexMiss_Success(t *testing.T) {\n\tunittest.LargeTest(t)\n\n\tconst clAuthor = \"broom@example.com\"\n\tconst clSubject = \"big sweeping changes\"\n\tconst clID = \"1234\"\n\tconst crs = \"gerrit\"\n\tconst AlphaNowGoodDigest = data.AlphaUntriagedDigest\n\tconst BetaBrandNewDigest = types.Digest(\"be7a03256511bec3a7453c3186bb2e07\")\n\n\t// arbitrary time that our pretend CL was created at\n\tvar clTime = time.Date(2020, time.May, 25, 10, 9, 8, 0, time.UTC)\n\n\tmcls := &mock_clstore.Store{}\n\tmtjs := &mock_tjstore.Store{}\n\tdefer mcls.AssertExpectations(t)\n\tdefer mtjs.AssertExpectations(t)\n\n\tmes := makeThreeDevicesExpectationStore()\n\tvar ie expectations.Expectations\n\tie.Set(data.AlphaTest, AlphaNowGoodDigest, expectations.Positive)\n\tissueStore := addChangelistExpectations(mes, crs, clID, &ie)\n\t// Hasn't been triaged yet\n\tissueStore.On(\"GetTriageHistory\", testutils.AnyContext, mock.Anything, mock.Anything).Return(nil, nil)\n\n\tmcls.On(\"GetChangelist\", testutils.AnyContext, clID).Return(code_review.Changelist{\n\t\tSystemID: clID,\n\t\tOwner: clAuthor,\n\t\tStatus: code_review.Open,\n\t\tSubject: clSubject,\n\t\tUpdated: clTime,\n\t}, nil)\n\tmcls.On(\"GetPatchsets\", testutils.AnyContext, clID).Return([]code_review.Patchset{\n\t\t{\n\t\t\tSystemID: \"first_one\",\n\t\t\tChangelistID: clID,\n\t\t\tOrder: 1,\n\t\t\t// All the rest are ignored\n\t\t},\n\t\t{\n\t\t\tSystemID: \"fourth_one\",\n\t\t\tChangelistID: clID,\n\t\t\tOrder: 4,\n\t\t\t// All the rest are ignored\n\t\t},\n\t}, nil).Once() // this should be cached after fetch, as it could be expensive to retrieve.\n\n\texpectedID := tjstore.CombinedPSID{\n\t\tCL: clID,\n\t\tCRS: crs,\n\t\tPS: \"fourth_one\", // we didn't specify a PS, so it goes with the most recent\n\t}\n\tanglerGroup := map[string]string{\n\t\t\"device\": data.AnglerDevice,\n\t}\n\tbullheadGroup := map[string]string{\n\t\t\"device\": data.BullheadDevice,\n\t}\n\toptions := map[string]string{\n\t\t\"ext\": data.PNGExtension,\n\t}\n\n\tmtjs.On(\"GetResults\", testutils.AnyContext, expectedID, anyTime).Return([]tjstore.TryJobResult{\n\t\t{\n\t\t\tGroupParams: anglerGroup,\n\t\t\tOptions: options,\n\t\t\tDigest: data.AlphaPositiveDigest,\n\t\t\tResultParams: map[string]string{\n\t\t\t\ttypes.PrimaryKeyField: string(data.AlphaTest),\n\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tGroupParams: bullheadGroup,\n\t\t\tOptions: options,\n\t\t\tDigest: AlphaNowGoodDigest,\n\t\t\tResultParams: map[string]string{\n\t\t\t\ttypes.PrimaryKeyField: string(data.AlphaTest),\n\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tGroupParams: anglerGroup,\n\t\t\tOptions: options,\n\t\t\tDigest: data.BetaPositiveDigest,\n\t\t\tResultParams: map[string]string{\n\t\t\t\ttypes.PrimaryKeyField: string(data.BetaTest),\n\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tGroupParams: bullheadGroup,\n\t\t\tOptions: options,\n\t\t\tDigest: BetaBrandNewDigest,\n\t\t\tResultParams: map[string]string{\n\t\t\t\ttypes.PrimaryKeyField: string(data.BetaTest),\n\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t},\n\t\t},\n\t}, nil).Once() // this should be cached after fetch, as it could be expensive to retrieve.\n\n\tctx := context.Background()\n\tdb := sqltest.NewCockroachDBForTestsWithProductionSchema(ctx, t)\n\texistingData := schema.Tables{}\n\taddDiffData(t, &existingData, BetaBrandNewDigest, data.BetaPositiveDigest, makeSmallDiffMetric())\n\trequire.NoError(t, sqltest.BulkInsertDataTables(ctx, db, existingData))\n\twaitForSystemTime()\n\n\tconst gerritCRS = \"gerrit\"\n\tconst gerritInternalCRS = \"gerrit-internal\"\n\n\treviewSystems := []clstore.ReviewSystem{\n\t\t{\n\t\t\tID: gerritInternalCRS,\n\t\t\tStore: nil, // nil to catch errors if this is used (when it shouldn't be)\n\t\t\tURLTemplate: \"Should not be used\",\n\t\t\t// Client is unused here\n\t\t},\n\t\t{\n\t\t\tID: gerritCRS,\n\t\t\tStore: mcls,\n\t\t\tURLTemplate: \"https://skia-review.googlesource.com/%s\",\n\t\t\t// Client is unused here\n\t\t},\n\t}\n\n\ts := New(mes, nil, makeThreeDevicesIndexer(), reviewSystems, mtjs, everythingPublic, nothingFlaky, db)\n\n\tq := &query.Search{\n\t\tCodeReviewSystemID: gerritCRS,\n\t\tChangelistID: clID,\n\t\tIncludeDigestsProducedOnMaster: false,\n\n\t\tIncludeUntriagedDigests: true,\n\t\tOnlyIncludeDigestsProducedAtHead: true,\n\n\t\tMetric: query.CombinedMetric,\n\t\tRGBAMinFilter: 0,\n\t\tRGBAMaxFilter: 255,\n\t\tSort: query.SortAscending,\n\t}\n\n\tresp, err := s.Search(ctx, q)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, resp)\n\t// make sure the group maps were not mutated.\n\tassert.Len(t, anglerGroup, 1)\n\tassert.Len(t, bullheadGroup, 1)\n\tassert.Len(t, options, 1)\n\n\t// We expect to see the current CL appended to the list of master branch commits.\n\tmasterBranchCommits := frontend.FromTilingCommits(data.MakeTestCommits())\n\tmasterBranchCommitsWithCL := append(masterBranchCommits, frontend.Commit{\n\t\tCommitTime: clTime.Unix(),\n\t\tHash: clID,\n\t\tAuthor: clAuthor,\n\t\tSubject: clSubject,\n\t\tChangelistURL: \"https://skia-review.googlesource.com/1234\",\n\t})\n\tassert.Equal(t, &frontend.SearchResponse{\n\t\tCommits: masterBranchCommitsWithCL,\n\t\tOffset: 0,\n\t\tSize: 1,\n\t\tResults: []*frontend.SearchResult{\n\t\t\t{\n\t\t\t\tTest: data.BetaTest,\n\t\t\t\tDigest: BetaBrandNewDigest,\n\t\t\t\tStatus: \"untriaged\",\n\t\t\t\tParamSet: paramtools.ParamSet{\n\t\t\t\t\t\"device\": {data.BullheadDevice},\n\t\t\t\t\ttypes.PrimaryKeyField: {string(data.BetaTest)},\n\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t},\n\t\t\t\tTraceGroup: frontend.TraceGroup{\n\t\t\t\t\tTraces: []frontend.Trace{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tID: data.BullheadBetaTraceID,\n\t\t\t\t\t\t\t// The master branch has digest index 1 for the 3 previous commits on master branch.\n\t\t\t\t\t\t\t// Then we see index 0 (this digest) be added to the end to preview what the trace\n\t\t\t\t\t\t\t// would look like if this CL were to land.\n\t\t\t\t\t\t\tDigestIndices: []int{1, 1, 1, 0},\n\t\t\t\t\t\t\tParams: paramtools.Params{\n\t\t\t\t\t\t\t\t\"device\": data.BullheadDevice,\n\t\t\t\t\t\t\t\ttypes.PrimaryKeyField: string(data.BetaTest),\n\t\t\t\t\t\t\t\ttypes.CorpusField: \"gm\",\n\t\t\t\t\t\t\t\t\"ext\": data.PNGExtension,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDigests: []frontend.DigestStatus{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigest: BetaBrandNewDigest,\n\t\t\t\t\t\t\tStatus: \"untriaged\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDigest: data.BetaPositiveDigest,\n\t\t\t\t\t\t\tStatus: \"positive\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tTotalDigests: 2,\n\t\t\t\t},\n\t\t\t\tClosestRef: frontend.PositiveRef,\n\t\t\t\tRefDiffs: map[frontend.RefClosest]*frontend.SRDiffDigest{\n\t\t\t\t\tfrontend.PositiveRef: {\n\t\t\t\t\t\t// Small diff\n\t\t\t\t\t\tNumDiffPixels: 8,\n\t\t\t\t\t\tPixelDiffPercent: 0.02,\n\t\t\t\t\t\tMaxRGBADiffs: [4]int{0, 48, 12, 0},\n\t\t\t\t\t\tDimDiffer: false,\n\t\t\t\t\t\tCombinedMetric: 0.0005,\n\t\t\t\t\t\tQueryMetric: 0.0005,\n\t\t\t\t\t\tDigest: data.BetaPositiveDigest,\n\t\t\t\t\t\tStatus: \"positive\",\n\t\t\t\t\t\tParamSet: map[string][]string{\n\t\t\t\t\t\t\t\"device\": {data.AnglerDevice, data.BullheadDevice},\n\t\t\t\t\t\t\ttypes.PrimaryKeyField: {string(data.BetaTest)},\n\t\t\t\t\t\t\ttypes.CorpusField: {\"gm\"},\n\t\t\t\t\t\t\t\"ext\": {data.PNGExtension},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tfrontend.NegativeRef: nil,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBulkTriageData: frontend.TriageRequestData{\n\t\t\tdata.BetaTest: {\n\t\t\t\tBetaBrandNewDigest: expectations.Positive,\n\t\t\t},\n\t\t},\n\t}, resp)\n\n\t// Validate that we cache the .*Store values in two quick responses.\n\t_, err = s.Search(ctx, q)\n\trequire.NoError(t, err)\n}", "title": "" }, { "docid": "ec1b5b468a2586ae386a0f2df17e2aa0", "score": "0.46272588", "text": "func correctnessTests(configFile string, bloomFilterSz int, numDocs int, isMalicious bool, useMaster bool, inputDir string) {\n /* Initialize client */\n log.Println(\"Initializing client...\")\n client.Setup(configFile, bloomFilterSz, numDocs)\n conn := client.OpenConnection()\n\n files,_ := ioutil.ReadDir(inputDir)\n numDocs = len(files)\n for docID, file := range files {\n var err error\n docID = docID % numDocs\n filename := inputDir + \"/\" + file.Name()\n if (isMalicious) {\n err = client.UpdateDocFile_malicious(conn, filename, docID, useMaster)\n } else {\n err = client.UpdateDocFile_semihonest(conn, filename, docID, useMaster)\n }\n if err != nil {\n log.Fatal(err)\n }\n }\n\n\n log.Println(\"Finished updates\")\n\n time.Sleep(5000 * time.Millisecond)\n \n pass := true\n for docID, file := range files {\n keywords := client.GetKeywordsFromFile(inputDir + \"/\" + file.Name())\n for _, keyword := range keywords {\n var docs []byte\n if (isMalicious) {\n docs, _, _, _, _, _, _ = client.SearchKeyword_malicious(conn, keyword, useMaster)\n } else {\n docs, _ = client.SearchKeyword_semihonest(conn, keyword, useMaster)\n }\n if (docs[docID / 8] & (1 << (uint(docID) % 8)) == 0) {\n log.Printf(\"ERROR: did not find keyword %s in document %d\\n\", keyword, docID)\n pass = false\n }\n }\n }\n if (pass) {\n log.Printf(\"---- PASSED TESTS ----\\n\");\n } else {\n log.Printf(\"---- FAILED TESTS ----\\n\");\n }\n\n /* Clean up */\n log.Println(\"Cleaning up...\")\n client.CloseConnection(conn)\n client.Cleanup()\n}", "title": "" }, { "docid": "dc265686ee528af78aefd35ad2b7104a", "score": "0.46222338", "text": "func (rp *evmRegistryPackerV2_1) UnpackCheckResult(key ocr2keepers.UpkeepKey, raw string) (EVMAutomationUpkeepResult21, error) {\n\tvar (\n\t\tresult EVMAutomationUpkeepResult21\n\t)\n\n\tb, err := hexutil.Decode(raw)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tout, err := rp.abi.Methods[\"checkUpkeep\"].Outputs.UnpackValues(b)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"%w: unpack checkUpkeep return: %s\", err, raw)\n\t}\n\n\tblock, id, err := splitKey(key)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\tresult = EVMAutomationUpkeepResult21{\n\t\tBlock: uint32(block.Uint64()),\n\t\tID: id,\n\t\tEligible: true,\n\t\tCheckBlockNumber: uint32(block.Uint64()),\n\t\tCheckBlockHash: [32]byte{},\n\t}\n\n\tupkeepNeeded := *abi.ConvertType(out[0], new(bool)).(*bool)\n\trawPerformData := *abi.ConvertType(out[1], new([]byte)).(*[]byte)\n\tresult.FailureReason = *abi.ConvertType(out[2], new(uint8)).(*uint8)\n\tresult.GasUsed = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\tresult.FastGasWei = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int)\n\tresult.LinkNative = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int)\n\n\tif !upkeepNeeded {\n\t\tresult.Eligible = false\n\t}\n\t// if NONE we expect the perform data. if TARGET_CHECK_REVERTED we will have the error data in the perform data used for off chain lookup\n\tif result.FailureReason == UPKEEP_FAILURE_REASON_NONE || (result.FailureReason == UPKEEP_FAILURE_REASON_TARGET_CHECK_REVERTED && len(rawPerformData) > 0) {\n\t\tresult.PerformData = rawPerformData\n\t}\n\n\t// This is a default placeholder which is used since we do not get the execute gas\n\t// from checkUpkeep result. This field is overwritten later from the execute gas\n\t// we have for an upkeep in memory. TODO (AUTO-1482): Refactor this\n\tresult.ExecuteGas = 5_000_000\n\n\treturn result, nil\n}", "title": "" }, { "docid": "deabffbbaa6da1c68158a1d8f67f473e", "score": "0.46210352", "text": "func checkMultiplePaths() {\n\tfirstPath := make(map[module.Version]string, len(buildList))\n\tfor _, mod := range buildList {\n\t\tsrc := mod\n\t\tif rep := Replacement(mod); rep.Path != \"\" {\n\t\t\tsrc = rep\n\t\t}\n\t\tif prev, ok := firstPath[src]; !ok {\n\t\t\tfirstPath[src] = mod.Path\n\t\t} else if prev != mod.Path {\n\t\t\tbase.Errorf(\"go: %s@%s used for two different module paths (%s and %s)\", src.Path, src.Version, prev, mod.Path)\n\t\t}\n\t}\n\tbase.ExitIfErrors()\n}", "title": "" }, { "docid": "7bcfe7f11eb83556c6d0b3a6615f7fa4", "score": "0.46151212", "text": "func TestFixManifestLayersBaseLayerParent(t *testing.T) {\n\t// TODO Windows: Fix this unit text\n\tif runtime.GOOS == \"windows\" {\n\t\tt.Skip(\"Needs fixing on Windows\")\n\t}\n\tduplicateLayerManifest := schema1.Manifest{\n\t\tFSLayers: []schema1.FSLayer{\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa\")},\n\t\t},\n\t\tHistory: []schema1.History{\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"parent\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"created\\\":\\\"2015-08-19T16:49:07.568027497Z\\\",\\\"container\\\":\\\"fe9e5a5264a843c9292d17b736c92dd19bdb49986a8782d7389964ddaff887cc\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"cd /go/src/github.com/tonistiigi/dnsdock \\\\u0026\\\\u0026 go get -v github.com/tools/godep \\\\u0026\\\\u0026 godep restore \\\\u0026\\\\u0026 go install -ldflags \\\\\\\"-X main.version `git describe --tags HEAD``if [[ -n $(command git status --porcelain --untracked-files=no 2\\\\u003e/dev/null) ]]; then echo \\\\\\\"-dirty\\\\\\\"; fi`\\\\\\\" ./...\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/bash\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":118430532}\\n\"},\n\t\t},\n\t}\n\n\tif err := fixManifestLayers(&duplicateLayerManifest); err == nil || !strings.Contains(err.Error(), \"invalid parent ID in the base layer of the image\") {\n\t\tt.Fatalf(\"expected an invalid parent ID error from fixManifestLayers\")\n\t}\n}", "title": "" }, { "docid": "a3e19d56cfadc044bf6b684c00ea5854", "score": "0.461216", "text": "func verifyDlcContent(path, id string) error {\n\trootMounts, err := getRootMounts(path, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(rootMounts) == 0 {\n\t\treturn errors.Errorf(\"no root mounts exist for %v\", id)\n\t}\n\tfor _, rootMount := range rootMounts {\n\t\tif err := filepath.Walk(rootMount, func(path string, info os.FileInfo, err error) error {\n\t\t\tswitch filepath.Ext(path) {\n\t\t\tcase \".sum\":\n\t\t\t\tif err := checkSHA2Sum(path); err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"check sum failed\")\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase \".perms\":\n\t\t\t\tif err := checkPerms(path); err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"permissions check failed\")\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ace9da8767074c15e4bdf7fbe61a5bd0", "score": "0.4607919", "text": "func TestCrConflictMergedWriteMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkdir(\"a\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"a/b\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b/c\", \"hello\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"b$\": \"DIR\", crnameEsc(\"b\", alice): \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(crname(\"a/b\", alice), ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"b$\": \"DIR\", crnameEsc(\"b\", alice): \"FILE\"}),\n\t\t\tread(\"a/b/c\", \"hello\"),\n\t\t\tread(crname(\"a/b\", alice), ntimesString(15, \"0123456789\")),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "9aa855add8bfa201e75d84c56c9acf43", "score": "0.46044078", "text": "func TestFixManifestLayers(t *testing.T) {\n\tduplicateLayerManifest := schema1.Manifest{\n\t\tFSLayers: []schema1.FSLayer{\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa\")},\n\t\t},\n\t\tHistory: []schema1.History{\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:07.568027497Z\\\",\\\"container\\\":\\\"fe9e5a5264a843c9292d17b736c92dd19bdb49986a8782d7389964ddaff887cc\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"cd /go/src/github.com/tonistiigi/dnsdock \\\\u0026\\\\u0026 go get -v github.com/tools/godep \\\\u0026\\\\u0026 godep restore \\\\u0026\\\\u0026 go install -ldflags \\\\\\\"-X main.version `git describe --tags HEAD``if [[ -n $(command git status --porcelain --untracked-files=no 2\\\\u003e/dev/null) ]]; then echo \\\\\\\"-dirty\\\\\\\"; fi`\\\\\\\" ./...\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/bash\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":118430532}\\n\"},\n\t\t},\n\t}\n\n\tduplicateLayerManifestExpectedOutput := schema1.Manifest{\n\t\tFSLayers: []schema1.FSLayer{\n\t\t\t{BlobSum: digest.Digest(\"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\")},\n\t\t\t{BlobSum: digest.Digest(\"sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa\")},\n\t\t},\n\t\tHistory: []schema1.History{\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"3b38edc92eb7c074812e217b41a6ade66888531009d6286a6f5f36a06f9841b9\\\",\\\"parent\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:11.368300679Z\\\",\\\"container\\\":\\\"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) ENTRYPOINT [\\\\\\\"/go/bin/dnsdock\\\\\\\"]\\\"],\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":null,\\\"Image\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":[\\\"/go/bin/dnsdock\\\"],\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":0}\\n\"},\n\t\t\t{V1Compatibility: \"{\\\"id\\\":\\\"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02\\\",\\\"created\\\":\\\"2015-08-19T16:49:07.568027497Z\\\",\\\"container\\\":\\\"fe9e5a5264a843c9292d17b736c92dd19bdb49986a8782d7389964ddaff887cc\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"cd /go/src/github.com/tonistiigi/dnsdock \\\\u0026\\\\u0026 go get -v github.com/tools/godep \\\\u0026\\\\u0026 godep restore \\\\u0026\\\\u0026 go install -ldflags \\\\\\\"-X main.version `git describe --tags HEAD``if [[ -n $(command git status --porcelain --untracked-files=no 2\\\\u003e/dev/null) ]]; then echo \\\\\\\"-dirty\\\\\\\"; fi`\\\\\\\" ./...\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"docker_version\\\":\\\"1.6.2\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"03797203757d\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"Memory\\\":0,\\\"MemorySwap\\\":0,\\\"CpuShares\\\":0,\\\"Cpuset\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"PortSpecs\\\":null,\\\"ExposedPorts\\\":null,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\",\\\"GOLANG_VERSION=1.4.1\\\",\\\"GOPATH=/go\\\"],\\\"Cmd\\\":[\\\"/bin/bash\\\"],\\\"Image\\\":\\\"e3b0ff09e647595dafee15c54cd632c900df9e82b1d4d313b1e20639a1461779\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"/go\\\",\\\"Entrypoint\\\":null,\\\"NetworkDisabled\\\":false,\\\"MacAddress\\\":\\\"\\\",\\\"OnBuild\\\":[],\\\"Labels\\\":{}},\\\"architecture\\\":\\\"amd64\\\",\\\"os\\\":\\\"linux\\\",\\\"Size\\\":118430532}\\n\"},\n\t\t},\n\t}\n\n\tif err := fixManifestLayers(&duplicateLayerManifest); err != nil {\n\t\tt.Fatalf(\"unexpected error from fixManifestLayers: %v\", err)\n\t}\n\n\tif !reflect.DeepEqual(duplicateLayerManifest, duplicateLayerManifestExpectedOutput) {\n\t\tt.Fatal(\"incorrect output from fixManifestLayers on duplicate layer manifest\")\n\t}\n\n\t// Run fixManifestLayers again and confirm that it doesn't change the\n\t// manifest (which no longer has duplicate layers).\n\tif err := fixManifestLayers(&duplicateLayerManifest); err != nil {\n\t\tt.Fatalf(\"unexpected error from fixManifestLayers: %v\", err)\n\t}\n\n\tif !reflect.DeepEqual(duplicateLayerManifest, duplicateLayerManifestExpectedOutput) {\n\t\tt.Fatal(\"incorrect output from fixManifestLayers on duplicate layer manifest (second pass)\")\n\t}\n}", "title": "" }, { "docid": "f6f10acb88dcd693198eb415ae7f7985", "score": "0.46033064", "text": "func duplicateDownload(t *testing.T) {\n\tworkingDir, err := os.MkdirTemp(\"\", \"downloadTests\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tdefer tests.RemoveAllAndAssert(t, workingDir)\n\tdownloadPattern := getRtTargetRepo() + \"*.in\"\n\tdownloadTarget := workingDir + string(filepath.Separator)\n\tsummary, err := testsDownloadService.DownloadFiles(services.DownloadParams{CommonParams: &utils.CommonParams{Pattern: downloadPattern, Recursive: true, Target: downloadTarget}, Flat: true})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif summary.TotalSucceeded != 2 {\n\t\tt.Error(\"Expected to download 2 files.\")\n\t}\n\tif summary.TotalFailed != 0 {\n\t\tt.Error(\"Failed to download\", summary.TotalFailed, \"files.\")\n\t}\n\tdownloadTarget2 := workingDir + string(filepath.Separator) + \"file\"\n\tsummary2, err := testsDownloadService.DownloadFiles(services.DownloadParams{CommonParams: &utils.CommonParams{Pattern: downloadPattern, Recursive: true, Target: downloadTarget2}, Flat: true})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t// Two files match the pattern, but both are planned to be downloaded to the same path, so only one of them is downloaded\n\tif summary2.TotalSucceeded != 1 {\n\t\tt.Error(\"Expected to download 1 files.\")\n\t}\n\tif summary2.TotalFailed != 0 {\n\t\tt.Error(\"Failed to download\", summary2.TotalFailed, \"files.\")\n\t}\n}", "title": "" }, { "docid": "9fa5ae177793c02fe6b3afcdeb57e501", "score": "0.45979387", "text": "func TestNewMembershipFromInitialPeerURLsMap_Single(t *testing.T) {\n\n\tinitialURLsMap, _ := types.NewURLsMap(InitialPeerURLsMapSingle)\n\texpectMembers := getExpectMembersSingle()\n\tdoTestNewMembershipFromInitialPeerURLsMap(initialURLsMap, \"raftgroup_multi\", expectMembers, t)\n\n}", "title": "" }, { "docid": "6e7be04e32d59f72436c1a225c7310d5", "score": "0.4597303", "text": "func ecMountpaths(t *testing.T, o *ecOptions, proxyURL string, bck cmn.Bck) {\n\ttype removedMpath struct {\n\t\tsi *meta.Snode\n\t\tmpath string\n\t}\n\tbaseParams := tools.BaseAPIParams(proxyURL)\n\tnewLocalBckWithProps(t, baseParams, bck, defaultECBckProps(o), o)\n\n\twg := sync.WaitGroup{}\n\twg.Add(o.objCount)\n\tfor i := 0; i < o.objCount; i++ {\n\t\tgo func(i int) {\n\t\t\tdefer wg.Done()\n\t\t\tobjName := fmt.Sprintf(o.pattern, i)\n\t\t\tcreateECObject(t, baseParams, bck, objName, i, o)\n\t\t}(i)\n\t}\n\twg.Wait()\n\n\tif t.Failed() {\n\t\tt.FailNow()\n\t}\n\n\tmsg := &apc.LsoMsg{Props: apc.GetPropsSize}\n\tobjList, err := api.ListObjects(baseParams, bck, msg, api.ListArgs{})\n\ttassert.CheckFatal(t, err)\n\ttlog.Logf(\"%d objects created, removing %d mountpaths\\n\", len(objList.Entries), o.parityCnt)\n\n\tallMpaths := tools.GetTargetsMountpaths(t, o.smap, baseParams)\n\tremoved := make(map[string]*removedMpath, o.parityCnt)\n\tdefer func() {\n\t\tfor _, rmMpath := range removed {\n\t\t\terr := api.AttachMountpath(baseParams, rmMpath.si, rmMpath.mpath, true /*force*/)\n\t\t\ttassert.CheckError(t, err)\n\t\t}\n\t\ttools.WaitForResilvering(t, baseParams, nil)\n\t}()\n\t// Choose `parity` random mpaths and disable them\n\ti := 0\n\tfor tsi, paths := range allMpaths {\n\t\tmpath := paths[rand.Intn(len(paths))]\n\t\tuid := tsi.ID() + \"/\" + mpath\n\t\tif _, ok := removed[uid]; ok {\n\t\t\tcontinue\n\t\t}\n\t\terr := api.DetachMountpath(baseParams, tsi, mpath, true /*dont-resil*/)\n\t\ttassert.CheckFatal(t, err)\n\t\trmMpath := &removedMpath{si: tsi, mpath: mpath}\n\t\tremoved[uid] = rmMpath\n\t\ti++\n\t\ttlog.Logf(\"%d. Disabled %s : %s\\n\", i, tsi.StringEx(), mpath)\n\t\tif i >= o.parityCnt {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, en := range objList.Entries {\n\t\t_, err := api.GetObject(baseParams, bck, en.Name, nil)\n\t\ttassert.CheckError(t, err)\n\t}\n}", "title": "" }, { "docid": "a485134784e0505c2f10ad21e8547d98", "score": "0.45930368", "text": "func Solve18() {\n\n\tchalInputZip, err := utility.GetFileForChallenge(\"http://www.pythonchallenge.com/pc/return/deltas.gz\", \"huge\", \"file\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tzipBytes, err := io.ReadAll(chalInputZip)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tzipReader, err := gzip.NewReader(bytes.NewReader(zipBytes))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// file, err := zipReader.(\"delta.txt\")\n\n\t// if err != nil {\n\t// \tpanic(err)\n\t// }\n\n\tscanner := bufio.NewScanner(zipReader)\n\n\tleftData := make([]string, 0)\n\trightData := make([]string, 0)\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\n\t\tleft := line[:53] + \"\\n\" // Although diff lib takes line arrays, it only works line by line if theyre separated by newline\n\t\tright := line[56:] + \"\\n\"\n\n\t\tleftData = append(leftData, left)\n\t\trightData = append(rightData, right)\n\t}\n\n\tbothFile, _ := os.Create(\"answers/chal18_both.png\")\n\tleftFile, _ := os.Create(\"answers/chal18_left.png\")\n\trightFile, _ := os.Create(\"answers/chal18_right.png\")\n\n\tdefer bothFile.Close()\n\tdefer leftFile.Close()\n\tdefer rightFile.Close()\n\n\tdiff := difflib.UnifiedDiff{\n\t\tA: leftData,\n\t\tB: rightData,\n\t\tFromFile: \"Left\",\n\t\tToFile: \"Right\",\n\t\tContext: 10000, //This sucks - pythons difflib actually does have support for outputting total diffs, but the go implementation does not\n\t}\n\n\tresult, _ := difflib.GetUnifiedDiffString(diff)\n\n\tlines := difflib.SplitLines(result)\n\n\tfor _, line := range lines[3:] {\n\t\tline := strings.TrimSuffix(line, \"\\n\")\n\t\tdiffPrefix, _ := utf8.DecodeRuneInString(line)\n\n\t\tif diffPrefix == ' ' {\n\t\t\tbothFile.Write(convertStringToBinary(line[1:]))\n\t\t} else if diffPrefix == '+' {\n\t\t\trightFile.Write(convertStringToBinary(line[1:]))\n\t\t} else if diffPrefix == '-' {\n\t\t\tleftFile.Write(convertStringToBinary(line[1:]))\n\t\t}\n\t}\n\n\tfmt.Println(\"Answer saved to: \" + bothFile.Name())\n\tfmt.Println(\"Answer saved to: \" + leftFile.Name())\n\tfmt.Println(\"Answer saved to: \" + rightFile.Name())\n}", "title": "" }, { "docid": "15ab7d06abb30ccfee20f031618379b0", "score": "0.45899853", "text": "func TestCrUnmergedCreateInRemovedDir(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkfile(\"a/b/c/d/e\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trm(\"a/b/c/d/e\"),\n\t\t\trmdir(\"a/b/c/d\"),\n\t\t\trmdir(\"a/b/c\"),\n\t\t\trmdir(\"a/b\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/b/c/d/f\", \"goodbye\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/b/c/d\", m{\"f\": \"FILE\"}),\n\t\t\tread(\"a/b/c/d/f\", \"goodbye\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/b/c/d\", m{\"f\": \"FILE\"}),\n\t\t\tread(\"a/b/c/d/f\", \"goodbye\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "e20a829033f810d9676f7831cc6d9922", "score": "0.458763", "text": "func (c *Client) downloadNonUnified(ctx context.Context, outDir string, outputs map[digest.Digest]*TreeOutput) (*MovedBytesMetadata, error) {\n\tvar dgs []digest.Digest\n\t// statsMu protects stats across threads.\n\tstatsMu := sync.Mutex{}\n\tfullStats := &MovedBytesMetadata{}\n\n\tif bool(c.useBatchOps) && bool(c.UtilizeLocality) {\n\t\tpaths := make([]*TreeOutput, 0, len(outputs))\n\t\tfor _, output := range outputs {\n\t\t\tpaths = append(paths, output)\n\t\t}\n\n\t\t// This is to utilize locality in disk when writing files.\n\t\tsort.Slice(paths, func(i, j int) bool {\n\t\t\treturn paths[i].Path < paths[j].Path\n\t\t})\n\n\t\tfor _, path := range paths {\n\t\t\tdgs = append(dgs, path.Digest)\n\t\t\tfullStats.Requested += path.Digest.Size\n\t\t}\n\t} else {\n\t\tfor dg := range outputs {\n\t\t\tdgs = append(dgs, dg)\n\t\t\tfullStats.Requested += dg.Size\n\t\t}\n\t}\n\n\tcontextmd.Infof(ctx, log.Level(2), \"%d items to download\", len(dgs))\n\tvar batches [][]digest.Digest\n\tif c.useBatchOps {\n\t\tbatches = c.makeBatches(ctx, dgs, !bool(c.UtilizeLocality))\n\t} else {\n\t\tcontextmd.Infof(ctx, log.Level(2), \"Downloading them individually\")\n\t\tfor i := range dgs {\n\t\t\tcontextmd.Infof(ctx, log.Level(3), \"Creating single batch of blob %s\", dgs[i])\n\t\t\tbatches = append(batches, dgs[i:i+1])\n\t\t}\n\t}\n\n\teg, eCtx := errgroup.WithContext(ctx)\n\tfor i, batch := range batches {\n\t\ti, batch := i, batch // https://golang.org/doc/faq#closures_and_goroutines\n\t\teg.Go(func() error {\n\t\t\tif err := c.casDownloaders.Acquire(eCtx, 1); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer c.casDownloaders.Release(1)\n\t\t\tif i%logInterval == 0 {\n\t\t\t\tcontextmd.Infof(ctx, log.Level(2), \"%d batches left to download\", len(batches)-i)\n\t\t\t}\n\t\t\tif len(batch) > 1 {\n\t\t\t\tcontextmd.Infof(ctx, log.Level(3), \"Downloading batch of %d files\", len(batch))\n\t\t\t\tbchMap, err := c.BatchDownloadBlobs(eCtx, batch)\n\t\t\t\tfor _, dg := range batch {\n\t\t\t\t\tdata := bchMap[dg]\n\t\t\t\t\tout := outputs[dg]\n\t\t\t\t\tperm := c.RegularMode\n\t\t\t\t\tif out.IsExecutable {\n\t\t\t\t\t\tperm = c.ExecutableMode\n\t\t\t\t\t}\n\t\t\t\t\tif err := os.WriteFile(filepath.Join(outDir, out.Path), data, perm); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tstatsMu.Lock()\n\t\t\t\t\tfullStats.LogicalMoved += int64(len(data))\n\t\t\t\t\tfullStats.RealMoved += int64(len(data))\n\t\t\t\t\tstatsMu.Unlock()\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tout := outputs[batch[0]]\n\t\t\t\tpath := filepath.Join(outDir, out.Path)\n\t\t\t\tcontextmd.Infof(ctx, log.Level(3), \"Downloading single file with digest %s to %s\", out.Digest, path)\n\t\t\t\tstats, err := c.ReadBlobToFile(ctx, out.Digest, path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tstatsMu.Lock()\n\t\t\t\tfullStats.addFrom(stats)\n\t\t\t\tstatsMu.Unlock()\n\t\t\t\tif out.IsExecutable {\n\t\t\t\t\tif err := os.Chmod(path, c.ExecutableMode); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif eCtx.Err() != nil {\n\t\t\t\treturn eCtx.Err()\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tcontextmd.Infof(ctx, log.Level(3), \"Waiting for remaining jobs\")\n\terr := eg.Wait()\n\tcontextmd.Infof(ctx, log.Level(3), \"Done\")\n\treturn fullStats, err\n}", "title": "" }, { "docid": "adb8445a21f6d5160061be8ae662dbf6", "score": "0.45873296", "text": "func checkCacheDiskConsistency(formats []*formatCacheV2) error {\n\tvar disks = make([]string, len(formats))\n\t// Collect currently available disk uuids.\n\tfor index, format := range formats {\n\t\tif format == nil {\n\t\t\tdisks[index] = \"\"\n\t\t\tcontinue\n\t\t}\n\t\tdisks[index] = format.Cache.This\n\t}\n\tfor i, format := range formats {\n\t\tif format == nil {\n\t\t\tcontinue\n\t\t}\n\t\tj := findCacheDiskIndex(disks[i], format.Cache.Disks)\n\t\tif j == -1 {\n\t\t\treturn fmt.Errorf(\"UUID on positions %d:%d do not match with , expected %s\", i, j, disks[i])\n\t\t}\n\t\tif i != j {\n\t\t\treturn fmt.Errorf(\"UUID on positions %d:%d do not match with , expected %s got %s\", i, j, disks[i], format.Cache.Disks[j])\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07922e24d44f5d2feaec8441f6e3b023", "score": "0.45788392", "text": "func checkFileBodiesEqual(t *testing.T, in, out *dicom.DataSet) {\n\t// DCMTK arbitrarily changes the sequences and items to use\n\t// undefined-length encoding, so ignore such diffs.\n\tvar normalize = func(s string) string {\n\t\ts = strings.Replace(s, \"NA u\", \"NA \", -1)\n\t\ts = strings.Replace(s, \"SQ u\", \"SQ \", -1)\n\t\treturn s\n\t}\n\tvar removeMetaElems = func(f *dicom.DataSet) []*dicom.Element {\n\t\tvar elems []*dicom.Element\n\t\tfor _, elem := range f.Elements {\n\t\t\tif elem.Tag.Group != dicomtag.MetadataGroup {\n\t\t\t\telems = append(elems, elem)\n\t\t\t}\n\t\t}\n\t\treturn elems\n\t}\n\n\tinElems := removeMetaElems(in)\n\toutElems := removeMetaElems(out)\n\tassert.Equal(t, len(inElems), len(outElems))\n\tfor i := 0; i < len(inElems); i++ {\n\t\tins := normalize(inElems[i].String())\n\t\touts := normalize(outElems[i].String())\n\t\tif ins != outs {\n\t\t\tt.Errorf(\"%dth element mismatch: %v <-> %v\", i, ins, outs)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "70150ad1aba5f495e2f06a327b8997c5", "score": "0.45728686", "text": "func TestConsistencyWhenKill9AfterModify(t *testing.T) {\n\t// assumption: the test is run on filesystem & not directly on object store\n\tdataRepoPath := path.Join(*repoPathPrefix, dirPath, dataPath)\n\n\tbaseDir := t.TempDir()\n\trequire.NotEmpty(t, baseDir, \"TempDir() did not generate a valid dir\")\n\n\tbm, err := blobmanipulator.NewBlobManipulator(baseDir, dataRepoPath)\n\tif err != nil {\n\t\tif errors.Is(err, kopiarunner.ErrExeVariableNotSet) {\n\t\t\tt.Skip(\"Skipping crash consistency tests because KOPIA_EXE is not set\")\n\t\t}\n\n\t\tt.Skip(\"Error creating SnapshotTester:\", err)\n\t}\n\n\tbm.DataRepoPath = dataRepoPath\n\n\t// create a snapshot for initialized data\n\t_, err = bm.SetUpSystemWithOneSnapshot()\n\trequire.NoError(t, err)\n\n\tcmpDir := bm.PathToTakeSnapshot\n\n\t// add files\n\tfileSize := 1 * 1024 * 1024\n\tnumFiles := 200\n\n\terr = bm.GenerateRandomFiles(fileSize, numFiles)\n\trequire.NoError(t, err)\n\n\tnewDir := bm.PathToTakeSnapshot\n\n\t// connect with repository with the environment configuration, otherwise it will display \"ERROR open repository: repository is not connected.kopia connect repo\".\n\tkopiaExe := os.Getenv(\"KOPIA_EXE\")\n\n\tcmd := exec.Command(kopiaExe, \"repo\", \"connect\", \"filesystem\", \"--path=\"+dataRepoPath, \"--content-cache-size-mb\", \"500\", \"--metadata-cache-size-mb\", \"500\", \"--no-check-for-updates\")\n\tenv := []string{\"KOPIA_PASSWORD=\" + testenv.TestRepoPassword}\n\tcmd.Env = append(os.Environ(), env...)\n\n\to, err := cmd.CombinedOutput()\n\trequire.NoError(t, err)\n\tt.Logf(string(o))\n\n\t// create snapshot with StderrPipe\n\tcmd = exec.Command(kopiaExe, \"snap\", \"create\", newDir, \"--json\", \"--parallel=1\")\n\n\t// kill the kopia command before it exits\n\tt.Logf(\"Kill the kopia command before it exits:\")\n\tkillOnCondition(t, cmd)\n\n\tt.Logf(\"Verify snapshot corruption:\")\n\t// verify snapshot corruption\n\terr = bm.VerifySnapshot()\n\trequire.NoError(t, err)\n\n\t// Create a temporary dir to restore a snapshot\n\trestoreDir := t.TempDir()\n\trequire.NotEmpty(t, restoreDir, \"TempDir() did not generate a valid dir\")\n\n\t// try to restore a snapshot without any error messages.\n\tstdout, err := bm.RestoreGivenOrRandomSnapshot(\"\", restoreDir)\n\trequire.NoError(t, err)\n\n\tt.Logf(stdout)\n\n\tt.Logf(\"Compare restored data and original data:\")\n\tCompareDirs(t, restoreDir, cmpDir)\n}", "title": "" }, { "docid": "aa95038fe5df1620a7078a5f4ab0126b", "score": "0.45695883", "text": "func TestLNURLDecodeStrict(t *testing.T) {\n\ttype args struct {\n\t\tcode string\n\t}\n\ttests := []struct {\n\t\tname string\n\t\tdesc string\n\t\targs args\n\t\twant string\n\t\twantErr bool\n\t}{\n\t\t{desc: \"LUD17_CHANGE_SCHEMA\",\n\t\t\targs: args{code: \"lnurlp://lnurl.fiatjaf.com\"}, // change scheme\n\t\t\twant: \"https://lnurl.fiatjaf.com\"},\n\t\t{desc: \"ONION_SCHEMA_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"onion://lnurl.fiatjaf.onion\"}, // change scheme\n\t\t\twant: \"http://lnurl.fiatjaf.onion\", wantErr: true},\n\t\t{desc: \"LUD17_BECH32_ENCODED_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"lnurl1d3h82unvwqaz7tmpwp5juenfv96x5ctx9e3k7mf0wccj7mrww4exctmsv9usxr8j98\"}, // lnurlp://api.fiatjaf.com/v1/lnurl/pay\n\t\t\twant: \"https://api.fiatjaf.com/v1/lnurl/pay\", wantErr: true},\n\t\t{desc: \"LUD17_BECH32_ENCODED_CHANGE_SCHEMA_IP_ERROR\",\n\t\t\targs: args{code: \"lnurl1dp68gup69uhnzt339ccjuvf0wccj7mrww4exctmsv9usux0rql\"}, // lnurlp://api.fiatjaf.com/v1/lnurl/pay\n\t\t\twant: \"https://1.1.1.1/v1/lnurl/pay\", wantErr: true},\n\t\t{desc: \"LUD1_ENCODED_CHANGE_SCHEMA\",\n\t\t\targs: args{code: \"lnurl1dp68gurn8ghj7vfwxyhrzt339amrztmvde6hymp0wpshjr50pch\"}, // https://1.1.1.1/v1/lnurl/pay\n\t\t\twant: \"https://1.1.1.1/v1/lnurl/pay\"},\n\t\t{desc: \"LUD1_PUNY_SAME_SCHEMA\",\n\t\t\targs: args{code: \"lnurl1dp68gurn8ghj77rw95khx7r3wc6kwv3nv3uhyvmpxserscfwvdhk6tmkxyhkcmn4wfkz7urp0y6jmn9j\"}, // https://xn--sxqv5g23dyr3a428a.com/v1/lnurl/pay\n\t\t\twant: \"https://xn--sxqv5g23dyr3a428a.com/v1/lnurl/pay\"}, // check puny code\n\t\t{desc: \"LUD1_IDN_SAME_SCHEMA\",\n\t\t\targs: args{code: \"lnurl1dp68gurn8ghjle443052l909sxr7t8ulukgg6tnrdakj7a339akxuatjdshhqctea4v3jm\"},\n\t\t\twant: \"https://测试假域名.com/v1/lnurl/pay\"}, // check puny code\n\t\t{desc: \"LUD17_BECH32_IDN_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"lnurl1d3h82unvwuaz7tlxkk973tu4ukqc0evlnljeprfwvdhk6tmkxyhkcmn4wfkz7urp0y93ltxj\"},\n\t\t\twant: \"https://测试假域名.com/v1/lnurl/pay\", wantErr: true}, // check puny code\n\t\t{desc: \"LUD1_BECH32_ONION_SAME_SCHEMA\",\n\t\t\targs: args{code: \"lnurl1dp68gup69uh7ddvtazhetevpsljel8l9jzxjummwd9hkutmkxyhkcmn4wfkz7urp0ygc52rr\"}, // http://测试假域名.onion/v1/lnurl/pay\n\t\t\twant: \"http://测试假域名.onion/v1/lnurl/pay\"}, // check puny onion (not sure know if this is possible)\n\t\t{desc: \"LUD1_BECH32_ONION_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"lnurl1dp68gurn8ghj7er0d4skjm3wdahxjmmw9amrztmvde6hymp0wpshjcw5kvw\"},\n\t\t\twant: \"http://domain.onion/v1/lnurl/pay\", wantErr: true}, // check puny onion (not sure know if this is possible)\n\t\t{desc: \"RANDOM_STRING_ERROR\",\n\t\t\targs: args{code: \"lnurl1d3h82unvjhypn2\"},\n\t\t\twant: \"lnurl\", wantErr: true}, // invalid domain name. returns error and decoded input\n\t\t{desc: \"RANDOM_STRING_UPPERCASE_ERROR\",\n\t\t\targs: args{code: strings.ToUpper(\"lnurl1d3h82unvjhypn2\")},\n\t\t\twant: \"lnurl\", wantErr: true},\n\t\t{desc: \"HTTPS\",\n\t\t\targs: args{code: \"https://lnurl.fiatjaf.com\"}, // do noting\n\t\t\twant: \"https://lnurl.fiatjaf.com\"},\n\t\t{desc: \"ONION_SCHEMA_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"lnurl1dahxjmmw8ghj7mrww4exctnxd9shg6npvchx7mnfdahquxueex\"}, // change scheme\n\t\t\twant: \"http://lnurl.fiatjaf.onion\", wantErr: true},\n\t\t{desc: \"ONION_HTTPS_CHANGE_SCHEMA_ERROR\",\n\t\t\targs: args{code: \"lnurl1dp68gurn8ghj7mrww4exctnxd9shg6npvchx7mnfdahq874q6e\"}, // change scheme\n\t\t\twant: \"http://lnurl.fiatjaf.onion\", wantErr: true},\n\t}\n\tfor _, tt := range tests {\n\t\ttt.name = tt.args.code\n\t\tt.Run(fmt.Sprintf(\"%s\", tt.desc), func(t *testing.T) {\n\t\t\tgot, err := LNURLDecodeStrict(tt.args.code)\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"LNURLDecodeStrict() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif got != tt.want {\n\t\t\t\tt.Errorf(\"LNURLDecodeStrict() got = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "29af56cfed350480501751354126d122", "score": "0.45675927", "text": "func TestChangedCompliantUsername(t *testing.T) {\n\temail := \"foo@redhat.com\"\n\t// starting with a UserSignup that exists and was approved and has the now outdated CompliantUsername\n\tuserSignup := &v1alpha1.UserSignup{\n\t\tObjectMeta: newObjectMeta(\"\", email),\n\t\tSpec: v1alpha1.UserSignupSpec{\n\t\t\tUsername: email,\n\t\t\tApproved: true,\n\t\t\tTargetCluster: \"east\",\n\t\t},\n\t\tStatus: v1alpha1.UserSignupStatus{\n\t\t\tConditions: []toolchainv1alpha1.Condition{\n\t\t\t\t{\n\t\t\t\t\tType: toolchainv1alpha1.UserSignupApproved,\n\t\t\t\t\tStatus: v1.ConditionTrue,\n\t\t\t\t\tReason: toolchainv1alpha1.UserSignupApprovedByAdminReason,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStatus: v1.ConditionTrue,\n\t\t\t\t\tType: toolchainv1alpha1.UserSignupComplete,\n\t\t\t\t},\n\t\t\t},\n\t\t\tCompliantUsername: \"foo-old\",\n\t\t},\n\t}\n\n\t// also starting with the old MUR whose name matches the outdated UserSignup CompliantUsername\n\toldMur := &v1alpha1.MasterUserRecord{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"foo-old\",\n\t\t\tNamespace: operatorNamespace,\n\t\t\tLabels: map[string]string{v1alpha1.MasterUserRecordUserIDLabelKey: userSignup.Name},\n\t\t},\n\t}\n\n\t// create the initial resources\n\tr, req, _ := prepareReconcile(t, userSignup.Name, userSignup, oldMur, basicNSTemplateTier)\n\n\t// 1st reconcile should effectively be a no op because the MUR name and UserSignup CompliantUsername match and status is all good\n\tres, err := r.Reconcile(req)\n\trequire.NoError(t, err)\n\trequire.Equal(t, reconcile.Result{}, res)\n\n\t// after the 1st reconcile verify that the MUR still exists and its name still matches the initial UserSignup CompliantUsername\n\tmurs := &v1alpha1.MasterUserRecordList{}\n\terr = r.client.List(context.TODO(), murs, client.InNamespace(operatorNamespace))\n\trequire.NoError(t, err)\n\trequire.Len(t, murs.Items, 1)\n\tmur := murs.Items[0]\n\trequire.Equal(t, userSignup.Name, mur.Labels[v1alpha1.MasterUserRecordUserIDLabelKey])\n\trequire.Equal(t, mur.Name, \"foo-old\")\n\trequire.Equal(t, userSignup.Status.CompliantUsername, \"foo-old\")\n\n\t// delete the old MUR to trigger creation of a new MUR using the new username\n\terr = r.client.Delete(context.TODO(), oldMur)\n\trequire.NoError(t, err)\n\n\t// 2nd reconcile should handle the deleted MUR and provision a new one\n\tres, err = r.Reconcile(req)\n\trequire.NoError(t, err)\n\trequire.Equal(t, reconcile.Result{}, res)\n\n\t// verify the new MUR is provisioned\n\tmurs = &v1alpha1.MasterUserRecordList{}\n\terr = r.client.List(context.TODO(), murs)\n\trequire.NoError(t, err)\n\trequire.Len(t, murs.Items, 1)\n\tmur = murs.Items[0]\n\n\t// the MUR name should match the new CompliantUserName\n\tassert.Equal(t, \"foo\", mur.Name)\n\trequire.Equal(t, operatorNamespace, mur.Namespace)\n\trequire.Equal(t, userSignup.Name, mur.Labels[v1alpha1.MasterUserRecordUserIDLabelKey])\n\trequire.Len(t, mur.Spec.UserAccounts, 1)\n\tassert.Equal(t, \"basic\", mur.Spec.UserAccounts[0].Spec.NSTemplateSet.TierName)\n\trequire.Len(t, mur.Spec.UserAccounts[0].Spec.NSTemplateSet.Namespaces, 3)\n\n\t// lookup the userSignup and check the conditions are updated but the CompliantUsername is still the old one\n\terr = r.client.Get(context.TODO(), types.NamespacedName{Name: userSignup.Name, Namespace: req.Namespace}, userSignup)\n\trequire.NoError(t, err)\n\trequire.Equal(t, userSignup.Status.CompliantUsername, \"foo-old\")\n\n\t// 3rd reconcile should update the CompliantUsername on the UserSignup status\n\tres, err = r.Reconcile(req)\n\trequire.NoError(t, err)\n\trequire.Equal(t, reconcile.Result{}, res)\n\n\t// lookup the userSignup one more time and verify that the CompliantUsername was updated using the current transformUsername logic\n\terr = r.client.Get(context.TODO(), types.NamespacedName{Name: userSignup.Name, Namespace: req.Namespace}, userSignup)\n\trequire.NoError(t, err)\n\n\t// the CompliantUsername and MUR name should now match\n\trequire.Equal(t, userSignup.Status.CompliantUsername, mur.Name)\n}", "title": "" }, { "docid": "a35987c6f8f36c6adc59fee6f3d0513e", "score": "0.45645496", "text": "func (cf *CollisionFinder) testCollision(file *File, errors chan<- error) {\n\t// Size testing\n\n\t// First, we check if this size has been seen before\n\tfileList, existed := cf.sizeCollisions[file.Size()]\n\tif !existed {\n\t\tfileList = &FileList{}\n\t\tcf.sizeCollisions[file.Size()] = fileList\n\n\t}\n\n\tcollision, err := fileList.CollisionAdd(file)\n\tif err != nil {\n\t\tgo func() {\n\t\t\terrors <- fmt.Errorf(\"while checking for size collisions: %v\", err)\n\t\t}()\n\n\t\treturn\n\t}\n\n\t// If no collision was found during insertion, everything cool...\n\tif collision == nil {\n\t\treturn\n\t}\n\n\t// Sum testing\n\n\t// ... but if it was, we have to add it to the set, based on its sum\n\tstringSum := fmt.Sprintf(\"%x\", collision.Sum)\n\tcollisionSet, existed := cf.hashCollisions[stringSum]\n\tif !existed {\n\t\tcollisionSet = NewFileSet()\n\t\tcf.hashCollisions[stringSum] = collisionSet\n\t}\n\n\tcollisionSet.Add(collision.FirstFile, collision.SecondFile)\n}", "title": "" }, { "docid": "1ca837353deaf2d92f284ded27c84b8a", "score": "0.4564475", "text": "func usingFilesOrMissing(fileSHA256Pairs []FileSHA256Pair, missingFiles []string, executeIfChanged func() error) error {\n\tmissingDetected := false\n\tfor _, f := range missingFiles {\n\t\tcheckMissingFileInfo, err := os.Stat(f)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tmissingDetected = true\n\t\t\t\tbreak // One file missing is enough to force regeneration\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"file opening error: %s due to: %w\", checkMissingFileInfo, err)\n\t\t\t}\n\t\t} else if checkMissingFileInfo.IsDir() {\n\t\t\treturn fmt.Errorf(\"checkMissingFileName is a folder: %s due to: %w\", f, err)\n\t\t}\n\t}\n\n\tchangeDetected := false\n\n\tfor i, filePair := range fileSHA256Pairs {\n\t\tfileName := filePair.FileName\n\t\tsha256file := filePair.Sha256file\n\t\tfileInfo, err := os.Stat(fileName)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn fmt.Errorf(\"file not found: %s due to: %w\", fileName, err)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"file opening error: %s due to: %w\", fileName, err)\n\t\t\t}\n\t\t} else if fileInfo.IsDir() {\n\t\t\treturn fmt.Errorf(\"file is a folder: %s due to: %w\", fileName, err)\n\t\t}\n\t\tnewSha256, err := GetFileSHA256(fileName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"sha256 not found: %w\", err)\n\t\t}\n\t\tfileSHA256Pairs[i].newSha256 = newSha256\n\t\tcurrentSha256 := \"\"\n\t\tif !missingDetected { // No need to read old sha256 if we have to overwrite it anyway\n\t\t\tsha256FileInfo, err := os.Stat(sha256file)\n\t\t\tif err == nil && sha256FileInfo.IsDir() {\n\t\t\t\treturn fmt.Errorf(\"sha256 is a folder: %w\", err)\n\t\t\t}\n\t\t\tif !os.IsNotExist(err) && !sha256FileInfo.IsDir() {\n\t\t\t\tcurrentSha256, err = ReadFileAsString(sha256file)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error reading existing sha256 file: %w\", err)\n\t\t\t\t}\n\t\t\t\tfileSHA256Pairs[i].currentSha256 = currentSha256\n\t\t\t}\n\t\t}\n\t\tif currentSha256 == \"\" || currentSha256 != newSha256 {\n\t\t\tchangeDetected = true\n\t\t}\n\t}\n\tif missingDetected || changeDetected {\n\t\tif err := executeIfChanged(); err == nil { // We only want to update the key if execution happened without error\n\t\t\tfor _, f := range fileSHA256Pairs {\n\t\t\t\terr = SaveSHA256(f.newSha256, f.Sha256file)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error saving sha256 file: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d79bb9a455a6068e0d5c139b0879ebd", "score": "0.45643225", "text": "func checkSidecarReleaseFile(bizID, appID, releaseID uint32, ciMeta []*sfs.ConfigItemMetaV1) error {\n\n\tworkspace := os.Getenv(constant.EnvSuitTestSidecarWorkspace)\n\tif len(workspace) == 0 {\n\t\treturn errors.New(\"sidecar workspace not set\")\n\t}\n\n\tfor _, one := range ciMeta {\n\t\tciPath := filepath.Clean(fmt.Sprintf(\"%s/bk-bscp/fileReleaseV1/%d/%d/%d/configItems/%s/%s\", workspace, bizID,\n\t\t\tappID, releaseID, one.ConfigItemSpec.Path, one.ConfigItemSpec.Name))\n\n\t\tsha256, err := tools.FileSHA256(ciPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s file sha256 failed, err: %v\", ciPath, err)\n\t\t}\n\n\t\tif sha256 != one.ContentSpec.Signature {\n\t\t\treturn fmt.Errorf(\"biz: %d app: %d release: %d ci: %v file sha256 not right, expect %s, but %s\", bizID,\n\t\t\t\tappID, releaseID, one.ConfigItemSpec, one.ContentSpec.Signature, sha256)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bab5d38f13a1595416851238d07b8dc6", "score": "0.4563285", "text": "func compareConfResult(testWorkRootDir string, tempCNINetDir string, result string, expected string, t *testing.T) {\n\ttempResult := tempCNINetDir + \"/\" + result\n\tresultFile, err := os.ReadFile(tempResult)\n\tif err != nil {\n\t\ttestutil.AnnotatedFatalf(t, \"failed to read file\",\n\t\t\t\"failed to read file %v: %v\", tempResult, err)\n\t}\n\n\texpectedFile, err := os.ReadFile(expected)\n\tif err != nil {\n\t\ttestutil.AnnotatedFatalf(t, fmt.Sprintf(\"failed to read file %v\", expected),\n\t\t\t\"failed to read file %v, err: %v\", expected, err)\n\t}\n\n\tif bytes.Equal(resultFile, expectedFile) {\n\t\tt.Logf(\"PASS: result matches expected: %v v. %v\", tempResult, expected)\n\t} else {\n\t\ttempFail := mktemp(testWorkRootDir, result+\".fail.XXXX\", t)\n\t\tcp(tempResult, tempFail+\"/\"+result, t)\n\t\ttestutil.AnnotatedErrorf(t, \"FAIL: result doesn't match expected\",\n\t\t\t\"FAIL: result doesn't match expected: %v v. %v\\nCheck %v for diff contents\", tempResult, expected, tempFail)\n\t}\n}", "title": "" }, { "docid": "907f8e43bd0977fea51e8cf9e9649af5", "score": "0.45594957", "text": "func TestCrMergedRenameIntoNewDir(t *testing.T) {\n\ttest(t,\n\t\tusers(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\tmkfile(\"a/b\", \"hello\"),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\trename(\"a/b\", \"d/e\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\twrite(\"a/c\", \"world\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{\"c\": \"FILE\"}),\n\t\t\tlsdir(\"d/\", m{\"e\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tread(\"d/e\", \"hello\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{\"c\": \"FILE\"}),\n\t\t\tlsdir(\"d/\", m{\"e\": \"FILE\"}),\n\t\t\tread(\"a/c\", \"world\"),\n\t\t\tread(\"d/e\", \"hello\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "e41e28a802d680028da7f696b76dbd0a", "score": "0.45586604", "text": "func TestD2(t *testing.T) {\n\tfirst := d2()\n\tif first != \"45973\" {\n\t\tt.Fatalf(\"First Puzzle wrong with %v\\n\", first)\n\t}\n\tsecond := d2Part2()\n\tif second != \"27CA4\" {\n\t\tt.Fatalf(\"Second wrong with %v\\n\", second)\n\t}\n}", "title": "" }, { "docid": "05cb96d6a78ff8c644dfd3d300e3f5f3", "score": "0.45540148", "text": "func TestCrUnmergedMoveAndDeleteMultiblockFile(t *testing.T) {\n\ttest(t,\n\t\tblockSize(20), users(\"alice\", \"bob\"),\n\t\tas(alice,\n\t\t\twrite(\"a/b/c/d\", ntimesString(15, \"0123456789\")),\n\t\t),\n\t\tas(bob,\n\t\t\tdisableUpdates(),\n\t\t),\n\t\tas(alice,\n\t\t\twrite(\"foo\", \"bar\"),\n\t\t),\n\t\tas(bob, noSync(),\n\t\t\trename(\"a/b/c/d\", \"a/b/c/e\"),\n\t\t\trm(\"a/b/c/e\"),\n\t\t\trmdir(\"a/b/c\"),\n\t\t\trmdir(\"a/b\"),\n\t\t\treenableUpdates(),\n\t\t\tlsdir(\"a/\", m{}),\n\t\t\tread(\"foo\", \"bar\"),\n\t\t),\n\t\tas(alice,\n\t\t\tlsdir(\"a/\", m{}),\n\t\t\tread(\"foo\", \"bar\"),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "3502c40dc44bad7d0ce0791af3f9e0a8", "score": "0.45529252", "text": "func TestFailedSyncProgress66Full(t *testing.T) { testFailedSyncProgress(t, ent.ETH66, FullSync) }", "title": "" }, { "docid": "4d61c7dc64690352ad3d47d2e46fd30f", "score": "0.45415172", "text": "func TestInstall2(t *testing.T) {\n\tt.Run(MakeTestName(baselineInstallE2ETest5, \"installs are idempotent\"), func(t *testing.T) {\n\n\t\t//Setup\n\t\tDeleteTestFolder(t, \"test-cache\")\n\t\tSetupEndToEndWithInstall(t, \"pkgr.yml\", \"test-library\")\n\t\tassert.DirExists(t, \"test-library/fansi\", \"expected fansi to be installed, but couldn't find folder in test-library\")\n\t\tDeleteTestFolder(t, \"test-library/fansi\") // giving pkgr the need to install this package again\n\n\t\t// Execute\n\t\tinstallCmd := command.New(\"pkgr\", \"install\", \"--config=pkgr.yml\", \"--logjson\")\n\n\t\tcapture, err := installCmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error occurred running pkgr install: %s\", err)\n\t\t}\n\t\tinstallPlanLogs := CollectGenericLogs(t, capture, \"package installation plan\")\n\n\t\trScriptCommand := command.New(\"Rscript\", \"--quiet\", \"install_test.R\")\n\t\trScriptCommand.Dir = \"Rscripts\"\n\t\trScriptCapture, err := rScriptCommand.CombinedOutput()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error occurred while using R to check installed packages: %s\", err)\n\t\t}\n\n\t\t// Validate\n\t\tassert.Len(t, installPlanLogs, 1)\n\t\tassert.Equal(t, 1, installPlanLogs[0].ToInstall)\n\t\tassert.Equal(t, 0, installPlanLogs[0].ToUpdate)\n\n\t\tg := goldie.New(t)\n\t\tg.Assert(t, idempotenceInstall, rScriptCapture)\n\t})\n\n\tt.Run(MakeTestName(baselineInstallE2ETest6, \"installs do not overwrite packages not installed by pkgr\"), func(t *testing.T) {\n\t\t//Setup\n\t\tDeleteTestFolder(t, \"test-cache\")\n\t\tDeleteTestFolder(t, \"test-library\")\n\t\terr := os.MkdirAll(\"./test-library\", 0777)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error while creating empty test-library directory: %s\", err)\n\t\t}\n\n\t\t// Execute\n\t\trInstallCmd := command.New(\"Rscript\", \"-e\", \"install.packages(c('ellipsis', 'digest'), lib='test-library', repos=c('https://mpn.metworx.com/snapshots/stable/2021-06-20'))\")\n\t\trInstallCapture, err := rInstallCmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error while installing packages through non-pkgr means: %s\\nOutput:\\n%s\", err, string(rInstallCapture))\n\t\t}\n\n\t\tinstallCmd := command.New(\"pkgr\", \"install\", \"--config=pkgr.yml\", \"--logjson\")\n\t\tpkgrCapture, err := installCmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error occurred running pkgr install: %s\", err)\n\t\t}\n\n\t\t// Validate\n\t\tnotInstalledByPkgLogs := CollectGenericLogs(t, pkgrCapture, \"Packages not installed by pkgr\")\n\t\tassert.Len(t, notInstalledByPkgLogs, 1, \"expected only one message containing all packages not installed by pkgr\")\n\t\tassert.Len(t, notInstalledByPkgLogs[0].Packages, 3, \"expected exactly three entries in the 'not installed by pkgr' log entry\")\n\t\tassert.Contains(t, notInstalledByPkgLogs[0].Packages, \"ellipsis\", \"ellipsis should have been listed under 'not installed by pkgr'\")\n\t\tassert.Contains(t, notInstalledByPkgLogs[0].Packages, \"rlang\", \"rlang should have been listed under 'not installed by pkgr'\")\n\t\tassert.Contains(t, notInstalledByPkgLogs[0].Packages, \"digest\", \"digest should have been listed under 'not installed by pkgr'\") // Extraneous, shouldn't matter to pkgr.yml\n\n\t\tinstallPlanLogs := CollectGenericLogs(t, pkgrCapture, \"package installation plan\")\n\t\tassert.Len(t, installPlanLogs, 1, \"expected exactly one message containing 'package installation plan' metadata\")\n\t\tassert.Equal(t, 9, installPlanLogs[0].ToInstall, \"since two packages were already installed from pkgr's plan, we expect only 9 packages to be installed\")\n\t\tassert.Equal(t, 0, installPlanLogs[0].ToUpdate)\n\n\t\tinstallationStatusLogs := CollectGenericLogs(t, pkgrCapture, \"package installation status\")\n\t\tassert.Len(t, installationStatusLogs, 1, \"expected exactly one message containing `package installation status` metadata\")\n\t\tassert.Equal(t, 3, installationStatusLogs[0].Installed)\n\t\tassert.Equal(t, 3, installationStatusLogs[0].NotFromPkgr)\n\t\tassert.Equal(t, 0, installationStatusLogs[0].Outdated)\n\t\tassert.Equal(t, 11, installationStatusLogs[0].TotalPackagesRequired)\n\n\t\tverifyInstalledCommand := command.New(\"Rscript\", \"--quiet\", \"install_test.R\")\n\t\tverifyInstalledCommand.Dir = \"Rscripts\"\n\t\trScriptCapture, err := verifyInstalledCommand.CombinedOutput()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error occurred while using R to check installed packages: %s\", err)\n\t\t}\n\n\t\tg := goldie.New(t)\n\t\tg.Assert(t, preinstalledInstall, rScriptCapture)\n\t})\n\n}", "title": "" }, { "docid": "92ecb02e377a8d92f47736290b6181b7", "score": "0.45349768", "text": "func main2() {\n\n\tdep3 = make(map[string]modVersion)\n\tdep4 = make(map[string]modVersion)\n\n\tdomains = make(map[string]bool)\n\tmissing = make(map[string]bool)\n\n\t// get all dependencies from this projects go.mod file\n\trs3, rp3 := getRequiresFromMod(projectname)\n\tfor _, r := range rs3 {\n\t\taddModule(&dep3, r, &rp3)\n\t}\n\n\t//\tfor _, r := range rp3 {\n\t//\t\tfmt.Printf(\"old: %s, new: %s, oldp: %s, newp: %s, oldv: %s\\n\", r.Old, r.New, r.Old.Path, r.New.Path, r.Old.Version)\n\t//\t}\n\n\t//\tos.Exit(0)\n\n\t// check all 4th, 5th ... party dependencies (3rd party's 3rd party)\n\tanyMissing := true\n\tdepends := &dep3\n\n\tfor anyMissing {\n\t\tanyMissing = false\n\t\tfor m, ver := range *depends {\n\t\t\tfor v := range ver {\n\t\t\t\t//fmt.Printf(\"%s %s %d\\n\", m, v, len(*depends))\n\n\t\t\t\tpath, err := module.EscapePath(m)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Issues with escape path of \", m)\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t} else {\n\t\t\t\t\t//if path != m {\n\t\t\t\t\t//\tfmt.Println(m, \" => \", path)\n\t\t\t\t\t//}\n\n\t\t\t\t}\n\n\t\t\t\tfp := filepath.Join(modulesHome, path+\"@\"+v)\n\n\t\t\t\trs4, rpl4 := getRequiresFromMod(fp)\n\t\t\t\tif rs4 == nil {\n\t\t\t\t\tmissing[m+\" \"+v] = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsetHasGoMod(depends, m, v)\n\n\t\t\t\tfor _, r4 := range rs4 {\n\t\t\t\t\tif !moduleExists(&dep4, r4, &rpl4) {\n\t\t\t\t\t\tfmt.Printf(\"Adding %s %s\\n\", r4.Mod.Path, r4.Mod.Version)\n\t\t\t\t\t\taddModule(&dep4, r4, &rpl4)\n\t\t\t\t\t\tanyMissing = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//fmt.Println(\"len \", len(*depends))\n\t\t\t//fmt.Println()\n\t\t}\n\t\tdepends = &dep4\n\t}\n\n\t// print modules\n\n\tms := make([]string, 0, len(dep4))\n\tfor m := range dep4 {\n\t\tms = append(ms, m)\n\t}\n\tsort.Strings(ms)\n\n\tcount := 0\n\tcountMissing := 0\n\n\tfor _, m := range ms {\n\t\t//fmt.Println(m)\n\t\tver := dep4[m]\n\t\tfor v, cnt := range ver {\n\t\t\tfmt.Println(m, v, cnt)\n\t\t\tcount++\n\t\t\tif !cnt.hasGoMod {\n\t\t\t\tcountMissing++\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"---\")\n\tfmt.Println(\"#modules: \", count)\n\tfmt.Println(\"#missing: \", countMissing)\n\tfmt.Println()\n\n\t// print modules with missing go.mod\n\n\tcount = 0\n\tmiss := make([]string, 0, len(missing))\n\tfmt.Println(\"Missing go.mod\")\n\tfor mis := range missing {\n\t\tmiss = append(miss, mis)\n\t}\n\tsort.Strings(miss)\n\tfor _, mis := range miss {\n\t\tfmt.Println(mis)\n\t\tcount++\n\t}\n\tfmt.Println(\"---\")\n\tfmt.Println(\"#modules: \", count)\n}", "title": "" }, { "docid": "fb254ea7c634c30457d61b0659197ce7", "score": "0.4532241", "text": "func TestDigestAndVerify(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\ttarInit func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry)\n\t\tchecks []check\n\t}{\n\t\t{\n\t\t\tname: \"no-regfile\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTarStatic(t, tarOf(\n\t\t\t\t\tdir(\"test2/\"), // modified\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"small-files\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"bbb\", dgstMap),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTarStatic(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"\"),\n\t\t\t\t\tfile(\"foo.txt\", \"M\"), // modified\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"bbb\"),\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\tcheckVerifyInvalidTOCEntryFail(\"foo.txt\"),\n\t\t\t\tcheckVerifyBrokenContentFail(\"foo.txt\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"big-files\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"bazbazbazbazbazbazbaz\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"testbartestbar\", dgstMap),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTarStatic(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"bazbazbazMMMbazbazbaz\"), // modified\n\t\t\t\t\tfile(\"foo.txt\", \"a\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"testbartestbar\"),\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\tcheckVerifyInvalidTOCEntryFail(\"test/bar.txt\"),\n\t\t\t\tcheckVerifyBrokenContentFail(\"test/bar.txt\"),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"with-non-regfiles\",\n\t\t\ttarInit: func(t *testing.T, dgstMap map[string]digest.Digest) (blob []tarEntry) {\n\t\t\t\treturn tarOf(\n\t\t\t\t\tregDigest(t, \"baz.txt\", \"bazbazbazbazbazbazbaz\", dgstMap),\n\t\t\t\t\tregDigest(t, \"foo.txt\", \"a\", dgstMap),\n\t\t\t\t\tsymlink(\"barlink\", \"test/bar.txt\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tregDigest(t, \"test/bar.txt\", \"testbartestbar\", dgstMap),\n\t\t\t\t\tdir(\"test2/\"),\n\t\t\t\t\tlink(\"test2/bazlink\", \"baz.txt\"),\n\t\t\t\t)\n\t\t\t},\n\t\t\tchecks: []check{\n\t\t\t\tcheckStargzTOC,\n\t\t\t\tcheckVerifyTOC,\n\t\t\t\tcheckVerifyInvalidStargzFail(buildTarStatic(t, tarOf(\n\t\t\t\t\tfile(\"baz.txt\", \"bazbazbazbazbazbazbaz\"),\n\t\t\t\t\tfile(\"foo.txt\", \"a\"),\n\t\t\t\t\tsymlink(\"barlink\", \"test/bar.txt\"),\n\t\t\t\t\tdir(\"test/\"),\n\t\t\t\t\tfile(\"test/bar.txt\", \"testbartestbar\"),\n\t\t\t\t\tdir(\"test2/\"),\n\t\t\t\t\tlink(\"test2/bazlink\", \"foo.txt\"), // modified\n\t\t\t\t), allowedPrefix[0])),\n\t\t\t\tcheckVerifyInvalidTOCEntryFail(\"test/bar.txt\"),\n\t\t\t\tcheckVerifyBrokenContentFail(\"test/bar.txt\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tfor _, cl := range compressionLevels {\n\t\t\tcl := cl\n\t\t\tfor _, srcCompression := range srcCompressions {\n\t\t\t\tsrcCompression := srcCompression\n\t\t\t\tfor _, prefix := range allowedPrefix {\n\t\t\t\t\tprefix := prefix\n\t\t\t\t\tt.Run(tt.name+\"-\"+fmt.Sprintf(\"compression=%v-prefix=%q\", cl, prefix), func(t *testing.T) {\n\t\t\t\t\t\t// Get original tar file and chunk digests\n\t\t\t\t\t\tdgstMap := make(map[string]digest.Digest)\n\t\t\t\t\t\ttarBlob := buildTarStatic(t, tt.tarInit(t, dgstMap), prefix)\n\n\t\t\t\t\t\trc, err := Build(compressBlob(t, tarBlob, srcCompression), WithChunkSize(chunkSize), WithCompressionLevel(cl))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"failed to convert stargz: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttocDigest := rc.TOCDigest()\n\t\t\t\t\t\tdefer rc.Close()\n\t\t\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\t\t\tif _, err := io.Copy(buf, rc); err != nil {\n\t\t\t\t\t\t\tt.Fatalf(\"failed to copy built stargz blob: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewStargz := buf.Bytes()\n\t\t\t\t\t\t// NoPrefetchLandmark is added during `Bulid`, which is expected behaviour.\n\t\t\t\t\t\tdgstMap[chunkID(NoPrefetchLandmark, 0, int64(len([]byte{landmarkContents})))] = digest.FromBytes([]byte{landmarkContents})\n\n\t\t\t\t\t\tfor _, check := range tt.checks {\n\t\t\t\t\t\t\tcheck(t, newStargz, tocDigest, dgstMap, cl)\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
443fd77a7123b25dd42787f23d9e184a
Get returns the job associated with identity and id.
[ { "docid": "b208011debf0f414002306d9e506584c", "score": "0.76501226", "text": "func (r *jobRepository) Get(did identity.DID, id jobs.JobID) (*jobs.Job, error) {\n\tkey, err := getKey(did, id)\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(jobs.ErrKeyConstructionFailed, err)\n\t}\n\n\tm, err := r.repo.Get(key)\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(jobs.ErrJobsMissing, err)\n\t}\n\n\treturn m.(*jobs.Job), nil\n}", "title": "" } ]
[ { "docid": "2306d9c4dcd98d20083e052ada45c0d8", "score": "0.7844388", "text": "func (d DB) Get(id string) (*job.Job, error) {\n\tresult := job.Job{}\n\terr := d.collection.Find(bson.M{\"id\": id}).One(&result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "ba6ffece7600a7ebb0315325b280f390", "score": "0.78424656", "text": "func (o *JobBookkeeper) Get(id string) *Job {\n\to.Lock()\n\tdefer o.Unlock()\n\tif j, ok := o.jobs[id]; ok {\n\t\treturn j\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cbb30e144f73ea07662f6baf1e3af9f8", "score": "0.749833", "text": "func GetJobWithID(w http.ResponseWriter, r *http.Request){\n\tdefer r.Body.Close()\n\n\tparams := mux.Vars(r)\n\tfmt.Println(params[\"id\"])\n\tjob, err := dao.FindById(params[\"id\"])\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid Job ID\")\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusOK, job)\n}", "title": "" }, { "docid": "6ca6ee67729d3de293f91801c33ad820", "score": "0.7468314", "text": "func (d DB) Get(id string) (*job.Job, error) {\n\ttemplate := `select to_jsonb(j.job) from (select * from %[1]s where id = $1) as j;`\n\tquery := fmt.Sprintf(template, JobTable)\n\tvar r sql.NullString\n\terr := d.conn.QueryRow(query, id).Scan(&r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := &job.Job{}\n\tif r.Valid {\n\t\terr = json.Unmarshal([]byte(r.String), &result)\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "1e4114fc7eb9e6f8f0f15e04fd3082f3", "score": "0.740459", "text": "func (r *JobRepository) GetJob(id int64) dbmodel.Job {\n\tif job, ok := r.jobs[id]; ok {\n\t\treturn job\n\t}\n\n\treturn dbmodel.Job{}\n}", "title": "" }, { "docid": "9d9bcae4965e206362bc9f571112741b", "score": "0.7314561", "text": "func (jb *Job) Get(ID int64) (*model.Job, error) {\n\tr, ok := jb.jobs[ID]\n\tif ok {\n\t\terr := r.Decrypt(jb.cipher)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn r, nil\n\t}\n\treturn nil, interfaces.ErrJobNotFound\n}", "title": "" }, { "docid": "a25ceb9cb543a114b93f005f77b3f415", "score": "0.72067624", "text": "func (store *Postgres) Get(jobID int64) (Job, error) {\n\trow := store.DB.QueryRow(getJobStatement, jobID)\n\n\tvar job Job\n\tvar startedValue sql.NullTime // nullable columns\n\tvar sagemakerIDValue, endpointValue, regionValue sql.NullString // nullable columns\n\terr := row.Scan(&job.ID, &job.Status, &job.Submitter, &job.CommitID, &sagemakerIDValue, &job.Type, &regionValue, &endpointValue, &job.Created, &job.Updated, &startedValue)\n\tif err != nil {\n\t\treturn Job{}, err\n\t}\n\n\tif startedValue.Valid {\n\t\tjob.Started = startedValue.Time\n\t}\n\n\tif regionValue.Valid {\n\t\tjob.Region = regionValue.String\n\t}\n\n\tif endpointValue.Valid {\n\t\tjob.Endpoint = endpointValue.String\n\t}\n\n\tif sagemakerIDValue.Valid {\n\t\tjob.SageMakerID = sagemakerIDValue.String\n\t}\n\n\treturn job, nil\n}", "title": "" }, { "docid": "d2bd959a44b13dd79e92cbef12735902", "score": "0.71978754", "text": "func (db *Database) GetJob(id uint) (*models.Job, error) {\n\tvar job models.Job\n\n\tquery := db.gormDB.Where(\n\t\t&models.Job{\n\t\t\tID: id,\n\t\t},\n\t)\n\n\terr := query.First(&job).Error\n\n\tif gorm.IsRecordNotFoundError(err) {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &job, nil\n}", "title": "" }, { "docid": "559b2e800f4b4cd0c714e1f773ba82f8", "score": "0.7194017", "text": "func (s *JobsService) Get(\n\tctx context.Context,\n\tjobID int64,\n) (*JobGetResponse, error) {\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\ts.client.url+\"2.0/jobs/get\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tq := req.URL.Query()\n\tq.Add(\"job_id\", fmt.Sprintf(\"%d\", jobID))\n\treq.URL.RawQuery = q.Encode()\n\tres, err := s.client.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.StatusCode >= 300 || res.StatusCode <= 199 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"Failed to returns 2XX response: %d\", res.StatusCode)\n\t}\n\tdefer res.Body.Close()\n\tdecoder := json.NewDecoder(res.Body)\n\n\tvar jobGetRes JobGetResponse\n\terr = decoder.Decode(&jobGetRes)\n\n\treturn &jobGetRes, err\n}", "title": "" }, { "docid": "12adc78a236980c4b7d596f76de16f06", "score": "0.7140384", "text": "func (s *state) GetJob(id ids.ID) (Job, error) {\n\tif s.cachingEnabled {\n\t\tif job, exists := s.jobsCache.Get(id); exists {\n\t\t\treturn job.(Job), nil\n\t\t}\n\t}\n\tjobBytes, err := s.jobs.Get(id[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tjob, err := s.parser.Parse(jobBytes)\n\tif err == nil && s.cachingEnabled {\n\t\ts.jobsCache.Put(id, job)\n\t}\n\treturn job, err\n}", "title": "" }, { "docid": "78a048c30ab02a6dc0849ecd775e8661", "score": "0.7096628", "text": "func (context Context) GetJobByID(id string) (result *types.Job, err error) {\n\n\tresp, err := context.sendAPIGetRequest(path.Join(\"jobs\", id), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttype getJobByIDResponse struct {\n\t\tData types.Job `json:\"data\"`\n\t}\n\trespObject := getJobByIDResponse{}\n\terr = json.NewDecoder(resp.Body).Decode(&respObject)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"JSON decode error\")\n\t}\n\n\treturn &respObject.Data, nil\n}", "title": "" }, { "docid": "c50acb203127d7cea6085bd2254e9aa5", "score": "0.7073299", "text": "func (r CassandraJobberRepository) GetJob(ID string) (*models.Job, error) {\n\tvar completedAt time.Time\n\tjob := models.Job{}\n\tvar newJob *models.Job\n\titer := r.session.Query(selectJobByIDQuery, ID).Iter()\n\tfor iter.Scan(&job.ID, &job.CreatedAt, &job.UpdatedAt, &completedAt, &job.Status, &job.Tags, &job.Type, &job.Owner) {\n\t\tcompletedAtValue := completedAt\n\t\tnewJob = &models.Job{\n\t\t\tID: job.ID,\n\t\t\tCreatedAt: job.CreatedAt,\n\t\t\tUpdatedAt: job.UpdatedAt,\n\t\t\tCompletedAt: &completedAtValue,\n\t\t\tStatus: job.Status,\n\t\t\tType: job.Type,\n\t\t\tTags: job.Tags,\n\t\t\tOwner: job.Owner,\n\t\t}\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn newJob, nil\n}", "title": "" }, { "docid": "cefed83e7825e0823c7a74650502aa7f", "score": "0.7051251", "text": "func doGetJob(id uint64) *job {\n\tjp := jobs.find(id)\n\tif jp == nil {\n\t\treturn nil\n\t}\n\treturn copyJob(jp)\n}", "title": "" }, { "docid": "125ea2baa29d82faaa82f76f9919602c", "score": "0.70078975", "text": "func (c *jobCache) GetJob(id string) (*Job, error) {\n\tc.mtx.RLock()\n\tdefer c.mtx.RUnlock()\n\n\tif j, ok := c.jobs[id]; ok {\n\t\treturn j.Copy(), nil\n\t}\n\treturn nil, ErrNotFound\n}", "title": "" }, { "docid": "3b5258efd754d81717acbabfa5f42995", "score": "0.6983622", "text": "func Get(client *golangsdk.ServiceClient, id string) (*JobDDSInstance, error) {\n\t// GET /v3/{project_id}/jobs\n\traw, err := client.Get(client.ServiceURL(\"jobs?id=\"+id), nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar res JobDDSInstance\n\terr = extract.IntoStructPtr(raw.Body, &res, \"job\")\n\treturn &res, err\n}", "title": "" }, { "docid": "5e335d2c7207eeb560e3360377f177f6", "score": "0.6900829", "text": "func (repo *JobRegistrationRepository) Get(id string) (*data.JobRegistration, error) {\n\n\tvar result data.JobRegistration\n\tvar docid primitive.ObjectID\n\tvar err error\n\n\tif docid, err = primitive.ObjectIDFromHex(id); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilter := bson.M{\"_id\": docid}\n\tctx, cancel := context.WithTimeout(context.Background(), repo.defaultTimeout)\n\tdefer cancel()\n\n\tif err := repo.jobRegistrationCollection.FindOne(ctx, filter).Decode(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "533d4a7e4f63d0358c0621b6a8efe1d9", "score": "0.68843234", "text": "func getJob(id uint64) *job {\n\tc := make(chan *job)\n\tjobReqChan <- jobRequest{id, c}\n\treturn <-c\n}", "title": "" }, { "docid": "e99adb29d6d4aed375b992215f70fe3c", "score": "0.68542504", "text": "func (r *Resolver) Job(ctx context.Context, args struct{ ID graphql.ID }) (*JobPayloadResolver, error) {\n\tif err := authenticateUser(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tid, err := stringutils.ToInt32(string(args.ID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tj, err := r.App.JobORM().FindJobTx(id)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn NewJobPayload(r.App, nil, err), nil\n\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn NewJobPayload(r.App, &j, nil), nil\n}", "title": "" }, { "docid": "a22d7eeed75be16c1a836dd19190c12e", "score": "0.6842997", "text": "func GetJob(w http.ResponseWriter, r *http.Request) {\n\thr := HTTPResponse{w}\n\tvars := mux.Vars(r)\n\tjobQueue := GetJobQueue(r)\n\tjob, err := jobQueue.Job(vars[\"jobID\"])\n\tif err != nil {\n\t\thr.JSONError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\thr.JSON(http.StatusOK, job)\n}", "title": "" }, { "docid": "f0168b7ddc7d4228e07a8a919fdb6daf", "score": "0.6823351", "text": "func (d *firestoreDB) GetJobById(ctx context.Context, id string) (*types.Job, error) {\n\tdoc, err := d.client.Get(ctx, d.jobs().Doc(id), DEFAULT_ATTEMPTS, GET_SINGLE_TIMEOUT)\n\tif st, ok := status.FromError(err); ok && st.Code() == codes.NotFound {\n\t\treturn nil, nil\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tvar rv types.Job\n\tif err := doc.DataTo(&rv); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "851ad5accf423806e870df8e627a7c6e", "score": "0.6754891", "text": "func (a *JobAPI) JobByID(ctx context.Context, id int) (Job, error) {\n\tvar returnValue Job\n\n\t// create path and map variables\n\tapiPath := fmt.Sprintf(\"%s/api/job/%d\", a.client.cfg.BasePath, id)\n\n\theaders := make(map[string]string)\n\theaders[\"Content-Type\"] = \"application/json\"\n\theaders[\"Accept\"] = \"application/json\"\n\n\tr, err := a.client.buildRequest(apiPath, \"GET\", nil, headers, url.Values{})\n\tif err != nil {\n\t\treturn returnValue, err\n\t}\n\n\tresponse, err := a.client.Call(ctx, r)\n\tif err != nil || response == nil {\n\t\treturn returnValue, err\n\t}\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tresponse.Body.Close()\n\tif err != nil {\n\t\treturn returnValue, err\n\t}\n\n\tif response.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&returnValue, body, response.Header.Get(\"Content-Type\"))\n\t\treturn returnValue, err\n\t}\n\n\tif response.StatusCode >= 300 {\n\t\tnewErr := Error{\n\t\t\tBody: body,\n\t\t\tErr: response.Status,\n\t\t}\n\n\t\tif response.StatusCode == 200 {\n\t\t\tvar v Job\n\t\t\terr = a.client.decode(&v, body, response.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.Err = err.Error()\n\t\t\t\treturn returnValue, newErr\n\t\t\t}\n\t\t\tnewErr.Model = v\n\t\t\treturn returnValue, newErr\n\t\t}\n\n\t\treturn returnValue, newErr\n\t}\n\n\treturn returnValue, nil\n}", "title": "" }, { "docid": "00a3e20fda80ec42fd5721fcc97be5b0", "score": "0.671064", "text": "func (d *localDB) GetJobById(id string) (*db.Job, error) {\n\tvar rv *db.Job\n\tif err := d.view(\"GetJobById\", func(tx *bolt.Tx) error {\n\t\tvalue := jobsBucket(tx).Get([]byte(id))\n\t\tif value == nil {\n\t\t\treturn nil\n\t\t}\n\t\t_, serialized, err := unpackJob(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar job db.Job\n\t\tif err := gob.NewDecoder(bytes.NewReader(serialized)).Decode(&job); err != nil {\n\t\t\treturn err\n\t\t}\n\t\trv = &job\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\tif rv == nil {\n\t\t// Return an error if id is invalid.\n\t\tif _, _, err := ParseId(id); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn rv, nil\n}", "title": "" }, { "docid": "7977cf74b98d68704cb08684264ce891", "score": "0.67072535", "text": "func (jp *JobPoolManager) GetJob(id string) (*Job, bool) {\n\tjp.RLock()\n\tdefer jp.RUnlock()\n\tj, ok := jp.Pool[id]\n\treturn j, ok\n}", "title": "" }, { "docid": "4d27f6c086f334976ab284d25ceea124", "score": "0.6696595", "text": "func GetJob(c *APIRequest, token string, ID string) (*GetResponse, error) {\n\tdebug(\"Getting job state\")\n\treq, err := http.NewRequest(\n\t\t\"GET\",\n\t\tfmt.Sprintf(\"%s/v1/api/job/%s\", *c.URL, ID),\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"X-Auth-Token\", token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t},\n\t}\n\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdebug(\"Response status: %s\", resp.Status)\n\tdebug(\"Response headers: %s\", resp.Header)\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdebug(\"Response body:\\n%s\", string(body))\n\n\tgetResp := GetResponse{}\n\terr = json.Unmarshal(body, &getResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &getResp, nil\n}", "title": "" }, { "docid": "cf7013320ba6374a2277ca1539d951ef", "score": "0.6652404", "text": "func (jobLog *JobLog) getJob(jobID string) (*Job, error) {\n\tindex, ok := jobLog.Index[jobID]\n\tif !ok {\n\t\treturn nil, ErrNotFound\n\t}\n\treturn jobLog.Jobs[index], nil\n}", "title": "" }, { "docid": "f736222973eeb798002d48c4bbc22bb7", "score": "0.66273737", "text": "func (m *JobManager) Read(id string, opts ...RequestOption) (j *Job, err error) {\n\terr = m.Request(\"GET\", m.URI(\"jobs\", id), &j)\n\treturn\n}", "title": "" }, { "docid": "d6c29dfee7c6896fbe8c100bcb76aae0", "score": "0.6610267", "text": "func GetJob(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *JobState, opts ...pulumi.ResourceOption) (*Job, error) {\n\tvar resource Job\n\terr := ctx.ReadResource(\"aws-native:glue:Job\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5bee94211cb7c506176468d5f6006b33", "score": "0.6593455", "text": "func getJob(ctx context.Context, js *jobs.Service, name string) (*jobs.Job, error) {\n\tfmt.Printf(\"Attempting to get a Job with name %s...\\n\", name)\n\n\tgetCtx, cancel := context.WithTimeout(ctx, requestDeadline)\n\tdefer cancel()\n\n\tj, err := js.Jobs.Get(name).Context(getCtx).Do()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfmt.Printf(\"Job retrieved:\\n %v\\n\", prettyFormat(j))\n\treturn j, nil\n}", "title": "" }, { "docid": "153f126633af6546b1e4c25e5671b6a3", "score": "0.6575178", "text": "func (repo *InMemoryJobRepository) Find(ctx context.Context, id JobID) (*Job, error) {\n\treq, ok := repo.jobs.Load(id)\n\tif !ok {\n\t\treturn nil, ErrJobNotFound\n\t}\n\n\treturn req.(*Job), nil\n}", "title": "" }, { "docid": "997778f87b945449ea6875b042039eae", "score": "0.65394175", "text": "func (c *quarksJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.QuarksJob, err error) {\n\tresult = &v1alpha1.QuarksJob{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"quarksjobs\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "496bfb13d9b45c26f20990fba6d287a5", "score": "0.6528714", "text": "func (c *APIClient) GetJob(jobID uint) (*models.Job, error) {\n\tvar job models.Job\n\n\tresponse, err := c.getJSON(\n\t\tfmt.Sprintf(\"/api/jobs/%d\", jobID),\n\t\t&job,\n\t)\n\n\tif response != nil && response.StatusCode == http.StatusNotFound {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &job, nil\n}", "title": "" }, { "docid": "6e934430deebdb3cc2d36e8b26f2c581", "score": "0.6517953", "text": "func (a JobsAPI) Get(req httpmodels.GetReq) (httpmodels.GetResp, error) {\n\tvar resp httpmodels.GetResp\n\n\tjsonResp, err := a.Client.performQuery(http.MethodGet, \"/jobs/get\", req, nil)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\terr = json.Unmarshal(jsonResp, &resp)\n\treturn resp, err\n}", "title": "" }, { "docid": "b47ea221ba7c10ffe91f6a5e8d8bc5c5", "score": "0.6515865", "text": "func (s *Service) GetJobDetail(id string) (*batch.JobDetail, error) {\n\tbatchSession := batch.New(s.session)\n\tinp := &batch.DescribeJobsInput{\n\t\tJobs: aws.StringSlice([]string{id}),\n\t}\n\tresp, err := batchSession.DescribeJobs(inp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(resp.Jobs) == 0 {\n\t\treturn nil, ErrNotFound\n\t}\n\treturn resp.Jobs[0], nil\n}", "title": "" }, { "docid": "4237a2239d732d143366ae41584b53c5", "score": "0.651369", "text": "func (client ResourceManagerClient) getJob(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/jobs/{jobId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetJobResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "98d5eb5b58d8656dd7a6638ba73a794d", "score": "0.65098375", "text": "func (m *Map) Get(id int64) *Package {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\tval := m.jobs[id]\n\n\treturn val\n}", "title": "" }, { "docid": "bf902a78598861a94990a7ef65a7d521", "score": "0.6471903", "text": "func (store *InMemoryJobStore) GetRecord(id string) (JobInfo, error) {\n\tstore.mu.RLock()\n\tdefer store.mu.RUnlock()\n\tif jobInfo, ok := store.jobs[id]; ok {\n\t\treturn *jobInfo, nil\n\t}\n\treturn JobInfo{}, &ErrNotFound{}\n}", "title": "" }, { "docid": "92ddd2d3573bab6f54266271b7885c7d", "score": "0.645163", "text": "func GetJob(db *sql.DB, params martini.Params, r render.Render) {\n\tjobName := params[\"jobName\"]\n\tspace := params[\"space\"]\n\tvar job structs.JobReq\n\n\tstmt, err := db.Prepare(\"select name,space,cmd,plan from jobs where name=$1 and space=$2\")\n\tif err != nil {\n\t\tutils.ReportError(err, r)\n\t\treturn\n\t}\n\n\tdefer stmt.Close()\n\trows, err := stmt.Query(jobName, space)\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&job.Name, &job.Space, &job.CMD, &job.Plan)\n\t\tif err != nil {\n\t\t\tutils.ReportError(err, r)\n\t\t\treturn\n\t\t}\n\t}\n\tr.JSON(200, job)\n}", "title": "" }, { "docid": "c2b5e8f6f230118387f37933eeeb6152", "score": "0.6437905", "text": "func (repo *JobRepository) Find(ctx context.Context, id provision.JobID) (*provision.Job, error) {\n\tvar job provision.Job\n\terr := repo.db.Model(ctx, &job).\n\t\tPreload(\"ProviderSettings\").\n\t\tPreload(\"Server\").\n\t\tPreload(\"Deployment\").\n\t\tWhere(\"id = ?\", id).\n\t\tFirst(&job).\n\t\tError\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"find job by ID\")\n\t}\n\n\treturn &job, nil\n}", "title": "" }, { "docid": "d6028fd88f83a91ad14aa77d0bf27fe0", "score": "0.6430449", "text": "func GetJob(ctx context.Context) (*tasks.Task, error) {\n\tj, ok := ctx.Value(jobKey).(*tasks.Task)\n\tif !ok {\n\t\treturn nil, errors.New(\"the context dose not have a job\")\n\t}\n\n\treturn j, nil\n}", "title": "" }, { "docid": "ab26a7928583c94d498d461ef41b9c9b", "score": "0.6403502", "text": "func (m *Manager) Lookup(ctx context.Context, id string) (*Job, error) {\n\treturn m.st.Lookup(ctx, id)\n}", "title": "" }, { "docid": "b60d9c3fd6bcc3dd2bce9498ec38a964", "score": "0.63902795", "text": "func (client JobExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result JobExecution, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/JobExecutionsClient.Get\")\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.GetPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.JobExecutionsClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"sql.JobExecutionsClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.JobExecutionsClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3d450410529fa541c880ccdff060d9ec", "score": "0.63756543", "text": "func GetJob(j *repository.JobRepository) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\trequestID := getNewRequestID()\n\t\tlog.Printf(\"RequestID:%6d: GetJob - starting\\n\", requestID)\n\n\t\tvars := mux.Vars(r)\n\t\tjobID, err := strconv.ParseInt(vars[\"job_id\"], 10, 64)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"RequestID:%6d: GetJob - Invalid job_id: %v\", requestID, err)\n\t\t\thttp.Error(w, \"Invalid job_id\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tjob := j.GetJob(jobID)\n\t\tif job.JobID <= 0 {\n\t\t\tlog.Printf(\"RequestID:%6d: GetJob(%d) - Not found\", requestID, jobID)\n\t\t\thttp.Error(w, \"Not Found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tif err := json.NewEncoder(w).Encode(job); err != nil {\n\t\t\tlog.Printf(\"RequestID:%6d: GetJob(%d) - Error writing the response: %v\", requestID, jobID, err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"RequestID:%6d: GetJob(%d) - completed\\n\", requestID, jobID)\n\t}\n}", "title": "" }, { "docid": "a3930185cf6c4a55c5b5fe9b3db0a947", "score": "0.63523245", "text": "func (s *HeadmastService) getJob(ctx *macaron.Context) {\n\tjobID := ctx.Query(\"jobid\")\n\tjob, err := s.jobManager.GetJob(jobID)\n\tif err != nil {\n\t\tlogrus.WithError(err)\n\t\tctx.JSON(500, nil)\n\t\treturn\n\t}\n\tctx.JSON(200, job)\n}", "title": "" }, { "docid": "35a89f6e7e1291d79fa42d817a6138cf", "score": "0.6349179", "text": "func (a *DefaultApiService) GetJob(ctx _context.Context, jobId string) (Job, *_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 Job\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/jobs/{job_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"job_id\"+\"}\", _neturl.QueryEscape(parameterToString(jobId, \"\")) , -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\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\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\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": "f3fa9ec4cb9834aa57e4a142049f2c8f", "score": "0.6284477", "text": "func (aj *ArrayJob) GetId() string {\n return aj.id\n}", "title": "" }, { "docid": "b6653b9ebf0a1cc6255d28256c33e073", "score": "0.6271002", "text": "func (jobLog *JobLog) GetJob(jobID string) (*Job, error) {\n\tjobLog.ModifyMutex.RLock()\n\tdefer jobLog.ModifyMutex.RUnlock()\n\n\treturn jobLog.getJob(jobID)\n}", "title": "" }, { "docid": "c027f53bae2de1177ef82bb05660af94", "score": "0.6270987", "text": "func (r *mongoDB) RetrieveJob(jobID string) (types.Job, error) {\n\tc := r.db.C(\"jobs\")\n\tresult := types.Job{}\n\terr := c.Find(bson.M{\"id\": jobID}).One(&result)\n\treturn result, err\n}", "title": "" }, { "docid": "f2a240cde62910716c1ad78652c30cf0", "score": "0.6242897", "text": "func (r *ProjectsJobsService) Get(projectId string, jobId string) *ProjectsJobsGetCall {\n\tc := &ProjectsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.jobId = jobId\n\treturn c\n}", "title": "" }, { "docid": "83a53186938d3b165fbed03995f35bf4", "score": "0.62133235", "text": "func (db *BoltDB) GetJob(account, key string) (*api.Job, error) {\n\tvar storedJob api.Job\n\n\terr := db.store.View(func(tx *bolt.Tx) error {\n\t\taccountBucket := tx.Bucket([]byte(account))\n\t\tif accountBucket == nil {\n\t\t\treturn tkerrors.ErrEntityNotFound\n\t\t}\n\t\ttargetBucket := accountBucket.Bucket([]byte(jobsBucket))\n\n\t\tjobRaw := targetBucket.Get([]byte(key))\n\t\tif jobRaw == nil {\n\t\t\treturn tkerrors.ErrEntityNotFound\n\t\t}\n\n\t\terr := go_proto.Unmarshal(jobRaw, &storedJob)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &storedJob, nil\n}", "title": "" }, { "docid": "5a6fd2ed833edb08ba3e51ee747ee1e0", "score": "0.61482507", "text": "func (r *DaskJobReconciler) getJob(namespace string, name string, daskjob *analyticsv1.DaskJob) (*batchv1.Job, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"looking for job\", name)\n\tjobKey := client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\tjob := batchv1.Job{}\n\tif err := r.Get(ctx, jobKey, &job); err != nil {\n\t\tInfof(log, \"job.Get Error: %+v\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\t// if job.Status.ReadyReplicas == job.Status.Replicas {\n\t// \tdaskjob.Status.Succeeded++\n\t// }\n\treturn &job, nil\n}", "title": "" }, { "docid": "c610bb3300b6c355b306aed63bbda9f5", "score": "0.6136813", "text": "func getImageJobById(context *gin.Context) {\n\telem, ok := jobs[context.Param(\"id\")]\n\tif !ok {\n\t\tcontext.JSON(http.StatusBadRequest, gin.H{\"status\": http.StatusBadRequest, \"message\": \"Bad input value for parameter id, no image job for id.\"})\n\t\treturn\n\t}\n\tvar imageJobErrorText string\n\tif imageJobError != nil {\n\t\timageJobErrorText = imageJobError.Error()\n\t}\n\n\tinputFileOut, outputFileOut := elem.getCachedOutput()\n\tcontext.JSON(http.StatusOK, ImageJobPresentation{\n\t\tCommandOfOutput: outputFileOut,\n\t\tCommandIfOutput: inputFileOut,\n\t\tRunning: elem.Running,\n\t\tId: elem.Id,\n\t\tError: imageJobErrorText,\n\t\tHashes: elem.Hashes,\n\t\tHashResult: elem.HashResult})\n}", "title": "" }, { "docid": "bd19e24e15730290ab2e6a7ea17fab18", "score": "0.6093776", "text": "func (c *Chainlink) ReadJob(id string) (*Response, *http.Response, error) {\n\tspecObj := &Response{}\n\tlog.Info().Str(NodeURL, c.Config.URL).Str(\"ID\", id).Msg(\"Reading Job\")\n\tresp, err := c.APIClient.R().\n\t\tSetResult(&specObj).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"id\": id,\n\t\t}).\n\t\tGet(\"/v2/jobs/{id}\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn specObj, resp.RawResponse, err\n}", "title": "" }, { "docid": "38039291f2879b878158355c5581d1c0", "score": "0.6060946", "text": "func getJobInfo(slurmUsername string, slurmToken string, id string) *JobInfo {\n\turl := HPCURL + \"/job/\" + id\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tklog.Error(\"Error creating Job Info request; err \", err)\n\t\treturn nil\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"X-SLURM-USER-NAME\", slurmUsername)\n\treq.Header.Set(\"X-SLURM-USER-TOKEN\", slurmToken)\n\n\trespBody, statusCode := podutils.SendReq(req)\n\tif statusCode != 200 {\n\t\tklog.Error(\"Retrieving job info not successful, status code \", statusCode)\n\t\treturn nil\n\t}\n\n\tjob := JobInfo{}\n\terr = json.Unmarshal(respBody, &job)\n\tJobMap = job.Job[0]\n\treturn &job\n}", "title": "" }, { "docid": "b265a4125f7d651f187a4d21e892b06e", "score": "0.60538644", "text": "func (j *Jenkins) GetJobObj(ctx context.Context, name string) *Job {\n\treturn &Job{Jenkins: j, Raw: new(JobResponse), Base: \"/job/\" + name}\n}", "title": "" }, { "docid": "69abc516daa785c36d5b1fa9cd1aad7b", "score": "0.6042647", "text": "func (pool *Pool) Show(id string) (*Job, error) {\n\tsess := pool.redis.Get()\n\tdefer sess.Close()\n\n\treply, err := sess.Do(\"SHOW\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treplyArr, ok := reply.([]interface{})\n\tif !ok || len(replyArr) != 30 {\n\t\treturn nil, errors.New(\"unexpected reply #1\")\n\t}\n\t//\tarr, ok := replyArr[0].([]interface{})\n\t//\tif !ok || len(arr) != 7 {\n\t//\t\treturn nil, errors.New(\"unexpected reply #2\")\n\t//\t}\n\n\tjob := Job{}\n\n\tif bytes, ok := replyArr[3].([]byte); ok {\n\t\tjob.Queue = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: queue\")\n\t}\n\n\tif bytes, ok := replyArr[1].([]byte); ok {\n\t\tjob.ID = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: id\")\n\t}\n\n\tif bytes, ok := replyArr[29].([]byte); ok {\n\t\tjob.Data = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: data\")\n\t}\n\n\tif job.Nacks, ok = replyArr[17].(int64); !ok {\n\t\treturn nil, errors.New(\"unexpected reply: nacks\")\n\t}\n\n\tif job.AdditionalDeliveries, ok = replyArr[19].(int64); !ok {\n\t\treturn nil, errors.New(\"unexpected reply: additional-deliveries\")\n\t}\n\treturn &job, nil\n}", "title": "" }, { "docid": "d8a5b6e4bc42bc6f18222e72e2fa6bb4", "score": "0.59913945", "text": "func (m *manager) GetWithJC(requestId string) (proto.Request, error) {\n\treq, err := m.Get(requestId)\n\tif err != nil {\n\t\treturn req, err\n\t}\n\n\tctx := context.TODO()\n\n\tvar jobChainBytes []byte\n\tq := \"SELECT job_chain FROM request_archives WHERE request_id = ?\"\n\tnotFound := false\n\terr = retry.Do(DB_TRIES, DB_RETRY_WAIT, func() error {\n\t\terr := m.dbConnector.QueryRowContext(ctx, q, requestId).Scan(&jobChainBytes)\n\t\tif err != nil {\n\t\t\tswitch err {\n\t\t\tcase sql.ErrNoRows:\n\t\t\t\tnotFound = true\n\t\t\t\treturn nil // don't try again\n\t\t\tdefault:\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}, nil)\n\tif err != nil {\n\t\treturn req, serr.NewDbError(err, \"SELECT request_archives\")\n\t}\n\tif notFound {\n\t\treturn req, serr.RequestNotFound{requestId}\n\t}\n\n\tvar jobChain proto.JobChain\n\tif err := json.Unmarshal(jobChainBytes, &jobChain); err != nil {\n\t\treturn req, fmt.Errorf(\"cannot unmarshal job chain: %s\", err)\n\t}\n\treq.JobChain = &jobChain\n\n\treturn req, nil\n}", "title": "" }, { "docid": "702b6b9c8e85400fd5fbd78a6a2d7ea0", "score": "0.5985623", "text": "func (ms ManagementServer) getJob(r *web.Ctx) web.Result {\n\tjob, result := ms.getRequestJob(r, web.JSON)\n\tif result != nil {\n\t\treturn result\n\t}\n\treturn r.Views.View(\"job\", job)\n}", "title": "" }, { "docid": "5dae8b32d731c31d08571a436e6788e5", "score": "0.5981902", "text": "func (c *FakePintaJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *pintav1.PintaJob, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(pintajobsResource, c.ns, name), &pintav1.PintaJob{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*pintav1.PintaJob), err\n}", "title": "" }, { "docid": "500636748317d5dc60f9056e8c8e6044", "score": "0.59803283", "text": "func (d *Databaser) GetJobByInvocationID(invocationID string) (*JobRecord, error) {\n\tquery := `\n\tSELECT cast(id as varchar),\n\t batch_id,\n\t\t\t\t submitter,\n\t\t\t\t date_submitted,\n\t\t\t\t date_started,\n\t\t\t\t date_completed,\n\t\t\t\t app_id,\n\t\t\t\t exit_code,\n\t\t\t\t failure_threshold,\n\t\t\t\t failure_count,\n\t\t\t\t condor_id,\n\t\t\t\t invocation_id\n\t FROM jobs\n\t WHERE invocation_id = cast($1 as uuid)\n\t`\n\tjr := &JobRecord{}\n\trows := d.db.QueryRow(query, invocationID)\n\tvar batchid interface{}\n\tvar appid interface{}\n\tvar invid interface{}\n\terr := rows.Scan(\n\t\t&jr.ID,\n\t\t&batchid,\n\t\t&jr.Submitter,\n\t\t&jr.DateSubmitted,\n\t\t&jr.DateStarted,\n\t\t&jr.DateCompleted,\n\t\t&appid,\n\t\t&jr.ExitCode,\n\t\t&jr.FailureThreshold,\n\t\t&jr.FailureCount,\n\t\t&jr.CondorID,\n\t\t&invid,\n\t)\n\t// rows.Scan returns ErrNoRows if no rows were found.\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\t// This evil has been perpetrated to avoid an issue where time.Time instances\n\t// set to their zero value and stored in PostgreSQL with timezone info can\n\t// come back as Time instances from __before__ the epoch. We need to re-zero\n\t// the dates on the fly when that happens.\n\tepoch := time.Unix(0, 0)\n\tif jr.DateSubmitted.Before(epoch) {\n\t\tjr.DateSubmitted = epoch\n\t}\n\tif jr.DateStarted.Before(epoch) {\n\t\tjr.DateStarted = epoch\n\t}\n\tif jr.DateCompleted.Before(epoch) {\n\t\tjr.DateCompleted = epoch\n\t}\n\tFixBatchID(jr, batchid)\n\tFixAppID(jr, appid)\n\tFixInvID(jr, invid)\n\treturn jr, err\n}", "title": "" }, { "docid": "60323a71b4d85d107ca9081da0e3edf7", "score": "0.59743494", "text": "func (t *TranscodeRepository) FindByJobId(id string) (*TranscodingJob, error) {\n\tsession := t.session.Clone()\n\tdefer session.Close()\n\tvar job TranscodingJob\n\terr := session.DB(config.DbName).C(config.TranscodingJobCollection).Find(bson.M{\"job_id\": id}).One(&job)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &job, err\n}", "title": "" }, { "docid": "92ab44c8b492c0eff68397764a39633d", "score": "0.59721345", "text": "func (r *ProjectsLocationsJobsService) Get(projectId string, location string, jobId string) *ProjectsLocationsJobsGetCall {\n\tc := &ProjectsLocationsJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.location = location\n\tc.jobId = jobId\n\treturn c\n}", "title": "" }, { "docid": "22770410fc2255b70e4382869df82c40", "score": "0.59645784", "text": "func (schematics *SchematicsV1) GetJob(getJobOptions *GetJobOptions) (result *Job, response *core.DetailedResponse, err error) {\n\treturn schematics.GetJobWithContext(context.Background(), getJobOptions)\n}", "title": "" }, { "docid": "b1b27dad37f783b244feb3a1ba86a525", "score": "0.5959866", "text": "func Get(jobs Store, sm *sagemaker.Client) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tjobID, err := strconv.ParseInt(httputil.Param(r, \"jobID\"), 10, 64)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tjob, err := jobs.Get(jobID)\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\tif err := appendSageMakerInfoIfNeeded(&job, sm); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif err := appendEndpointInfoIfNeeded(&job, sm); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tbody, err := json.Marshal(job)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(body)\n\t})\n}", "title": "" }, { "docid": "3b6a261f71c07e4adc00f0e0b56983b2", "score": "0.5943945", "text": "func (d *Databaser) GetJob(uuid string) (*JobRecord, error) {\n\tquery := `\n\tSELECT cast(id as varchar),\n\t\t\t\t batch_id,\n\t\t\t\t submitter,\n\t\t\t\t date_submitted,\n\t\t\t\t date_started,\n\t\t\t\t date_completed,\n\t\t\t\t app_id,\n\t\t\t\t exit_code,\n\t\t\t\t failure_threshold,\n\t\t\t\t failure_count,\n\t\t\t\t condor_id,\n\t\t\t\t invocation_id\n\t FROM jobs\n\t WHERE id = cast($1 as uuid)\n\t`\n\tjr := &JobRecord{}\n\trows := d.db.QueryRow(query, uuid)\n\tvar batchid interface{}\n\tvar appid interface{}\n\tvar invid interface{}\n\terr := rows.Scan(\n\t\t&jr.ID,\n\t\t&batchid,\n\t\t&jr.Submitter,\n\t\t&jr.DateSubmitted,\n\t\t&jr.DateStarted,\n\t\t&jr.DateCompleted,\n\t\t&appid,\n\t\t&jr.ExitCode,\n\t\t&jr.FailureThreshold,\n\t\t&jr.FailureCount,\n\t\t&jr.CondorID,\n\t\t&invid,\n\t)\n\t// This evil has been perpetrated to avoid an issue where time.Time instances\n\t// set to their zero value and stored in PostgreSQL with timezone info can\n\t// come back as Time instances from __before__ the epoch. We need to re-zero\n\t// the dates on the fly when that happens.\n\tepoch := time.Unix(0, 0)\n\tif jr.DateSubmitted.Before(epoch) {\n\t\tjr.DateSubmitted = epoch\n\t}\n\tif jr.DateStarted.Before(epoch) {\n\t\tjr.DateStarted = epoch\n\t}\n\tif jr.DateCompleted.Before(epoch) {\n\t\tjr.DateCompleted = epoch\n\t}\n\tFixBatchID(jr, batchid)\n\tFixAppID(jr, appid)\n\tFixInvID(jr, invid)\n\treturn jr, err\n}", "title": "" }, { "docid": "d8ba1b5497fbb8466a7ce4f676d2b2ec", "score": "0.5924941", "text": "func getJob(w io.Writer, jobName string) (*talent.Job, error) {\n\tctx := context.Background()\n\n\tclient, err := google.DefaultClient(ctx, talent.CloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"google.DefaultClient: %w\", err)\n\t}\n\t// Create the jobs service client.\n\tservice, err := talent.New(client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"talent.New: %w\", err)\n\t}\n\n\tjob, err := service.Projects.Jobs.Get(jobName).Do()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get job %s: %w\", jobName, err)\n\t}\n\n\tfmt.Fprintf(w, \"Job: %q\", job.Name)\n\n\treturn job, err\n}", "title": "" }, { "docid": "569ef678bf52de430ffdfcde5dd74abf", "score": "0.5919274", "text": "func GetJob(t testing.TestingT, options *KubectlOptions, jobName string) *batchv1.Job {\n\tjob, err := GetJobE(t, options, jobName)\n\trequire.NoError(t, err)\n\treturn job\n}", "title": "" }, { "docid": "78e31969bafa7dc0c6735d63f2ee52c3", "score": "0.59187216", "text": "func (client ResourceManagerClient) GetJob(ctx context.Context, request GetJobRequest) (response GetJobResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.getJob, 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 = GetJobResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetJobResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetJobResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetJobResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "988ca4a86fc241baabdfd5162d1cfdff", "score": "0.5898471", "text": "func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/actions/jobs/%v\", owner, repo, jobID)\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tjob := new(WorkflowJob)\n\tresp, err := s.client.Do(ctx, req, job)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn job, resp, nil\n}", "title": "" }, { "docid": "93a68e9ebb21b4f06749f2113cc30b35", "score": "0.58867717", "text": "func (client *Client) GetJob(name string) (*batchv1.Job, error) {\n\targs := client.Called(name)\n\tjob, _ := args.Get(0).(*batchv1.Job)\n\n\treturn job, args.Error(1)\n}", "title": "" }, { "docid": "77266a0a0a02e96a53f0fd068fa5d8cf", "score": "0.58814055", "text": "func (js *JobSession) GetJobArray(id string) (*ArrayJob, error) {\n cid := C.CString(id)\n defer C.free(unsafe.Pointer(cid))\n\n if jarray := C.drmaa2_jsession_get_job_array(js.js, cid); jarray != nil {\n defer C.drmaa2_jarray_free(&jarray)\n ja := convertJarray(jarray)\n return &ja, nil\n }\n return nil, makeLastError()\n}", "title": "" }, { "docid": "fb7b6bb6c477dcc1f15d815650f146a5", "score": "0.58673847", "text": "func (s *MongoJobsStorage) GetJob() (Job, error) {\n\tselect {\n\tcase job := <-s.jobs:\n\t\treturn job, nil\n\tcase <-time.After(3 * time.Second):\n\t\treturn Job{}, &NoJobsError{\"No jobs\"}\n\t}\n}", "title": "" }, { "docid": "643334c19f2b363ab7db24b97c9613da", "score": "0.5843919", "text": "func (mw *managedWorkloads) GetByID(id uint32) *workload {\n\tvar foundWorkload *workload\n\tfor wl := range mw.Iter() {\n\t\tif wl.job.ID == id {\n\t\t\tcopyWL := wl\n\t\t\tfoundWorkload = &copyWL\n\t\t}\n\t}\n\n\treturn foundWorkload\n}", "title": "" }, { "docid": "9baddb4b6e6f32ae0ca05db86811c97a", "score": "0.58316463", "text": "func (pool *Pool) Get(queues ...interface{}) (*Job, error) {\n\tif len(queues) == 0 {\n\t\treturn nil, errors.New(\"expected at least one queue\")\n\t}\n\n\targs := []interface{}{\"GETJOB\"}\n\tswitch v := queues[0].(type) {\n\tcase bool:\n\t\tif v {\n\t\t\targs = append(args, \"NOHANG\")\n\t\t}\n\t}\n\ttmp := []interface{}{\n\t\t\"TIMEOUT\",\n\t\tint(pool.conf.Timeout.Nanoseconds() / 1000000),\n\t\t\"WITHCOUNTERS\",\n\t\t\"FROM\",\n\t}\n\tfor _, arg := range tmp {\n\t\targs = append(args, arg)\n\t}\n\tfor _, arg := range queues[1:] {\n\t\targs = append(args, arg.(string))\n\t}\n\n\treply, err := pool.do(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treplyArr, ok := reply.([]interface{})\n\tif !ok || len(replyArr) != 1 {\n\t\treturn nil, errors.New(\"unexpected reply #1\")\n\t}\n\tarr, ok := replyArr[0].([]interface{})\n\tif !ok || len(arr) != 7 {\n\t\treturn nil, errors.New(\"unexpected reply #2\")\n\t}\n\n\tjob := Job{}\n\n\tif bytes, ok := arr[0].([]byte); ok {\n\t\tjob.Queue = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: queue\")\n\t}\n\n\tif bytes, ok := arr[1].([]byte); ok {\n\t\tjob.ID = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: id\")\n\t}\n\n\tif bytes, ok := arr[2].([]byte); ok {\n\t\tjob.Data = string(bytes)\n\t} else {\n\t\treturn nil, errors.New(\"unexpected reply: data\")\n\t}\n\n\tif job.Nacks, ok = arr[4].(int64); !ok {\n\t\treturn nil, errors.New(\"unexpected reply: nacks\")\n\t}\n\n\tif job.AdditionalDeliveries, ok = arr[6].(int64); !ok {\n\t\treturn nil, errors.New(\"unexpected reply: additional-deliveries\")\n\t}\n\n\treturn &job, nil\n}", "title": "" }, { "docid": "da026f079e75d03fa09aa4280c9c2835", "score": "0.5804026", "text": "func (d *Databaser) GetJobByCondorID(condorID string) (*JobRecord, error) {\n\tquery := `\n\tSELECT cast(id as varchar),\n\t\t\t\tbatch_id,\n\t\t\t\tsubmitter,\n\t\t\t\tdate_submitted,\n\t\t\t\tdate_started,\n\t\t\t\tdate_completed,\n\t\t\t\tapp_id,\n\t\t\t\texit_code,\n\t\t\t\tfailure_threshold,\n\t\t\t\tfailure_count,\n\t\t\t\tcondor_id,\n\t\t\t\tinvocation_id\n \t FROM jobs\n\tWHERE condor_id = $1\n\t`\n\tjr := &JobRecord{}\n\trows := d.db.QueryRow(query, condorID)\n\tvar batchid interface{}\n\tvar appid interface{}\n\tvar invid interface{}\n\terr := rows.Scan(\n\t\t&jr.ID,\n\t\t&batchid,\n\t\t&jr.Submitter,\n\t\t&jr.DateSubmitted,\n\t\t&jr.DateStarted,\n\t\t&jr.DateCompleted,\n\t\t&appid,\n\t\t&jr.ExitCode,\n\t\t&jr.FailureThreshold,\n\t\t&jr.FailureCount,\n\t\t&jr.CondorID,\n\t\t&invid,\n\t)\n\t// This evil has been perpetrated to avoid an issue where time.Time instances\n\t// set to their zero value and stored in PostgreSQL with timezone info can\n\t// come back as Time instances from __before__ the epoch. We need to re-zero\n\t// the dates on the fly when that happens.\n\tepoch := time.Unix(0, 0)\n\tif jr.DateSubmitted.Before(epoch) {\n\t\tjr.DateSubmitted = epoch\n\t}\n\tif jr.DateStarted.Before(epoch) {\n\t\tjr.DateStarted = epoch\n\t}\n\tif jr.DateCompleted.Before(epoch) {\n\t\tjr.DateCompleted = epoch\n\t}\n\tFixBatchID(jr, batchid)\n\tFixAppID(jr, appid)\n\tFixInvID(jr, invid)\n\treturn jr, err\n}", "title": "" }, { "docid": "7c292ad3085be615dde4941765f01a2b", "score": "0.5800689", "text": "func (a *JobAPI) JobByName(ctx context.Context, name string) (Job, error) {\n\tvar returnValue Job\n\n\t// create path and map variables\n\tapiPath := fmt.Sprintf(\"%s/api/job/%s\", a.client.cfg.BasePath, name)\n\n\theaders := make(map[string]string)\n\theaders[\"Content-Type\"] = \"application/json\"\n\theaders[\"Accept\"] = \"application/json\"\n\n\tr, err := a.client.buildRequest(apiPath, \"GET\", nil, headers, url.Values{})\n\tif err != nil {\n\t\treturn returnValue, err\n\t}\n\n\tresponse, err := a.client.Call(ctx, r)\n\tif err != nil || response == nil {\n\t\treturn returnValue, err\n\t}\n\n\tbody, err := ioutil.ReadAll(response.Body)\n\tresponse.Body.Close()\n\tif err != nil {\n\t\treturn returnValue, err\n\t}\n\n\tif response.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&returnValue, body, response.Header.Get(\"Content-Type\"))\n\t\treturn returnValue, err\n\t}\n\n\tif response.StatusCode >= 300 {\n\t\tnewErr := Error{\n\t\t\tBody: body,\n\t\t\tErr: response.Status,\n\t\t}\n\n\t\tif response.StatusCode == 200 {\n\t\t\tvar v Job\n\t\t\terr = a.client.decode(&v, body, response.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.Err = err.Error()\n\t\t\t\treturn returnValue, newErr\n\t\t\t}\n\t\t\tnewErr.Model = v\n\t\t\treturn returnValue, newErr\n\t\t}\n\n\t\treturn returnValue, newErr\n\t}\n\n\treturn returnValue, nil\n}", "title": "" }, { "docid": "c859795bb57a73b7f03f838a4e8e4e00", "score": "0.57928634", "text": "func (q *fsJobQueue) readJob(id uuid.UUID) (*job, error) {\n\tvar j job\n\texists, err := q.db.Read(id.String(), &j)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading job '%s': %v\", id, err)\n\t}\n\tif !exists {\n\t\t// return corrupt database?\n\t\treturn nil, jobqueue.ErrNotExist\n\t}\n\treturn &j, nil\n}", "title": "" }, { "docid": "8326bd1a8964e7f541dc998f6499d1ce", "score": "0.577865", "text": "func (c *Client) GetJob() (*transfer.Job, bool) {\n\tc.jobListMutex.Lock()\n\tdefer func() {\n\t\tc.jobListMutex.Unlock()\n\t}()\n\n\tjob := c.jobList.Front()\n\tif job == nil {\n\t\treturn nil, true\n\t}\n\tc.jobList.Remove(job)\n\n\treturn job.Value.(*transfer.Job), false\n}", "title": "" }, { "docid": "3ff819e4c2ae3fb425021796b35a2219", "score": "0.57508636", "text": "func (eh EnvironmentHandler) GetJob(ctx context.Context, appName, envName, jobComponentName, jobName string) (*deploymentModels.ScheduledJobSummary, error) {\n\tif jobSummary, err := eh.getJob(ctx, appName, envName, jobComponentName, jobName); err == nil {\n\t\treturn jobSummary, nil\n\t}\n\n\t// TODO: Return error from getJob when legacy handler is removed\n\t// TODO: Remove when there are no legacy jobs left\n\n\t// Backward compatibility: Get job not handled by RadixBatch\n\tjh := legacyJobHandler{accounts: eh.accounts}\n\treturn jh.GetJob(ctx, appName, envName, jobComponentName, jobName)\n}", "title": "" }, { "docid": "a21d731397245afe16e10640e5afa4db", "score": "0.5749341", "text": "func (job *QorJob) GetJob() *Job {\n\tif job.Job != nil {\n\t\treturn job.Job\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ac896d155260d59aef614eacced50fa", "score": "0.57389754", "text": "func (a *Application) GetJobHandler(c echo.Context) error {\n\tl := a.Logger.With(\n\t\tzap.String(\"source\", \"jobHandler\"),\n\t\tzap.String(\"operation\", \"getJob\"),\n\t\tzap.String(\"appId\", c.Param(\"aid\")),\n\t\tzap.String(\"jobId\", c.Param(\"jid\")),\n\t)\n\taid, err := uuid.FromString(c.Param(\"aid\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusUnprocessableEntity, &Error{Reason: err.Error()})\n\t}\n\tjid, err := uuid.FromString(c.Param(\"jid\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusUnprocessableEntity, &Error{Reason: err.Error()})\n\t}\n\tjob := &model.Job{\n\t\tID: jid,\n\t\tAppID: aid,\n\t}\n\terr = WithSegment(\"db-select\", c, func() error {\n\t\treturn a.DB.Model(&job).Column(\"job.*\", \"App\").Where(\"job.id = ?\", job.ID).Select()\n\t})\n\ta.DB.Model(&job.StatusEvents).Where(\"job_id = ?\", job.ID).Column(\"status.*\", \"Events\").Select()\n\tif err != nil {\n\t\tif err.Error() == RecordNotFoundString {\n\t\t\treturn c.JSON(http.StatusNotFound, job)\n\t\t}\n\t\tlog.E(l, \"Failed to retrieve job.\", func(cm log.CM) {\n\t\t\tcm.Write(zap.Error(err))\n\t\t})\n\t\treturn c.JSON(http.StatusInternalServerError, &Error{Reason: err.Error(), Value: job})\n\t}\n\tlog.D(l, \"Retrieved job successfully.\", func(cm log.CM) {\n\t\tcm.Write(zap.Object(\"job\", job))\n\t})\n\treturn c.JSON(http.StatusOK, job)\n}", "title": "" }, { "docid": "b3307ca48f3a8d5f02e3fd50b73e28fa", "score": "0.57361937", "text": "func (to *Session) GetJobs(deliveryServiceID *int, userID *int) ([]tc.Job, ReqInf, error) {\n\tpath := apiBase + \"/jobs\"\n\tif deliveryServiceID != nil || userID != nil {\n\t\tpath += \"?\"\n\t\tif deliveryServiceID != nil {\n\t\t\tpath += \"dsId=\" + strconv.Itoa(*deliveryServiceID)\n\t\t\tif userID != nil {\n\t\t\t\tpath += \"&\"\n\t\t\t}\n\t\t}\n\t\tif userID != nil {\n\t\t\tpath += \"userId=\" + strconv.Itoa(*userID)\n\t\t}\n\t}\n\n\tresp, remoteAddr, err := to.request(http.MethodGet, path, nil)\n\treqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}\n\tif err != nil {\n\t\treturn nil, reqInf, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdata := struct {\n\t\tResponse []tc.Job `json:\"response\"`\n\t}{}\n\terr = json.NewDecoder(resp.Body).Decode(&data)\n\treturn data.Response, reqInf, err\n}", "title": "" }, { "docid": "8d3aae37cca24c92d204652f42bb40e4", "score": "0.57338333", "text": "func (job *QorJob) GetJobID() string {\n\treturn fmt.Sprint(job.ID)\n}", "title": "" }, { "docid": "d1dd52ed8aee4dc79d54c65ea3cd2a3d", "score": "0.572784", "text": "func (b *BigQuery) GetJob(jobId string) (*bigquery.Job, error) {\n\n\tclient, err := newBqApiClient(b.email, b.key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbqc, err := newBQClient(client, b.projectId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bqc.getJob(jobId)\n}", "title": "" }, { "docid": "d7fc94836733fdf7eed691d1c849c8ac", "score": "0.57259774", "text": "func (r *RDBMS) GetJobRequest(jobID types.JobID) (*job.Request, error) {\n\n\tr.lockTx()\n\tdefer r.unlockTx()\n\n\tselectStatement := \"select job_id, name, requestor, server_id, request_time, descriptor, teststeps from jobs where job_id = ?\"\n\tlog.Debugf(\"Executing query: %s\", selectStatement)\n\trows, err := r.db.Query(selectStatement, jobID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get job request with id %v: %v\", jobID, err)\n\t}\n\tdefer func() {\n\t\tif err := rows.Close(); err != nil {\n\t\t\tlog.Warningf(\"could not close rows for job request: %v\", err)\n\t\t}\n\t}()\n\n\tvar (\n\t\treq *job.Request\n\t)\n\tfound := false\n\tfor rows.Next() {\n\t\tif req != nil {\n\t\t\t// We have already found a matching request. If we find more than one,\n\t\t\t// then we have a problem\n\t\t\treturn nil, fmt.Errorf(\"multiple requests found with job id %v\", jobID)\n\t\t}\n\t\tfound = true\n\t\tcurrRequest := job.Request{}\n\t\terr := rows.Scan(\n\t\t\t&currRequest.JobID,\n\t\t\t&currRequest.JobName,\n\t\t\t&currRequest.Requestor,\n\t\t\t&currRequest.ServerID,\n\t\t\t&currRequest.RequestTime,\n\t\t\t&currRequest.JobDescriptor,\n\t\t\t&currRequest.TestDescriptors,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not get job request with job id %v: %v\", jobID, err)\n\t\t}\n\t\treq = &currRequest\n\t}\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"no job request found for job ID %d\", jobID)\n\t}\n\t// check that job descriptor is valid JSON\n\tvar jobDesc job.JobDescriptor\n\tif err := json.Unmarshal([]byte(req.JobDescriptor), &jobDesc); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal job descriptor: %w\", err)\n\t}\n\t// check that test step descriptors are valid JSON\n\tvar testStepDescs [][]*test.TestStepDescriptor\n\tif err := json.Unmarshal([]byte(req.TestDescriptors), &testStepDescs); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal test step descriptors: %w\", err)\n\t}\n\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"could not find request with JobID %d\", jobID)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "03af3e9c2d5386cdbc7a0ac4f7326d85", "score": "0.56851363", "text": "func (k *KubeAPI) GetJob(namespace, job string) (*v1batch.Job, error) {\n\treturn k.Client.BatchV1().Jobs(namespace).Get(job, metav1.GetOptions{})\n}", "title": "" }, { "docid": "e04b6e04f2b52555a772def57fc26e35", "score": "0.5654336", "text": "func (l *JobList) Get(i int) *Job {\n\tif l == nil || i < 0 || i >= len(l.items) {\n\t\treturn nil\n\t}\n\treturn l.items[i]\n}", "title": "" }, { "docid": "b19bc661e312a66922b82ca0f7330653", "score": "0.56432235", "text": "func (j *Job) ID() string {\n\treturn telemetryJobID\n}", "title": "" }, { "docid": "2038e61059e18827e8934f1941716d45", "score": "0.5552218", "text": "func (js *JobServiceGorm) Job() (*entity.Employee_job, []error) {\n\tjob, errs := js.jobRepo.Job()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn job, errs\n}", "title": "" }, { "docid": "22ecabeace2ecd91572713119ebe763b", "score": "0.55416054", "text": "func (ms ManagementServer) getAPIJob(r *web.Ctx) web.Result {\n\tjob, result := ms.getRequestJob(r, web.JSON)\n\tif result != nil {\n\t\treturn result\n\t}\n\treturn web.JSON.Result(job)\n}", "title": "" }, { "docid": "9ae9b88b1a87b6006c10272fa13e2700", "score": "0.55179095", "text": "func (j *JobQueue) ticketByJobID(id string) *sync.Mutex {\n\thash := j.hash(id)\n\treturn j.ticketByHash(hash)\n}", "title": "" }, { "docid": "80ae9ec87563c182cdc5c54ed801a2d7", "score": "0.5514263", "text": "func (s SnapshotAPI) GetRestoreJob(mops *OpsManagerAPI, projectID string) (project *Project, err error) {\n\tdr := dac.NewRequest(mops.username, mops.apiKey, \"POST\", mops.url+ONEPROJECT+projectID, \"\")\n\tresp, err := dr.Execute()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer resp.Body.Close()\n\tresBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, errwrap.Wrapf(\"Failed reading HTTP response body: {{err}}\", err)\n\t}\n\tprojResp := &Project{}\n\terr = json.Unmarshal(resBody, projResp)\n\treturn projResp, nil\n}", "title": "" }, { "docid": "3fa5467430fbf782b70b625710aec012", "score": "0.55077446", "text": "func (c *Client) GetJobInfo(jobID string) (JobInfo, error) {\n\tvalues := url.Values{}\n\tvalues.Add(\"fields[]\", \"id\")\n\tvalues.Add(\"fields[]\", \"name\")\n\tvalues.Add(\"fields[]\", \"progress\")\n\tvalues.Add(\"fields[]\", \"status\")\n\tvalues.Add(\"fields[]\", \"start_time\")\n\tvalues.Add(\"fields[]\", \"end_time\")\n\n\tresp, err := c.client.CallAPI(\"GET\", fmt.Sprintf(\"/jobs/%s/info\", jobID), values, nil)\n\tif err != nil {\n\t\treturn JobInfo{}, err\n\t}\n\n\tvar ji JobInfo\n\terr = json.Unmarshal([]byte(resp), &ji)\n\tif err != nil {\n\t\treturn JobInfo{}, err\n\t}\n\n\treturn ji, nil\n}", "title": "" }, { "docid": "4edbd02e8dde4d9ce35d9fddd4a19d8d", "score": "0.54946685", "text": "func (r *repository) GetJobPostByID(ctx context.Context, id uint64) (*models.JobPost, error) {\n\tm := models.JobPost{ID: id}\n\terr := r.DB.WithContext(ctx).Model(&m).\n\t\tWhere(\"jp.id = ?\", id).\n\t\tRelation(relCompany).\n\t\tRelation(relFunction).\n\t\tRelation(relIndustry).\n\t\tRelation(relHiringManager).\n\t\tRelation(relHRContact).\n\t\tReturning(\"*\").\n\t\tFirst()\n\t//pg returns error when no rows in the result set\n\tif err == pg.ErrNoRows {\n\t\treturn nil, nil\n\t}\n\treturn &m, err\n}", "title": "" }, { "docid": "9376c8d58c6baf09f595c5a49ed4382f", "score": "0.5490872", "text": "func (svc *PreheatService) \tGet(id string) *mgr.PreheatTask {\n\tif id == \"\" {\n\t\treturn nil\n\t}\n\treturn svc.repository.Get(id)\n}", "title": "" }, { "docid": "aad7bb622b982e76561cf4b0042b3eaf", "score": "0.5488916", "text": "func getKey(did identity.DID, id jobs.JobID) ([]byte, error) {\n\tif jobs.JobIDEqual(jobs.NilJobID(), id) {\n\t\treturn nil, errors.New(\"job ID is not valid\")\n\t}\n\thexKey := hexutil.Encode(append(did[:], id.Bytes()...))\n\treturn append([]byte(jobPrefix), []byte(hexKey)...), nil\n}", "title": "" }, { "docid": "372fecc10c4d6f066c93beec3e1857a8", "score": "0.5484069", "text": "func (s *searchRepos) getJob(ctx context.Context) func() error {\n\treturn func() error {\n\t\treturn callSearcherOverRepos(ctx, s.args, s.stream, s.repoSet.AsList(), s.repoSet.IsIndexed())\n\t}\n}", "title": "" }, { "docid": "d64aeafeae88b94d3e71cef81d67e592", "score": "0.547786", "text": "func (c *Coordinator) job(ctx context.Context, s entity.TaskSpec) (*Job, error) {\n\tif !s.Type.IsATaskType() {\n\t\treturn nil, errutil.AssertionFailure(\"invalid task type\")\n\t}\n\tswitch s.Type {\n\tcase entity.TaskTypeModule:\n\t\treturn c.modulejob(ctx, s)\n\tdefault:\n\t\treturn nil, errutil.UnhandledCase(s.Type)\n\t}\n}", "title": "" }, { "docid": "8756a3c1a78b9fb2366a40a5a3097ad4", "score": "0.5466874", "text": "func (o *orm) FindJob(ctx context.Context, id int32) (jb Job, err error) {\n\ttx := postgres.TxFromContext(ctx, o.db)\n\terr = PreloadAllJobTypes(tx).\n\t\tPreload(\"JobSpecErrors\").\n\t\tFirst(&jb, \"jobs.id = ?\", id).\n\t\tError\n\tif err != nil {\n\t\treturn jb, err\n\t}\n\n\tif jb.OffchainreportingOracleSpec != nil {\n\t\tvar ch evm.Chain\n\t\tch, err = o.chainSet.Get(jb.OffchainreportingOracleSpec.EVMChainID.ToInt())\n\t\tif err != nil {\n\t\t\treturn jb, err\n\t\t}\n\t\tjb.OffchainreportingOracleSpec = LoadDynamicConfigVars(ch.Config(), *jb.OffchainreportingOracleSpec)\n\t}\n\treturn jb, err\n}", "title": "" }, { "docid": "60a91ff69fd948f1910b1a38d45c53bc", "score": "0.5460187", "text": "func (dao *TaskDAORedis) Get(id string) (*model.Task, error) {\n\ttask, err := dao.get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn task, nil\n}", "title": "" }, { "docid": "ab54c475ea510d8a25d4a9351ea9206b", "score": "0.5459154", "text": "func (j *Job) JobID() string {\n\tj.begin(j.ctx, \"JobID()\")\n\tjob, jobArray, err := j.jobCheck()\n\tif err != nil {\n\t\tj.lastError = err\n\t\treturn \"\"\n\t}\n\tif job != nil {\n\t\treturn job.GetID()\n\t}\n\treturn jobArray.GetID()\n}", "title": "" } ]
32e465b2e20b0e1d02215d341b74232c
render table, returning count of rows rendered gap of zero means fit terminal exactly by truncating table you will want a larger gap to account for prompt or other text. A gap of 1 means the row count is not limited useful for reports or inspecting tasks.
[ { "docid": "828a535602d5dbe93839614f50012960", "score": "0.6230395", "text": "func (t *Table) Render() {\n\toriginalWidths := make([]int, len(t.Header))\n\n\tfor _, row := range t.Rows {\n\t\tfor j, cell := range row {\n\t\t\tif originalWidths[j] < len(cell) {\n\t\t\t\toriginalWidths[j] = len(cell)\n\t\t\t}\n\t\t}\n\t}\n\n\t// initialise with original size and reduce interatively\n\twidths := originalWidths[:]\n\n\t// account for gaps of 2 chrs\n\twidthBudget := t.Width - TABLE_COL_GAP*(len(t.Header)-1)\n\n\tfor SumInts(widths...) > widthBudget {\n\t\t// find max col width index\n\t\tvar max, maxi int\n\n\t\tfor i, w := range widths {\n\t\t\tif w > max {\n\t\t\t\tmax = w\n\t\t\t\tmaxi = i\n\t\t\t}\n\t\t}\n\n\t\t// decrement, if 0 abort\n\t\tif widths[maxi] == 0 {\n\t\t\tbreak\n\t\t}\n\t\twidths[maxi] = widths[maxi] - 1\n\t}\n\n\trows := append([][]string{t.Header}, t.Rows...)\n\n\tfor i, row := range rows {\n\t\tmode := t.RowStyles[i].Mode\n\t\tfg := t.RowStyles[i].Fg\n\t\tbg := t.RowStyles[i].Bg\n\n\t\t// defaults\n\t\tif mode == 0 {\n\t\t\tmode = MODE_DEFAULT\n\t\t}\n\n\t\tif fg == 0 {\n\t\t\tfg = FG_DEFAULT\n\t\t}\n\n\t\tif bg == 0 {\n\t\t\t/// alternate if not specified\n\t\t\tif i%2 != 0 {\n\t\t\t\tbg = BG_DEFAULT_1\n\t\t\t} else {\n\t\t\t\tbg = BG_DEFAULT_2\n\t\t\t}\n\t\t}\n\n\t\tcells := row[:]\n\t\tfor i, w := range widths {\n\t\t\ttrimmed := FixStr(cells[i], w)\n\n\t\t\t// support ' / ' markup -- show notes faded. Insert ANSI escape\n\t\t\t// formatting, ensuring reset to original colour for given row.\n\t\t\tif strings.Contains(trimmed, \" \"+NOTE_MODE_KEYWORD+\" \") {\n\t\t\t\ttrimmed = strings.Replace(\n\t\t\t\t\tFixStr(cells[i], w+2),\n\t\t\t\t\t\" \"+NOTE_MODE_KEYWORD+\" \",\n\t\t\t\t\tfmt.Sprintf(\"\\033[38;5;%dm \", FG_NOTE),\n\t\t\t\t\t1,\n\t\t\t\t) + fmt.Sprintf(\"\\033[38;5;%dm\", fg)\n\t\t\t}\n\n\t\t\tcells[i] = trimmed\n\t\t}\n\n\t\tline := strings.Join(cells, strings.Repeat(\" \", TABLE_COL_GAP))\n\n\t\t// print style, line then reset\n\t\tfmt.Printf(\"\\033[%d;38;5;%d;48;5;%dm%s\\033[0m\\n\", mode, fg, bg, line)\n\t}\n}", "title": "" } ]
[ { "docid": "d9a0fd9dbb6cc19de4a5089de7b1010f", "score": "0.6216459", "text": "func (t Table) Render(w io.Writer, cellSep string, maxWidth int, constraints []ColumnConstraint) error {\n\tif len(t.rows) == 0 {\n\t\treturn NoRowsError{}\n\t}\n\tif len(constraints) != len(t.rows[0]) {\n\t\treturn InconsistentRowsError{existingRows: len(t.rows[0]), newRow: len(constraints)}\n\t}\n\n\terr := t.breakOnLineBreaks()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twidths, err := t.renderFirstPass(cellSep, maxWidth, constraints)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trows, err := t.renderSecondPass(constraints, widths)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// write out\n\tfor _, row := range rows {\n\t\tfmt.Fprint(w, strings.Join(row, cellSep))\n\t\tfmt.Fprintln(w)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d391ec0dc862aa1022a904f373ec635", "score": "0.6078533", "text": "func (r *Renderer) renderRows(bot *Bot) {\n\tfor y := 0; y < TableUnitsY*ConsoleUnitsPerTableUnitsY; y++ {\n\t\tif y%TableUnitsY == 0 && y > 0 {\n\t\t\tr.renderRowSep()\n\t\t}\n\n\t\tr.renderColumns(bot, y)\n\t\tr.renderRowSep()\n\t}\n}", "title": "" }, { "docid": "a11415de4c5d2412206a0ebfa8391ffa", "score": "0.60311884", "text": "func (this *TableCol) Render(maxWidth int) (content string, width, lineCount int) {\n\tcontent = this.Content(maxWidth)\n\tlines := strings.Split(content, \"\\n\")\n\trendered := make([]string, len(lines))\n\tfor idx, line := range lines {\n\t\tlineLen := StringLength(line)\n\t\tif lineLen > width {\n\t\t\twidth = lineLen\n\t\t}\n\t\tif maxWidth > 0 {\n\t\t\tif diff := int(maxWidth) - lineLen; diff > 0 {\n\t\t\t\tline += strings.Repeat(\" \", diff)\n\t\t\t}\n\t\t}\n\t\tlineCount++\n\t\trendered[idx] = line\n\t\t_dbgTableCol(\"\\033[0mLINE %d (len: %d): \\\"%s\\\"\\n\\033[0m\", idx, lineLen, line)\n\t}\n\tcontent = strings.Join(rendered, \"\\n\")\n\treturn\n}", "title": "" }, { "docid": "1c693208c1447bb523016c8511888b3b", "score": "0.5835764", "text": "func (r renderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {}", "title": "" }, { "docid": "6cd527aee77b4d60371b074539a009ab", "score": "0.55481195", "text": "func renderTable(v *gocui.View, columns []string, resultSet [][]string) {\n\ttable := tablewriter.NewWriter(v)\n\ttable.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: true})\n\ttable.SetHeader(columns)\n\t// Add Bulk Data.\n\ttable.AppendBulk(resultSet)\n\ttable.Render()\n}", "title": "" }, { "docid": "b6d95ab5c9f7f51a4542d0728ccbbecd", "score": "0.55006826", "text": "func (r renderer) TableRow(out *bytes.Buffer, text []byte) {}", "title": "" }, { "docid": "c51ac29d0b53661ee06ea54a0a634b35", "score": "0.54962707", "text": "func renderStatTable(Table [][]string) {\n\tg := widgets.NewTable()\n\tg.SetRect(0, 5, 75, 26)\n\tg.TextAlignment = ui.AlignCenter\n\tg.ColumnWidths = []int{6, 34, 10, 10, 10}\n\tg.Rows = Table\n\tui.Render(g)\n}", "title": "" }, { "docid": "8cd7cd84da93fe7a36bc01d8ef7e67be", "score": "0.5491116", "text": "func drawTable(header1 string, header2 string, rows int, getRow getRowFn) {\n\tfmt.Println(line)\n\tfmt.Println(rowFormat, header1, header2)\n\tfmt.Println(line)\n\tfor row := 0; row < rows; row++ {\n\t\tcell1, cell2 := getRow(row)\n\t\tfmt.Printf(rowFormat, cell1, cell2)\n\t}\n\tfmt.Println(line)\n}", "title": "" }, { "docid": "97a78152b59a333bfc91c8cb5bb659ce", "score": "0.5487349", "text": "func GenerateTable(headers []string, rows [][]string) {\n\tfmt.Println(``)\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader(headers)\n\ttable.SetRowLine(true)\n\n\tfor _, v := range rows {\n\t\ttable.Append(v)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "c932cd523809ec8bf36bef126674b569", "score": "0.54648775", "text": "func (t *Table) Render() string {\n\tfmt.Fprintln(t.w, \"-\")\n\tt.w.Flush()\n\n\treturn t.buf.String()\n}", "title": "" }, { "docid": "5d9ecf89549d05fcbcee25e2b110e14a", "score": "0.544333", "text": "func (t *Table) DisplayTable(rows [][]string) error {\n\tnumRows := len(rows)\n\tnumCols := len(rows[0])\n\tif numRows != len(t.RowColors) {\n\t\treturn fmt.Errorf(\"row count and row-colors mismatch\")\n\t}\n\n\t// Compute max. column widths\n\tmaxColWidths := make([]int, numCols)\n\tfor _, row := range rows {\n\t\tif len(row) != len(t.AlignRight) {\n\t\t\treturn fmt.Errorf(\"col count and align-right mismatch\")\n\t\t}\n\t\tfor i, v := range row {\n\t\t\tif len([]rune(v)) > maxColWidths[i] {\n\t\t\t\tmaxColWidths[i] = len([]rune(v))\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compute per-cell text with padding and alignment applied.\n\tpaddedText := make([][]string, numRows)\n\tfor r, row := range rows {\n\t\tpaddedText[r] = make([]string, numCols)\n\t\tfor c, cell := range row {\n\t\t\tif t.AlignRight[c] {\n\t\t\t\tfmtStr := fmt.Sprintf(\"%%%ds\", maxColWidths[c])\n\t\t\t\tpaddedText[r][c] = fmt.Sprintf(fmtStr, cell)\n\t\t\t} else {\n\t\t\t\textraWidth := maxColWidths[c] - len([]rune(cell))\n\t\t\t\tfmtStr := fmt.Sprintf(\"%%s%%%ds\", extraWidth)\n\t\t\t\tpaddedText[r][c] = fmt.Sprintf(fmtStr, cell, \"\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Draw table top border\n\tsegments := make([]string, numCols)\n\tfor i, c := range maxColWidths {\n\t\tsegments[i] = strings.Repeat(\"─\", c+2)\n\t}\n\tindentText := strings.Repeat(\" \", t.TableIndentWidth)\n\tborder := fmt.Sprintf(\"%s┌%s┐\", indentText, strings.Join(segments, \"┬\"))\n\tfmt.Println(border)\n\n\t// Print the table with colors\n\tfor r, row := range paddedText {\n\t\tfmt.Print(indentText + \"│ \")\n\t\tfor c, text := range row {\n\t\t\tt.RowColors[r].Print(text)\n\t\t\tif c != numCols-1 {\n\t\t\t\tfmt.Print(\" │ \")\n\t\t\t}\n\t\t}\n\t\tfmt.Println(\" │\")\n\t}\n\n\t// Draw table bottom border\n\tborder = fmt.Sprintf(\"%s└%s┘\", indentText, strings.Join(segments, \"┴\"))\n\tfmt.Println(border)\n\n\treturn nil\n}", "title": "" }, { "docid": "ee6f2a9c58882584cca7ba0b862075c5", "score": "0.5375845", "text": "func Table(table [][]string, tableOptions ...TableOption) (string, error) {\n\tmaxs, err := lookupMaxLengthPerColumn(table)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcols := len(maxs)\n\toptions := defaultOptions(cols)\n\n\tfor _, userOption := range tableOptions {\n\t\tuserOption(&options)\n\t}\n\n\tif len(options.errors) > 0 {\n\t\treturn \"\", options.errors[0]\n\t}\n\n\tvar (\n\t\tbuf bytes.Buffer\n\t\tidx = 0\n\t\trowLimit = len(table)\n\t)\n\n\tif (options.rowLimit >= 0) && (options.rowLimit < len(table)) {\n\t\trowLimit = options.rowLimit\n\t}\n\n\tfor ; idx < rowLimit; idx++ {\n\t\trow := table[idx]\n\n\t\tif options.desiredRowWidth > 0 {\n\t\t\trawRowWidth := lookupPlainRowLength(row, maxs, options.separator)\n\n\t\t\tif rawRowWidth > options.desiredRowWidth {\n\t\t\t\treturn \"\", &RowLengthExceedsDesiredWidthError{}\n\t\t\t}\n\n\t\t\tfor y := range row {\n\t\t\t\tmaxs[y] += (options.desiredRowWidth - rawRowWidth) / cols\n\t\t\t}\n\t\t}\n\n\t\tfor y, cell := range row {\n\t\t\tnotLastCol := y < len(row)-1\n\t\t\tfillment := strings.Repeat(\n\t\t\t\toptions.filler,\n\t\t\t\tmaxs[y]-bunt.PlainTextLength(cell),\n\t\t\t)\n\n\t\t\tswitch options.columnAlignment[y] {\n\t\t\tcase Left:\n\t\t\t\tbuf.WriteString(cell)\n\t\t\t\tif notLastCol {\n\t\t\t\t\tbuf.WriteString(fillment)\n\t\t\t\t}\n\n\t\t\tcase Right:\n\t\t\t\tbuf.WriteString(fillment)\n\t\t\t\tbuf.WriteString(cell)\n\n\t\t\tcase Center:\n\t\t\t\tx := bunt.PlainTextLength(fillment) / 2\n\t\t\t\tbuf.WriteString(fillment[:x])\n\t\t\t\tbuf.WriteString(cell)\n\t\t\t\tif notLastCol {\n\t\t\t\t\tbuf.WriteString(fillment[x:])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif notLastCol {\n\t\t\t\tbuf.WriteString(options.separator)\n\t\t\t}\n\t\t}\n\n\t\t// Make sure to add a linefeed to the end of each line, unless it is\n\t\t// the last line of the table and the settings indicate that there must\n\t\t// be no linefeed at the last line\n\t\tif lastline := idx >= rowLimit-1; !lastline || !options.omitLinefeedAtEnd {\n\t\t\t// Special case in which the number of table rows is limited, add an\n\t\t\t// ellipsis to indicate the truncation\n\t\t\tif lastline && rowLimit >= 0 && rowLimit < len(table) {\n\t\t\t\tbuf.WriteString(\"\\n[...]\")\n\t\t\t}\n\n\t\t\tbuf.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "ada60d29b6e8751ff623eb16a5aa6916", "score": "0.5372273", "text": "func Table(opts TableOpts) ([]string, error) {\n\n\tif len(opts.Rows) == 0 {\n\t\treturn nil, errors.New(\"No rows to display\")\n\t}\n\tif len(opts.Columns) == 0 {\n\t\treturn nil, errors.New(\"No columns to display\")\n\t}\n\n\tcolumnLabels := make([]string, len(opts.Columns))\n\tfor i, name := range opts.Columns {\n\t\tcolumnLabels[i] = strings.ToUpper(toSnakeCase(name))\n\t}\n\n\trowMaps := getRowMaps(opts.Rows)\n\n\ttableData, err := extractSliceAttrs(rowMaps, opts.Columns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tseparator := \" | \"\n\tif opts.Separator != \"\" {\n\t\tseparator = opts.Separator\n\t}\n\n\tseparatorLen := len(separator)\n\tcolumnWidths := columnWidths(tableData, columnLabels, opts.ShowHeader)\n\tcolumnFormats := columnFormats(columnWidths)\n\ttableWidth := sum(columnWidths) + separatorLen*(len(opts.Columns)-1)\n\n\trowCount := len(tableData)\n\trowOffset := 0\n\tif opts.ShowHeader {\n\t\trowCount += 3\n\t\trowOffset = 3\n\t}\n\trows := make([]string, rowCount)\n\n\tif opts.ShowHeader {\n\t\theaders := make([]string, len(opts.Columns))\n\t\tfor i, label := range columnLabels {\n\t\t\theaders[i] = fmt.Sprintf(columnFormats[i], label)\n\t\t}\n\t\trows[0] = strings.Repeat(\"=\", tableWidth)\n\t\trows[1] = strings.Join(headers, separator)\n\t\trows[2] = strings.Repeat(\"=\", tableWidth)\n\t}\n\n\tvar rowColors []*color.Color\n\tif len(opts.Colors) == len(opts.Rows) {\n\t\trowColors = opts.Colors\n\t}\n\n\tfor i, row := range tableData {\n\t\trowItems := make([]string, len(row))\n\t\tfor h, item := range row {\n\t\t\tif rowColors != nil {\n\t\t\t\trowItems[h] = rowColors[i].Sprintf(columnFormats[h], item)\n\t\t\t} else {\n\t\t\t\trowItems[h] = fmt.Sprintf(columnFormats[h], item)\n\t\t\t}\n\t\t}\n\t\trows[i+rowOffset] = strings.Join(rowItems, separator)\n\t}\n\n\treturn rows, nil\n}", "title": "" }, { "docid": "2483260a38aeb9ae4c5e4742a1451129", "score": "0.53115183", "text": "func (t *Table) Draw(buf *termui.Buffer) {\n\tif t.filter.String() != \"\" && t.filterColumn >= 0 {\n\t\tvar filteredRows [][]string\n\t\tfor i := 0; i < len(t.Rows); i += t.rowsPerEntry {\n\t\t\tif strings.Contains(t.Rows[i][t.filterColumn], t.filter.String()) {\n\t\t\t\tfor r := 0; r < t.rowsPerEntry; r++ {\n\t\t\t\t\tfilteredRows = append(filteredRows, t.Rows[i+r])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if no match against the filter\n\t\tif len(filteredRows) == 0 {\n\t\t\t// make an empty table based on the number of columns\n\t\t\t// of the last render.\n\t\t\t// NOTE: if the number of columns changes might produce\n\t\t\t// unwanted behavior\n\t\t\tif len(t.Table.Rows) != 0 {\n\t\t\t\tcolumns := len(t.Table.Rows[0])\n\t\t\t\tfilteredRows = [][]string{\n\t\t\t\t\tmake([]string, columns),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tt.out = filteredRows\n\t} else {\n\t\tt.out = t.Rows\n\t}\n\n\tt.reCalcView()\n\t// Avoid panic in the termui/table draw method, if no rows are supplied by the user.\n\tif len(t.Table.Rows) == 0 {\n\t\treturn\n\t}\n\n\tt.paintActiveRow()\n\tt.Table.Draw(buf)\n}", "title": "" }, { "docid": "90b7a536bb7cb47dda53559b68a46396", "score": "0.5298293", "text": "func getTableLen(table string) int {\n i := 0\n for _, char := range table {\n if char == '*' {\n break\n }\n i += 1\n }\n return i\n}", "title": "" }, { "docid": "414832d5e6d38e06f28c6426ce92d01a", "score": "0.5246209", "text": "func displayTable(m *TuiModel) string {\n\tvar builder []string\n\tcolumnNamesToInterfaceArray := m.GetSchemaData()\n\n\t// go through all columns\n\tfor c, columnName := range m.GetHeaders() {\n\t\tif m.expandColumn > -1 && m.expandColumn != c {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar rowBuilder []string\n\t\tcolumnValues := columnNamesToInterfaceArray[columnName]\n\n\t\tfor r, val := range columnValues {\n\t\t\tbase := m.GetBaseStyle()\n\t\t\t// handle highlighting\n\t\t\tif c == m.GetColumn() && r == m.GetRow() {\n\t\t\t\tbase.Foreground(lipgloss.Color(highlight))\n\t\t\t}\n\t\t\t// display text based on type\n\t\t\trow := func() string {\n\t\t\t\tswitch v := val.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\treturn TruncateIfApplicable(m, v)\n\t\t\t\tcase int64:\n\t\t\t\t\treturn fmt.Sprintf(\"%d\", v)\n\t\t\t\tcase float64:\n\t\t\t\t\treturn fmt.Sprintf(\"%.2f\", v)\n\t\t\t\tcase time.Time:\n\t\t\t\t\tcw := m.CellWidth()\n\t\t\t\t\tstr := v.String()\n\t\t\t\t\tminVal := int(math.Min(float64(len(str)), float64(cw)))\n\t\t\t\t\ts := str[:minVal]\n\t\t\t\t\tif len(s) == cw {\n\t\t\t\t\t\ts = s[:len(s)-3] + \"...\"\n\t\t\t\t\t}\n\t\t\t\t\treturn s\n\t\t\t\tcase nil:\n\t\t\t\t\treturn \"NULL\"\n\t\t\t\tdefault:\n\t\t\t\t\treturn \"\"\n\t\t\t\t}\n\t\t\t}()\n\t\t\trowBuilder = append(rowBuilder, base.Render(row))\n\t\t}\n\n\t\t// get a list of columns\n\t\tbuilder = append(builder, lipgloss.JoinVertical(lipgloss.Left, rowBuilder...))\n\t}\n\n\t// join them into rows\n\treturn lipgloss.JoinHorizontal(lipgloss.Left, builder...)\n}", "title": "" }, { "docid": "befa01de02d0d53c3bfa6ea514ba8fd0", "score": "0.521205", "text": "func (t *Table) Rows() int {\n\treturn len(t.Row)\n}", "title": "" }, { "docid": "5ebe27a85d04c5f581bb6cdb273940b8", "score": "0.51638496", "text": "func drawTable(w io.Writer, report []URL) {\n\ttable := tablewriter.NewWriter(w)\n\ttable.SetHeader([]string{\"No\", \"URL\", \"Status\"})\n\tfor i, url := range report {\n\t\trow := []string{strconv.Itoa(i + 1), url.Loc, strconv.Itoa(url.StatusCode)}\n\t\ttable.Append(row)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "4b07ddb62741a04affc7ccfb71a2e9b8", "score": "0.5125304", "text": "func (this *TableCol) LineCount(maxWidth ...int) int {\n\tif len(maxWidth) == 0 || maxWidth[0] == 0 {\n\t\treturn this.lineCount\n\t}\n\treturn strings.Count(this.Content(maxWidth[0]), \"\\n\") + 1\n}", "title": "" }, { "docid": "9c8c5d98d8b447798c894d9304aa27e6", "score": "0.5116903", "text": "func (sl SprintList) RenderInTable() error {\n\tif sl.Display.Plain {\n\t\tw := tabwriter.NewWriter(os.Stdout, 0, tabWidth, 1, '\\t', 0)\n\t\treturn sl.renderPlain(w)\n\t}\n\n\tdata := sl.tableData()\n\tview := tui.NewTable(\n\t\ttui.WithColPadding(colPadding),\n\t\ttui.WithMaxColWidth(maxColWidth),\n\t\ttui.WithTableFooterText(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Showing %d results from board \\\"%s\\\" of project \\\"%s\\\"\",\n\t\t\t\tlen(sl.Data), sl.Board, sl.Project,\n\t\t\t),\n\t\t),\n\t)\n\n\treturn view.Paint(data)\n}", "title": "" }, { "docid": "f865745db7b99c897f76b8d8ea9e020d", "score": "0.5110386", "text": "func (t Table) printRow(columns [][]string, colKey int) {\n\t// Get Maximum Height\n\tmax := t.rs[colKey]\n\ttotal := len(columns)\n\n\t// TODO Fix uneven col size\n\t// if total < t.colSize {\n\t//\tfor n := t.colSize - total; n < t.colSize ; n++ {\n\t//\t\tcolumns = append(columns, []string{SPACE})\n\t//\t\tt.cs[n] = t.mW\n\t//\t}\n\t//}\n\n\t// Pad Each Height\n\t// pads := []int{}\n\tpads := []int{}\n\n\tfor i, line := range columns {\n\t\tlength := len(line)\n\t\tpad := max - length\n\t\tpads = append(pads, pad)\n\t\tfor n := 0; n < pad; n++ {\n\t\t\tcolumns[i] = append(columns[i], \" \")\n\t\t}\n\t}\n\t//fmt.Println(max, \"\\n\")\n\tfor x := 0; x < max; x++ {\n\t\tfor y := 0; y < total; y++ {\n\n\t\t\t// Check if border is set\n\t\t\tfmt.Fprint(t.out, ConditionString((!t.border && y == 0), EMPTY, t.pColumn))\n\t\t\tfmt.Fprint(t.out, ConditionString(!t.border, EMPTY, SPACE))\n\n\t\t\tstr := columns[y][x]\n\n\t\t\t// This would print alignment\n\t\t\t// Default alignment would use multiple configuration\n\t\t\tswitch t.align {\n\t\t\tcase ALIGN_CENTRE: //\n\t\t\t\tfmt.Fprintf(t.out, \"%s\", Pad(str, SPACE, t.cs[y]))\n\t\t\tcase ALIGN_RIGHT:\n\t\t\t\tfmt.Fprintf(t.out, \"%s\", PadLeft(str, SPACE, t.cs[y]))\n\t\t\tcase ALIGN_LEFT:\n\t\t\t\tfmt.Fprintf(t.out, \"%s\", PadRight(str, SPACE, t.cs[y]))\n\t\t\tdefault:\n\t\t\t\tif decimal.MatchString(strings.TrimSpace(str)) || percent.MatchString(strings.TrimSpace(str)) {\n\t\t\t\t\tfmt.Fprintf(t.out, \"%s\", PadLeft(str, SPACE, t.cs[y]))\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(t.out, \"%s\", PadRight(str, SPACE, t.cs[y]))\n\n\t\t\t\t\t// TODO Custom alignment per column\n\t\t\t\t\t//if max == 1 || pads[y] > 0 {\n\t\t\t\t\t//\tfmt.Fprintf(t.out, \"%s\", Pad(str, SPACE, t.cs[y]))\n\t\t\t\t\t//} else {\n\t\t\t\t\t//\tfmt.Fprintf(t.out, \"%s\", PadRight(str, SPACE, t.cs[y]))\n\t\t\t\t\t//}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Fprintf(t.out, ConditionString(!t.border, EMPTY, SPACE))\n\t\t}\n\t\t// Check if border is set\n\t\t// Replace with space if not set\n\t\tfmt.Fprint(t.out, ConditionString(t.border, t.pColumn, EMPTY))\n\t\tfmt.Fprintln(t.out)\n\t}\n\n\tif t.rowLine {\n\t\tt.printLine(true)\n\t}\n\n}", "title": "" }, { "docid": "7571ecc4acf7d0b32691dad219858ed7", "score": "0.50789785", "text": "func TestTable_Walk_countInts(t *testing.T) {\n\tvar err error\n\tvar table1 *gotables.Table\n\n\tvar tableString string\n\ttableString = `\n\t[TypesGalore22]\n i s right\n int string *Table\n 0 \"abc\" []\n 1 \"xyz\" []\n 2 \"ssss\" []\n 3 \"xxxx\" []\n 4 \"yyyy\" []\n `\n\ttable1, err = gotables.NewTableFromString(tableString)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Now create and set some table cell tables.\n\tright0 := `\n\t[right0]\n\ti int = 32`\n\n\tright1 := `\n\t[right1]\n\ts string = \"thirty-two\"`\n\n\tright2 := `\n\t[right2]\n\tx\ty\tz\n\tint\tint\tint\n\t1\t2\t3\n\t4\t5\t6\n\t7\t8\t9`\n\n\tright3 := `\n\t[right3]\n\tf float32 = 88.8`\n\n\tright4 := `\n\t[right4]\n\tt1 *Table = []`\n\n\ttable1.SetTableMustSet(\"right\", 0, gotables.NewTableFromStringMustMake(right0))\n\ttable1.SetTableMustSet(\"right\", 1, gotables.NewTableFromStringMustMake(right1))\n\ttable1.SetTableMustSet(\"right\", 2, gotables.NewTableFromStringMustMake(right2))\n\ttable1.SetTableMustSet(\"right\", 3, gotables.NewTableFromStringMustMake(right3))\n\ttable1.SetTableMustSet(\"right\", 4, gotables.NewTableFromStringMustMake(right4))\n\n\t// fmt.Printf(\"table1:\\n%s\\n\", table1)\n\n\tvar tableCount int\n\tvar visitTable = func(table *gotables.Table) (err error) {\n\t\t// fmt.Printf(\"visiting:\\n%s\\n\", table)\n\t\ttableCount++\n\t\treturn\n\t}\n\n\tvar cellCount int\n\tvar intCount int\n\tvar intSum int\n\tvar float32Count int\n\tvar visitCell = func(walkDeep bool, cell gotables.CellInfo) (err error) {\n\t\tcellCount++\n\t\tif cell.ColType == \"int\" {\n\t\t\tintCount++\n\t\t\tintSum += cell.Table.GetIntByColIndexMustGet(cell.ColIndex, cell.RowIndex)\n\t\t}\n\t\tif cell.ColType == \"float32\" {\n\t\t\tfloat32Count++\n\t\t}\n\t\treturn\n\t}\n\n\tconst walkDeep = true\n\tvar walkSafe gotables.WalkSafe = make(gotables.WalkSafe)\n\terr = table1.Walk(walkDeep, walkSafe, visitTable, nil, visitCell)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tvar expecting int = 7\n\n\texpecting = 7\n\tif tableCount != expecting {\n\t\tt.Fatalf(\"expecting tableCount %d, not %d\", expecting, tableCount)\n\t}\n\n\texpecting = 28\n\tif cellCount != expecting {\n\t\tt.Fatalf(\"expecting cellCount %d, not %d\", expecting, cellCount)\n\t}\n\n\texpecting = 15\n\tif intCount != expecting {\n\t\tt.Fatalf(\"expecting intCount %d, not %d\", expecting, intCount)\n\t}\n\n\texpecting = 87\n\tif intSum != expecting {\n\t\tt.Fatalf(\"expecting intSum %d, not %d\", expecting, intSum)\n\t}\n\n\texpecting = 1\n\tif float32Count != expecting {\n\t\tt.Fatalf(\"expecting float32Count %d, not %d\", expecting, float32Count)\n\t}\n}", "title": "" }, { "docid": "f3c68cb625887f3427158d5aae50a8a3", "score": "0.5075141", "text": "func (b *Buffer) getNumOfVisibleRows () int {\n visibleRows := b.rowsOffset + (b.maxVisibleRows - b.reservedRows)\n\n if visibleRows > len(b.rows) {\n visibleRows = len(b.rows)\n }\n\n return visibleRows\n}", "title": "" }, { "docid": "ae3dec4dab4c69a7546eec09077eb98e", "score": "0.49938864", "text": "func tabulate() {\n\n\tw := new(tabwriter.Writer)\n\tw.Init(os.Stdout, 8, 8, 0, '\\t', 0)\n\tdefer w.Flush()\n\n\tfmt.Fprintf(w, \"\\n \")\n\tfor _, each := range configJSON.Columns {\n\t\tfmt.Fprintf(w, \"%s\\t\\t\", each)\n\t}\n\tfmt.Fprintf(w, \"\\n\")\n\n\tfor _, each := range allAlertData {\n\t\tif filteredAlerts[each.Name] == 1 {\n\t\t\tfmt.Fprintf(w, \" %s\\t\\t%s\\t\\t%s\\t\\t%s\\t\\t%s\",\n\t\t\t\teach.Name,\n\t\t\t\teach.Service,\n\t\t\t\teach.Tag,\n\t\t\t\teach.Severity,\n\t\t\t\ttimeDiff(time.Now(), each.StartsAt, 0),\n\t\t\t)\n\t\t\tif each.EndsAt == time.Unix(maxtstmp, 0).UTC() {\n\t\t\t\tfmt.Fprintf(w, \"\\t\\t%s\", \"Undefined\")\n\t\t\t\tfmt.Fprintf(w, \"\\t\\t%s\\n\", \"Undefined\")\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(w, \"\\t\\t%s\", timeDiff(time.Now(), each.EndsAt, 0))\n\t\t\t\tfmt.Fprintf(w, \"\\t\\t%s\\n\", timeDiff(each.StartsAt, each.EndsAt, 1))\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f8ff43410a702d788c1016476b18f369", "score": "0.4955933", "text": "func (table *Table) NumberOfRows() (int, int) {\n\tvar numberOfRows int\n\tvar dataFileInfo *os.FileInfo\n\tdataFileInfo, err := table.DataFile.Stat()\n\tif err != nil {\n\t\tlogg.Err(\"table\", \"NumberOfRows\", err.String())\n\t\treturn 0, st.CannotStatTableDataFile\n\t}\n\tnumberOfRows = int(dataFileInfo.Size) / table.RowLength\n\treturn numberOfRows, st.OK\n}", "title": "" }, { "docid": "f3e5d1e56de054201787252b0dbce6ac", "score": "0.49258602", "text": "func (buckets HistogramBuckets) Table() string {\n\tif len(buckets) == 0 {\n\t\treturn \"\"\n\t}\n\tbuf := bytes.NewBuffer(nil)\n\ttb := tablewriter.NewWriter(buf)\n\ttb.SetAutoWrapText(false)\n\ttb.SetColWidth(1500)\n\ttb.SetCenterSeparator(\"*\")\n\ttb.SetAlignment(tablewriter.ALIGN_CENTER)\n\ttb.SetCaption(true, fmt.Sprintf(\"\t(%q scale)\", buckets[0].Scale))\n\ttb.SetHeader([]string{\"lower bound\", \"upper bound\", \"count\"})\n\tfor _, v := range buckets {\n\t\tlo := fmt.Sprintf(\"%f\", v.LowerBound)\n\t\tif v.Scale == \"milliseconds\" {\n\t\t\tlo = fmt.Sprintf(\"%.3f\", v.LowerBound)\n\t\t}\n\t\thi := fmt.Sprintf(\"%f\", v.UpperBound)\n\t\tif v.Scale == \"milliseconds\" {\n\t\t\thi = fmt.Sprintf(\"%.3f\", v.UpperBound)\n\t\t}\n\t\tif v.UpperBound == math.MaxFloat64 {\n\t\t\thi = \"math.MaxFloat64\"\n\t\t}\n\t\ttb.Append([]string{lo, hi, fmt.Sprintf(\"%d\", v.Count)})\n\t}\n\ttb.Render()\n\treturn buf.String()\n}", "title": "" }, { "docid": "34c8927d17d5f495903ee8b868407f22", "score": "0.49163544", "text": "func (c TableConfig) MakeTable(data [][]string) string {\n\tmaxLineWidth := c.MaxLineWidth\n\tif c.GetTerminalWidth != nil {\n\t\tmaxLineWidth = c.GetTerminalWidth()\n\t}\n\tnumColumns := 0\n\tfor _, row := range data {\n\t\tif numColumns < len(row) {\n\t\t\tnumColumns = len(row)\n\t\t}\n\t}\n\tcolumnWidths := make([]int, numColumns)\n\tfor _, row := range data {\n\t\tfor colIdx, cell := range row {\n\t\t\tif columnWidths[colIdx] < len(cell) {\n\t\t\t\tcolumnWidths[colIdx] = len(cell)\n\t\t\t}\n\t\t}\n\t}\n\tif c.MaxColumnWidth > 0 {\n\t\tfor idx, colWidth := range columnWidths {\n\t\t\tif colWidth > c.MaxColumnWidth {\n\t\t\t\tcolumnWidths[idx] = c.MaxColumnWidth\n\t\t\t}\n\t\t}\n\t}\n\trv := make([]string, 0, len(data))\n\tfor idx, row := range data {\n\t\tstr := make([]string, 0, len(row))\n\t\tfor colIdx, cell := range row {\n\t\t\t// If there are multiple lines in the string, keep only the first.\n\t\t\tcell = strings.Split(cell, \"\\n\")[0]\n\t\t\tcell = strings.TrimSpace(cell)\n\t\t\tif c.MaxColumnWidth > 0 {\n\t\t\t\tcell = util.TruncateNoEllipses(cell, c.MaxColumnWidth)\n\t\t\t}\n\t\t\tpadding := columnWidths[colIdx] - len(cell)\n\t\t\tcell = cell + strings.Repeat(\" \", padding)\n\t\t\tstr = append(str, cell)\n\t\t}\n\t\tline := strings.Join(str, \" \")\n\t\tif maxLineWidth > 0 {\n\t\t\tline = util.TruncateNoEllipses(line, maxLineWidth)\n\t\t}\n\t\tline = strings.TrimSpace(line)\n\t\trv = append(rv, line)\n\n\t\tif idx == 0 && (c.IncludeHeader || c.JSONTagsAsHeaders) {\n\t\t\trv = append(rv, strings.Repeat(\"-\", len(line)))\n\t\t}\n\t}\n\treturn strings.Join(rv, \"\\n\")\n}", "title": "" }, { "docid": "05a875df6faaf42aaf90426eb97e9404", "score": "0.48813352", "text": "func getTableRowAndColumnCount(table *goquery.Selection) (int, int) {\n\trows := 0\n\tcolumns := 0\n\ttable.Find(\"tr\").Each(func(_ int, tr *goquery.Selection) {\n\t\t// Look for rows\n\t\tstrRowSpan, _ := tr.Attr(\"rowspan\")\n\t\trowSpan, err := strconv.Atoi(strRowSpan)\n\t\tif err != nil {\n\t\t\trowSpan = 1\n\t\t}\n\t\trows += rowSpan\n\n\t\t// Now look for columns\n\t\tcolumnInThisRow := 0\n\t\ttr.Find(\"td\").Each(func(_ int, td *goquery.Selection) {\n\t\t\tstrColSpan, _ := tr.Attr(\"colspan\")\n\t\t\tcolSpan, err := strconv.Atoi(strColSpan)\n\t\t\tif err != nil {\n\t\t\t\tcolSpan = 1\n\t\t\t}\n\t\t\tcolumnInThisRow += colSpan\n\t\t})\n\n\t\tif columnInThisRow > columns {\n\t\t\tcolumns = columnInThisRow\n\t\t}\n\t})\n\n\treturn rows, columns\n}", "title": "" }, { "docid": "0ce29fe8c86eda48038dfc5e2c48693c", "score": "0.48665074", "text": "func (t *Table) Size() int64 { return t.tableSize }", "title": "" }, { "docid": "c677d2ce613235ab761c86fcb5cae1e9", "score": "0.48557484", "text": "func (c ConsoleOutput) Table(header string, rows [][]string) {\n\tif len(header) > 0 {\n\t\tif c.Color {\n\t\t\tc.Say(white+header+reset, 0)\n\t\t} else {\n\t\t\tc.Say(header, 0)\n\t\t}\n\n\t\tc.LineBreak()\n\t}\n\n\tw := new(tabwriter.Writer)\n\tdefer w.Flush()\n\n\tw.Init(os.Stdout, 0, 8, 1, '\\t', 0)\n\n\tfor _, row := range rows {\n\t\tfor i, column := range row {\n\t\t\tfmt.Fprint(w, column)\n\n\t\t\tif i != len(row)-1 {\n\t\t\t\tfmt.Fprint(w, \"\\t\")\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprint(w, \"\\n\")\n\t}\n\n}", "title": "" }, { "docid": "ff0b6cd2d5cf310ca67a1cf462fadb18", "score": "0.4849593", "text": "func (r *renderer) Spacing() int { return 0 }", "title": "" }, { "docid": "4dbf08fc20d7bfabb8493a57354b1361", "score": "0.48448804", "text": "func (r *Renderer) renderRowSep() {\n\tfmt.Println()\n\tr.lines++\n}", "title": "" }, { "docid": "2c01d386fd6db759b386878b8fe83445", "score": "0.48438767", "text": "func (table *Table) Draw(buf *Buffer) {\n\ttable.Block.Draw(buf)\n\n\ttable.drawLocation(buf)\n\ttable.drawUpdated(buf)\n\ttable.ColResizer()\n\n\tcolXPos := []int{}\n\tcur := 1 + table.PadLeft\n\tfor _, w := range table.ColWidths {\n\t\tcolXPos = append(colXPos, cur)\n\t\tcur += w\n\t\tcur += table.ColGap\n\t}\n\n\tfor i, h := range table.Header {\n\t\twidth := table.ColWidths[i]\n\t\tif width == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif width > (table.Inner.Dx()-colXPos[i])+1 {\n\t\t\tcontinue\n\t\t}\n\t\tbuf.SetString(\n\t\t\th,\n\t\t\tNewStyle(Theme.Default.Fg, ColorClear, ModifierBold),\n\t\t\timage.Pt(table.Inner.Min.X+colXPos[i]-1, table.Inner.Min.Y),\n\t\t)\n\t}\n\n\tif table.TopRow < 0 {\n\t\treturn\n\t}\n\n\tfor rowNum := table.TopRow; rowNum < table.TopRow+table.Inner.Dy()-1 && rowNum < len(table.Rows); rowNum++ {\n\t\trow := table.Rows[rowNum]\n\t\ty := (rowNum + 2) - table.TopRow\n\n\t\tstyle := NewStyle(Theme.Default.Fg)\n\t\tfor i, width := range table.ColWidths {\n\t\t\tif width == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif width > (table.Inner.Dx()-colXPos[i])+1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr := TrimString(row[i], width)\n\t\t\tif table.Styles[rowNum][i] != nil {\n\t\t\t\tbuf.SetString(\n\t\t\t\t\tr,\n\t\t\t\t\t*table.Styles[rowNum][i],\n\t\t\t\t\timage.Pt(table.Inner.Min.X+colXPos[i]-1, table.Inner.Min.Y+y-1),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tbuf.SetString(\n\t\t\t\t\tr,\n\t\t\t\t\tstyle,\n\t\t\t\t\timage.Pt(table.Inner.Min.X+colXPos[i]-1, table.Inner.Min.Y+y-1),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e42840d2459d519a4dab9c91f2cd9d01", "score": "0.48119715", "text": "func (c ColDecimal256) Rows() int {\n\treturn len(c)\n}", "title": "" }, { "docid": "6716b84ae6f6778bf31fa2e2444b799c", "score": "0.4769311", "text": "func (fw *Writer) NumRows() int { return fw.nrows }", "title": "" }, { "docid": "610594a7a42af577d50f959e43b77716", "score": "0.4769268", "text": "func paddingFmt(w io.Writer, x interface{}, format string) {\n\tfor i := x.(int); i > 0; i-- {\n\t\tfmt.Fprint(w, `<td width=\"25\"></td>`)\n\t}\n}", "title": "" }, { "docid": "fb6e45d5464b63db4ec7c7cc5cd756e8", "score": "0.47588545", "text": "func (t *Table) Render() string {\n\tt.t.Render()\n\treturn t.output.String()\n}", "title": "" }, { "docid": "4f5c395f6b7f31017606ec6aaf4733f6", "score": "0.47322237", "text": "func (b *Builder) Table(table [][]string, align []TableAlignment) *Builder {\n\t// The table must have at least two line ;\n\t// the header and one content line.\n\tif len(table) < 2 {\n\t\treturn b\n\t}\n\t// This functions protects accesses to undefined\n\t// indexes in the given alignment slice. The default\n\t// alignment is returned if the given index exceed\n\t// the size of the slice.\n\tidxAlign := func(idx int) TableAlignment {\n\t\talen := len(align)\n\t\tif alen == 0 || idx > alen-1 {\n\t\t\treturn defaultAlign\n\t\t}\n\t\treturn align[idx]\n\t}\n\theaderLen := len(table[0])\n\n\t// Count max char len of each column.\n\tcolsLens := make([]int, headerLen)\n\tfor x, line := range table {\n\t\tfor y := range line {\n\t\t\tcl := max(charLen(table[x][y]), colsLens[y])\n\t\t\tif cl < minCellSize {\n\t\t\t\tcolsLens[y] = minCellSize\n\t\t\t} else {\n\t\t\t\tcolsLens[y] = cl\n\t\t\t}\n\t\t}\n\t}\n\tsb := strings.Builder{}\n\n\tfor x, line := range table {\n\t\t// Add the line separator just after\n\t\t// the header line.\n\t\tif x == 1 {\n\t\t\tvar cols []string\n\t\t\tfor j, l := range colsLens {\n\t\t\t\tswitch idxAlign(j) {\n\t\t\t\tcase AlignRight:\n\t\t\t\t\tcols = append(cols, fmt.Sprintf(\"%s:\", strings.Repeat(\"-\", l-1)))\n\t\t\t\tcase AlignCenter:\n\t\t\t\t\tcols = append(cols, fmt.Sprintf(\":%s:\", strings.Repeat(\"-\", l-2)))\n\t\t\t\tcase AlignLeft: // default\n\t\t\t\t\tcols = append(cols, strings.Repeat(\"-\", l))\n\t\t\t\t}\n\t\t\t}\n\t\t\tsb.WriteString(joinCols(cols))\n\t\t\tsb.WriteByte('\\n')\n\t\t}\n\t\t// Pad all the columns of the rows and\n\t\t// join the values with the separator.\n\t\tcols := make([]string, len(table[0]))\n\t\tfor y, cl := range colsLens {\n\t\t\tvar cell string\n\t\t\tif y <= len(line)-1 {\n\t\t\t\tcell = line[y]\n\t\t\t}\n\t\t\tif cell == \"\" {\n\t\t\t\t// Fill empty column with spaces.\n\t\t\t\tcols[y] = strings.Repeat(\" \", cl)\n\t\t\t} else {\n\t\t\t\tcell = reCRLN.ReplaceAllString(cell, \" \")\n\t\t\t\tcols[y] = padSpaces(cell, cl, idxAlign(y))\n\t\t\t}\n\t\t}\n\t\tsb.WriteString(joinCols(cols))\n\t\tsb.WriteByte('\\n')\n\t}\n\tb.writeln(sb.String())\n\n\treturn b\n}", "title": "" }, { "docid": "4874fea06d48aecd1925c58c8d119cae", "score": "0.4724212", "text": "func printQueryOutput(\n\tw io.Writer, cols []string, allRows [][]string, tag string, displayFormat tableDisplayFormat,\n) {\n\tif len(cols) == 0 {\n\t\t// This operation did not return rows, just show the tag.\n\t\tfmt.Fprintln(w, tag)\n\t\treturn\n\t}\n\n\tswitch displayFormat {\n\tcase tableDisplayPretty:\n\t\t// Initialize tablewriter and set column names as the header row.\n\t\ttable := tablewriter.NewWriter(w)\n\t\ttable.SetAutoFormatHeaders(false)\n\t\ttable.SetAutoWrapText(false)\n\t\ttable.SetHeader(cols)\n\t\tfor _, row := range allRows {\n\t\t\tfor i, r := range row {\n\t\t\t\trow[i] = expandTabsAndNewLines(r)\n\t\t\t}\n\t\t\ttable.Append(row)\n\t\t}\n\t\ttable.Render()\n\t\tnRows := len(allRows)\n\t\tfmt.Fprintf(w, \"(%d row%s)\\n\", nRows, util.Pluralize(int64(nRows)))\n\n\tcase tableDisplayTSV:\n\t\tfallthrough\n\tcase tableDisplayCSV:\n\t\tfmt.Fprintf(w, \"%d row%s\\n\", len(allRows),\n\t\t\tutil.Pluralize(int64(len(allRows))))\n\n\t\tcsvWriter := csv.NewWriter(w)\n\t\tif displayFormat == tableDisplayTSV {\n\t\t\tcsvWriter.Comma = '\\t'\n\t\t}\n\t\t_ = csvWriter.Write(cols)\n\t\t_ = csvWriter.WriteAll(allRows)\n\n\tcase tableDisplayHTML:\n\t\tfmt.Fprint(w, \"<table>\\n<thead><tr>\")\n\t\tfor _, col := range cols {\n\t\t\tfmt.Fprintf(w, \"<th>%s</th>\", html.EscapeString(col))\n\t\t}\n\t\tfmt.Fprint(w, \"</tr></head>\\n<tbody>\\n\")\n\t\tfor _, row := range allRows {\n\t\t\tfmt.Fprint(w, \"<tr>\")\n\t\t\tfor _, r := range row {\n\t\t\t\tfmt.Fprintf(w, \"<td>%s</td>\", strings.Replace(html.EscapeString(r), \"\\n\", \"<br/>\", -1))\n\t\t\t}\n\t\t\tfmt.Fprint(w, \"</tr>\\n\")\n\t\t}\n\t\tfmt.Fprint(w, \"</tbody>\\n</table>\\n\")\n\n\tcase tableDisplayRecords:\n\t\tmaxColWidth := 0\n\t\tfor _, col := range cols {\n\t\t\tcolLen := utf8.RuneCountInString(col)\n\t\t\tif colLen > maxColWidth {\n\t\t\t\tmaxColWidth = colLen\n\t\t\t}\n\t\t}\n\n\t\tfor i, row := range allRows {\n\t\t\tfmt.Fprintf(w, \"-[ RECORD %d ]\\n\", i+1)\n\t\t\tfor j, r := range row {\n\t\t\t\tlines := strings.Split(r, \"\\n\")\n\t\t\t\tfor l, line := range lines {\n\t\t\t\t\tcolLabel := cols[j]\n\t\t\t\t\tif l > 0 {\n\t\t\t\t\t\tcolLabel = \"\"\n\t\t\t\t\t}\n\t\t\t\t\t// Note: special characters, including a vertical bar, in\n\t\t\t\t\t// the colLabel are not escaped here. This is in accordance\n\t\t\t\t\t// with the same behavior in PostgreSQL.\n\t\t\t\t\tfmt.Fprintf(w, \"%-*s | %s\\n\", maxColWidth, colLabel, line)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase tableDisplaySQL:\n\t\tfmt.Fprint(w, \"CREATE TABLE results (\\n\")\n\t\tfor i, col := range cols {\n\t\t\ts := parser.Name(col)\n\t\t\tfmt.Fprintf(w, \" %s STRING\", s.String())\n\t\t\tif i < len(cols)-1 {\n\t\t\t\tfmt.Fprint(w, \",\")\n\t\t\t}\n\t\t\tfmt.Fprint(w, \"\\n\")\n\t\t}\n\t\tfmt.Fprint(w, \");\\n\\n\")\n\t\tfor _, row := range allRows {\n\t\t\tfmt.Fprint(w, \"INSERT INTO results VALUES (\")\n\t\t\tfor i, r := range row {\n\t\t\t\ts := parser.DString(r)\n\t\t\t\tfmt.Fprintf(w, \"%s\", s.String())\n\t\t\t\tif i < len(row)-1 {\n\t\t\t\t\tfmt.Fprint(w, \", \")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Fprint(w, \");\\n\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b4d1fc30512a530d12b62f0c9fadd481", "score": "0.472124", "text": "func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName string, expectCount int) {\n\tquery := fmt.Sprintf(`show tables like '%%%s%%';`, showTableName)\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\trowcount := 0\n\n\tfor {\n\t\tqueryResult, err := tablet.VttabletProcess.QueryTablet(query, keyspaceName, true)\n\t\trequire.Nil(t, err)\n\t\trowcount = len(queryResult.Rows)\n\t\tif rowcount > 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tselect {\n\t\tcase <-time.After(time.Second):\n\t\t\tcontinue // Keep looping\n\t\tcase <-ctx.Done():\n\t\t\t// Break below to the assertion\n\t\t}\n\n\t\tbreak\n\t}\n\n\tassert.Equal(t, expectCount, rowcount)\n}", "title": "" }, { "docid": "f9cbba5704256688e9291464cf27494d", "score": "0.47132507", "text": "func (r renderer) TableCell(out *bytes.Buffer, text []byte, flags int) {}", "title": "" }, { "docid": "fe13b65e53be6e2faf451627cfb2c674", "score": "0.47078264", "text": "func formatLineTable(line string, lineNum int) string {\n\tdata := [][]string{\n\t\t{\"\", \"|\", \"\"},\n\t\t{\" \" + strconv.Itoa(lineNum), \"|\", line},\n\t\t{\"\", \"|\", \"\"},\n\t\t{\"\", \"|\", \"\"},\n\t}\n\n\ttableString := &strings.Builder{}\n\ttable := tablewriter.NewWriter(tableString)\n\n\ttable.SetAutoWrapText(false)\n\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\ttable.SetCenterSeparator(\"\")\n\ttable.SetColumnSeparator(\"\")\n\ttable.SetHeaderLine(false)\n\ttable.SetColMinWidth(0, 3)\n\ttable.SetRowSeparator(\"\")\n\ttable.SetBorder(false)\n\ttable.SetColumnAlignment([]int{tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_DEFAULT, tablewriter.ALIGN_DEFAULT})\n\ttable.SetTablePadding(\" \")\n\ttable.SetNoWhiteSpace(true)\n\ttable.AppendBulk(data)\n\n\ttable.Render()\n\treturn tableString.String()\n}", "title": "" }, { "docid": "3b439d983a5a3b92ee272b8fdc39de28", "score": "0.4706956", "text": "func (g *Game) Rows() int {\n\treturn int(g.rows)\n}", "title": "" }, { "docid": "c9a0e1287ec7d7a3558605c09d5fca82", "score": "0.46885988", "text": "func (c ColDecimal64) Rows() int {\n\treturn len(c)\n}", "title": "" }, { "docid": "548754a688d5a977da3212aced41260b", "score": "0.46832776", "text": "func countColumns(node *blackfriday.Node) int {\n\tvar columns int\n\n\tnode.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus {\n\t\tswitch node.Type {\n\t\tcase blackfriday.TableRow:\n\t\t\tif !entering {\n\t\t\t\treturn blackfriday.Terminate\n\t\t\t}\n\t\tcase blackfriday.TableCell:\n\t\t\tif entering {\n\t\t\t\tcolumns++\n\t\t\t}\n\t\tdefault:\n\t\t}\n\t\treturn blackfriday.GoToNext\n\t})\n\treturn columns\n}", "title": "" }, { "docid": "47eb3fe0c6d81560415f1465ccac96f8", "score": "0.46635997", "text": "func (t *Table) RowCount() int {\r\n\r\n\treturn len(t.rows)\r\n}", "title": "" }, { "docid": "4903b5474955474d0a081b7b9e85a6a3", "score": "0.46561098", "text": "func WriteTable(w io.Writer, table Table, style TableStyler) {\n\tif style == nil {\n\t\tstyle = defaultStyle\n\t}\n\trowCount, colCount := table.RowCount(), table.ColCount()\n\tif rowCount <= 0 || colCount <= 0 {\n\t\treturn\n\t}\n\twidthArray := make([]int, colCount)\n\tfor j := 0; j < colCount; j++ {\n\t\tmaxWidth := 0\n\t\tfor i := 0; i < rowCount; i++ {\n\t\t\twidth := len(table.Get(i, j))\n\t\t\tif i == 0 || width > maxWidth {\n\t\t\t\tmaxWidth = width\n\t\t\t}\n\t\t}\n\t\twidthArray[j] = maxWidth\n\t}\n\tcw := newColorWriter(w)\n\trowBorder := rowBorderLine(widthArray)\n\tstyle.BorderRender(rowBorder, cw)\n\tfor i := 0; i < rowCount; i++ {\n\t\tfmt.Fprint(cw, \"\\n\")\n\t\twriteTableRow(cw, table, i, widthArray, style)\n\t\tfmt.Fprint(cw, \"\\n\")\n\t\tstyle.BorderRender(rowBorder, cw)\n\t}\n\tfmt.Fprint(cw, \"\\n\")\n}", "title": "" }, { "docid": "ee9b1af86037b20e7381e17ccac6e2b3", "score": "0.46499246", "text": "func RenderTableForSlack(log logr.Logger, items TableItems) (string, error) {\n\twriter := &strings.Builder{}\n\ttable := tablewriter.NewWriter(writer)\n\theaderKeys := make(map[string]int) // maps the header values to their index\n\theader := []string{\"\"}\n\n\tfor _, item := range items {\n\t\tif _, ok := headerKeys[item.Meta.CloudProvider]; !ok {\n\t\t\theader = append(header, item.Meta.CloudProvider)\n\t\t\theaderKeys[item.Meta.CloudProvider] = len(header) - 1\n\t\t}\n\t}\n\n\tres := results{\n\t\theader: headerKeys,\n\t\tcontent: make(map[string]resultRow),\n\t}\n\n\tfor _, item := range items {\n\t\tmeta := item.Meta\n\t\tif meta.CloudProvider == \"\" {\n\t\t\tlog.V(5).Info(\"skipped testrun\", \"id\", meta.TestrunID)\n\t\t\tcontinue\n\t\t}\n\t\tres.AddResult(meta, item.StatusSymbol)\n\t}\n\tif res.Len() == 0 {\n\t\treturn \"\", nil\n\t}\n\n\ttable.SetAutoWrapText(false)\n\ttable.SetHeader(header)\n\ttable.AppendBulk(res.GetContent())\n\ttable.SetHeaderAlignment(tablewriter.ALIGN_CENTER)\n\ttable.SetAlignment(tablewriter.ALIGN_LEFT)\n\ttable.Render()\n\treturn writer.String(), nil\n}", "title": "" }, { "docid": "7f179bc37fbe14fe5a23ce0a6ef6f5dd", "score": "0.46363693", "text": "func ExampleNewTable() {\n\tt := NewTable()\n\n\tt.SetHeaders(\"id\", \"user\", \"balance\")\n\tt.SetSizes(4, 12)\n\tt.SetAlignments(ALIGN_RIGHT, ALIGN_RIGHT, ALIGN_LEFT)\n\n\tt.Add(1, \"{g}Bob{!}\", 1.42)\n\tt.Add(2, \"John\", 73.1)\n\tt.Add(3, \"Mary\", 2.29)\n\tt.Separator()\n\tt.Add(4, \"Bob\", 6.6)\n\tt.Add(5, \"Matilda\", 0.0)\n\n\tt.Render()\n}", "title": "" }, { "docid": "c562e5f34c884981950d94f020b426ce", "score": "0.4627382", "text": "func (self *T) Rows() int {\n\treturn 2\n}", "title": "" }, { "docid": "c562e5f34c884981950d94f020b426ce", "score": "0.4627382", "text": "func (self *T) Rows() int {\n\treturn 2\n}", "title": "" }, { "docid": "205792e03c56d5f04da2ec73bab63fa7", "score": "0.46217158", "text": "func (s *ServicesWidget) RowCount() int {\n\treturn len(s.filteredRows)\n}", "title": "" }, { "docid": "9e74f6286a7a4574c3fcebd101ef3e1c", "score": "0.4619353", "text": "func (w *colView) Render(width, height int) *term.Buffer {\n\tcols, widths := w.prepareRender(width)\n\tif len(cols) == 0 {\n\t\treturn &term.Buffer{Width: width}\n\t}\n\tvar buf term.Buffer\n\tfor i, col := range cols {\n\t\tif i > 0 {\n\t\t\tbuf.Width += colViewColGap\n\t\t}\n\t\tbufCol := col.Render(widths[i], height)\n\t\tbuf.ExtendRight(bufCol)\n\t}\n\treturn &buf\n}", "title": "" }, { "docid": "43c4cd8263abc325f6364f89378a7d43", "score": "0.46007323", "text": "func (this *MarkupConfluence) tableRow(args ...string) string {\n\tvar retval string = \"\"\n\tfor _, arg := range args {\n\t\tretval += fmt.Sprintf(\"|%s \", arg)\n\t}\n\treturn retval + \"|\\n\"\n}", "title": "" }, { "docid": "843317653f7ada5d63ad2901fbf863b7", "score": "0.45739225", "text": "func (c ColDecimal32) Rows() int {\n\treturn len(c)\n}", "title": "" }, { "docid": "827eb7de980bdd02687c2c23ad39d8e4", "score": "0.45634094", "text": "func (t *Table) RowCount() int {\n\treturn len(t.Row)\n}", "title": "" }, { "docid": "ac7aed662c36c0b1009c0671e7659003", "score": "0.45409158", "text": "func (wf WindowFrame) RowCount() int {\n\treturn len(wf.Rows)\n}", "title": "" }, { "docid": "5813956709989f0539f53ce4087d4691", "score": "0.45219037", "text": "func displayDynamicTable(table *[][]int, a []rune, b []rune) {\n\tfmt.Println(\"\\nDynamic Table:\")\n\tfmt.Print(\" \")\n\tfor _, v := range b {\n\t\tfmt.Printf(\"%c \", v)\n\t}\n\n\tfmt.Println(\" \")\n\tfor r := 0; r < len(*table); r++ {\n\t\tfmt.Printf(\"%c \", a[r])\n\t\tfor c := 0; c < len((*table)[0]); c++ {\n\t\t\tfmt.Print((*table)[r][c], \" \")\n\t\t}\n\t\tfmt.Println()\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "ba484a8c28f5999ebc269ad419630d62", "score": "0.45180994", "text": "func (c *CSVInterpolator) numRows() int64 {\n\tif c.row == 1 {\n\t\treturn rowsNeededToInterpolate - 1\n\t}\n\n\treturn rowsNeededToInterpolate\n}", "title": "" }, { "docid": "669a2d5239dac1db160963011d240976", "score": "0.4517487", "text": "func print_table(chunks []Chunk) {\n\tfmt.Println()\n\tfmt.Println(\" Tag | Payload | Pos1 | Pos2\")\n\tfmt.Println(\"------------------|----------------------------------------------------------------\")\n\tfor i := range chunks {\n\t\tpayload := chunks[i].payload\n\t\tn := 40\n\t\tif len(payload) < 40 {\n\t\t\tn = len(payload)\n\t\t}\n\t\tif len(payload) > 0 {\n\t\t\ttag := chunks[i].tag\n\t\t\tif tag == \"\" {\n\t\t\t\ttag = \"...\"\n\t\t\t}\n\t\t\tfmt.Printf(\" %-16s | %-40s | %-8d | %-8d\\n\", tag, payload[:n],\n\t\t\t\tchunks[i].pos1, chunks[i].pos2)\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "149c8901ccaee15a5204f6eb8b8f005d", "score": "0.45125613", "text": "func (r *Renderer) countLines(buf bytes.Buffer) int {\n\tw, err := r.termWidth()\n\tif err != nil || w == 0 {\n\t\t// if we got an error due to terminal.GetSize not being supported\n\t\t// on current platform then just assume a very wide terminal\n\t\tw = 10000\n\t}\n\n\tbufBytes := buf.Bytes()\n\n\tcount := 0\n\tcurr := 0\n\tdelim := -1\n\tfor curr < len(bufBytes) {\n\t\t// read until the next newline or the end of the string\n\t\trelDelim := bytes.IndexRune(bufBytes[curr:], '\\n')\n\t\tif relDelim != -1 {\n\t\t\tcount += 1 // new line found, add it to the count\n\t\t\tdelim = curr + relDelim\n\t\t} else {\n\t\t\tdelim = len(bufBytes) // no new line found, read rest of text\n\t\t}\n\n\t\tif lineWidth := utf8.RuneCount(bufBytes[curr:delim]); lineWidth > w {\n\t\t\t// account for word wrapping\n\t\t\tcount += lineWidth / w\n\t\t\tif (lineWidth % w) == 0 {\n\t\t\t\t// content whose width is exactly a multiplier of available width should not\n\t\t\t\t// count as having wrapped on the last line\n\t\t\t\tcount -= 1\n\t\t\t}\n\t\t}\n\t\tcurr = delim + 1\n\t}\n\n\treturn count\n}", "title": "" }, { "docid": "7e3f1684e291911b3ca97392c84e55d8", "score": "0.44905528", "text": "func (t *Table) rowsHeight() (float32, float32) {\r\n\r\n\tstart := float32(0)\r\n\theight := t.ContentHeight()\r\n\tif t.header.Visible() {\r\n\t\theight -= t.header.Height()\r\n\t\tstart += t.header.Height()\r\n\t}\r\n\tif t.statusPanel.Visible() {\r\n\t\theight -= t.statusPanel.Height()\r\n\t}\r\n\tif height < 0 {\r\n\t\treturn 0, 0\r\n\t}\r\n\treturn start, height\r\n}", "title": "" }, { "docid": "95429e89b44e299de62305cb83575890", "score": "0.4484659", "text": "func (specs TableSortSpecs) SpecsCount() int {\n\tif specs == 0 {\n\t\treturn 0\n\t}\n\treturn int(C.iggTableSortSpecsGetSpecsCount(specs.handle()))\n}", "title": "" }, { "docid": "61b3dc5925436c525f4b0e5e3b40942f", "score": "0.44835702", "text": "func printQueryOutput(\n\tw io.Writer, cols []string, allRows [][]string, tag string, pretty bool,\n) {\n\tif len(cols) == 0 {\n\t\t// This operation did not return rows, just show the tag.\n\t\tfmt.Fprintln(w, tag)\n\t\treturn\n\t}\n\n\tif pretty {\n\t\t// Initialize tablewriter and set column names as the header row.\n\t\ttable := tablewriter.NewWriter(w)\n\t\ttable.SetAutoFormatHeaders(false)\n\t\ttable.SetAutoWrapText(false)\n\t\ttable.SetHeader(cols)\n\t\tfor _, row := range allRows {\n\t\t\tfor i, r := range row {\n\t\t\t\trow[i] = expandTabsAndNewLines(r)\n\t\t\t}\n\t\t\ttable.Append(row)\n\t\t}\n\t\ttable.Render()\n\t\tnRows := len(allRows)\n\t\tfmt.Fprintf(w, \"(%d row%s)\\n\", nRows, util.Pluralize(int64(nRows)))\n\t} else {\n\t\tif len(cols) == 0 {\n\t\t\t// No result selected, inform the user.\n\t\t\tfmt.Fprintln(w, tag)\n\t\t} else {\n\t\t\t// Some results selected, inform the user about how much data to expect.\n\t\t\tfmt.Fprintf(w, \"%d row%s\\n\", len(allRows),\n\t\t\t\tutil.Pluralize(int64(len(allRows))))\n\n\t\t\t// Then print the results themselves.\n\t\t\tfmt.Fprintln(w, strings.Join(cols, \"\\t\"))\n\t\t\tfor _, row := range allRows {\n\t\t\t\tfmt.Fprintln(w, strings.Join(row, \"\\t\"))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "566bb449ceeb52d6baa1ca875fb7e3b7", "score": "0.44733536", "text": "func renderTable(repos []*github.Repository, writer io.Writer) {\n\ttable := tablewriter.NewWriter(writer)\n\ttable.SetHeader(headers)\n\n\tfor _, repo := range repos {\n\t\tr := newRepo(repo)\n\t\ttable.Append(r.RepoString())\n\t}\n\n\ttable.Render()\n}", "title": "" }, { "docid": "7d824481203c80e04482e779878ff617", "score": "0.44683373", "text": "func (th *TableHandler) GetEmptySeatsCount(c echo.Context) (err error) {\n\tres := &getSeatsEmptyResponse{}\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\t// Query database\n\tcount, err := th.dbSvc.GetEmptySeatsCount(c.Request().Context())\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Map response fields\n\tres.SeatsEmpty = int64(count)\n\t// Return ok\n\treturn c.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "c7b9d2b44253b0c070e4ab6a5ddd62db", "score": "0.44624427", "text": "func (c *Counter) PrintAsTable(highlight bool) {\n\tif c == nil || len(c.topicStats) == 0 {\n\t\treturn\n\t}\n\ttable := tabular.NewTable(highlight,\n\t\ttabular.C(\"Topic\").Align(tabular.AlignLeft),\n\t\ttabular.C(\"Succeeded\"),\n\t\ttabular.C(\"Failed\"))\n\n\tfor topic, s := range c.topicStats {\n\t\tfailed := format.RedIfTrue(humanize.Comma(s.failure), func() bool {\n\t\t\treturn s.failure > 0\n\t\t}, highlight)\n\n\t\tsucceeded := format.GreenIfTrue(humanize.Comma(s.success), func() bool {\n\t\t\treturn s.success > 0\n\t\t}, highlight)\n\t\ttable.AddRow(topic, succeeded, failed)\n\t}\n\ttable.SetTitle(\"SUMMARY\")\n\ttable.TitleAlignment(tabular.AlignCenter)\n\ttable.Render()\n}", "title": "" }, { "docid": "b2926fff1563b13be3692e70f481b59f", "score": "0.4455558", "text": "func (b *Bill) drawBillTable(headers []string, values []string) {\n\tb.pdf.SetFillColor(255, 0, 0)\n\tb.whiteText()\n\tb.pdf.SetDrawColor(64, 64, 64)\n\tb.lightFillColor()\n\tb.pdf.SetLineWidth(0.3)\n\tb.pdf.SetFont(b.config.Business.SerifFont, \"B\", 10)\n\n\tbaseY := b.pdf.GetY() + 10\n\tb.pdf.SetY(baseY)\n\tfor _, header := range headers {\n\t\twidth := float64(len(header)) * 4.9\n\t\tb.pdf.CellFormat(width, 5, header, \"1\", 0, \"C\", true, 0, \"\")\n\t}\n\n\tb.pdf.Ln(5)\n\tb.pdf.SetFillColor(255, 255, 255)\n\tb.blackText()\n\tb.pdf.SetFont(b.config.Business.SerifFont, \"\", 8)\n\tfor i, val := range values {\n\t\twidth := float64(len(headers[i])) * 4.9\n\t\tb.pdf.CellFormat(width, 4, val, \"1\", 0, \"L\", true, 0, \"\")\n\t}\n\n}", "title": "" }, { "docid": "d31f6503651e651449d97865393bdc42", "score": "0.44540688", "text": "func PageTable(c *fiber.Ctx) {\n\tgameSlug := strings.ToLower(c.Params(\"slug\"))\n\n\tgame, err := models.GetGameBy(\"slug\", gameSlug)\n\tif err != nil {\n\t\tc.SendStatus(404)\n\t\tRenderPage(c, \"error\", pageVars(fiber.Map{}))\n\t\treturn\n\t}\n\n\tgameObject, err := json.Marshal(game)\n\tif err != nil {\n\t\tc.SendStatus(500)\n\t\tRenderPage(c, \"error\", pageVars(fiber.Map{}))\n\t\treturn\n\t}\n\n\tgameAsset := getGameAssetName(game)\n\tRenderPage(c, \"table\", pageVars(fiber.Map{\n\t\t\"title\": fmt.Sprintf(\"%s | QCards Table\", game.Name),\n\t\t\"stylesheets\": []string{\"game\", gameAsset},\n\t\t\"scripts\": []string{gameAsset},\n\t\t\"game\": string(gameObject),\n\t\t\"gameOwner\": game.OwnerID,\n\t}))\n}", "title": "" }, { "docid": "e3bb456c5868e455892b67863fe94f16", "score": "0.44409123", "text": "func renderAndResetTable(t table.Writer) {\n\n\tt.Render()\n\n\tt.ResetHeaders()\n\tt.ResetRows()\n\tt.ResetFooters()\n\n}", "title": "" }, { "docid": "8efde60db404cf2050c2b3441f0210c7", "score": "0.4433031", "text": "func (c ColDate) Rows() int {\n\treturn len(c)\n}", "title": "" }, { "docid": "a679f457afddc6ee6f5f5f5f0ab751bd", "score": "0.4424856", "text": "func (v *InvoiceCollection) Table() string {\n\t// vheads := []string{\"項次\", \"表頭\", \"發票狀態\", \"發票號碼\", \"發票日期\",\n\t// \t\"商店統編\", \"商店店名\", \"載具名稱\", \"載具號碼\", \"總金額\"}\n\t// dheads := []string{\"項次\", \"表頭\", \"發票號碼\", \"小計\", \"品項名稱\"}\n\n\t// nv := len(pinvs)\n\tvheads := append([]string{\"項次\"}, invoiceCtagNames...)\n\tdheads := append([]string{\"項次\"}, detailCtagNames...)\n\tvsizes, dsizes := util.GetSizes(vheads), util.GetSizes(dheads)\n\tvnf, dnf := len(vheads), len(dheads)\n\n\tvdata, vsizes, ddata, dsizes := v.stringSlice(vsizes, dsizes)\n\n\tvar b bytes.Buffer\n\tbws := b.WriteString\n\n\tvn := util.Isum(vsizes...) + 2*vnf // + vnf + (vnf - 1) + 1\n\ttitle := \"發票清單\"\n\t_, _, vl := util.CountChars(title)\n\tvm := (vn - vl) / 2\n\tbws(util.StrSpaces(vm) + title + \"\\n\")\n\n\tisleft := true\n\tvheads[vnf-1] = util.AlignToRight(vheads[vnf-1], vsizes[vnf-1]) // Title\n\tvhtab := util.StrThickLine(vn)\n\tvhtab += sliceToString(\"\", &vheads, vsizes, isleft)\n\tvhtab += \"\\n\" + util.StrThinLine(vn)\n\n\tlspaces := util.StrSpaces(5)\n\tdn := util.Isum(dsizes...) + dnf*2 //+ dnf + (dnf - 1) + 1\n\tdheads[dnf-2] = util.AlignToRight(dheads[dnf-2], dsizes[dnf-2]) // SubTitle\n\tdhtab := lspaces + util.StrThickLine(dn)\n\tdhtab += sliceToString(lspaces, &dheads, dsizes, isleft)\n\tdhtab += \"\\n\" + lspaces + util.StrThinLine(dn)\n\n\tfor i := 0; i < len(vdata); i++ {\n\t\tbws(vhtab)\n\t\tbws(getInvoiceTableRowString(&vdata[i], \"\", i+1, vsizes, isleft))\n\t\tbws(\"\\n\")\n\n\t\tbws(dhtab)\n\t\tfor j := 0; j < len(ddata[i]); j++ {\n\t\t\tbws(getDeailTableRowString(&ddata[i][j], lspaces, j+1, dsizes, isleft))\n\t\t\tbws(\"\\n\")\n\t\t}\n\t\tbws(lspaces + util.StrThickLine(dn))\n\t}\n\n\treturn b.String()\n\n}", "title": "" }, { "docid": "f624ab78fd968ad1ad37c10aeada7132", "score": "0.4422143", "text": "func getFirstDrawResults(dtData dtPaginationData) error {\n\trows, err := dtData.db.Table(dtData.tableName).Select(\"COUNT(*)\").Rows()\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"could not execute query to get the rowcount of the entire '%v' table %w\", dtData.tableName, err,\n\t\t)\n\t}\n\n\tdefer func() {\n\t\t_ = rows.Close()\n\n\t\terr = rows.Err()\n\t}()\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"row error occurred %w\", err)\n\t}\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&final)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not scan row to &final %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c6a719d753a40c28093512468d146ea", "score": "0.4413619", "text": "func printTable(out io.Writer, rows [][]string) {\n\ttw := tablewriter.NewWriter(out)\n\ttw.AppendBulk(rows)\n\ttw.Render()\n}", "title": "" }, { "docid": "7935d5a7e707513e27c6d31cf6e005f2", "score": "0.4409741", "text": "func (row *Row) Buffer() termui.Buffer {\n\tbuf := termui.NewBuffer()\n\t//This set the background of the whole row\n\tbuf.Area.Min = image.Point{row.X, row.Y}\n\tbuf.Area.Max = image.Point{row.X + row.Width, row.Y + row.Height}\n\tbuf.Fill(' ', row.ParColumns[0].TextFgColor, row.ParColumns[0].TextBgColor)\n\n\tfor _, col := range row.Columns {\n\t\tbuf.Merge(col.Buffer())\n\t}\n\treturn buf\n}", "title": "" }, { "docid": "1ab4d5ad9f1d29ba7e55084bfa21397e", "score": "0.4404504", "text": "func (*mySQL) GetRowCount(r RequestAgGrid, rows int) int64 {\n\tif rows == 0 {\n\t\treturn 0\n\t}\n\n\tcurrentLastRow := r.StartRow + int64(rows)\n\n\tif currentLastRow <= r.EndRow {\n\t\treturn currentLastRow\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "2d59f354c4111cd670849dff3b0cd8df", "score": "0.44035596", "text": "func (m *TaskManager) GetWIPTableLen() (lenWIPTable int) {\n\tm.WIPTable.Range(func(key, value interface{}) bool {\n\t\tlenWIPTable++\n\t\treturn true\n\t})\n\treturn\n}", "title": "" }, { "docid": "ef15c68279a7166db259dc64feddf17b", "score": "0.4393865", "text": "func formatTable(tbl string) string {\n\ttbl = tbl[:12] + \"\\n\" + tbl[12:]\n\ttbl = tbl[:26] + \"\\n\" + tbl[26:]\n\ttbl = tbl[:39] + \"\\n\" + tbl[39:]\n\ttbl = tbl[:53] + \"\\n\" + tbl[53:]\n\treturn tbl\n}", "title": "" }, { "docid": "85cdbcbf7e65d92947a8d7dceb868127", "score": "0.4393227", "text": "func (me TxsdPresentationAttributesGraphicsDisplay) IsTable() bool { return me.String() == \"table\" }", "title": "" }, { "docid": "6ef9d307127b066895c2311322c488c4", "score": "0.4390802", "text": "func Table(dataHeader []string, data [][]string) {\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader(dataHeader)\n\tfor _, v := range data {\n\t\ttable.Append(v)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "c49278670405f4df13350fb3efb1fd7a", "score": "0.43899292", "text": "func (ri *Interpreter) Render(w io.Writer, file *parser.File, hr table.Renderer) error {\n\tvar err error\n\tbw := bufio.NewWriter(w) //buffer the writer to speed up writing\n\ttables := file.Tables()\n\t_ = hr.SetWriter(bw)\n\tif err = hr.SetSettings(ri.settings); err != nil {\n\t\treturn fmt.Errorf(\"failed to render table: %s\", err)\n\t}\n\t_ = hr.SetTables(tables)\n\tif err = hr.StartFile(); err != nil {\n\t\treturn fmt.Errorf(\"failed to render table: %s\", err)\n\t}\n\tfor i, t := range tables {\n\t\tif err = t.Run(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to run one or more commands for table: %s\", err)\n\t\t}\n\t\tri.job.UI.Logf(\"****processed contents of table %d\\n%v\\n\", i+1, t.ProcessedTableContents().DebugString())\n\t\tif err = t.Render(w, hr); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to render table %d: %s\", i+1, err)\n\t\t}\n\t}\n\tif err = hr.EndFile(); err != nil {\n\t\treturn fmt.Errorf(\"failed to render table: %s\", err)\n\t}\n\treturn bw.Flush() //flush to ensure all changes are written to the writer\n}", "title": "" }, { "docid": "069b727329634a8aedda68716f746280", "score": "0.438543", "text": "func Table(nextSlide func()) (title string, info string, content cview.Primitive) {\n\ttable := cview.NewTable()\n\ttable.SetFixed(1, 1)\n\tfor row, line := range strings.Split(tableData, \"\\n\") {\n\t\tfor column, cell := range strings.Split(line, \"|\") {\n\t\t\tcolor := cview.Styles.PrimaryTextColor\n\t\t\tif row == 0 {\n\t\t\t\tcolor = cview.Styles.SecondaryTextColor\n\t\t\t} else if column == 0 {\n\t\t\t\tcolor = cview.Styles.TertiaryTextColor\n\t\t\t}\n\t\t\talign := cview.AlignLeft\n\t\t\tif row == 0 {\n\t\t\t\talign = cview.AlignCenter\n\t\t\t} else if column == 0 || column >= 4 {\n\t\t\t\talign = cview.AlignRight\n\t\t\t}\n\t\t\ttableCell := cview.NewTableCell(cell)\n\t\t\ttableCell.SetTextColor(color)\n\t\t\ttableCell.SetAlign(align)\n\t\t\ttableCell.SetSelectable(row != 0 && column != 0)\n\t\t\tif column >= 1 && column <= 3 {\n\t\t\t\ttableCell.SetExpansion(1)\n\t\t\t}\n\t\t\ttable.SetCell(row, column, tableCell)\n\t\t}\n\t}\n\ttable.SetBorder(true)\n\ttable.SetTitle(\"Table\")\n\n\tcode := cview.NewTextView()\n\tcode.SetWrap(false)\n\tcode.SetDynamicColors(true)\n\tcode.SetPadding(1, 1, 2, 0)\n\n\tlist := cview.NewList()\n\n\tbasic := func() {\n\t\ttable.SetBorders(false)\n\t\ttable.SetSelectable(false, false)\n\t\ttable.SetSeparator(' ')\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableBasic)\n\t}\n\n\tseparator := func() {\n\t\ttable.SetBorders(false)\n\t\ttable.SetSelectable(false, false)\n\t\ttable.SetSeparator(cview.Borders.Vertical)\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableSeparator)\n\t}\n\n\tborders := func() {\n\t\ttable.SetBorders(true)\n\t\ttable.SetSelectable(false, false)\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableBorders)\n\t}\n\n\tselectRow := func() {\n\t\ttable.SetBorders(false)\n\t\ttable.SetSelectable(true, false)\n\t\ttable.SetSeparator(' ')\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableSelectRow)\n\t}\n\n\tselectColumn := func() {\n\t\ttable.SetBorders(false)\n\t\ttable.SetSelectable(false, true)\n\t\ttable.SetSeparator(' ')\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableSelectColumn)\n\t}\n\n\tselectCell := func() {\n\t\ttable.SetBorders(false)\n\t\ttable.SetSelectable(true, true)\n\t\ttable.SetSeparator(' ')\n\t\tcode.Clear()\n\t\tfmt.Fprint(code, tableSelectCell)\n\t}\n\n\tnavigate := func() {\n\t\tapp.SetFocus(table)\n\t\ttable.SetDoneFunc(func(key tcell.Key) {\n\t\t\tapp.SetFocus(list)\n\t\t})\n\t\ttable.SetSelectedFunc(func(row int, column int) {\n\t\t\tapp.SetFocus(list)\n\t\t})\n\t}\n\n\tlist.ShowSecondaryText(false)\n\tlist.SetPadding(1, 1, 2, 2)\n\n\tvar demoTableText = []struct {\n\t\ttext string\n\t\tshortcut rune\n\t\tselected func()\n\t}{\n\t\t{\"Basic table\", 'b', basic},\n\t\t{\"Table with separator\", 's', separator},\n\t\t{\"Table with borders\", 'o', borders},\n\t\t{\"Selectable rows\", 'r', selectRow},\n\t\t{\"Selectable columns\", 'c', selectColumn},\n\t\t{\"Selectable cells\", 'l', selectCell},\n\t\t{\"Navigate\", 'n', navigate},\n\t\t{\"Next slide\", 'x', nextSlide},\n\t}\n\n\tfor _, tableText := range demoTableText {\n\t\titem := cview.NewListItem(tableText.text)\n\t\titem.SetShortcut(tableText.shortcut)\n\t\titem.SetSelectedFunc(tableText.selected)\n\t\tlist.AddItem(item)\n\t}\n\n\tbasic()\n\n\tsubFlex := cview.NewFlex()\n\tsubFlex.SetDirection(cview.FlexRow)\n\tsubFlex.AddItem(list, 10, 1, true)\n\tsubFlex.AddItem(table, 0, 1, false)\n\n\tflex := cview.NewFlex()\n\tflex.AddItem(subFlex, 0, 1, true)\n\tflex.AddItem(code, codeWidth, 1, false)\n\n\treturn \"Table\", \"\", flex\n}", "title": "" }, { "docid": "413cdb16b580de0ab0f350f3a32eec09", "score": "0.43849626", "text": "func (m *Metrics) RecordTableCount(status string, err error) {\n\tvar result string\n\tif err != nil {\n\t\tresult = TableResultFailure\n\t} else {\n\t\tresult = TableResultSuccess\n\t}\n\tm.TableCounter.WithLabelValues(status, result).Inc()\n}", "title": "" }, { "docid": "86f517d7f3120b58c08cdc905feed7f8", "score": "0.438236", "text": "func (t *Table) Size() int {\n\treturn t.size\n}", "title": "" }, { "docid": "ec7d59ffb7e16cbc251de5790bd45982", "score": "0.4376849", "text": "func Table(headers []string, data [][]string) {\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader(headers)\n\tfor _, v := range data {\n\t\ttable.Append(v)\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "ce967f2ccb5e076066157afcedfb0562", "score": "0.4376058", "text": "func (d *Inbrs) DisplayTable(w io.Writer) {\n\tvar data [][]string\n\tfor _, s := range d.list {\n\t\tdata = append(data, []string{s.hostname, s.intName, s.area,\n\t\t\ts.remoteID, s.fwAddress.String()})\n\t}\n\ttable := tablewriter.NewWriter(w)\n\ttable.SetHeader([]string{\"hostname\", \"interface\", \"area\", \"remote id\", \"FW address\"})\n\tfor _, v := range data {\n\t\ttable.Append(v)\n\t}\n\ttable.Render() // Send output\n}", "title": "" }, { "docid": "152591d09b4b482fce0d11f4c47ca95e", "score": "0.43758658", "text": "func (g *Game) tidyTable() {\n\tdealt := g.countCardsDealt()\n\tif dealt < 12 {\n\t\tg.dealRandom(12 - dealt)\n\t}\n\t// TODO: check for caps\n\t// TODO: consolidate cards\n}", "title": "" }, { "docid": "51797f7bcfc5cccaecc0e1615a30d4a1", "score": "0.4370938", "text": "func (t *Tabulator) Tabulate() int {\n\n\tfor {\n\n\t\t// Have we reached the end of the instruction list?\n\t\tif t.position >= len(t.instructions) {\n\t\t\tt.completed = true\n\t\t\tbreak\n\t\t}\n\n\t\t// Check to see if we are executing an instruction for the second time.\n\t\t// If so, halt operation.\n\t\tif contains(t.position, t.history) {\n\t\t\tbreak\n\t\t}\n\n\t\tt.DoTick()\n\t}\n\n\treturn t.accumulator\n}", "title": "" }, { "docid": "55b1cfa18db1d8a9424c2e781aa5d8a6", "score": "0.43655637", "text": "func NewTable() *Table {\n\tbuf := bytes.NewBuffer([]byte{})\n\tw := NewColWriter(buf, \" | \")\n\tw.PadLastColumn = true\n\tw.DecorateLine = func(line string) string {\n\t\tif strings.HasPrefix(line, \"-\") {\n\t\t\tline = strings.ReplaceAll(line, \"|\", \"+\")\n\t\t\tline = strings.ReplaceAll(line, \" \", \"-\")\n\n\t\t\treturn \"+-\" + line + \"-+\"\n\t\t}\n\n\t\treturn \"| \" + line + \" |\"\n\t}\n\n\treturn &Table{buf: buf, w: w}\n}", "title": "" }, { "docid": "a7dfc2df4e2984d4ebe1bbd5c39dcab6", "score": "0.43584925", "text": "func (t *Table) reCalcView() {\n\tif len(t.out) == 0 {\n\t\treturn\n\t}\n\t// Adjust the visible rows based on the available\n\t// height.\n\tif t.visibleRows < t.height-skipRows {\n\t\tt.visibleRows = t.height - skipRows\n\t}\n\t// Avoid overflow if the number of displayed rows\n\t// is greater than the number of available rows.\n\tif t.offset+t.visibleRows > len(t.out) {\n\t\tt.visibleRows = len(t.out) - t.offset\n\t}\n\t// Avoid underflow if the table height is less than the top left\n\t// corner of the table.\n\tif t.visibleRows < 0 {\n\t\tt.visibleRows = 0\n\t}\n\tt.Table.Rows = t.out[t.offset : t.offset+t.visibleRows]\n}", "title": "" }, { "docid": "8d5aaa53ef33ba4cdc121a7ab63fadfb", "score": "0.435676", "text": "func Table() error {\n\tm, err := fpl.Elements()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Position\", \"Name\", \"Form\", \"Transfers in\", \"Team\", \"FDR\"})\n\ttable.SetAutoMergeCells(true)\n\ttable.SetRowLine(true)\n\ttable.SetAutoWrapText(false)\n\n\tkeys := make([]int, len(m))\n\tfor k := range m {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Ints(keys)\n\n\tfor _, k := range keys {\n\t\tfor _, e := range m[k] {\n\t\t\ttable.Append([]string{\n\t\t\t\tposition(k),\n\t\t\t\te.WebName,\n\t\t\t\tfmt.Sprintf(\"%.1f\", e.Form),\n\t\t\t\tstrconv.Itoa(e.TransfersIn),\n\t\t\t\te.Team.Name,\n\t\t\t\tfdr(e.Difficulties),\n\t\t\t})\n\t\t}\n\t}\n\n\ttable.Render()\n\treturn nil\n}", "title": "" }, { "docid": "6b5f42f242d0ad2b634a0e31e89f15ed", "score": "0.43534628", "text": "func assembleTable(m *TuiModel) string {\n\tif m.renderSelection {\n\t\treturn displaySelection(m)\n\t}\n\n\treturn displayTable(m)\n}", "title": "" }, { "docid": "18c23f7e5b088a29aa1e26295e4f36bf", "score": "0.43471777", "text": "func Table(z *html.Tokenizer) renderer.Table {\n\treturn renderer.Table{\n\t\tContent: parseTable(z),\n\t}\n}", "title": "" }, { "docid": "e7c250be88417564fef80b8e4c1951ad", "score": "0.43439037", "text": "func rowSpace(radius float64) float64 {\n\treturn 2.0 * radius\n}", "title": "" }, { "docid": "46631d1ae5ee4f9b83de86b74d67acfa", "score": "0.4341583", "text": "func terminalWidth() (int, error) {\n\treturn 0, errors.New(\"Not supported\")\n}", "title": "" }, { "docid": "241425c0bdf4d6758842199daea7f32e", "score": "0.43410406", "text": "func table(ds *docState) nodes.Node {\n\tvar rows [][]*nodes.GridCell\n\tfor _, tr := range findChildAtoms(ds.cur, atom.Tr) {\n\t\tds.push(tr)\n\t\tr := tableRow(ds)\n\t\tds.pop()\n\t\trows = append(rows, r)\n\t}\n\tif len(rows) == 0 {\n\t\treturn nil\n\t}\n\treturn nodes.NewGridNode(rows...)\n}", "title": "" }, { "docid": "44a917b73d7254daca52124e8f6fa1b7", "score": "0.4335757", "text": "func TableToText(headers, body []string, separator string) (string, error) {\n\n\theadercount := len(headers)\n\tvar (\n\t\twidths []int\n\t\tres bytes.Buffer\n\t\tast string = \"+\"\n\t)\n\n\tfor i := range headers {\n\t\twidths = append(widths, len(headers[i]))\n\t}\n\n\tfor i := range body {\n\t\tcols := strings.Split(body[i], separator)\n\t\tif headercount != len(cols) {\n\t\t\treturn \"\", fmt.Errorf(\"header column count don't match column count in body\")\n\t\t}\n\t\tfor j := range cols {\n\t\t\tif widths[j] < len(cols[j]) {\n\t\t\t\twidths[j] = len(cols[j])\n\t\t\t}\n\t\t}\n\n\t}\n\n\tprint := func(elements []string, ws []int, a string, buf *bytes.Buffer, space string) {\n\t\tfor i := range elements {\n\t\t\tbuf.WriteString(fmt.Sprintf(\"+%s\", space))\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s\", elements[i]) + strings.Repeat(space, ws[i]-len(elements[i])))\n\t\t\tbuf.WriteString(space)\n\n\t\t\tif i == len(elements)-1 {\n\t\t\t\tbuf.WriteString(\"+\")\n\t\t\t}\n\t\t}\n\t}\n\n\tprintline := func(buf *bytes.Buffer, ws []int, a string) {\n\t\tvar e []string\n\t\te = make([]string, len(ws))\n\t\tfor i := range ws {\n\t\t\te[i] = strings.Repeat(a, ws[i])\n\t\t}\n\t\tprint(e, ws, a, buf, a)\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\n\tprintline(&res, widths, ast)\n\tprint(headers, widths, ast, &res, \" \")\n\tres.WriteString(\"\\n\")\n\tprintline(&res, widths, ast)\n\n\tfor i := range body {\n\t\trow := body[i]\n\t\tprint(strings.Split(row, separator), widths, ast, &res, \" \")\n\t\tres.WriteString(\"\\n\")\n\t}\n\n\tprintline(&res, widths, ast)\n\n\treturn res.String(), nil\n}", "title": "" }, { "docid": "20cbe4a1b377ce603dc93999d2c8ae8d", "score": "0.43337655", "text": "func (s *TransactionRows) Count() int {\n\t// return s.iter.\n\treturn 0\n}", "title": "" }, { "docid": "d34a9be3d9735d2c7519b9c95482b706", "score": "0.43332765", "text": "func (t Table) String() string {\n\ttotal := fmt.Sprintf(\"\\n\")\n\tfor i, stack := range t {\n\t\tvar label string\n\t\tswitch i {\n\t\tcase 0, 1, 2, 3, 5:\n\t\t\tlabel = fmt.Sprintf(\" %d\", i+1)\n\t\tcase 4:\n\t\t\tlabel = fmt.Sprintf(\"4s\")\n\t\tcase 6:\n\t\t\tlabel = fmt.Sprintf(\" %d\", 8)\n\t\tcase 7:\n\t\t\tlabel = fmt.Sprintf(\" %d\", 9)\n\t\tcase 8:\n\t\t\tlabel = fmt.Sprintf(\"%d\", 12)\n\t\tcase 9:\n\t\t\tlabel = fmt.Sprintf(\"%d\", 16)\n\t\tdefault:\n\t\t\tfmt.Println(\"default\")\n\t\t}\n\t\ttotal += fmt.Sprintf(\"[%s] --> %v\\n\", label, stack)\n\t}\n\treturn total\n}", "title": "" }, { "docid": "7bc39d8a77cba8545d8d2c4ac2846b73", "score": "0.43125814", "text": "func (tt *TtTable) Len() uint64 {\n\treturn tt.numberOfEntries\n}", "title": "" } ]
d5ae7d9535aa15087c05be38e59aff30
ReadResponse reads a server response into the received o.
[ { "docid": "08265ef806002dffc99ba41633ecd0bd", "score": "0.0", "text": "func (o *CreateUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCreateUserOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewCreateUserBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewCreateUserInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" } ]
[ { "docid": "6fdd59ce184882917575926ac12d73e6", "score": "0.7880432", "text": "func (o *BindServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewBindServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewBindServerUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewBindServerForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewBindServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "88b427bded639a6df5b315866601de86", "score": "0.77676487", "text": "func ReadResponse(e EventLog, context interface{}, mx time.Duration, rid string, in sumex.Streams) (*coquery.Response, coquery.ResponseError) {\n\te.Log(context, \"ReadResponse\", \"Started : RequestID[%s]\", rid)\n\n\tvar res *coquery.Response\n\tvar rerr coquery.ResponseError\n\n\t// Collect the coquery.Response and error channels\n\trs, re := ResponseStream(e, context, mx, rid, in)\n\n\tselect {\n\tcase res = <-rs:\n\tcase rerr = <-re:\n\t}\n\n\tif rerr != nil {\n\t\te.Error(context, \"ReadResponse\", rerr, \"Completed\")\n\t\treturn nil, rerr\n\t}\n\n\te.Log(context, \"ReadResponse\", \"Completed\")\n\treturn res, nil\n}", "title": "" }, { "docid": "c90f8b94ea4ae4d4fd8f7c1735021de9", "score": "0.76934534", "text": "func ReadResponse(resp *protos.Response) *Response {\n\treturn &Response{\n\t\tnodes: []*protos.Node{resp.GetN()[0]},\n\t}\n}", "title": "" }, { "docid": "b7639ff8cdebb390cf3d35690a064c7f", "score": "0.759287", "text": "func ReadResponse(r *bufio.Reader) (res *Response, err error) {\n\tres = new(Response)\n\t// read response line\n\tvar s string\n\tif s, err = readLine(r); err != nil {\n\t\treturn\n\t}\n\tproto, code, status, ok := parseResponseLine(s)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid response: %s\", s)\n\t}\n\tif err := checkVersion(proto); err != nil {\n\t\treturn nil, err\n\t}\n\tres.StatusCode = code\n\tres.Status = status\n\n\t// read headers\n\tres.Header, err = ReadHeader(r)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// read body\n\tif cl := res.Header.Get(\"Content-Length\"); cl != \"\" {\n\t\tlength, err := strconv.ParseInt(cl, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid Content-Length: %v\", err)\n\t\t}\n\t\tres.Body = make([]byte, length)\n\t\tif _, err := io.ReadFull(r, res.Body); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c0991293459d87c2f43a56100a28406e", "score": "0.75271106", "text": "func (o *DeleteNetworkHTTPServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteNetworkHTTPServerNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "2748ac3736c866a85dabd42d8e69e114", "score": "0.75138617", "text": "func (o *SendBroadcastReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewSendBroadcastAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewSendBroadcastForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "4805de645c122da4361398fdd68485fc", "score": "0.7487366", "text": "func (o *ListServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewListServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewListServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 409:\n\t\tresult := NewListServerConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewListServerInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "783cb3da3b1457180e2d3b08ddd07b3d", "score": "0.7412997", "text": "func (o *AboutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAboutOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewAboutUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e6e83f086112c1a58c5897ad27d20859", "score": "0.73999643", "text": "func (c *Conn) ReadResponse() (*Response, error) {\n\tvar resp *Response\n\tvar statusCode int\n\tfor {\n\t\tline, err := c.conn.ReadLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tc.debugf(\"Read line: %v\", line)\n\n\t\t// Parse the line that was just read.\n\t\tif len(line) < 4 {\n\t\t\treturn nil, c.protoErr(\"Truncated response: %v\", line)\n\t\t}\n\t\tif code, err := strconv.Atoi(line[0:3]); err != nil || code < 100 {\n\t\t\treturn nil, c.protoErr(\"Invalid status code: %v\", line[0:3])\n\t\t} else if resp == nil {\n\t\t\tresp = &Response{}\n\t\t\tstatusCode = code\n\t\t} else if code != statusCode {\n\t\t\t// The status code should stay fixed for all lines of the response, since events can't be interleaved with\n\t\t\t// response lines.\n\t\t\treturn nil, c.protoErr(\"Status code changed: %v != %v\", code, statusCode)\n\t\t}\n\t\tresp.RawLines = append(resp.RawLines, line)\n\t\tswitch line[3] {\n\t\tcase ' ':\n\t\t\t// Final line in the response.\n\t\t\tresp.Reply = line[4:]\n\t\t\tresp.Err = statusCodeToError(statusCode, resp.Reply)\n\t\t\treturn resp, nil\n\t\tcase '-':\n\t\t\t// Continuation, keep reading.\n\t\t\tresp.Data = append(resp.Data, line[4:])\n\t\tcase '+':\n\t\t\t// A \"dot-encoded\" payload follows.\n\t\t\tdotBody, err := c.conn.ReadDotBytes()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdotBodyStr := strings.TrimRight(string(dotBody), \"\\n\\r\")\n\t\t\t// c.debugf(\"Read dot body:\\n---\\n%v\\n---\", dotBodyStr)\n\t\t\tresp.Data = append(resp.Data, line[4:]+\"\\r\\n\"+dotBodyStr)\n\t\t\tdotLines := strings.Split(dotBodyStr, \"\\n\")\n\t\t\tfor _, dotLine := range dotLines[:len(dotLines)-1] {\n\t\t\t\tresp.RawLines = append(resp.RawLines, dotLine)\n\t\t\t}\n\t\t\tresp.RawLines = append(resp.RawLines, \".\")\n\t\tdefault:\n\t\t\treturn nil, c.protoErr(\"Invalid separator: '%v'\", line[3])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f5d046606b0bc699cc6a02a5505fa47", "score": "0.73965615", "text": "func (o *VerifyLdapCloseConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewVerifyLdapCloseConnectionCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewVerifyLdapCloseConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewVerifyLdapCloseConnectionUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewVerifyLdapCloseConnectionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9caab7b204c4944e412a6c9a6a6dad1a", "score": "0.7395565", "text": "func (o *UnsubscribeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUnsubscribeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "57a3831c6c446460066f37f35dc242ab", "score": "0.738551", "text": "func (o *WeaviatePeersMetaEchoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewWeaviatePeersMetaEchoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewWeaviatePeersMetaEchoInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "c9cf70c48847c1d1a951480008749e32", "score": "0.73680997", "text": "func (o *NetworkConnectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewNetworkConnectOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewNetworkConnectForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewNetworkConnectNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewNetworkConnectInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "fa53f6af925f55ce3030a4e4c3171a81", "score": "0.7340925", "text": "func (o *CheckpointServerGetServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCheckpointServerGetServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewCheckpointServerGetServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b7c36fdfca745a3819328e3dedb4091c", "score": "0.7329891", "text": "func (o *NotifyStateChangedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201, 200:\n\t\tresult := NewNotifyStateChangedCreated()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "f63d48df40cd3f4bb7a88d44a224f9be", "score": "0.7278517", "text": "func (o *GETCargosIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGETCargosIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e4d0b5133aedb4c85132fdc21f24b1b0", "score": "0.72748125", "text": "func (o *GetPhaseForSubscriptionAndDateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetPhaseForSubscriptionAndDateOK()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "80fbe5607ed41bd95d1f15c261013c28", "score": "0.72713655", "text": "func (o *DeleteEventReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewDeleteEventNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewDeleteEventUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewDeleteEventForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "8c3f4a486dabd9e637c529741ca9cd6d", "score": "0.7260747", "text": "func (o *GetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetV2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewGetV2Unauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetV2NotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d588d760bcceb7e0338e4dbc0318f680", "score": "0.7259178", "text": "func (o *GetAntivirusServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetAntivirusServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewGetAntivirusServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "7d2d462756587e3a0b44e660ef5d5dab", "score": "0.7244727", "text": "func (o *ListServersBindingsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewListServersBindingsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewListServersBindingsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewListServersBindingsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewListServersBindingsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "66100b1ce4391229e45be5ecfbc6f905", "score": "0.72386295", "text": "func (o *HTTPProxyGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewHTTPProxyGetOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewHTTPProxyGetDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "d80902fcf422a1ceb38a7a0cb529ab45", "score": "0.7237408", "text": "func (o *PatchEtherPhysicalPortsMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPatchEtherPhysicalPortsMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPatchEtherPhysicalPortsMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "13ec5bc37695cefb156424688314b99b", "score": "0.7225038", "text": "func (o *InfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewInfoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewInfoInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f681a01e5f329a154205184b01f159d4", "score": "0.7215448", "text": "func (o *GetReadyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetReadyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 503:\n\t\tresult := NewGetReadyServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewGetReadyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "601eb3c19e4e2f29ca5dc0ab28b0d5c1", "score": "0.72148037", "text": "func (o *DeleteConnectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteConnectionNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewDeleteConnectionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewDeleteConnectionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "a5f74d65f5522abb7abf7f005b5a1cb1", "score": "0.7206709", "text": "func (o *SystemEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSystemEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSystemEventsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewSystemEventsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b48987870e472b56457e3cb57e037259", "score": "0.7205945", "text": "func (o *ResolveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewResolveOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "50d29adf8e4acdb0dfbd6e2e7ef7fef7", "score": "0.720075", "text": "func (r *Response) Read(p []byte) (n int, err error) {\n\tif r.Error != nil {\n\t\treturn -1, r.Error\n\t}\n\treturn r.RawResponse.Body.Read(p)\n}", "title": "" }, { "docid": "7bf2cedb19a39a8512c62e3afdfa09d9", "score": "0.7199875", "text": "func (o *SendReportReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewSendReportNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewSendReportBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewSendReportNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "557ae9d36a6a9bac39602fef0108f43c", "score": "0.71960676", "text": "func (o *KillQueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 400:\n\t\tresult := NewKillQueryBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewKillQueryNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 422:\n\t\tresult := NewKillQueryUnprocessableEntity()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9dd3a32ccddb0cead68ec3c8897969fd", "score": "0.7193624", "text": "func (c *Connection) readResponse() error {\n\tvar packetLength uint32\n\terr := binary.Read(c.in, binary.BigEndian, &packetLength)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpacket := make([]byte, packetLength)\n\t_, err = io.ReadFull(c.conn, packet)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trrh := &RpcResponseHeaderProto{}\n\terr = readRPCPacket(packet, rrh)\n\tcallId := rrh.CallId\n\tcall, ok := c.calls[*callId]\n\tif !ok {\n\t\t//todo\n\t}\n\tfmt.Println(\"\")\n\tfmt.Print(\"receiced call Id is: \")\n\tfmt.Println(*callId)\n\tresp := call.RpcResponse\n\t//resp := &GetFileInfoResponseProto{}\n\terr = readRPCPacket(packet, rrh, *resp)\n\tif err != nil {\n\t\t//todo\n\t}\n\t//fmt.Println(rpcResponse)\n\tdelete(c.calls, *callId)\n\tcall.rspChan <- struct{}{}\n\treturn nil\n}", "title": "" }, { "docid": "ea1dbb3f97f766a4274af540a678374a", "score": "0.7191533", "text": "func (o *PostUIAutopilotWaypointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewPostUIAutopilotWaypointNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 403:\n\t\tresult := NewPostUIAutopilotWaypointForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewPostUIAutopilotWaypointInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "c5e202ae26874edc56c30fb3119363cb", "score": "0.71895283", "text": "func (o *TraerEventosReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTraerEventosOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewTraerEventosBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1412cbb72e319aadda335834dbfa548f", "score": "0.71852624", "text": "func (o *RemoveTagReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRemoveTagOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewRemoveTagNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 405:\n\t\tresult := NewRemoveTagMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "95330507ec78acd1e3c5156c76f22b66", "score": "0.7168901", "text": "func (o *NewTOTPReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewNewTOTPOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewNewTOTPBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e49e5df04deda859dadc26ebce2fe0ea", "score": "0.71667314", "text": "func (o *CopyFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCopyFileOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f2d62a4f384f32003f3e52f1c23f3152", "score": "0.71650946", "text": "func (o *PostUnlinkPatientGUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostUnlinkPatientGUIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewPostUnlinkPatientGUIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewPostUnlinkPatientGUIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 405:\n\t\tresult := NewPostUnlinkPatientGUIDMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "4809f526b355d1cc4a2a68976ad06d44", "score": "0.71636176", "text": "func (o *GetSpoeMessageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetSpoeMessageOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetSpoeMessageNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetSpoeMessageDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "c01c7ae49edf7aaa0b1b45cb12928490", "score": "0.7160983", "text": "func (o *ReplaceRuntimeServerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewReplaceRuntimeServerOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewReplaceRuntimeServerBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewReplaceRuntimeServerNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewReplaceRuntimeServerDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "ca62b45db6e064c8a2a2bcca80b39532", "score": "0.7160835", "text": "func (o *StatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewStatusDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "03237d29a25d7e7de6575fb2b1bbe37f", "score": "0.7158718", "text": "func (o *SessionVerifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSessionVerifyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewSessionVerifyBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewSessionVerifyNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 405:\n\t\tresult := NewSessionVerifyMethodNotAllowed()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewSessionVerifyInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1e5be25200bca54d25a8049bedb7fe83", "score": "0.71551126", "text": "func (o *PowerOffMachineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewPowerOffMachineAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewPowerOffMachineForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewPowerOffMachineNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "08e90b60a4a644fd282972fd6636d62f", "score": "0.7153217", "text": "func (o *AddNodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewAddNodeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "706c276ebd41359f8c11aa7c677b0dcb", "score": "0.71495056", "text": "func (o *DeleteaspecificReminderReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteaspecificReminderNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "dfa6bea63f315d4eee1dc19cbd0647d4", "score": "0.7148206", "text": "func (o *RunsForRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRunsForRouteOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewRunsForRouteBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewRunsForRouteForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e38915393515e870ae7809b56609e405", "score": "0.7145722", "text": "func (o *GetAddressFromAliasReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetAddressFromAliasOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetAddressFromAliasBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetAddressFromAliasInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "4972a2bfb1efa74473173bf9c8e90408", "score": "0.71391666", "text": "func (rw *responseReadWriter) Read(p []byte) (n int, err error) {\n\treturn rw.buffer.Read(p)\n}", "title": "" }, { "docid": "50af78287d4699c9687913fbd9b53459", "score": "0.7133628", "text": "func (o *GetaspecificCallRecordingFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetaspecificCallRecordingFileOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1e6df5de07c9d15e4256580cc889446f", "score": "0.7133337", "text": "func (o *ContainerRestartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 204:\n\t\tresult := NewContainerRestartNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewContainerRestartNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewContainerRestartInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "eeb5149694d1305202ef55330a123cd5", "score": "0.71270204", "text": "func (o *UpdateOutputReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewUpdateOutputOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewUpdateOutputBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "ed851ee3b6ada76eac9e23b472e29982", "score": "0.71256405", "text": "func (o *PostHostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostHostNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostHostDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "1975269e9786ca219a8dc680c6c6fb33", "score": "0.71244645", "text": "func (o *AcquireChildNetworkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201:\n\t\tresult := NewAcquireChildNetworkCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 409:\n\t\tresult := NewAcquireChildNetworkConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewAcquireChildNetworkDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "42c9b96d0670a895dfaafb4cca29336e", "score": "0.7121634", "text": "func (o *FindReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewFindOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewFindDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "2b05170ee5a74e46acc59840e57ab921", "score": "0.7116978", "text": "func (o *SecurityLogForwardingModifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSecurityLogForwardingModifyOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewSecurityLogForwardingModifyDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "69f7c6be1b9a6f8514e995c03195ef31", "score": "0.7112332", "text": "func (o *PostPaPerformanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPostPaPerformanceOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "89767e257640c7cc7e97398dc6129345", "score": "0.7111056", "text": "func (o *ChargebackReversalPaymentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201, 200:\n\t\tresult := NewChargebackReversalPaymentCreated()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "4ae24715319b316b075637b533952b6d", "score": "0.7109182", "text": "func (o *PersonReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPersonOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPersonBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewPersonUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewPersonInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "2a8db292d90233cd3b32ae5969761f1e", "score": "0.7107569", "text": "func (o *PutLTENetworkIDDNSReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPutLTENetworkIDDNSNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPutLTENetworkIDDNSDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "6036f8e2a714e5271d5a20d9e2e6251f", "score": "0.7107342", "text": "func (o *SetObjStateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewSetObjStateOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e1872127c39242b8310b25bc17a4b0e6", "score": "0.7106628", "text": "func (o *CheckAvailabilityReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCheckAvailabilityOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "9fba237792cf5df729c24c7ca81896a3", "score": "0.7105635", "text": "func (o *GetIOAEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetIOAEventsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetIOAEventsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewGetIOAEventsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewGetIOAEventsTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewGetIOAEventsInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetIOAEventsDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "a63ea6c0cc871eda80213dada3ee7618", "score": "0.71035564", "text": "func (o *DeleteaspecificVoicemailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewDeleteaspecificVoicemailNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "105c6720a172136e629d36c338d1b9ce", "score": "0.71014845", "text": "func (o *ShutdownMachineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewShutdownMachineAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewShutdownMachineForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewShutdownMachineNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d65b03166f2fd7e37d415265bf479075", "score": "0.70930254", "text": "func (o *PingDriverEndpointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPingDriverEndpointOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewPingDriverEndpointNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewPingDriverEndpointInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "aa154dfe3415e5be475011b3560c73d0", "score": "0.70822", "text": "func (o *NodeInspectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewNodeInspectOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewNodeInspectNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewNodeInspectInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 503:\n\t\tresult := NewNodeInspectServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "3126617fea869e1f4e1637780206bd36", "score": "0.7081472", "text": "func (o *RestartMachineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewRestartMachineAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewRestartMachineForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewRestartMachineNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "f7019ded4e4b7dc66fc0be9ad3f58103", "score": "0.7078638", "text": "func (o *TagsReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTagsReadOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7e262223b24a732f67d461d4f7fb1248", "score": "0.707803", "text": "func (o *AssignUsingPOSTReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewAssignUsingPOSTOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewAssignUsingPOSTForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "a0091db290d07ec377391ea8d0732392", "score": "0.7076666", "text": "func (o *GetApplianceRestoresMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetApplianceRestoresMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewGetApplianceRestoresMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewGetApplianceRestoresMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "95860d612abfb13071c60a8f4e249901", "score": "0.7075394", "text": "func (o *DeleteTodoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewDeleteTodoOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewDeleteTodoNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "0d3cb0e775db7b4174b3ed975f21babf", "score": "0.70719033", "text": "func (o *RemoveAgentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRemoveAgentOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewRemoveAgentDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "eda61b8225af2cfe5ff6f6a2026c1f6e", "score": "0.7068811", "text": "func (o *GetUsingGET2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetUsingGET2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewGetUsingGET2Unauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetUsingGET2NotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "d3952ff6350a7e6773954440c048c955", "score": "0.70681673", "text": "func (o *PostStorageVirtualDrivesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostStorageVirtualDrivesMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostStorageVirtualDrivesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "0cd91924959fb477c74a3c8244d64043", "score": "0.70677066", "text": "func (o *HealthCheckReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewHealthCheckOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 503:\n\t\tresult := NewHealthCheckServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "eeb9847d3b32ac936da49092a1043ec6", "score": "0.7067466", "text": "func (o *DeleteServerProfilesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewDeleteServerProfilesMoidOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 404:\n\t\tresult := NewDeleteServerProfilesMoidNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewDeleteServerProfilesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "02bd671b399eeef4a2dd423fa66cc628", "score": "0.70671886", "text": "func (o *GetEventReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetEventOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetEventBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewGetEventUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewGetEventForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetEventNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewGetEventTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "b8d8f150d95c6e09afaadfcb7fd466f1", "score": "0.70645726", "text": "func (o *PredictReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPredictOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7b36ac6a48847bd8ef5daba3546fa9f0", "score": "0.70635635", "text": "func (o *ResizeMachineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 202:\n\t\tresult := NewResizeMachineAccepted()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewResizeMachineForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewResizeMachineNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7730356c5b3fa090721417ddade3ef8d", "score": "0.70629615", "text": "func (o *CloneListenerUsingPOSTReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCloneListenerUsingPOSTOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 401:\n\t\tresult := NewCloneListenerUsingPOSTUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewCloneListenerUsingPOSTForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewCloneListenerUsingPOSTNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewCloneListenerUsingPOSTInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "5af6f47abf8ee7d2299e57f1cdce814d", "score": "0.7060443", "text": "func (o *ReleaseChildNetworkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewReleaseChildNetworkOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 409:\n\t\tresult := NewReleaseChildNetworkConflict()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewReleaseChildNetworkDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "ab0c5e227adefd13e4ac4a78f4ef8fce", "score": "0.7056472", "text": "func (o *CreateMsgVpnJndiQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewCreateMsgVpnJndiQueueOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\tresult := NewCreateMsgVpnJndiQueueDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "17d3cc48d9e13f7ab118104ff47f37d7", "score": "0.70564514", "text": "func (o *GetHealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetHealthOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 500:\n\t\tresult := NewGetHealthInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "04343924fe4c281d41b0d49260229300", "score": "0.7056214", "text": "func (o *CommitsReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCommitsReadOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "217f01db1155217b00105b43171b0ec3", "score": "0.70556414", "text": "func (o *PostRemoteAPIJUserWhoamiReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewPostRemoteAPIJUserWhoamiOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewPostRemoteAPIJUserWhoamiUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "103ac8a6e4544bf819596cd4341d01f9", "score": "0.7054317", "text": "func (o *SemverGenerateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 201:\n\t\tresult := NewSemverGenerateCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewSemverGenerateNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewSemverGenerateInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "6f5f671b9b70aab671ce53c0575eb715", "score": "0.705283", "text": "func (o *GetBodyResourceByDatePeriodReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetBodyResourceByDatePeriodOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewGetBodyResourceByDatePeriodBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 401:\n\t\tresult := NewGetBodyResourceByDatePeriodUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "614a13f0f2013bbc476a1d9352896c3d", "score": "0.7051423", "text": "func (o *GetBundleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetBundleOK()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "c811546053602a87afa650c658e28f32", "score": "0.70486444", "text": "func (o *GetUsingGET3Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetUsingGET3OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 403:\n\t\tresult := NewGetUsingGET3Forbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e57e123d135bd1ab4954c37ad9760526", "score": "0.704851", "text": "func (o *SamlSingleLogoutRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tresult := NewSamlSingleLogoutRequestDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n}", "title": "" }, { "docid": "67c89c07a7dc22efd930cc33bc1fcd2b", "score": "0.7043387", "text": "func (o *SearchBundlesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewSearchBundlesOK()\n\t\tresult.HttpResponse = response\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\terrorResult := kbcommon.NewKillbillError(response.Code())\n\t\tif err := consumer.Consume(response.Body(), &errorResult); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errorResult\n\t}\n}", "title": "" }, { "docid": "4b62e552ce0a77e008bb9886f4452e13", "score": "0.70425063", "text": "func (o *RecoverVMFromRecycleBinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewRecoverVMFromRecycleBinOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewRecoverVMFromRecycleBinBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewRecoverVMFromRecycleBinNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewRecoverVMFromRecycleBinInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "7fef9484a0d9f3a656c44b0b65d6f2d9", "score": "0.70424986", "text": "func (o *PostServerProfilesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostServerProfilesMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostServerProfilesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "066e6562990e555119669e4c20ea96bd", "score": "0.70422995", "text": "func (o *GetVirtualCircuitReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetVirtualCircuitOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewGetVirtualCircuitUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetVirtualCircuitNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetVirtualCircuitInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\tresult := NewGetVirtualCircuitDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" }, { "docid": "03f560285641a97b1114daeed312516b", "score": "0.70422536", "text": "func (o *AddSleepReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewAddSleepOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 401:\n\t\tresult := NewAddSleepUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 403:\n\t\tresult := NewAddSleepForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "e43bd269fc1ed569ec4d5073aa8a6ee0", "score": "0.7035245", "text": "func (o *POSTCargosCargoIDDevolverReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\n\tresult := NewPOSTCargosCargoIDDevolverDefault(response.Code())\n\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.Code()/100 == 2 {\n\t\treturn result, nil\n\t}\n\treturn nil, result\n\n}", "title": "" }, { "docid": "b649445f3ca5c163d2679247f31bfaea", "score": "0.70329946", "text": "func (o *PostLolReplaysV1RoflsByGameIDDownloadGracefulReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 204:\n\t\tresult := NewPostLolReplaysV1RoflsByGameIDDownloadGracefulNoContent()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "ebe32683a9d50eb8171c6500e33d839f", "score": "0.703102", "text": "func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetStatusOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 500:\n\t\tresult := NewGetStatusInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "674061361fc3bd09110dc83f222f150e", "score": "0.7030493", "text": "func (o *EventSubscriptionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewEventSubscriptionPostCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "1b8d42f0a49e3b17062583f29d289642", "score": "0.7028006", "text": "func (o *StatsRelativeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewStatsRelativeOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 400:\n\t\tresult := NewStatsRelativeBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "title": "" }, { "docid": "50865e63b561da87751619d47db502bc", "score": "0.7027416", "text": "func (o *PostIamLdapPoliciesMoidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 201:\n\t\tresult := NewPostIamLdapPoliciesMoidCreated()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tdefault:\n\t\tresult := NewPostIamLdapPoliciesMoidDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "title": "" } ]
ad7bc16b92bfa27d42dc7d5de9994f4f
NewFsScanner creates a new FsScanner
[ { "docid": "2fbb58b23f7da0b444c32092484e2f7a", "score": "0.75737196", "text": "func NewFsScanner(root, rulespath string, output ReportInterface, debug bool) *FsScanner {\n\tf := &FsScanner{\n\t\tRoot: root,\n\t\tRulesPath: rulespath,\n\t\tRuleSet: &model.RuleSet{},\n\t\tDebug: debug,\n\t\tOutput: output,\n\t}\n\n\tf.RuleSet.ParseConfig(f.RulesPath)\n\treturn f\n}", "title": "" } ]
[ { "docid": "79b63f016acb07a12776ef1d41b54126", "score": "0.7811127", "text": "func NewScanner(fs fs.FS) *Scanner {\n\treturn &Scanner{\n\t\tFS: fs,\n\t\tSelectByName: func(item string) bool { return true },\n\t\tSelect: func(item string, fi os.FileInfo) bool { return true },\n\t\tError: func(item string, fi os.FileInfo, err error) error { return err },\n\t\tResult: func(item string, s ScanStats) {},\n\t}\n}", "title": "" }, { "docid": "cf5afef3713b24241f5f2252ded4617c", "score": "0.70625156", "text": "func newScanner(r io.Reader) *scanner {\n\treturn &scanner{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "cf5afef3713b24241f5f2252ded4617c", "score": "0.70625156", "text": "func newScanner(r io.Reader) *scanner {\n\treturn &scanner{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "eb928e270378cd2674fbe353d22d0e06", "score": "0.689838", "text": "func NewScanner(roots []*Root) *Scanner {\n\t// this feels weird\n\treturn &Scanner{roots}\n}", "title": "" }, { "docid": "1b49a72bef65cd53dbb01e8bbfa35a85", "score": "0.6897362", "text": "func NewScanner(r io.Reader, path string) *Scanner {\n\treturn &Scanner{r: r, pos: Pos{Path: path, LineNo: 1}}\n}", "title": "" }, { "docid": "ed63b47409598ce44a0b41370d552a6f", "score": "0.6871068", "text": "func NewScanner() Scanner {\n\tvar s Scanner\n\n\ts.Reset()\n\n\treturn s\n}", "title": "" }, { "docid": "adf5d986a4ccf324e62a3f1f79f36123", "score": "0.67845285", "text": "func NewScanner(mapper func([]byte) (Token, error)) *Scanner {\n\treturn &Scanner{\n\t\tmapper: mapper,\n\t}\n}", "title": "" }, { "docid": "d093c112309747d8bb48a21ff644101e", "score": "0.67645586", "text": "func NewScanner(opts ...option) *Scanner {\n\to := &options{\n\t\tclock: clock.RealClock{},\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n\treturn &Scanner{\n\t\tvs: chainguard.NewVulnSrc(),\n\t\toptions: o,\n\t}\n}", "title": "" }, { "docid": "dae2f08a8e599fca76b204753956b8a7", "score": "0.6713991", "text": "func NewScanner(r io.Reader) *Scanner {\n\ts := &Scanner{r: bufio.NewReader(r), l: 1, c: 0}\n\ts.next()\n\treturn s\n}", "title": "" }, { "docid": "b85dd4c9c76ac76f4e881d29e924e950", "score": "0.6711393", "text": "func newScanner(s string) *scanner {\n\treturn &scanner{[]rune(s), 0}\n}", "title": "" }, { "docid": "4e01482b316c7484eda1197f6d0dfea8", "score": "0.6701678", "text": "func NewScanner(r io.Reader) *Scanner {\n\tret := &Scanner{\n\t\ts: bufio.NewScanner(r),\n\t}\n\tret.s.Split(ret.findToken)\n\treturn ret\n}", "title": "" }, { "docid": "b564993b945140488021931bce929339", "score": "0.66506016", "text": "func NewScanner(r io.Reader) *Scanner {\n\ts := &Scanner{r: bufio.NewReader(r)}\n\treturn s\n}", "title": "" }, { "docid": "5b7f75de76671f602033bc3af2d24b3c", "score": "0.66285783", "text": "func NewScanner(providers []Provider, dal *dal.DAL, hub socket.IHub) *Scanner {\n\treturn &Scanner{\n\t\tproviders: providers,\n\t\tdal: dal,\n\t\thub: hub,\n\t}\n}", "title": "" }, { "docid": "ac6bbc08bd39bd89cbdfe9672c06fe1e", "score": "0.66115934", "text": "func NewScanner(ctx context.Context) Scanner {\n\treturn &scanner{\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "2d735098c648ec9e6dd6f8a9f73c5d19", "score": "0.6597481", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "2d735098c648ec9e6dd6f8a9f73c5d19", "score": "0.6597481", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "2d735098c648ec9e6dd6f8a9f73c5d19", "score": "0.6597481", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "491ae256f7f730949d5d0d15d688c4b2", "score": "0.6595847", "text": "func NewScanner(ctMap maps.Map, scanners ...EntryScanner) *Scanner {\n\treturn &Scanner{\n\t\tctMap: ctMap,\n\t\tscanners: scanners,\n\t\tstopCh: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "1e7c2896173866786728207a27d11bdc", "score": "0.6588955", "text": "func NewScanner(shpR, dbfR io.Reader, opts ...Option) *Scanner {\n\ts := &Scanner{\n\t\tdbf: dbf.NewScanner(dbfR),\n\t\trecordsCh: make(chan *Record),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&s.opts)\n\t}\n\ts.shp = shp.NewScanner(shpR, s.opts.shp...)\n\treturn s\n}", "title": "" }, { "docid": "a5392c3d9aa65701ac41112ee656c933", "score": "0.6585232", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{\n\t\tbr: byteReader{\n\t\t\tr: r,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e2cbfca5c4ccbe77d7902da6283000f5", "score": "0.65755117", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{r: &reader{r: bufio.NewReader(r)}}\n}", "title": "" }, { "docid": "a0958ea456ff8338477198dadc94551e", "score": "0.6566114", "text": "func NewScanner(r io.Reader) *Scanner {\n\treturn &Scanner{\n\t\tr: r,\n\t}\n}", "title": "" }, { "docid": "98739bcf1fc07c109e05f3704f1a4f0c", "score": "0.65625715", "text": "func newBufScanner(r io.Reader) *bufScanner {\n\treturn &bufScanner{s: NewScanner(r)}\n}", "title": "" }, { "docid": "3aa7be92ed3594d73c9c391251065a6a", "score": "0.653519", "text": "func New(path string) *Scanner {\n\treturn &Scanner{\n\t\tConcurrency: 1,\n\t\tPath: path,\n\t}\n}", "title": "" }, { "docid": "5e669d80d0e6302a42711e8a9c132545", "score": "0.6525028", "text": "func (module *Module) NewScanner() zgrab2.Scanner {\n\treturn new(Scanner)\n}", "title": "" }, { "docid": "afa2c970d26bd796f8c0d26d9515237c", "score": "0.64655834", "text": "func NewScanner(src []byte) *Scanner {\n\treturn &Scanner{\n\t\tsrc: src,\n\t\tlines: []int{0},\n\t}\n}", "title": "" }, { "docid": "7dd69652db1150ecb4f9e6e4eafd2b9a", "score": "0.6445586", "text": "func (m *Module) NewScanner() zgrab2.Scanner {\n\treturn new(Scanner)\n}", "title": "" }, { "docid": "a981acce17cf93c9486584fb6a1840d3", "score": "0.64437944", "text": "func NewScanner(reader io.Reader) *Scanner {\n\treturn &Scanner{bufio.NewReader(reader)}\n}", "title": "" }, { "docid": "ad168e00448ad34898dd0ef244a294e2", "score": "0.6433361", "text": "func NewScanner() *Scanner {\n\treturn &Scanner{\n\t\tbrowsers: make([]*browser, maxRank),\n\t\tdevices: make([]*device, maxRank),\n\t\toses: make([]*aos, maxRank),\n\t}\n}", "title": "" }, { "docid": "a47febbec9a1ff138fea48833d40856a", "score": "0.6422227", "text": "func NewScanner(objects osm.Objects) *Scanner {\n\treturn &Scanner{\n\t\toffset: -1,\n\t\tobjects: objects,\n\t}\n}", "title": "" }, { "docid": "f6bdff444936037722d7a8db26036f27", "score": "0.6388526", "text": "func New(codec video.Codec) *fs {\n\treturn &fs{\n\t\tcodec: codec,\n\t}\n}", "title": "" }, { "docid": "9f69a1d58be0add3b53de4be29ed62c9", "score": "0.6363763", "text": "func NewScanner(reader io.Reader) *Scanner {\n\treturn &Scanner{\n\t\treader: bufio.NewReader(reader),\n\t}\n}", "title": "" }, { "docid": "5a981c5de53c8055cf4581e0696dea44", "score": "0.63539875", "text": "func NewScanner(input string) *Scanner {\n\treturn &Scanner{input: input, Row: 1}\n}", "title": "" }, { "docid": "28efc5aac854e40b26e3e59c04725484", "score": "0.6336035", "text": "func NewScanner(template string) *Scanner {\n\treturn &Scanner{input: template}\n}", "title": "" }, { "docid": "8564458938f9a40b3f862bb1e1c7324e", "score": "0.63037205", "text": "func New() (fs.FS, error) {\n\treturn newFS(0, 0)\n}", "title": "" }, { "docid": "6b832f8babb44db2306b280fb8aa11f8", "score": "0.6277438", "text": "func newFloatIteratorScanner(input FloatIterator, keys []influxql.VarRef, defaultValue interface{}) *floatIteratorScanner {\n\treturn &floatIteratorScanner{\n\t\tinput: newBufFloatIterator(input),\n\t\tkeys: keys,\n\t\tdefaultValue: defaultValue,\n\t}\n}", "title": "" }, { "docid": "4c065d9e03d63fefb4a94eae912e92c0", "score": "0.6266099", "text": "func NewScanner(binDir,ruleDir string, db * gorm.DB) (*Scanner, error) {\n\tlog.Debugf(\"NewScanner %s %s\",ruleDir,binDir)\n\twatcherBins, err := fsnotify.NewWatcher()\n\terr = watcherBins.Add(binDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twatcherRules, err := fsnotify.NewWatcher()\n\terr = watcherRules.Add(ruleDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twrp, err := NewWatchedRulesetProvider(ruleDir,db,watcherRules.Events)\n\tif err != nil {\n\t\tlog.Debugf(\"Error watcher contstruction %v\",err)\n\t\treturn nil, err\n\t}\n\tresultschan := make(chan BinaryMatches, 1000)\n\tscanningChan := make(chan fsnotify.Event, 10000)\n\treturn &Scanner{ScanningChan : scanningChan,RulesetProvider: wrp,workerwaitgroup: &sync.WaitGroup{},RuleDir: ruleDir, BinDir: binDir, resultsDB: db, watcherRules: watcherRules, watcherBins: watcherBins, resultsChan: resultschan, started: false}, nil\n}", "title": "" }, { "docid": "ef6166793d94847c82a0384f77948a71", "score": "0.6243555", "text": "func New(r io.Reader) *Scanner {\n\treturn &Scanner{\n\t\tscanner: bufio.NewScanner(r),\n\t}\n}", "title": "" }, { "docid": "bb51a4b098722a3cd63cef6f86a61519", "score": "0.6241223", "text": "func New(s Storer) *Fs {\n\tfs := &Fs{}\n\tfs.fileStorer = newFileStorer(s, fs)\n\treturn fs\n}", "title": "" }, { "docid": "c5164f602e1e09f4d3cec5c5c6c5c73e", "score": "0.62232757", "text": "func NewScanner(b []byte) *Scanner {\n\ts := Scanner{\n\t\tb: b,\n\t\tcode: make([]instr, len(b)/4),\n\t}\n\ts.decode(b)\n\ts.nextPos = 0\n\n\treturn &s\n}", "title": "" }, { "docid": "8f31b32c4d877bc04277db01d33f79e7", "score": "0.6200576", "text": "func NewFileScanner(fileName string) (*FileScanner, error) {\n\n\ttmpFile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfs := FileScanner{File: tmpFile, Logger: slf.WithContext(pwdCurr)}\n\n\tdefer fs.Logger.WithFields(slf.Fields{\n\t\t\"file\": fileName,\n\t}).Info(\"Created a new file scanner.\")\n\n\treturn &fs, nil\n}", "title": "" }, { "docid": "734ab407e92df28bb5a3828fb1c3b717", "score": "0.61987376", "text": "func NewFileScanner(paths []string,\n\tfilter Filter, updater Updater) FileScanner {\n\n\treturn &fileScannerImpl{\n\t\tcacheFiles: make(map[string]*FileAttr),\n\t\tscannedFiles: make(map[SHA256Digest][]*FileAttr),\n\t\tpaths: paths,\n\t\tfilter: filter,\n\t\tupdater: updater,\n\t\tcache: (filter.GetCacheDir() + string(os.PathSeparator) + \"global.cache\"),\n\t\thashEngine: sha256.New(),\n\t\tbuffer: make([]byte, 512*1024),\n\t}\n}", "title": "" }, { "docid": "44070ddcd8994917730a938425b123e9", "score": "0.6196989", "text": "func New(fname string, src []byte) (s *Scanner) {\n\tif len(src) > 2 && src[0] == 0xEF && src[1] == 0xBB && src[2] == 0xBF {\n\t\tsrc = src[3:]\n\t}\n\ts = &Scanner{\n\t\tsrc: src,\n\t\tNLine: 1,\n\t\tNCol: 0,\n\t\tFname: fname,\n\t}\n\ts.next()\n\treturn\n}", "title": "" }, { "docid": "d86304fdbf8a84400f33f7aadea97892", "score": "0.61711156", "text": "func NewScanner(r io.Reader) *bufio.Scanner {\n\tret := bufio.NewScanner(r)\n\tret.Split(SplitFortune)\n\treturn ret\n}", "title": "" }, { "docid": "8caf02fa3483c56ef4239ac6ff6eb66a", "score": "0.61417156", "text": "func New(ctx context.Context, r io.Reader, procs int) *Scanner {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\ts := &Scanner{\n\t\tctx: ctx,\n\t\tprocs: procs,\n\t}\n\ts.decoder = newDecoder(ctx, s, r)\n\treturn s\n}", "title": "" }, { "docid": "32b267975228789011bb267282829c39", "score": "0.6140927", "text": "func New(src []byte) *Scanner {\n\t// even though we accept a src, we read from a io.Reader compatible type\n\t// (*bytes.Buffer). So in the future we might easily change it to streaming\n\t// read.\n\tb := bytes.NewBuffer(src)\n\ts := &Scanner{\n\t\tbuf: b,\n\t\tsrc: src,\n\t}\n\n\t// srcPosition always starts with 1\n\ts.srcPos.Line = 1\n\treturn s\n}", "title": "" }, { "docid": "b6abcb257e7addec1507c4de4b93fcf6", "score": "0.61323535", "text": "func NewScanner(source string) *Scanner {\n\treturn &Scanner{source: strings.NewReader(source), line: 1}\n}", "title": "" }, { "docid": "f56a92f3901ef70529d997de60f35b14", "score": "0.61055535", "text": "func NewScanner(r io.Reader, limit int) *Scanner {\n\trs, ok := r.(io.RuneScanner)\n\tif !ok {\n\t\trs = bufio.NewReader(r)\n\t}\n\treturn &Scanner{r: rs, limit: limit, tabWidth: 4}\n}", "title": "" }, { "docid": "2d6fedddcc6cdb000ec29494e62d92ef", "score": "0.60862064", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {\n\t// This will hold the Fs object. We need to create it here\n\t// so we can refer to it in the SSH callback, but it's populated\n\t// in NewFsWithConnection\n\tf := &Fs{\n\t\tci: fs.GetConfig(ctx),\n\t}\n\t// Parse config into Options struct\n\topt := new(Options)\n\terr := configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(opt.SSH) != 0 && ((opt.User != currentUser && opt.User != \"\") || opt.Host != \"\" || (opt.Port != \"22\" && opt.Port != \"\")) {\n\t\tfs.Logf(name, \"--sftp-ssh is in use - ignoring user/host/port from config - set in the parameters to --sftp-ssh (remove them from the config to silence this warning)\")\n\t}\n\n\tif opt.User == \"\" {\n\t\topt.User = currentUser\n\t}\n\tif opt.Port == \"\" {\n\t\topt.Port = \"22\"\n\t}\n\n\tsshConfig := &ssh.ClientConfig{\n\t\tUser: opt.User,\n\t\tAuth: []ssh.AuthMethod{},\n\t\tHostKeyCallback: ssh.InsecureIgnoreHostKey(),\n\t\tTimeout: f.ci.ConnectTimeout,\n\t\tClientVersion: \"SSH-2.0-\" + f.ci.UserAgent,\n\t}\n\n\tif len(opt.HostKeyAlgorithms) != 0 {\n\t\tsshConfig.HostKeyAlgorithms = []string(opt.HostKeyAlgorithms)\n\t}\n\n\tif opt.KnownHostsFile != \"\" {\n\t\thostcallback, err := knownhosts.New(env.ShellExpand(opt.KnownHostsFile))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't parse known_hosts_file: %w\", err)\n\t\t}\n\t\tsshConfig.HostKeyCallback = hostcallback\n\t}\n\n\tif opt.UseInsecureCipher && (opt.Ciphers != nil || opt.KeyExchange != nil) {\n\t\treturn nil, fmt.Errorf(\"use_insecure_cipher must be false if ciphers or key_exchange are set in advanced configuration\")\n\t}\n\n\tsshConfig.Config.SetDefaults()\n\tif opt.UseInsecureCipher {\n\t\tsshConfig.Config.Ciphers = append(sshConfig.Config.Ciphers, \"aes128-cbc\", \"aes192-cbc\", \"aes256-cbc\", \"3des-cbc\")\n\t\tsshConfig.Config.KeyExchanges = append(sshConfig.Config.KeyExchanges, \"diffie-hellman-group-exchange-sha1\", \"diffie-hellman-group-exchange-sha256\")\n\t} else {\n\t\tif opt.Ciphers != nil {\n\t\t\tsshConfig.Config.Ciphers = opt.Ciphers\n\t\t}\n\t\tif opt.KeyExchange != nil {\n\t\t\tsshConfig.Config.KeyExchanges = opt.KeyExchange\n\t\t}\n\t}\n\n\tif opt.MACs != nil {\n\t\tsshConfig.Config.MACs = opt.MACs\n\t}\n\n\tkeyFile := env.ShellExpand(opt.KeyFile)\n\tpubkeyFile := env.ShellExpand(opt.PubKeyFile)\n\t//keyPem := env.ShellExpand(opt.KeyPem)\n\t// Add ssh agent-auth if no password or file or key PEM specified\n\tif (len(opt.SSH) == 0 && opt.Pass == \"\" && keyFile == \"\" && !opt.AskPassword && opt.KeyPem == \"\") || opt.KeyUseAgent {\n\t\tsshAgentClient, _, err := sshagent.New()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't connect to ssh-agent: %w\", err)\n\t\t}\n\t\tsigners, err := sshAgentClient.Signers()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"couldn't read ssh agent signers: %w\", err)\n\t\t}\n\t\tif keyFile != \"\" {\n\t\t\t// If `opt.KeyUseAgent` is false, then it's expected that `opt.KeyFile` contains the private key\n\t\t\t// and `${opt.KeyFile}.pub` contains the public key.\n\t\t\t//\n\t\t\t// If `opt.KeyUseAgent` is true, then it's expected that `opt.KeyFile` contains the public key.\n\t\t\t// This is how it works with openssh; the `IdentityFile` in openssh config points to the public key.\n\t\t\t// It's not necessary to specify the public key explicitly when using ssh-agent, since openssh and rclone\n\t\t\t// will try all the keys they find in the ssh-agent until they find one that works. But just like\n\t\t\t// `IdentityFile` is used in openssh config to limit the search to one specific key, so does\n\t\t\t// `opt.KeyFile` in rclone config limit the search to that specific key.\n\t\t\t//\n\t\t\t// However, previous versions of rclone would always expect to find the public key in\n\t\t\t// `${opt.KeyFile}.pub` even if `opt.KeyUseAgent` was true. So for the sake of backward compatibility\n\t\t\t// we still first attempt to read the public key from `${opt.KeyFile}.pub`. But if it fails with\n\t\t\t// an `fs.ErrNotExist` then we also try to read the public key from `opt.KeyFile`.\n\t\t\tpubBytes, err := os.ReadFile(keyFile + \".pub\")\n\t\t\tif err != nil {\n\t\t\t\tif errors.Is(err, iofs.ErrNotExist) && opt.KeyUseAgent {\n\t\t\t\t\tpubBytes, err = os.ReadFile(keyFile)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"failed to read public key file: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to read public key file: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpub, _, _, _, err := ssh.ParseAuthorizedKey(pubBytes)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to parse public key file: %w\", err)\n\t\t\t}\n\t\t\tpubM := pub.Marshal()\n\t\t\tfound := false\n\t\t\tfor _, s := range signers {\n\t\t\t\tif bytes.Equal(pubM, s.PublicKey().Marshal()) {\n\t\t\t\t\tsshConfig.Auth = append(sshConfig.Auth, ssh.PublicKeys(s))\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\treturn nil, errors.New(\"private key not found in the ssh-agent\")\n\t\t\t}\n\t\t} else {\n\t\t\tsshConfig.Auth = append(sshConfig.Auth, ssh.PublicKeys(signers...))\n\t\t}\n\t}\n\n\t// Load key file as a private key, if specified. This is only needed when not using an ssh agent.\n\tif (keyFile != \"\" && !opt.KeyUseAgent) || opt.KeyPem != \"\" {\n\t\tvar key []byte\n\t\tif opt.KeyPem == \"\" {\n\t\t\tkey, err = os.ReadFile(keyFile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to read private key file: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\t// wrap in quotes because the config is a coming as a literal without them.\n\t\t\topt.KeyPem, err = strconv.Unquote(\"\\\"\" + opt.KeyPem + \"\\\"\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"pem key not formatted properly: %w\", err)\n\t\t\t}\n\t\t\tkey = []byte(opt.KeyPem)\n\t\t}\n\t\tclearpass := \"\"\n\t\tif opt.KeyFilePass != \"\" {\n\t\t\tclearpass, err = obscure.Reveal(opt.KeyFilePass)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tvar signer ssh.Signer\n\t\tif clearpass == \"\" {\n\t\t\tsigner, err = ssh.ParsePrivateKey(key)\n\t\t} else {\n\t\t\tsigner, err = ssh.ParsePrivateKeyWithPassphrase(key, []byte(clearpass))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse private key file: %w\", err)\n\t\t}\n\n\t\t// If a public key has been specified then use that\n\t\tif pubkeyFile != \"\" {\n\t\t\tcertfile, err := os.ReadFile(pubkeyFile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to read cert file: %w\", err)\n\t\t\t}\n\n\t\t\tpk, _, _, _, err := ssh.ParseAuthorizedKey(certfile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to parse cert file: %w\", err)\n\t\t\t}\n\n\t\t\t// And the signer for this, which includes the private key signer\n\t\t\t// This is what we'll pass to the ssh client.\n\t\t\t// Normally the ssh client will use the public key built\n\t\t\t// into the private key, but we need to tell it to use the user\n\t\t\t// specified public key cert. This signer is specific to the\n\t\t\t// cert and will include the private key signer. Now ssh\n\t\t\t// knows everything it needs.\n\t\t\tcert, ok := pk.(*ssh.Certificate)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"public key file is not a certificate file: \" + pubkeyFile)\n\t\t\t}\n\t\t\tpubsigner, err := ssh.NewCertSigner(cert, signer)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error generating cert signer: %w\", err)\n\t\t\t}\n\t\t\tsshConfig.Auth = append(sshConfig.Auth, ssh.PublicKeys(pubsigner))\n\t\t} else {\n\t\t\tsshConfig.Auth = append(sshConfig.Auth, ssh.PublicKeys(signer))\n\t\t}\n\t}\n\n\t// Auth from password if specified\n\tif opt.Pass != \"\" {\n\t\tclearpass, err := obscure.Reveal(opt.Pass)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsshConfig.Auth = append(sshConfig.Auth,\n\t\t\tssh.Password(clearpass),\n\t\t\tssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) {\n\t\t\t\treturn f.keyboardInteractiveReponse(user, instruction, questions, echos, clearpass)\n\t\t\t}),\n\t\t)\n\t}\n\n\t// Config for password if none was defined and we're allowed to\n\t// We don't ask now; we ask if the ssh connection succeeds\n\tif opt.Pass == \"\" && opt.AskPassword {\n\t\tsshConfig.Auth = append(sshConfig.Auth,\n\t\t\tssh.PasswordCallback(f.getPass),\n\t\t\tssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) {\n\t\t\t\tpass, _ := f.getPass()\n\t\t\t\treturn f.keyboardInteractiveReponse(user, instruction, questions, echos, pass)\n\t\t\t}),\n\t\t)\n\t}\n\n\treturn NewFsWithConnection(ctx, f, name, root, m, opt, sshConfig)\n}", "title": "" }, { "docid": "7308cb65d71111b941332810bebaa0f4", "score": "0.6003293", "text": "func NewFileSystem(r Reader) (*FileSystem, error) {\n\tfs := &FileSystem{r: r, curdir: \"/\"}\n\n\terr := fs.findVolumes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read volume descriptor: %v\", err)\n\t}\n\n\tfs.buildCache()\n\n\treturn fs, nil\n}", "title": "" }, { "docid": "087d42e1a456ed0eb29e9e98a5c9aff1", "score": "0.599481", "text": "func New() (*DummyFS, error) {\n\treturn &DummyFS{}, nil\n}", "title": "" }, { "docid": "0404e7de2173af03990fb187b96770bb", "score": "0.59515935", "text": "func NewScanner(customHeaders CustomHeaders, s rpc.Scanner) Scanner {\n\treturn Scanner{customHeaders: customHeaders, client: s}\n}", "title": "" }, { "docid": "a4c6f1844c0ff5619418b9107239ff9a", "score": "0.5950314", "text": "func NewScanner(rdr io.Reader) (Scanner, error) {\n\tscn := Scanner{}\n\tb := bytes.Buffer{}\n\t_, err := b.ReadFrom(rdr)\n\tif err != nil {\n\t\treturn scn, err\n\t}\n\ts := b.String()\n\tif len(s) < 1 {\n\t\treturn scn, errors.New(\"Empty source\")\n\t}\n\n\tscn.text = []rune(s)\n\treturn scn, nil\n}", "title": "" }, { "docid": "204cb4d831f41d1ca0ee1b9c4067aca3", "score": "0.59428126", "text": "func New(_ context.Context) filesystem.Interface {\n\treturn &fs{}\n}", "title": "" }, { "docid": "98705bdd88cbf7f1b87b6ed049c0a5bc", "score": "0.5931463", "text": "func newFS(name, namespace string) *Filesystem {\n\treturn &Filesystem{\n\t\tName: name,\n\t\tNamespace: namespace,\n\t}\n}", "title": "" }, { "docid": "fefaeeddb831d6fe4c694bfe5af56330", "score": "0.5909654", "text": "func NewFS(_ *venti.Thello) (*venti.Rhello, venti.Handler, error) {\n\treturn nil, &fs{score: sha1.New()}, nil\n}", "title": "" }, { "docid": "bb0b033e98979f36b9a142563502bebc", "score": "0.5880087", "text": "func newSeedScanner(seed modules.Seed, log *persist.Logger) *seedScanner {\n\treturn &seedScanner{\n\t\tseed: seed,\n\t\tkeys: make(map[types.UnlockHash]uint64, numInitialKeys),\n\t\tsiacoinOutputs: make(map[types.SiacoinOutputID]scannedOutput),\n\t\tsiafundOutputs: make(map[types.SiafundOutputID]scannedOutput),\n\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "f9b47a44d7f65daa5abc94d9aeabb13b", "score": "0.58773", "text": "func New(c ...Config) *FS {\n\tf := &FS{\n\t\tLogger: log.New(os.Stderr, \"site62 - filesystem: \", log.Lmicroseconds|log.Llongfile),\n\t\tsettings: newSettings(),\n\t\tloop: newLoop(),\n\t}\n\tf.Configuration = newConfiguration(f, c...)\n\treturn f\n}", "title": "" }, { "docid": "634555738c0720c1796dbc40d040514e", "score": "0.5868626", "text": "func NewScanner(src []byte) *Scanner {\n\ts := &Scanner{\n\t\tsrc: bytes.Split(src, []byte{'\\n'}),\n\t}\n\tfor _, v := range s.src {\n\t\tif len(v) > s.width {\n\t\t\ts.width = len(v)\n\t\t}\n\t}\n\ts.height = len(s.src)\n\ts.resize(s.width, s.height)\n\treturn s\n}", "title": "" }, { "docid": "467cce2b17268e7ffc25a7eb93d04ec8", "score": "0.5838363", "text": "func (s SnapshotProbe) NewScanner(start, end []byte, batchSize int, reverse bool) (*Scanner, error) {\n\treturn newScanner(s.KVSnapshot, start, end, batchSize, reverse)\n}", "title": "" }, { "docid": "7b0a75b170ce05750092381fdaeed98c", "score": "0.58361924", "text": "func NewScanner(t *testing.T, vulnerabilities ...voucher.Vulnerability) voucher.VulnerabilityScanner {\n\tscanner := new(testVulnerabilityScanner)\n\tscanner.setVulnerabilities(vulnerabilities)\n\treturn scanner\n}", "title": "" }, { "docid": "c45569d9532dc4e6d461a2da1aacc55b", "score": "0.58266556", "text": "func New(opts ...Option) IScanner {\n\tscanner := new(Scanner)\n\tfor _, opt := range opts {\n\t\topt(scanner)\n\t}\n\treturn scanner\n}", "title": "" }, { "docid": "377346b2185a67b4f6ecb40fb22c633d", "score": "0.58225894", "text": "func New() FS {\n\treturn FS{\n\t\tTree: Directory{},\n\t}\n}", "title": "" }, { "docid": "677732572ddbeef9b4d7b728a83d5e24", "score": "0.58017087", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {\n\t// Parse config into Options struct\n\topt := new(Options)\n\terr := configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = checkUploadChunkSize(opt.ChunkSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"qingstor: chunk size: %w\", err)\n\t}\n\terr = checkUploadCutoff(opt.UploadCutoff)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"qingstor: upload cutoff: %w\", err)\n\t}\n\tsvc, err := qsServiceConnection(ctx, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif opt.Zone == \"\" {\n\t\topt.Zone = \"pek3a\"\n\t}\n\n\tf := &Fs{\n\t\tname: name,\n\t\topt: *opt,\n\t\tsvc: svc,\n\t\tzone: opt.Zone,\n\t\tcache: bucket.NewCache(),\n\t}\n\tf.setRoot(root)\n\tf.features = (&fs.Features{\n\t\tReadMimeType: true,\n\t\tWriteMimeType: true,\n\t\tBucketBased: true,\n\t\tBucketBasedRootOK: true,\n\t\tSlowModTime: true,\n\t}).Fill(ctx, f)\n\n\tif f.rootBucket != \"\" && f.rootDirectory != \"\" {\n\t\t// Check to see if the object exists\n\t\tbucketInit, err := svc.Bucket(f.rootBucket, opt.Zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tencodedDirectory := f.opt.Enc.FromStandardPath(f.rootDirectory)\n\t\t_, err = bucketInit.HeadObject(encodedDirectory, &qs.HeadObjectInput{})\n\t\tif err == nil {\n\t\t\tnewRoot := path.Dir(f.root)\n\t\t\tif newRoot == \".\" {\n\t\t\t\tnewRoot = \"\"\n\t\t\t}\n\t\t\tf.setRoot(newRoot)\n\t\t\t// return an error with an fs which points to the parent\n\t\t\treturn f, fs.ErrorIsFile\n\t\t}\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "c221122216760a9cd480cb505c4d6141", "score": "0.5729128", "text": "func NewScanner(r *Rules) (*Scanner, error) {\n\tvar yrScanner *C.YR_SCANNER\n\tif err := newError(C.yr_scanner_create(r.cptr, &yrScanner)); err != nil {\n\t\treturn nil, err\n\t}\n\ts := &Scanner{cptr: yrScanner, rules: r, userData: (*cgoHandle)(C.malloc(C.size_t(unsafe.Sizeof(cgoHandle(0)))))}\n\t*s.userData = 0\n\truntime.SetFinalizer(s, (*Scanner).Destroy)\n\treturn s, nil\n}", "title": "" }, { "docid": "76f2310b359a4a2bc951fb3da1b75b7c", "score": "0.5718654", "text": "func New(tarstream io.Reader) (http.FileSystem, error) {\n\ttr := tar.NewReader(tarstream)\n\n\ttarfs := tarfs{make(map[string]file)}\n\t// Iterate through the files in the archive.\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\t// end of tar archive\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdata, err := ioutil.ReadAll(tr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttarfs.files[path.Join(\"/\", hdr.Name)] = file{\n\t\t\tdata: data,\n\t\t\tfi: hdr.FileInfo(),\n\t\t}\n\t}\n\treturn &tarfs, nil\n}", "title": "" }, { "docid": "14036cbff18b2ecb6ec6c05be3d7f302", "score": "0.5705787", "text": "func NewFS(t testing.TB) *FS {\n\tmock := &FS{}\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "02f379768a9da6834011a1c075871c0e", "score": "0.5696072", "text": "func NewFS(args Args) *FS {\n\n\tcryptoCore := cryptocore.New(args.Masterkey, args.OpenSSL, args.GCMIV128)\n\tcontentEnc := contentenc.New(cryptoCore, contentenc.DefaultBS)\n\tnameTransform := nametransform.New(cryptoCore, args.EMENames, args.LongNames)\n\n\treturn &FS{\n\t\tFileSystem: pathfs.NewLoopbackFileSystem(args.Cipherdir),\n\t\targs: args,\n\t\tnameTransform: nameTransform,\n\t\tcontentEnc: contentEnc,\n\t}\n}", "title": "" }, { "docid": "221c04d56d839f9a7468d40177d71813", "score": "0.568409", "text": "func New(\n\tctx context.Context,\n\tcfg *viper.Viper,\n\tec hub.ErrorsCollector,\n\topts ...func(s *Scanner),\n) *Scanner {\n\tif cfg.GetString(\"scanner.trivyURL\") == \"\" {\n\t\tlog.Fatal().Msg(\"trivy url not set\")\n\t}\n\ts := &Scanner{\n\t\tis: &TrivyScanner{\n\t\t\tctx: ctx,\n\t\t\tcfg: cfg,\n\t\t},\n\t\tec: ec,\n\t}\n\tfor _, o := range opts {\n\t\to(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "fd13532307f1c15db40f2514f1d0ddfa", "score": "0.56795114", "text": "func NewSfs(conf *SfsConfig) (*Sfs, error) {\n sfsLogLevel = conf.LogLevel\n mnt := conf.Mountpoint\n mount_opts := getFuseMountOptions(conf)\n\n if !conf.Config.IsEmpty() {\n configFileOpts := readJsonFile(conf.Config)\n Echoerr(\"%v\", configFileOpts)\n }\n\n c, err := fuse.Mount(string(mnt), mount_opts...)\n if err != nil { return nil, err }\n\n mfs := &Sfs {\n Mountpoint : mnt,\n RootNode : NewIdNode(conf.Paths[0]),\n Connection : c,\n }\n\n /** Start a goroutine which looks for INT/TERM and\n * calls unmount on the filesystem. Otherwise ctrl-C\n * leaves us with ghost mounts which outlive the process.\n */\n trap := func (sig os.Signal) {\n Echoerr(\"Caught %s - forcing unmount(2) of %s\\n\", sig, mfs.Mountpoint)\n mfs.Unmount()\n }\n TrapExit(trap)\n return mfs, nil\n}", "title": "" }, { "docid": "e53ab63202baceb3efd3d3ac1acfb767", "score": "0.5678173", "text": "func New(tb testing.TB) FS {\n\ttb.Helper()\n\n\tpath, err := filepath.EvalSymlinks(tb.TempDir())\n\tif err != nil {\n\t\ttb.Fatalf(\"failed to create testfs: %s\", err)\n\t}\n\n\tpath = filepath.ToSlash(path)\n\n\ttb.Logf(\"creating testFS at %s\", path)\n\treturn FS{\n\t\tFS: os.DirFS(path),\n\t\tpath: path,\n\t}\n}", "title": "" }, { "docid": "63288deb8a903276223b54daf756e701", "score": "0.5673563", "text": "func NewFs(options ...ConstructorOption) (*ObjStorFs, error) {\n\tcreated := &ObjStorFs{\n\t\topts: fsOptions{\n\t\t\tdeadlines: make(map[string]time.Duration),\n\t\t},\n\t}\n\n\toptions = append(defaultOptions, options...)\n\n\tfor _, opt := range options {\n\t\toptionErr := opt(created)\n\t\tif nil != optionErr {\n\t\t\treturn nil, optionErr\n\t\t}\n\t}\n\n\tif 0 == created.directoryCacheSizeMax {\n\t\tcreated.directoryCacheSizeMax = DefaultMaxCachedDirectories\n\t}\n\tdirectoryCache, err := lru.NewWithEvict(created.directoryCacheSizeMax,\n\t\tcreated.evictDirectoryCallback)\n\tif nil != err {\n\t\terr = errors.Wrap(err, \"could not create directory cache\")\n\t\treturn nil, err\n\t}\n\tcreated.directoryCache = directoryCache\n\n\tif 0 == created.totalCachedFilesSizeMax {\n\t\tcreated.totalCachedFilesSizeMax = DefaultMaxCachedFilesSize\n\t}\n\tif 0 == created.filesCacheSizeMax {\n\t\tcreated.filesCacheSizeMax = DefaultMaxCachedFiles\n\t}\n\tfilesCache, err := lru.NewWithEvict(created.filesCacheSizeMax,\n\t\tcreated.evictFileCallback)\n\tif nil != err {\n\t\terr = errors.Wrap(err, \"could not create files cache\")\n\t\treturn nil, err\n\t}\n\tcreated.filesCache = filesCache\n\n\treturn created, nil\n}", "title": "" }, { "docid": "c95a77b9ff459dcf1e611d1093030917", "score": "0.56476426", "text": "func New(fieldSeparators, quotes []rune, escape rune) Scanner {\n\treturn &scanner{\n\t\tsplitter{\n\t\t\tfieldSeparators: fieldSeparators,\n\t\t\tquotes: quotes,\n\t\t\tesc: escape,\n\t\t\tnoesc: utf8.RuneError, // assume shouldn't exist\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7245a34ae278650abf74e1b89ef8dd68", "score": "0.5636946", "text": "func Init(f *token.File) (s *Scanner) {\n\ts = new(Scanner)\n\ts.file = f\n\ts.pos = new(token.Pos)\n\ts.errors = printError\n\treturn\n}", "title": "" }, { "docid": "2c4afd702a9f5a0116b545861126b25e", "score": "0.56134737", "text": "func New(ctx context.Context, repo gitiles.GitilesRepo, ref string) (*FS, error) {\n\thash, err := repo.ResolveRef(ctx, ref)\n\tif err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\treturn &FS{\n\t\trepo: repo,\n\t\thash: hash,\n\t\tcachedFileInfos: map[string]os.FileInfo{},\n\t\tcachedContents: map[string][]byte{},\n\t\tchanges: map[string][]byte{},\n\t}, nil\n}", "title": "" }, { "docid": "29c59fcfe04264907a661cdd0a515e38", "score": "0.5603196", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {\n\t// Parse config into Options struct\n\topt := new(Options)\n\terr := configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\troot = strings.Trim(root, \"/\")\n\tf := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\topt: *opt,\n\t}\n\tf.setRoot(root)\n\tf.features = (&fs.Features{\n\t\tReadMimeType: true,\n\t\tWriteMimeType: true,\n\t\tBucketBased: true,\n\t\tBucketBasedRootOK: true,\n\t}).Fill(ctx, f)\n\tif f.rootBucket != \"\" && f.rootDirectory != \"\" {\n\t\tod := buckets.getObjectData(f.rootBucket, f.rootDirectory)\n\t\tif od != nil {\n\t\t\tnewRoot := path.Dir(f.root)\n\t\t\tif newRoot == \".\" {\n\t\t\t\tnewRoot = \"\"\n\t\t\t}\n\t\t\tf.setRoot(newRoot)\n\t\t\t// return an error with an fs which points to the parent\n\t\t\terr = fs.ErrorIsFile\n\t\t}\n\t}\n\treturn f, err\n}", "title": "" }, { "docid": "b0c2b0a85ea4ae735de19bf83515aa8a", "score": "0.56021106", "text": "func NewFileScanner(filename string) *FileScanner {\n\tfile, e := os.Open(filename)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\treader := bufio.NewReader(file)\n\tsc := FileScanner{file, reader, 0, nil}\n\tsc.advancePointer()\n\treturn &sc\n}", "title": "" }, { "docid": "ac7ac64e611c08b785bf549df663614b", "score": "0.55925435", "text": "func newNodeScanner(scannerDirPrefix string) (ns *nodeScanner) {\n\tns = new(nodeScanner)\n\tns.stats = scannerStats{}\n\n\t// Setup the node scanner's directories.\n\tscannerDirPath := filepath.Join(scannerDirPrefix, nodeScannerDirName)\n\tscannerGatewayDirPath := filepath.Join(scannerDirPath, \"gateway\")\n\tif _, err := os.Stat(scannerDirPath); os.IsNotExist(err) {\n\t\terr := os.Mkdir(scannerDirPath, 0750)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error creating scan directory: \", err)\n\t\t}\n\t}\n\tif _, err := os.Stat(scannerGatewayDirPath); os.IsNotExist(err) {\n\t\terr := os.Mkdir(scannerGatewayDirPath, 0750)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error creating scanner gateway directory: \", err)\n\t\t}\n\t}\n\tlog.Printf(\"Logging data in: %s\\n\", scannerDirPath)\n\n\t// Create the file for this scan.\n\tstartTime := time.Now().Format(\"01-02:15:04\")\n\tscanLogName := scannerDirPath + \"/scan-\" + startTime + \".json\"\n\tscanLog, err := os.Create(scanLogName)\n\tif err != nil {\n\t\tlog.Fatal(\"Error creating scan file: \", err)\n\t}\n\tns.scanLog = scanLog\n\n\t// Create dummy gateway at localhost. It is used only to connect/disconnect\n\t// from nodes and to use the ShareNodes RPC with other nodes for the purposes\n\t// of this scan.\n\tg, err := gateway.New(\"localhost:0\", true, scannerGatewayDirPath)\n\tif err != nil {\n\t\tlog.Fatal(\"Error making new gateway: \", err)\n\t}\n\tlog.Println(\"Set up gateway at address: \", g.Address())\n\tns.gateway = g\n\n\tpersistFilePath := filepath.Join(scannerDirPath, persistFileName)\n\terr = ns.setupPersistFile(persistFilePath)\n\tif err != nil {\n\t\tlog.Fatal(\"Error setting up persist file: \", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "33237a3fd17bcbb2dc8b995029da30fa", "score": "0.55820894", "text": "func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {\n\t// Parse config into Options struct\n\topt := new(Options)\n\terr := configstruct.Set(m, opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseClient := fshttp.NewClient(ctx)\n\toAuthClient, ts, err := oauthutil.NewClientWithBaseClient(ctx, name, m, oauthConfig, baseClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to configure Box: %w\", err)\n\t}\n\n\troot = strings.Trim(path.Clean(root), \"/\")\n\tif root == \".\" || root == \"/\" {\n\t\troot = \"\"\n\t}\n\n\tf := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\topt: *opt,\n\t\tunAuth: rest.NewClient(baseClient),\n\t\tsrv: rest.NewClient(oAuthClient).SetRoot(rootURL),\n\t\tts: ts,\n\t\tpacer: fs.NewPacer(ctx, pacer.NewGoogleDrive(pacer.MinSleep(minSleep))),\n\t\tstartTime: time.Now(),\n\t\talbums: map[bool]*albums{},\n\t\tuploaded: dirtree.New(),\n\t}\n\tf.features = (&fs.Features{\n\t\tReadMimeType: true,\n\t}).Fill(ctx, f)\n\tf.srv.SetErrorHandler(errorHandler)\n\n\t_, _, pattern := patterns.match(f.root, \"\", true)\n\tif pattern != nil && pattern.isFile {\n\t\toldRoot := f.root\n\t\tvar leaf string\n\t\tf.root, leaf = path.Split(f.root)\n\t\tf.root = strings.TrimRight(f.root, \"/\")\n\t\t_, err := f.NewObject(ctx, leaf)\n\t\tif err == nil {\n\t\t\treturn f, fs.ErrorIsFile\n\t\t}\n\t\tf.root = oldRoot\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "aab6a3ffb90f1a9a20c56c5428544587", "score": "0.557954", "text": "func New(r io.ReaderAt) (*FS, error) {\n\tvar err error\n\ts := FS{\n\t\tr: r,\n\t\tlookup: make(map[string]int),\n\t}\n\thardlink := make(map[string][]string)\n\tif err := s.add(\".\", newDir(\".\"), hardlink); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsegs, err := findSegments(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"tarfs: error finding segments: %w\", err)\n\t}\n\tfor _, seg := range segs {\n\t\tr := io.NewSectionReader(r, seg.start, seg.size)\n\t\trd := tar.NewReader(r)\n\t\ti := inode{\n\t\t\toff: seg.start,\n\t\t\tsz: seg.size,\n\t\t}\n\t\ti.h, err = rd.Next()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"tarfs: error reading header @%d(%d): %w\", seg.start, seg.size, err)\n\t\t}\n\t\ti.h.Name = normPath(i.h.Name)\n\t\tn := i.h.Name\n\t\tswitch i.h.Typeflag {\n\t\tcase tar.TypeDir:\n\t\t\t// Has this been created this already?\n\t\t\tif _, ok := s.lookup[n]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ti.children = make(map[int]struct{})\n\t\tcase tar.TypeSymlink, tar.TypeLink:\n\t\t\t// If an absolute path, norm the path and it should be fine.\n\t\t\t// A symlink could dangle, but that's really weird.\n\t\t\tif path.IsAbs(i.h.Linkname) {\n\t\t\t\ti.h.Linkname = normPath(i.h.Linkname)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif i.h.Typeflag == tar.TypeSymlink {\n\t\t\t\t// Assume that symlinks are relative to the directory they're\n\t\t\t\t// present in.\n\t\t\t\ti.h.Linkname = path.Join(path.Dir(n), i.h.Linkname)\n\t\t\t}\n\t\t\ti.h.Linkname = normPath(i.h.Linkname)\n\t\t\t// Linkname should now be a full path from the root of the tar.\n\t\tcase tar.TypeReg:\n\t\t}\n\t\tif err := s.add(n, i, hardlink); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\t// Cleanup any dangling hardlinks.\n\t// This leaves them in the inode slice, but removes them from the observable\n\t// tree.\n\tfor _, rms := range hardlink {\n\t\tfor _, rm := range rms {\n\t\t\tidx := s.lookup[rm]\n\t\t\tdelete(s.lookup, rm)\n\t\t\tp := s.inode[s.lookup[path.Dir(rm)]]\n\t\t\tdelete(p.children, idx)\n\t\t}\n\t}\n\treturn &s, nil\n}", "title": "" }, { "docid": "3aa3f63cdd12a6974b2b179bfdcb5afa", "score": "0.55753523", "text": "func UseMockFS() {\n\tfs = &mockfs{ScanEntry: defaultEntryScanFunc}\n}", "title": "" }, { "docid": "0fdc0c2e7fcb0e759f4437b94cc7f4d8", "score": "0.5574382", "text": "func newFileRegistry() (registry.Registry, error) {\n\n\ttmpRegistry := &fileRegistry{}\n\treturn tmpRegistry, nil\n}", "title": "" }, { "docid": "da5d4e7d3795b111f981861d6b2231a1", "score": "0.5540852", "text": "func NewFilterfs(validfn func(string) bool, wrappedfs *VFS) *VFS {\n\treturn &VFS{\n\t\t&filterfs{\n\t\t\tvalidfn: validfn,\n\t\t\twrappedfs: wrappedfs,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a5a88100dcfc4815bd52d61900d3e3e6", "score": "0.55382854", "text": "func newDev(f *os.File) *dev {\n\treturn &dev{\n\t\tf: f,\n\t\tsyscalls: &realSyscalls{},\n\t}\n}", "title": "" }, { "docid": "a8356fdadc96a078db3b197ef080520b", "score": "0.55345374", "text": "func New(\n\tbasePaths ...string,\n) data.DataProvider {\n\treturn _fs{\n\t\tbasePaths: basePaths,\n\t}\n}", "title": "" }, { "docid": "8e91a4550a9db6c347a70ac0e3700c22", "score": "0.5518667", "text": "func NewFS(root VarNodeable) *FS {\n\tret := &FS{RootNode: root, Name: \"fusebox\"}\n\treturn ret\n}", "title": "" }, { "docid": "162e31fc8227f8a9aee517ad3364bc43", "score": "0.55055463", "text": "func New(innerFS fs.FS) (*FS, error) {\n\tif innerFS == nil {\n\t\treturn nil, fmt.Errorf(\"no inner file system\")\n\t}\n\tvar vfs = FS{\n\t\tfs: innerFS,\n\t}\n\t_, err := vfs.loadTemplates()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &vfs, nil\n}", "title": "" }, { "docid": "06beffd872b9867d2ba385f545ea64bb", "score": "0.54950416", "text": "func NewFS(path string, options *Options) *FileSystem {\n\treturn &FileSystem{\n\t\tpath: path,\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "c94139c5fb930a56e8cc179ae6e9b3e5", "score": "0.54859936", "text": "func newStringIteratorScanner(input StringIterator, keys []influxql.VarRef, defaultValue interface{}) *stringIteratorScanner {\n\treturn &stringIteratorScanner{\n\t\tinput: newBufStringIterator(input),\n\t\tkeys: keys,\n\t\tdefaultValue: defaultValue,\n\t}\n}", "title": "" }, { "docid": "b3b76baf5cccd2382341ec63d0ac09a8", "score": "0.54725343", "text": "func NewScanner(r io.Reader, tags ...interface{}) *Scanner {\n\ts := Scanner{\n\t\tDecoder: xml.NewDecoder(r),\n\t\tnameToType: make(map[string]reflect.Type, len(tags)),\n\t}\n\n\t// Map the xml local name of an element to its underlying type.\n\tfor _, tag := range tags {\n\t\tv := reflect.ValueOf(tag)\n\t\tif v.Kind() == reflect.Ptr {\n\t\t\tv = v.Elem()\n\t\t}\n\t\tt := v.Type()\n\t\tname := elementName(v)\n\t\ts.nameToType[name] = t\n\t}\n\treturn &s\n}", "title": "" }, { "docid": "5e4865088aef1266bf356d905a1c613d", "score": "0.5443618", "text": "func NewFileSystem() filesystemspec.FileSystem {\n\tnewFileSystem := &real{}\n\n\treturn newFileSystem\n}", "title": "" }, { "docid": "ab5ea6981e05fea00effc4e9f61bb70a", "score": "0.5422341", "text": "func New(query string) Scanner {\n\treturn Scanner{\n\t\tQuery: query,\n\t}\n}", "title": "" }, { "docid": "f9edf036f10d65c4351d27935cc8b02a", "score": "0.5417501", "text": "func New(name string, dir string) http.FileSystem {\n\treturn &gatewayFS{\n\t\tname: name,\n\t\tdir: dir,\n\t}\n}", "title": "" }, { "docid": "90650be4ae1975e1d6897082b5991c0d", "score": "0.53803176", "text": "func NewFs(db FsDatabase, us *ReplicaInfo, replicas map[string]*ReplicaInfo) FS {\n\tnewFs := FS{\n\t\tdatabase: db,\n\t\tNextInd: 0,\n\t\tNextVid: 1,\n\t\tChunkInDb: make(map[string]bool),\n\t}\n\tif data, err := db.GetBlock([]byte(\"metadata\")); err == nil {\n\t\tif jsonErr := json.Unmarshal(data, &filesystem); jsonErr != nil {\n\t\t\tfilesystem = newFs\n\t\t} else {\n\t\t\tfilesystem.database = db\n\t\t}\n\t} else {\n\t\tfilesystem = newFs\n\t}\n\tif root, err := filesystem.database.GetRoot(); err != nil || root == nil {\n\t\tutil.P_out(\"Couldn't find root in db, making new one\")\n\t\tfilesystem.root = new(Directory)\n\t\tfilesystem.root.InitDirectory(\"\", os.ModeDir|0755, nil)\n\t} else {\n\t\tfilesystem.root = root\n\t}\n\tfilesystem.comm, _ = NewCommunicator(us.Name, replicas)\n\tif filesystem.comm != nil {\n\t\tgo filesystem.comm.MetaBroadcastListener(func(payload []byte) {\n\t\t\tchanges := make(map[string][]byte)\n\t\t\ti := 0\n\t\t\tfor i = range payload {\n\t\t\t\tif payload[i] == byte(' ') {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif i >= len(payload) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tjson.Unmarshal(payload[i+1:], &changes)\n\t\t\tfilesystem.Lock(nil)\n\t\t\tdefer filesystem.Unlock(nil)\n\t\t\tfilesystem.updateFromBroadcast(changes)\n\t\t})\n\t\tgo filesystem.comm.ChunkRequestListener(func(sha []byte) []byte {\n\t\t\tdata, _ := filesystem.database.GetBlock(sha)\n\t\t\treturn data\n\t\t})\n\t}\n\tfilesystem.replInfo = *us\n\t//filesystem.replInfo = *replicas[pid]\n\treturn filesystem\n}", "title": "" }, { "docid": "4de3c37a902066146893e93df2565734", "score": "0.5378983", "text": "func NewFs(name, path string) (fs.Fs, error) {\n\tif !isPowerOfTwo(int64(chunkSize)) {\n\t\treturn nil, errors.Errorf(\"drive: chunk size %v isn't a power of two\", chunkSize)\n\t}\n\tif chunkSize < 256*1024 {\n\t\treturn nil, errors.Errorf(\"drive: chunk size can't be less than 256k - was %v\", chunkSize)\n\t}\n\n\toAuthClient, _, err := oauthutil.NewClient(name, driveConfig)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to configure drive: %v\", err)\n\t}\n\n\troot, err := parseDrivePath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := &Fs{\n\t\tname: name,\n\t\troot: root,\n\t\tpacer: pacer.New().SetMinSleep(minSleep).SetPacer(pacer.GoogleDrivePacer),\n\t}\n\n\t// Create a new authorized Drive client.\n\tf.client = oAuthClient\n\tf.svc, err = drive.New(f.client)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"couldn't create Drive client\")\n\t}\n\n\t// Read About so we know the root path\n\terr = f.pacer.Call(func() (bool, error) {\n\t\tf.about, err = f.svc.About.Get().Do()\n\t\treturn shouldRetry(err)\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"couldn't read info about Drive\")\n\t}\n\n\tf.dirCache = dircache.New(root, f.about.RootFolderId, f)\n\n\t// Parse extensions\n\terr = f.parseExtensions(*driveExtensions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = f.parseExtensions(defaultExtensions) // make sure there are some sensible ones on there\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Find the current root\n\terr = f.dirCache.FindRoot(false)\n\tif err != nil {\n\t\t// Assume it is a file\n\t\tnewRoot, remote := dircache.SplitPath(root)\n\t\tnewF := *f\n\t\tnewF.dirCache = dircache.New(newRoot, f.about.RootFolderId, &newF)\n\t\tnewF.root = newRoot\n\t\t// Make new Fs which is the parent\n\t\terr = newF.dirCache.FindRoot(false)\n\t\tif err != nil {\n\t\t\t// No root so return old f\n\t\t\treturn f, nil\n\t\t}\n\t\t_, err := newF.newObjectWithInfo(remote, nil)\n\t\tif err != nil {\n\t\t\t// File doesn't exist so return old f\n\t\t\treturn f, nil\n\t\t}\n\t\t// return an error with an fs which points to the parent\n\t\treturn &newF, fs.ErrorIsFile\n\t}\n\t// fmt.Printf(\"Root id %s\", f.dirCache.RootID())\n\treturn f, nil\n}", "title": "" }, { "docid": "678410c6bf98b68271b362b5c3286625", "score": "0.5377227", "text": "func NewSync() (Finder, error) {\n\tast, err := buildSkiaAST()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Problem building AST: %s\", err)\n\t}\n\tbuf := bufio.NewScanner(bytes.NewBuffer(ast))\n\tglog.Infof(\"Parsing %d bytes\", len(ast))\n\treturn parseSkiaAST(buf)\n}", "title": "" }, { "docid": "f15b13c3c6f6d9d2c142c04b21a0a0c7", "score": "0.53370523", "text": "func New(\n\troot string,\n\tmaxSaver int,\n\tmaxLoader int,\n\tlg *zerolog.Logger) (*FileSystem, error) {\n\n\troot, err := filepath.Abs(root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif maxSaver < 1 || maxSaver > 20 {\n\t\treturn nil, fmt.Errorf(\"maxSaver %d is out of allowed range [1, 20]\", maxSaver)\n\t}\n\tif maxLoader < 1 || maxLoader > 20 {\n\t\treturn nil, fmt.Errorf(\"maxLoader %d is out of allowed range [1, 20]\", maxLoader)\n\t}\n\tl := lg.With().Str(\"root\", root).Logger()\n\treturn &FileSystem{\n\t\troot: root,\n\t\tskip: skipDotFile,\n\t\tmaxLoader: maxLoader,\n\t\tmaxSaver: maxSaver,\n\t\tlg: &l,\n\t}, nil\n}", "title": "" }, { "docid": "d991715730910b810e3b1b0f13fdb3bc", "score": "0.5331632", "text": "func (s *Source) Scanner() *scanner.Scanner {\n\tif s.scanner == nil {\n\t\ts.scanner = scanner.New(s.Path, s.Src)\n\t\ts.scanner.Run()\n\t}\n\n\ts.scanner.Reset()\n\treturn s.scanner\n}", "title": "" }, { "docid": "4fb58bdb9a8fdd4576a2121a887b91a0", "score": "0.5306331", "text": "func NewStringScanner(s string) *StringScanner {\n\treturn &StringScanner{[]rune(s), 0}\n}", "title": "" }, { "docid": "82f36a0285d7104828a09382808fc4f9", "score": "0.53041446", "text": "func newFifos(root, id string, tty, stdin bool) (*cio.FIFOSet, error) {\n\troot = filepath.Join(root, \"io\")\n\tif err := os.MkdirAll(root, 0700); err != nil {\n\t\treturn nil, err\n\t}\n\tfifos, err := cio.NewFIFOSetInDir(root, id, tty)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !stdin {\n\t\tfifos.Stdin = \"\"\n\t}\n\treturn fifos, nil\n}", "title": "" } ]
57e906295cd0a13917f74683a1f8732c
GetTestSigning gets the testSigning property value. When test signing is allowed, the device does not enforce signature validation during boot
[ { "docid": "5de9188438eeb6ffe8ee8b4b89912211", "score": "0.8456633", "text": "func (m *DeviceHealthAttestationState) GetTestSigning()(*string) {\n val, err := m.GetBackingStore().Get(\"testSigning\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" } ]
[ { "docid": "0986569295bb48294835af741f7b77f5", "score": "0.7203847", "text": "func (m *DeviceHealthAttestationState) SetTestSigning(value *string)() {\n err := m.GetBackingStore().Set(\"testSigning\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4aca86846ed5f493dff689f7cfd847ad", "score": "0.6276815", "text": "func GetSigningKey() string {\n\treturn signingKey\n}", "title": "" }, { "docid": "65d6f7051fe93adb6fefe5edd909b4a6", "score": "0.6100446", "text": "func TestSign(w http.ResponseWriter, r *http.Request) {\n\tconf := ConfLoad()\n\n\t// Returns a Public / Private Key Pair\n\t// Read JSON config from app.yaml\n\tif v := os.Getenv(\"PRIV_KEY\"); v != \"\" {\n\t\terr := json.Unmarshal([]byte(v), &conf)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%#v\", conf)\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\t// Get the public key\n\tvar pubkey ecdsa.PublicKey\n\tpubkey = conf.PublicKey\n\n\t// Try signing a message\n\tmessage := []byte(\"99999999\")\n\tsig1, sig2, err := ecdsa.Sign(rand.Reader, &conf.PrivateKey, message)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Try verifying the signature\n\tresult := ecdsa.Verify(&pubkey, message, sig1, sig2)\n\tif result != true {\n\t\tpanic(\"Unable to verify signature\")\n\t}\n\n\tfmt.Fprintf(w, \"message: %#v\\n\\nsig1: %#v\\nsig2: %#v\", string(message[:]), sig1, sig2)\n\n}", "title": "" }, { "docid": "2303ffb7acbc66df57771fa70a852e6e", "score": "0.57589066", "text": "func getSigningKey() []byte {\n\t// Get signing key\n\tsigningKey := []byte(os.Getenv(\"SIGNING_KEY\"))\n\tif len(signingKey) == 0 {\n\t\tsigningKey = SIGNING_KEY\n\t}\n\n\treturn signingKey\n}", "title": "" }, { "docid": "c1732ae10633d1772958fc6b8cf84af3", "score": "0.54739654", "text": "func (p *PacketCryptAnn) GetSigningKey() []byte {\n\treturn p.Header[56:88]\n}", "title": "" }, { "docid": "7f7dc1de17d761ed4f79c9656a0dd91f", "score": "0.5413365", "text": "func (m *CreatePostRequestBody) GetCertificateSigningRequest()(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.PrintCertificateSigningRequestable) {\n return m.certificateSigningRequest\n}", "title": "" }, { "docid": "2430140f68a7aeab3301832d7bd5328e", "score": "0.5363057", "text": "func (i *Invoice) GetTest() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(0)\n}", "title": "" }, { "docid": "8bc9bf0299f4e98b0b823b9aadc326e7", "score": "0.5156149", "text": "func isTestSignature(sign *types.Signature) bool {\n\tif sign.Recv() != nil {\n\t\treturn false\n\t}\n\tparams := sign.Params()\n\tif params.Len() != 1 {\n\t\treturn false\n\t}\n\tobj := objOf(params.At(0).Type())\n\treturn obj != nil && obj.Pkg().Path() == \"testing\" && obj.Name() == \"T\"\n}", "title": "" }, { "docid": "8bc9bf0299f4e98b0b823b9aadc326e7", "score": "0.5156149", "text": "func isTestSignature(sign *types.Signature) bool {\n\tif sign.Recv() != nil {\n\t\treturn false\n\t}\n\tparams := sign.Params()\n\tif params.Len() != 1 {\n\t\treturn false\n\t}\n\tobj := objOf(params.At(0).Type())\n\treturn obj != nil && obj.Pkg().Path() == \"testing\" && obj.Name() == \"T\"\n}", "title": "" }, { "docid": "2ee4fc2dbff632988568f04298f3cea4", "score": "0.5125405", "text": "func (d *DockerPath) GetTestnet() string {\n\treturn testnet\n}", "title": "" }, { "docid": "35328f91c8f51353a7e815279ce2cf92", "score": "0.5109689", "text": "func (c *Conf) GetSigningKey() common.RawBytes {\n\tc.keyConfLock.RLock()\n\tdefer c.keyConfLock.RUnlock()\n\treturn c.keyConf.SignKey\n}", "title": "" }, { "docid": "fdccf36fb8335a317afc3bfcfb335310", "score": "0.5100267", "text": "func (m *SignatureKeyHolderMock) GetSignMethod() (r SignMethod) {\n\tcounter := atomic.AddUint64(&m.GetSignMethodPreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetSignMethodCounter, 1)\n\n\tif len(m.GetSignMethodMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetSignMethodMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignMethod.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetSignMethodMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignMethod\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignMethodMock.mainExpectation != nil {\n\n\t\tresult := m.GetSignMethodMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignMethod\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignMethodFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignMethod.\")\n\t\treturn\n\t}\n\n\treturn m.GetSignMethodFunc()\n}", "title": "" }, { "docid": "44860e320ce27f2acd490a38b0313e5e", "score": "0.5093213", "text": "func (r *ProviderRegister) GetSigningKey() (*fcrcrypto.KeyPair, error) {\n\treturn fcrcrypto.DecodePublicKey(r.SigningKey)\n}", "title": "" }, { "docid": "72ec9a446b815453996aadf86451f051", "score": "0.50756174", "text": "func (c CryptoServiceTester) TestSignWithKey(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcontent := []byte(\"this is a secret\")\n\n\ttufKey, err := cryptoService.Create(c.role, c.gun, c.keyAlgo)\n\trequire.NoError(t, err, c.errorMsg(\"error creating key\"))\n\n\t// Test Sign\n\tprivKey, role, err := cryptoService.GetPrivateKey(tufKey.ID())\n\trequire.NoError(t, err, c.errorMsg(\"failed to get private key\"))\n\trequire.Equal(t, c.role, role)\n\n\tsignature, err := privKey.Sign(rand.Reader, content, nil)\n\trequire.NoError(t, err, c.errorMsg(\"signing failed\"))\n\n\tverifier, ok := signed.Verifiers[algoToSigType[c.keyAlgo]]\n\trequire.True(t, ok, c.errorMsg(\"Unknown verifier for algorithm\"))\n\n\terr = verifier.Verify(tufKey, signature, content)\n\trequire.NoError(t, err,\n\t\tc.errorMsg(\"verification failed for %s key type\", c.keyAlgo))\n}", "title": "" }, { "docid": "ea592b0ae9e420da28dd1d6b3edee71d", "score": "0.50726575", "text": "func (u *UserPath) GetTestnet() string {\n\treturn testnet\n}", "title": "" }, { "docid": "b87c5a59372ed203b913304462fe2ee0", "score": "0.50333476", "text": "func getDeviceAuthTest() (*gosip.SPClient, error) {\n\treturn r(&device.AuthCnfg{}, \"./config/private.spo-device.json\")\n}", "title": "" }, { "docid": "86d6d5972b86a9448d3b0edce9421114", "score": "0.49549958", "text": "func (r *ProviderRegister) GetRootSigningKey() (*fcrcrypto.KeyPair, error) {\n\treturn fcrcrypto.DecodePublicKey(r.RootSigningKey)\n}", "title": "" }, { "docid": "d0615475ad58bcccedd66b50823d87a8", "score": "0.49342987", "text": "func (pc *MockProviderContext) SigningManager() fab.SigningManager {\n\treturn pc.signingManager\n}", "title": "" }, { "docid": "5b7960e6aeaa9a4a318b01938de875b9", "score": "0.49341938", "text": "func (m *ParcelMock) GetSign() (r []byte) {\n\tcounter := atomic.AddUint64(&m.GetSignPreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetSignCounter, 1)\n\n\tif len(m.GetSignMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetSignMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to ParcelMock.GetSign.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetSignMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ParcelMock.GetSign\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignMock.mainExpectation != nil {\n\n\t\tresult := m.GetSignMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ParcelMock.GetSign\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to ParcelMock.GetSign.\")\n\t\treturn\n\t}\n\n\treturn m.GetSignFunc()\n}", "title": "" }, { "docid": "02ce6de1d3fa88b5420ca8964ac61894", "score": "0.49149612", "text": "func (f Factory) SignMode() signing.SignMode {\n\treturn f.signMode\n}", "title": "" }, { "docid": "f07e5832375c2a06f0195dc24558234f", "score": "0.4906432", "text": "func (s Sign) getSignature(signingKey []byte, stringToSign string) string {\n\treturn hex.EncodeToString(sumHMAC(signingKey, []byte(stringToSign)))\n}", "title": "" }, { "docid": "52b0a0d3ce4a8eed1ca07ae646df442b", "score": "0.4903778", "text": "func (s Sign) getSigningKey(t time.Time) []byte {\n\tsecret := s.secretAccessKey\n\tdate := sumHMAC([]byte(\"AWS4\"+secret), []byte(t.Format(yyyymmdd)))\n\tregion := sumHMAC(date, []byte(s.region))\n\tservice := sumHMAC(region, []byte(\"s3\"))\n\tsigningKey := sumHMAC(service, []byte(\"aws4_request\"))\n\treturn signingKey\n}", "title": "" }, { "docid": "6453d00fc32817e1680c6ffb60af20d9", "score": "0.49008614", "text": "func (i *Invoice) CalculateSigningRoot() ([]byte, error) {\n\treturn i.CoreDocument.CalculateSigningRoot(i.DocumentType())\n}", "title": "" }, { "docid": "a94f8632d70e651e38326679c965943b", "score": "0.48527056", "text": "func GetSigningMethod(alg string) (method SigningMethod) {\n\tsigningMethodLock.RLock()\n\tdefer signingMethodLock.RUnlock()\n\n\tif methodF, ok := signingMethods[alg]; ok {\n\t\tmethod = methodF()\n\t}\n\treturn\n}", "title": "" }, { "docid": "e9716ddcff7acad1163a6614497647c5", "score": "0.4821872", "text": "func (c CryptoServiceTester) TestSignNoMatchingKeys(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err, c.errorMsg(\"error creating key\"))\n\n\t// Test Sign\n\t_, _, err = cryptoService.GetPrivateKey(privKey.ID())\n\trequire.Error(t, err, c.errorMsg(\"Should not have found private key\"))\n}", "title": "" }, { "docid": "64a08c7ab4756bfae738ea9ce988838e", "score": "0.48193875", "text": "func (r *AttachmentPreview) GetSign() string {\n\treturn r.Sign\n}", "title": "" }, { "docid": "8f2ee0cd65419caccc1b730f153bbb86", "score": "0.47948366", "text": "func getSignature(signingKey []byte, stringToSign string) string {\n\treturn hex.EncodeToString(sumHMAC(signingKey, []byte(stringToSign)))\n}", "title": "" }, { "docid": "f9a4f84b84e05f5f308c94175ee61e93", "score": "0.47453535", "text": "func (s *SignatureVerification) GetSignature() string {\n\tif s == nil || s.Signature == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Signature\n}", "title": "" }, { "docid": "ff7850ff5d10b06ef7766604c2c0bee5", "score": "0.47159937", "text": "func (s *SignSuite) TearDownTest(c *C) {\n}", "title": "" }, { "docid": "4bcc040af4b889f073a62dc0007628f0", "score": "0.4714142", "text": "func getTmgAuthTest() (*gosip.SPClient, error) {\n\treturn r(&tmg.AuthCnfg{}, \"./config/private.onprem-tmg.json\")\n}", "title": "" }, { "docid": "75dc8fe9e788240ab6869c43e98c3186", "score": "0.47136882", "text": "func (m *ActiveNodeMock) GetSignatureVerifier() (r cryptkit.SignatureVerifier) {\n\tcounter := atomic.AddUint64(&m.GetSignatureVerifierPreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetSignatureVerifierCounter, 1)\n\n\tif len(m.GetSignatureVerifierMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetSignatureVerifierMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to ActiveNodeMock.GetSignatureVerifier.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetSignatureVerifierMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ActiveNodeMock.GetSignatureVerifier\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureVerifierMock.mainExpectation != nil {\n\n\t\tresult := m.GetSignatureVerifierMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ActiveNodeMock.GetSignatureVerifier\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureVerifierFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to ActiveNodeMock.GetSignatureVerifier.\")\n\t\treturn\n\t}\n\n\treturn m.GetSignatureVerifierFunc()\n}", "title": "" }, { "docid": "a57ab5cb60311311d322d1f68252db75", "score": "0.46912152", "text": "func (m *DeviceHealthAttestationState) GetSecureBootConfigurationPolicyFingerPrint()(*string) {\n val, err := m.GetBackingStore().Get(\"secureBootConfigurationPolicyFingerPrint\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2158132de4dbaa03b70e9dddad3dbdbd", "score": "0.46887404", "text": "func (m *GetInfoResponse) GetTestnet() bool {\n\tif m != nil {\n\t\treturn m.Testnet\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a88c00dc96af63d2777a09b9f8db8d62", "score": "0.46846467", "text": "func (e *Entity) CalculateSigningRoot() ([]byte, error) {\n\tdr, err := e.CalculateDataRoot()\n\tif err != nil {\n\t\treturn dr, err\n\t}\n\treturn e.CoreDocument.CalculateSigningRoot(e.DocumentType(), dr)\n}", "title": "" }, { "docid": "1c38ee5f868b4aba0210a7554e536940", "score": "0.46738455", "text": "func GetSignature(signedParams map[string]*string, secret *string) (_result *string) {\n\tstringToSign := buildStringToSign(signedParams)\n\tsignature := sign(stringToSign, tea.StringValue(secret))\n\treturn tea.String(signature)\n}", "title": "" }, { "docid": "6e54de73c9aeea99f59b9bb5478bc795", "score": "0.4619613", "text": "func TestGetPayment(t *testing.T) {\n\tfmt.Println(\"mp_test : GetPayment\")\n\n\tpmt, err := mp.GetPayment(\"8262805\")\n\tif err != nil {\n\t\tt.Fatalf(\"Error getting the payment: %v\", err)\n\t}\n\tfmt.Println(\"Payment: \", pmt)\n}", "title": "" }, { "docid": "159339a2a606d31e76035419e15fc53b", "score": "0.46073264", "text": "func (s *SigningMethodGCPJWTImpl) Verify(signingString, signature string, key interface{}) error {\n\tvar ctx context.Context\n\n\tswitch k := key.(type) {\n\tcase context.Context:\n\t\tctx = k\n\tdefault:\n\t\treturn jwt.ErrInvalidKey\n\t}\n\n\t// Get the IAMSignBlobConfig from the context\n\tconfig, ok := FromContextJWT(ctx)\n\tif !ok {\n\t\treturn fmt.Errorf(\"IAMSignJWTConfig missing from provided context!\")\n\t}\n\n\t// Default config.Client is a http.DefaultClient\n\tif config.Client == nil {\n\t\tconfig.Client = getDefaultClient(ctx)\n\t}\n\n\t// Let's get the header\n\tparts := strings.Split(signingString, \".\")\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"expected a 2 part string to sign, but got %d instead\", len(parts))\n\t}\n\tjwtHeaderRaw, err := jwt.DecodeSegment(parts[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\theader := &gcpJwtHeader{}\n\terr = json.Unmarshal(jwtHeaderRaw, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate the algorithm and get the KeyID\n\tif header.Algorithm != jwt.SigningMethodRS256.Alg() {\n\t\treturn fmt.Errorf(\"expected alg RS256, got %s instead\", header.Algorithm)\n\t}\n\n\tvar sig []byte\n\tif sig, err = jwt.DecodeSegment(signature); err != nil {\n\t\treturn err\n\t}\n\n\tvar cert string\n\n\tif config.DisableCache {\n\t\t// Not leveraging the cache, do a HTTP request for the certificates and carry on\n\t\tcertResp, cerr := getCertificatesForAccount(config.Client, config.ServiceAccount)\n\t\tif cerr != nil {\n\t\t\treturn cerr\n\t\t}\n\t\tif c, ok := certResp.certs[header.KeyID]; ok {\n\t\t\tcert = c\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"could not find certificate associated with kid %s for serviceaccount %s\", header.KeyID, config.ServiceAccount)\n\t\t}\n\t} else {\n\t\t// Check the cache for the certs and use those, otherwise grab 'em\n\t\tif c, ok := getCertFromCache(config.ServiceAccount, header.KeyID); ok {\n\t\t\tcert = c\n\t\t} else {\n\t\t\tcertResp, cerr := getCertificatesForAccount(config.Client, config.ServiceAccount)\n\t\t\tif cerr != nil {\n\t\t\t\treturn cerr\n\t\t\t}\n\t\t\tif c, ok := certResp.certs[header.KeyID]; ok {\n\t\t\t\tcert = c\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"could not find certificate associated with kid %s for serviceaccount %s\", header.KeyID, config.ServiceAccount)\n\t\t\t}\n\t\t\tupdateCache(config.ServiceAccount, certResp.certs, certResp.expires)\n\t\t}\n\t}\n\n\thasher := sha256.New()\n\t_, err = hasher.Write([]byte(signingString))\n\tif err != nil {\n\t\treturn err\n\t}\n\thash := hasher.Sum(nil)\n\n\treturn verifyWithCert(sig, hash, cert)\n}", "title": "" }, { "docid": "3632264e9909a8b21bc2b6fae64b74ee", "score": "0.46062043", "text": "func (ss StdSignature) GetSignature() []byte {\n\treturn ss.Signature\n}", "title": "" }, { "docid": "b4a6156921d231d5a9c6841b69f3906d", "score": "0.46044323", "text": "func (config *Config) GetSignatureVerifier() signature.SignatureVerifier {\n\tsigVerifierImpl := config.signatureVerifier\n\tvar sigVerifier signature.SignatureVerifier\n\tswitch sigVerifierImpl {\n\tcase \"aes.signature.verifier\":\n\t\tsigVerifier = signature.AESSignatureVerifier{}\n\t\tbreak\n\tdefault:\n\t\tsigVerifier = signature.AESSignatureVerifier{}\n\t}\n\treturn sigVerifier\n}", "title": "" }, { "docid": "29b8e766952e6800a4b667c575782162", "score": "0.4599915", "text": "func (f Factory) getSimPK() (cryptotypes.PubKey, error) {\n\tvar (\n\t\tok bool\n\t\tpk cryptotypes.PubKey = &secp256k1.PubKey{} // use default public key type\n\t)\n\n\t// Use the first element from the list of keys in order to generate a valid\n\t// pubkey that supports multiple algorithms.\n\tif f.simulateAndExecute && f.keybase != nil {\n\t\trecords, _ := f.keybase.List()\n\t\tif len(records) == 0 {\n\t\t\treturn nil, errors.New(\"cannot build signature for simulation, key records slice is empty\")\n\t\t}\n\n\t\t// take the first record just for simulation purposes\n\t\tpk, ok = records[0].PubKey.GetCachedValue().(cryptotypes.PubKey)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"cannot build signature for simulation, failed to convert proto Any to public key\")\n\t\t}\n\t}\n\n\treturn pk, nil\n}", "title": "" }, { "docid": "bfb04be20fbbfe17aec39087efba9687", "score": "0.45980164", "text": "func (p *PacketCryptAnn) HasSigningKey() bool {\n\treturn !pcutil.IsZero(p.GetSigningKey())\n}", "title": "" }, { "docid": "66c3c7f5f3f2524d710f37e55e98d4c6", "score": "0.45966178", "text": "func (o *RiskRulesListAllOfData) GetIsTest() bool {\n\tif o == nil || IsNil(o.IsTest) {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsTest\n}", "title": "" }, { "docid": "f1ba0111b740f577e2d98844f5d70e98", "score": "0.45863146", "text": "func (a *ActiveDevice) setSigningKey(g *GlobalContext, uv keybase1.UserVersion, deviceID keybase1.DeviceID,\n\tsigKey GenericKey, deviceName string) error {\n\ta.Lock()\n\tdefer a.Unlock()\n\n\tif err := a.internalUpdateUserVersionDeviceID(uv, deviceID); err != nil {\n\t\treturn err\n\t}\n\n\ta.signingKey = sigKey\n\tif len(deviceName) > 0 {\n\t\ta.deviceName = deviceName\n\t}\n\ta.nistFactory = NewNISTFactory(g, uv.Uid, deviceID, sigKey)\n\treturn nil\n}", "title": "" }, { "docid": "9c1bea32c6ef920289ba6f307e57137f", "score": "0.45820358", "text": "func TestTsigGenerate(t *testing.T) {\n\t// This is a template TSIG to be used for signing.\n\ttsig := TSIG{\n\t\tHdr: RR_Header{Name: \"testkey.\", Rrtype: TypeTSIG, Class: ClassANY, Ttl: 0},\n\t\tAlgorithm: HmacSHA256,\n\t\tTimeSigned: timeSigned,\n\t\tFudge: 300,\n\t\tOrigId: 42,\n\t\tError: RcodeBadTime, // use a non-0 value to make sure it's indeed used\n\t}\n\n\ttests := []struct {\n\t\tdesc string // test description\n\t\trequestMAC string // request MAC to be passed to TsigGenerate (arbitrary choice)\n\t\totherData string // other data specified in the TSIG (arbitrary choice)\n\t\texpectedMAC string // pre-computed expected (correct) MAC in hex form\n\t}{\n\t\t{\"with request MAC\", \"3684c225\", \"\",\n\t\t\t\"c110e3f62694755c10761dc8717462431ee34340b7c9d1eee09449150757c5b1\"},\n\t\t{\"no request MAC\", \"\", \"\",\n\t\t\t\"385449a425c6d52b9bf2c65c0726eefa0ad8084cdaf488f24547e686605b9610\"},\n\t\t{\"with other data\", \"3684c225\", \"666f6f\",\n\t\t\t\"15b91571ca80b3b410a77e2b44f8cc4f35ace22b26020138439dd94803e23b5d\"},\n\t}\n\tfor _, tc := range tests {\n\t\ttc := tc\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\t// Build TSIG for signing from the template\n\t\t\ttestTSIG := tsig\n\t\t\ttestTSIG.OtherLen = uint16(len(tc.otherData) / 2)\n\t\t\ttestTSIG.OtherData = tc.otherData\n\t\t\treq := &Msg{\n\t\t\t\tMsgHdr: MsgHdr{Opcode: OpcodeUpdate},\n\t\t\t\tQuestion: []Question{{Name: \"example.com.\", Qtype: TypeSOA, Qclass: ClassINET}},\n\t\t\t\tExtra: []RR{&testTSIG},\n\t\t\t}\n\n\t\t\t// Call generate, and check the returned MAC against the expected value\n\t\t\tmsgData, mac, err := TsigGenerate(req, testSecret, tc.requestMAC, false)\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tif mac != tc.expectedMAC {\n\t\t\t\tt.Fatalf(\"MAC doesn't match: expected '%s', but got '%s'\", tc.expectedMAC, mac)\n\t\t\t}\n\n\t\t\t// Retrieve the TSIG to be sent out, confirm the MAC in it\n\t\t\t_, outTSIG, err := stripTsig(msgData)\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t\tif outTSIG.MAC != tc.expectedMAC {\n\t\t\t\tt.Fatalf(\"MAC doesn't match: expected '%s', but got '%s'\", tc.expectedMAC, outTSIG.MAC)\n\t\t\t}\n\t\t\t// Confirm other fields of MAC.\n\t\t\t// RDLENGTH should be valid as stripTsig succeeded, so we exclude it from comparison\n\t\t\toutTSIG.MACSize = 0\n\t\t\toutTSIG.MAC = \"\"\n\t\t\ttestTSIG.Hdr.Rdlength = outTSIG.Hdr.Rdlength\n\t\t\tif *outTSIG != testTSIG {\n\t\t\t\tt.Fatalf(\"TSIG RR doesn't match: expected '%v', but got '%v'\", *outTSIG, testTSIG)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "42b1e6c759424ff08d14b1861e3cdb64", "score": "0.4579119", "text": "func TestConfig(key []byte, now time.Time) *Config {\n\treturn &Config{\n\t\tsigningKey: key,\n\t\tclock: &utils.TestClock{Time: now},\n\t}\n}", "title": "" }, { "docid": "5349ef83224cba05dc09ec8bded907b8", "score": "0.45705402", "text": "func (m *CryptographyServiceMock) Sign(p []byte) (r *insolar.Signature, r1 error) {\n\tcounter := atomic.AddUint64(&m.SignPreCounter, 1)\n\tdefer atomic.AddUint64(&m.SignCounter, 1)\n\n\tif len(m.SignMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.SignMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to CryptographyServiceMock.Sign. %v\", p)\n\t\t\treturn\n\t\t}\n\n\t\tinput := m.SignMock.expectationSeries[counter-1].input\n\t\ttestify_assert.Equal(m.t, *input, CryptographyServiceMockSignInput{p}, \"CryptographyService.Sign got unexpected parameters\")\n\n\t\tresult := m.SignMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the CryptographyServiceMock.Sign\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\t\tr1 = result.r1\n\n\t\treturn\n\t}\n\n\tif m.SignMock.mainExpectation != nil {\n\n\t\tinput := m.SignMock.mainExpectation.input\n\t\tif input != nil {\n\t\t\ttestify_assert.Equal(m.t, *input, CryptographyServiceMockSignInput{p}, \"CryptographyService.Sign got unexpected parameters\")\n\t\t}\n\n\t\tresult := m.SignMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the CryptographyServiceMock.Sign\")\n\t\t}\n\n\t\tr = result.r\n\t\tr1 = result.r1\n\n\t\treturn\n\t}\n\n\tif m.SignFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to CryptographyServiceMock.Sign. %v\", p)\n\t\treturn\n\t}\n\n\treturn m.SignFunc(p)\n}", "title": "" }, { "docid": "5701b1de048170c69962e07738fef0c5", "score": "0.45697805", "text": "func (stub *MockStub) GetSignedProposal() (*pb.SignedProposal, error) {\n\treturn stub.signedProposal, nil\n}", "title": "" }, { "docid": "0ea01352256e50a5a7b6e369e11a2ea7", "score": "0.45599392", "text": "func (msg MsgTest) GetSignBytes() []byte {\n\tb, err := json.Marshal(msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn sdk.MustSortJSON(b)\n}", "title": "" }, { "docid": "e2c763f5973ef5c7fb44b4ec9e3af5c7", "score": "0.45594016", "text": "func (m *MacOSEnterpriseWiFiConfiguration) GetRootCertificateForServerValidation()(MacOSTrustedRootCertificateable) {\n val, err := m.GetBackingStore().Get(\"rootCertificateForServerValidation\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(MacOSTrustedRootCertificateable)\n }\n return nil\n}", "title": "" }, { "docid": "b3c2d0813cfb8044b6f2024718cfb086", "score": "0.45547917", "text": "func GetDefaultSigningKeyFile(isPublic bool) (string, error) {\n\t// we have to use $HOME for now because os/user is not implemented on some plateforms\n\thome_dir := os.Getenv(\"HOME\")\n\tif home_dir == \"\" {\n\t\thome_dir = \"/tmp/keys\"\n\t}\n\n\tif isPublic {\n\t\treturn filepath.Join(home_dir, DEFAULT_PUBLIC_KEY_FILE), nil\n\t} else {\n\t\treturn filepath.Join(home_dir, DEFAULT_PRIVATE_KEY_FILE), nil\n\t}\n}", "title": "" }, { "docid": "4059d8a1d64051f4d8bdea73688d01ce", "score": "0.45535225", "text": "func (s *SignSuite) SetUpTest(c *C) {\n}", "title": "" }, { "docid": "60826f5b84b47ce69ffd008cb8e47272", "score": "0.45454594", "text": "func (r *AttachmentOriginal) GetSign() string {\n\treturn r.Sign\n}", "title": "" }, { "docid": "49a795b4067b58aa5f8118e920160b0f", "score": "0.4535453", "text": "func (m *SignatureKeyHolderMock) GetSignatureKeyType() (r SignatureKeyType) {\n\tcounter := atomic.AddUint64(&m.GetSignatureKeyTypePreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetSignatureKeyTypeCounter, 1)\n\n\tif len(m.GetSignatureKeyTypeMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetSignatureKeyTypeMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignatureKeyType.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetSignatureKeyTypeMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignatureKeyType\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureKeyTypeMock.mainExpectation != nil {\n\n\t\tresult := m.GetSignatureKeyTypeMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignatureKeyType\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureKeyTypeFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignatureKeyType.\")\n\t\treturn\n\t}\n\n\treturn m.GetSignatureKeyTypeFunc()\n}", "title": "" }, { "docid": "4491c53d590d4ebde2fa3fe0be2d1080", "score": "0.4532625", "text": "func TestSignPayPlatform(t *testing.T) {\n\tConvey(\"TestSignPayPlatform \", t, func() {\n\t\tpp := make(map[string]interface{})\n\t\tpp[\"customerId\"] = 10001\n\t\tpp[\"deviceType\"] = 3\n\t\tsign := s.signPayPlatform(pp, s.dao.PaySign)\n\t\tt.Logf(\"order no (%s)\", sign)\n\t\tr := &model.PayParam{\n\t\t\tCustomerID: 10001,\n\t\t\tDeviceType: 3,\n\t\t}\n\t\tstr, _ := json.Marshal(r)\n\t\tpstr, _ := json.Marshal(pp)\n\t\tt.Logf(\"order no (%s) (%s)\", str, pstr)\n\t\tSo(string(str) == string(pstr), ShouldBeTrue)\n\t})\n}", "title": "" }, { "docid": "4730696956407244e8c60a183650038e", "score": "0.4530881", "text": "func GetTestClient(path string) *Keystoreclient {\n\treturn &Keystoreclient{linker: &localLinker{store: make(map[string]*google_protobuf.Any)}, retries: 5, backoffTime: time.Millisecond * 5}\n}", "title": "" }, { "docid": "51f9a64d9d2938650f616d2841f8ac36", "score": "0.45232037", "text": "func NewTestPoSt() []byte {\n\treturn make([]byte, OnePoStProofPartition.ProofLen())\n}", "title": "" }, { "docid": "c2ba61a967130008c4cd3f49118c4070", "score": "0.45172298", "text": "func RunJSONSerializationTestForKeyVaultSigningKeyParameters(subject KeyVaultSigningKeyParameters) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual KeyVaultSigningKeyParameters\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7ee3a9c314fbc391751f69ccb4ca9693", "score": "0.4509267", "text": "func InitSigningKey() string {\n\treturn uniuri.NewLen(32)\n}", "title": "" }, { "docid": "319466e319f89a183acb16230e9664f3", "score": "0.45090437", "text": "func NewSigningRoundTripper(rt http.RoundTripper, app, secret string) *SigningRoundTripper {\n\tif rt == nil {\n\t\trt = http.DefaultTransport\n\t}\n\treturn &SigningRoundTripper{rt, app, secret}\n}", "title": "" }, { "docid": "9c58f8303fe65f04ed20b36f20dea958", "score": "0.45067883", "text": "func (a *ActiveDevice) SigningKey() (GenericKey, error) {\n\ta.RLock()\n\tdefer a.RUnlock()\n\tif a.signingKey == nil {\n\t\treturn nil, NotFoundError{\n\t\t\tMsg: \"Not found: device signing key\",\n\t\t}\n\t}\n\treturn a.signingKey, nil\n}", "title": "" }, { "docid": "02ea1b11c51d0e0be05cc1ad09ad8f03", "score": "0.44951347", "text": "func (m *InternalDomainFederation) GetNextSigningCertificate()(*string) {\n val, err := m.GetBackingStore().Get(\"nextSigningCertificate\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "124b3a37d56931440b59cd25dc91a3e9", "score": "0.44703308", "text": "func (h HTTPInvalidRequestLine) GetTestKeys(tk map[string]interface{}) (interface{}, error) {\n\ttestKeys := HTTPInvalidRequestLineTestKeys{IsAnomaly: false}\n\n\ttampering, ok := tk[\"tampering\"].(bool)\n\tif !ok {\n\t\treturn testKeys, errors.New(\"tampering is not bool\")\n\t}\n\ttestKeys.IsAnomaly = tampering\n\n\treturn testKeys, nil\n}", "title": "" }, { "docid": "2479204a6811aff508714a5990dc3d41", "score": "0.4466107", "text": "func TestBasicSign(t *testing.T) {\n\tcs := NewEd25519()\n\tkey, err := cs.Create(data.CanonicalRootRole, \"\", data.ED25519Key)\n\trequire.NoError(t, err)\n\ttestData := data.Signed{\n\t\tSigned: &json.RawMessage{},\n\t}\n\n\terr = Sign(cs, &testData, key)\n\trequire.NoError(t, err)\n\n\tif len(testData.Signatures) != 1 {\n\t\tt.Fatalf(\"Incorrect number of signatures: %d\", len(testData.Signatures))\n\t}\n\n\tif testData.Signatures[0].KeyID != key.ID() {\n\t\tt.Fatalf(\"Wrong signature ID returned: %s\", testData.Signatures[0].KeyID)\n\t}\n}", "title": "" }, { "docid": "ccfbc1b64ac16c3d9b35cb78dc7d6adc", "score": "0.44645557", "text": "func (h FacebookMessenger) GetTestKeys(tk map[string]interface{}) (interface{}, error) {\n\tvar (\n\t\tdnsBlocking bool\n\t\ttcpBlocking bool\n\t)\n\tif tk[\"facebook_dns_blocking\"] == nil {\n\t\tdnsBlocking = false\n\t} else {\n\t\tdnsBlocking = tk[\"facebook_dns_blocking\"].(bool)\n\t}\n\n\tif tk[\"facebook_tcp_blocking\"] == nil {\n\t\ttcpBlocking = false\n\t} else {\n\t\ttcpBlocking = tk[\"facebook_tcp_blocking\"].(bool)\n\t}\n\n\treturn FacebookMessengerTestKeys{\n\t\tDNSBlocking: dnsBlocking,\n\t\tTCPBlocking: tcpBlocking,\n\t\tIsAnomaly: dnsBlocking || tcpBlocking,\n\t}, nil\n}", "title": "" }, { "docid": "76709ab3b23f65ceadd1b1a227e14258", "score": "0.4461814", "text": "func TestSignWithTSUEmbedTSUCertificate(t *testing.T) {\n\ttsukey := getTSURSAKey()\n\ttsuCert := getTSUCert()\n\n\th := sha256.New()\n\t_, err := h.Write([]byte(\"Hello World\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tgenTime := time.Now().UTC()\n\n\tnonce := big.NewInt(0)\n\tnonce = nonce.SetBytes([]byte{0x1, 0x2, 0x3})\n\n\tduration, _ := time.ParseDuration(\"1s\")\n\n\ttimestamp := Timestamp{\n\t\tHashAlgorithm: crypto.SHA256,\n\t\tHashedMessage: h.Sum(nil),\n\t\tTime: genTime,\n\t\tNonce: nonce,\n\t\tPolicy: asn1.ObjectIdentifier{2, 4, 5, 6},\n\t\tOrdering: true,\n\t\tAccuracy: duration,\n\t\tQualified: true,\n\t\tAddTSACertificate: true,\n\t}\n\ttimestampBytes, err := timestamp.CreateResponse(tsuCert, tsukey)\n\tif err != nil {\n\t\tt.Errorf(\"unable to generate time stamp response: %s\", err.Error())\n\t}\n\n\ttimestampRes, err := ParseResponse(timestampBytes)\n\tif err != nil {\n\t\tt.Fatalf(\"unable to parse time stamp response: %s\", err.Error())\n\t}\n\n\tif timestampRes.HashAlgorithm.HashFunc() != crypto.SHA256 {\n\t\tt.Errorf(\"expected hash algorithm is SHA256\")\n\t}\n\tif len(timestampRes.HashedMessage) != 32 {\n\t\tt.Errorf(\"got %d: expected: %d\", len(timestampRes.HashedMessage), 32)\n\t}\n\n\tif timestampRes.Accuracy != duration {\n\t\tt.Errorf(\"got accuracy %s: expected: %s\", timestampRes.Accuracy, duration)\n\t}\n\n\tif !timestampRes.Qualified {\n\t\tt.Errorf(\"got %t: expected: %t\", timestampRes.Qualified, true)\n\t}\n\n\tif !timestampRes.AddTSACertificate {\n\t\tt.Error(\"TSU certificate must be included in timestamp response\")\n\t}\n}", "title": "" }, { "docid": "393cd1a9c3f7118b2af26b1a58a06f1c", "score": "0.44569233", "text": "func (m *SignatureKeyHolderMock) GetSignatureKeyMethod() (r SignatureMethod) {\n\tcounter := atomic.AddUint64(&m.GetSignatureKeyMethodPreCounter, 1)\n\tdefer atomic.AddUint64(&m.GetSignatureKeyMethodCounter, 1)\n\n\tif len(m.GetSignatureKeyMethodMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.GetSignatureKeyMethodMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignatureKeyMethod.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.GetSignatureKeyMethodMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignatureKeyMethod\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureKeyMethodMock.mainExpectation != nil {\n\n\t\tresult := m.GetSignatureKeyMethodMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the SignatureKeyHolderMock.GetSignatureKeyMethod\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.GetSignatureKeyMethodFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to SignatureKeyHolderMock.GetSignatureKeyMethod.\")\n\t\treturn\n\t}\n\n\treturn m.GetSignatureKeyMethodFunc()\n}", "title": "" }, { "docid": "e0210f577caeafbc03322cd5fc9e36d7", "score": "0.44359317", "text": "func RunJSONSerializationTestForUrlSigningKey(subject UrlSigningKey) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual UrlSigningKey\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "02f48845ea57f10e4d68935ba35a9669", "score": "0.44329768", "text": "func CreateSignatureForTests() *Signature {\n\tmet := concrete_files.CreateFileForTests()\n\tsig := concrete_files.CreateFileForTests()\n\tusr := CreateUserForTests()\n\tout := createSignature(met, sig, usr)\n\treturn out.(*Signature)\n}", "title": "" }, { "docid": "8cb1b73b777b61e8d3c0b4b9cdee49ae", "score": "0.44315422", "text": "func (m *InternalDomainFederation) GetIsSignedAuthenticationRequestRequired()(*bool) {\n val, err := m.GetBackingStore().Get(\"isSignedAuthenticationRequestRequired\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "1c2f26b0aaff9da5de24ee47b76eeb1b", "score": "0.44263405", "text": "func getSamlAuthTest() (*gosip.SPClient, error) {\n\treturn r(&saml.AuthCnfg{}, \"./config/private.spo-user.json\")\n}", "title": "" }, { "docid": "491ebd19330902e53ee9c109bf27b883", "score": "0.4423794", "text": "func VerifySigningKeyInput(keyFile string, isPublic bool) string {\n\tkeyFile = verifySigningKeyInputHelper(keyFile, isPublic, false)\n\tif _, err := os.Stat(keyFile); os.IsNotExist(err) {\n\t\tkeyFile = verifySigningKeyInputHelper(keyFile, isPublic, true)\n\t\tif _, err := os.Stat(keyFile); os.IsNotExist(err) {\n\t\t\tFatal(CLI_GENERAL_ERROR, i18n.GetMessagePrinter().Sprintf(\"%v. Please create the signing key.\", err))\n\t\t}\n\t}\n\n\treturn keyFile\n}", "title": "" }, { "docid": "677d48cf38cab5bea266c394b02997ec", "score": "0.44188914", "text": "func (stg *securityTestGroup) teardownTest() {\n\tctx := ts.tu.MustGetLoggedInContext(context.Background())\n\ts, err := stg.securityRestIf.List(ctx, &api.ListWatchOptions{})\n\t// delete the sg policy\n\tExpect(err).ShouldNot(HaveOccurred())\n\tEventually(func() bool {\n\t\tBy(\"Deleting Security Policy ------\")\n\t\tfor _, i := range s {\n\t\t\t_, err := stg.securityRestIf.Delete(ctx, i.GetObjectMeta())\n\t\t\tif err != nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}, 30, 5).Should(BeTrue(), fmt.Sprintf(\"Failed to delete security policy after testing process\"))\n\tsnIf := ts.tu.APIClient.ClusterV1().DistributedServiceCard()\n\tvalidateCluster()\n\tvalidateNICHealth(context.Background(), snIf, ts.tu.NumNaplesHosts, cmd.ConditionStatus_TRUE)\n}", "title": "" }, { "docid": "5fb8224df62c688bf0b2c4118e16ae1d", "score": "0.44182163", "text": "func GetTestEnterpriseCode() string {\n\tcachedEnterpriseCodeMut.Lock()\n\tdefer cachedEnterpriseCodeMut.Unlock()\n\n\tif cachedEnterpriseCode != \"\" {\n\t\treturn cachedEnterpriseCode\n\t}\n\n\t// Get test enterprise code from s3. The Pachyderm Enterprise test activation\n\t// token is stored in\n\t// s3://pachyderm-engineering/test_enterprise_activation_code.txt\n\ts3client := s3.New(session.Must(session.NewSessionWithOptions(\n\t\tsession.Options{\n\t\t\tConfig: aws.Config{\n\t\t\t\tRegion: aws.String(\"us-west-1\"), // contains s3://pachyderm-engineering\n\t\t\t},\n\t\t})))\n\t// S3 client requires string pointers. Go does not allow programs to take the\n\t// address of constants, so we must create strings here\n\toutput, err := s3client.GetObject(&s3.GetObjectInput{\n\t\tBucket: aws.String(\"pachyderm-engineering\"),\n\t\tKey: aws.String(\"test_enterprise_activation_code.txt\"),\n\t})\n\tif err != nil {\n\t\t// tests can't run without credentials -- just crash\n\t\tpanic(fmt.Sprintf(\"cannot get test enterprise token from s3: %v\", err))\n\t}\n\tbuf := &bytes.Buffer{}\n\tif _, err = buf.ReadFrom(output.Body); err != nil {\n\t\tpanic(fmt.Sprintf(\"cannot copy test enterprise token to buffer: %v\", err))\n\t}\n\tcachedEnterpriseCode = buf.String()\n\treturn cachedEnterpriseCode\n}", "title": "" }, { "docid": "25b0cb3e7117382b68fcad51b3d56919", "score": "0.44175994", "text": "func (keyRing *KeyRing) GetSigningEntity() (*openpgp.Entity, error) {\n\tvar signEntity *openpgp.Entity\n\n\tfor _, e := range keyRing.entities {\n\t\t// Entity.PrivateKey must be a signing key\n\t\tif e.PrivateKey != nil {\n\t\t\tif !e.PrivateKey.Encrypted {\n\t\t\t\tsignEntity = e\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif signEntity == nil {\n\t\terr := errors.New(\"gopenpgp: cannot sign message, unable to unlock signer key\")\n\t\treturn signEntity, err\n\t}\n\n\treturn signEntity, nil\n}", "title": "" }, { "docid": "f5f6a7c61278001ab04589a10be638f7", "score": "0.44074517", "text": "func GetSignedFlavor(flavorString string, rsaPrivateKeyLocation string) (string, error) {\n\tvar privateKey *rsa.PrivateKey\n\tvar flavorInterface flavor.ImageFlavor\n\tif rsaPrivateKeyLocation == \"\" {\n\t\tlog.Error(\"No RSA Key file path provided\")\n\t\treturn \"\", errors.New(\"No RSA Key file path provided\")\n\t}\n\n\tpriv, err := ioutil.ReadFile(rsaPrivateKeyLocation)\n\tif err != nil {\n\t\tlog.Error(\"No RSA private key found\")\n\t\treturn \"\", err\n\t}\n\n\tprivPem, _ := pem.Decode(priv)\n\tparsedKey, err := x509.ParsePKCS8PrivateKey(privPem.Bytes)\n\tif err != nil {\n\t\tlog.Error(\"Cannot parse RSA private key from file\")\n\t\treturn \"\", err\n\t}\n\n\tprivateKey, ok := parsedKey.(*rsa.PrivateKey)\n\tif !ok {\n\t\tlog.Error(\"Unable to parse RSA private key\")\n\t\treturn \"\", err\n\t}\n\thashEntity := sha512.New384()\n\t_, err = hashEntity.Write([]byte(flavorString))\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Error while writing flavor hash: \" + err.Error())\n\t}\n\tsignature, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA384, hashEntity.Sum(nil))\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Error while signing flavor: \" + err.Error())\n\t}\n\tsignatureString := base64.StdEncoding.EncodeToString(signature)\n\n\terr = json.Unmarshal([]byte(flavorString), &flavorInterface)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Error while unmarshalling signed image flavor: \" + err.Error())\n\t}\n\n\tsignedFlavor := &flavor.SignedImageFlavor{\n\t\tImageFlavor: flavorInterface.Image,\n\t\tSignature: signatureString,\n\t}\n\n\tsignedFlavorJSON, err := json.Marshal(signedFlavor)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Error while marshalling signed image flavor: \" + err.Error())\n\t}\n\n\treturn string(signedFlavorJSON), nil\n}", "title": "" }, { "docid": "c35da96ee1cd05e00d1d749a6f2987de", "score": "0.44070604", "text": "func SigningPolicy(certExpiry time.Duration) *cfconfig.Signing {\n\t// Force the minimum Certificate expiration to be fifteen minutes\n\tif certExpiry < MinNodeCertExpiration {\n\t\tcertExpiry = DefaultNodeCertExpiration\n\t}\n\n\t// Add the backdate\n\tcertExpiry = certExpiry + CertBackdate\n\n\treturn &cfconfig.Signing{\n\t\tDefault: &cfconfig.SigningProfile{\n\t\t\tUsage: []string{\"signing\", \"key encipherment\", \"server auth\", \"client auth\"},\n\t\t\tExpiry: certExpiry,\n\t\t\tBackdate: CertBackdate,\n\t\t\t// Only trust the key components from the CSR. Everything else should\n\t\t\t// come directly from API call params.\n\t\t\tCSRWhitelist: &cfconfig.CSRWhitelist{\n\t\t\t\tPublicKey: true,\n\t\t\t\tPublicKeyAlgorithm: true,\n\t\t\t\tSignatureAlgorithm: true,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "416cb309d7b6489846f7fdba03bc11d5", "score": "0.43908018", "text": "func (m *IosDeviceFeaturesConfiguration) GetSingleSignOnExtensionPkinitCertificate()(IosCertificateProfileBaseable) {\n val, err := m.GetBackingStore().Get(\"singleSignOnExtensionPkinitCertificate\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(IosCertificateProfileBaseable)\n }\n return nil\n}", "title": "" }, { "docid": "08bfab0e7ecf277fb39bf870e87edd11", "score": "0.43887448", "text": "func (m *Client) GetWebhookSigningSecret(arg0 context.Context, arg1 string) (*zendesk.WebhookSigningSecret, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetWebhookSigningSecret\", arg0, arg1)\n\tret0, _ := ret[0].(*zendesk.WebhookSigningSecret)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "bc69adeca098c6af3e961c25c153f11e", "score": "0.4387975", "text": "func (h SignModeHandler) GetSignBytes(_ context.Context, signerData signing.SignerData, txData signing.TxData) ([]byte, error) {\n\tbody := txData.Body\n\t_, err := decode.RejectUnknownFields(\n\t\ttxData.BodyBytes, body.ProtoReflect().Descriptor(), false, h.fileResolver)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif (len(body.ExtensionOptions) > 0) || (len(body.NonCriticalExtensionOptions) > 0) {\n\t\treturn nil, fmt.Errorf(\"%s does not support protobuf extension options: invalid request\", h.Mode())\n\t}\n\n\tif signerData.Address == \"\" {\n\t\treturn nil, fmt.Errorf(\"got empty address in %s handler: invalid request\", h.Mode())\n\t}\n\n\ttip := txData.AuthInfo.Tip\n\tif tip != nil && tip.Tipper == \"\" {\n\t\treturn nil, fmt.Errorf(\"tipper cannot be empty\")\n\t}\n\tisTipper := tip != nil && tip.Tipper == signerData.Address\n\n\t// We set a convention that if the tipper signs with LEGACY_AMINO_JSON, then\n\t// they sign over empty fees and 0 gas.\n\tvar fee *aminojsonpb.AminoSignFee\n\tif isTipper {\n\t\tfee = &aminojsonpb.AminoSignFee{\n\t\t\tAmount: nil,\n\t\t\tGas: 0,\n\t\t}\n\t} else {\n\t\tf := txData.AuthInfo.Fee\n\t\tif f == nil {\n\t\t\treturn nil, fmt.Errorf(\"fee cannot be nil when tipper is not signer\")\n\t\t}\n\t\tfee = &aminojsonpb.AminoSignFee{\n\t\t\tAmount: f.Amount,\n\t\t\tGas: f.GasLimit,\n\t\t\tPayer: f.Payer,\n\t\t\tGranter: f.Granter,\n\t\t}\n\t}\n\n\tsignDoc := &aminojsonpb.AminoSignDoc{\n\t\tAccountNumber: signerData.AccountNumber,\n\t\tTimeoutHeight: body.TimeoutHeight,\n\t\tChainId: signerData.ChainID,\n\t\tSequence: signerData.Sequence,\n\t\tMemo: body.Memo,\n\t\tMsgs: txData.Body.Messages,\n\t\tFee: fee,\n\t\tTip: tip,\n\t}\n\n\treturn h.encoder.Marshal(signDoc)\n}", "title": "" }, { "docid": "5659b244b6d60ed322da4fff3aa1852b", "score": "0.43868563", "text": "func (m *ParcelMock) GetSignFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.GetSignMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.GetSignCounter) == uint64(len(m.GetSignMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.GetSignMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.GetSignCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.GetSignFunc != nil {\n\t\treturn atomic.LoadUint64(&m.GetSignCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "1a12b8afc0c09b9d1acd05a49c0fe908", "score": "0.43864343", "text": "func (s *SigningMethodGCPJWTImpl) Sign(signingString string, key interface{}) (string, error) {\n\tvar ctx context.Context\n\n\t// check to make sure the key is a context.Context\n\tswitch k := key.(type) {\n\tcase context.Context:\n\t\tctx = k\n\tdefault:\n\t\treturn \"\", jwt.ErrInvalidKey\n\t}\n\n\t// Get the IAMSignBlobConfig from the context\n\tconfig, ok := FromContextJWT(ctx)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"IAMSignJWTConfig missing from provided context!\")\n\t}\n\n\t// Default config.OAuth2HTTPClient is a google.DefaultClient\n\tif config.OAuth2HTTPClient == nil {\n\t\tc, err := getDefaultOauthClient(ctx)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tconfig.OAuth2HTTPClient = c\n\t}\n\n\t// Default the ProjectID to a wildcard\n\tif config.ProjectID == \"\" {\n\t\tconfig.ProjectID = \"-\"\n\t}\n\n\t// Prepare the call\n\t// First decode the JSON string and discard the header\n\tparts := strings.Split(signingString, \".\")\n\tif len(parts) != 2 {\n\t\treturn \"\", fmt.Errorf(\"expected a 2 part string to sign, but got %d instead\", len(parts))\n\t}\n\tjwtClaimSet, err := jwt.DecodeSegment(parts[1])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsignReq := &iam.SignJwtRequest{Payload: string(jwtClaimSet)}\n\tname := fmt.Sprintf(\"projects/%s/serviceAccounts/%s\", config.ProjectID, config.ServiceAccount)\n\n\t// Do the call\n\tiamService, err := iam.New(config.OAuth2HTTPClient)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsignResp, err := iamService.Projects.ServiceAccounts.SignJwt(name, signReq).Do()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Check the response\n\tif signResp.HTTPStatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"unexpected response code from signing request, expected %d but got %d instead\", http.StatusOK, signResp.HTTPStatusCode)\n\t}\n\n\treturn signResp.SignedJwt, nil\n}", "title": "" }, { "docid": "fef0d36696eb89c5740dead87d44b9a1", "score": "0.4377141", "text": "func GetFakeEnvelope(c *Configuration) []byte {\n\tl := c.toInternal().EnvelopeSize\n\treturn make([]byte, l)\n}", "title": "" }, { "docid": "6c1a265be9821774811c19fbca744b21", "score": "0.43767053", "text": "func (x *UiDetectionRequest) GetTestId() string {\n\tif x != nil {\n\t\treturn x.TestId\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d844bbd99f583e400345fc748caae891", "score": "0.43744186", "text": "func (keyRing *KeyRing) getSigningEntity() (*openpgp.Entity, error) {\n\tvar signEntity *openpgp.Entity\n\n\tfor _, e := range keyRing.entities {\n\t\t// Entity.PrivateKey must be a signing key\n\t\tif e.PrivateKey != nil {\n\t\t\tif !e.PrivateKey.Encrypted {\n\t\t\t\tsignEntity = e\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif signEntity == nil {\n\t\treturn nil, errors.New(\"gopenpgp: cannot sign message, unable to unlock signer key\")\n\t}\n\n\treturn signEntity, nil\n}", "title": "" }, { "docid": "e09200de557f3b7a0b5e737d153218f7", "score": "0.43729362", "text": "func (o *SamlConfigurationProperties) GetSignatureMethod() SamlConfigurationPropertyItemsString {\n\tif o == nil || o.SignatureMethod == nil {\n\t\tvar ret SamlConfigurationPropertyItemsString\n\t\treturn ret\n\t}\n\treturn *o.SignatureMethod\n}", "title": "" }, { "docid": "066fb575e560667a3edc1ae8fceb1804", "score": "0.43711674", "text": "func isTestSignature(sign *types.Signature) bool {\n\tif sign.Recv() != nil {\n\t\treturn false // test funcs don't have receivers\n\t}\n\tparams := sign.Params()\n\tif params.Len() != 1 {\n\t\treturn false // too many parameters for a test func\n\t}\n\tnamed := namedType(params.At(0).Type())\n\tif named == nil {\n\t\treturn false // the only parameter isn't named, like \"string\"\n\t}\n\tobj := named.Obj()\n\treturn obj != nil && obj.Pkg().Path() == \"testing\" && obj.Name() == \"T\"\n}", "title": "" }, { "docid": "d8a1562bfcec01a1e8a60dca10765932", "score": "0.43550032", "text": "func TestSignContractSuccess(t *testing.T) {\n\tsignatureHelper(t, false)\n}", "title": "" }, { "docid": "baeeb9a55ccd40bc698792f9b0b8677b", "score": "0.43532637", "text": "func GetSigningIdentity(mspConfigPath, mspID string, bccspConfig *config.BCCSP) (SigningIdentity, error) {\n\tmspInstance, err := LoadLocalMSPAt(mspConfigPath, mspID, BCCSPType, bccspConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsigningIdentity, err := mspInstance.GetDefaultSigningIdentity()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn signingIdentity, nil\n}", "title": "" }, { "docid": "9dfeda499f9aa20a2b64cf95f204a14a", "score": "0.43476593", "text": "func (u *Unit) GetSigner() string {\n\treturn u.Signer\n}", "title": "" }, { "docid": "a06489e5f56b19fd043b454761b00707", "score": "0.4342141", "text": "func test_getGasPrice(t *testing.T) {\n\t//services.RunOnTestNet()\n\tt.Skip(nil)\n\t// get the suggested gas price\n\tgasPrice, err := eth_gateway.EthWrapper.GetGasPrice()\n\tif err != nil {\n\t\tt.Fatalf(\"error retrieving gas price: %v\\n\", err)\n\t}\n\tif gasPrice.IsUint64() && gasPrice.Uint64() > 0 {\n\t\tt.Logf(\"gas price verified: %v\\n\", gasPrice)\n\t} else {\n\t\tt.Fatalf(\"gas price less than zero: %v\\n\", gasPrice)\n\t}\n\tt.Logf(\"current network gas price :%v\", gasPrice.String())\n}", "title": "" }, { "docid": "9c4321fc00100056cbec52fe263df1af", "score": "0.43398535", "text": "func (c *Provider) SigningManager() core.SigningManager {\n\treturn c.signingManager\n}", "title": "" }, { "docid": "82c3f29876a2236c0ac55cbb9eeade6d", "score": "0.433837", "text": "func (m *InternalDomainFederation) GetSigningCertificateUpdateStatus()(SigningCertificateUpdateStatusable) {\n val, err := m.GetBackingStore().Get(\"signingCertificateUpdateStatus\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(SigningCertificateUpdateStatusable)\n }\n return nil\n}", "title": "" } ]
288427ee882a039ae675cd53f835d2a2
NonceSize returns the required size of the nonce / IV.
[ { "docid": "530c6453aac48537b3c970ec41bd2b97", "score": "0.64417213", "text": "func (g *StupidGCM) NonceSize() int {\n\treturn ivLen\n}", "title": "" } ]
[ { "docid": "b2fd7b3d97a92339103b4032af884898", "score": "0.7221289", "text": "func (nonce Nonce) Size() int {\n\treturn len(nonce)\n}", "title": "" }, { "docid": "e85545979bd5d8be1decbf7de08c946f", "score": "0.67976874", "text": "func (s *Stream) NonceSize() int { return s.cipher.NonceSize() - 4 }", "title": "" }, { "docid": "0cc6459d28d5533e46aca84f32c1f278", "score": "0.65833825", "text": "func (jn JoinNonce) Size() int { return 3 }", "title": "" }, { "docid": "30b08a02150daaa4eea4534bf9fd560a", "score": "0.65218985", "text": "func (b *TencBox) Size() uint64 {\n\tvar size uint64 = 32\n\tif b.DefaultIsProtected == 1 && b.DefaultPerSampleIVSize == 0 {\n\t\tsize += uint64(1 + len(b.DefaultConstantIV))\n\t}\n\treturn size\n}", "title": "" }, { "docid": "c2f2e2bae1762ce5e5cd079d45379055", "score": "0.6472846", "text": "func (g *XChaCha20Poly1305) NonceSize() int {\n\treturn ccp.NonceSizeX\n}", "title": "" }, { "docid": "14131bf40d1fe935af124e54e78e869f", "score": "0.6389741", "text": "func (z AccountNonce) Msgsize() (s int) {\n\ts = hsp.Uint32Size\n\treturn\n}", "title": "" }, { "docid": "0ea82bd3353e8df04dfebc94d1d42ad2", "score": "0.6211845", "text": "func (c RestClient) NVMeNamespaceSize(ctx context.Context, namespacePath string) (int, error) {\n\tnamespace, err := c.NVMeNamespaceGetByName(ctx, namespacePath)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif namespace == nil {\n\t\treturn 0, fmt.Errorf(\"could not find namespace with name %v\", namespace)\n\t}\n\tsize := namespace.Space.Size\n\treturn int(*size), nil\n}", "title": "" }, { "docid": "bd39f0fdcaa5b6fda273f4e958606eab", "score": "0.6088365", "text": "func (sg *Sm4Gcm) NonceSize() int {\n\treturn gcmStandardNonceSize\n}", "title": "" }, { "docid": "bc3ea2901149262a48b6df139e9f4cfd", "score": "0.6078952", "text": "func Length(maxlen int, nonce, key []byte) int {\n\tif !isUint32(maxlen) {\n\t\tpanic(\"maxlen is out of range\")\n\t}\n\tmax := uint32(maxlen)\n\tif max&(max-1) != 0 {\n\t\tpanic(\"max padding length is not power of two\")\n\t}\n\th, err := blake2b.New256(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\th.Write(nonce)\n\td := h.Sum(nil)\n\n\tr := binary.BigEndian.Uint32(d[:4])\n\tpadlen := r & (max - 1)\n\treturn int(padlen)\n}", "title": "" }, { "docid": "b4446187653f20460cffacfbee7f246f", "score": "0.5998224", "text": "func (key AES128Key) Size() int { return 16 }", "title": "" }, { "docid": "cb53280193f4a392efc73c92bb236897", "score": "0.5960841", "text": "func BoxNonceBytes() int {\n\treturn int(C.crypto_box_noncebytes())\n}", "title": "" }, { "docid": "2b9afb038809cb954654b276344bcddc", "score": "0.5915553", "text": "func (k *kmac128) Size() int {\n\treturn k.outputSize\n}", "title": "" }, { "docid": "b354487f3717a9b384330a1c32008d2f", "score": "0.5902567", "text": "func (a *Cipher) NonceSize() int { return NonceSize }", "title": "" }, { "docid": "a1151712099baaad95cfd90e1370d4fc", "score": "0.58856905", "text": "func (c *XXTinyEncryptionAlgorithm) BlockSize() int { return int(c.size) }", "title": "" }, { "docid": "af1eca2ad5db99c2a09962dc7c95956c", "score": "0.5849862", "text": "func (s *Secret) Size() int {\n\treturn len(s.Private)\n}", "title": "" }, { "docid": "6ff6205dbb0ca860bf10bcfea4b5db33", "score": "0.5846549", "text": "func (tx *TxTicketUnbond) GetSize() int64 {\n\treturn int64(len(tx.Bytes()))\n}", "title": "" }, { "docid": "780b50c67729c676be63d882513af2df", "score": "0.5809472", "text": "func (e *Envelope) size() int {\n\treturn 20 + len(e.Version) + len(e.AESNonce) + len(e.Data)\n}", "title": "" }, { "docid": "458eb1df14a58cdcdf08daf84662771d", "score": "0.5799746", "text": "func accountNonce(state kv.KVStoreReader, callerAgentID isc.AgentID) uint64 {\n\tif callerAgentID.Kind() == isc.AgentIDKindEthereumAddress {\n\t\tpanic(\"to get EVM nonce, call EVM contract\")\n\t}\n\tdata := state.Get(nonceKey(callerAgentID))\n\tif data == nil {\n\t\treturn 0\n\t}\n\treturn codec.MustDecodeUint64(data) + 1\n}", "title": "" }, { "docid": "0dd281d8e10fb1fb1b7c76d670fe6a8c", "score": "0.5735726", "text": "func (obj *TransactionOutput) Size() int {\n\tvar n int\n\tn += ranger.UvarintSize(uint64(obj.Value))\n\tn += ranger.UvarintSize(uint64(len(obj.ScriptPubKey))) + len(obj.ScriptPubKey)\n\treturn n\n}", "title": "" }, { "docid": "4842187a581c4cabd08a7485a6c72ba8", "score": "0.571959", "text": "func (n *Net) Size() int {\n\treturn n.trie.Size()\n}", "title": "" }, { "docid": "4ba62924e9f1919db524e7306180a746", "score": "0.56827503", "text": "func (st *Poly1305) Size() int {\n\treturn Size\n}", "title": "" }, { "docid": "432ce84c6ca4d9e69dc812d828d86595", "score": "0.5645023", "text": "func GetSaltSize() int {\n\treturn pwSaltBytes * 2\n}", "title": "" }, { "docid": "f9164afc6417c80a0d24280bc283085d", "score": "0.5640392", "text": "func (t *stdToken) Size() int {\n\tvar count int\n\tif len(t.audience) > 0 {\n\t\tcount++\n\t}\n\tif t.birthdate != nil {\n\t\tcount++\n\t}\n\tif t.address != nil {\n\t\tcount++\n\t}\n\tcount += len(t.privateClaims)\n\treturn count\n}", "title": "" }, { "docid": "579da9f873df667f206eeff6edd45db9", "score": "0.5615346", "text": "func (o *ApiKey) GetNonce() string {\n\tif o == nil || o.Nonce == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Nonce\n}", "title": "" }, { "docid": "96a7d9549797765f4537e305d8817930", "score": "0.5601998", "text": "func (j *JWTTokenRequest) GetNonce() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "485ef2a1069c4aeab1bbd3c903e4c68e", "score": "0.55716306", "text": "func GetNonce() string {\n\treturn fmt.Sprintf(\"%v\", time.Now().Unix() * multiplier)\n}", "title": "" }, { "docid": "3d53e1a66a258037c5dc7d5612179041", "score": "0.556674", "text": "func (c *COINUT) GetNonce() int64 {\n\tif c.Nonce.Get() == 0 {\n\t\tc.Nonce.Set(time.Now().Unix())\n\t} else {\n\t\tc.Nonce.Inc()\n\t}\n\n\treturn int64(c.Nonce.Get())\n}", "title": "" }, { "docid": "bdcf794b3d27a2bd608682ee0774e26f", "score": "0.555982", "text": "func (c *safeConfig) GetSizeInBytes(key string) uint {\n\tc.RLock()\n\tdefer c.RUnlock()\n\tval, err := c.Viper.GetSizeInBytesE(key)\n\tif err != nil {\n\t\tlog.Warnf(\"failed to get configuration value for key %q: %s\", key, err)\n\t}\n\treturn val\n}", "title": "" }, { "docid": "fcb956bdbfa001823a3ad074fc28f963", "score": "0.5551782", "text": "func (ce *CacheEntry) Size() int {\n\tl := offKeyStr\n\tif ce != nil {\n\t\tl += len(ce.Key) + len(ce.Data)\n\t}\n\treturn l\n}", "title": "" }, { "docid": "22b89517ee3349f48007c8d87580e760", "score": "0.554309", "text": "func (obj *TransactionInput) Size() int {\n\tvar n int\n\tn += obj.Outpoint.Size()\n\tn += ranger.UvarintSize(uint64(len(obj.ScriptSig))) + len(obj.ScriptSig)\n\tn += ranger.UvarintSize(uint64(obj.SequenceNo))\n\treturn n\n}", "title": "" }, { "docid": "abc5dee807d3bf8d72961a05f53a54e0", "score": "0.55326366", "text": "func (rpcCli *RpcClient) SCS_getNonce(dappAddress, address string) (float64, error) {\n\n\tpointer, err := rpcCli.netServeHandler(SCS_getNonce, []string{dappAddress, address})\n\tfmt.Println(pointer.Result)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn pointer.Result.(float64), nil\n}", "title": "" }, { "docid": "45c6b6883e241b21f846292f63710d07", "score": "0.5525847", "text": "func (obj *TransactionWitness) Size() int {\n\tvar n int\n\tif obj.Data == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.Data)))\n\n\t\tn += len(obj.Data) * int(32)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "8a7c42b53fc39694a10d8287df124525", "score": "0.5507533", "text": "func (obj *GlobalConfigTransaction) Size() int {\n\tvar n int\n\tn += ranger.UvarintSize(uint64(obj.ActivationBlockHeight))\n\tif obj.ScalarUpdates == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.ScalarUpdates)))\n\t\tfor _, item := range obj.ScalarUpdates {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\tif obj.ListUpdates == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.ListUpdates)))\n\t\tfor _, item := range obj.ListUpdates {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\tn += ranger.UvarintSize(uint64(len(obj.SigPublicKey))) + len(obj.SigPublicKey)\n\tn += ranger.UvarintSize(uint64(len(obj.Signature))) + len(obj.Signature)\n\treturn n\n}", "title": "" }, { "docid": "886c796df02f1cf429c903bfde36d490", "score": "0.549097", "text": "func (r *RTx) Size() int64 {\n\tvar size uint64\n\terr := r.r.call(\"srv.TransactionSize\", r.contextID, &size)\n\tif err != nil {\n\t\treturn -1\n\t}\n\n\treturn int64(size)\n}", "title": "" }, { "docid": "abd5585a4532afdc6db728695aa4e7d6", "score": "0.548669", "text": "func (mg *NoahGate) GetNonce(address string) (*string, error) {\n\tresponse, err := mg.api.GetAddress(address)\n\tif err != nil {\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn nil, err\n\t}\n\tif response.Error != nil {\n\t\terr = errors.NewNodeError(response.Error.Message, response.Error.Code)\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn nil, err\n\t}\n\treturn &response.Result.TransactionCount, nil\n}", "title": "" }, { "docid": "47a553239a9377529453b7c374b9d00d", "score": "0.54833806", "text": "func dSize(curve elliptic.Curve) int {\n\torder := curve.Params().P\n\tbitLen := order.BitLen()\n\tsize := bitLen / 8\n\tif bitLen%8 != 0 {\n\t\tsize = size + 1\n\t}\n\treturn size\n}", "title": "" }, { "docid": "e5c16212e31f8ef022ae427cbf9e5cf4", "score": "0.5476474", "text": "func (mg *MinterGate) GetNonce(address string) (*string, error) {\n\tresponse, err := mg.api.GetAddress(address)\n\tif err != nil {\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn nil, err\n\t}\n\tif response.Error != nil {\n\t\terr = errors.NewNodeError(response.Error.Message, response.Error.Code)\n\t\tmg.Logger.WithFields(logrus.Fields{\n\t\t\t\"address\": address,\n\t\t}).Warn(err)\n\t\treturn nil, err\n\t}\n\treturn &response.Result.TransactionCount, nil\n}", "title": "" }, { "docid": "3ac67c13dabe41c34b624f9bcf45781f", "score": "0.5474195", "text": "func dSize(curve elliptic.Curve) int {\n\torder := curve.Params().P\n\tbitLen := order.BitLen()\n\tsize := bitLen / 8\n\tif bitLen%8 != 0 {\n\t\tsize++\n\t}\n\treturn size\n}", "title": "" }, { "docid": "c0016312bf86a80b88e40554efb9f7d9", "score": "0.5468968", "text": "func UvarintSize(i uint64) int {\n\tvar n int\n\n\tfor {\n\t\tn++\n\t\ti >>= 7\n\t\tif i == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "1f2e1629c617d53009c728a80ad823bd", "score": "0.54613715", "text": "func (rc *runContainer16) serializedSizeInBytes() int {\n\t// number of runs in one unint16, then each run\n\t// needs two more uint16\n\treturn 2 + len(rc.iv)*4\n}", "title": "" }, { "docid": "25c290facbf0fd35ba7db3169594a8c2", "score": "0.5449758", "text": "func (obj *GenesisTransaction) Size() int {\n\tvar n int\n\tif obj.Outputs == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.Outputs)))\n\t\tfor _, item := range obj.Outputs {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "a591a1cbd59e066e42d5591232f907f0", "score": "0.54352945", "text": "func (ip *IPv4) TotalLength() uint16 { return binary.BigEndian.Uint16(ip[2:4]) }", "title": "" }, { "docid": "5c9a7c89adc5c23b91e88857fecb8db3", "score": "0.54325294", "text": "func (m Msg) GetNonce() nonce.Data {\n\treturn m.Nonce\n}", "title": "" }, { "docid": "e5f960500ef03c2b3d84d54dc7e7c13b", "score": "0.543209", "text": "func GenerateNonce(size int) ([]byte, error) {\n\tnonce := make([]byte, size)\n\t_, err := rand.Read(nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nonce, nil\n}", "title": "" }, { "docid": "44094a07b35b33894097f83324f827a5", "score": "0.54233456", "text": "func (token Token) Size() int64 {\n\treturn int64(token.len())\n}", "title": "" }, { "docid": "fbb5e03f59a4a43f515652728dd31ab3", "score": "0.5403384", "text": "func UvarintSize(x uint64) int {\n\tif x <= MaxVal4 {\n\t\tif x <= MaxVal1 {\n\t\t\treturn 1\n\t\t} else if x <= MaxVal2 {\n\t\t\treturn 2\n\t\t} else if x <= MaxVal3 {\n\t\t\treturn 3\n\t\t}\n\t\treturn 4\n\t}\n\tif x <= MaxVal5 {\n\t\treturn 5\n\t} else if x <= MaxVal6 {\n\t\treturn 6\n\t} else if x <= MaxVal7 {\n\t\treturn 7\n\t} else if x <= MaxVal8 {\n\t\treturn 8\n\t} else if x <= MaxVal9 {\n\t\treturn 9\n\t}\n\treturn 10\n}", "title": "" }, { "docid": "376436dada5cfc054ef63fbbc3333c59", "score": "0.5396721", "text": "func (s *stateObject) getNonce() uint64 {\n\treturn s.account.Nonce\n}", "title": "" }, { "docid": "5bbdd771a0f29ddb6b8d68628efffd1e", "score": "0.5395039", "text": "func GenerateNonce(noncesize int) ([]byte) {\n\n\tnonce := make([]byte, noncesize)\n\n\t//Use crypto RNG\n\t_, err := io.ReadFull(rand.Reader, nonce)\n\tcheckerror(err)\n\n\treturn nonce\n}", "title": "" }, { "docid": "18fd97ee21378356835ec1f426fd32e6", "score": "0.53892565", "text": "func (block *Block) Size() int {\n\tsize := proto.Size(block.GetHeader()) + len(block.GetHash())\n\tfor _, tx := range block.GetBody().GetTxs() {\n\t\tsize += proto.Size(tx)\n\t}\n\treturn size\n}", "title": "" }, { "docid": "a2e31cb47f709d66d3b7a3678e22ea90", "score": "0.53826666", "text": "func getUvarintSize(x uint32) uint64 {\n\tif x < 128 {\n\t\treturn 1\n\t} else if x < 16384 { // 128 * 128\n\t\treturn 2\n\t} else if x < 2097152 { // 128 * 128 * 128\n\t\treturn 3\n\t} else if x < 268435456 { // 128 * 128 * 128 * 128\n\t\treturn 4\n\t} else {\n\t\treturn 5\n\t}\n}", "title": "" }, { "docid": "f9bacb2e3729413d1cd6eefc3b4c8031", "score": "0.53691894", "text": "func (obj *Transaction) Size() int {\n\tvar n int\n\tn += 1\n\tn += 1 + obj.Body.Size()\n\tn += 2\n\treturn n\n}", "title": "" }, { "docid": "4b1ca9f5cf0204ff4161d615ed7bd404", "score": "0.5365149", "text": "func nonce() []byte {\n\tnonce := make([]byte, 8)\n\trand.Read(nonce)\n\treturn nonce\n}", "title": "" }, { "docid": "2b006091437af158b28707007cd62492", "score": "0.53295964", "text": "func CryptoBoxPrivKeySize() int {\n\treturn int(C.crypto_box_secretkeybytes())\n}", "title": "" }, { "docid": "306b625401e8cc29148c53f165a7ff00", "score": "0.53275824", "text": "func getNonce(t *testing.T, client rpcclient.Client, addr []byte) int {\n\tac, err := edbcli.GetAccount(client, addr)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif ac == nil {\n\t\treturn 0\n\t}\n\treturn ac.Sequence\n}", "title": "" }, { "docid": "2fe192f2ee91fe4b1ebe3ff687cb4867", "score": "0.5326258", "text": "func (ins Instruction) Size() uint64 {\n\treturn uint64(InstructionSize * ins.OpCode.rawInstructions())\n}", "title": "" }, { "docid": "7ca83346b55cfa8a5ecc1dd225388e0a", "score": "0.53250647", "text": "func (pb *Block) Size() int64 {\n\treturn pb.numBytesChunks + pb.numBytesIndex + pb.numBytesTombstone + pb.numBytesMeta\n}", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.5318396", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.5318396", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "811d8189acf6aea77491b1627390fd5d", "score": "0.5312879", "text": "func (xx *XXHash32) Size() int {\n\treturn 4\n}", "title": "" }, { "docid": "fe9ade8a12e8f84e92e78dc057a8d6ca", "score": "0.53092223", "text": "func (t *transportBase) NInBytes() uint64 {\n\treturn t.nInBytes\n}", "title": "" }, { "docid": "183e41e3c735523b656e4df97b5316cb", "score": "0.5307421", "text": "func GetNonce(c *gin.Context) {\n\taccount, status, err := getAccount(c)\n\tif err != nil {\n\t\tshared.RespondWith(c, status, nil, err.Error(), data.ReturnCodeInternalError)\n\t\treturn\n\t}\n\n\tshared.RespondWith(c, http.StatusOK, gin.H{\"nonce\": account.Nonce}, \"\", data.ReturnCodeSuccess)\n}", "title": "" }, { "docid": "78e80a6bb7a04faa75e01643c5c3a0bb", "score": "0.5305233", "text": "func (c *Parser) IDnSize() ([4]byte, uint32, error) {\n\tvar ID [4]byte\n\tvar blockSize uint32\n\tif err := binary.Read(c.r, binary.BigEndian, &ID); err != nil {\n\t\treturn ID, blockSize, err\n\t}\n\tif err := binary.Read(c.r, binary.LittleEndian, &blockSize); err != err {\n\t\treturn ID, blockSize, err\n\t}\n\treturn ID, blockSize, nil\n}", "title": "" }, { "docid": "7707bdfde23cb43604f305dd554f9083", "score": "0.53010184", "text": "func GetNonce(client *ethclient.Client, fromAddress common.Address) (uint64, error) {\n\treturn client.PendingNonceAt(context.Background(), fromAddress)\n}", "title": "" }, { "docid": "5a6f607f55670d1d16518c738cba1ea1", "score": "0.5293788", "text": "func (s *State) GetNonce(addr common.Address, fromPool bool) uint64 {\n\tif fromPool {\n\t\treturn s.txPool.GetNonce(addr)\n\t}\n\treturn s.main.GetNonce(addr)\n}", "title": "" }, { "docid": "006d442a9dbf1578733f76ba7da9821f", "score": "0.5290107", "text": "func (c Int) GetSize(d interface{}) int {\n\treturn bits.UintSize / 8\n}", "title": "" }, { "docid": "6876691f2e3ca341364e3040102f78e4", "score": "0.528242", "text": "func VarUIntSize(x uint64) int {\n\treturn (bits.Len64(x|1) + 6) / 7\n}", "title": "" }, { "docid": "a5d2e19ba8864e65f0e80887dfcce886", "score": "0.5272425", "text": "func (xRpcCmd *XRpcCmd) ByteSize() (size uint64) {\n\tfor k, v := range xRpcCmd.header {\n\t\tsize += uint64(len(k) + len(v))\n\t}\n\treturn size\n}", "title": "" }, { "docid": "41839878cc1826a9d0123e29d618c5e9", "score": "0.5243817", "text": "func (s *Sum32) Size() int { return 4 }", "title": "" }, { "docid": "7ec891693843f73aa013269c01a2100e", "score": "0.52414316", "text": "func nonce() uint32 {\n\treturn atomic.AddUint32(&globalID, 1)\n}", "title": "" }, { "docid": "93fbf8f813d7c1e02e98aaa8a52c6bed", "score": "0.5228139", "text": "func nonce(size int) string {\n\tbuf := make([]byte, size)\n\tfor i := 0; i < size; i++ {\n\t\tbuf[i] = alpha[rand.Intn(len(alpha)-1)]\n\t}\n\treturn string(buf)\n}", "title": "" }, { "docid": "6558145376e26210a4f66a733b2300eb", "score": "0.52274024", "text": "func (obj *TransferTransaction) Size() int {\n\tvar n int\n\tif obj.Inputs == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.Inputs)))\n\t\tfor _, item := range obj.Inputs {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\tif obj.Outputs == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.Outputs)))\n\t\tfor _, item := range obj.Outputs {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\tif obj.Witnesses == nil {\n\t\t// Cannot calculate the value for missing fields\n\t\treturn 0\n\t} else {\n\t\tn += ranger.UvarintSize(uint64(len(obj.Witnesses)))\n\t\tfor _, item := range obj.Witnesses {\n\t\t\tn += item.Size()\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "4a8fdd2c6d8cbd7ecd98e2ec01ac5e7b", "score": "0.52192616", "text": "func (obj *GlobalConfigScalarUpdate) Size() int {\n\tvar n int\n\tn += ranger.UvarintSize(uint64(len(obj.Key))) + len(obj.Key)\n\tn += ranger.UvarintSize(uint64(len(obj.Value))) + len(obj.Value)\n\treturn n\n}", "title": "" }, { "docid": "a3d19a784ce202ebde3bb17812de0f83", "score": "0.52113414", "text": "func (k *pcpRSAPrivateKey) Size() uint32 {\n\treturn uint32((k.pubKey.(*rsa.PublicKey).N.BitLen() + 7) / 8)\n}", "title": "" }, { "docid": "b6bdf77e709c8ba68c38d4e85095866e", "score": "0.5204781", "text": "func (xx *XXHash64) Size() int {\n\treturn 8\n}", "title": "" }, { "docid": "f9ee443aef422e3ea2a1470df48d2a6d", "score": "0.52035683", "text": "func (n *Network) Size() int {\n\treturn len(n.nodes)\n}", "title": "" }, { "docid": "70242d2c18bfc23ce7ab3e95c3b9cb03", "score": "0.5192466", "text": "func Size(codeSize int64, id string) int64 {\n\tnhashes := (codeSize + pageSize - 1) / pageSize\n\tidOff := int64(codeDirectorySize)\n\thashOff := idOff + int64(len(id)+1)\n\tcdirSz := hashOff + nhashes*sha256.Size\n\treturn int64(superBlobSize+blobSize) + cdirSz\n}", "title": "" }, { "docid": "e00d7fa2e65b9a640b046aa250faebcf", "score": "0.5190258", "text": "func (self *BlockBody) Size() int {\n // We can't use length of self.Bytes() because it has a length prefix\n // Need only the sum of transaction sizes\n return self.Transactions.Size()\n}", "title": "" }, { "docid": "3a74e7741daf398e15036bb94799d52b", "score": "0.518857", "text": "func (u *UserIdent) ByteCount() int {\n\treturn len(u.Namespace) + 1 + len(u.Host) + 1 + len(u.Castle) + 1 + len(u.Lord) + 1 + len(u.Minion) + 1\n}", "title": "" }, { "docid": "5bb4823e11665c4dfd7a19800736c18f", "score": "0.51880354", "text": "func (c *BlockWithVotesRequest) GetSerializedLength() int {\n\treturn message_fields.SizeBlockHeight\n}", "title": "" }, { "docid": "b44a00bdfa0fcb51bf147d292ee2e295", "score": "0.51787513", "text": "func (z *Transaction) Msgsize() (s int) {\n\ts = 1 + 6 + msgp.BytesPrefixSize + len(z.Nonce) + 15 + z.TransactableID.Msgsize() + 13 + z.Transactable.Msgsize()\n\treturn\n}", "title": "" }, { "docid": "6bdaed210e943c6714a9a83ddf4ff691", "score": "0.5176217", "text": "func (h *Hashing) ComputeNonce(msg io.Reader) ([]byte, Error) {\n\tswitch h.Hash {\n\tcase Shake256:\n\t\tret := make([]byte, 64)\n\t\tshake := sha3.NewShake256()\n\t\tshake.Write(h.Prefix)\n\t\t_, err := io.Copy(shake, msg)\n\t\tif err != nil {\n\t\t\treturn nil, wrapErrorf(err, \"hashing failed\")\n\t\t}\n\t\tshake.Read(ret)\n\t\treturn ret, nil\n\tdefault:\n\t\treturn nil, errorf(\"Hash %s not supported\", h.Hash)\n\t}\n}", "title": "" }, { "docid": "dcb8c42d26cd6927d53e30d6c24db8d5", "score": "0.5165568", "text": "func (rc *runContainer32) serializedSizeInBytes() int {\n\treturn 4 + len(rc.iv)*8\n}", "title": "" }, { "docid": "cefe71c861ec946df6e407f8f0e351f5", "score": "0.5163029", "text": "func inputSize(sigScriptSize int) int {\n\treturn 32 + 4 + wire.VarIntSerializeSize(uint64(sigScriptSize)) + sigScriptSize + 4\n}", "title": "" }, { "docid": "cefe71c861ec946df6e407f8f0e351f5", "score": "0.5163029", "text": "func inputSize(sigScriptSize int) int {\n\treturn 32 + 4 + wire.VarIntSerializeSize(uint64(sigScriptSize)) + sigScriptSize + 4\n}", "title": "" }, { "docid": "02e80560625ee66c7900a11916d7607a", "score": "0.5162685", "text": "func (bc *ByteContent) Size() int64 {\n\treturn int64(len(bc.Data))\n}", "title": "" }, { "docid": "494f4b859988f226bbf5ce07422c6aaa", "score": "0.51592743", "text": "func (ts Tagset) Size() int64 {\n\tif data, ok := ts[TIDsize]; ok {\n\t\tvar size, _ = data.Uint64()\n\t\treturn int64(size)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "32b75a05c2d325338ab6abab75d4a2a7", "score": "0.515858", "text": "func (t *Datatype) Size() uint {\n\treturn uint(C.H5Tget_size(t.id))\n}", "title": "" }, { "docid": "92317ec4f6d0f03432dcb3310e6a64c4", "score": "0.51548946", "text": "func sizeUint64Iface(ival interface{}, tagsize int, _ marshalOptions) int {\n\tv := ival.(uint64)\n\treturn tagsize + wire.SizeVarint(v)\n}", "title": "" }, { "docid": "e80ecc3c0a8affaab61699be98866134", "score": "0.51512057", "text": "func (*digest) Size() int {\n\treturn int(HashSize)\n}", "title": "" }, { "docid": "df457535a0251ac602cb9931df684e42", "score": "0.5148632", "text": "func (c *Ctrie) Size() uint {\n\t// TODO: The size operation can be optimized further by caching the size\n\t// information in main nodes of a read-only Ctrie – this reduces the\n\t// amortized complexity of the size operation to O(1) because the size\n\t// computation is amortized across the update operations that occurred\n\t// since the last snapshot.\n\tsize := uint(0)\n\tfor _ = range c.Iterator(nil) {\n\t\tsize++\n\t}\n\treturn size\n}", "title": "" }, { "docid": "e039c5453374b1479d749995c1229acd", "score": "0.51451564", "text": "func (t *Trun) GetSize() uint32 {\n\treturn t.Size\n}", "title": "" }, { "docid": "332f8fdcc51d116728ad2efd4d4c6d6c", "score": "0.51450384", "text": "func (vect *Vector) Size(tr fdb.Transaction) (int64, error) {\n\n\tbegin, end := vect.subspace.FDBRangeKeys()\n\n\t// GET is a blocking operation\n\tlastkey, err := tr.GetKey(fdb.LastLessOrEqual(end)).Get()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t// lastkey < beginKey indicates an empty vector\n\tif bytes.Compare(lastkey, begin.FDBKey()) == -1 {\n\t\treturn 0, nil\n\t}\n\n\tindex, err := vect.indexAt(lastkey)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn index + 1, nil\n}", "title": "" }, { "docid": "5da24368bdbbea228686dd7eeb601824", "score": "0.51383656", "text": "func (ni *NetworkInterface) GetIPv4SubnetPrefixLength() string {\n\tif ni.ipv4SubnetPrefixLength == \"\" && ni.SubnetGatewayIPV4Address != \"\" {\n\t\tni.ipv4SubnetPrefixLength = strings.Split(ni.SubnetGatewayIPV4Address, \"/\")[1]\n\t}\n\n\treturn ni.ipv4SubnetPrefixLength\n}", "title": "" }, { "docid": "9612e633b64ab05d4ba8b0c4a2d99dc1", "score": "0.51347625", "text": "func (txmp *TxMempool) SizeBytes() int64 { return atomic.LoadInt64(&txmp.txsBytes) }", "title": "" }, { "docid": "057309335589370a998e33cc1a180d10", "score": "0.5128776", "text": "func GenerateNonce(c cipher.AEAD) []byte {\n\tif c.NonceSize() < minimumRandomNonceSize {\n\t\tpanic(\"miscreant.GenerateNonce: nonce size is too small: \" + string(c.NonceSize()))\n\t}\n\n\tnonce := make([]byte, c.NonceSize())\n\t_, err := io.ReadFull(rand.Reader, nonce[:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn nonce\n}", "title": "" }, { "docid": "430aafe721c90631cd438203b13fc223", "score": "0.51212853", "text": "func (m *txSortedMap) MaxNonce() uint64 {\n\tvar sortedTxs types.Transactions\n\tif m.cache != nil {\n\t\tsortedTxs = m.cache\n\t} else {\n\t\tsortedTxs = m.Flatten()\n\t}\n\n\tmaxNonce := (sortedTxs)[sortedTxs.Len()-1].Nonce()\n\treturn maxNonce\n}", "title": "" }, { "docid": "b7dd398528f10f56f28f65a1f101ad03", "score": "0.5117908", "text": "func (h *Sha3FastHasher) Size() int {\n\treturn h.Hashbitlen / 8\n}", "title": "" }, { "docid": "7508802b1b79fe13b057ba7bf05d0d63", "score": "0.5116467", "text": "func (block *Mesh) GetSize() int {\n\treturn rexDataBlockHeaderSize + meshHeaderSize +\n\t\tlen(block.Coords)*12 +\n\t\tlen(block.Normals)*12 +\n\t\tlen(block.TexCoords)*8 +\n\t\tlen(block.Colors)*12 +\n\t\tlen(block.Triangles)*12\n}", "title": "" }, { "docid": "40a26d074f0736f2f6d91053584c56d6", "score": "0.5112893", "text": "func GetNonce(ae accountExecutor, k string, c *websocket.Conn) {\n\tae.getNonce(k, c)\n}", "title": "" }, { "docid": "edef999830bed0687901407d53b79df6", "score": "0.51100194", "text": "func (tx TxBase) GetTxActualSize() uint64 {\n\t//txBytes, _ := json.Marshal(tx)\n\t//txSizeInByte := len(txBytes)\n\t//\n\t//return uint64(math.Ceil(float64(txSizeInByte) / 1024))\n\tif tx.cachedActualSize != nil {\n\t\treturn *tx.cachedActualSize\n\t}\n\tsizeTx := uint64(1) // int8\n\tsizeTx += uint64(len(tx.Type) + 1) // string\n\tsizeTx += uint64(8) // int64\n\tsizeTx += uint64(8)\n\n\tsigPubKey := uint64(len(tx.SigPubKey))\n\tsizeTx += sigPubKey\n\tsig := uint64(len(tx.Sig))\n\tsizeTx += sig\n\tif tx.Proof != nil {\n\t\tproof := uint64(len(tx.Proof.Bytes()))\n\t\tsizeTx += proof\n\t}\n\n\tsizeTx += uint64(1)\n\tinfo := uint64(len(tx.Info))\n\tsizeTx += info\n\n\tmeta := tx.Metadata\n\tif meta != nil {\n\t\tmetaSize := meta.CalculateSize()\n\t\tsizeTx += metaSize\n\t}\n\tresult := uint64(math.Ceil(float64(sizeTx) / 1024))\n\ttx.cachedActualSize = &result\n\treturn *tx.cachedActualSize\n}", "title": "" } ]
3e63395d9475400874c6973b55cf79bd
AddCaveat adds a caveat to the given macaroon. If it's a thirdparty caveat, it uses the service's caveatid encoder to create the id of the new caveat.
[ { "docid": "3cd538db8107c229d9f3187b19e74b14", "score": "0.8411792", "text": "func (svc *Service) AddCaveat(m *macaroon.Macaroon, cav checkers.Caveat) error {\n\tlogf(\"Service.AddCaveat id %q; cav %#v\", m.Id(), cav)\n\tif cav.Location == \"\" {\n\t\tm.AddFirstPartyCaveat(cav.Condition)\n\t\treturn nil\n\t}\n\trootKey, err := randomBytes(24)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot generate third party secret: %v\", err)\n\t}\n\tid, err := svc.encoder.encodeCaveatId(cav, rootKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot create third party caveat id at %q: %v\", cav.Location, err)\n\t}\n\tif err := m.AddThirdPartyCaveat(rootKey, id, cav.Location); err != nil {\n\t\treturn fmt.Errorf(\"cannot add third party caveat: %v\", err)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "c02dba6bfd712272555b7b64f5858bf3", "score": "0.78904474", "text": "func (o *Oven) AddCaveat(ctx context.Context, m *Macaroon, cav checkers.Caveat) error {\n\treturn m.AddCaveat(ctx, cav, o.p.Key, o.p.Locator)\n}", "title": "" }, { "docid": "e299d4f75fce6d69bc8b78cdddd34c8d", "score": "0.6578958", "text": "func (o *Oven) AddCaveats(ctx context.Context, m *Macaroon, caveats []checkers.Caveat) error {\n\treturn m.AddCaveats(ctx, caveats, o.p.Key, o.p.Locator)\n}", "title": "" }, { "docid": "e08398b7ccec4d024830a779e5f8ece9", "score": "0.5818639", "text": "func TestHasCaveat(t *testing.T) {\n\tt.Parallel()\n\n\tconst (\n\t\tcond = \"cond\"\n\t\tvalue = \"value\"\n\t)\n\tm := testMacaroon.Clone()\n\n\t// The macaroon doesn't have any caveats, so we shouldn't find any.\n\tif _, ok := HasCaveat(m, cond); ok {\n\t\tt.Fatal(\"found unexpected caveat with unknown condition\")\n\t}\n\n\t// Add two caveats, one in a valid LSAT format and another invalid.\n\t// We'll test that we're still able to determine the macaroon contains\n\t// the valid caveat even though there is one that is invalid.\n\tinvalidCaveat := []byte(\"invalid\")\n\tif err := m.AddFirstPartyCaveat(invalidCaveat); err != nil {\n\t\tt.Fatalf(\"unable to add macaroon caveat: %v\", err)\n\t}\n\tvalidCaveat1 := Caveat{Condition: cond, Value: value}\n\tif err := AddFirstPartyCaveats(m, validCaveat1); err != nil {\n\t\tt.Fatalf(\"unable to add macaroon caveat: %v\", err)\n\t}\n\n\tcaveatValue, ok := HasCaveat(m, cond)\n\tif !ok {\n\t\tt.Fatal(\"expected macaroon to contain caveat\")\n\t}\n\tif caveatValue != validCaveat1.Value {\n\t\tt.Fatalf(\"expected caveat value \\\"%v\\\", got \\\"%v\\\"\",\n\t\t\tvalidCaveat1.Value, caveatValue)\n\t}\n\n\t// If we add another caveat with the same condition, the value of the\n\t// most recently added caveat should be returned instead.\n\tvalidCaveat2 := validCaveat1\n\tvalidCaveat2.Value += value\n\tif err := AddFirstPartyCaveats(m, validCaveat2); err != nil {\n\t\tt.Fatalf(\"unable to add macaroon caveat: %v\", err)\n\t}\n\n\tcaveatValue, ok = HasCaveat(m, cond)\n\tif !ok {\n\t\tt.Fatal(\"expected macaroon to contain caveat\")\n\t}\n\tif caveatValue != validCaveat2.Value {\n\t\tt.Fatalf(\"expected caveat value \\\"%v\\\", got \\\"%v\\\"\",\n\t\t\tvalidCaveat2.Value, caveatValue)\n\t}\n}", "title": "" }, { "docid": "20e9c0f4a9998fcc42e1d4e9e37b17d1", "score": "0.5319569", "text": "func (svc *Service) NewMacaroon(id string, rootKey []byte, caveats []checkers.Caveat) (*macaroon.Macaroon, error) {\n\tif rootKey == nil {\n\t\tnewRootKey, err := randomBytes(24)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot generate root key for new macaroon: %v\", err)\n\t\t}\n\t\trootKey = newRootKey\n\t}\n\tif id == \"\" {\n\t\tidBytes, err := randomBytes(24)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot generate id for new macaroon: %v\", err)\n\t\t}\n\t\tid = fmt.Sprintf(\"%x\", idBytes)\n\t}\n\tm, err := macaroon.New(rootKey, id, svc.location)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot bake macaroon: %v\", err)\n\t}\n\n\t// TODO look at the caveats for expiry time and associate\n\t// that with the storage item so that the storage can\n\t// garbage collect it at an appropriate time.\n\tif err := svc.store.Put(m.Id(), &storageItem{\n\t\tRootKey: rootKey,\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot save macaroon to store: %v\", err)\n\t}\n\tfor _, cav := range caveats {\n\t\tif err := svc.AddCaveat(m, cav); err != nil {\n\t\t\tif err := svc.store.store.Del(m.Id()); err != nil {\n\t\t\t\tlog.Printf(\"failed to remove macaroon from storage: %v\", err)\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "c1889f35ef7c0332883f5b0450893544", "score": "0.53154397", "text": "func encodeCaveat(\n\tcondition string,\n\trootKey []byte,\n\tthirdPartyInfo ThirdPartyInfo,\n\tkey *KeyPair,\n\tns *checkers.Namespace,\n) ([]byte, error) {\n\tswitch thirdPartyInfo.Version {\n\tcase Version0, Version1:\n\t\treturn encodeCaveatV1(condition, rootKey, &thirdPartyInfo.PublicKey, key)\n\tcase Version2:\n\t\treturn encodeCaveatV2(condition, rootKey, &thirdPartyInfo.PublicKey, key)\n\tdefault:\n\t\t// Version 3 or later - use V3.\n\t\treturn encodeCaveatV3(condition, rootKey, &thirdPartyInfo.PublicKey, key, ns)\n\t}\n}", "title": "" }, { "docid": "66dbfa67adf31d07eb50a7923f30a17d", "score": "0.5040098", "text": "func decodeCaveat(key *KeyPair, caveat []byte) (*ThirdPartyCaveatInfo, error) {\n\tif len(caveat) == 0 {\n\t\treturn nil, errgo.New(\"empty third party caveat\")\n\t}\n\tswitch caveat[0] {\n\tcase byte(Version2):\n\t\treturn decodeCaveatV2V3(Version2, key, caveat)\n\tcase byte(Version3):\n\t\tif len(caveat) < version3CaveatMinLen {\n\t\t\t// If it has the version 3 caveat tag and it's too short, it's\n\t\t\t// almost certainly an id, not an encrypted payload.\n\t\t\treturn nil, errgo.Newf(\"caveat id payload not provided for caveat id %q\", caveat)\n\t\t}\n\t\treturn decodeCaveatV2V3(Version3, key, caveat)\n\tcase 'e':\n\t\t// 'e' will be the first byte if the caveatid is a base64 encoded JSON object.\n\t\treturn decodeCaveatV1(key, caveat)\n\tdefault:\n\t\treturn nil, errgo.Newf(\"caveat has unsupported version %d\", caveat[0])\n\t}\n}", "title": "" }, { "docid": "10db1a05b20c7a7cfe693e58613d0d3a", "score": "0.50237805", "text": "func (p *Protocol) AddClaimer(c MakesClaims) error {\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\n\tif p.claimersLocked {\n\t\treturn errors.New(\"protocol-claim: cannot add claimer after lock\")\n\t}\n\n\tp.claimers = append(p.claimers, c)\n\n\tvar claimerClaim struct {\n\t\tName string\n\t\tIdentity string\n\t\tClaims string\n\t}\n\n\tclaimerClaim.Name = c.ClaimerName()\n\tclaimerClaim.Identity = c.ClaimerIdentity()\n\tclaimerClaim.Claims = c.ClaimerClaims()\n\n\terr := p.Claims.push(ClaimersClaimPath, claimerClaim)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"protocol-claim: failed to push claim while adding a claimer\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f1a589f8e1748b7a050badffd70d460e", "score": "0.49785656", "text": "func NewMethodCaveat(t testing.TB, method string, additionalMethods ...string) security.Caveat {\n\tc, err := security.NewCaveat(security.MethodCaveat, append(additionalMethods, method))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "4e07d52e8fa619a53d0fa1ca896bd40f", "score": "0.49568745", "text": "func encodeCaveatV1(\n\tcondition string,\n\trootKey []byte,\n\tthirdPartyPubKey *PublicKey,\n\tkey *KeyPair,\n) ([]byte, error) {\n\tvar nonce [NonceLen]byte\n\tif _, err := rand.Read(nonce[:]); err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot generate random number for nonce\")\n\t}\n\tplain := caveatRecord{\n\t\tRootKey: rootKey,\n\t\tCondition: condition,\n\t}\n\tplainData, err := json.Marshal(&plain)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot marshal %#v\", &plain)\n\t}\n\tsealed := box.Seal(nil, plainData, &nonce, thirdPartyPubKey.boxKey(), key.Private.boxKey())\n\tid := caveatJSON{\n\t\tThirdPartyPublicKey: thirdPartyPubKey,\n\t\tFirstPartyPublicKey: &key.Public,\n\t\tNonce: nonce[:],\n\t\tId: base64.StdEncoding.EncodeToString(sealed),\n\t}\n\tdata, err := json.Marshal(id)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot marshal %#v\", id)\n\t}\n\tbuf := make([]byte, base64.StdEncoding.EncodedLen(len(data)))\n\tbase64.StdEncoding.Encode(buf, data)\n\treturn buf, nil\n}", "title": "" }, { "docid": "62c71c6fd1393c96176395ef0529e1a2", "score": "0.46710628", "text": "func decodeCaveatV1(key *KeyPair, caveat []byte) (*ThirdPartyCaveatInfo, error) {\n\tdata := make([]byte, (3*len(caveat)+3)/4)\n\tn, err := base64.StdEncoding.Decode(data, caveat)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot base64-decode caveat\")\n\t}\n\tdata = data[:n]\n\tvar wrapper caveatJSON\n\tif err := json.Unmarshal(data, &wrapper); err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot unmarshal caveat %q\", data)\n\t}\n\tif !bytes.Equal(key.Public.Key[:], wrapper.ThirdPartyPublicKey.Key[:]) {\n\t\treturn nil, errgo.New(\"public key mismatch\")\n\t}\n\tif wrapper.FirstPartyPublicKey == nil {\n\t\treturn nil, errgo.New(\"target service public key not specified\")\n\t}\n\t// The encrypted string is base64 encoded in the JSON representation.\n\tsecret, err := base64.StdEncoding.DecodeString(wrapper.Id)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot base64-decode encrypted data\")\n\t}\n\tvar nonce [NonceLen]byte\n\tif copy(nonce[:], wrapper.Nonce) < NonceLen {\n\t\treturn nil, errgo.Newf(\"nonce too short %x\", wrapper.Nonce)\n\t}\n\tc, ok := box.Open(nil, secret, &nonce, wrapper.FirstPartyPublicKey.boxKey(), key.Private.boxKey())\n\tif !ok {\n\t\treturn nil, errgo.Newf(\"cannot decrypt caveat %#v\", wrapper)\n\t}\n\tvar record caveatRecord\n\tif err := json.Unmarshal(c, &record); err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot decode third party caveat record\")\n\t}\n\treturn &ThirdPartyCaveatInfo{\n\t\tCondition: []byte(record.Condition),\n\t\tFirstPartyPublicKey: *wrapper.FirstPartyPublicKey,\n\t\tThirdPartyKeyPair: *key,\n\t\tRootKey: record.RootKey,\n\t\tCaveat: caveat,\n\t\tVersion: Version1,\n\t\tNamespace: legacyNamespace(),\n\t}, nil\n}", "title": "" }, { "docid": "310dda38aff611d885d423cc4c2da7fe", "score": "0.4629812", "text": "func AddClaimer(c MakesClaims) error {\n\treturn Default.AddClaimer(c)\n}", "title": "" }, { "docid": "c75fe4819bd4db29598766fff4e551bb", "score": "0.45300028", "text": "func (t *MedicalApp) addAccessControl(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start addAccessControl\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 8 {\n\t\t\tfmt.Println(\"Incorrect number of arguments, Required 8 arguments\")\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 8 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\tfmt.Println(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\t// get timestamp\n\t\ttxTimeAsPtr, errTx := t.GetTxTimestampChannel(stub)\n\t\tif errTx != nil {\n\t\t\treturn shim.Error(\"Returning time error\")\n\t\t}\n\n\t\t// create the object\n\t\tvar obj = AccessControl{}\n\n\t\tobj.AccessControl_ID = ComputeHashKey(args[0]+(txTimeAsPtr.String()))\n\t\tobj.Doctor_ID = args[0]\n\t\tobj.Patient_ID = args[1]\n\t\tobj.IsValid = args[2]\n\t\tobj.ValidTill = args[3]\n\t\tobj.GrandedAccessOn = args[4]\n\t\tobj.Patient_Name = args[5]\n\t\tobj.Doctor_Name = args[6]\n\t\tobj.ClinicName = args[7]\n\t\tobj.AssetType = \"AccessControl\"\n\n\t\t// convert to bytes\n\t\tassetAsBytes, errMarshal := json.Marshal(obj)\n\t\t\n\t\t// show error if failed\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\t// save data in blockchain\n\t\terrPut := stub.PutState(obj.AccessControl_ID, assetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to save file data : %s\", obj.AccessControl_ID))\n\t\t}\n\n\t\tfmt.Println(\"Success in saving file data %v\", obj)\n\n\n\t\treturn shim.Success(assetAsBytes)\n\t}", "title": "" }, { "docid": "9d8e4e3a9129904ce723c57f88e8ea14", "score": "0.4470234", "text": "func TheoBonus(id int, ctx context.Context, client *ent.Client) (*ent.Developper, error) {\n\td, err := GetDevelopers(id, ctx, client)\n\tnewAge := d.Age + 1\n\td, err = UpdateDeveloper(id, newAge, d.Experience, d.Name, d.School, ctx, client)\n\treturn d, err\n}", "title": "" }, { "docid": "0037fea7f3b759903fb4b0ccb60b461d", "score": "0.44460094", "text": "func (o *Oven) NewMacaroon(ctx context.Context, version Version, caveats []checkers.Caveat, ops ...Op) (*Macaroon, error) {\n\tif len(ops) == 0 {\n\t\treturn nil, errgo.Newf(\"cannot mint a macaroon associated with no operations\")\n\t}\n\tops = CanonicalOps(ops)\n\trootKey, storageId, err := o.p.RootKeyStoreForOps(ops).RootKey(ctx)\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\tid, err := o.newMacaroonId(ctx, ops, storageId)\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\tidBytesNoVersion, err := id.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\tidBytes := make([]byte, len(idBytesNoVersion)+1)\n\tidBytes[0] = byte(LatestVersion)\n\t// TODO We could use a proto.Buffer to avoid this copy.\n\tcopy(idBytes[1:], idBytesNoVersion)\n\n\tif MacaroonVersion(version) < macaroon.V2 {\n\t\t// The old macaroon format required valid text for the macaroon id,\n\t\t// so base64-encode it.\n\t\tb64data := make([]byte, base64.RawURLEncoding.EncodedLen(len(idBytes)))\n\t\tbase64.RawURLEncoding.Encode(b64data, idBytes)\n\t\tidBytes = b64data\n\t}\n\tm, err := NewMacaroon(rootKey, idBytes, o.p.Location, version, o.p.Namespace)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"cannot create macaroon with version %v\", version)\n\t}\n\tif err := o.AddCaveats(ctx, m, caveats); err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "1bc35c629062f16bcce69cc5a75eac34", "score": "0.44453278", "text": "func (C *Client) Add(id int, entry mal.AnimeEntry) error {\n\t_, err := C.Anime.Add(id, entry)\n\treturn err\n}", "title": "" }, { "docid": "a23d27f7469cffdcda10755a33d855bb", "score": "0.44360217", "text": "func (c ThirdPartyCaveatCheckerFunc) CheckThirdPartyCaveat(ctx context.Context, info *ThirdPartyCaveatInfo) ([]checkers.Caveat, error) {\n\treturn c(ctx, info)\n}", "title": "" }, { "docid": "94fbff7519b3d4132d352ce1e795b250", "score": "0.44342592", "text": "func (t *SimpleChaincode) addConsent(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar err error\n\tvar mobileID string\n\n\t// if len(args) != 3 {\n\t// \treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\n\t// }\n\n\tmobileID = args[0]\n\tvar consentLog = ConsentLog{MobileID: args[0], MobileNumber: args[1], AAL: args[2], MobileIDIAL: args[3], IssuerCode: args[4], IssuerName: args[5], VerifierCode: args[6], VerifierName: args[7], ConsentDate: args[8], TxCode: args[9]}\n\n\tconsentLogAsBytes, _ := json.Marshal(consentLog)\n\t// Write the state back to the ledger\n\terr = stub.PutState(\"CONSENT_\"+mobileID, consentLogAsBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "ef8c14039a8cf6ad2ce226a1dd59d937", "score": "0.4425226", "text": "func AddGoodsCate(m *GoodsCate) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "title": "" }, { "docid": "9fa6fd93775a5bd3ed6bf6fa1318afd1", "score": "0.44243413", "text": "func (ws *WebService) AddMacAddress(c *echo.Context) error {\n\tvar mac MACAddress\n\tc.Bind(&mac)\n\tlog.Printf(\"[INFO] [shiva] MAC address to store: %v\", mac)\n\texists, err := ws.Store.Exists([]byte(mac.Address))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\t&APIErrorResponse{Error: err.Error()})\n\t}\n\tif exists {\n\t\treturn c.JSON(http.StatusBadRequest,\n\t\t\t&APIErrorResponse{\n\t\t\t\tError: fmt.Sprintf(\"MAC already exists %s\",\n\t\t\t\t\tmac.Address),\n\t\t\t})\n\t}\n\t_, err = net.ParseMAC(mac.Address)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\t&APIErrorResponse{Error: err.Error()})\n\t}\n\tdata, err := json.Marshal(mac)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError,\n\t\t\t&APIErrorResponse{Error: err.Error()})\n\t}\n\tws.Store.Put([]byte(mac.Address), data)\n\t// log.Printf(\"[INFO] [shiva] MAC stored : %v\", mac)\n\treturn c.JSON(http.StatusOK, mac)\n}", "title": "" }, { "docid": "9e45acaad37bef326d67cfdd32bc14f7", "score": "0.4406705", "text": "func GetCaveatArgOfCondition(mac *macaroon.Macaroon, cond string) string {\n\tfor _, caveat := range mac.Caveats() {\n\t\tcaveatCond, arg, err := checkers.ParseCaveat(string(caveat.Id))\n\t\tif err != nil {\n\t\t\t// If we can't parse the caveat, it probably doesn't\n\t\t\t// concern us.\n\t\t\tcontinue\n\t\t}\n\t\tif caveatCond == cond {\n\t\t\treturn arg\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5d9be1b1f35b3c00a5c6eccfef47a839", "score": "0.44019517", "text": "func operationCaveat(cond string, op []string) Caveat {\n\tfor _, o := range op {\n\t\tif strings.IndexByte(o, ' ') != -1 {\n\t\t\treturn ErrorCaveatf(\"invalid operation name %q\", o)\n\t\t}\n\t}\n\treturn firstParty(cond, strings.Join(op, \" \"))\n}", "title": "" }, { "docid": "ed47e986c3c9474111b114c819188dae", "score": "0.43882948", "text": "func (_obj *Apicontacts) AddServant(imp _impApicontacts, obj string) {\n\ttars.AddServant(_obj, imp, obj)\n}", "title": "" }, { "docid": "a980789505324bb50d93275ba1f6b557", "score": "0.43007797", "text": "func NewExpiryCaveat(t testing.TB, until time.Time) security.Caveat {\n\tc, err := security.NewCaveat(security.ExpiryCaveat, until)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "b269e792bc4601d08ab066adeb7394e2", "score": "0.42671904", "text": "func (cc CustomerController) Add(c domain.Customer) {\n\terr := cc.store.Create(c)\n\tif err != nil {\n\t\tlog.Println(\"Error: \", err)\n\t\treturn\n\t}\n\tlog.Println(\"New Customer has been created\")\n}", "title": "" }, { "docid": "8180078fcd0cea88610283fee7cb94e7", "score": "0.42311385", "text": "func (cs *CSet) Add(reason, action, reaction string) {\n\tcs.mu.Lock()\n\tdefer cs.mu.Unlock()\n\tif cs.m[reason] == nil {\n\t\tcs.m[reason] = make(map[string]string, 2)\n\t}\n\tcs.m[reason][action] = reaction\n}", "title": "" }, { "docid": "53cb58e9a668a6e7f870504c700028ac", "score": "0.42052016", "text": "func (n *NoteCtr) NoteAdd(c *gin.Context) {\n\tyear, err := strconv.Atoi(c.Param(\"year\"))\n\n\tif err != nil {\n\t\tapiresponse.APIResponse(c, http.StatusBadRequest, nil, 1, \"NoteAdd\", err.Error())\n\t\treturn\n\t}\n\n\tmonth, err := strconv.Atoi(c.Param(\"month\"))\n\n\tif err != nil {\n\t\tapiresponse.APIResponse(c, http.StatusBadRequest, nil, 1, \"NoteAdd\", err.Error())\n\t\treturn\n\t}\n\n\taddedNote, err := model.NoteAdd(n.DB, year, month)\n\n\tif err != nil {\n\t\tapiresponse.APIResponse(c, http.StatusInternalServerError, nil, 11, \"NoteAdd\", err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": addedNote,\n\t\t\"error\": nil,\n\t})\n\treturn\n}", "title": "" }, { "docid": "326a0a0cc34e9debb0bf76ec314a24ca", "score": "0.41907012", "text": "func Discharge(ctx context.Context, p DischargeParams) (*Macaroon, error) {\n\tvar caveatIdPrefix []byte\n\tif p.Caveat == nil {\n\t\t// The caveat information is encoded in the id itself.\n\t\tp.Caveat = p.Id\n\t} else {\n\t\t// We've been given an explicit id, so when extra third party\n\t\t// caveats are added, use that id as the prefix\n\t\t// for any more ids.\n\t\tcaveatIdPrefix = p.Id\n\t}\n\tcavInfo, err := decodeCaveat(p.Key, p.Caveat)\n\tif err != nil {\n\t\treturn nil, errgo.Notef(err, \"discharger cannot decode caveat id\")\n\t}\n\tcavInfo.Id = p.Id\n\t// Note that we don't check the error - we allow the\n\t// third party checker to see even caveats that we can't\n\t// understand.\n\tcond, arg, _ := checkers.ParseCaveat(string(cavInfo.Condition))\n\n\tvar caveats []checkers.Caveat\n\tif cond == checkers.CondNeedDeclared {\n\t\tcavInfo.Condition = []byte(arg)\n\t\tcaveats, err = checkNeedDeclared(ctx, cavInfo, p.Checker)\n\t} else {\n\t\tcaveats, err = p.Checker.CheckThirdPartyCaveat(ctx, cavInfo)\n\t}\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err, errgo.Any)\n\t}\n\t// Note that the discharge macaroon does not need to\n\t// be stored persistently. Indeed, it would be a problem if\n\t// we did, because then the macaroon could potentially be used\n\t// for normal authorization with the third party.\n\tm, err := NewMacaroon(cavInfo.RootKey, p.Id, \"\", cavInfo.Version, cavInfo.Namespace)\n\tif err != nil {\n\t\treturn nil, errgo.Mask(err)\n\t}\n\tm.caveatIdPrefix = caveatIdPrefix\n\tfor _, cav := range caveats {\n\t\tif err := m.AddCaveat(ctx, cav, p.Key, p.Locator); err != nil {\n\t\t\treturn nil, errgo.Notef(err, \"could not add caveat\")\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "ab58ba781676dd9ccec78fe85a59147b", "score": "0.41884354", "text": "func PointInotifyAddWatch(t *kernel.Task, fields seccheck.FieldSet, cxtData *pb.ContextData, info kernel.SyscallInfo) (proto.Message, pb.MessageType) {\n\tp := &pb.InotifyAddWatch{\n\t\tContextData: cxtData,\n\t\tSysno: uint64(info.Sysno),\n\t\tFd: info.Args[0].Int(),\n\t\tMask: info.Args[2].Uint(),\n\t}\n\tif pathAddr := info.Args[1].Pointer(); pathAddr > 0 {\n\t\tp.Pathname, _ = t.CopyInString(pathAddr, linux.PATH_MAX)\n\t}\n\n\tif fields.Local.Contains(seccheck.FieldSyscallPath) {\n\t\tp.FdPath = getFilePath(t, int32(p.Fd))\n\t}\n\n\tp.Exit = newExitMaybe(info)\n\treturn p, pb.MessageType_MESSAGE_SYSCALL_INOTIFY_ADD_WATCH\n}", "title": "" }, { "docid": "3a3135ff1978a22178b4a6604518eb94", "score": "0.41823858", "text": "func (t *ServicesChaincode) addCIAV(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tmyLogger.Debugf(\"Adding Customer record started...\")\n\tmyLogger.Debugf(args[0])\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments for addCIAV. Expecting 1\")\n\t}\n\n\tmyLogger.Debugf(\"Adding Customer record ...\")\n\tvar Cust ciav.Customer\n\terr := json.Unmarshal([]byte(string(args[0])), &Cust)\n\tif err != nil {\n\t\tfmt.Println(\"Error is :\", err)\n\t}\n\n\tdata, isCDExists := pme.DuplicateExists(stub, Cust)\n\tif isCDExists {\n\t\treturn nil, errors.New(\"ERROR : Add failed. Duplicate customer - Data already exists.\")\n\t}\n\n\tfor i := range Cust.Identification {\n\t\tciav.AddIdentification(stub, []string{Cust.Identification[i].CustomerId, Cust.Identification[i].IdentityNumber, Cust.Identification[i].PoiType, Cust.Identification[i].PoiDoc,\n\t\t\tCust.Identification[i].Source})\n\t}\n\n\tciav.AddCustomer(stub, []string{Cust.PersonalDetails.CustomerId, Cust.PersonalDetails.FirstName, Cust.PersonalDetails.LastName,\n\t\tCust.PersonalDetails.Sex, Cust.PersonalDetails.EmailId, Cust.PersonalDetails.Dob, Cust.PersonalDetails.PhoneNumber, Cust.PersonalDetails.Occupation,\n\t\tCust.PersonalDetails.AnnualIncome, Cust.PersonalDetails.IncomeSource, Cust.PersonalDetails.Source})\n\n\tciav.AddKYC(stub, []string{Cust.Kyc.CustomerId, Cust.Kyc.KycStatus, Cust.Kyc.LastUpdated, Cust.Kyc.Source, Cust.Kyc.KycRiskLevel})\n\n\tfor i := range Cust.Address {\n\t\tciav.AddAddress(stub, []string{Cust.Address[i].CustomerId, Cust.Address[i].AddressId, Cust.Address[i].AddressType,\n\t\t\tCust.Address[i].DoorNumber, Cust.Address[i].Street, Cust.Address[i].Locality, Cust.Address[i].City, Cust.Address[i].State,\n\t\t\tCust.Address[i].Pincode, Cust.Address[i].PoaType, Cust.Address[i].PoaDoc, Cust.Address[i].Source})\n\t}\n\t// match data using PME\n\tpme.CollectMatchData(stub, Cust, data)\n\n\tmyLogger.Debugf(\"Add . . .\")\n\treturn []byte(\"Add Successful....\"), nil\n}", "title": "" }, { "docid": "989035794063d0c03ce67fa19fa03084", "score": "0.4166998", "text": "func (c *Client) AddAnnotation(pod *corev1.Pod, key, value string) (*corev1.Pod, error) {\n\tif pod.GetAnnotations() == nil {\n\t\tpod.SetAnnotations(make(map[string]string))\n\t}\n\tpod.Annotations[key] = value\n\n\treturn c.UpdatePod(pod, pod.GetNamespace(), metav1.UpdateOptions{})\n}", "title": "" }, { "docid": "b30d3981230ee784fef95e0bf5943ce1", "score": "0.4157689", "text": "func SaveCinemaResponse(cinema, screen, movie, seats, ticketPrice, name, phone, email, city, address, seatNumbers, Time string, handlingCharges int) (string, bool) {\n\tstatus := \"success\"\n\tmsg := \"\"\n\tbookingID := fmt.Sprintf(\"AC%d\", config.BookingNumber*100000)\n\torderRefNumber := fmt.Sprintf(\"AC%d\", config.BookingNumber*100000)\n\torder := fmt.Sprintf(\"mov%d\", config.BookingNumber*100)\n\tbookmeBookingID := utils.GetRandomSeq(32)\n\tbookingReference := \"\"\n\tnetAmount := 0\n\tdiscount := 0\n\tif _ticketPrice, err := strconv.ParseInt(ticketPrice, 10, 0); err == nil {\n\t\tnetAmount = int(_ticketPrice)\n\t} else {\n\t\tfmt.Println(config.ERROR, \"There was an error converting 'ticket_price' to integer\")\n\t\treturn \"There was an error converting 'ticket_price' to integer\", true\n\t}\n\tif _seats, err := strconv.ParseInt(seats, 10, 0); err == nil {\n\t\tnetAmount *= int(_seats)\n\t} else {\n\t\tfmt.Println(config.ERROR, \"There was an error converting 'seats' to integer\")\n\t\treturn \"There was an error converting 'seats' to integer\", true\n\t}\n\n\ttotalAmount := netAmount + handlingCharges\n\tseatPreference := \"\"\n\tdate := time.Now().Format(\"02th January 2006 03:04:05 PM\")\n\t_time, _ := time.Parse(\"2006-01-02 15:04:05\", Time)\n\n\treturn fmt.Sprintf(`[\n\t\t{\n\t\t\t\"status\": \"%s\",\n\t\t\t\"msg\": \"%s\",\n\t\t\t\"booking_id\": \"%s\",\n\t\t\t\"orderRefNumber\": \"%s\",\n\t\t\t\"order\": \"%s\",\n\t\t\t\"bookme_booking_id\": \"%s\",\n\t\t\t\"booking_reference\": \"%s\",\n\t\t\t\"cinema\": \"%s\",\n\t\t\t\"screen\": \"%s\",\n\t\t\t\"movie\": \"%s\",\n\t\t\t\"seats\": \"%s\",\n\t\t\t\"net_amount\": \"%d\",\n\t\t\t\"handling_charges\": \"%d\",\n\t\t\t\"Discount\": \"%d\",\n\t\t\t\"total_amount\": \"%d\",\n\t\t\t\"name\": \"%s\",\n\t\t\t\"phone\": \"%s\",\n\t\t\t\"email\": \"%s\",\n\t\t\t\"city\": \"%s\",\n\t\t\t\"address\": \"%s\",\n\t\t\t\"seat_numbers\": \"%s\",\n\t\t\t\"seat_preference\": \"%s\",\n\t\t\t\"date\": \"%s\",\n\t\t\t\"time\": \"%s\"\n\t\t}\n\t]`,\n\t\tstatus, msg, bookingID, orderRefNumber, order, bookmeBookingID, bookingReference, cinema, screen, movie, seats, netAmount,\n\t\thandlingCharges, discount, totalAmount, name, phone, email, city, address, seatNumbers, seatPreference, date, _time.Format(\"Jan 02 2006 03:04 PM\")), true\n\n}", "title": "" }, { "docid": "e540eb8f79207426326f46cc136c7188", "score": "0.41451532", "text": "func (_obj *Apiphone) AddServant(imp _impApiphone, obj string) {\n\ttars.AddServant(_obj, imp, obj)\n}", "title": "" }, { "docid": "1d855815997f9ddc32c29482cfcb3206", "score": "0.41441885", "text": "func (r *ChannelResource) AddReaction(ctx context.Context, messageID, emoji string) error {\n\te := endpoint.CreateReaction(r.channelID, messageID, url.PathEscape(emoji))\n\tresp, err := r.client.doReq(ctx, e, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\treturn apiError(resp)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fff4a076c1a06bebba0b9fd8f922c0f", "score": "0.41239014", "text": "func (g *Client) AddAttestationToImage(ctx context.Context, ref reference.Canonical, attestation voucher.Attestation) (voucher.SignedAttestation, error) {\n\tif !g.CanAttest() {\n\t\treturn voucher.SignedAttestation{}, errCannotAttest\n\t}\n\n\tsignedAttestation, err := voucher.SignAttestation(g.keyring, attestation)\n\tif nil != err {\n\t\treturn voucher.SignedAttestation{}, err\n\t}\n\n\t_, err = g.containeranalysis.CreateOccurrence(\n\t\tctx,\n\t\tnewOccurrenceAttestation(\n\t\t\tref,\n\t\t\tsignedAttestation,\n\t\t\tg.binauthProject,\n\t\t),\n\t)\n\n\tif isAttestionExistsErr(err) {\n\t\terr = nil\n\n\t\tsignedAttestation.Signature = \"\"\n\t}\n\n\treturn signedAttestation, err\n}", "title": "" }, { "docid": "63b654339b6c6955479015069bac9131", "score": "0.41205266", "text": "func (b *EventBuilder) Incident(value *IncidentBuilder) *EventBuilder {\n\tb.incident = value\n\tif value != nil {\n\t\tb.bitmap_ |= 4096\n\t} else {\n\t\tb.bitmap_ &^= 4096\n\t}\n\treturn b\n}", "title": "" }, { "docid": "501c66198aa374ae371e2fe64ac16f34", "score": "0.41033545", "text": "func AllowCaveat(op ...string) Caveat {\n\tif len(op) == 0 {\n\t\treturn ErrorCaveatf(\"no operations allowed\")\n\t}\n\treturn operationCaveat(CondAllow, op)\n}", "title": "" }, { "docid": "972d2443f2c6f25138d446f8d7c64abf", "score": "0.40978867", "text": "func (r *RPC) AddArc(c context.Context, arg *feedmdl.ArgArc, res *struct{}) (err error) {\n\terr = r.s.AddArc(c, arg.Mid, arg.Aid, arg.PubDate, arg.RealIP)\n\treturn\n}", "title": "" }, { "docid": "6df19410245c91bcfa4d8acd21dc1810", "score": "0.4091024", "text": "func (pool Pool) AppendCAs() error {\n\tif ok := pool.Certs.AppendCertsFromPEM([]byte(comodo)); !ok {\n\t\treturn errors.New(\"failed to parse const Comodo root certificate\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9a216d7811fa1e616cd9da7577275116", "score": "0.4079946", "text": "func (m PrometheusBackend) AddPanic(daemon, asset, request string) {\n\tm.panicsTotal.With(\n\t\tprometheus.Labels{\n\t\t\trequestLabel: request,\n\t\t\tassetLabel: asset,\n\t\t\tdaemonLabel: daemon,\n\t\t},\n\t).Add(1)\n}", "title": "" }, { "docid": "da1e447d5f2965f7c6ffe2f089fc6177", "score": "0.40744305", "text": "func (t *MedicalApp) addDoctor(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start addDoctor\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 9 {\n\t\t\tfmt.Println(\"Incorrect number of arguments, Required 9 arguments\")\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 9 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\tfmt.Println(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\t// get timestamp\n\t\ttxTimeAsPtr, errTx := t.GetTxTimestampChannel(stub)\n\t\tif errTx != nil {\n\t\t\treturn shim.Error(\"Returning time error\")\n\t\t}\n\n\t\t// create the object\n\t\tvar obj = Doctor{}\n\n\t\tobj.Doctor_ID = ComputeHashKey(args[0]+(txTimeAsPtr.String()))\n\t\tobj.FirstName = args[0]\n\t\tobj.LastName = args[1]\n\t\tobj.FatherName = args[2]\n\t\tobj.BrithDate = args[3]\n\t\tobj.Gender = args[4]\n\t\tobj.ClinicName = args[5]\n\t\tobj.Specialization = args[6]\n\t\tobj.Username = args[7]\n\t\tobj.Password = args[8]\n\t\tobj.AssetType = \"Doctor\"\n\n\t\t// convert to bytes\n\t\tassetAsBytes, errMarshal := json.Marshal(obj)\n\t\t\n\t\t// show error if failed\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\t// save data in blockchain\n\t\terrPut := stub.PutState(obj.Doctor_ID, assetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to save file data : %s\", obj.Doctor_ID))\n\t\t}\n\n\t\tfmt.Println(\"Success in saving file data %v\", obj)\n\n\n\t\treturn shim.Success(assetAsBytes)\n\t}", "title": "" }, { "docid": "833a49bfe1742b1ffacf792118d6475a", "score": "0.4073372", "text": "func AddComprobante(m *Comprobante) (id int64, err error) {\n\to := orm.NewOrm()\n\tm.FechaRegistro = time.Now()\n\tm.Mes = int(time.Now().Month())\n\tm.Ano = time.Now().Year()\n\tid, err = o.Insert(m)\n\treturn\n}", "title": "" }, { "docid": "aff9ddb732e06aa09ed3fd29c27add35", "score": "0.40685272", "text": "func (g *Graph) Add(vc *verifiable.Credential) (string, error) { //nolint:interfacer\n\t// TODO: do we need canonical?\n\tanchorBytes, err := vc.MarshalJSON()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcid, err := g.Cas.Write(anchorBytes)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to add anchor to graph: %w\", err)\n\t}\n\n\tlogger.Debugf(\"added anchor[%s]: %s\", cid, string(anchorBytes))\n\n\treturn cid, nil\n}", "title": "" }, { "docid": "1df07244214681514f80a2534146829b", "score": "0.40675208", "text": "func (s *AnimeService) Add(animeID int, entry AnimeEntry) (*Response, error) {\n\n\treturn s.client.post(s.AddEndpoint.String(), animeID, entry, true)\n}", "title": "" }, { "docid": "d5a5171a9b4efc91d805975d3b7f2cf5", "score": "0.40557918", "text": "func AddClaimType(ctx sdk.Context, k keeper.Keeper, claimType string) {\n\tparams := types.DefaultParams()\n\tparams.ClaimParams = map[string](types.ClaimParams){\n\t\tclaimType: {\n\t\t\tClaimType: claimType,\n\t\t},\n\t}\n\tk.SetParams(ctx, params)\n}", "title": "" }, { "docid": "47bd718492c3014493c57167fd09e393", "score": "0.4054743", "text": "func (c Controlling) AddTo(m *stun.Message) error {\n\treturn tieBreaker(c).AddToAs(m, stun.AttrICEControlling)\n}", "title": "" }, { "docid": "aab7cc2beec95c7b2939305e890b9c55", "score": "0.40515664", "text": "func ProtoToContaineranalysisNoteAttestation(p *containeranalysispb.ContaineranalysisNoteAttestation) *containeranalysis.NoteAttestation {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &containeranalysis.NoteAttestation{\n\t\tHint: ProtoToContaineranalysisNoteAttestationHint(p.GetHint()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "23c9f89c1e4f715e862dc5df1f0e6cf1", "score": "0.40440977", "text": "func (s *Scenario) AddIdentity(identity *metadata.Identity) {\n\ts.Identity = identity\n}", "title": "" }, { "docid": "3c763c0ec4935749639ff2583167b209", "score": "0.4042578", "text": "func (recv *Application) AddAccelerator(accelerator string, actionName string, parameter *glib.Variant) {\n\tc_accelerator := C.CString(accelerator)\n\tdefer C.free(unsafe.Pointer(c_accelerator))\n\n\tc_action_name := C.CString(actionName)\n\tdefer C.free(unsafe.Pointer(c_action_name))\n\n\tc_parameter := (*C.GVariant)(C.NULL)\n\tif parameter != nil {\n\t\tc_parameter = (*C.GVariant)(parameter.ToC())\n\t}\n\n\tC.gtk_application_add_accelerator((*C.GtkApplication)(recv.native), c_accelerator, c_action_name, c_parameter)\n\n\treturn\n}", "title": "" }, { "docid": "b96bdde0a26fed0d44da7491733d15d3", "score": "0.40418884", "text": "func (m Metric) AddPanic() {\n\tm.backend.AddPanic(m.daemon, m.asset, m.requestName)\n}", "title": "" }, { "docid": "818048b1bf797af432044d3bc83c64ed", "score": "0.4034088", "text": "func (ns *Namespace) ResolveCaveat(cav Caveat) Caveat {\n\t// TODO(rog) If a namespace isn't registered, try to resolve it by\n\t// resolving it to the latest compatible version that is\n\t// registered.\n\tif cav.Namespace == \"\" || cav.Location != \"\" {\n\t\treturn cav\n\t}\n\tprefix, ok := ns.Resolve(cav.Namespace)\n\tif !ok {\n\t\terrCav := ErrorCaveatf(\"caveat %q in unregistered namespace %q\", cav.Condition, cav.Namespace)\n\t\tif errCav.Namespace != cav.Namespace {\n\t\t\tprefix, _ = ns.Resolve(errCav.Namespace)\n\t\t}\n\t\tcav = errCav\n\t}\n\tif prefix != \"\" {\n\t\tcav.Condition = ConditionWithPrefix(prefix, cav.Condition)\n\t}\n\tcav.Namespace = \"\"\n\treturn cav\n}", "title": "" }, { "docid": "411fa12303fee7dc3236fd47d0e399b4", "score": "0.40340567", "text": "func AddMAC(cmd *command.Command, keyName string, required bool) error {\n\tkey := keyName\n\tconst (\n\t\tlongName = \"mac\"\n\t\tshortName = \"m\"\n\t\tdefaultValue = \"\"\n\t\tdescription = \"Specify the MAC address\"\n\t)\n\n\tflags := cmd.Cobra.Flags()\n\tflags.StringP(longName, shortName, defaultValue, description)\n\tif required {\n\t\tcmd.Cobra.MarkFlagRequired(longName)\n\t}\n\n\tflag := flags.Lookup(longName)\n\tflag.Hidden = true\n\n\tviper.BindPFlag(key, flag)\n\tviper.SetDefault(key, defaultValue)\n\n\treturn nil\n}", "title": "" }, { "docid": "3239092ef57912b2d577bb186d3b853c", "score": "0.40270552", "text": "func (t *App) AddHeader(args ...interface{}) {\n\tt.AddLine(args...)\n\tt.addSeparator(args)\n}", "title": "" }, { "docid": "f08d4643e01740b27ff9294240a9af4c", "score": "0.40264574", "text": "func (c *mutableTLSConfig) AddImmutableClientCACert(cert *x509.Certificate) {\n\tc.Lock()\n\tc.clientCerts = append(c.clientCerts, cert)\n\tc.Unlock()\n}", "title": "" }, { "docid": "08e38e01a0a295229f2a633088696d8e", "score": "0.40204722", "text": "func AddMention(mention Mention) {\n\t// Log it\n\tlog.Printf(\"MENTION %s on %s by %s, %s\",mention.item.id, mention.item.kind, mention.item.author, mention.item.url)\t\n}", "title": "" }, { "docid": "af7c84e7e7d8127e2f2867cc938fac2c", "score": "0.40182477", "text": "func (cl *Climate) AddOption(option clasp.Specification, flags ...AliasFlag) {\n\n\tcl.Specifications = append(cl.Specifications, &option)\n}", "title": "" }, { "docid": "f495fbe3839836cbdd9dc4606dce69b8", "score": "0.40082917", "text": "func (_Consensus *ConsensusTransactor) AddObserver(opts *bind.TransactOpts, nodeID string) (*types.Transaction, *types.Receipt, error) {\n\treturn _Consensus.contract.Transact(opts, \"addObserver\", nodeID)\n}", "title": "" }, { "docid": "0056a8bfca1fa25ecf92421d8f7f2cf4", "score": "0.40076092", "text": "func NewBrowserCaveatSelector(assetsPrefix string) CaveatSelector {\n\treturn &browserCaveatSelector{assetsPrefix}\n}", "title": "" }, { "docid": "347d35ad7c101ef8771b171d945a14d7", "score": "0.40004256", "text": "func setAdd(item, cumulative value.Value) (value.AnnotatedValue, error) {\n\tav, ok := cumulative.(value.AnnotatedValue)\n\tif !ok {\n\t\tav = value.NewAnnotatedValue(cumulative)\n\t}\n\n\tset, e := getSet(av)\n\tif e == nil {\n\t\tset.Add(item)\n\t\treturn av, nil\n\t}\n\n\tset = value.NewSet(_OBJECT_CAP)\n\tset.Add(item)\n\tav.SetAttachment(\"set\", set)\n\treturn av, nil\n}", "title": "" }, { "docid": "9371085728905fa6f23fd14039f0a6cf", "score": "0.39941552", "text": "func (_CivilTokenControllerContract *CivilTokenControllerContractTransactorSession) AddToCore(operator common.Address) (*types.Transaction, error) {\n\treturn _CivilTokenControllerContract.Contract.AddToCore(&_CivilTokenControllerContract.TransactOpts, operator)\n}", "title": "" }, { "docid": "955fc482a6a9932e06dca0804f0a3f74", "score": "0.39889255", "text": "func (_CivilTokenControllerContract *CivilTokenControllerContractSession) AddToCore(operator common.Address) (*types.Transaction, error) {\n\treturn _CivilTokenControllerContract.Contract.AddToCore(&_CivilTokenControllerContract.TransactOpts, operator)\n}", "title": "" }, { "docid": "72784e4d2f823c5ae3f4ca06955fb393", "score": "0.39878622", "text": "func (a *ApplianceCustomizationsApiService) ApplianceCustomizationsIdPut(ctx _context.Context, id string) ApiApplianceCustomizationsIdPutRequest {\n\treturn ApiApplianceCustomizationsIdPutRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "7c70b1da64b6c1a7a61aceabe196db6d", "score": "0.39851794", "text": "func AddServiceCA(jaeger *v1.Jaeger, commonSpec *v1.JaegerCommonSpec) {\n\tif autodetect.OperatorConfiguration.GetPlatform() != autodetect.OpenShiftPlatform {\n\t\treturn\n\t}\n\n\tif !deployServiceCA(jaeger) {\n\t\tjaeger.Logger().V(-1).Info(\"CA: Skip adding the Jaeger instance's service CA volume\")\n\t\treturn\n\t}\n\n\tvolume := corev1.Volume{\n\t\tName: ServiceCAName(jaeger),\n\t\tVolumeSource: corev1.VolumeSource{\n\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\tName: ServiceCAName(jaeger),\n\t\t\t\t},\n\t\t\t\tItems: []corev1.KeyToPath{{\n\t\t\t\t\tKey: \"service-ca.crt\",\n\t\t\t\t\tPath: \"service-ca.crt\",\n\t\t\t\t}},\n\t\t\t},\n\t\t},\n\t}\n\n\tvolumeMount := corev1.VolumeMount{\n\t\tName: ServiceCAName(jaeger),\n\t\tMountPath: serviceCAMountPath,\n\t\tReadOnly: true,\n\t}\n\n\tcommonSpec.Volumes = util.RemoveDuplicatedVolumes(append(commonSpec.Volumes, volume))\n\tcommonSpec.VolumeMounts = util.RemoveDuplicatedVolumeMounts(append(commonSpec.VolumeMounts, volumeMount))\n}", "title": "" }, { "docid": "382fbb9580f658e0d1e03f49786d62ae", "score": "0.3982459", "text": "func (c Client) CreateAttestationNote(aa *kritisv1beta1.AttestationAuthority) (*grafeas.Note, error) {\n\tnoteProject, noteId, err := metadata.ParseNoteReference(aa.Spec.NoteReference)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taaNote := &attestation.Authority{\n\t\tHint: &attestation.Authority_Hint{\n\t\t\tHumanReadableName: aa.Name,\n\t\t},\n\t}\n\tnote := grafeas.Note{\n\t\tName: aa.Spec.NoteReference,\n\t\tShortDescription: fmt.Sprintf(\"Image Policy Security Attestor\"),\n\t\tLongDescription: fmt.Sprintf(\"Image Policy Security Attestor deployed in %s namespace\", aa.Namespace),\n\t\tType: &grafeas.Note_AttestationAuthority{\n\t\t\tAttestationAuthority: aaNote,\n\t\t},\n\t}\n\n\treq := &grafeas.CreateNoteRequest{\n\t\tNote: &note,\n\t\tNoteId: noteId,\n\t\tParent: fmt.Sprintf(\"projects/%s\", noteProject),\n\t}\n\treturn c.client.CreateNote(c.ctx, req)\n}", "title": "" }, { "docid": "c04f85d240541a869abdc07c38a71a61", "score": "0.3980945", "text": "func (c *AgendaController) AddReaction(ctx *app.AddReactionAgendaContext) error {\n\t// AgendaController_AddReaction: start_implement\n\n\t// Put your logic here\n\n\t// AgendaController_AddDecision: end_implement\n\treturn nil\n}", "title": "" }, { "docid": "e8f1c31183f2e96f17529a80cb633095", "score": "0.39688504", "text": "func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) {\n\tu := \"octocat\"\n\tif message != \"\" {\n\t\tu = fmt.Sprintf(\"%s?s=%s\", u, url.QueryEscape(message))\n\t}\n\n\treq, err := c.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tresp, err := c.Do(ctx, req, buf)\n\tif err != nil {\n\t\treturn \"\", resp, err\n\t}\n\n\treturn buf.String(), resp, nil\n}", "title": "" }, { "docid": "03b3771e3d6335b528fba943a0ba6a57", "score": "0.39666745", "text": "func (cc CoffeeController) CreateCoffee(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tc := models.Coffee{}\n\n\tjson.NewDecoder(r.Body).Decode(&c)\n\n\tc.ID = bson.NewObjectId()\n\n\tcc.Session.DB(\"coffee\").C(\"coffees\").Insert(c)\n\n\t// Marshal converts Go struct to JSON\n\tjsn, _ := json.Marshal(c)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", jsn)\n}", "title": "" }, { "docid": "de2f0cdd8a5e221a9050f5bc2e812c86", "score": "0.3966336", "text": "func (c Client) CreateAttestationNote(aa *kritisv1beta1.AttestationAuthority) (*grafeas.Note, error) {\n\tnoteProject, err := getProjectFromNoteReference(aa.Spec.NoteReference)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taaNote := &attestation.Authority{\n\t\tHint: &attestation.Authority_Hint{\n\t\t\tHumanReadableName: aa.Name,\n\t\t},\n\t}\n\tnote := grafeas.Note{\n\t\tName: fmt.Sprintf(\"projects/%s/notes/%s\", noteProject, aa.Name),\n\t\tShortDescription: fmt.Sprintf(\"Image Policy Security Attestor\"),\n\t\tLongDescription: fmt.Sprintf(\"Image Policy Security Attestor deployed in %s namespace\", aa.Namespace),\n\t\tType: &grafeas.Note_AttestationAuthority{\n\t\t\tAttestationAuthority: aaNote,\n\t\t},\n\t}\n\n\treq := &grafeas.CreateNoteRequest{\n\t\tNote: &note,\n\t\tNoteId: aa.Name,\n\t\tParent: fmt.Sprintf(\"projects/%s\", noteProject),\n\t}\n\treturn c.client.CreateNote(c.ctx, req)\n}", "title": "" }, { "docid": "8c21ef9e16c638a9318a8c6f9dc7fb42", "score": "0.39635485", "text": "func (c Customer) AddCustomer() (err error) {\n\terr = DB.Create(&c).Error\n\treturn\n}", "title": "" }, { "docid": "cdeef98f37ce469836d0b753fdfe0b5f", "score": "0.39634904", "text": "func (c *Client) CreateCoffee(coffee Coffee) (*Coffee, error) {\n\trb, err := json.Marshal(coffee)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/coffees\", c.HostURL), strings.NewReader(string(rb)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := c.doRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewCoffee := Coffee{}\n\terr = json.Unmarshal(body, &newCoffee)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &newCoffee, nil\n}", "title": "" }, { "docid": "8812b4948b2b8febae00c9f50625cafe", "score": "0.39630198", "text": "func addCoffee(ctx context.Context, db DB) (coffee, error) {\n\tfmt.Println(\"Adding new coffee (Enter # to quit):\")\n\tfmt.Print(\"Enter coffee name: \")\n\tname, quit := validateStrInput(quitStr, false, nil, nil)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tfmt.Print(\"Enter roaster/producer name: \")\n\troaster, quit := validateStrInput(quitStr, false, nil, nil)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tfmt.Print(\"Enter origin/region (Format: Region, Country): \")\n\tregion, quit := validateStrInput(quitStr, true, nil, nil)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tfmt.Print(\"Enter variety (Format: Variety 1, Variety 2, ...): \")\n\tvariety, quit := validateStrInput(quitStr, true, nil, nil)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tfmt.Print(\"Enter processing method: \")\n\tmethod, quit := validateStrInput(quitStr, true, nil, nil)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tfmt.Print(\"Is decaf (true or false): \")\n\tdecaf, quit := validateBoolInput(quitStr, true)\n\tif quit {\n\t\tfmt.Println(quitMsg)\n\t\treturn coffee{}, nil\n\t}\n\n\tnewCoffee := coffee{\n\t\tname: name,\n\t\troaster: roaster,\n\t\tregion: region,\n\t\tvariety: variety,\n\t\tmethod: method,\n\t\tdecaf: decaf,\n\t}\n\n\tif err := db.insertCoffee(ctx, newCoffee); err != nil {\n\t\treturn coffee{}, fmt.Errorf(\"buna: coffee: failed to insert coffee: %w\", err)\n\t}\n\n\tfmt.Println(\"Added coffee successfully\")\n\treturn newCoffee, nil\n}", "title": "" }, { "docid": "d10e971af5bb2c80350a35c218422663", "score": "0.39559856", "text": "func (suo *ServiceUpdateOne) AddCustomer(c ...*Customer) *ServiceUpdateOne {\n\tids := make([]string, len(c))\n\tfor i := range c {\n\t\tids[i] = c[i].ID\n\t}\n\treturn suo.AddCustomerIDs(ids...)\n}", "title": "" }, { "docid": "f6accfce4138f7a6ed5c90789131cb72", "score": "0.39544052", "text": "func AddCash(coin Coin, amt float64, acctName, exname, owner, remarks string) error {\n\tcs, err := connect()\n\tfor _, c := range cs {\n\t\tdefer c.Close()\n\t}\n\tif err != nil {\n\t\tlogger.Warn().Msg(err.Error())\n\t\treturn err\n\t}\n\tbp, _ := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: BALANCE_DBNAME,\n\t\tPrecision: \"s\",\n\t})\n\ttimeStamp := time.Now()\n\tif math.Abs(amt) < 1e-6 {\n\t\treturn nil\n\t}\n\n\tport_fields := make(map[string]interface{})\n\tport_fields[string(coin)] = amt\n\ttags := make(map[string]string)\n\ttags[\"account\"] = acctName\n\ttags[\"owner\"] = owner\n\ttags[\"remark\"] = remarks\n\ttags[\"exchange\"] = exname\n\n\tpt, err := client.NewPoint(MT_PRINCIPAL, tags, port_fields, timeStamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbp.AddPoint(pt)\n\treturn influx.WriteBatchPoints(cs, bp)\n}", "title": "" }, { "docid": "a2fead1ab78e1627c6d77368a5452705", "score": "0.39531577", "text": "func AddCustomer(db *bolt.DB, userID, customerID string) error {\n\n\terr := db.Update(func(tx *bolt.Tx) error {\n\n\t\terr := tx.Bucket([]byte(\"DB\")).Bucket([]byte(\"CUSTOMERS\")).Put([]byte(userID), []byte(customerID))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not insert entry: %v\", err)\n\t\t}\n\n\t\treturn nil\n\t})\n\tfmt.Println(\"Added Entry\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "072a920a12a083cc1b82dd5624df3a62", "score": "0.3952485", "text": "func TestCaveatSerialization(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname string\n\t\tcaveatStr string\n\t\terr error\n\t}{\n\t\t{\n\t\t\tname: \"valid caveat\",\n\t\t\tcaveatStr: \"expiration=1337\",\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"valid caveat with separator in value\",\n\t\t\tcaveatStr: \"expiration=1337=\",\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"invalid caveat\",\n\t\t\tcaveatStr: \"expiration:1337\",\n\t\t\terr: ErrInvalidCaveat,\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\ttest := test\n\t\tsuccess := t.Run(test.name, func(t *testing.T) {\n\t\t\tcaveat, err := DecodeCaveat(test.caveatStr)\n\t\t\tif !errors.Is(err, test.err) {\n\t\t\t\tt.Fatalf(\"expected err \\\"%v\\\", got \\\"%v\\\"\",\n\t\t\t\t\ttest.err, err)\n\t\t\t}\n\n\t\t\tif test.err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcaveatStr := EncodeCaveat(caveat)\n\t\t\tif caveatStr != test.caveatStr {\n\t\t\t\tt.Fatalf(\"expected encoded caveat \\\"%v\\\", \"+\n\t\t\t\t\t\"got \\\"%v\\\"\", test.caveatStr, caveatStr)\n\t\t\t}\n\t\t})\n\t\tif !success {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8a0f5ccffe2576fd300ec2fddb17139e", "score": "0.39469665", "text": "func (c *jsiiProxy_CfnAssociation) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "abc5bbeeb6b9a9fcde8c80da53913a4e", "score": "0.3942388", "text": "func (w *PackWriter) PutImpactCategory(ic *ImpactCategory) error {\n\treturn w.put(\"lcia_categories/\"+ic.ID+\".json\", ic)\n}", "title": "" }, { "docid": "d9f16ee3240007755b784015c78be787", "score": "0.39351267", "text": "func (_obj *Message) AddServant(imp _impMessage, obj string) {\n\ttars.AddServant(_obj, imp, obj)\n}", "title": "" }, { "docid": "ba97aa037fcd1410cda4b2c8cb3e82b9", "score": "0.3933427", "text": "func (s *Service) addFunc(obj interface{}) {\n\tcert := *obj.(*certificatetpr.CustomObject)\n\ts.Config.Logger.Log(\"debug\", fmt.Sprintf(\"creating certificate '%s'\", cert.Spec.CommonName))\n\n\tif err := s.Config.CAService.SetupPKI(cert.Spec); err != nil {\n\t\ts.Config.Logger.Log(\"error\", fmt.Sprintf(\"could not setup PKI '%#v'\", err))\n\t\treturn\n\t}\n\tif err := s.Issue(cert.Spec); err != nil {\n\t\ts.Config.Logger.Log(\"error\", fmt.Sprintf(\"could not issue cert '%#v'\", err))\n\t\treturn\n\t}\n\n\ts.Config.Logger.Log(\"info\", fmt.Sprintf(\"certificate '%s' issued\", cert.Spec.CommonName))\n}", "title": "" }, { "docid": "bddc2ba681a1b330270a186be61073c6", "score": "0.39262164", "text": "func (c *CallMock) AddInterceptor(interceptor InterceptorFunc) {\n\tc.Interceptors = append(c.Interceptors, nil)\n\tcopy(c.Interceptors[1:], c.Interceptors[0:])\n\tc.Interceptors[0] = interceptor\n}", "title": "" }, { "docid": "4b14207d76d3cac5ba338c990e18fe8c", "score": "0.3915521", "text": "func AddClientSecret(ctx context.Context, objID string) (autorest.Response, error) {\n\tappClient := getApplicationsClient()\n\treturn appClient.UpdatePasswordCredentials(ctx, objID, graphrbac.PasswordCredentialsUpdateParameters{\n\t\tValue: &[]graphrbac.PasswordCredential{\n\t\t\t{\n\t\t\t\tStartDate: &date.Time{time.Now()},\n\t\t\t\tEndDate: &date.Time{time.Date(2018, time.December, 20, 22, 0, 0, 0, time.UTC)},\n\t\t\t\tValue: to.StringPtr(\"052265a2-bdc8-49aa-81bd-ecf7e9fe0c42\"), // this will become the client secret! Record this value, there is no way to get it back\n\t\t\t\tKeyID: to.StringPtr(\"08023993-9209-4580-9d4a-e060b44a64b8\"),\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "e2f02d7233a7c078b4d15138af857dd8", "score": "0.39142594", "text": "func (p *Pattern) AddCowbell(x int) error {\n\tfor i := 0; i < len(p.instruments); i++ {\n\t\tif p.instruments[i].name == \"cowbell\" {\n\t\t\tcowbellBeats := p.instruments[i].beats\n\t\t\tvar empty []int\n\t\t\tfor j := 0; j < 16; j++ {\n\t\t\t\tif cowbellBeats[j] == false {\n\t\t\t\t\tempty = append(empty, j)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(empty) <= x {\n\t\t\t\tp.instruments[i].beats = [16]bool{true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true}\n\t\t\t} else {\n\t\t\t\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\t\t\t\tvar randIndex int\n\t\t\t\tfor j := 0; j < x; j++ {\n\t\t\t\t\trandIndex = r.Int() % len(empty)\n\t\t\t\t\tp.instruments[i].beats[empty[randIndex]] = true\n\t\t\t\t\tempty = empty[:randIndex+copy(empty[randIndex:], empty[randIndex+1:])]\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59faa02404b6463e26703c45b8526f2f", "score": "0.39122465", "text": "func ProtoToContaineranalysisNoteAttestationHint(p *containeranalysispb.ContaineranalysisNoteAttestationHint) *containeranalysis.NoteAttestationHint {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &containeranalysis.NoteAttestationHint{\n\t\tHumanReadableName: dcl.StringOrNil(p.GetHumanReadableName()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "88a2aaf8d7abf1602425cb096bf57cac", "score": "0.39089182", "text": "func (mr *MockRepositoryMockRecorder) CreateCinema(cinema interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateCinema\", reflect.TypeOf((*MockRepository)(nil).CreateCinema), cinema)\n}", "title": "" }, { "docid": "fccc7c407fffe4919d9cdde0abb0cad9", "score": "0.39051002", "text": "func (mc *MarketplaceController) AddAuctionCreatedActivity(mi usecase.MarketplaceInteractor) func(*gin.Context) {\n\treturn func(c *gin.Context) {\n\t\tauctionID := c.PostForm(\"auctionID\")\n\t\tauctionNumber := c.PostForm(\"auctionNumber\")\n\t\temployerUserID := c.PostForm(\"employerUserID\")\n\t\temployerTenantID := c.PostForm(\"employerTenantID\")\n\t\temployerName := c.PostForm(\"employerName\")\n\n\t\tmarketplace := marketplaceModel.Marketplace{\n\t\t\tEmployerUserID: employerUserID,\n\t\t\tEmployerTenantID: employerTenantID,\n\t\t\tEmployerName: employerName,\n\t\t}\n\n\t\tcompetitive := marketplaceModel.Competitive{\n\t\t\tMarketplace: marketplace,\n\t\t\tAuctionID: auctionID,\n\t\t\tAuctionNumber: auctionNumber,\n\t\t}\n\n\t\terr := mi.AddAuctionCreatedActivity(competitive)\n\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\"error\": \"Unable to send notification to agency\",\n\t\t\t\t\"internalError\": err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusCreated, gin.H{\n\t\t\t\"status\": \"ok\",\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b720f294eae6c14464e50a8afff5b44c", "score": "0.39029288", "text": "func (c *APIClient) AddCustomHeader(key string, value string) {\n\tc.customHeaders[key] = value\n}", "title": "" }, { "docid": "ec0745ac3d8c5ee5de4141da46931995", "score": "0.390243", "text": "func encodeCaveatV3(\n\tcondition string,\n\trootKey []byte,\n\tthirdPartyPubKey *PublicKey,\n\tkey *KeyPair,\n\tns *checkers.Namespace,\n) ([]byte, error) {\n\treturn encodeCaveatV2V3(Version3, condition, rootKey, thirdPartyPubKey, key, ns)\n}", "title": "" }, { "docid": "630be1e75eec8b59c9e9347e5df984ee", "score": "0.39000922", "text": "func AddSANIP(ips ...net.IP) Option {\n\treturn func(c *mycert) error {\n\t\tfor _, ip := range ips {\n\t\t\tc.cert.IPAddresses = append(c.cert.IPAddresses, ip)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "9e8069f535e52f4e5d73609b53e54638", "score": "0.38924062", "text": "func (v *Visit) DecorateCustomMetadata(evt *ua.ActionEvent, customData map[string]interface{}) {\n\n\tevt.CustomData = map[string]interface{}{\n\t\t\"JSUIVersion\": JSUIVERSION,\n\t\t\"ipaddress\": v.IP,\n\t}\n\n\t// Send all the possible random custom data that can be added from the config\n\t// scenario file.\n\tfor _, elem := range v.Config.RandomCustomData {\n\t\tevt.CustomData[elem.APIName] = randomStringArray(elem.Values)\n\t}\n\n\t// Override possible values of customData with the specific customData sent\n\tfor k, v := range customData {\n\t\tevt.CustomData[k] = v\n\t}\n}", "title": "" }, { "docid": "6fcde1dbc2df90d3a7e753c4d9e5a0a8", "score": "0.38923332", "text": "func (p *Project) AddIOSClient(name string, teamID string, hasBackend bool, hasTests bool) {\n\tfmt.Printf(\"Adding iOS client: %s\\n\", name)\n\tclient := Client{\n\t\tKind: IOSClientKind,\n\t\tName: name,\n\t\tBundleDomain: reverseDomain(p.Domain),\n\t\tTeamID: teamID,\n\t\tHasBackend: hasBackend,\n\t\tHasTests: hasTests,\n\t\tTemplates: make(TemplateFiles),\n\t}\n\tp.Clients = append(p.Clients, client)\n}", "title": "" }, { "docid": "ff180f5bfb8a198247912122c20ecebf", "score": "0.38913634", "text": "func (this *Booking) AddCommission(name string, value float32, isPercent bool, isDefault bool) (models.Comission, error) {\n\tcomission := models.Comission{bson.NewObjectId(), name, value, isPercent, isDefault}\n\terr := this.db.DB.C(comission.GetTableName()).Insert(comission)\n\treturn comission, err\n}", "title": "" }, { "docid": "7edf64d156c908b380f57891324e3722", "score": "0.3887581", "text": "func (client Client) AddReaction(channel string, timestamp string, reaction string) error {\n\tmsgRef := sl.NewRefToMessage(channel, timestamp)\n\treturn client.api.AddReaction(reaction, msgRef)\n}", "title": "" }, { "docid": "0a6b6c08f80f84ae6946d3c5269ba0b6", "score": "0.38826135", "text": "func (c *CustomData) Add(key string, value interface{}) {\n\tc.CustomData[key] = value\n}", "title": "" }, { "docid": "7f28baa33416e5a2ce013e3ad242ed4b", "score": "0.3875074", "text": "func (cuo *CustomerUpdateOne) AddAddress(c ...*CustomerAddress) *CustomerUpdateOne {\n\tids := make([]int, len(c))\n\tfor i := range c {\n\t\tids[i] = c[i].ID\n\t}\n\treturn cuo.AddAddresIDs(ids...)\n}", "title": "" }, { "docid": "13b634d2ac677b5fe0a83b57e6643728", "score": "0.38590655", "text": "func AddAdvertise(m *Advertise) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "title": "" }, { "docid": "32115ca1ae2f22916902ebfc7209fd7f", "score": "0.38556564", "text": "func insertCPEIntoDB(cpe *pb.CPEDataMsg, macMgmtTable gocassa.Table) error {\n\tdbcpe, err := json.Marshal(cpe)\n\tif dbcpe == nil {\n\t\treturn fmt.Errorf(logtagdb+\"INSERT CPE error: %v\", err)\n\t}\n\n\tentry := cpe\n\n\tquery, params := macMgmtTable.Set(entry).GenerateStatement()\n\tlogFields := log.Fields{\n\t\t\"CPE_MAC\" : cpe.MacAddr,\n\t\t\"CABLE_MODEM\" : cpe.CableModem,\n\t\t\"IPv4_ADDR\" : cpe.Ipv4Addr,\n\t\t\"DEVICE_CLASS\": cpe.DeviceClass,\n\t\t\"LEASE_TIME\" : cpe.LeaseTime}\n\n\n\tlog.WithFields(logFields).Info(logtagdb, \"Query -> \", query, \"Params = \", params)\n\n\tif err := macMgmtTable.Set(entry).Run(); err != nil {\n\t\tlog.WithFields(logFields).Error(logtagdb, err)\n\t\treturn fmt.Errorf(logtagdb+\"INSERT CPE error: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0886c8f340b0dc85009cd8424ab72b64", "score": "0.3843822", "text": "func (_obj *DoUser) AddServant(imp _impDoUser, obj string) {\n\ttars.AddServant(_obj, imp, obj)\n}", "title": "" }, { "docid": "7e21967231fffecb4e562823bdf81ff8", "score": "0.3838033", "text": "func (_Consensus *ConsensusTransactorSession) AddObserver(nodeID string) (*types.Transaction, *types.Receipt, error) {\n\treturn _Consensus.Contract.AddObserver(&_Consensus.TransactOpts, nodeID)\n}", "title": "" }, { "docid": "0a58ef65f2f29ee36ba9c190486daf93", "score": "0.3831933", "text": "func (cm *Customer) AddMetadata(key, value string) {\n\tcm.Metadata[key] = value\n}", "title": "" }, { "docid": "bff1f116fb65641b4c10336fa4194b73", "score": "0.38268447", "text": "func (f *FakeAttributes) AddAnnotation(k, v string) error {\n\treturn f.AddAnnotationWithLevel(k, v, auditinternal.LevelMetadata)\n}", "title": "" }, { "docid": "d8f351a4db10953b6322ed42caf9dff2", "score": "0.38259125", "text": "func AddIngredient(ingredient string, amount int) error {\n\n\t// Acquire Lock for get and update CoffeMachineIdentity\n\t// It is required to have lock on both get and update , otherwise\n\t// data can be inconsistent\n\n\tlock := objects.GetCoffeeMachineIdentityMutexLock()\n\tlock.Lock()\n\t// Release lock after function scope ends\n\tdefer lock.Unlock()\n\n\tcoffeMachineIdentity := objects.GetCoffeMachineIdentity()\n\n\t// Check if ingredient exists in coffe-machine\n\tingredientMap, ok := coffeMachineIdentity.Ingrediants[ingredient]\n\tif !ok {\n\t\tfmt.Printf(\"Ingredient %v not available in coffee-machine\\n\", ingredient)\n\t\treturn fmt.Errorf(\"Ingredient %v not available in coffee-machine\\n\", ingredient)\n\t}\n\n\t// update ingredient quantity\n\tcoffeMachineIdentity.Ingrediants[ingredient] = ingredientMap + amount\n\n\t// update thresold amount of ingredient\n\tcoffeMachineIdentity.ThresoldIngrediants[ingredient] = (coffeMachineIdentity.Ingrediants[ingredient] * THRESOLD_INGREDIENT_PERCENTAGE) / 100\n\treturn nil\n}", "title": "" } ]
97e77220d60a3d3f587afa30345a778b
AddCredential associates the credential to the user
[ { "docid": "3cda461ef69218e384ca8b6126fe08ea", "score": "0.7930331", "text": "func (u *User) AddCredential(cred webauthn.Credential) {\n\tu.Credentials = append(u.Credentials, cred)\n}", "title": "" } ]
[ { "docid": "62bfc0ea13bdd6f53fc4fe3819b81df2", "score": "0.72394186", "text": "func (k *Key) AddCredential(cred webauthn.Credential) {\n\tk.credentials = append(k.credentials, cred)\n}", "title": "" }, { "docid": "9ec1b939c7a9ce1eb6863ca3a62a2770", "score": "0.7192291", "text": "func (a *CredentialAdding) AddCredential() error {\n\tclient := resty.New()\n\tkErr := authentication.KuberaError{}\n\t// body of POST request\n\tbody := CloudCredential{\n\t\tName: a.CredName,\n\t\tProjectID: a.projectID,\n\t\tProviderID: a.providerID,\n\t\tCred: CredType{\n\t\t\tAccessID: a.Username,\n\t\t\tSecretKey: a.Password,\n\t\t},\n\t}\n\t// body of POST request in JSON format\n\tbodyRaw, err := json.Marshal(body)\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(bodyRaw).\n\t\tSetHeader(\"Cookie\",\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"token=%s;authProvider=localAuthConfig\",\n\t\t\t\ta.jwtToken,\n\t\t\t),\n\t\t).\n\t\t//SetError method automatic unmarshalling if response status code >= 399\n\t\t// and content type either JSON or XML.\n\t\tSetError(&kErr).\n\t\tPost(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"%s/v3/groups/%s/providercredentials\",\n\t\t\t\tconnection.GetHostName(),\n\t\t\t\ta.groupID,\n\t\t\t),\n\t\t)\n\n\tif err != nil || kErr.Message != \"\" || !resp.IsSuccess() {\n\t\treturn &authentication.APIError{\n\t\t\tErr: err,\n\t\t\tMessage: kErr.Message,\n\t\t\tStatusCode: resp.StatusCode(),\n\t\t\tStatus: resp.Status(),\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19e63e2620e261ac8e7928337d1a1dd0", "score": "0.65538174", "text": "func (h Wincred) Add(creds *credentials.Credentials) error {\n\tcredsLabels := []byte(credentials.CredsLabel)\n\tg := winc.NewGenericCredential(creds.ServerURL)\n\tg.UserName = creds.Username\n\tg.CredentialBlob = []byte(creds.Secret)\n\tg.Persist = winc.PersistLocalMachine\n\tg.Attributes = []winc.CredentialAttribute{{Keyword: \"label\", Value: credsLabels}}\n\n\treturn g.Write()\n}", "title": "" }, { "docid": "5751ab9a27030e2f3d2a6163cabb24e7", "score": "0.6424091", "text": "func PutCredential(\n\tctx context.Context,\n\tclient databroker.DataBrokerServiceClient,\n\tcredential *Credential,\n) error {\n\tshrinkCredential(credential)\n\n\tdata := protoutil.NewAny(credential)\n\t_, err := client.Put(ctx, &databroker.PutRequest{\n\t\tRecords: []*databroker.Record{{\n\t\t\tType: data.GetTypeUrl(),\n\t\t\tId: credential.GetId(),\n\t\t\tData: data,\n\t\t}},\n\t})\n\treturn err\n}", "title": "" }, { "docid": "ef4202dd4c60caf8dc026969370aece5", "score": "0.64067674", "text": "func (a *CredentialAdding) AddCloudCredential() error {\n\tfns := []func() error{\n\t\ta.SetKuberaDetails,\n\t\ta.FetchGroupProjectID,\n\t\ta.FetchBackupProviderID,\n\t\ta.AddCredential,\n\t}\n\tfor _, fn := range fns {\n\t\terr := fn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ddb80999ef192e4583c35d825c27a37f", "score": "0.6108597", "text": "func (s *Store) SaveCredential(username, password string) error {\n\thashedPass, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tc := &credentials{Username: username, Password: string(hashedPass)}\n\tif err := s.db.Save(c); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c9b36f631ad4f87ab689044d04dae4b2", "score": "0.6091028", "text": "func(db *GraphPersistence) AddUserCredentials(uid, password string) error {\n log.Debug(fmt.Sprintf(\"adding credentials for user %s\", uid))\n session := db.NewSession()\n defer session.Close()\n\n cfg := map[string]interface{}{\n \"uid\": uid,\n \"password\": hashAndSalt(password),\n }\n // generate handler function to process graph query\n handler := func(tx neo4j.Transaction) (interface{}, error) {\n query := `CREATE (c:Credentials {password: $password})\n WITH c\n MATCH\n (u:User {uid: $uid})\n CREATE (u)-[:OWNS]->(c)`\n return tx.Run(query, cfg)\n }\n _, err := session.WriteTransaction(handler)\n if err != nil {\n log.Error(fmt.Errorf(\"unable to update user credentials: %+v\", err))\n return err\n }\n return nil\n}", "title": "" }, { "docid": "90c8fca81fe1d91e65c73aba9f898035", "score": "0.60759765", "text": "func (a *UserManagementApiService) CreateUserCredential(ctx context.Context, accountname string, username string) ApiCreateUserCredentialRequest {\n\treturn ApiCreateUserCredentialRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\taccountname: accountname,\n\t\tusername: username,\n\t}\n}", "title": "" }, { "docid": "ae8df59dd3be48334b5406b27c2ffd37", "score": "0.6040396", "text": "func (es *EnvStreams) AddCredential(credential config.SDKCredential) {\n\tif credential == nil {\n\t\treturn\n\t}\n\tfor _, sp := range es.streamProviders {\n\t\tif esp := sp.Register(credential, es.storeQueries, es.loggers); esp != nil {\n\t\t\tes.lock.Lock()\n\t\t\tes.activeStreams = append(es.activeStreams, streamInfo{credential, esp})\n\t\t\tes.lock.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e9e47fed9e65ce83f7e6eb045e5fc55b", "score": "0.5954905", "text": "func (m *ItemAddKeyPostRequestBody) SetPasswordCredential(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.PasswordCredentialable)() {\n err := m.GetBackingStore().Set(\"passwordCredential\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f6adb4e07f586fb88edf0d36a8ba006f", "score": "0.58496624", "text": "func (s *Store) UpdateCredential(username, password, newPassword string) error {\n\tisValid, err := s.ValidateCredential(username, password)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif !isValid {\n\t\treturn errors.New(\"invalid credentials\")\n\t}\n\n\tnewHashedPass, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tc := new(credentials)\n\tif err := s.db.One(\"Username\", username, c); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tc.Password = string(newHashedPass)\n\n\tif err = s.db.Update(c); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "65176e227e2218335461c7edfa4ddf89", "score": "0.5848242", "text": "func addUser(\n\thandle, password, name string, context ServerContext, access Access,\n) (*user, error) {\n\taccount := &user{\n\t\thandle: handle,\n\t\tname: name,\n\t}\n\n\taccount.setPassword(password)\n\n\t// Save, but throw error if overwriting\n\tif err := access.Save(account, false, context); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create new pool with handle\n\tif _, err := addPool(handle, context, access); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Printf(\"Added user \\\"%s\\\"\", handle)\n\n\treturn account, nil\n}", "title": "" }, { "docid": "6b23017ae7dbfd640ade86a9e335ea8f", "score": "0.57886356", "text": "func (a *Auth) AddUser(id, passwd, name, email, addedBy string) error {\n\tif ok := mutt.CheckParamString(id, passwd, name, email, addedBy); !ok {\n\t\treturn ERR_MISSING_REQUIRED_FIELDS\n\t}\n\n\tif _, err := a.db.Get(bID, []byte(id)); err != nil {\n\t\t// error means, the id not exist\n\t\ttmpId := mutt.User{ID: id}\n\t\ttmpId.Name.DisplayName = name\n\t\ttmpId.Email.Email = email\n\t\ttmpB, err := tmpId.Bytes()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn a.db.Put(bID, []byte(id), tmpB)\n\t}\n\treturn ERR_USERID_EXIST\n}", "title": "" }, { "docid": "3823e3065b31d4caff41efa72ba7647f", "score": "0.57750624", "text": "func AuthAdd(context *clusterd.Context, clusterName, name, keyringPath string, caps []string) error {\n\targs := append([]string{\"auth\", \"add\", name, \"-i\", keyringPath}, caps...)\n\t_, err := ExecuteCephCommand(context, clusterName, args)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to auth add for %s: %+v\", name, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "42140d5346228646081f1b190bc332ed", "score": "0.5759334", "text": "func CreateUserCredential(username, password, clientID string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "b0142597bb7c138ef0f97ca834468ed2", "score": "0.5724499", "text": "func UpdateUserCredential(userID uuid.UUID, username, password string) error {\n\treturn nil\n}", "title": "" }, { "docid": "527c2bdbbb012f60c28a9b385471ec25", "score": "0.56530595", "text": "func (p DCNone) Add(creds *credentials.Credentials) error {\n\tvar auths map[string]interface{}\n\n\tif creds == nil {\n\t\treturn errors.New(\"missing credentials\")\n\t}\n\tconfig, err := getParsedConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tauthsInterface, ok := config[\"auths\"]\n\tif ok {\n\t\tauths, ok = authsInterface.(map[string]interface{})\n\t}\n\tif !ok {\n\t\t// Either config['auths'] doesn't exist or it isn't a hash\n\t\tauths = map[string]interface{}{}\n\t\tconfig[\"auths\"] = auths\n\t}\n\tpayload := fmt.Sprintf(\"%s:%s\", creds.Username, creds.Secret)\n\tencoded := base64.URLEncoding.EncodeToString([]byte(payload))\n\tauths[creds.ServerURL] = map[string]string{\"auth\": encoded}\n\treturn saveParsedConfig(&config)\n}", "title": "" }, { "docid": "5451ef45213ae0fd328f8e4730d1bc60", "score": "0.5619957", "text": "func (v *Verifiable) SaveCredential(request *models.RequestEnvelope) *models.ResponseEnvelope {\n\targs := cmdverifiable.CredentialExt{}\n\n\tif err := json.Unmarshal(request.Payload, &args); err != nil {\n\t\treturn &models.ResponseEnvelope{Error: &models.CommandError{Message: err.Error()}}\n\t}\n\n\tresponse, cmdErr := exec(v.handlers[cmdverifiable.SaveCredentialCommandMethod], args)\n\tif cmdErr != nil {\n\t\treturn &models.ResponseEnvelope{Error: cmdErr}\n\t}\n\n\treturn &models.ResponseEnvelope{Payload: response}\n}", "title": "" }, { "docid": "095b5dc076b7dda2f0f9d6429116331a", "score": "0.56068534", "text": "func (c credentialsClient) Add(tx transaction.Transaction) (credentials.Set, error) {\n\t// sleep to prevent concurrent modification error from Microsoft\n\ttime.Sleep(c.DelayIntervalBetweenModifications())\n\n\tcurrPasswordCredential, err := c.PasswordCredential().Add(tx)\n\tif err != nil {\n\t\treturn credentials.Set{}, fmt.Errorf(\"adding current password credential: %w\", err)\n\t}\n\n\ttime.Sleep(c.DelayIntervalBetweenModifications())\n\n\tnextPasswordCredential, err := c.PasswordCredential().Add(tx)\n\tif err != nil {\n\t\treturn credentials.Set{}, fmt.Errorf(\"adding next password credential: %w\", err)\n\t}\n\n\ttime.Sleep(c.DelayIntervalBetweenModifications())\n\n\tkeyCredentialSet, err := c.KeyCredential().Add(tx)\n\tif err != nil {\n\t\treturn credentials.Set{}, fmt.Errorf(\"adding key credential set: %w\", err)\n\t}\n\n\treturn credentials.Set{\n\t\tCurrent: credentials.Credentials{\n\t\t\tCertificate: credentials.Certificate{\n\t\t\t\tKeyId: string(*keyCredentialSet.Current.KeyCredential.KeyID),\n\t\t\t\tJwk: keyCredentialSet.Current.Jwk,\n\t\t\t},\n\t\t\tPassword: credentials.Password{\n\t\t\t\tKeyId: string(*currPasswordCredential.KeyID),\n\t\t\t\tClientSecret: *currPasswordCredential.SecretText,\n\t\t\t},\n\t\t},\n\t\tNext: credentials.Credentials{\n\t\t\tCertificate: credentials.Certificate{\n\t\t\t\tKeyId: string(*keyCredentialSet.Next.KeyCredential.KeyID),\n\t\t\t\tJwk: keyCredentialSet.Next.Jwk,\n\t\t\t},\n\t\t\tPassword: credentials.Password{\n\t\t\t\tKeyId: string(*nextPasswordCredential.KeyID),\n\t\t\t\tClientSecret: *nextPasswordCredential.SecretText,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "39523979f0b6698f5f840d0f5c5e5926", "score": "0.5584541", "text": "func (c *jsiiProxy_CfnSourceCredential) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "74406963ddf4fa4447d484334f75c55f", "score": "0.55595565", "text": "func (h Osxkeychain) Add(creds *credentials.Credentials) error {\n\t_ = h.Delete(creds.ServerURL) // ignore errors as existing credential may not exist.\n\n\ts, err := splitServer(creds.ServerURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer freeServer(s)\n\n\tlabel := C.CString(credentials.CredsLabel)\n\tdefer C.free(unsafe.Pointer(label))\n\tusername := C.CString(creds.Username)\n\tdefer C.free(unsafe.Pointer(username))\n\tsecret := C.CString(creds.Secret)\n\tdefer C.free(unsafe.Pointer(secret))\n\n\terrMsg := C.keychain_add(s, label, username, secret)\n\tif errMsg != nil {\n\t\tdefer C.free(unsafe.Pointer(errMsg))\n\t\treturn errors.New(C.GoString(errMsg))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1e1713f6103066653f01280c9fa4a196", "score": "0.5512691", "text": "func NewCredentialsAdder(cred CredentialAdding) *CredentialAdding {\n\treturn &CredentialAdding{\n\t\tCloudName: cred.CloudName,\n\t\tCredName: cred.CredName,\n\t\tUsername: cred.Username,\n\t\tPassword: cred.Password,\n\t}\n}", "title": "" }, { "docid": "6b3603036d674e3a88d3ca3d0db0a290", "score": "0.5506977", "text": "func (bruter *SSH) Add(c model.Credential) {\n\tif bruter.active.Get() {\n\t\tbruter.queue <- c\n\t}\n\treturn\n}", "title": "" }, { "docid": "fdf094bd05322ffffe7edd08f29dd20d", "score": "0.5497298", "text": "func (m *ItemAddKeyPostRequestBody) SetKeyCredential(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.KeyCredentialable)() {\n err := m.GetBackingStore().Set(\"keyCredential\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "af7dcc570ce4b81ee43623744d3e202c", "score": "0.5475224", "text": "func (a *UserManagementApiService) CreateUserCredentialExecute(r ApiCreateUserCredentialRequest) (*User, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *User\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"UserManagementApiService.CreateUserCredential\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/accounts/{accountname}/users/{username}/credentials\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"accountname\"+\"}\", url.PathEscape(parameterToString(r.accountname, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", url.PathEscape(parameterToString(r.username, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.credential == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"credential is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.credential\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiErrorResponse\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": "38fde512d1a9f63b22e319e77c4c0161", "score": "0.5470202", "text": "func PutCredentials(w http.ResponseWriter, r *http.Request, credential interface{}, accessToken string) {\n\tapiQuery := \"/api/v1/data\"\n\tvar netClient = &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\tjsonStr, _ := json.Marshal(credential)\n\treq, _ := http.NewRequest(\"PUT\", credhubServer+apiQuery, bytes.NewBuffer(jsonStr))\n\treq.Header.Add(\"authorization\", \"bearer \"+accessToken)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, reqErr := netClient.Do(req)\n\tif reqErr != nil {\n\t\tfmt.Println(reqErr)\n\t\thttp.Error(w, \"Error\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tflashMessage := []byte(body)\n\tCheckError(w, r, flashMessage, \"Successfully set credential\", \"success\")\n}", "title": "" }, { "docid": "e5f5155e9b139b502314dada12ea771a", "score": "0.54632187", "text": "func (x *User) AddDeviceCredentialID(deviceCredentialID string) {\n\tx.DeviceCredentialIds = slices.Unique(append(x.DeviceCredentialIds, deviceCredentialID))\n}", "title": "" }, { "docid": "eb847c4cb46f46675a307e695e0a1f97", "score": "0.5433658", "text": "func AddCredentials(req *http.Request) (added bool) {\n\thost := req.URL.Hostname()\n\n\t// TODO(golang.org/issue/26232): Support arbitrary user-provided credentials.\n\tnetrcOnce.Do(readNetrc)\n\tfor _, l := range netrc {\n\t\tif l.machine == host {\n\t\t\treq.SetBasicAuth(l.login, l.password)\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b95191dcd7e96bdb9e1dff226ff2171", "score": "0.54299474", "text": "func Credential(username, password string) auth.Credential {\n\tif username == \"\" {\n\t\treturn auth.Credential{\n\t\t\tRefreshToken: password,\n\t\t}\n\t}\n\treturn auth.Credential{\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n}", "title": "" }, { "docid": "e9502e731e00e37c958a001432e2210a", "score": "0.54245627", "text": "func (u *Credential) Save(db *sqlx.DB) error {\n\tu.Username = strings.ToLower(u.Username)\n\tif u.Id == \"\" {\n\t\trows, err := db.NamedQuery(\"INSERT INTO credentials (username, password_hash, password_reset_token, user_id) VALUES (:username, :password_hash, :password_reset_token, :user_id) RETURNING id\", u)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rows.Close()\n\t\tif rows.Next() {\n\t\t\trows.Scan(&u.Id)\n\t\t}\n\t}\n\t_, err := db.NamedExec(\"UPDATE credentials SET username=:username, password_hash=:password_hash, password_reset_token=:password_reset_token, user_id=:user_id WHERE id=:id\", u)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d38c91c65a7736f206923b751535347", "score": "0.54105663", "text": "func (es *ExtensionStore) AddExtensionServiceCredentials(ctx context.Context, extensionID string, serviceID string, credentials *domain.ExtensionServiceCredentials) (*domain.ExtensionServiceCredentials, error) {\n\textension, err := es.GetExtension(ctx, extensionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsvc, err := extension.GetService(serviceID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcredentials, err = svc.AddCredentials(credentials)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = es.UpdateExtension(ctx, extension)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn credentials, nil\n}", "title": "" }, { "docid": "54e3e7300752106c87d0dd6e10560fa5", "score": "0.53844726", "text": "func AddUser(userPoolID string, clientID string, email string, password string, svc cognitoidentityprovider.CognitoIdentityProvider) *cognitoidentityprovider.AdminRespondToAuthChallengeOutput {\n\ttempPass := pass.MustGenerate(64, 10, 10, false, false)\n\tusername, _ := uuid.NewV4()\n\n\t_, err := svc.AdminCreateUser(&cognitoidentityprovider.AdminCreateUserInput{\n\t\tUserPoolId: aws.String(userPoolID),\n\t\tTemporaryPassword: aws.String(tempPass),\n\t\tUsername: aws.String(username.String()),\n\t\tUserAttributes: []*cognitoidentityprovider.AttributeType{\n\t\t\t&cognitoidentityprovider.AttributeType{\n\t\t\t\tName: aws.String(\"email\"),\n\t\t\t\tValue: aws.String(email),\n\t\t\t},\n\t\t\t&cognitoidentityprovider.AttributeType{\n\t\t\t\tName: aws.String(\"email_verified\"),\n\t\t\t\tValue: aws.String(\"true\"),\n\t\t\t},\n\t\t},\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(\"failed to create the user: \", err.Error())\n\t}\n\n\treq, resp := svc.AdminInitiateAuthRequest(&cognitoidentityprovider.AdminInitiateAuthInput{\n\t\tAuthFlow: aws.String(\"ADMIN_NO_SRP_AUTH\"),\n\t\tUserPoolId: aws.String(userPoolID),\n\t\tClientId: aws.String(clientID),\n\t\tAuthParameters: map[string]*string{\n\t\t\t\"USERNAME\": aws.String(username.String()),\n\t\t\t\"PASSWORD\": aws.String(tempPass),\n\t\t},\n\t})\n\n\terr = req.Send()\n\tif err != nil {\n\t\tlog.Fatal(\"failed to sign in as the newly created user: \", err)\n\t}\n\n\tif *resp.ChallengeName == \"NEW_PASSWORD_REQUIRED\" {\n\t\tsession := resp.Session\n\t\tresp, err := svc.AdminRespondToAuthChallenge(&cognitoidentityprovider.AdminRespondToAuthChallengeInput{\n\t\t\tChallengeName: aws.String(\"NEW_PASSWORD_REQUIRED\"),\n\t\t\tUserPoolId: aws.String(userPoolID),\n\t\t\tClientId: aws.String(clientID),\n\t\t\tChallengeResponses: map[string]*string{\n\t\t\t\t\"USERNAME\": aws.String(username.String()),\n\t\t\t\t\"NEW_PASSWORD\": aws.String(password),\n\t\t\t},\n\t\t\tSession: session,\n\t\t})\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"failed to assign the newly created user's password: \", err)\n\t\t}\n\n\t\treturn resp\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cfc6a143208b605f9a7294069f625388", "score": "0.5382239", "text": "func generateCredential() (hce.Credential, error){\n\tsecurityApi := hce.NewSecurityApi()\n\tcredential := hce.Credential{nil, \"USERNAME_PASSWORD\", \"myusername\", \"mypassword\", \"Neil's DockerHub username/password\", nil}\n\tcredential, err := securityApi.StoreCredential(credential)\n\tlog.Println(credential)\n\treturn credential, err\n}", "title": "" }, { "docid": "54388eb379252440419254d95f43e9a4", "score": "0.5343891", "text": "func AddUser(lc *LDAPClient, username string, uid string, pwd string) (err error) {\n\terr = lc.Connect()\n\tdefer lc.Close()\n\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t\treturn\n\t}\n\terr = lc.AddUser(username, uid, pwd)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "e05c6efca4152b3033be60bd64f438c7", "score": "0.533426", "text": "func (s *StoreImplementation) SaveCredential(name string, vc *verifiable.Credential) error {\n\tif name == \"\" {\n\t\treturn errors.New(\"credential name is mandatory\")\n\t}\n\n\tid, err := s.GetCredentialIDByName(name)\n\tif err != nil && !errors.Is(err, storage.ErrDataNotFound) {\n\t\treturn fmt.Errorf(\"get credential id using name : %w\", err)\n\t}\n\n\tif id != \"\" {\n\t\treturn errors.New(\"credential name already exists\")\n\t}\n\n\tvcBytes, err := vc.MarshalJSON()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal vc: %w\", err)\n\t}\n\n\tid = vc.ID\n\tif id == \"\" {\n\t\t// ID in VCs are not mandatory, use uuid to save in DB if id missing\n\t\tid = uuid.New().String()\n\t}\n\n\tif e := s.store.Put(id, vcBytes); e != nil {\n\t\treturn fmt.Errorf(\"failed to put vc: %w\", e)\n\t}\n\n\trecordBytes, err := getRecord(id, getVCSubjectID(vc), vc.Context, vc.Types)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to prepare record: %w\", err)\n\t}\n\n\tif err := s.store.Put(credentialNameDataKey(name), recordBytes); err != nil {\n\t\treturn fmt.Errorf(\"store vc name to id map : %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "570500295622b65bff94b3b0d61e0ac6", "score": "0.5300233", "text": "func (z *Client) SetCredential(cred Credential) {\n\tz.credential = cred\n}", "title": "" }, { "docid": "f886f68f5213118935b27d157e4fb21a", "score": "0.5280826", "text": "func (h *hserv) userAdd(w http.ResponseWriter, r *http.Request) {\n\tif err := validateAdminPerms(w, r); err != nil {\n\t\treturn\n\t}\n\tinfo := &authn.User{}\n\tif err := cmn.ReadJSON(w, r, info); err != nil {\n\t\treturn\n\t}\n\tif err := h.mgr.addUser(info); err != nil {\n\t\tcmn.WriteErrMsg(w, r, fmt.Sprintf(\"Failed to add user: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif Conf.Verbose() {\n\t\tnlog.Infof(\"Add user %q\", info.ID)\n\t}\n}", "title": "" }, { "docid": "3152cd3b2eebc185a1e9859627699e89", "score": "0.52787066", "text": "func (m *userManager) addUser(userID, userPass string) error {\n\tif userID == \"\" || userPass == \"\" {\n\t\treturn fmt.Errorf(\"invalid credentials\")\n\t}\n\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\n\tif _, ok := m.Users[userID]; ok {\n\t\treturn fmt.Errorf(\"user %q already registered\", userID)\n\t}\n\tm.Users[userID] = &userInfo{\n\t\tUserID: userID,\n\t\tpasswordDecoded: userPass,\n\t\tPassword: base64.StdEncoding.EncodeToString([]byte(userPass)),\n\t}\n\n\treturn m.saveUsers()\n}", "title": "" }, { "docid": "348d102a4ccb92c62b0910dee40247d4", "score": "0.5276952", "text": "func AddUser(user string, clearance string) error {\r\n\tif user == \"\" {\r\n\t\treturn errors.New(\"username cannot be blank\")\r\n\t}\r\n\r\n\tpass := getInput(\"Enter new user's password: \")\r\n\tif pass == \"\" {\r\n\t\treturn errors.New(\"password cannot be blank\")\r\n\t}\r\n\r\n\trUser := strings.ReplaceAll(user, \"\\n\", \"\")\r\n\trPass := strings.ReplaceAll(pass, \"\\n\", \"\")\r\n\r\n\thsh, err := HashPassword(rPass)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tusr := config.User{\r\n\t\tPassHash: hsh,\r\n\t\tClearance: clearance,\r\n\t}\r\n\r\n\tif _, ok := config.Global().Access[rUser]; ok {\r\n\t\treturn errors.New(\"user already exists\")\r\n\t}\r\n\r\n\tconfig.Global().Access[rUser] = usr\r\n\tconfig.WriteToDisk()\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "61aed04dcc2a005299e84c5ecbcae083", "score": "0.5249614", "text": "func (c *Client) UserAdd(uid string, giveName string, sn string, cn string, pwd string) (*UserRecord, error) {\n\toptions := map[string]interface{}{\n\t\t\"givenname\": giveName,\n\t\t\"sn\": sn,\n\t\t\"cn\": cn,\n\t\t\"userpassword\": pwd,\n\t}\n\n\tres, err := c.rpc(\"user_add\", []string{uid}, options)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar userRec UserRecord\n\terr = json.Unmarshal(res.Result.Data, &userRec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &userRec, nil\n}", "title": "" }, { "docid": "0fd390c3f4a433c12e41a1a4d39cfd17", "score": "0.52415925", "text": "func AddUser(args ...string) error {\n\tusername := args[0]\n\tpassword := args[1]\n\n\treturn user.Add(username, password)\n}", "title": "" }, { "docid": "3edb0a05118ab5dee10e06c169f0c6c9", "score": "0.52269846", "text": "func (p *proteusAPI) AddUser(username string, password string, properties string) (int64, error) {\n\tα := struct {\n\t\tM OperationAddUser `xml:\"tns:addUser\"`\n\t}{\n\t\tOperationAddUser{\n\t\t\t&username,\n\t\t\t&password,\n\t\t\t&properties,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationAddUserResponse `xml:\"addUserResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"AddUser\", α, &γ); err != nil {\n\t\treturn 0, err\n\t}\n\treturn *γ.M.Return, nil\n}", "title": "" }, { "docid": "bf5321950a14d76faaf98eefb013f6ac", "score": "0.5225062", "text": "func (a *Account) add(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"starting account.add\")\n\n\tif len(args) == 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 1\")\n\t}\n\n\terr := sanitizeArguments(args)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tvar owner Owner\n\towner.ObjectType = OwnerObejctType\n\towner.Id = getOwnerId(stub, 0)\n\towner.Username = args[0]\n\n\townerAsByte, _ := json.Marshal(owner)\n\terr = stub.PutState(owner.Id, ownerAsByte)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "28acbd4de13cf5e7a5d832683cc1948f", "score": "0.52178866", "text": "func (u user) add(c *gin.Context) {\n\tctx := getContext(c)\n\n\tbody, err := ioutil.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tvar userData map[string]string\n\tjson.Unmarshal(body, &userData)\n\n\treq := &engine.AddUserRequest{\n\t\tUserName: userData[\"username\"],\n\t\tPassword: userData[\"password\"],\n\t\tFirstName: userData[\"firstname\"],\n\t\tLastName: userData[\"lastname\"],\n\t\tGender: userData[\"gender\"],\n\t}\n\trepo := u.Add(ctx, req)\n\tfmt.Println(repo)\n\t// TODO: token stuff\n\n\tres, err := u.GenerateToken()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tc.JSON(http.StatusOK, res[\"token\"])\n\tc.Header(\"Content-Type\", \"application/json\")\n}", "title": "" }, { "docid": "4c377de5c04b72094566190927eafa21", "score": "0.5214686", "text": "func (h *ServiceClient) AddUser(inboundTag string, email string, level uint32, uuid string, alterID uint32) {\n\tresp, err := h.proxyClient.AlterInbound(context.Background(), &proxymancmd.AlterInboundRequest{\n\t\tTag: inboundTag,\n\t\tOperation: serial.ToTypedMessage(&proxymancmd.AddUserOperation{\n\t\t\tUser: &protocol.User{\n\t\t\t\tLevel: level,\n\t\t\t\tEmail: email,\n\t\t\t\tAccount: serial.ToTypedMessage(&vmess.Account{\n\t\t\t\t\tId: uuid,\n\t\t\t\t\tAlterId: alterID,\n\t\t\t\t\tSecuritySettings: &protocol.SecurityConfig{Type: protocol.SecurityType_AUTO},\n\t\t\t\t}),\n\t\t\t},\n\t\t}),\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t} else {\n\t\tlog.Printf(\"%v\", resp)\n\t}\n}", "title": "" }, { "docid": "ad086f717bd609498f7c28ed67b5bca1", "score": "0.5210945", "text": "func AddUser(dto *action_dtos.AddUserDto, service *pgCommon.PostgresServiceInformations) error {\n\t_, err := service.PgoApi.CreateUser(&msgs.CreateUserRequest{\n\t\tPassword:dto.Password,\n\t\tUsername: dto.Username,\n\t\tNamespace: service.ClusterInstance.Namespace,\n\t\tClusters: []string{service.ClusterInstance.Name},\n\t\tPasswordType: \"md5\",\n\t})\n\n\tif err != nil {\n\t\tlogger.RError(err, \"Unable to progress add user action for user \" + dto.Username)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "4dfaca6d58316a3832b4d18fb5e0467b", "score": "0.5206931", "text": "func (s *Store) ForceUpdateCredential(username, newPassword string) error {\n\tlog.Warnf(\"Forcing update of your \\\"%s\\\" credential.\", username)\n\n\tnewHashedPass, err := bcrypt.GenerateFromPassword([]byte(newPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tc := new(credentials)\n\tif err := s.db.One(\"Username\", username, c); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tc.Password = string(newHashedPass)\n\n\tif err = s.db.Update(c); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f5ff528a02303baf0317ba50221599a", "score": "0.5199655", "text": "func (m *WindowsWifiEnterpriseEAPConfiguration) SetPromptForAdditionalAuthenticationCredentials(value *bool)() {\n err := m.GetBackingStore().Set(\"promptForAdditionalAuthenticationCredentials\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f46a16b7b41babc876c6aff232346aa7", "score": "0.519114", "text": "func createCredential(\n\tfqdn string,\n\tsslRequired bool,\n\tserverName string,\n\tdatabaseName string,\n\tbindingDetails bindingDetails,\n\tsecureBidningDetails secureBindingDetails,\n) credentials {\n\tusername := fmt.Sprintf(\"%s@%s\", bindingDetails.LoginName, serverName)\n\tconnectionTemplate := \"mysql://%s:%s@%s:3306/%s?useSSL=true&requireSSL=true\"\n\tconnectionString := fmt.Sprintf(\n\t\tconnectionTemplate,\n\t\turl.QueryEscape(username),\n\t\tsecureBidningDetails.Password,\n\t\tfqdn,\n\t\tdatabaseName,\n\t)\n\treturn credentials{\n\t\tHost: fqdn,\n\t\tPort: 3306,\n\t\tDatabase: databaseName,\n\t\tUsername: username,\n\t\tPassword: secureBidningDetails.Password,\n\t\tSSLRequired: sslRequired,\n\t\tURI: connectionString,\n\t\tTags: []string{\"mysql\"},\n\t}\n}", "title": "" }, { "docid": "004493297ed5d09c82215e967ca84e48", "score": "0.51889926", "text": "func (sp *ScyllaRoleProvider) Add(role *entities.RoleData) derrors.Error {\n\t\n\tsp.Lock()\n\tdefer sp.Unlock()\n\t\n\tif err := sp.checkConnectionAndConnect(); err != nil {\n\t\treturn err\n\t}\n\t\n\texists, err := sp.unsafeExist(role.OrganizationID, role.RoleID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif *exists {\n\t\treturn derrors.NewAlreadyExistsError(\"role\").WithParams(role.OrganizationID, role.RoleID)\n\t}\n\t\n\t// add new basic credential\n\tstmt, names := qb.Insert(table).Columns(\"organization_id\", \"role_id\", \"name\", \"internal\", \"primitives\").ToCql()\n\tq := gocqlx.Query(sp.Session.Query(stmt), names).BindStruct(role)\n\tcqlErr := q.ExecRelease()\n\t\n\tif cqlErr != nil {\n\t\treturn derrors.AsError(cqlErr, \"cannot add new role\")\n\t}\n\t\n\treturn nil\n}", "title": "" }, { "docid": "c889ecc64dc9f2b67c8e28c0f4770a1d", "score": "0.51824576", "text": "func (manager *UsersManager) AddUser(email string, countryCode int, phoneNumber string, publicKey string) error {\n\tapi, err := LoadAuthyAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuser, err := api.RegisterUser(email, countryCode, phoneNumber, url.Values{})\n\tif err != nil {\n\t\tfor field, msg := range user.Errors {\n\t\t\tfmt.Printf(\"%s=%s\\n\", field, msg)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn manager.AddUserID(user.ID, publicKey)\n}", "title": "" }, { "docid": "47a005989e86509003a75a55c69cd703", "score": "0.5180233", "text": "func (lc *LDAPClient) AddUser(username string, uidStr string, passwd string) (err error) {\n\tif lc.Exist(\"(&(uid=\" + username + \"))\") {\n\t\treturn errors.New(\"record has existed in ldap\")\n\t}\n\n\tdomainID, err := lc.SambadomainSid()\n\tif err != nil {\n\t\treturn\n\t}\n\tcurtime := fmt.Sprintf(\"%d\", time.Now().Unix())\n\tuid, err := strconv.Atoi(uidStr)\n\tif err != nil {\n\t\treturn\n\t}\n\tsambaSid := fmt.Sprintf(\"%s-%d\", domainID, uid*2+1000)\n\tuserDn := fmt.Sprintf(\"uid=%s,ou=People,%s\", username, lc.BaseDn)\n\tuserAttr := make(map[string][]string)\n\tuserAttr[\"uid\"] = []string{username}\n\tuserAttr[\"shadowMin\"] = []string{\"0\"}\n\tuserAttr[\"homeDirectory\"] = []string{\"/home/\" + username}\n\n\tuserAttr[\"objectClass\"] = []string{\"top\", \"person\", \"organizationalPerson\",\n\t\t\"inetOrgPerson\", \"sambaSamAccount\", \"posixAccount\", \"shadowAccount\"}\n\tuserAttr[\"cn\"] = []string{username}\n\tuserAttr[\"givenName\"] = []string{username}\n\tuserAttr[\"sn\"] = []string{username}\n\tuserAttr[\"uid\"] = []string{username}\n\tuserAttr[\"uidNumber\"] = []string{uidStr}\n\tuserAttr[\"gidNumber\"] = []string{\"0\"}\n\tuserAttr[\"displayName\"] = []string{username}\n\tuserAttr[\"homeDirectory\"] = []string{\"/home/\" + username}\n\tuserAttr[\"loginShell\"] = []string{\"/bin/bash\"}\n\tuserAttr[\"sambaSID\"] = []string{sambaSid}\n\tuserAttr[\"sambaAcctFlags\"] = []string{\"[U ]\"}\n\tuserAttr[\"userPassword\"] = []string{passwd}\n\t// gen ntp pwd\n\tntppwd, err := createSambaNtpPwd(passwd)\n\tif err != nil {\n\t\treturn\n\t}\n\tuserAttr[\"sambaNTPassword\"] = []string{ntppwd}\n\tuserAttr[\"sambaPwdLastSet\"] = []string{curtime}\n\n\taddrequest := ldap.NewAddRequest(userDn)\n\tfor k, v := range userAttr {\n\t\taddrequest.Attribute(k, v)\n\t}\n\tif err = lc.Conn.Add(addrequest); err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t\treturn\n\t}\n\tpasswordModifyRequest := ldap.NewPasswordModifyRequest(userDn, \"\", passwd)\n\t_, err = lc.Conn.PasswordModify(passwordModifyRequest)\n\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: \", err.Error())\n\t}\n\treturn\n}", "title": "" }, { "docid": "7d1cadf994fc7d05ab7ebeb047d876c2", "score": "0.51769775", "text": "func NewCredentialUserRegistrationDetails()(*CredentialUserRegistrationDetails) {\n m := &CredentialUserRegistrationDetails{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "0913f9255fdc98d388ff87d9e5fac484", "score": "0.5171396", "text": "func (sam *SqlAccountManager) CreateAccountInGoogle(instanceID string, bindingID string, details models.BindDetails, instance models.ServiceInstanceDetails) (models.ServiceBindingCredentials, error) {\n\tvar err error\n\tusername, usernameOk := details.Parameters[\"username\"].(string)\n\tpassword, passwordOk := details.Parameters[\"password\"].(string)\n\n\tif !passwordOk || !usernameOk {\n\t\treturn models.ServiceBindingCredentials{}, errors.New(\"Error binding, missing parameters. Required parameters are username and password\")\n\t}\n\n\t// create username, pw with grants\n\tsqlService, err := googlecloudsql.New(sam.GCPClient)\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error creating CloudSQL client: %s\", err)\n\t}\n\n\top, err := sqlService.Users.Insert(sam.ProjectId, instance.Name, &googlecloudsql.User{\n\t\tName: username,\n\t\tPassword: password,\n\t}).Do()\n\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error inserting new database user: %s\", err)\n\t}\n\n\t// poll for the user creation operation to be completed\n\terr = sam.pollOperationUntilDone(op, sam.ProjectId)\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error encountered while polling until operation id %s completes: %s\", op.Name, err)\n\t}\n\n\t// create ssl certs\n\tcertname := bindingID[:10] + \"cert\"\n\tnewCert, err := sqlService.SslCerts.Insert(sam.ProjectId, instance.Name, &googlecloudsql.SslCertsInsertRequest{\n\t\tCommonName: certname,\n\t}).Do()\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error creating ssl certs: %s\", err)\n\t}\n\tcertInsertOperation := newCert.Operation\n\terr = sam.pollOperationUntilDone(certInsertOperation, sam.ProjectId)\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error encountered while polling until operation id %s completes: %s\", op.Name, err)\n\t}\n\n\tcreds := SqlAccountInfo{\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tSha1Fingerprint: newCert.ClientCert.CertInfo.Sha1Fingerprint,\n\t\tCaCert: newCert.ServerCaCert.Cert,\n\t\tClientCert: newCert.ClientCert.CertInfo.Cert,\n\t\tClientKey: newCert.ClientCert.CertPrivateKey,\n\t}\n\n\tcredBytes, err := json.Marshal(&creds)\n\tif err != nil {\n\t\treturn models.ServiceBindingCredentials{}, fmt.Errorf(\"Error marshalling credentials: %s\", err)\n\t}\n\n\tnewBinding := models.ServiceBindingCredentials{\n\t\tOtherDetails: string(credBytes),\n\t}\n\n\treturn newBinding, nil\n}", "title": "" }, { "docid": "c95d6e4fc8c0ebc99d761fb2ce804ac5", "score": "0.5167809", "text": "func (h *Hub) AddUser(toAdd, requester, role string) error {\n\tlog.Printf(\"Adding user %s as %s to hub %s requested by %s\", toAdd, role, h.name, requester)\n\tok, _ := h.auth.CanChangeUsers(requester)\n\tif !ok {\n\t\tlog.Print(\"User can't change other users\")\n\t\treturn errUnauthorized\n\t}\n\tuserIDs, err := h.db.UserIDsForEmails([]string{toAdd})\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar userID string\n\tif userID, ok = userIDs[toAdd]; !ok {\n\t\treturn errors.New(\"Email not found\")\n\t}\n\tlog.Printf(\"Got id from email: %s\", userID)\n\tauthEntry := &collections.AuthEntry{}\n\t// Currenly just using this for checking for the existence of docRef.\n\tdocRef, _ := h.db.EntryForFieldValue(h.users, hubcodes.UserIDKey, userID, authEntry)\n\tif docRef == nil {\n\t\t// Usually means the user's role hasn't been set for a hub, so we add them to it.\n\t\tvar err error\n\t\tdocRef, err = h.db.AddEntry(h.users, \"\", collections.AuthEntry{\n\t\t\tUserID: userID,\n\t\t\tRole: collabauth.NoRole,\n\t\t\tStatus: hubcodes.UserOffline,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tupdate := firestore.Update{\n\t\tPath: collabauth.Role,\n\t\tValue: role,\n\t}\n\t_, err = docRef.Update(context.Background(), []firestore.Update{update})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Also update their entry in the user to hubs collection\n\th.db.UpdateUsersHubList(userID, h.name, role)\n\n\treturn err\n}", "title": "" }, { "docid": "e8bc1c5677635f62408bbee6103dac94", "score": "0.5160051", "text": "func (_e *MockProxy_Expecter) CreateCredential(ctx interface{}, req interface{}) *MockProxy_CreateCredential_Call {\n\treturn &MockProxy_CreateCredential_Call{Call: _e.mock.On(\"CreateCredential\", ctx, req)}\n}", "title": "" }, { "docid": "39cc280cb644d1696cf436e3f14c0e91", "score": "0.51526207", "text": "func (api *Api) AddUser(w rest.ResponseWriter, r *rest.Request) {\n\n\t// Check credentials\n\n\tlogin := r.PathParam(\"login\")\n\tguid := r.PathParam(\"GUID\")\n\n\t// Only admin is allowed\n\n\tif login != \"admin\" {\n\t\trest.Error(w, \"Not allowed\", 400)\n\t\treturn\n\t}\n\n\tsession := Session{}\n\tvar errl error\n\tif session, errl = api.CheckLogin(login, guid); errl != nil {\n\t\trest.Error(w, errl.Error(), 401)\n\t\treturn\n\t}\n\n\tdefer api.TouchSession(guid)\n\n\t// Can't add if it exists already\n\n\tuserData := User{}\n\n\tif err := r.DecodeJsonPayload(&userData); err != nil {\n\t\trest.Error(w, \"Invalid data format received.\", 400)\n\t\treturn\n\t} else if len(userData.Login) == 0 {\n\t\trest.Error(w, \"Incorrect data format received.\", 400)\n\t\treturn\n\t}\n\tuser := User{}\n\tmutex.Lock()\n\tif !api.db.Find(&user, \"login = ?\", userData.Login).RecordNotFound() {\n\t\tmutex.Unlock()\n\t\trest.Error(w, \"Record exists.\", 400)\n\t\treturn\n\t}\n\tmutex.Unlock()\n\n\t// Add user\n\n\tif len(userData.Passhash) == 0 {\n\t\trest.Error(w, \"Empty password not allowed.\", 400)\n\t\treturn\n\t}\n\n\tc := &Crypt{}\n\tc.Pass = []byte(userData.Passhash)\n\tc.Crypt()\n\tuserData.Passhash = string(c.Hash)\n\n\tmutex.Lock()\n\tif err := api.db.Save(&userData).Error; err != nil {\n\t\tmutex.Unlock()\n\t\trest.Error(w, err.Error(), 400)\n\t\treturn\n\t}\n\tmutex.Unlock()\n\n\tapi.LogActivity(session.Id, \"Added new user '\"+userData.Login+\"'.\")\n\tw.WriteJson(userData)\n}", "title": "" }, { "docid": "c80484ed20178f4193f1b1d88a31e2ab", "score": "0.5139001", "text": "func (server *WorkerServer) AddAuthentication(tlsConfig *tls.Config) {\n\tlogrus.Info(\"Start server with TLS authentication\")\n\tserver.opts = append(server.opts, grpc.Creds(credentials.NewTLS(tlsConfig)))\n}", "title": "" }, { "docid": "cd63e6e06d979dbb450a213c3f307046", "score": "0.51313746", "text": "func setCredentials(cfg *clientv3.Config, username, password string) {\n\tcfg.Username = username\n\tcfg.Password = password\n}", "title": "" }, { "docid": "09f178a52af7ac942cb14ebbce1636c1", "score": "0.51092845", "text": "func ConnectWithCredential(addr string, cred model.Credential, timeout time.Duration) (ok bool, err error) {\n\tauthMethod, err := GetAuthMethod(cred)\n\tif err != nil {\n\t\treturn\n\t}\n\tconfig := &ssh.ClientConfig{\n\t\tUser: cred.User,\n\t\tHostKeyCallback: ssh.InsecureIgnoreHostKey(),\n\t\tAuth: []ssh.AuthMethod{authMethod},\n\t\tTimeout: timeout,\n\t\t// TODO(chris): does not work :/\n\t\tBannerCallback: ssh.BannerDisplayStderr(),\n\t}\n\treturn Connect(addr, config)\n}", "title": "" }, { "docid": "8b454469e65c7765275b3402b04dc36b", "score": "0.5108966", "text": "func (u *UserSvc) Add(ctx context.Context, user *app.User) error {\n\tuserID := uuid.New()\n\n\ttoken, err := u.auth.Create(userID.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create user object\n\tuser.ID = userID\n\tuser.Token = token\n\tn := time.Now().UTC()\n\tuser.CreatedAt = n\n\tuser.UpdatedAt = n\n\n\t// persist it\n\treturn u.storage.Create(ctx, user)\n}", "title": "" }, { "docid": "749f2ea6bd334bdeea565c8e24e1c63b", "score": "0.5103873", "text": "func storeCredentials(c context.Context, cred *oauth2Credentials) error {\n\t// TODO: implement\n\treturn nil\n}", "title": "" }, { "docid": "e63a3e9fafbbb03ce2f3bc9100d7bf06", "score": "0.5080439", "text": "func (g *Gomail) addAuth(auth smtp.Auth) {\n\tdefer g.Unlock()\n\n\tg.Lock()\n\tg.auth = auth\n}", "title": "" }, { "docid": "8a3f825d84bd697f6b10091b3ee0c333", "score": "0.5071535", "text": "func (v *Client) AddUser(c boundService.HandlerServiceClient, i string, u User) (*boundService.AlterInboundResponse, error) {\n\tresp, err := c.AlterInbound(context.Background(), &boundService.AlterInboundRequest{\n\t\tTag: i,\n\t\tOperation: serial.ToTypedMessage(&boundService.AddUserOperation{\n\t\t\tUser: &protocol.User{\n\t\t\t\tLevel: u.Level,\n\t\t\t\tEmail: u.Email,\n\t\t\t\tAccount: serial.ToTypedMessage(&vmess.Account{\n\t\t\t\t\tId: u.UUID,\n\t\t\t\t\tAlterId: u.AlterID,\n\t\t\t\t\tSecuritySettings: &protocol.SecurityConfig{Type: protocol.SecurityType_AUTO},\n\t\t\t\t}),\n\t\t\t},\n\t\t}),\n\t})\n\treturn resp, err\n}", "title": "" }, { "docid": "f3f3e9968b2ddc681d1bd907c5631879", "score": "0.5068062", "text": "func saveCredentials(Target string, UserName string, Password string) int {\n\tTargetName := C.CString(Target)\n\tUserC := C.CString(UserName)\n\tPassC := C.CString(Password)\n\tdefer C.free(unsafe.Pointer(TargetName))\n\tdefer C.free(unsafe.Pointer(PassC))\n\tdefer C.free(unsafe.Pointer(UserC))\n\n\tvar cred C.CREDENTIALA\n\tC.memset(unsafe.Pointer(&cred), 0, C.sizeof_CREDENTIALA)\n\tcred.Type = C.CRED_TYPE_GENERIC\n\tcred.TargetName = TargetName\n\tcred.CredentialBlobSize = C.ulong(C.strlen(PassC) + 1)\n\tcred.CredentialBlob = (C.LPBYTE)(unsafe.Pointer(PassC))\n\tcred.Persist = C.CRED_PERSIST_LOCAL_MACHINE\n\tcred.UserName = UserC\n\trc := C.CredWriteA(&cred, 0)\n\treturn int(rc)\n}", "title": "" }, { "docid": "db0f260e6b63d2de12996cec70ad2e34", "score": "0.5060029", "text": "func NewCredential(role string) *Credential {\n\treturn &Credential{\n\t\trole: role,\n\t}\n}", "title": "" }, { "docid": "9e121dd2970feb2563cc034a91d2cd99", "score": "0.5052756", "text": "func (i *Interceptor) addLsatCredentials(iCtx *interceptContext) error {\n\tif iCtx.token == nil {\n\t\treturn fmt.Errorf(\"cannot add nil token to context\")\n\t}\n\n\tmacaroon, err := iCtx.token.PaidMacaroon()\n\tif err != nil {\n\t\treturn err\n\t}\n\tiCtx.opts = append(iCtx.opts, grpc.PerRPCCredentials(\n\t\tmacaroons.NewMacaroonCredential(macaroon),\n\t))\n\treturn nil\n}", "title": "" }, { "docid": "ae2842095f35e4e8e71b01313475749c", "score": "0.5045094", "text": "func AddUser(usersID string, settings *models.Settings) {\n\tfmt.Println(\"WARNING: This command is deprecated. Please use \\\"catalyze invites send\\\" instead.\")\n\thelpers.SignIn(settings)\n\thelpers.AddUserToEnvironment(usersID, settings)\n\tfmt.Println(\"Added.\")\n}", "title": "" }, { "docid": "5499a3aaada63aaa9160e02ab557cef0", "score": "0.5044937", "text": "func (s *server) AddUser(ctx context.Context, in *pb.UserInfo) (*pb.AddUserMessage, error) {\n\tlog.Printf(\"request recieved: %v\", in)\n\n\treturn &pb.AddUserMessage{Message: fmt.Sprintf(\"The Users info is: Name: %s, Age: %v, Email: %s\", in.Name, in.Age, in.Email)}, nil\n}", "title": "" }, { "docid": "9ce8927a9d42df99ce0bd1879f27e4c7", "score": "0.50430924", "text": "func (o MongoDbLinkedServiceOutput) EncryptedCredential() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbLinkedService) interface{} { return v.EncryptedCredential }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "00afec66e0e778cd7aa367d45169bece", "score": "0.50418884", "text": "func (k *HMACAuthsCollection) Add(hmacAuth HMACAuth) error {\n\tcred := (entity)(&hmacAuth)\n\treturn k.credentialsCollection.Add(cred)\n}", "title": "" }, { "docid": "b6779d68c6d9e2f429c98439de9595c4", "score": "0.5040352", "text": "func (u *User) Add(input *AddInput) *Output {\n\tuserID := uuid.NewV4().String()\n\tpassword := crypt.HashPassword(input.Password)\n\n\tparams := &dynamodb.PutItemInput{\n\t\tTableName: aws.String(u.DBName),\n\t\tItem: map[string]*dynamodb.AttributeValue{\n\t\t\t\"userID\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(userID),\n\t\t\t},\n\t\t\t\"useremail\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(input.Useremail),\n\t\t\t},\n\t\t\t\"username\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(input.Username),\n\t\t\t},\n\t\t\t\"profilePicture\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(\"https://ssl.gstatic.com/accounts/ui/avatar_2x.png\"),\n\t\t\t},\n\t\t\t\"password\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(password),\n\t\t\t},\n\t\t\t\"createdAt\": &dynamodb.AttributeValue{\n\t\t\t\tS: aws.String(time.Now().String()),\n\t\t\t},\n\t\t},\n\t}\n\tresp, err := u.svc.PutItem(params)\n\tutil.LogErrOrResp(resp, err)\n\n\tif err != nil {\n\t\treturn &Output{false, \"Signup failed due to database error\", err.Error()}\n\t}\n\treturn &Output{true, \"Signup successfull\", \"\"}\n\n}", "title": "" }, { "docid": "41d409e94917af7dbb4d736f29cbcf4d", "score": "0.5036721", "text": "func (c *jsiiProxy_CfnGrant) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "title": "" }, { "docid": "d0edb9253afb350b25d1c23857b0b852", "score": "0.5035508", "text": "func (c *ServiceManagerClient) PutCredentials(ctx context.Context, credentials *types.BrokerPlatformCredential, force bool) (*types.BrokerPlatformCredential, error) {\n\tlog.C(ctx).Debugf(\"Putting credentials in Service Manager at %s\", c.url)\n\n\tbody, err := json.Marshal(credentials)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treqURL := c.getURL(web.BrokerPlatformCredentialsURL)\n\tif force {\n\t\tlog.C(ctx).Debugf(\"forcing credential rotation\")\n\t\treqURL += \"?force=true\"\n\t}\n\treq, err := http.NewRequest(http.MethodPut, reqURL, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tresponse, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error registering credentials in Service Manager\")\n\t}\n\n\tswitch response.StatusCode {\n\tcase http.StatusOK:\n\t\tlog.C(ctx).Debugf(\"Successfully putting credentials in Service Manager at: %s\", c.url)\n\tcase http.StatusConflict:\n\t\tlog.C(ctx).Debugf(\"Credentials could not be persisted. Existing credentials were found in Service Manager at: %s\", c.url)\n\t\treturn nil, ErrConflictingBrokerPlatformCredentials\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected response status code received (%v) upon credentials registration\", response.StatusCode)\n\t}\n\tvar brokerPlatformCred = types.BrokerPlatformCredential{}\n\tif err = util.BodyToObject(response.Body, &brokerPlatformCred); err != nil {\n\t\tlog.C(ctx).WithError(err).Error(\"error reading response body\")\n\t\treturn nil, err\n\t}\n\n\treturn &brokerPlatformCred, nil\n}", "title": "" }, { "docid": "d8fbccfa48f875bb69fbd463e3da8c0e", "score": "0.5019693", "text": "func addAuthItem(db *sql.DB, name, password string) error {\n\t_, err := db.Exec(`INSERT INTO auth (\n\t\tname,\n\t\tpassword\n\t) VALUES (\n\t\t?,\n\t\t?\n\t);`, name, password)\n\treturn err\n}", "title": "" }, { "docid": "776f04e80a3a6a898eb3e32bcb3a5ee0", "score": "0.50089765", "text": "func (db *LikesDB) AddUser(user general.Credentials) error {\n\t_, err := db.database.Exec(\"INSERT INTO users(id, username) VALUES (?,?)\", user.ID, user.Username)\n\tif err != nil {\n\t\treturn general.MySQLErrorToDBError(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7623cf49556098fa8fcfcc6ddeb0ba4", "score": "0.5002052", "text": "func (db Db) AddUser(login, email, hash string) (string, error) {\n\tctx := db.context()\n\tfilter := bson.M{\"login\": login}\n\toptsFind := options.FindOne()\n\tfound := db.users.FindOne(ctx, filter, optsFind)\n\tif found.Err() == mongo.ErrNoDocuments {\n\t\topts := options.InsertOne()\n\t\tdoc := bson.M{\"login\": login, \"hash\": hash}\n\t\tif email != \"\" {\n\t\t\tdoc[\"email\"] = email\n\t\t}\n\t\tres, err := db.users.InsertOne(ctx, doc, opts)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn res.InsertedID.(primitive.ObjectID).Hex(), nil\n\t} else if found.Err() != nil {\n\t\treturn \"\", found.Err()\n\t}\n\treturn \"\", errors.New(\"User with this login already exists\")\n}", "title": "" }, { "docid": "3644ae4662dab580d06a74f84ccca556", "score": "0.50007814", "text": "func (c PublicApp) AddUser() revel.Result {\n\tif user := c.connected(); user != nil {\n\t\tc.ViewArgs[\"user\"] = user\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a8f07ee3ff723e5188a24c86049c8e9b", "score": "0.49985808", "text": "func (api *API) SetCredential(credential string) *API {\n\tapi.credential = credential\n\treturn api\n}", "title": "" }, { "docid": "be82d2f8d079c05b78d46a094c105da1", "score": "0.49948636", "text": "func GetUserCredential(username string) (*views.Credentials,error){\n\tresult := db.QueryRow(\"SELECT password FROM users WHERE username= $1\", username)\n\t// We create another instance of `Credentials` to store the credentials we get from the database\n\thashedCreds := &views.Credentials{}\n\n\t// Store the obtained password in `storedCreds`\n\terr := result.Scan(&hashedCreds.Password)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil,err\n\t}\n\t\n\treturn hashedCreds,nil\n}", "title": "" }, { "docid": "a5b6a339b452457374602ad8f5f57eb6", "score": "0.49859524", "text": "func (c *Client) UserAddWithPassword(user *User, password string) (*User, error) {\n\tif user.Username == \"\" {\n\t\treturn nil, errors.New(\"Username is required\")\n\t}\n\tif password == \"\" {\n\t\treturn nil, errors.New(\"password is required\")\n\t}\n\n\trec, err := c.UserAdd(user, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.SetPassword(rec.Username, rec.RandomPassword, password, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rec, nil\n}", "title": "" }, { "docid": "5318c1664a1f470223d374fee5bc715d", "score": "0.49795145", "text": "func (o GreenplumLinkedServiceOutput) EncryptedCredential() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v GreenplumLinkedService) interface{} { return v.EncryptedCredential }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "846674bcdd2a0890b3c5b8bd354e9616", "score": "0.49742046", "text": "func (o CouchbaseLinkedServiceOutput) EncryptedCredential() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CouchbaseLinkedService) interface{} { return v.EncryptedCredential }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7210a65428884ab5d14d6b293be13ca3", "score": "0.4964555", "text": "func (_OperCont *OperContTransactor) AddAuthorizedUser(opts *bind.TransactOpts, usr common.Address, username string, role uint8) (*types.Transaction, error) {\n\treturn _OperCont.contract.Transact(opts, \"addAuthorizedUser\", usr, username, role)\n}", "title": "" }, { "docid": "40b61879bcb12bfd4fe4288cd078468f", "score": "0.49640945", "text": "func GenerateCredential(class string, data ...string) (cred interfaces.Credential, err error) {\n\tswitch class {\n\tcase \"PassWord\":\n\t\tif len(data) != 4 {\n\t\t\terr = errors.New(\"Generate Credential param lenth error\")\n\t\t\tlog.Println(\"info:\", err)\n\t\t\treturn cred, err\n\t\t}\n\t\tcred = &credential.InputPassWord{\n\t\t\tGrantType: data[0],\n\t\t\tUsername: data[1],\n\t\t\tPassword: data[2],\n\t\t\tScope: data[3],\n\t\t}\n\tcase \"AuthorizationCode\":\n\t}\n\treturn cred, nil\n}", "title": "" }, { "docid": "580f3e793977eac482b0f7fa68af8985", "score": "0.496287", "text": "func (r *UserRepository) AddUser(u *domain.UserUpsertRequest) {\n\tvar salt = generateRandomSalt(saltSize)\n\tvar hash = hashPassword(u.Password, salt)\n\n\tuser := map[string]string{\n\t\t\"username\": u.Username,\n\t\t\"email\": u.Email,\n\t\t\"salt\": salt,\n\t\t\"hash\": hash,\n\t}\n\n\t_, err := r.collection.InsertOne(nil, user)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t}\n}", "title": "" }, { "docid": "ee43873ed75c1d4db33a78c9f1d4f78f", "score": "0.49600098", "text": "func UpdateCred(aaguid []byte, counter uint32) {\n\tvar credential Credential\n\tdatabase.DBCon.Model(&credential).Where(\"aa_guid = ?\", aaguid).Update(\"sign_count\", counter)\n\n}", "title": "" }, { "docid": "88f8debfe486e9e29c00b78818c340e2", "score": "0.49576482", "text": "func (a *Server) userAdd(w http.ResponseWriter, r *http.Request) {\n\tif err := checkAuthorization(w, r); err != nil {\n\t\treturn\n\t}\n\tinfo := &User{}\n\tif err := cmn.ReadJSON(w, r, info); err != nil {\n\t\treturn\n\t}\n\tif err := a.users.addUser(info); err != nil {\n\t\tcmn.WriteErrMsg(w, r, fmt.Sprintf(\"Failed to add user: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif glog.V(4) {\n\t\tglog.Infof(\"Added a user %s\\n\", info.ID)\n\t}\n}", "title": "" }, { "docid": "1bca37cd689eaf917b84d2eb9b281df9", "score": "0.49560574", "text": "func (a *Client) AddUser(params *AddUserParams, authInfo runtime.ClientAuthInfoWriter) (*AddUserOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewAddUserParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"addUser\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/users\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &AddUserReader{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.(*AddUserOK)\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 addUser: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "fc9260464fc63e508e45271f02cb7a2c", "score": "0.49556231", "text": "func (o MySqlLinkedServiceOutput) EncryptedCredential() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MySqlLinkedService) interface{} { return v.EncryptedCredential }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "7e75c0554c8c0d10a92236c925b89d9f", "score": "0.4951185", "text": "func (a *UserApiService) UserForCredential(ctx _context.Context, credentialType string, credentialId string, localVarOptionals *UserForCredentialOpts) (User, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue User\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/users/credential/{credential_type}/{credential_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"credential_type\"+\"}\", _neturl.QueryEscape(parameterToString(credentialType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"credential_id\"+\"}\", _neturl.QueryEscape(parameterToString(credentialId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Fields.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields\", parameterToString(localVarOptionals.Fields.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\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v User\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\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": "49ab1f591ca8d7ed391ffd19576028fd", "score": "0.49509573", "text": "func (j *Jenkins) CreateSshCredential(id, username, passphrase, privateKey, description string) (*string, error) {\n\trequestStruct := NewCreateSshCredentialRequest(id, username, passphrase, privateKey, description)\n\tparam := map[string]string{\"json\": makeJson(requestStruct)}\n\tresponseString := \"\"\n\tresponse, err := j.Requester.Post(\"/credentials/store/system/domain/_/createCredentials\",\n\t\tnil, &responseString, param)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil, errors.New(strconv.Itoa(response.StatusCode))\n\t}\n\treturn &requestStruct.Credentials.Id, nil\n}", "title": "" }, { "docid": "a6990c85673738e9dcc08f510e384587", "score": "0.49508825", "text": "func (vfs *OrefaFS) UserAdd(name, groupName string) (avfs.UserReader, error) {\n\treturn nil, avfs.ErrPermDenied\n}", "title": "" }, { "docid": "db03432ebf9af110a9a16222fafecdbf", "score": "0.4945122", "text": "func (s *Storage) AddUser(\n\tctx context.Context,\n\temail users.Email,\n\tfullname string,\n\thashedPassword string,\n) (string, error) {\n\tsqlStatement := `INSERT INTO users.users (email, fullname, password_hash) VALUES ($1, $2, $3) RETURNING id`\n\trows, err := s.connPool.Query(ctx, sqlStatement, email, fullname, hashedPassword)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error inserting new user:%v\", err)\n\t}\n\tdefer rows.Close()\n\n\tvar userID int64\n\trows.Next()\n\terr = rows.Err()\n\tif err != nil {\n\t\tpgerr, ok := err.(*pgconn.PgError)\n\t\terr := fmt.Errorf(\"error scanning new user result:%v\", err)\n\t\tif !ok {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// From: https://www.postgresql.org/docs/11/errcodes-appendix.html\n\t\tconst uniqueViolationErrorCode = \"23505\"\n\t\tif pgerr.Code == uniqueViolationErrorCode {\n\t\t\treturn \"\", fmt.Errorf(\"%w:%s\", users.UserAlreadyExistsErr, email)\n\t\t}\n\t\treturn \"\", err\n\t}\n\terr = rows.Scan(&userID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strconv.FormatInt(userID, 10), nil\n}", "title": "" }, { "docid": "6a99a874a825193ba05db6aac1749262", "score": "0.493956", "text": "func add_user(db *sql.DB, username string, question string, answer string, password string) error {\n\n\texists := user_exists(db, username)\n\tif exists {\n\t\treturn errors.New(\"User already exists.\")\n\t}\n\n\tif verbose {\n\t\tlog.Printf(\"Creating new user: %s\\n\", username)\n\t}\n\n\tpassword = md5Sum(password)\n\n\tstatement := \"INSERT INTO accounts(username,security_question,security_answer,password) VALUES(?,?,?,?)\"\n\n\tstmt, err := db.Prepare(statement)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = stmt.Exec(username, question, answer, password)\n\tstmt.Close()\n\n\treturn err\n}", "title": "" }, { "docid": "c0595f233ab27edac2cd36488ad656d9", "score": "0.49376675", "text": "func (db *DBORM) AddUser(customer models.Customer) (models.Customer, error) {\n\thashPassword(&customer.Pass)\n\tcustomer.LoggedIn = true\n\terr := db.Create(&customer).Error\n\tcustomer.Pass = \"\"\n\treturn customer, err\n}", "title": "" }, { "docid": "e91ffbe4e50392e4fa28bf0a7c5aad39", "score": "0.4926059", "text": "func (o MariaDBLinkedServiceOutput) EncryptedCredential() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MariaDBLinkedService) interface{} { return v.EncryptedCredential }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "154baf1a8401ee9ccb4807ea684c65de", "score": "0.4919053", "text": "func AddAuthenticationToken(c context.Context, user commonLib.UserDB) (commonLib.UserDB, error){\n\t\tvar updatedUser commonLib.UserDB\n\tafter := options.After\n\topt := options.FindOneAndUpdateOptions{\n\t\tReturnDocument: &after,\n\t}\n\t\n\tresult := UserCollection.FindOneAndUpdate(c, bson.M{\"username\": user.Username}, bson.M{\"$set\": bson.M{\"AuthenticationToken\": user.AuthenticationToken}} ,&opt);\n\tif result.Err()!=nil{\n\t\treturn user, result.Err()\n\t}\n\tif err := result.Decode(&updatedUser); err != nil {\n\t\treturn user, fmt.Errorf(\"Cannot decode: %w\", err)\n\t}\t\n\treturn updatedUser, nil\n}", "title": "" }, { "docid": "9c0e477fe48eab8820044a6392935371", "score": "0.49176624", "text": "func (s *Server) CredentialHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tWriteError(w, r, ErrorCode, \"Method not allowed\")\n\t\treturn\n\t}\n\n\tif r.Header.Get(\"Sec-Key\") != serverKey {\n\t\tWriteError(w, r, ErrorCode, \"Method not allowed\")\n\t\treturn\n\t}\n\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tWriteError(w, r, ErrorCode, err.Error())\n\t\treturn\n\t}\n\n\t// convert form data to struct\n\tPostUser := User{\n\t\tUUID: r.Form.Get(\"UUID\"),\n\n\t\t// if asking for new Credentials\n\t\tCredentials: Credentials{\n\t\t\tValue: r.Form.Get(\"current_credentials\"),\n\t\t\tKey: r.Form.Get(\"current_key\"),\n\t\t},\n\t}\n\n\tif !IsValidUUID(PostUser.UUID) {\n\t\tWriteError(w, r, ErrorCode, \"Invalid form data\")\n\t\treturn\n\t}\n\n\tcreds, err := PostUser.Store(r, s.db)\n\tif err != nil {\n\t\tmysqlErr, ok := err.(*mysql.MySQLError)\n\t\tif ok && mysqlErr.Number != 1062 {\n\t\t\t// log to sentry as a very big issue TODO what is 🤦‍\n\t\t\tsentry.WithScope(func(scope *sentry.Scope) {\n\t\t\t\tscope.SetLevel(sentry.LevelFatal)\n\t\t\t\tsentry.CaptureException(err)\n\t\t\t})\n\t\t}\n\t\tWriteError(w, r, 401, err.Error())\n\t\treturn\n\t}\n\n\tc, err := json.Marshal(creds)\n\tFatal(err)\n\tif err == nil {\n\t\t_, err = w.Write(c)\n\t\tFatal(err)\n\t}\n}", "title": "" }, { "docid": "d88c2edc70e8018aaea697a9f878da92", "score": "0.49122623", "text": "func setOrgCredentials(args Arguments) (*setOrgCredentialsResult, error) {\n\t// build request body based on provider\n\trequestBody := &models.V4AddCredentialsRequest{Provider: &provider}\n\tif provider == \"aws\" {\n\t\trequestBody.Aws = &models.V4AddCredentialsRequestAws{\n\t\t\tRoles: &models.V4AddCredentialsRequestAwsRoles{\n\t\t\t\tAdmin: &args.awsAdminRole,\n\t\t\t\tAwsoperator: &args.awsOperatorRole,\n\t\t\t},\n\t\t}\n\t} else if provider == \"azure\" {\n\t\trequestBody.Azure = &models.V4AddCredentialsRequestAzure{\n\t\t\tCredential: &models.V4AddCredentialsRequestAzureCredential{\n\t\t\t\tSubscriptionID: &args.azureSubscriptionID,\n\t\t\t\tTenantID: &args.azureTenantID,\n\t\t\t\tClientID: &args.azureClientID,\n\t\t\t\tSecretKey: &args.azureSecretKey,\n\t\t\t},\n\t\t}\n\t}\n\n\tif args.verbose {\n\t\tfmt.Println(color.WhiteString(\"Sending API request to set credentials\"))\n\t}\n\n\tclientWrapper, err := client.NewWithConfig(args.apiEndpoint, args.userProvidedToken)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tauxParams := clientWrapper.DefaultAuxiliaryParams()\n\tauxParams.ActivityName = activityName\n\n\tresponse, err := clientWrapper.SetCredentials(args.organizationID, requestBody, auxParams)\n\tif err != nil {\n\t\tif clienterror.IsConflictError(err) {\n\t\t\treturn nil, microerror.Mask(errors.CredentialsAlreadySetError)\n\t\t}\n\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\t// Location header returned is in the format\n\t// /v4/organizations/myorg/credentials/{credential_id}/\n\tsegments := strings.Split(response.Location, \"/\")\n\tresult := &setOrgCredentialsResult{\n\t\tcredentialID: segments[len(segments)-2],\n\t}\n\n\treturn result, nil\n}", "title": "" } ]
310bab34c81a714f7c4e7c0717ddbc69
Home is the handler for the home page
[ { "docid": "e029e5b93d7b2f5f3861ba78c209da82", "score": "0.77677375", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"This is the home page\")\n}", "title": "" } ]
[ { "docid": "b42dce74f2cc6bafa24458cd17ef8445", "score": "0.8456133", "text": "func (st *sT) homeHandler(w http.ResponseWriter, r *http.Request) {\n\tst.render(w, r, home)\n}", "title": "" }, { "docid": "107321ba2d82188becb55c721063cbad", "score": "0.8250098", "text": "func HomeHandler(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tfmt.Fprintln(rw, \"home\")\n}", "title": "" }, { "docid": "7118bfbc8fd3910d11c2c574349d738f", "score": "0.8120655", "text": "func HandleHome(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"This is home page\")\n}", "title": "" }, { "docid": "d5bf5f187cb86b726253698bb6723e20", "score": "0.8071582", "text": "func HomeHandler(c buffalo.Context) error {\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "b473342ebe0f4645d47d5ba39cb8d7cc", "score": "0.80667263", "text": "func HandleHome(w http.ResponseWriter, r *http.Request) {\n\tviews.RenderHome(w, auth.GetCurrentUser(r))\n}", "title": "" }, { "docid": "4aede9eae5e7f4916f5a7d53d92298a7", "score": "0.8057726", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tHomeTemplate.Execute(w, nil)\n}", "title": "" }, { "docid": "ec616450a9146460b0431e7b3dcf6b07", "score": "0.80505514", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\thomeVars := struct {\n\t\tTitle string\n\t}{\n\t\tTitle: \"Home\",\n\t}\n\n\ttemplateLayout, err := templatesBox.FindString(\"layout.html\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ttemplateHome, err := templatesBox.FindString(\"home.html\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tt := template.New(\"\")\n\tt.Parse(templateLayout)\n\tt.Parse(templateHome)\n\terr = t.ExecuteTemplate(w, \"layout\", homeVars)\n}", "title": "" }, { "docid": "7a8c6ef5708969bd678fe366c6119efa", "score": "0.80312246", "text": "func HomeHandler(c buffalo.Context) error {\n\tslow(c)\n\tses := c.Session().Get(\"session\")\n\tif ses != nil {\n\t\tses = ses.(string)\n\t\tuname := c.Session().Get(\"current_user_id\").(string)\n\t\tc.Session().Set(\"username\", uname)\n\t}\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "1b36a4205751fd87a27feef480ca03ac", "score": "0.80285484", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Print(r.URL.Path)\n\tif r.URL.Path != \"/\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tw.Write([]byte(\"Ini HomePage\"))\n}", "title": "" }, { "docid": "1e9a13c6013cd0ec9313a0b91d0b6c0b", "score": "0.8022985", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\tp, _ := loadPage(\"index\")\n\tfmt.Fprintf(w, \"<div class = \\\"container text-center\\\"> </br></br><h1>%s</h1><p>%s</p></div>\", p.Title, p.Body)\n}", "title": "" }, { "docid": "3bca1e4288cd0ba3d9bd72ed34aa0b13", "score": "0.80174017", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\trenderTemplate(w, \"home.html\")\n}", "title": "" }, { "docid": "c764180bca37b32d24a6493af1627123", "score": "0.80139124", "text": "func handlerHome(w http.ResponseWriter, r *http.Request) {\n\n\tif r.URL.Path != \"/\" {\n\t\thttp.Error(w, \"Not found\", 404)\n\t\tlog.Printf(\"Not found: %s\", r.URL)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\tlog.Printf(\"Method not allowed: %s\", r.URL)\n\t\treturn\n\t}\n\t_, loggedIn, err := CheckLogin(w, r)\n\tif err != nil {\n\t\tlog.Println(\"error trying to retrieve session on login page:\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif loggedIn {\n\t\thttp.Redirect(w, r, \"/control\", http.StatusFound)\n\t} else {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t}\n\n\tt := NewTemplateHandler(\"index.html\")\n\tt.ServeHTTP(w, r)\n}", "title": "" }, { "docid": "5aabf8b376aff2b77cabcd9214ada1f6", "score": "0.8004253", "text": "func homeHandler(c echo.Context) error {\n\tDebugf(\"Publishing the home page\")\n\treturn c.Render(http.StatusUnauthorized, \"home.html\", \"\")\n}", "title": "" }, { "docid": "adcc2ecc65ceefaef02b397189f6fcea", "score": "0.800062", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\terr := renderPage(w, \"home.jet\", nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "cbe6b1ca118f25e1ee173338adee8874", "score": "0.79967546", "text": "func (a *App) HomeHandler(c buffalo.Context) error {\n\treturn c.Render(http.StatusOK, a.r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "ad5f88fd60503dc311a125af29e0492d", "score": "0.79854494", "text": "func HomeHandler(c buffalo.Context) error {\n\treturn c.Render(http.StatusOK, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "ce4457f7d8d5dd6984d98bb4e06b1504", "score": "0.7977471", "text": "func home(res http.ResponseWriter, req *http.Request) {\r\n\tif req.URL.Path != \"/\" {\r\n\t\thttp.NotFound(res, req)\r\n\t\treturn\r\n\t}\r\n\ttpl.ExecuteTemplate(res, \"home.html\", nil)\r\n}", "title": "" }, { "docid": "27388b5284aaa0c3f0065e67de5f8aa2", "score": "0.79522175", "text": "func HomeHandler(c buffalo.Context) error {\n\tuserID := c.Session().Get(\"user_id\")\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\tentries := &models.Entries{}\n\n\terr := tx.Where(\"user_id = ?\", userID).All(entries)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tc.Set(\"entries\", entries)\n\tc.Set(\"username\", c.Session().Get(\"full_name\"))\n\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "bb2e3be470c5f8e90b8f38a283e2ca85", "score": "0.79377025", "text": "func (app *App) Home(w http.ResponseWriter, r *http.Request) {\n\t// 404 if not truly root\n\tif r.URL.Path != \"/\" {\n\t\tapp.NotFound(w)\n\t\treturn\n\t}\n\n\t// Get the latest snippets\n\tsnippets, err := app.Database.LatestSnippets()\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\tapp.RenderHTML(w, r, \"home.page.html\", &HTMLData{\n\t\tSnippets: snippets,\n\t})\n}", "title": "" }, { "docid": "95296aca4119f5864d6ad055bf868869", "score": "0.79316574", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tw.Write([]byte(\"This is our home\"))\n}", "title": "" }, { "docid": "bf55f37afbe6141fbad436230475afdc", "score": "0.791072", "text": "func HomeHandler(c buffalo.Context) error {\n\tc.Set(\"email\", c.Session().Get(\"email\"))\n\tc.Set(\"scopes\", c.Session().Get(\"scopes\"))\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "070c8dd72933ffab7dbee360aa63afb9", "score": "0.7884705", "text": "func HomeHandler(res http.ResponseWriter, req *http.Request) {\n\n\tview.RenderTemplate(\"home.html\", pongo2.Context{}, res)\n}", "title": "" }, { "docid": "6ddb6215f29711702d760b833f638929", "score": "0.7858699", "text": "func HandleHome(context router.Context) error {\n\n\t// Build a query\n\tq := stories.Query().Limit(listLimit)\n\n\t// Select only above 0 points, Order by rank, then points, then name\n\tq.Where(\"points > 0\").Order(\"rank desc, points desc, id desc\")\n\n\t// Fetch the stories\n\tresults, err := stories.FindAll(q)\n\tif err != nil {\n\t\treturn router.InternalError(err)\n\t}\n\n\t// Render the template\n\tview := view.New(context)\n\tview.AddKey(\"stories\", results)\n\tview.AddKey(\"meta_title\", \"Golang News\")\n\tview.AddKey(\"meta_desc\", \"News for Go Hackers, in the style of Hacker News. A curated selection of the latest links about the Go programming language.\")\n\tview.AddKey(\"meta_keywords\", \"golang news, blog, links, go developers, go web apps, web applications, fragmenta\")\n\tview.AddKey(\"authenticity_token\", authorise.CreateAuthenticityToken(context))\n\n\tview.Template(\"stories/views/index.html.got\")\n\treturn view.Render()\n\n}", "title": "" }, { "docid": "836ad84c99f44934ee401802008e9644", "score": "0.7855817", "text": "func (app *App) homeHandler(w http.ResponseWriter, r *http.Request) {\n\terr := app.pickPath(w, r)\n\tif err != nil {\n\t\tcenterr.ErrorLog.Printf(\"bad path %s\", r.URL.Path)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tapp.render(w, r, home)\n}", "title": "" }, { "docid": "4d17d09d4b468f3fcbc236554a224d42", "score": "0.78361344", "text": "func (app *application) home(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\tapp.notFound(w)\n\t\treturn\n\t}\n\n\tapp.render(w, r, \"checks.page.tmpl\", &templateData{\n\t\tChecklist: app.checkList,\n\t\tConfiguration: app.config,\n\t})\n}", "title": "" }, { "docid": "3291c62d22335ee356c13bc3d0328df0", "score": "0.7829765", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\terr := renderPage(w, \"home.jet\", nil)\n\tif err != nil {\n\t\tlog.Error(\"ERROR - could not fetch template for rendering\", err)\n\t\thttp.Error(w, \"Could not render home page\", http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0b995a364916c8b49e3b06ff833757ee", "score": "0.78260833", "text": "func (h *Handlers) Home(w http.ResponseWriter, r *http.Request) {\n\thttp.Redirect(w, r, \"/leaderboard\", 302)\n}", "title": "" }, { "docid": "743fb4f8d46a66e17fb6a8c6a6950006", "score": "0.7825502", "text": "func Home(r render.Render, req *http.Request, tokens oauth2.Tokens, session sessions.Session, params martini.Params) {\n\tif \"http://\"+req.Host == config.AppUrl {\n\t\to := render.HTMLOptions{Layout: \"\"}\n\t\tr.HTML(200, \"home\", nil, o)\n\t} else {\n\t\tShowPublic(r, req)\n\t}\n}", "title": "" }, { "docid": "b739ccbdf269f6a51be77a41f7faab0c", "score": "0.7820069", "text": "func (h *handler) goHome(w http.ResponseWriter, r *http.Request) {\n\trespond(h.Logger, w, r, \"./tmpl/index.tmpl\", nil)\n}", "title": "" }, { "docid": "be682b0cb8a38f1ad1b98a115a2b9c36", "score": "0.78148484", "text": "func Home(w http.ResponseWriter, req *http.Request) {\n\tlog.Println(\">>>\", req.URL)\n\tlog.Println(\">>>\", theContext)\n\n\ttheContext.Title = titleWelcome[theContext.Lang]\n\trender(w, \"index\", theContext)\n}", "title": "" }, { "docid": "8b3f209f116d1f240f13913e0f847914", "score": "0.7814124", "text": "func HomeHandler(c buffalo.Context) error {\n\tst := c.Session().Get(\"session_test\")\n\tif st == nil {\n\t\treturn c.Render(501, r.String(\"Session test failed\"))\n\t}\n\tc.Set(\"session_test\", st.(uuid.UUID).String())\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "628b513ef21189b607f99b7f5e4cccc7", "score": "0.78132695", "text": "func (c *Core) HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"EEE 110\")\n\t//http.ServeFile(w, r, \"web_files/test.html\")\n\tc.Templates[\"index\"].Execute(w, \"\")\n\n}", "title": "" }, { "docid": "1123dc38e200169be8557bcca40d185e", "score": "0.78122777", "text": "func (ctx *HTTPHandlerContext) HomeHandler(w http.ResponseWriter, r *http.Request) {\n\n\tvar page int64 = 1\n\tvar err error\n\n\t// HTTP URL Parameters\n\tpage, err = strconv.ParseInt(r.URL.Query().Get(\"page\"), 0, 64)\n\tif err != nil {\n\t\tlog.Info().Msg(\"Page is not available\")\n\t}\n\n\tif page == 0 {\n\t\tpage = 1\n\t}\n\n\tsess := util.GetSession(r)\n\n\tvar postDAO postsdao.PostsDAO\n\terr = postDAO.Initialize(ctx.dbClient, ctx.hConfig)\n\tif err != nil {\n\t\tlog.Error().Err(err).Str(\"service\", \"postdao\").Msg(\"Error initialzing post data access object \")\n\t}\n\n\t// Get List\n\tposts, pageCount, hasNextPage, hasPrevPage, err := postDAO.AllPostsSortedByDatePaginated(page, 10)\n\t//posts, err := postDAO.AllPostsSortedByDate()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\ttemplate, err := util.SiteTemplate(\"/index.html\")\n\tif err != nil {\n\t\tlog.Error().Err(err)\n\t}\n\n\t//pageCount := len(posts)\n\n\t//template := \"templates/index.html\"\n\ttmpl := pongo2.Must(pongo2.FromFile(template))\n\n\tout, err := tmpl.Execute(pongo2.Context{\n\t\t\"title\": \"Index\",\n\t\t\"posts\": posts,\n\t\t\"pagecount\": pageCount,\n\t\t\"currentpage\": page,\n\t\t\"nextpage\": page + 1,\n\t\t\"prevpage\": page - 1,\n\t\t\"hasnextpage\": hasNextPage,\n\t\t\"hasprevpage\": hasPrevPage,\n\t\t\"user\": sess.User,\n\t\t\"bodyclass\": \"frontpage\",\n\t\t\"hidetitle\": true,\n\t\t\"pagekey\": util.GetPageID(r),\n\t\t\"token\": sess.SessionToken,\n\t})\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprint(w, out)\n}", "title": "" }, { "docid": "b9602ac3b26aca02b91eea51e860e109", "score": "0.7795163", "text": "func HomeHandler(c buffalo.Context) error {\n\ttrans := c.Value(\"tx\").(*pop.Connection)\n\truns := trans.Last(&models.Job{})\n\tc.Set(\"aJob\", runs)\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "336462424d9ac24d66890dc519113209", "score": "0.77892274", "text": "func (m *Repository) Home(w http.ResponseWriter, r *http.Request) {\n\trender.Template(w, r, \"home.page.html\", &models.TemplateData{})\n}", "title": "" }, { "docid": "aada34e4ce52ca4c163df25cd6d67ff9", "score": "0.77758133", "text": "func HomepageHandler(ctx *macaron.Context) {\n\tctx.Data[\"Env\"] = simulation.Env\n\tctx.Data[\"TickSleep\"] = simulation.TickSleep.Milliseconds()\n\tif lastMCPing != (time.Time{}) {\n\t\tlastPing := time.Since(lastMCPing).Milliseconds()\n\t\tctx.Data[\"LastMCPing\"] = lastPing\n\t\tctx.Data[\"MCConnected\"] = (lastPing < 2000)\n\t\tctx.Data[\"MCVersion\"] = mcVersion\n\t}\n\tctx.HTML(http.StatusOK, \"sim/index\")\n}", "title": "" }, { "docid": "e7db2803103f242e11f657c2385ad70d", "score": "0.7771118", "text": "func (m *Repository) Home(w http.ResponseWriter, r *http.Request) {\n\trender.Template(w, r, \"home.page.tmpl\", &models.TemplateData{})\n}", "title": "" }, { "docid": "5b5f7b420aaeca31fdb32289bc8dfc4b", "score": "0.77595866", "text": "func (s *Server) Home(w http.ResponseWriter, r *http.Request) {\n\tdata := make(map[string]interface{})\n\tdata[\"Config\"] = s.cfg\n\tdata[\"Title\"] = \"Heroes\"\n\n\terr := s.view.Render(w, s.cfg.HomeTemplate, data)\n\tif err != nil {\n\t\ts.log.Println(err)\n\t}\n}", "title": "" }, { "docid": "754ea83a73220c273769cddf4feb87be", "score": "0.77544785", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tauth := service.GetSessionMember(r)\n\ttemplateData := map[string]interface{}{\n\t\t\"title\": \"Home\",\n\t\t\"auth\": auth,\n\t}\n\n\ttmpl := template.Must(template.ParseFiles(\"template/home/home.tmpl\", setting.UserTemplate))\n\tif err := tmpl.ExecuteTemplate(w, \"base\", templateData); err != nil {\n\t\tLogger.Error(err.Error())\n\t}\n}", "title": "" }, { "docid": "e3b7bf4948f3e369b7c1f02e67241748", "score": "0.7744236", "text": "func (app *App) Home(w http.ResponseWriter, r *http.Request) {\n\n\t// if r.URL.Path != \"/\" {\n\t// \thttp.NotFound(w, r)\n\t// \treturn\n\t// }\n\n\tsnippets, err := app.Database.GetUpTo10LatestSnippets()\n\n\tif err != nil {\n\t\tapp.ServerError(w, err)\n\t\treturn\n\t}\n\n\tapp.RenderHTML(w, r, \"home.page.html\", &HTMLData{\n\t\tSnippets: snippets,\n\t})\n\n}", "title": "" }, { "docid": "1edc3c57cc43b8ab7582ba0a35494483", "score": "0.77227235", "text": "func Home(w http.ResponseWriter, r *http.Request, app *config.App) {\n\tif r.Method == \"GET\" {\n\t\thttp.ServeFile(w, r, \"webserver/static/home.html\")\n\t} else {\n\t\thttp.Redirect(w, r, \"/\", 303)\n\t}\n}", "title": "" }, { "docid": "ea9f4792cf6df673c90869335c0b6770", "score": "0.76954883", "text": "func (r *Handler) HomePage(c *gin.Context) {\n\tu.ResSuccess(u.Res{Ctx: c, Status: 201, Msg: \"Welcome to Pulsar microservice 2020\"})\n}", "title": "" }, { "docid": "b8930d5dbf4e9403859a268ede2ceea1", "score": "0.76921237", "text": "func HomeHandler(c buffalo.Context) error {\n\treturn c.Render(200, r.JSON(map[string]string{\"message\": \"Welcome to Buffalo!\"}))\n}", "title": "" }, { "docid": "71391357e5d2f8e8c28eecb9742e2e13", "score": "0.768629", "text": "func handleHome(ctx iris.Context) {\n\n\tresponse := sendToBackend(FrontendMessage{Operation: \"home\"})\n\tif !response.Success {\n\t\tctx.HTML(\"<h1>Error loading the home page: \" + response.ErrMessage + \"</h1>\")\n\t}\n\n\thomeworks := response.Homeworks\n\n\tctx.HTML(\"<h1>List of homeworks</h1>\")\n\tctx.HTML(\"<h1>Total number of homeworks: \" + strconv.Itoa(len(homeworks)) + \"</h1>\")\n\tif len(homeworks) > 0 {\n\t\tctx.HTML(\"<table>\")\n\t\tctx.HTML(\"<tr><th>Homework</th><th>Description</th><th>Submissions</th></tr>\")\n\t\tfor index, element := range homeworks {\n\t\t\tif !element.Deleted {\n\t\t\t\tctx.HTML(\"<tr><td> <a href=\\\"/edit?id=\" + strconv.Itoa(index) +\n\t\t\t\t\t\"\\\">\" + element.Homework.Name + \"</a></td><td>\" + element.Homework.Desc + \"</td><td>\" + strconv.Itoa(element.Homework.Submissions) + \"</td></tr>\")\n\t\t\t}\n\t\t}\n\t\tctx.HTML(\"</table>\")\n\t} else {\n\t\tctx.HTML(\"Empty\")\n\t}\n\tctx.HTML(\"<a href=\\\"/create\\\">Create a new homework</a>\")\n}", "title": "" }, { "docid": "0cb39f11569a734ec0454ef4ad8eb499", "score": "0.7671563", "text": "func (this *PagesController) Home(r render.Render) {\n\tr.HTML(200, \"pages/home\", nil)\n}", "title": "" }, { "docid": "f39115ae33cb01e5eacbaa8a6310b8ee", "score": "0.7657222", "text": "func Home(ctx erpc.CallCtx, args *struct{}) ([]byte, *erpc.Status) {\n\treturn html.Render(ctx, \"home\", \"Home Page Test!\")\n}", "title": "" }, { "docid": "ffc9cad68c29f13d18d23bffaa028f3b", "score": "0.76421386", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\t//tmpl := template.Must(template.ParseFiles(config.SiteRootTemplate+\"front/index.html\", config.SiteHeaderTemplate, config.SiteFooterTemplate))\n\ttmpl := template.Must(template.ParseFiles(config.SiteRootTemplate + \"front/index.html\"))\n\n\tdata := contextData{\n\t\t\"PageTitle\": config.SiteFullName,\n\t\t\"PageMetaDesc\": config.SiteSlogan,\n\t\t\"CanonicalURL\": r.RequestURI,\n\t\t\"CsrfToken\": csrf.Token(r),\n\t\t\"Settings\": config.SiteSettings,\n\t}\n\ttmpl.Execute(w, data)\n}", "title": "" }, { "docid": "3220e5efe1e848d21820c44147ce129b", "score": "0.76416904", "text": "func (router *Router) HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"<a href='%s'>Login</a>\", google.Oauth2URL(\"state\"))\n}", "title": "" }, { "docid": "8db2f72141df1b99b264578c13b339d4", "score": "0.7628639", "text": "func handleHome(w http.ResponseWriter, r *http.Request) {\n\tf, _ := template.ParseFiles(\"views/index.htm\")\n\tf.Execute(w, nil)\n}", "title": "" }, { "docid": "f05d7d65dcde1b31d4cd5c84f659690e", "score": "0.761664", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tparsedHome, _ := template.ParseFiles(\"templates/home.page.tmpl\", \"templates/base.layout.tmpl\")\n\terr := parsedHome.Execute(w, nil)\n\tif err != nil {\n\t\tlog.Panicln(\"Error rendering home page: \", err)\n\t}\n}", "title": "" }, { "docid": "6faced9895903e5d46bef3aa9adcdb82", "score": "0.76133054", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tt := template.New(\"index.html\") // Create a template.\n\t// get the current working directory\n\tcwd, _ := os.Getwd()\n\tp := path.Join(cwd, \"public\", \"index.html\")\n\tt, err := t.ParseFiles(p) // Parse template file.\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\t// Sample := struct {\n\t// \tEmail string\n\t// \tPassword string\n\t// \tGreeting string\n\t// }{\n\t// \tEmail: \"spankie@gmail.com\",\n\t// \tPassword: \"password\",\n\t// \tGreeting: \"Hello Spankie\",\n\t// }\n\terr = t.Execute(w, nil) // merge.\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "5d3ad1b1eae12bd0605d3a6256fb7b1d", "score": "0.7607121", "text": "func (b *HomeController) Home(responseWriter http.ResponseWriter, request *http.Request) {\n\tb.Log.Printf(\"%s %s -> %s\", request.Method, request.URL.Path, request.RemoteAddr)\n\n\tpageVars := render.PageVars{\n\t\tTitle: \"GoViolin\",\n\t}\n\n\tif err := render.Render(responseWriter, \"home.html\", pageVars); err != nil {\n\t\tb.Log.Printf(\"%s %s -> %s : ERROR : %v\", request.Method, request.URL.Path, request.RemoteAddr, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ac1020a14b91a89432eb2cc3fb8e6c3c", "score": "0.76050085", "text": "func HomeHandler(c buffalo.Context) error {\n\tslow(c)\n\t//cl := client.NewClient(client.Wrap(mot.NewClientWrapper(Tracer)))\n\tclient.DefaultClient = client.NewClient(\n\t\tclient.Wrap(\n\t\t\tmot.NewClientWrapper(Tracer)),\n\t)\n\tctx := mware.MetadataContext(c)\n\tuser := proto.NewAccountClient(\"account\", client.DefaultClient)\n\tuser.Search(ctx, &account.SearchRequest{})\n\treturn c.Render(200, r.HTML(\"index.html\"))\n}", "title": "" }, { "docid": "da1111bb9f2d455fbd4ebefe5bec170a", "score": "0.76010966", "text": "func HandleHome(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Hello from handleHome\")\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "1605d7086c0b411ae66a6d96d2f1b4d7", "score": "0.75827897", "text": "func (c *HomeController) Home(ctx *app.HomeHomeContext) error {\n\t// HomeController_Home: start_implement\n\n\t// Put your logic here\n\n\t// HomeController_Home: end_implement\n\tres := make(map[string]string, 1)\n\tres[\"message\"] = \"Hello World!\"\n\treturn ctx.OK(res)\n}", "title": "" }, { "docid": "a936e4ec030251a684167a1cff22d9ea", "score": "0.75825006", "text": "func HomeHandler(c buffalo.Context) error {\n\tisAdmin := c.Session().Get(\"is_admin\") == true\n\troutePath := \"apiUploadMultiPath\"\n\tif isAdmin {\n\t\troutePath = \"apiUploadGcsPath\"\n\t}\n\tuploadURI := \"\"\n\tri, err := app.Routes().Lookup(routePath)\n\tif err != nil {\n\t\tc.Logger().Debug(\"No such route\")\n\t} else {\n\t\tuploadURI = ri.Path\n\t}\n\tc.Set(\"isAdmin\", isAdmin)\n\tc.Set(\"uploadURI\", uploadURI)\n\tc.Set(\"userID\", c.Session().Get(\"user\"))\n\treturn c.Render(200, r.HTML(\"_index.html\"))\n}", "title": "" }, { "docid": "2b1edb8c19bff1ada80d7749677f8512", "score": "0.7577349", "text": "func (app *application) home(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\tapp.notFound(w)\n\t\treturn\n\t}\n\n\tfiles := []string{\n\t\t\"./ui/html/home.page.tmpl\",\n\t\t\"./ui/html/base.layout.tmpl\",\n\t\t\"./ui/html/footer.partial.tmpl\",\n\t}\n\n\tts, err := template.ParseFiles(files...)\n\tif err != nil {\n\t\tapp.serverError(w, err)\n\t}\n\n\terr = ts.Execute(w, nil)\n\tif err != nil {\n\t\tapp.serverError(w, err)\n\t}\n\n\t// w.Write([]byte(\"Hello from Pegion\"))\n}", "title": "" }, { "docid": "a1ec51cbd8168bfe660c353c04340896", "score": "0.7576218", "text": "func HomeHandler(rw http.ResponseWriter, req *http.Request) {\n\t//t, err := template.Delims(\"{#\", \"#}\").ParseFiles(\"./templates/index.html\")\n\tt := template.New(\"index.html\")\n\tt.Delims(\"[[\", \"]]\")\n\tt, err := t.ParseFiles(\"./templates/index.html\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not find template file template/index.html. Error: %s.\", err)\n\t}\n\n\tsession := app.GetSession(req)\n\ttd := TemplateData{}\n\tif u, ok := session.Values[\"user\"].(User); ok {\n\t\ttd.Email = u.Email\n\t}\n\terr = t.Execute(rw, td)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't show template with data %v. Error %s\", td, err)\n\t}\n}", "title": "" }, { "docid": "bf28e1a690d4264bda3523ece0712783", "score": "0.7573111", "text": "func (rs Index) Home(w http.ResponseWriter, r *http.Request) {\n\tmets := genMetas()\n\tsendTemplate(mets, w, r)\n}", "title": "" }, { "docid": "a49d620117d569a866e280bf4292f31b", "score": "0.7572165", "text": "func (h *handler) goHome(w http.ResponseWriter, r *http.Request) {\n\tdata := map[string]interface{}{\"bodyClass\": \"page-template-carousel\"}\n\trespond(h.Logger, w, r, \"./tmpl/index.tmpl\", data)\n}", "title": "" }, { "docid": "374bd34abf1d282293a6bcf9fa9901db", "score": "0.757093", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\t_session, _error := store.Get(r, config.AppSessionName)\n\tif _error != nil {\n\t\thttp.Error(w, _error.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\t_session.Save(r, w)\n\n\t// Check if user is authenticated\n\tif _auth, _ok := _session.Values[config.AppSessionAuthenticated].(bool); !_ok || !_auth {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusTemporaryRedirect)\n\t\treturn\n\t}\n\n\t_tokenStr := \"\"\n\tif _session.Values[\"AuthToken\"] != nil {\n\t\t_tokenStr = _session.Values[\"AuthToken\"].(string)\n\t}\n\n\t// Get error message to display\n\t_errorMessage := \"\"\n\tif _session.Values[config.AppSessionErrorMessage] != nil {\n\t\t_errorMessage = _session.Values[config.AppSessionErrorMessage].(string)\n\t}\n\n\t_val, _found := cacheUsers.Get(_session.Values[config.AppSessionAuthGoogleEmail].(string))\n\tif !_found {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusTemporaryRedirect)\n\t\treturn\n\t}\n\n\t_cacheUser := _val.(*TCacheUser)\n\tcacheUsers.Set(_session.Values[config.AppSessionAuthGoogleEmail].(string), _cacheUser, cache.DefaultExpiration)\n\n\t// Set information and load page\n\t_homePageData := &THomePageData{\n\t\tAppName: config.AppName,\n\t\tErrorMsg: _errorMessage,\n\t\tEmail: _session.Values[config.AppSessionAuthGoogleEmail].(string),\n\t\tLaunchURL: fmt.Sprintf(\"sftp://%s:%s@%s\", _cacheUser.Email, _cacheUser.Password, config.SFTPServer),\n\t\tToken: _tokenStr,\n\t\tRefreshTimeout: (config.AppWWWTimeout),\n\t}\n\thomePage.Execute(w, _homePageData)\n}", "title": "" }, { "docid": "eef0c51d3a677e3e7c42e39fc1535538", "score": "0.7562035", "text": "func HomeHandler(c *gin.Context) {\r\n\tc.HTML(http.StatusOK, \"index.tmpl\", gin.H{\r\n\t\t\"title\": \"API Documentation\",\r\n\t})\r\n}", "title": "" }, { "docid": "e0b461cd549bbc7559316fe457bca25f", "score": "0.75576395", "text": "func HomeHandler(w http.ResponseWriter, req *http.Request) {\n\tfmt.Fprintf(w, \"Welcome to use fib system!\")\n}", "title": "" }, { "docid": "9b31195b5311724df0d97fc1fe375426", "score": "0.755584", "text": "func home(w http.ResponseWriter, r *http.Request) {\n\treq_ctx := Ctx{\n\t\tTitle: \"Home page\",\n\t\tMenu: Menu{menu, 0},\n\t\tLeft: []string{\n\t\t\t\"This is a test service created entirely in Go using \" +\n\t\t\t\t\"<em>kasia.go</em> and <em>kview</em> packages.\",\n\t\t\t\"Please select another menu item!\",\n\t\t},\n\t\tRight: RightCtx{\"A house is much better than a flat. So buy a new \" +\n\t\t\t\"House today!\"},\n\t}\n\texec(w, r, home_view, req_ctx)\n}", "title": "" }, { "docid": "fb3d5454ab66f6f97f54de45cd6a3955", "score": "0.75481033", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tclaims := retriveClaimsFromCookie(r)\n\tif claims != nil {\n\t\trefreshTokenIfTooCloseToExpiryTime(w, claims)\n\t\tvar greetings string\n\t\tif claims.Username == \"test\" {\n\t\t\tgreetings = \"We appreciate your custom here!\"\n\t\t} else {\n\t\t\tgreetings = \"You are highly appreciated as a valuable customer here!\"\n\t\t}\n\t\tdata := map[string]string{\"user\": claims.Username, \"greetings\": greetings}\n\t\tdispatchHomePage.Execute(w, data)\n\t\t// w.Write([]byte(fmt.Sprintf(\"Welcome %s!\", )))\n\t}\n}", "title": "" }, { "docid": "b83bd183eb29248816471058cd926f46", "score": "0.75450414", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\t// fmt.Fprint(w, \"You're home! :D\")\n\t// Send file over\n\thttp.ServeFile(w, r, \"home-page.html\")\n}", "title": "" }, { "docid": "1fececdf7432e301a690930f4df831e9", "score": "0.75433105", "text": "func HomePageHandler(w http.ResponseWriter, r *http.Request) {\n\thomePageView := template.Must(template.ParseFiles(\"views/index.html\"))\n\thomePageView.Execute(w, nil)\n}", "title": "" }, { "docid": "a579f33e4b19538abc8bb9df82576f35", "score": "0.75343305", "text": "func (m *Repository) Home(w http.ResponseWriter, r *http.Request) {\n\n\t/*working with session, grab remote IP address of person visiting\n\tmy site and store it in home page*/\n\tremoteIP := r.RemoteAddr\n\tm.App.Session.Put(r.Context(), \"remote_ip\", remoteIP)\n\n\trender.RenderTemplate(w, \"home.page.html\", &models.TemplateData{})\n}", "title": "" }, { "docid": "c3fac4a3eaf0ae5e33495d7a19d17662", "score": "0.7512109", "text": "func HomeHandler(response http.ResponseWriter, request *http.Request) {\n\tdb := OpenDb(\"db.sqlite3\")\n\tclusters, _ := db.GetClusterSummaries()\n\trenderTemplate(response, \"home.html\", map[string]interface{}{\"clusters\": clusters})\n\tdb.Close()\n}", "title": "" }, { "docid": "fe188e5c1003b399883bf5df053dd934", "score": "0.74750906", "text": "func (t *Layout) Home() {\n\tt.Ctx.Data = map[string]interface{}{\n\t\t\"id\": \"index\",\n\t\t\"title\": \"title\",\n\t\t\"header\": \"My Header\",\n\t\t\"footer\": \"My Footer\",\n\t}\n\tt.Ctx.Template = \"layoutHTML\"\n\tt.HTML(http.StatusOK)\n}", "title": "" }, { "docid": "2c22c4851b21dfb60891f617186a2984", "score": "0.7469294", "text": "func homeHandler(w http.ResponseWriter, r *http.Request) {\n\tinaccessibleLinks = nil\n\tif r.URL.Path != \"/\" {\n\t\tvar ErrNotFound = errors.New(\"Only the home page is accessible.\")\n\t\tcheckError(ErrNotFound, w, r)\n\t\treturn\n\t}\n\n\tswitch r.Method {\n\tcase \"GET\":\n\t\thttp.ServeFile(w, r, \"static/home.html\")\n\tcase \"POST\":\n\n\t\t// If there are no errors we set the url to the user input\n\t\tuserInput = r.FormValue(\"url\")\n\n\t\t// Validating user input to be a real url\n\t\tu, err := url.ParseRequestURI(userInput)\n\t\t_ = u\n\t\tif err != nil {\n\t\t\tvar er = errors.New(\"Please enter a valid URL.\")\n\t\t\tcheckError(er, w, r)\n\t\t\treturn\n\t\t}\n\n\t\thostURL = u.Host\n\t\tmainURL = extractMainUrl(hostURL)\n\t\tdomainName = extractDomainName(hostURL)\n\n\t\t// Redirecting to result page\n\t\thttp.Redirect(w, r, \"/result\", 302)\n\n\tdefault:\n\t\tfmt.Fprintf(w, \"GET and POST methods are supported.\")\n\t}\n}", "title": "" }, { "docid": "bd337d9bffa64a68cd3ebde3e3195b2a", "score": "0.7453068", "text": "func HandleHome(responseWriter http.ResponseWriter, request *http.Request, params httprouter.Params) {\n\timages, err := globalImageStore.FindAll(0)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ttemplateData := map[string]interface{}{\n\t\t\"Images\": images,\n\t}\n\n\tRenderTemplate(responseWriter, request, \"index/home\", templateData)\n}", "title": "" }, { "docid": "ed8e9269ac204f9cd786219d862f5b6d", "score": "0.74474156", "text": "func (h Home) Index(w http.ResponseWriter, r *http.Request) {\n\trender.NewFrontRender().SetTemplates(\"home.html\").Render(w, nil)\n}", "title": "" }, { "docid": "2b55645632ea36345228504e18bc9ed2", "score": "0.73960644", "text": "func indexHandler(w http.ResponseWriter, r *http.Request){\n\terr := templates.ExecuteTemplate(w, \"home.html\", nil)\n\n\tif err != nil{\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "70757c5a7fc8ce41fdb9e69f6692f714", "score": "0.7369324", "text": "func (*SiteController) Home(c echo.Context) error {\n\tvar site models.Site\n\n\tret, err := site.Home()\n\tif err != nil {\n\t\treturn c.Render(500, \"500\", err)\n\t}\n\n\treturn c.Render(200, \"index\", ret)\n}", "title": "" }, { "docid": "25c29bf1912a836b20628a7ab71abdeb", "score": "0.736314", "text": "func Homepage(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\texecuteTemplate(w, \"index.html\", d(\"Title\", \"home\"))\n}", "title": "" }, { "docid": "0b348ac37adddfd849a9efa15051bc0e", "score": "0.7350684", "text": "func homePage(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(r.URL.Path)\n\tp := strings.Split(r.URL.Path, \"/\")\n\tif len(p) == 2 {\n\t\tfmt.Fprintf(w, \"Welcome to the HomePage!\")\n\t\tfmt.Println(\"Endpoint Hit: homePage\")\n\t} else {\n\t\treturnSingleArticle(w, r, p[2])\n\t\tfmt.Println(p[2])\n\t}\n}", "title": "" }, { "docid": "999b5fdf6088b4637d106085c27e5bd4", "score": "0.73313975", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tif strings.Contains(r.URL.Path, \".\") {\n\t\tChttp.ServeHTTP(w, r)\n\t} else {\n\t\thttp.Redirect(w, r, \"/home/\", http.StatusFound)\n\t}\n}", "title": "" }, { "docid": "ea12abc126830e0bad4092fd5ddf05ce", "score": "0.7321838", "text": "func (h *Handler) HomeHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.Redirect(w, r,\n\t\t\"https://github.com/quantum/discovery\",\n\t\thttp.StatusMovedPermanently,\n\t)\n}", "title": "" }, { "docid": "a3fa9f6c782623a0bd72a31c5bbe212d", "score": "0.7305619", "text": "func Home(ctx context.Context, res http.ResponseWriter, req *http.Request) {\n\thttp.ServeFile(res, req, \"static/home.html\")\n}", "title": "" }, { "docid": "62fde5e429c8199144269a1ce6f32d3d", "score": "0.72980064", "text": "func homePage(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"Homepage Endpoint Hit\")\n}", "title": "" }, { "docid": "8830bb2df547057b06f58af2dd01bbd3", "score": "0.7293781", "text": "func Home(log logrus.FieldLogger, k8sToken string) router.Handle {\n\treturn func(c *router.Control) {\n\t\tt, err := template.ParseFiles(\"templates/layout.html\", \"templates/index.html\")\n\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Couldn't parse template files: %+v\", err)\n\t\t}\n\n\t\tdata := struct {\n\t\t\tGitHubSignInLink string // link to sign in to GitHub\n\t\t\tLogin string // user's login\n\t\t\tActivated bool // is user activated in k8s\n\t\t\tGuestToken string // a token to reach Kubernetes\n\t\t}{\n\t\t\tGitHubSignInLink: \"/oauth/github\",\n\t\t\tGuestToken: k8sToken,\n\t\t}\n\n\t\t// Check if user have already logged in\n\t\tsessionData := session.Get(c.Request)\n\t\tif sessionData != nil {\n\t\t\tdata.Login = sessionData.CAttr(\"Login\").(string)\n\t\t\tdata.Activated = sessionData.Attr(\"Activated\").(bool)\n\t\t}\n\n\t\tt.ExecuteTemplate(c.Writer, \"layout\", data)\n\t}\n}", "title": "" }, { "docid": "918f6e978cd4d12f69f82e625a9677e0", "score": "0.7278624", "text": "func Home(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t// Articles per page\n\tperPage := 4\n\n\t// Get page param\n\tpage := ps.ByName(\"page\")\n\n\tif page == \"\" {\n\t\t// Load articles with the page 0\n\t\tarticles, max, err := getArticles(0, perPage)\n\t\tif err != nil {\n\t\t\tutil.Logger.Error(err)\n\t\t\treturn\n\t\t}\n\n\t\t// Render template\n\t\tutil.Template.RenderTemplate(w, r, \"home.html\", map[string]interface{}{\n\t\t\t\"articles\": articles,\n\t\t\t\"page\": 0,\n\t\t\t\"max\": max / perPage,\n\t\t})\n\t\treturn\n\t}\n\n\t// Convert page to int\n\tpageNumber, err := strconv.Atoi(page)\n\n\t// Check if pageNumber can be a valid page\n\tif err != nil {\n\t\thttp.Redirect(w, r, \"/\", 302)\n\t\treturn\n\t}\n\n\t// Get article list for the given page\n\tarticles, max, err := getArticles(pageNumber, perPage)\n\tif err != nil {\n\t\tutil.Logger.Error(err)\n\t\treturn\n\t}\n\n\t// Check if there are any articles for this page\n\tif len(articles) <= 0 {\n\t\thttp.Redirect(w, r, \"/\", 302)\n\t\treturn\n\t}\n\n\t// Render template\n\tutil.Template.RenderTemplate(w, r, \"home.html\", map[string]interface{}{\n\t\t\"articles\": articles,\n\t\t\"page\": pageNumber,\n\t\t\"max\": max / perPage,\n\t})\n}", "title": "" }, { "docid": "257e44e4a42b3d43350d9edb4e29db2e", "score": "0.7274605", "text": "func HomePage(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"homepage.html\", gin.H{\n\t})\n}", "title": "" }, { "docid": "66d4be5029ab30d08b7e1c0973f343b3", "score": "0.726596", "text": "func Home(db *bolt.DB, webroot string) *Wrapper {\n\thomeTemplate := CreateTemplate(webroot, \"base.html\", \"home.template\")\n\treturn &Wrapper{HomeHandler{homeTemplate, db}}\n}", "title": "" }, { "docid": "fe334fb9426c778a160601da49f1fdb2", "score": "0.7255718", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\tdata, err := Asset(\"static/index.html\")\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tw.Write(data)\n}", "title": "" }, { "docid": "8b5df8246df2b023db564151fba07521", "score": "0.7250106", "text": "func homePage(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"Welcome to the HomePage!\")\n\tfmt.Println(\"Endpoint Hit: homePage\")\n}", "title": "" }, { "docid": "ce0de548930f3ec7df569e7aeaad74d6", "score": "0.7249471", "text": "func HomeHandler(c buffalo.Context) error {\n\n\t// tx, ok := c.Value(\"tx\").(*pop.Connection)\n\t// if !ok {\n\t// \treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t// }\n\n\t// users := &models.Users{}\n\n\t// if err := tx.All(users); err != nil {\n\t// \treturn errors.WithStack(err)\n\t// }\n\n\t// log.Println(users)\n\treturn c.Render(200, r.JSON(map[string]string{\"Hi\": \"Welcome to Suunto Things, Created with Buffalo!\"}))\n}", "title": "" }, { "docid": "b6d47302dc01187e424b18a3fe67535e", "score": "0.7226379", "text": "func homeHandler(w http.ResponseWriter, r *http.Request){\r\n\terrorHandler(w,r, http.StatusNotFound)\r\n}", "title": "" }, { "docid": "e024d81b44ef063852267541b4ebcf01", "score": "0.72194505", "text": "func Home() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\trender.JSON(w, http.StatusOK, \"Welcome to Janus\")\n\t}\n}", "title": "" }, { "docid": "99fea8a600ed43a7e85d945eb997b6a0", "score": "0.72044843", "text": "func homeHandler(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"Content-type\", \"text/html\")\n\twebpage, err := ioutil.ReadFile(\"home.html\")\n\n\tif err != nil {\n\t\thttp.Error(response, fmt.Sprintf(\"home.html file error %v\", err), 500)\n\t}\n\n\tfmt.Fprint(response, string(webpage))\n}", "title": "" }, { "docid": "7ddb909afa07d7cba22e00aa79cf2d9b", "score": "0.7199827", "text": "func (c *Console) Home(w http.ResponseWriter, r *http.Request) {\n\tlogger := c.loggerFromRequest(r)\n\t_, err := session.GetString(r, \"username\")\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"could not get session\")\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tc.render(w, logger, \"console-home.tmpl\", nil)\n}", "title": "" }, { "docid": "eff09d1a8138b21f33233ac008d178b7", "score": "0.719519", "text": "func home(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"index.tmpl\", gin.H{\n\t\t\"title\": \"Hi there!\",\n\t\t\"heading\": \"Welcome\",\n\t\t\"content\": \"... to the API.\",\n\t})\n}", "title": "" }, { "docid": "e03d0894d2933db67988bc4663094985", "score": "0.71900606", "text": "func (c *Context) GetHomeHandler(rw web.ResponseWriter, req *web.Request) {\n\terr := templates.ExecuteTemplate(rw, \"indexPage\", c)\n\tif err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "ef47406eb1aec6cb6978009642c3de4e", "score": "0.7185009", "text": "func Home(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tu := session.Get(userKey)\n\n\tif u != nil {\n\t\tlog.Printf(\"user: %v\\n\", u)\n\t\tuser, err := models.FindUserByID(u.(uint))\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error getting user:\", err.Error())\n\t\t\tc.Redirect(302, \"/signup\")\n\t\t\treturn\n\t\t}\n\n\t\tlog.Printf(\"Found session user: %v\\n\", user)\n\t\tc.Redirect(302, \"/photos\")\n\t} else {\n\t\tc.Redirect(302, \"/signup\")\n\t}\n}", "title": "" }, { "docid": "ea3843be955d93bd2a05c5dfd965b737", "score": "0.71714824", "text": "func (app *application) home(w http.ResponseWriter, r *http.Request) {\n\n\ts, err := app.snippets.Latest()\n\n\tif err != nil {\n\t\tapp.serverError(w, err)\n\t\treturn\n\t}\n\n\tapp.render(w, r, \"home.page.tmpl\", &templateData{\n\t\tSnippets: s,\n\t})\n\n}", "title": "" }, { "docid": "626512818acd0498e1dc10d7a932616a", "score": "0.71644783", "text": "func HomeGet(c *gin.Context) {\n\tdb := models.GetDB()\n\tpage := models.Page{}\n\n\tdb.First(&page, \"slug = ?\", \"/\")\n\tif page.ID == 0 {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\th := DefaultH(c)\n\tsession := sessions.Default(c)\n\th[\"Page\"] = page\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\n\tc.HTML(http.StatusOK, \"home/show\", h)\n}", "title": "" }, { "docid": "6dc84fb350881b73b90c79397e603dde", "score": "0.71592563", "text": "func HomeGet(c *gin.Context) {\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = \"Welcome to basic GIN blog\"\n\th[\"Active\"] = \"home\"\n\tc.HTML(http.StatusOK, \"home/show\", h)\n}", "title": "" }, { "docid": "6d6c2f343a647acb35617b682dd11655", "score": "0.71140075", "text": "func HomeHandler(w http.ResponseWriter, r *http.Request) {\n\t// for relative urls - we need to get the resource\n\t// so we can proxy/server it -- aka\n\t// if a request comes in as /images/image1.jpg\n\t// we need to forward to http://resource.com/images/image1.jpg\n\tfmt.Println(\"HomeHandler\")\n\tsession, err := CookieStore.Get(r, os.Getenv(\"COOKIE_SECRET\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Retrieve our struct and type-assert it\n\tval := session.Values[\"redirection_url\"].(string)\n\tfmt.Println(\"proxy session url\", val)\n\tfmt.Println(\"proxy url\", r.URL.String())\n\n\t//itemaddress = val + r.URL.String()\n\tfmt.Println(val + r.URL.String())\n\tr.URL = testutils.ParseURI(val + r.URL.String())\n\n\tfwd, _ := forward.New()\n\tfwd.ServeHTTP(w, r)\n\n}", "title": "" }, { "docid": "05f75a7555ff95f0724ad2906008bce6", "score": "0.7107337", "text": "func Home(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"[%v]\\t%s\", r.Method, constants.HomeAPIRoute)\n\tfmt.Fprintf(w, \"API seems fine.\")\n}", "title": "" } ]
b31a6efff160369d78ebfffd93e5974f
PollForDecisionTaskWithContext is the same as PollForDecisionTask with the addition of the ability to pass a context and additional request options. See PollForDecisionTask for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create subcontexts for http.Requests. See for more information on using Contexts.
[ { "docid": "6ff07df0a65c513ba715c6d502fabdda", "score": "0.862086", "text": "func (c *SWF) PollForDecisionTaskWithContext(ctx aws.Context, input *PollForDecisionTaskInput, opts ...request.Option) (*PollForDecisionTaskOutput, error) {\n\treq, out := c.PollForDecisionTaskRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" } ]
[ { "docid": "38891a2c27a2b6bcf3ef37bd2ac84c3a", "score": "0.6558823", "text": "func (c *SWF) PollForActivityTaskWithContext(ctx aws.Context, input *PollForActivityTaskInput, opts ...request.Option) (*PollForActivityTaskOutput, error) {\n\treq, out := c.PollForActivityTaskRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "39e223984800ef92ae94ab152a30cb8f", "score": "0.6346196", "text": "func (c *SWF) PollForDecisionTaskPagesWithContext(ctx aws.Context, input *PollForDecisionTaskInput, fn func(*PollForDecisionTaskOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *PollForDecisionTaskInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.PollForDecisionTaskRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*PollForDecisionTaskOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "9f65dbbc1b933bc91d014f2c5770862b", "score": "0.5798062", "text": "func (c *SWF) RespondDecisionTaskCompletedWithContext(ctx aws.Context, input *RespondDecisionTaskCompletedInput, opts ...request.Option) (*RespondDecisionTaskCompletedOutput, error) {\n\treq, out := c.RespondDecisionTaskCompletedRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "bd289d8266f26456613cba7ccf9d8efc", "score": "0.57750577", "text": "func (m *MockClient) PollForDecisionTask(arg0 context.Context, arg1 *types.PollForDecisionTaskRequest, arg2 ...yarpc.CallOption) (*types.PollForDecisionTaskResponse, 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, \"PollForDecisionTask\", varargs...)\n\tret0, _ := ret[0].(*types.PollForDecisionTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "98029e1a5ff53204053dd018f322b46b", "score": "0.56445545", "text": "func (m *MockHandler) PollForDecisionTask(arg0 context.Context, arg1 *types.MatchingPollForDecisionTaskRequest) (*types.MatchingPollForDecisionTaskResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PollForDecisionTask\", arg0, arg1)\n\tret0, _ := ret[0].(*types.MatchingPollForDecisionTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cb5b53d81cb8a7230d196059188d4f29", "score": "0.5581605", "text": "func (m *MockHandler) PollForDecisionTask(arg0 context.Context, arg1 *types.PollForDecisionTaskRequest) (*types.PollForDecisionTaskResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PollForDecisionTask\", arg0, arg1)\n\tret0, _ := ret[0].(*types.PollForDecisionTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "009d27c2babbbf06f7b47c07e815a1ec", "score": "0.5354757", "text": "func (mr *MockClientMockRecorder) PollForDecisionTask(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, \"PollForDecisionTask\", reflect.TypeOf((*MockClient)(nil).PollForDecisionTask), varargs...)\n}", "title": "" }, { "docid": "d6efab0b503f3812af9a99352e445091", "score": "0.535179", "text": "func (r *rowSet) PollWithContext(ctx context.Context) (*Status, error) {\n\treturn r.poll(ctx)\n}", "title": "" }, { "docid": "bfb2dcbba9e0c968cc1575dba5bbda0a", "score": "0.5104163", "text": "func (v *MatchingService_PollForDecisionTask_Args) GetPollRequest() (o *PollForDecisionTaskRequest) {\n\tif v != nil && v.PollRequest != nil {\n\t\treturn v.PollRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2828a30c7dbe7924e04730e07f2d859d", "score": "0.49896988", "text": "func (mr *MockHandlerMockRecorder) PollForDecisionTask(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PollForDecisionTask\", reflect.TypeOf((*MockHandler)(nil).PollForDecisionTask), arg0, arg1)\n}", "title": "" }, { "docid": "2828a30c7dbe7924e04730e07f2d859d", "score": "0.49896988", "text": "func (mr *MockHandlerMockRecorder) PollForDecisionTask(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PollForDecisionTask\", reflect.TypeOf((*MockHandler)(nil).PollForDecisionTask), arg0, arg1)\n}", "title": "" }, { "docid": "935f1ff1f7c464ac0cf6313f0135c21e", "score": "0.49804804", "text": "func (c *DatabaseMigrationService) ModifyReplicationTaskWithContext(ctx aws.Context, input *ModifyReplicationTaskInput, opts ...request.Option) (*ModifyReplicationTaskOutput, error) {\n\treq, out := c.ModifyReplicationTaskRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "f2e7b7874130f947f530ae91eb4aa4cf", "score": "0.49571073", "text": "func (c *SWF) RespondActivityTaskFailedWithContext(ctx aws.Context, input *RespondActivityTaskFailedInput, opts ...request.Option) (*RespondActivityTaskFailedOutput, error) {\n\treq, out := c.RespondActivityTaskFailedRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "c2f764bf8fbc6c686de64c51b953e08e", "score": "0.49485496", "text": "func (c *SWF) RecordActivityTaskHeartbeatWithContext(ctx aws.Context, input *RecordActivityTaskHeartbeatInput, opts ...request.Option) (*RecordActivityTaskHeartbeatOutput, error) {\n\treq, out := c.RecordActivityTaskHeartbeatRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "847383cd1e8e2c917fff3fb19283adf1", "score": "0.4686139", "text": "func (c *SWF) CountPendingDecisionTasksWithContext(ctx aws.Context, input *CountPendingDecisionTasksInput, opts ...request.Option) (*PendingTaskCount, error) {\n\treq, out := c.CountPendingDecisionTasksRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "8f09ab20aafc27a678107e9cfb7a7c6e", "score": "0.46615312", "text": "func NewPollingRequestWithContext(ctx context.Context, resp *http.Response) (*http.Request, error) {\n\tlocation := GetLocation(resp)\n\tif location == \"\" {\n\t\treturn nil, NewErrorWithResponse(\"autorest\", \"NewPollingRequestWithContext\", resp, \"Location header missing from response that requires polling\")\n\t}\n\n\treq, err := Prepare((&http.Request{}).WithContext(ctx),\n\t\tAsGet(),\n\t\tWithBaseURL(location))\n\tif err != nil {\n\t\treturn nil, NewErrorWithError(err, \"autorest\", \"NewPollingRequestWithContext\", nil, \"Failure creating poll request to %s\", location)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "c5c08a2518d210e426f6bcd7f6dcf29a", "score": "0.45839325", "text": "func NewWatchTaskParamsWithContext(ctx context.Context) *WatchTaskParams {\n\tvar ()\n\treturn &WatchTaskParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "b2bedb2ed4ec5a922fb847c54d023d8b", "score": "0.45624763", "text": "func (v *PollForDecisionTaskRequest) GetPollRequest() (o *shared.PollForDecisionTaskRequest) {\n\tif v != nil && v.PollRequest != nil {\n\t\treturn v.PollRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "78bbcb17ad2862245ba7e63292f40754", "score": "0.4442184", "text": "func (m *MockSSMAPI) GetMaintenanceWindowTaskWithContext(arg0 context.Context, arg1 *ssm.GetMaintenanceWindowTaskInput, arg2 ...request.Option) (*ssm.GetMaintenanceWindowTaskOutput, 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, \"GetMaintenanceWindowTaskWithContext\", varargs...)\n\tret0, _ := ret[0].(*ssm.GetMaintenanceWindowTaskOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0a1d5d7aa52d24da34030f042f9405c9", "score": "0.4411235", "text": "func (c *DatabaseMigrationService) MoveReplicationTaskWithContext(ctx aws.Context, input *MoveReplicationTaskInput, opts ...request.Option) (*MoveReplicationTaskOutput, error) {\n\treq, out := c.MoveReplicationTaskRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "cac29836a9153870822dea82124dd2d5", "score": "0.4320734", "text": "func (c *IAM) SetSecurityTokenServicePreferencesWithContext(ctx aws.Context, input *SetSecurityTokenServicePreferencesInput, opts ...request.Option) (*SetSecurityTokenServicePreferencesOutput, error) {\n\treq, out := c.SetSecurityTokenServicePreferencesRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e3197b2caa09418f0b17cd974d8e8da6", "score": "0.4300884", "text": "func (c *SWF) RespondActivityTaskCanceledWithContext(ctx aws.Context, input *RespondActivityTaskCanceledInput, opts ...request.Option) (*RespondActivityTaskCanceledOutput, error) {\n\treq, out := c.RespondActivityTaskCanceledRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "08c704a94abd2013d4144a7dfd89e1f4", "score": "0.42845842", "text": "func (m *MockClient) PollForActivityTask(arg0 context.Context, arg1 *types.PollForActivityTaskRequest, arg2 ...yarpc.CallOption) (*types.PollForActivityTaskResponse, 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, \"PollForActivityTask\", varargs...)\n\tret0, _ := ret[0].(*types.PollForActivityTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "eef853cb256458018c2ef5bc12de0eba", "score": "0.42832297", "text": "func (m *MockECSAPI) DescribeTaskDefinitionWithContext(arg0 context.Context, arg1 *ecs.DescribeTaskDefinitionInput, arg2 ...request.Option) (*ecs.DescribeTaskDefinitionOutput, 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, \"DescribeTaskDefinitionWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecs.DescribeTaskDefinitionOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d535fb4ed19130c362f00eea900a5dee", "score": "0.4274887", "text": "func (v *MatchingService_PollForActivityTask_Args) GetPollRequest() (o *PollForActivityTaskRequest) {\n\tif v != nil && v.PollRequest != nil {\n\t\treturn v.PollRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "21bb9ee68c81fbe0f94ed869859364ea", "score": "0.42688876", "text": "func (c *SWF) RespondActivityTaskCompletedWithContext(ctx aws.Context, input *RespondActivityTaskCompletedInput, opts ...request.Option) (*RespondActivityTaskCompletedOutput, error) {\n\treq, out := c.RespondActivityTaskCompletedRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "b9e9d5cbbfc2aed3f79ef9813c8f6123", "score": "0.42428383", "text": "func DecisionContext(parent context.Context, decision error) context.Context {\n\tif decision == nil || errors.Is(decision, Skip) {\n\t\treturn parent\n\t}\n\treturn context.WithValue(parent, decisionCtxKey{}, decision)\n}", "title": "" }, { "docid": "b9e9d5cbbfc2aed3f79ef9813c8f6123", "score": "0.42428383", "text": "func DecisionContext(parent context.Context, decision error) context.Context {\n\tif decision == nil || errors.Is(decision, Skip) {\n\t\treturn parent\n\t}\n\treturn context.WithValue(parent, decisionCtxKey{}, decision)\n}", "title": "" }, { "docid": "b9e9d5cbbfc2aed3f79ef9813c8f6123", "score": "0.42428383", "text": "func DecisionContext(parent context.Context, decision error) context.Context {\n\tif decision == nil || errors.Is(decision, Skip) {\n\t\treturn parent\n\t}\n\treturn context.WithValue(parent, decisionCtxKey{}, decision)\n}", "title": "" }, { "docid": "b9e9d5cbbfc2aed3f79ef9813c8f6123", "score": "0.42428383", "text": "func DecisionContext(parent context.Context, decision error) context.Context {\n\tif decision == nil || errors.Is(decision, Skip) {\n\t\treturn parent\n\t}\n\treturn context.WithValue(parent, decisionCtxKey{}, decision)\n}", "title": "" }, { "docid": "91b7dad84738e1983789a084d6527d55", "score": "0.4237365", "text": "func (m *MockECSAPI) DiscoverPollEndpointWithContext(arg0 context.Context, arg1 *ecs.DiscoverPollEndpointInput, arg2 ...request.Option) (*ecs.DiscoverPollEndpointOutput, 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, \"DiscoverPollEndpointWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecs.DiscoverPollEndpointOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "17bee7a1c7862a4ccf2cb377551a8571", "score": "0.42337593", "text": "func (m *MockSSMAPI) GetMaintenanceWindowExecutionTaskWithContext(arg0 context.Context, arg1 *ssm.GetMaintenanceWindowExecutionTaskInput, arg2 ...request.Option) (*ssm.GetMaintenanceWindowExecutionTaskOutput, 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, \"GetMaintenanceWindowExecutionTaskWithContext\", varargs...)\n\tret0, _ := ret[0].(*ssm.GetMaintenanceWindowExecutionTaskOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5777100a769e8f6359b1156d7392b9ac", "score": "0.4226656", "text": "func (c *Route53RecoveryControlConfig) WaitUntilControlPanelCreatedWithContext(ctx aws.Context, input *DescribeControlPanelInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilControlPanelCreated\",\n\t\tMaxAttempts: 26,\n\t\tDelay: request.ConstantWaiterDelay(5 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"ControlPanel.Status\",\n\t\t\t\tExpected: \"DEPLOYED\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"ControlPanel.Status\",\n\t\t\t\tExpected: \"PENDING\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.StatusWaiterMatch,\n\t\t\t\tExpected: 500,\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeControlPanelInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeControlPanelRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "22a66d7c456fbc851adcd8a519bebdb7", "score": "0.4199163", "text": "func ContextWithLongPollTarget(ctx context.Context, target string) context.Context {\n\treturn context.WithValue(ctx, longPollTargetKey, target)\n}", "title": "" }, { "docid": "b7e9adf94116acc2cbd296de1a6d09b8", "score": "0.41789088", "text": "func (h *Handler) RespondDecisionTaskFailed(\n\tctx context.Context,\n\twrappedRequest *hist.RespondDecisionTaskFailedRequest,\n) (retError error) {\n\n\tdefer log.CapturePanic(h.GetLogger(), &retError)\n\th.startWG.Wait()\n\n\tscope := metrics.HistoryRespondDecisionTaskFailedScope\n\th.metricsClient.IncCounter(scope, metrics.CadenceRequests)\n\tsw := h.metricsClient.StartTimer(scope, metrics.CadenceLatency)\n\tdefer sw.Stop()\n\n\tdomainID := wrappedRequest.GetDomainUUID()\n\tif domainID == \"\" {\n\t\treturn h.error(errDomainNotSet, scope, domainID, \"\")\n\t}\n\n\tif ok := h.rateLimiter.Allow(); !ok {\n\t\treturn h.error(errHistoryHostThrottle, scope, domainID, \"\")\n\t}\n\n\tfailedRequest := wrappedRequest.FailedRequest\n\ttoken, err0 := h.tokenSerializer.Deserialize(failedRequest.TaskToken)\n\tif err0 != nil {\n\t\terr0 = &gen.BadRequestError{Message: fmt.Sprintf(\"Error deserializing task token. Error: %v\", err0)}\n\t\treturn h.error(err0, scope, domainID, \"\")\n\t}\n\n\th.Service.GetLogger().Debug(fmt.Sprintf(\"RespondDecisionTaskFailed. DomainID: %v, WorkflowID: %v, RunID: %v, ScheduleID: %v\",\n\t\ttoken.DomainID,\n\t\ttoken.WorkflowID,\n\t\ttoken.RunID,\n\t\ttoken.ScheduleID))\n\n\terr0 = validateTaskToken(token)\n\tif err0 != nil {\n\t\treturn h.error(err0, scope, domainID, \"\")\n\t}\n\tworkflowID := token.WorkflowID\n\n\tengine, err1 := h.controller.GetEngine(workflowID)\n\tif err1 != nil {\n\t\treturn h.error(err1, scope, domainID, workflowID)\n\t}\n\n\terr2 := engine.RespondDecisionTaskFailed(ctx, wrappedRequest)\n\tif err2 != nil {\n\t\treturn h.error(err2, scope, domainID, workflowID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "626e04bd0151757be341902e938674d4", "score": "0.41446722", "text": "func (p CheckPolicy) WithContext(ctx context.Context) CheckPolicy { // nolint\n\tp.context = ExtractValueFromContext(ctx)\n\treturn p\n}", "title": "" }, { "docid": "e2fb7d8e4f6e175e347ad512bf2de6b8", "score": "0.4126208", "text": "func (m *MockCloudFormationAPI) DescribeStackDriftDetectionStatusWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackDriftDetectionStatusInput, arg2 ...request.Option) (*cloudformation.DescribeStackDriftDetectionStatusOutput, 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, \"DescribeStackDriftDetectionStatusWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudformation.DescribeStackDriftDetectionStatusOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a795d582dc7df645025872b77d9db394", "score": "0.41241232", "text": "func (c *DatabaseMigrationService) DescribeReplicationTaskIndividualAssessmentsWithContext(ctx aws.Context, input *DescribeReplicationTaskIndividualAssessmentsInput, opts ...request.Option) (*DescribeReplicationTaskIndividualAssessmentsOutput, error) {\n\treq, out := c.DescribeReplicationTaskIndividualAssessmentsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "2b2b89f78931ec017e8a312cf0f97e6c", "score": "0.41051948", "text": "func (c *Route53RecoveryControlConfig) WaitUntilControlPanelDeletedWithContext(ctx aws.Context, input *DescribeControlPanelInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilControlPanelDeleted\",\n\t\tMaxAttempts: 26,\n\t\tDelay: request.ConstantWaiterDelay(5 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.StatusWaiterMatch,\n\t\t\t\tExpected: 404,\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"ControlPanel.Status\",\n\t\t\t\tExpected: \"PENDING_DELETION\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.StatusWaiterMatch,\n\t\t\t\tExpected: 500,\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeControlPanelInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeControlPanelRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "7b12c1212d58d3782b7401be43a6cad8", "score": "0.41025943", "text": "func (mr *MockSSMAPIMockRecorder) GetMaintenanceWindowTaskWithContext(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, \"GetMaintenanceWindowTaskWithContext\", reflect.TypeOf((*MockSSMAPI)(nil).GetMaintenanceWindowTaskWithContext), varargs...)\n}", "title": "" }, { "docid": "a5b0638c61d8da7acb4fca06da5ff8b3", "score": "0.40869278", "text": "func (m *MockHandler) PollForActivityTask(arg0 context.Context, arg1 *types.MatchingPollForActivityTaskRequest) (*types.PollForActivityTaskResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PollForActivityTask\", arg0, arg1)\n\tret0, _ := ret[0].(*types.PollForActivityTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "036edeb8bdf11100acf4c073de81d176", "score": "0.4083394", "text": "func (m *MockCloudFormationAPI) DetectStackResourceDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackResourceDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackResourceDriftOutput, 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, \"DetectStackResourceDriftWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudformation.DetectStackResourceDriftOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fb2a6126d4e55688226f8d37ae47daab", "score": "0.40752184", "text": "func (m *MockHandler) PollForActivityTask(arg0 context.Context, arg1 *types.PollForActivityTaskRequest) (*types.PollForActivityTaskResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PollForActivityTask\", arg0, arg1)\n\tret0, _ := ret[0].(*types.PollForActivityTaskResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "0b4ee5adec268b9ddba3395a500ffa65", "score": "0.40463373", "text": "func (m *MockECSAPI) StopTaskWithContext(arg0 context.Context, arg1 *ecs.StopTaskInput, arg2 ...request.Option) (*ecs.StopTaskOutput, 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, \"StopTaskWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecs.StopTaskOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ff3428982802910bb79178489c040cff", "score": "0.40070882", "text": "func (m *MockSSMAPI) UpdateMaintenanceWindowTaskWithContext(arg0 context.Context, arg1 *ssm.UpdateMaintenanceWindowTaskInput, arg2 ...request.Option) (*ssm.UpdateMaintenanceWindowTaskOutput, 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, \"UpdateMaintenanceWindowTaskWithContext\", varargs...)\n\tret0, _ := ret[0].(*ssm.UpdateMaintenanceWindowTaskOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ec381b58364d706d3acefadf668a0046", "score": "0.40068212", "text": "func (v *PollForDecisionTaskResponse) GetDecisionInfo() (o *shared.TransientDecisionInfo) {\n\tif v != nil && v.DecisionInfo != nil {\n\t\treturn v.DecisionInfo\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2db91a4c05b13ddd770c9b0f95eafe5f", "score": "0.39779627", "text": "func (c Client) UpdateWithContext(context context.Context, input *UpdateTaskChannelInput) (*UpdateTaskChannelResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodPost,\n\t\tURI: \"/Workspaces/{workspaceSid}/TaskChannels/{sid}\",\n\t\tContentType: client.URLEncoded,\n\t\tPathParams: map[string]string{\n\t\t\t\"workspaceSid\": c.workspaceSid,\n\t\t\t\"sid\": c.sid,\n\t\t},\n\t}\n\n\tif input == nil {\n\t\tinput = &UpdateTaskChannelInput{}\n\t}\n\n\tresponse := &UpdateTaskChannelResponse{}\n\tif err := c.client.Send(context, op, input, response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "ac507bf4728185df6b58cc11592ad941", "score": "0.39715013", "text": "func (c *CodePipeline) PollForThirdPartyJobsWithContext(ctx aws.Context, input *PollForThirdPartyJobsInput, opts ...request.Option) (*PollForThirdPartyJobsOutput, error) {\n\treq, out := c.PollForThirdPartyJobsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "38ed72f3fef7cb75409429afc99e0a20", "score": "0.39321342", "text": "func (m *PolicyDecisionPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "dbba9459810dff616f97428ecba8bc8f", "score": "0.39233625", "text": "func Poll(ctx context.Context, poller func(chan<- bool), backoffDuration time.Duration) error {\n\tdone := make(chan bool)\n\tfor {\n\t\tgo poller(done)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\"failed to complete polling within the timeout\")\n\t\tcase <-done:\n\t\t\tlog.Infof(\"successfully completed the polling function\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t\ttime.Sleep(backoffDuration)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31fd71aba9a42a3a30e76236630a5d17", "score": "0.39225772", "text": "func (c *CodePipeline) PollForJobsWithContext(ctx aws.Context, input *PollForJobsInput, opts ...request.Option) (*PollForJobsOutput, error) {\n\treq, out := c.PollForJobsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "232df31699ab620e20b9a47f374641e2", "score": "0.39090818", "text": "func (c *DatabaseMigrationService) DescribeReplicationTaskAssessmentResultsWithContext(ctx aws.Context, input *DescribeReplicationTaskAssessmentResultsInput, opts ...request.Option) (*DescribeReplicationTaskAssessmentResultsOutput, error) {\n\treq, out := c.DescribeReplicationTaskAssessmentResultsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "1149335a0b53870c9be793454277f25e", "score": "0.39069465", "text": "func (v *PollForDecisionTaskResponse) Equals(rhs *PollForDecisionTaskResponse) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.TaskToken == nil && rhs.TaskToken == nil) || (v.TaskToken != nil && rhs.TaskToken != nil && bytes.Equal(v.TaskToken, rhs.TaskToken))) {\n\t\treturn false\n\t}\n\tif !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {\n\t\treturn false\n\t}\n\tif !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.PreviousStartedEventId, rhs.PreviousStartedEventId) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.StartedEventId, rhs.StartedEventId) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.Attempt, rhs.Attempt) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.NextEventId, rhs.NextEventId) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.BacklogCountHint, rhs.BacklogCountHint) {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.StickyExecutionEnabled, rhs.StickyExecutionEnabled) {\n\t\treturn false\n\t}\n\tif !((v.Query == nil && rhs.Query == nil) || (v.Query != nil && rhs.Query != nil && v.Query.Equals(rhs.Query))) {\n\t\treturn false\n\t}\n\tif !((v.DecisionInfo == nil && rhs.DecisionInfo == nil) || (v.DecisionInfo != nil && rhs.DecisionInfo != nil && v.DecisionInfo.Equals(rhs.DecisionInfo))) {\n\t\treturn false\n\t}\n\tif !((v.WorkflowExecutionTaskList == nil && rhs.WorkflowExecutionTaskList == nil) || (v.WorkflowExecutionTaskList != nil && rhs.WorkflowExecutionTaskList != nil && v.WorkflowExecutionTaskList.Equals(rhs.WorkflowExecutionTaskList))) {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.EventStoreVersion, rhs.EventStoreVersion) {\n\t\treturn false\n\t}\n\tif !((v.BranchToken == nil && rhs.BranchToken == nil) || (v.BranchToken != nil && rhs.BranchToken != nil && bytes.Equal(v.BranchToken, rhs.BranchToken))) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.ScheduledTimestamp, rhs.ScheduledTimestamp) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.StartedTimestamp, rhs.StartedTimestamp) {\n\t\treturn false\n\t}\n\tif !((v.Queries == nil && rhs.Queries == nil) || (v.Queries != nil && rhs.Queries != nil && _Map_String_WorkflowQuery_Equals(v.Queries, rhs.Queries))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "58c8ed3bef3d6424c468c556c410065b", "score": "0.39012825", "text": "func (m *MockClient) RespondDecisionTaskFailed(arg0 context.Context, arg1 *types.RespondDecisionTaskFailedRequest, arg2 ...yarpc.CallOption) 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, \"RespondDecisionTaskFailed\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "53cc74f91d9a9278801e09966c61a90f", "score": "0.38991025", "text": "func (mr *MockECSAPIMockRecorder) StopTaskWithContext(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, \"StopTaskWithContext\", reflect.TypeOf((*MockECSAPI)(nil).StopTaskWithContext), varargs...)\n}", "title": "" }, { "docid": "9f837f65f8bfa44644c69f622d65e858", "score": "0.38965946", "text": "func (o *WatchTaskParams) WithContext(ctx context.Context) *WatchTaskParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c75571bdc1bf0bf4118f2594c2a541e8", "score": "0.38947704", "text": "func (m *MockCloudFormationAPI) DetectStackDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackDriftOutput, 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, \"DetectStackDriftWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudformation.DetectStackDriftOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d8428f99be568155f5ba83b05cf54252", "score": "0.3874352", "text": "func (v *PollForActivityTaskRequest) GetPollRequest() (o *shared.PollForActivityTaskRequest) {\n\tif v != nil && v.PollRequest != nil {\n\t\treturn v.PollRequest\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ac83f67ad449096e9ea5209bf4fd7084", "score": "0.38690564", "text": "func ToHistoryServiceRespondDecisionTaskFailedArgs(t *history.HistoryService_RespondDecisionTaskFailed_Args) *types.HistoryServiceRespondDecisionTaskFailedArgs {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.HistoryServiceRespondDecisionTaskFailedArgs{\n\t\tFailedRequest: ToHistoryRespondDecisionTaskFailedRequest(t.FailedRequest),\n\t}\n}", "title": "" }, { "docid": "0e56ee9f0d897c1cd0e4064cd4a225ad", "score": "0.38581252", "text": "func ValidateOTPForLinkedAccountWithContext(ctx context.Context, data *ValidateOTPForLinkedAccountParams) (*xendit.ValidatedLinkedAccount, *xendit.Error) {\n\tclient, err := getClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client.ValidateOTPForLinkedAccountWithContext(ctx, data)\n}", "title": "" }, { "docid": "11e9432a3dbc4bd7988a688a2bbd3b83", "score": "0.38577932", "text": "func (m *MockCloudFormationAPI) DetectStackSetDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackSetDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackSetDriftOutput, 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, \"DetectStackSetDriftWithContext\", varargs...)\n\tret0, _ := ret[0].(*cloudformation.DetectStackSetDriftOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "69a28df61ec61753c6408e95de0725ac", "score": "0.38454795", "text": "func (mr *MockSSMAPIMockRecorder) GetMaintenanceWindowExecutionTaskWithContext(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, \"GetMaintenanceWindowExecutionTaskWithContext\", reflect.TypeOf((*MockSSMAPI)(nil).GetMaintenanceWindowExecutionTaskWithContext), varargs...)\n}", "title": "" }, { "docid": "fe7af2eddc1baf75e9329dec5c8aada1", "score": "0.3842041", "text": "func (v *PollForDecisionTaskResponse) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [17]string\n\ti := 0\n\tif v.TaskToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"TaskToken: %v\", v.TaskToken)\n\t\ti++\n\t}\n\tif v.WorkflowExecution != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowExecution: %v\", v.WorkflowExecution)\n\t\ti++\n\t}\n\tif v.WorkflowType != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowType: %v\", v.WorkflowType)\n\t\ti++\n\t}\n\tif v.PreviousStartedEventId != nil {\n\t\tfields[i] = fmt.Sprintf(\"PreviousStartedEventId: %v\", *(v.PreviousStartedEventId))\n\t\ti++\n\t}\n\tif v.StartedEventId != nil {\n\t\tfields[i] = fmt.Sprintf(\"StartedEventId: %v\", *(v.StartedEventId))\n\t\ti++\n\t}\n\tif v.Attempt != nil {\n\t\tfields[i] = fmt.Sprintf(\"Attempt: %v\", *(v.Attempt))\n\t\ti++\n\t}\n\tif v.NextEventId != nil {\n\t\tfields[i] = fmt.Sprintf(\"NextEventId: %v\", *(v.NextEventId))\n\t\ti++\n\t}\n\tif v.BacklogCountHint != nil {\n\t\tfields[i] = fmt.Sprintf(\"BacklogCountHint: %v\", *(v.BacklogCountHint))\n\t\ti++\n\t}\n\tif v.StickyExecutionEnabled != nil {\n\t\tfields[i] = fmt.Sprintf(\"StickyExecutionEnabled: %v\", *(v.StickyExecutionEnabled))\n\t\ti++\n\t}\n\tif v.Query != nil {\n\t\tfields[i] = fmt.Sprintf(\"Query: %v\", v.Query)\n\t\ti++\n\t}\n\tif v.DecisionInfo != nil {\n\t\tfields[i] = fmt.Sprintf(\"DecisionInfo: %v\", v.DecisionInfo)\n\t\ti++\n\t}\n\tif v.WorkflowExecutionTaskList != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowExecutionTaskList: %v\", v.WorkflowExecutionTaskList)\n\t\ti++\n\t}\n\tif v.EventStoreVersion != nil {\n\t\tfields[i] = fmt.Sprintf(\"EventStoreVersion: %v\", *(v.EventStoreVersion))\n\t\ti++\n\t}\n\tif v.BranchToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"BranchToken: %v\", v.BranchToken)\n\t\ti++\n\t}\n\tif v.ScheduledTimestamp != nil {\n\t\tfields[i] = fmt.Sprintf(\"ScheduledTimestamp: %v\", *(v.ScheduledTimestamp))\n\t\ti++\n\t}\n\tif v.StartedTimestamp != nil {\n\t\tfields[i] = fmt.Sprintf(\"StartedTimestamp: %v\", *(v.StartedTimestamp))\n\t\ti++\n\t}\n\tif v.Queries != nil {\n\t\tfields[i] = fmt.Sprintf(\"Queries: %v\", v.Queries)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"PollForDecisionTaskResponse{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "93f79628b37ef9a5f6a8750f00e5c05c", "score": "0.3836302", "text": "func (h *Handler) ScheduleDecisionTask(\n\tctx context.Context,\n\trequest *hist.ScheduleDecisionTaskRequest,\n) (retError error) {\n\n\tdefer log.CapturePanic(h.GetLogger(), &retError)\n\th.startWG.Wait()\n\n\tscope := metrics.HistoryScheduleDecisionTaskScope\n\th.metricsClient.IncCounter(scope, metrics.CadenceRequests)\n\tsw := h.metricsClient.StartTimer(scope, metrics.CadenceLatency)\n\tdefer sw.Stop()\n\n\tdomainID := request.GetDomainUUID()\n\tif domainID == \"\" {\n\t\treturn h.error(errDomainNotSet, scope, domainID, \"\")\n\t}\n\n\tif ok := h.rateLimiter.Allow(); !ok {\n\t\treturn h.error(errHistoryHostThrottle, scope, domainID, \"\")\n\t}\n\n\tif request.WorkflowExecution == nil {\n\t\treturn h.error(errWorkflowExecutionNotSet, scope, domainID, \"\")\n\t}\n\n\tworkflowExecution := request.WorkflowExecution\n\tworkflowID := workflowExecution.GetWorkflowId()\n\tengine, err1 := h.controller.GetEngine(workflowID)\n\tif err1 != nil {\n\t\treturn h.error(err1, scope, domainID, workflowID)\n\t}\n\n\terr2 := engine.ScheduleDecisionTask(ctx, request)\n\tif err2 != nil {\n\t\treturn h.error(err2, scope, domainID, workflowID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f67551220587fed166e882a6b6bdaa7a", "score": "0.38355637", "text": "func (h *Handler) RespondDecisionTaskCompleted(\n\tctx context.Context,\n\twrappedRequest *hist.RespondDecisionTaskCompletedRequest,\n) (resp *hist.RespondDecisionTaskCompletedResponse, retError error) {\n\n\tdefer log.CapturePanic(h.GetLogger(), &retError)\n\th.startWG.Wait()\n\n\tscope := metrics.HistoryRespondDecisionTaskCompletedScope\n\th.metricsClient.IncCounter(scope, metrics.CadenceRequests)\n\tsw := h.metricsClient.StartTimer(scope, metrics.CadenceLatency)\n\tdefer sw.Stop()\n\n\tdomainID := wrappedRequest.GetDomainUUID()\n\tif domainID == \"\" {\n\t\treturn nil, h.error(errDomainNotSet, scope, domainID, \"\")\n\t}\n\n\tif ok := h.rateLimiter.Allow(); !ok {\n\t\treturn nil, h.error(errHistoryHostThrottle, scope, domainID, \"\")\n\t}\n\n\tcompleteRequest := wrappedRequest.CompleteRequest\n\tif len(completeRequest.Decisions) == 0 {\n\t\th.metricsClient.IncCounter(scope, metrics.EmptyCompletionDecisionsCounter)\n\t}\n\ttoken, err0 := h.tokenSerializer.Deserialize(completeRequest.TaskToken)\n\tif err0 != nil {\n\t\terr0 = &gen.BadRequestError{Message: fmt.Sprintf(\"Error deserializing task token. Error: %v\", err0)}\n\t\treturn nil, h.error(err0, scope, domainID, \"\")\n\t}\n\n\th.Service.GetLogger().Debug(fmt.Sprintf(\"RespondDecisionTaskCompleted. DomainID: %v, WorkflowID: %v, RunID: %v, ScheduleID: %v\",\n\t\ttoken.DomainID,\n\t\ttoken.WorkflowID,\n\t\ttoken.RunID,\n\t\ttoken.ScheduleID))\n\n\terr0 = validateTaskToken(token)\n\tif err0 != nil {\n\t\treturn nil, h.error(err0, scope, domainID, \"\")\n\t}\n\tworkflowID := token.WorkflowID\n\n\tengine, err1 := h.controller.GetEngine(workflowID)\n\tif err1 != nil {\n\t\treturn nil, h.error(err1, scope, domainID, workflowID)\n\t}\n\n\tresponse, err2 := engine.RespondDecisionTaskCompleted(ctx, wrappedRequest)\n\tif err2 != nil {\n\t\treturn nil, h.error(err2, scope, domainID, workflowID)\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "9918e9f45b2b7a606645366abb03d724", "score": "0.3831968", "text": "func (c *DatabaseMigrationService) StopReplicationTaskWithContext(ctx aws.Context, input *StopReplicationTaskInput, opts ...request.Option) (*StopReplicationTaskOutput, error) {\n\treq, out := c.StopReplicationTaskRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "9ecc76a51a71edbd623198651d3b7554", "score": "0.3819887", "text": "func (c *CodeGuruReviewer) WaitUntilCodeReviewCompletedWithContext(ctx aws.Context, input *DescribeCodeReviewInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilCodeReviewCompleted\",\n\t\tMaxAttempts: 180,\n\t\tDelay: request.ConstantWaiterDelay(10 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"CodeReview.State\",\n\t\t\t\tExpected: \"Completed\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.FailureWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"CodeReview.State\",\n\t\t\t\tExpected: \"Failed\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"CodeReview.State\",\n\t\t\t\tExpected: \"Pending\",\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeCodeReviewInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeCodeReviewRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "8c93c83199f72e32a663f4dc773e0117", "score": "0.37966785", "text": "func (m *MockECSAPI) WaitUntilTasksRunningWithContext(arg0 context.Context, arg1 *ecs.DescribeTasksInput, arg2 ...request.WaiterOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilTasksRunningWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "3906cea7902f7a91b740f92c5c8b519a", "score": "0.37887496", "text": "func WaitContext(ctx context.Context, chk checker.Checker, opts ...Option) error {\n\toptions := &options{\n\t\ttimeout: 10 * time.Second,\n\t\tinterval: time.Second,\n\t\tinvertCheck: false,\n\t\tlogger: logr.Discard(),\n\t\tbackoffPolicy: BackoffPolicyLinear,\n\t\tbackoffExponentialMaxInterval: 5 * time.Second,\n\t\tbackoffCoefficient: 2.0,\n\t}\n\n\t// apply the list of options to waiter\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\n\t// Ignore timeout context when the timeout is unlimited\n\tif options.timeout != 0 {\n\t\tvar cancel func()\n\t\tctx, cancel = context.WithTimeout(ctx, options.timeout)\n\t\tdefer cancel()\n\t}\n\n\tvar chkName string\n\tif t := reflect.TypeOf(chk); t.Kind() == reflect.Ptr {\n\t\tchkName = t.Elem().Name()\n\t} else {\n\t\tchkName = t.Name()\n\t}\n\n\tchkID, err := chk.Identity()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//This is a counter for exponential backoff\n\tretries := 0\n\n\tfor {\n\t\toptions.logger.Info(fmt.Sprintf(\"[%s] Checking the %s ...\", chkName, chkID))\n\n\t\terr := chk.Check(ctx)\n\t\tif err != nil {\n\t\t\tvar expectedError *checker.ExpectedError\n\t\t\tif errors.As(err, &expectedError) {\n\t\t\t\toptions.logger.Error(expectedError, \"Expectation failed\", expectedError.Details()...)\n\t\t\t} else {\n\t\t\t\tif !errors.Is(err, context.DeadlineExceeded) {\n\t\t\t\t\toptions.logger.Error(err, \"Error occurred\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar waitDuration time.Duration\n\t\tif options.backoffPolicy == BackoffPolicyExponential {\n\t\t\twaitDuration = exponentialBackoff(retries, options.backoffCoefficient, options.interval, options.backoffExponentialMaxInterval)\n\t\t} else if options.backoffPolicy == BackoffPolicyLinear {\n\t\t\twaitDuration = options.interval\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"invalid backoff policy: %s\", options.backoffPolicy)\n\t\t}\n\n\t\tif options.invertCheck == true {\n\t\t\tif err == nil {\n\t\t\t\tgoto CONTINUE\n\t\t\t}\n\n\t\t\tbreak\n\t\t}\n\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\n\tCONTINUE:\n\t\tretries++\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(waitDuration):\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a6e8194a3b2e5ae85f4584fd0c49ff43", "score": "0.37866992", "text": "func (c *IAM) WaitUntilPolicyExistsWithContext(ctx aws.Context, input *GetPolicyInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilPolicyExists\",\n\t\tMaxAttempts: 20,\n\t\tDelay: request.ConstantWaiterDelay(1 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.StatusWaiterMatch,\n\t\t\t\tExpected: 200,\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.RetryWaiterState,\n\t\t\t\tMatcher: request.ErrorWaiterMatch,\n\t\t\t\tExpected: \"NoSuchEntity\",\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *GetPolicyInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.GetPolicyRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "97b97c18541842f82a5207ff6c51aebb", "score": "0.37780553", "text": "func (c *client) DialUsingCredentialsWithContext(ctx context.Context, sess *session.Session, host, port, secretKey string, opts ...grpc.DialOption) error {\n\tcm := credentialsmanager.New().UsingSDKV1Session(sess)\n\treturn c.DialUsingCredentialsManager(ctx, cm, host, port, secretKey, opts...)\n}", "title": "" }, { "docid": "34edd0de02462d0c80a2ceaaf6472b0f", "score": "0.37774906", "text": "func NewPollTicker(interval time.Duration, disabled bool) *PollTicker {\n\treturn &PollTicker{\n\t\tticker: utils.NewPausableTicker(interval),\n\t\tinterval: interval,\n\t\tdisabled: disabled,\n\t}\n}", "title": "" }, { "docid": "08f375565a6d32b80307ad8663593761", "score": "0.37744403", "text": "func (m *MockSSMAPI) DescribeAvailablePatchesWithContext(arg0 context.Context, arg1 *ssm.DescribeAvailablePatchesInput, arg2 ...request.Option) (*ssm.DescribeAvailablePatchesOutput, 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, \"DescribeAvailablePatchesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ssm.DescribeAvailablePatchesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8f555dda5d75b2e8aa9e9a90f5f1e760", "score": "0.3757915", "text": "func (m *MockECSAPI) WaitUntilTasksStoppedWithContext(arg0 context.Context, arg1 *ecs.DescribeTasksInput, arg2 ...request.WaiterOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilTasksStoppedWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "abcc27b04e98cf95953ecabf11750c4d", "score": "0.37475112", "text": "func (m *MockECSAPI) GetTaskProtectionWithContext(arg0 context.Context, arg1 *ecs.GetTaskProtectionInput, arg2 ...request.Option) (*ecs.GetTaskProtectionOutput, 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, \"GetTaskProtectionWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecs.GetTaskProtectionOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6ce0da8981859f9a2af6d2c5a268102d", "score": "0.37431666", "text": "func (c *Transfer) WaitUntilServerOfflineWithContext(ctx aws.Context, input *DescribeServerInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilServerOffline\",\n\t\tMaxAttempts: 120,\n\t\tDelay: request.ConstantWaiterDelay(30 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"Server.State\",\n\t\t\t\tExpected: \"OFFLINE\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tState: request.FailureWaiterState,\n\t\t\t\tMatcher: request.PathWaiterMatch, Argument: \"Server.State\",\n\t\t\t\tExpected: \"STOP_FAILED\",\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeServerInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeServerRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "title": "" }, { "docid": "bfe2559d922dfc21cfeccb1470aceca5", "score": "0.37408757", "text": "func (m *MockShield) DisableApplicationLayerAutomaticResponseWithContext(arg0 context.Context, arg1 *shield.DisableApplicationLayerAutomaticResponseInput, arg2 ...request.Option) (*shield.DisableApplicationLayerAutomaticResponseOutput, 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, \"DisableApplicationLayerAutomaticResponseWithContext\", varargs...)\n\tret0, _ := ret[0].(*shield.DisableApplicationLayerAutomaticResponseOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "14e8a9cd411eebc5f866ad4d2438704d", "score": "0.3734966", "text": "func (v *MatchingService_PollForDecisionTask_Args) MethodName() string {\n\treturn \"PollForDecisionTask\"\n}", "title": "" }, { "docid": "6137d31520192cef44dac75f0a1f3cd9", "score": "0.37313795", "text": "func (m *MockECSAPI) RunTaskWithContext(arg0 context.Context, arg1 *ecs.RunTaskInput, arg2 ...request.Option) (*ecs.RunTaskOutput, 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, \"RunTaskWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecs.RunTaskOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "abbb78604ea7e37c7b5c96070a1b71ea", "score": "0.37310526", "text": "func (mr *MockCloudFormationAPIMockRecorder) DetectStackResourceDriftWithContext(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, \"DetectStackResourceDriftWithContext\", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackResourceDriftWithContext), varargs...)\n}", "title": "" }, { "docid": "07fa8341b044f8ad550d0f3eed3e4aad", "score": "0.37165833", "text": "func (c *ECS) DescribeTasksCommonWithContext(ctx volcengine.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DescribeTasksCommonRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e42542fb133e6fb65f93568cd617094b", "score": "0.37139553", "text": "func (m *MockKMSAPI) GetKeyPolicyWithContext(arg0 context.Context, arg1 *kms.GetKeyPolicyInput, arg2 ...request.Option) (*kms.GetKeyPolicyOutput, 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, \"GetKeyPolicyWithContext\", varargs...)\n\tret0, _ := ret[0].(*kms.GetKeyPolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fd8a9d66c39427a2a45611c7eed36a3d", "score": "0.37139547", "text": "func (m *MockHandler) RespondDecisionTaskFailed(arg0 context.Context, arg1 *types.RespondDecisionTaskFailedRequest) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RespondDecisionTaskFailed\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "8ac823d17fc57742e7944f84611b0546", "score": "0.3698291", "text": "func WithPollProtocol(pp poll.Protocol) Option {\n\treturn func(ops *optionParams) error {\n\t\tops.pp = pp\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a635b45e9bfe39ba70ec8f5baea483ab", "score": "0.3689542", "text": "func (m *MockShield) DisableProactiveEngagementWithContext(arg0 context.Context, arg1 *shield.DisableProactiveEngagementInput, arg2 ...request.Option) (*shield.DisableProactiveEngagementOutput, 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, \"DisableProactiveEngagementWithContext\", varargs...)\n\tret0, _ := ret[0].(*shield.DisableProactiveEngagementOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8104713847aadaa02e40581e9316ba56", "score": "0.36867934", "text": "func (v *MatchingService_PollForDecisionTask_Args) Equals(rhs *MatchingService_PollForDecisionTask_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.PollRequest == nil && rhs.PollRequest == nil) || (v.PollRequest != nil && rhs.PollRequest != nil && v.PollRequest.Equals(rhs.PollRequest))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "442377a89db176975275a306e0313614", "score": "0.36850083", "text": "func WaitWithContext(ctx context.Context, checker checker.Checker, opts ...Option) error {\n\treturn WaitContext(ctx, checker, opts...)\n}", "title": "" }, { "docid": "9626d7aee3252469fb1dcc70a9e61e73", "score": "0.36832604", "text": "func (catalogManagement *CatalogManagementV1) GetOfferingAuditWithContext(ctx context.Context, getOfferingAuditOptions *GetOfferingAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getOfferingAuditOptions, \"getOfferingAuditOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getOfferingAuditOptions, \"getOfferingAuditOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"catalog_identifier\": *getOfferingAuditOptions.CatalogIdentifier,\n\t\t\"offering_id\": *getOfferingAuditOptions.OfferingID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/audit`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getOfferingAuditOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"catalog_management\", \"V1\", \"GetOfferingAudit\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = catalogManagement.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalAuditLog)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4c5040f8513c01a6e9aca24a16f7adb7", "score": "0.3683038", "text": "func (mr *MockSSMAPIMockRecorder) UpdateMaintenanceWindowTaskWithContext(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, \"UpdateMaintenanceWindowTaskWithContext\", reflect.TypeOf((*MockSSMAPI)(nil).UpdateMaintenanceWindowTaskWithContext), varargs...)\n}", "title": "" }, { "docid": "9366dd5a6f470b2127e65f02d130ef77", "score": "0.36808097", "text": "func (mr *MockClientMockRecorder) RespondDecisionTaskFailed(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, \"RespondDecisionTaskFailed\", reflect.TypeOf((*MockClient)(nil).RespondDecisionTaskFailed), varargs...)\n}", "title": "" }, { "docid": "fadd13ff4c02ba58992b93838767d364", "score": "0.36700526", "text": "func (mr *MockClientMockRecorder) PollForActivityTask(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, \"PollForActivityTask\", reflect.TypeOf((*MockClient)(nil).PollForActivityTask), varargs...)\n}", "title": "" }, { "docid": "54e3407ceaf9a4a8204013b786c49ffa", "score": "0.3668323", "text": "func (c *DatabaseMigrationService) StartReplicationTaskAssessmentWithContext(ctx aws.Context, input *StartReplicationTaskAssessmentInput, opts ...request.Option) (*StartReplicationTaskAssessmentOutput, error) {\n\treq, out := c.StartReplicationTaskAssessmentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "a384705e4ed8d3d099e8247a8e116742", "score": "0.36523145", "text": "func WithPollTimeout(t time.Duration) Option {\n\treturn func(o *options) {\n\t\to.pollTimeout = t\n\t}\n}", "title": "" }, { "docid": "7dcc6e47e40077beebfe561aedeeee90", "score": "0.36430612", "text": "func (c *CloudSearchDomain) SuggestWithContext(ctx aws.Context, input *SuggestInput, opts ...request.Option) (*SuggestOutput, error) {\n\treq, out := c.SuggestRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "fad082b567ddbdb9cc765d36d8e1b3bd", "score": "0.36243746", "text": "func (_m *SitewiseClient) WaitUntilPortalActiveWithContext(_a0 context.Context, _a1 *iotsitewise.DescribePortalInput, _a2 ...request.WaiterOption) error {\n\t_va := make([]interface{}, len(_a2))\n\tfor _i := range _a2 {\n\t\t_va[_i] = _a2[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, _a0, _a1)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, *iotsitewise.DescribePortalInput, ...request.WaiterOption) 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": "" }, { "docid": "9fcb9012c39a87bccebdd60cd0495587", "score": "0.36243692", "text": "func (c *IAM) DetachUserPolicyWithContext(ctx aws.Context, input *DetachUserPolicyInput, opts ...request.Option) (*DetachUserPolicyOutput, error) {\n\treq, out := c.DetachUserPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "85ca992563af0fde395131c6268cb9ae", "score": "0.36229807", "text": "func FromHistoryServiceScheduleDecisionTaskArgs(t *types.HistoryServiceScheduleDecisionTaskArgs) *history.HistoryService_ScheduleDecisionTask_Args {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &history.HistoryService_ScheduleDecisionTask_Args{\n\t\tScheduleRequest: FromScheduleDecisionTaskRequest(t.ScheduleRequest),\n\t}\n}", "title": "" }, { "docid": "414f2a43e666e9df3656d59214ae5a6d", "score": "0.36189985", "text": "func (p *CheckPolicy) Context() Context {\n\treturn p.context\n}", "title": "" }, { "docid": "550feaa79a1681ff091504b8d0f1f456", "score": "0.3618739", "text": "func ToHistoryServiceScheduleDecisionTaskArgs(t *history.HistoryService_ScheduleDecisionTask_Args) *types.HistoryServiceScheduleDecisionTaskArgs {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.HistoryServiceScheduleDecisionTaskArgs{\n\t\tScheduleRequest: ToScheduleDecisionTaskRequest(t.ScheduleRequest),\n\t}\n}", "title": "" }, { "docid": "07ae46930f8b1e0984d758cca8b4e1ba", "score": "0.36176416", "text": "func (m *MockS3API) ListBucketIntelligentTieringConfigurationsWithContext(arg0 context.Context, arg1 *s3.ListBucketIntelligentTieringConfigurationsInput, arg2 ...request.Option) (*s3.ListBucketIntelligentTieringConfigurationsOutput, 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, \"ListBucketIntelligentTieringConfigurationsWithContext\", varargs...)\n\tret0, _ := ret[0].(*s3.ListBucketIntelligentTieringConfigurationsOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
9647b873210526979d097a3177472b54
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
[ { "docid": "3e013886e6bc1d59a365df69c5ee97c5", "score": "0.78447765", "text": "func (in *ReferenceObject) DeepCopyInto(out *ReferenceObject) {\n\t*out = *in\n}", "title": "" } ]
[ { "docid": "854825ecc9cd3a0495a19df5509c3c2f", "score": "0.8227633", "text": "func (in *Memory) DeepCopyInto(out *Memory) {\n\t*out = *in\n}", "title": "" }, { "docid": "760357bc14dbd63f0878759aca969b71", "score": "0.81385624", "text": "func (in *Output) DeepCopyInto(out *Output) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7301f5678de7282507f88cf56a8f5020", "score": "0.8120162", "text": "func (in *Version) DeepCopyInto(out *Version) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "477d12977ccedc720e9eeed2cceef4ad", "score": "0.80859816", "text": "func (in *Parser) DeepCopyInto(out *Parser) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9277508c6f4a9eb94b5bc53225b87fd6", "score": "0.8066513", "text": "func (in *Size) DeepCopyInto(out *Size) {\n\t*out = *in\n}", "title": "" }, { "docid": "71f7571eb16269b8ded7102013eb2fcb", "score": "0.8059338", "text": "func (in *TargetObj) DeepCopyInto(out *TargetObj) {\n\t*out = *in\n}", "title": "" }, { "docid": "bf7b4b522057ae01ab0d93d4522fe30a", "score": "0.8048466", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "bf7b4b522057ae01ab0d93d4522fe30a", "score": "0.8048466", "text": "func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {\n\t*out = *in\n}", "title": "" }, { "docid": "30d5a6805fd4fa1a057ce4497fc7b0ff", "score": "0.80351156", "text": "func (in *Build) DeepCopyInto(out *Build) {\n\t*out = *in\n}", "title": "" }, { "docid": "bd31f739afee4d8ac0f25b43cee7cdf6", "score": "0.8033947", "text": "func (in *Jmx) DeepCopyInto(out *Jmx) {\n\t*out = *in\n}", "title": "" }, { "docid": "8e8acfb208833240003e7bd04991a6fd", "score": "0.80243134", "text": "func (in *Res) DeepCopyInto(out *Res) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "45607a53c4ae582710d113a58be4b5ca", "score": "0.80229694", "text": "func (in *BackupInvokerRef) DeepCopyInto(out *BackupInvokerRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "cdb1b110aa6c8f15da6e580e063891b8", "score": "0.8006612", "text": "func (in *InputParser) DeepCopyInto(out *InputParser) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "fe843f24d377bc345c3c2bafc6836e50", "score": "0.8001176", "text": "func (in *LDAPCheck) DeepCopyInto(out *LDAPCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "a79d310025d9bad0312cdb9615f67da0", "score": "0.7997681", "text": "func (in *InferenceTarget) DeepCopyInto(out *InferenceTarget) {\n\t*out = *in\n}", "title": "" }, { "docid": "32411e48b0c41369a3b37f1f34c69604", "score": "0.7977746", "text": "func (in *Heapster) DeepCopyInto(out *Heapster) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "15fc36816a874df726f7daacda88349f", "score": "0.797648", "text": "func (in *DataPath) DeepCopyInto(out *DataPath) {\n\t*out = *in\n}", "title": "" }, { "docid": "73b3e2ee8d0f1c30554fc6f775e42f09", "score": "0.7969903", "text": "func (in *Hazelcast) DeepCopyInto(out *Hazelcast) {\n\t*out = *in\n}", "title": "" }, { "docid": "acbc3f1efee5aaa8d03be05054421061", "score": "0.79691386", "text": "func (in *Backup) DeepCopyInto(out *Backup) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7b25b696e89f23360fd8f34af49816dc", "score": "0.7963414", "text": "func (in *RestoreTarget) DeepCopyInto(out *RestoreTarget) {\n\t*out = *in\n\tout.Ref = in.Ref\n\tif in.VolumeMounts != nil {\n\t\tin, out := &in.VolumeMounts, &out.VolumeMounts\n\t\t*out = make([]corev1.VolumeMount, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Replicas != nil {\n\t\tin, out := &in.Replicas, &out.Replicas\n\t\t*out = new(int32)\n\t\t**out = **in\n\t}\n\tif in.VolumeClaimTemplates != nil {\n\t\tin, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates\n\t\t*out = make([]offshootapiapiv1.PersistentVolumeClaim, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Rules != nil {\n\t\tin, out := &in.Rules, &out.Rules\n\t\t*out = make([]Rule, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe55aea8bcbb4c5fb7ce8689ae5b50db", "score": "0.7959444", "text": "func (in *OTLP) DeepCopyInto(out *OTLP) {\n\t*out = *in\n}", "title": "" }, { "docid": "4cc4474c2a1333bf5f947b2294d0b027", "score": "0.795355", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79462665", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79462665", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3c51337658fc0e9d2966273bd3459022", "score": "0.79462665", "text": "func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "0919c719fbed6afefb28478852255757", "score": "0.79458517", "text": "func (in *VfInfo) DeepCopyInto(out *VfInfo) {\n\t*out = *in\n}", "title": "" }, { "docid": "ffd1a2a762b20e39ec3e229a7fa8c82d", "score": "0.7944908", "text": "func (in *Toleration) DeepCopyInto(out *Toleration) {\n\t*out = *in\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.79435134", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "92bd0f9f52c488e2823218fc03f28117", "score": "0.79435134", "text": "func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.79374313", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "f254b9a7e0b67c245be45d8e4adaf4be", "score": "0.79374313", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n}", "title": "" }, { "docid": "01a4a6fa60275bc00731594653970844", "score": "0.7934015", "text": "func (in *ObjectStorageTLSSpec) DeepCopyInto(out *ObjectStorageTLSSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "ae8320d666daf42f7b276f91c508dfdb", "score": "0.79308224", "text": "func (in *File) DeepCopyInto(out *File) {\n\t*out = *in\n}", "title": "" }, { "docid": "5d6676976741906b273edf03cf097f8d", "score": "0.79153347", "text": "func (in *Identity) DeepCopyInto(out *Identity) {\n\t*out = *in\n}", "title": "" }, { "docid": "e7824965b786de83e5edd7c40c1905bd", "score": "0.79148036", "text": "func (in *Cache) DeepCopyInto(out *Cache) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "c06114d198782896449be1949d23d234", "score": "0.79092026", "text": "func (in *IoPerf) DeepCopyInto(out *IoPerf) {\n\t*out = *in\n}", "title": "" }, { "docid": "c615a020c64c11406e2c550e7ecaef60", "score": "0.79038364", "text": "func (in *DingTalk) DeepCopyInto(out *DingTalk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b7393f65fb4d2df141f42b8c195d3860", "score": "0.79036677", "text": "func (in *CanaryResult) DeepCopyInto(out *CanaryResult) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "af229d6e46b09920288a05ff27f2055f", "score": "0.79035586", "text": "func (in *Instance) DeepCopyInto(out *Instance) {\n\t*out = *in\n}", "title": "" }, { "docid": "d7c721157968f6bd706d0455330c4026", "score": "0.7898415", "text": "func (in *TCPCheck) DeepCopyInto(out *TCPCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "778b99573503a518fafd03683f65a07e", "score": "0.7897241", "text": "func (in *KMSEncryptionAlibaba) DeepCopyInto(out *KMSEncryptionAlibaba) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "06a3b3f38b6ff0617d4968300458ec9c", "score": "0.7896163", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "f2e09bb7e9a17cc1e32f0d15d54b1922", "score": "0.78952575", "text": "func (in *NodeResult) DeepCopyInto(out *NodeResult) {\n\t*out = *in\n\tif in.Observations != nil {\n\t\tin, out := &in.Observations, &out.Observations\n\t\t*out = make([]Observation, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f2e09bb7e9a17cc1e32f0d15d54b1922", "score": "0.78952575", "text": "func (in *NodeResult) DeepCopyInto(out *NodeResult) {\n\t*out = *in\n\tif in.Observations != nil {\n\t\tin, out := &in.Observations, &out.Observations\n\t\t*out = make([]Observation, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "dddf435977ebcd6bfaf0b4c062ea8042", "score": "0.78914475", "text": "func (in *Image) DeepCopyInto(out *Image) {\n\t*out = *in\n}", "title": "" }, { "docid": "86e6e9110b4e611d68a6016ced01967e", "score": "0.7889931", "text": "func (in *DNS) DeepCopyInto(out *DNS) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "2c0186ad474559dbf6791ceb1124b087", "score": "0.78861487", "text": "func (in *Rule) DeepCopyInto(out *Rule) {\n\t*out = *in\n\tif in.TargetHosts != nil {\n\t\tin, out := &in.TargetHosts, &out.TargetHosts\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Snapshots != nil {\n\t\tin, out := &in.Snapshots, &out.Snapshots\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Paths != nil {\n\t\tin, out := &in.Paths, &out.Paths\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Include != nil {\n\t\tin, out := &in.Include, &out.Include\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "bf4475f50224fcbecdf3c494868d167b", "score": "0.7883835", "text": "func (in *Json6902) DeepCopyInto(out *Json6902) {\n\t*out = *in\n\tin.Target.DeepCopyInto(&out.Target)\n}", "title": "" }, { "docid": "91acd35f3d3dfc1f65af5ad610c93290", "score": "0.78772044", "text": "func (in *NIC) DeepCopyInto(out *NIC) {\n\t*out = *in\n}", "title": "" }, { "docid": "dfd9b82d38c6fee08dd3cf0209bd1133", "score": "0.78766406", "text": "func (in *Disk) DeepCopyInto(out *Disk) {\n\t*out = *in\n}", "title": "" }, { "docid": "4db8dae318248c89d5b1884921cf3f0c", "score": "0.78720886", "text": "func (in *TestOracle) DeepCopyInto(out *TestOracle) {\n\t*out = *in\n\tif in.Pass != nil {\n\t\tin, out := &in.Pass, &out.Pass\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Fail != nil {\n\t\tin, out := &in.Fail, &out.Fail\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "9b3266dd6bad29cf240af4b4fb444de3", "score": "0.7866232", "text": "func (in *Artifacts) DeepCopyInto(out *Artifacts) {\n\t*out = *in\n}", "title": "" }, { "docid": "77971dc0b377a52b9d2814eb5a6acc6f", "score": "0.78603375", "text": "func (in *ContainerPort) DeepCopyInto(out *ContainerPort) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "29e02c97b127087f995d6b0457b82abc", "score": "0.78584296", "text": "func (in *Checksum) DeepCopyInto(out *Checksum) {\n\t*out = *in\n}", "title": "" }, { "docid": "74741263fc8a9e2990e2e3a20b799143", "score": "0.78578705", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e85c49c1705dd0d0d0a0564220621e8f", "score": "0.7855512", "text": "func (in *Dependency) DeepCopyInto(out *Dependency) {\n\t*out = *in\n}", "title": "" }, { "docid": "370fd9524fb300cb6e294a6ecb9e8a2d", "score": "0.7849087", "text": "func (in *SystemRule) DeepCopyInto(out *SystemRule) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "a9062924f4e13bda7a07fc0c62640c37", "score": "0.78436196", "text": "func (in *BackupTarget) DeepCopyInto(out *BackupTarget) {\n\t*out = *in\n\tout.Ref = in.Ref\n\tif in.Paths != nil {\n\t\tin, out := &in.Paths, &out.Paths\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.VolumeMounts != nil {\n\t\tin, out := &in.VolumeMounts, &out.VolumeMounts\n\t\t*out = make([]corev1.VolumeMount, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Replicas != nil {\n\t\tin, out := &in.Replicas, &out.Replicas\n\t\t*out = new(int32)\n\t\t**out = **in\n\t}\n\tif in.Exclude != nil {\n\t\tin, out := &in.Exclude, &out.Exclude\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "427593624e8f7c25b1f2d36902ae0730", "score": "0.784302", "text": "func (in *Compaction) DeepCopyInto(out *Compaction) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "647f1524647108952ee31ce014c689dc", "score": "0.78417987", "text": "func (in *HelmTiller) DeepCopyInto(out *HelmTiller) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "4b862c3b8921cf3f39b78a13d968c9fc", "score": "0.78391075", "text": "func (in *FinalInstallStep) DeepCopyInto(out *FinalInstallStep) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "5ab614070f87d291c5c74f600b683d65", "score": "0.7836729", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "44de1c7a8498d83ec6f0a1339d4d328c", "score": "0.7832308", "text": "func (in *EnvSelector) DeepCopyInto(out *EnvSelector) {\n\t*out = *in\n}", "title": "" }, { "docid": "cb473a50a2c7608cb863df348afabf6c", "score": "0.78277665", "text": "func (in *State) DeepCopyInto(out *State) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "14fef7eecdd89f4797e05b4e11d16629", "score": "0.78249705", "text": "func (in *Addon) DeepCopyInto(out *Addon) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7e0d8d90d7ac662f33fdb4df6eec1caf", "score": "0.7822815", "text": "func (in *TolerateSpec) DeepCopyInto(out *TolerateSpec) {\n\t*out = *in\n}", "title": "" }, { "docid": "a748e1f42ee8ddc275bf9b43f3b35103", "score": "0.7819042", "text": "func (in *DockerPullCheck) DeepCopyInto(out *DockerPullCheck) {\n\t*out = *in\n}", "title": "" }, { "docid": "c16be5768cc974667aa6c224d746bcc4", "score": "0.7817328", "text": "func (in *LoggingSpec) DeepCopyInto(out *LoggingSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9b11c1572d023ac80a5aac9db170efbe", "score": "0.7816202", "text": "func (in *KubeLego) DeepCopyInto(out *KubeLego) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "f0cd3fe33fab64d922a03529f83b943b", "score": "0.78157395", "text": "func (in *Resolve) DeepCopyInto(out *Resolve) {\n\t*out = *in\n\tif in.Services != nil {\n\t\tin, out := &in.Services, &out.Services\n\t\t*out = make([]ServiceResolveSpec, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "0afdff87e84ca65710759d1337015963", "score": "0.78157145", "text": "func (in *SubSpec) DeepCopyInto(out *SubSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "75953b773ee1b231c11039416db7c653", "score": "0.7811187", "text": "func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "288bba05c76ddb20c0924391cf5c17d4", "score": "0.78101945", "text": "func (in *NuxeoAccess) DeepCopyInto(out *NuxeoAccess) {\n\t*out = *in\n\tout.TargetPort = in.TargetPort\n}", "title": "" }, { "docid": "a66214db9e683346d01273bd3d212342", "score": "0.78098994", "text": "func (in *Watch) DeepCopyInto(out *Watch) {\n\t*out = *in\n\tif in.Deployments != nil {\n\t\tin, out := &in.Deployments, &out.Deployments\n\t\t*out = make([]Deployment, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Parsers != nil {\n\t\tin, out := &in.Parsers, &out.Parsers\n\t\t*out = make([]InputParser, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Outputs != nil {\n\t\tin, out := &in.Outputs, &out.Outputs\n\t\t*out = make([]Output, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c27c0b2fa28bc0c6fc2d2861feaa77bc", "score": "0.7805171", "text": "func (in *DataTransferProgress) DeepCopyInto(out *DataTransferProgress) {\n\t*out = *in\n}", "title": "" }, { "docid": "7cbb1952216c7abee2fb9390c4172456", "score": "0.7802186", "text": "func (in *IdentityDb) DeepCopyInto(out *IdentityDb) {\n\t*out = *in\n\tout.PoolOptions = in.PoolOptions\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.7801798", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "01b508f74eb653d3628e69f3ddedcd2a", "score": "0.7801798", "text": "func (in *Destination) DeepCopyInto(out *Destination) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "4f446099c62c3201f8a1f2caf7fd067f", "score": "0.7801664", "text": "func (in *Monocular) DeepCopyInto(out *Monocular) {\n\t*out = *in\n\tout.Addon = in.Addon\n\treturn\n}", "title": "" }, { "docid": "3827c31220dfe680f394f9d1ebceab58", "score": "0.7801511", "text": "func (in *PoolOptions) DeepCopyInto(out *PoolOptions) {\n\t*out = *in\n}", "title": "" }, { "docid": "e6e62bc68e6768204636bf9495629843", "score": "0.7800986", "text": "func (in *Global) DeepCopyInto(out *Global) {\n\t*out = *in\n\tout.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral\n\tif in.XXX_unrecognized != nil {\n\t\tin, out := &in.XXX_unrecognized, &out.XXX_unrecognized\n\t\t*out = make([]byte, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "32253f480abe83070a818b4213200b5d", "score": "0.77990997", "text": "func (in *Docker) DeepCopyInto(out *Docker) {\n\t*out = *in\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "546392e209b025332450b746e29a55a3", "score": "0.7797951", "text": "func (in *ServiceResolveSpec) DeepCopyInto(out *ServiceResolveSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "7686bd51b571d5c60d19a80bba43f7c5", "score": "0.7796954", "text": "func (in *NameValue) DeepCopyInto(out *NameValue) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e94fbb469461cb85f65bdb5e3f8cff52", "score": "0.77958417", "text": "func (in *ContainerImage) DeepCopyInto(out *ContainerImage) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "460869f5d0b2d3581371f96eaab1c6c5", "score": "0.7794182", "text": "func (in *QueryParameterMatcher) DeepCopyInto(out *QueryParameterMatcher) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "e777d7d159b2dbf5fb1d5346593c672b", "score": "0.779374", "text": "func (in *TaskTestSpec) DeepCopyInto(out *TaskTestSpec) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "3fd37fa0a6e40b0c2c4b4779ff65d42b", "score": "0.7793158", "text": "func (in *Selector) DeepCopyInto(out *Selector) {\n\t*out = *in\n}", "title": "" }, { "docid": "c7e1d612f3613418287025d9beb75ebd", "score": "0.779272", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n}", "title": "" }, { "docid": "c7e1d612f3613418287025d9beb75ebd", "score": "0.779272", "text": "func (in *NamespacedName) DeepCopyInto(out *NamespacedName) {\n\t*out = *in\n}", "title": "" }, { "docid": "2cb6d185c77c6fd513706bfc4ea5a80b", "score": "0.77900076", "text": "func (in *Level) DeepCopyInto(out *Level) {\n\t*out = *in\n}", "title": "" }, { "docid": "68d5af65be2b3f9605eb56feb89abe23", "score": "0.7788513", "text": "func (in *Interface) DeepCopyInto(out *Interface) {\n\t*out = *in\n\tif in.Flags != nil {\n\t\tin, out := &in.Flags, &out.Flags\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.IPV4Addresses != nil {\n\t\tin, out := &in.IPV4Addresses, &out.IPV4Addresses\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.IPV6Addresses != nil {\n\t\tin, out := &in.IPV6Addresses, &out.IPV6Addresses\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n}", "title": "" }, { "docid": "1b4cf9640bfcf7f7cdbcebab0c99d94e", "score": "0.7784692", "text": "func (in *IdentityForCmk) DeepCopyInto(out *IdentityForCmk) {\n\t*out = *in\n\tif in.PropertyBag != nil {\n\t\tin, out := &in.PropertyBag, &out.PropertyBag\n\t\t*out = make(genruntime.PropertyBag, len(*in))\n\t\tfor key, val := range *in {\n\t\t\t(*out)[key] = val\n\t\t}\n\t}\n\tif in.UserAssignedIdentity != nil {\n\t\tin, out := &in.UserAssignedIdentity, &out.UserAssignedIdentity\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "3a4aaf8e02ea48978e3b56c3f6792bad", "score": "0.77827114", "text": "func (in *EmptyDir) DeepCopyInto(out *EmptyDir) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "b22a5d61be5d9d15da49361e15b66431", "score": "0.777896", "text": "func (in *TaskRef) DeepCopyInto(out *TaskRef) {\n\t*out = *in\n\tif in.Params != nil {\n\t\tin, out := &in.Params, &out.Params\n\t\t*out = make([]Param, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f89bdac0ff7dc2948005dc666c01c5be", "score": "0.77752614", "text": "func (in *GitReference) DeepCopyInto(out *GitReference) {\n\t*out = *in\n}", "title": "" }, { "docid": "a985014e9811aa9606eb760041b35dfa", "score": "0.7774464", "text": "func (in *ConfigurationInfo) DeepCopyInto(out *ConfigurationInfo) {\n\t*out = *in\n\tif in.ARN != nil {\n\t\tin, out := &in.ARN, &out.ARN\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.Revision != nil {\n\t\tin, out := &in.Revision, &out.Revision\n\t\t*out = new(int64)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "ee51e9942eff79d630765d320000db37", "score": "0.7773195", "text": "func (in *ImageRef) DeepCopyInto(out *ImageRef) {\n\t*out = *in\n\treturn\n}", "title": "" }, { "docid": "9b8a5d0e517ed18900f4997b7f4b1dd2", "score": "0.77729154", "text": "func (in *Properties) DeepCopyInto(out *Properties) {\n\t*out = *in\n}", "title": "" }, { "docid": "24680e96db252cb395af5d70d23d5666", "score": "0.7770153", "text": "func (in *PackagePath) DeepCopyInto(out *PackagePath) {\n\t*out = *in\n\treturn\n}", "title": "" } ]
8ef9b07c699befeba89ba5ef221c325c
sendChunk is in charge of sending an "admissible" piece of batch, i.e. one which doesn't need to be subdivided further before going to a range (so no mixing of forward and reverse scans, etc). The parameters and return values correspond to client.Sender with the exception of the returned boolean, which is true when indicating that the caller should retry but needs to send EndTransaction in a separate request.
[ { "docid": "677b26e3282b1f2df737b7fbb6096336", "score": "0.7394986", "text": "func (ds *DistSender) sendChunk(ctx context.Context, ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error, bool) {\n\tisReverse := ba.IsReverse()\n\n\tctx, cleanup := tracing.EnsureContext(ctx, ds.Tracer)\n\tdefer cleanup()\n\n\t// The minimal key range encompassing all requests contained within.\n\t// Local addressing has already been resolved.\n\t// TODO(tschottdorf): consider rudimentary validation of the batch here\n\t// (for example, non-range requests with EndKey, or empty key ranges).\n\trs, err := keys.Range(ba)\n\tif err != nil {\n\t\treturn nil, roachpb.NewError(err), false\n\t}\n\tvar br *roachpb.BatchResponse\n\n\t// Send the request to one range per iteration.\n\tfor {\n\t\t// Increase the sequence counter only once before sending RPCs to\n\t\t// the ranges involved in this chunk of the batch (as opposed to for\n\t\t// each RPC individually). On RPC errors, there's no guarantee that\n\t\t// the request hasn't made its way to the target regardless of the\n\t\t// error; we'd like the second execution to be caught by the sequence\n\t\t// cache if that happens. There is a small chance that that we address\n\t\t// a range twice in this chunk (stale/suboptimal descriptors due to\n\t\t// splits/merges) which leads to a transaction retry.\n\t\t// TODO(tschottdorf): it's possible that if we don't evict from the\n\t\t// cache we could be in for a busy loop.\n\t\tba.SetNewRequest()\n\n\t\tvar curReply *roachpb.BatchResponse\n\t\tvar desc *roachpb.RangeDescriptor\n\t\tvar evictToken *evictionToken\n\t\tvar needAnother bool\n\t\tvar pErr *roachpb.Error\n\t\tvar finished bool\n\t\tfor r := retry.StartWithCtx(ctx, ds.rpcRetryOptions); r.Next(); {\n\t\t\t// Get range descriptor (or, when spanning range, descriptors). Our\n\t\t\t// error handling below may clear them on certain errors, so we\n\t\t\t// refresh (likely from the cache) on every retry.\n\t\t\tlog.Trace(ctx, \"meta descriptor lookup\")\n\t\t\tvar err error\n\t\t\tdesc, needAnother, evictToken, err = ds.getDescriptors(ctx, rs, evictToken, isReverse)\n\n\t\t\t// getDescriptors may fail retryably if, for example, the first\n\t\t\t// range isn't available via Gossip. Assume that all errors at\n\t\t\t// this level are retryable. Non-retryable errors would be for\n\t\t\t// things like malformed requests which we should have checked\n\t\t\t// for before reaching this point.\n\t\t\tif err != nil {\n\t\t\t\tlog.Trace(ctx, \"range descriptor lookup failed: \"+err.Error())\n\t\t\t\tif log.V(1) {\n\t\t\t\t\tlog.Warning(ctx, err)\n\t\t\t\t}\n\t\t\t\tpErr = roachpb.NewError(err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif needAnother && br == nil {\n\t\t\t\t// TODO(tschottdorf): we should have a mechanism for discovering\n\t\t\t\t// range merges (descriptor staleness will mostly go unnoticed),\n\t\t\t\t// or we'll be turning single-range queries into multi-range\n\t\t\t\t// queries for no good reason.\n\n\t\t\t\t// If there's no transaction and op spans ranges, possibly\n\t\t\t\t// re-run as part of a transaction for consistency. The\n\t\t\t\t// case where we don't need to re-run is if the read\n\t\t\t\t// consistency is not required.\n\t\t\t\tif ba.Txn == nil && ba.IsPossibleTransaction() &&\n\t\t\t\t\tba.ReadConsistency != roachpb.INCONSISTENT {\n\t\t\t\t\treturn nil, roachpb.NewError(&roachpb.OpRequiresTxnError{}), false\n\t\t\t\t}\n\t\t\t\t// If the request is more than but ends with EndTransaction, we\n\t\t\t\t// want the caller to come again with the EndTransaction in an\n\t\t\t\t// extra call.\n\t\t\t\tif l := len(ba.Requests) - 1; l > 0 && ba.Requests[l].GetInner().Method() == roachpb.EndTransaction {\n\t\t\t\t\treturn nil, roachpb.NewError(errors.New(\"cannot send 1PC txn to multiple ranges\")), true /* shouldSplitET */\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// It's possible that the returned descriptor misses parts of the\n\t\t\t// keys it's supposed to scan after it's truncated to match the\n\t\t\t// descriptor. Example revscan [a,g), first desc lookup for \"g\"\n\t\t\t// returns descriptor [c,d) -> [d,g) is never scanned.\n\t\t\t// We evict and retry in such a case.\n\t\t\tincludesFrontOfCurSpan := func(rd *roachpb.RangeDescriptor) bool {\n\t\t\t\tif isReverse {\n\t\t\t\t\treturn desc.ContainsExclusiveEndKey(rs.EndKey)\n\t\t\t\t}\n\t\t\t\treturn desc.ContainsKey(rs.Key)\n\t\t\t}\n\t\t\tif !includesFrontOfCurSpan(desc) {\n\t\t\t\tif err := evictToken.Evict(ctx); err != nil {\n\t\t\t\t\treturn nil, roachpb.NewError(err), false\n\t\t\t\t}\n\t\t\t\t// On addressing errors, don't backoff; retry immediately.\n\t\t\t\tr.Reset()\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcurReply, pErr = func() (*roachpb.BatchResponse, *roachpb.Error) {\n\t\t\t\t// Truncate the request to our current key range.\n\t\t\t\tintersected, iErr := rs.Intersect(desc)\n\t\t\t\tif iErr != nil {\n\t\t\t\t\treturn nil, roachpb.NewError(iErr)\n\t\t\t\t}\n\t\t\t\ttruncBA, numActive, trErr := truncate(ba, intersected)\n\t\t\t\tif numActive == 0 && trErr == nil {\n\t\t\t\t\t// This shouldn't happen in the wild, but some tests\n\t\t\t\t\t// exercise it.\n\t\t\t\t\treturn nil, roachpb.NewErrorf(\"truncation resulted in empty batch on [%s,%s): %s\",\n\t\t\t\t\t\trs.Key, rs.EndKey, ba)\n\t\t\t\t}\n\t\t\t\tif trErr != nil {\n\t\t\t\t\treturn nil, roachpb.NewError(trErr)\n\t\t\t\t}\n\t\t\t\treturn ds.sendSingleRange(ctx, truncBA, desc)\n\t\t\t}()\n\t\t\t// If sending succeeded, break this loop.\n\t\t\tif pErr == nil {\n\t\t\t\tfinished = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlog.VTracef(1, ctx, \"reply error %s: %s\", ba, pErr)\n\n\t\t\t// Error handling: If the error indicates that our range\n\t\t\t// descriptor is out of date, evict it from the cache and try\n\t\t\t// again. Errors that apply only to a single replica were\n\t\t\t// handled in send().\n\t\t\t//\n\t\t\t// TODO(bdarnell): Don't retry endlessly. If we fail twice in a\n\t\t\t// row and the range descriptor hasn't changed, return the error\n\t\t\t// to our caller.\n\t\t\tswitch tErr := pErr.GetDetail().(type) {\n\t\t\tcase *roachpb.SendError:\n\t\t\t\t// We've tried all the replicas without success. Either\n\t\t\t\t// they're all down, or we're using an out-of-date range\n\t\t\t\t// descriptor. Invalidate the cache and try again with the new\n\t\t\t\t// metadata.\n\t\t\t\tif err := evictToken.Evict(ctx); err != nil {\n\t\t\t\t\treturn nil, roachpb.NewError(err), false\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase *roachpb.RangeKeyMismatchError:\n\t\t\t\t// Range descriptor might be out of date - evict it. This is\n\t\t\t\t// likely the result of a range split. If we have new range\n\t\t\t\t// descriptors, insert them instead as long as they are different\n\t\t\t\t// from the last descriptor to avoid endless loops.\n\t\t\t\tvar replacements []roachpb.RangeDescriptor\n\t\t\t\tdifferent := func(rd *roachpb.RangeDescriptor) bool {\n\t\t\t\t\treturn !desc.RSpan().Equal(rd.RSpan())\n\t\t\t\t}\n\t\t\t\tif tErr.MismatchedRange != nil && different(tErr.MismatchedRange) {\n\t\t\t\t\treplacements = append(replacements, *tErr.MismatchedRange)\n\t\t\t\t}\n\t\t\t\tif tErr.SuggestedRange != nil && different(tErr.SuggestedRange) {\n\t\t\t\t\tif includesFrontOfCurSpan(tErr.SuggestedRange) {\n\t\t\t\t\t\treplacements = append(replacements, *tErr.SuggestedRange)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Same as Evict() if replacements is empty.\n\t\t\t\tif err := evictToken.EvictAndReplace(ctx, replacements...); err != nil {\n\t\t\t\t\treturn nil, roachpb.NewError(err), false\n\t\t\t\t}\n\t\t\t\t// On addressing errors, don't backoff; retry immediately.\n\t\t\t\tr.Reset()\n\t\t\t\tif log.V(1) {\n\t\t\t\t\tlog.Warning(ctx, tErr)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t// Immediately return if querying a range failed non-retryably.\n\t\tif pErr != nil {\n\t\t\treturn nil, pErr, false\n\t\t} else if !finished {\n\t\t\tselect {\n\t\t\tcase <-ds.rpcRetryOptions.Closer:\n\t\t\t\treturn nil, roachpb.NewError(&roachpb.NodeUnavailableError{}), false\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil, roachpb.NewError(ctx.Err()), false\n\t\t\tdefault:\n\t\t\t\tlog.Fatal(ctx, \"exited retry loop with nil error but finished=false\")\n\t\t\t}\n\t\t}\n\n\t\tba.Txn.Update(curReply.Txn)\n\n\t\tif br == nil {\n\t\t\t// First response from a Range.\n\t\t\tbr = curReply\n\t\t} else {\n\t\t\t// This was the second or later call in a cross-Range request.\n\t\t\t// Combine the new response with the existing one.\n\t\t\tif err := br.Combine(curReply); err != nil {\n\t\t\t\treturn nil, roachpb.NewError(err), false\n\t\t\t}\n\t\t}\n\n\t\tif isReverse {\n\t\t\t// In next iteration, query previous range.\n\t\t\t// We use the StartKey of the current descriptor as opposed to the\n\t\t\t// EndKey of the previous one since that doesn't have bugs when\n\t\t\t// stale descriptors come into play.\n\t\t\trs.EndKey, err = prev(ba, desc.StartKey)\n\t\t} else {\n\t\t\t// In next iteration, query next range.\n\t\t\t// It's important that we use the EndKey of the current descriptor\n\t\t\t// as opposed to the StartKey of the next one: if the former is stale,\n\t\t\t// it's possible that the next range has since merged the subsequent\n\t\t\t// one, and unless both descriptors are stale, the next descriptor's\n\t\t\t// StartKey would move us to the beginning of the current range,\n\t\t\t// resulting in a duplicate scan.\n\t\t\trs.Key, err = next(ba, desc.EndKey)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, roachpb.NewError(err), false\n\t\t}\n\n\t\tif ba.MaxSpanRequestKeys > 0 {\n\t\t\t// Count how many results we received.\n\t\t\tvar numResults int64\n\t\t\tfor _, resp := range curReply.Responses {\n\t\t\t\tnumResults += resp.GetInner().Header().NumKeys\n\t\t\t}\n\t\t\tif numResults > ba.MaxSpanRequestKeys {\n\t\t\t\tpanic(fmt.Sprintf(\"received %d results, limit was %d\", numResults, ba.MaxSpanRequestKeys))\n\t\t\t}\n\t\t\tba.MaxSpanRequestKeys -= numResults\n\t\t\tif ba.MaxSpanRequestKeys == 0 {\n\t\t\t\t// prepare the batch response after meeting the max key limit.\n\t\t\t\tfillSkippedResponses(ba, br, rs)\n\t\t\t\t// done, exit loop.\n\t\t\t\treturn br, nil, false\n\t\t\t}\n\t\t}\n\n\t\t// If this was the last range accessed by this call, exit loop.\n\t\tif !needAnother {\n\t\t\treturn br, nil, false\n\t\t}\n\n\t\t// key cannot be less that the end key.\n\t\tif !rs.Key.Less(rs.EndKey) {\n\t\t\tpanic(fmt.Sprintf(\"start key %s is less than %s\", rs.Key, rs.EndKey))\n\t\t}\n\n\t\tlog.Trace(ctx, \"querying next range\")\n\t}\n\n\treturn br, nil, false\n}", "title": "" } ]
[ { "docid": "5f46c60b8cf64583a6748c28e9bd9852", "score": "0.6292975", "text": "func (channel *Channel) onFileChunkRequest(_ *gotox.Tox, friendNumber uint32, fileNumber uint32, position uint64, length uint64) {\n\ttrans, exists := channel.transfers[fileNumber]\n\t// sanity check\n\tif !exists {\n\t\tlog.Println(tag, \"Send transfer doesn't seem to exist!\", fileNumber)\n\t\treturn\n\t}\n\t// get address for working with sendTransfer\n\taddress, _ := channel.addressOf(friendNumber)\n\t// if this callback is called the send transfer is active, so make sure the sendTransfer doesn't time out\n\tsendTran, exists := channel.sendActive[address]\n\tif !exists {\n\t\tlog.Println(tag, \"WARNING: sending timeout can not be stopped!\")\n\t} else {\n\t\t// set started to true since we're actually sending data\n\t\tsendTran.started = true\n\t}\n\t// ensure that length is valid\n\tif length+position > trans.size {\n\t\tlength = trans.size - position\n\t}\n\t// if we're already done we finish here without sending any more chunks\n\tif length == 0 {\n\t\t// close & remove transfer\n\t\tchannel.closeTransfer(fileNumber, StSuccess)\n\t\t// remember to remove from sendActive IF it existed!\n\t\tif _, exists := channel.sendActive[address]; exists {\n\t\t\tdelete(channel.sendActive, address)\n\t\t}\n\t\treturn\n\t}\n\t// get bytes to send\n\tdata := make([]byte, length)\n\t_, err := trans.file.ReadAt(data, int64(position))\n\tif err != nil {\n\t\tfmt.Println(tag, \"Error reading file:\", err)\n\t\treturn\n\t}\n\t// send\n\terr = channel.tox.FileSendChunk(friendNumber, fileNumber, position, data)\n\tif err != nil {\n\t\tlog.Println(tag, \"File send error: \", err)\n\t}\n\t// update progress\n\ttrans.SetProgress(position + length)\n}", "title": "" }, { "docid": "d1087bb1cd314a9c5814465f1e6e7cbe", "score": "0.6226351", "text": "func (a *App) SendChunk(chunk []byte, to string) error {\n\tif chunk == nil || len(chunk) == 0 {\n\t\treturn nil\n\t}\n\tchunk_base64 := make([]byte, base64.StdEncoding.EncodedLen(len(chunk)))\n\tbase64.StdEncoding.Encode(chunk_base64, chunk)\n\n\tmsg := xmpp.Message{}\n\tmsg.To = to\n\tmsg.Type = \"voxmpp\"\n\tmsg.OtherElements = []xmpp.XMLElement{\n\t\t{\n\t\t\tXMLName: xml.Name{\n\t\t\t\tSpace: NSVOXMPP,\n\t\t\t\tLocal: \"data\",\n\t\t\t},\n\t\t\tInnerXML: chunk_base64,\n\t\t},\n\t}\n\n\t_, err := a.SendMessage(&msg)\n\treturn err\n}", "title": "" }, { "docid": "6a551f3eb8da7070f2a508799c7b9075", "score": "0.59254396", "text": "func (rx *ResumableUpload) transferChunk(ctx context.Context) (*http.Response, error) {\n\tchunk, off, size, err := rx.Media.Chunk()\n\n\tdone := err == io.EOF\n\tif !done && err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := rx.doUploadRequest(ctx, chunk, off, int64(size), done)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\t// We sent \"X-GUploader-No-308: yes\" (see comment elsewhere in\n\t// this file), so we don't expect to get a 308.\n\tif res.StatusCode == 308 {\n\t\treturn nil, errors.New(\"unexpected 308 response status code\")\n\t}\n\n\tif res.StatusCode == http.StatusOK {\n\t\trx.reportProgress(off, off+int64(size))\n\t}\n\n\tif statusResumeIncomplete(res) {\n\t\trx.Media.Next()\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "29d5f223aeefc1d1ef0420e152ef54fd", "score": "0.58822984", "text": "func (c *Client) relayChunks(addr string, audioDataStream <-chan []int32, a *AudioIO) {\n\t// keep track of written bytes\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\tvar written uint64\n\tprogressDone := make(chan struct{})\n\tgo showProgress(&wg, \"written\", progressDone, &written)\n\t// write recorded chunks as packets and relay\n\tvar chunk []int32\n\tserializeBuff := new(bytes.Buffer)\n\tfor chunk = range audioDataStream {\n\t\t// write the binary representation of the recorded chunk into serializeBuff\n\t\tbinary.Write(serializeBuff, binary.BigEndian, chunk)\n\t\ta.BuffPool.Put(chunk) // return chunk\n\t\tserializeBuff = compress(serializeBuff)\n\t\twritten += uint64(serializeBuff.Len())\n\t\tpkt := c.configureRelayPkt(addr, serializeBuff.Bytes())\n\t\tc.cr.EncryptE2E(addr, pkt) // end-to-end encrypt packet\n\t\tc.client.Send(pkt, nil)\n\t\tserializeBuff.Reset()\n\t}\n\tprogressDone <- struct{}{}\n\twg.Wait()\n}", "title": "" }, { "docid": "2a91884b8ef4862499992b6d352f3293", "score": "0.5877781", "text": "func sendRequestBodyChunk(id uint32, last bool, chunk []byte) {\n\treq := getRequest(id)\n\tsendChunk(req, last, chunk)\n}", "title": "" }, { "docid": "395e4e445f85fce3cc36a25766c6f42d", "score": "0.56529474", "text": "func BatchAndSend(chunks <-chan Chunk, conn io.Writer, c clock.Clock, cutoffBytes int, cutoffMs int) {\n\tif cutoffMs < 0 {\n\t\tcutoffMs = 0\n\t}\n\tvar timeout <-chan time.Time\n\tbuf := AppendUint32(nil, 0) // Make room for a CRC.\n\tnumChunks := 0\n\tfor {\n\t\tselect {\n\t\tcase chunk, ok := <-chunks:\n\t\t\tif !ok {\n\t\t\t\t// Send any queued up chunks before quitting.\n\t\t\t\tsendSerializedData(buf, conn)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tchunkLength := chunk.SerializedLength()\n\t\t\tif len(buf)+chunkLength >= cutoffBytes && numChunks > 0 {\n\t\t\t\tsendSerializedData(buf, conn)\n\t\t\t\tnumChunks = 0\n\t\t\t\tbuf = buf[0:4] // Leave 4 bytes at the front for the CRC\n\t\t\t\ttimeout = nil\n\t\t\t}\n\t\t\tbuf = AppendChunk(buf, &chunk)\n\t\t\tnumChunks++\n\t\t\tif timeout == nil {\n\t\t\t\ttimeout = c.After(time.Millisecond * time.Duration(cutoffMs))\n\t\t\t}\n\n\t\tcase <-timeout:\n\t\t\tsendSerializedData(buf, conn)\n\t\t\tnumChunks = 0\n\t\t\tbuf = buf[0:4] // Leave 4 bytes at the front for the CRC\n\t\t\ttimeout = nil\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d8c5c42e220ecdc285f4627b0e526c30", "score": "0.56382686", "text": "func chunked(te []string) bool { return len(te) > 0 && te[0] == \"chunked\" }", "title": "" }, { "docid": "d8c5c42e220ecdc285f4627b0e526c30", "score": "0.56382686", "text": "func chunked(te []string) bool { return len(te) > 0 && te[0] == \"chunked\" }", "title": "" }, { "docid": "16d03edfc34852ddacb994fd8de2bc4a", "score": "0.5571338", "text": "func (m *MessageDechunker) AddChunk(c chunk) (complete bool) {\n\tif m.chunks == nil || m.mid != c.mid || m.cnt != c.cnt {\n\t\tm.chunks = make(map[chunkId]string)\n\t\tm.cnt = c.cnt\n\t\tm.mid = c.mid\n\t}\n\tm.chunks[c.cid] = c.data\n\treturn m.isComplete()\n}", "title": "" }, { "docid": "976b45706424fc1a0c87e2a7f50cd828", "score": "0.5557603", "text": "func (nds *Stream) writeChunk(data []byte, eof bool) error {\n\t// The header must fit in a 2-byte uvarint and is thus at most 14 bits long.\n\t// The bits are allocated as follows, starting from the least significant:\n\t// 0: EOF (active high)\n\t// 1..3: reserved\n\t// 4..13 (9 bits): FRAMESIZE-1-len(data)\n\t// Encoding the FRAMESIZE-1-len(data) instead of len(data) makes the header\n\t// uvarint fit into a single byte when there is less padding (and more\n\t// data), leaving one byte more room for the data (up to 492 bytes).\n\tvar header uint64\n\tif eof {\n\t\theader |= 1\n\t}\n\theader |= uint64(FRAMESIZE-1-len(data)) << 4\n\tn := binary.PutUvarint(nds.writeBuf[:2], header)\n\tif n+len(data) > FRAMESIZE {\n\t\tpanic(\"Stream.writeChunk space accounting failed\")\n\t}\n\tn += copy(nds.writeBuf[n:], data)\n\tfor i := n; i < len(nds.writeBuf); i++ {\n\t\tnds.writeBuf[i] = 0\n\t}\n\treturn nds.ndc.SendFrame(nds.writeBuf[:])\n}", "title": "" }, { "docid": "ce9ac37f7000a960f334a86882841dac", "score": "0.5531004", "text": "func isValidChunk(n int64) bool {\n\treturn n > 0 && n%0x40000 == 0\n}", "title": "" }, { "docid": "d9116e214ff84c075bfe105688ea2a07", "score": "0.55257666", "text": "func doChunk(writer *kafka.Writer, chunkCount int, chunks int, year int, writeTo string, verbose bool, rdr io.Reader, delay int) (int, bool) {\n\tscanner := bufio.NewScanner(rdr)\n\t// insert a line as the first line of each chunk - the entire contents of the line is the value of the year\n\t// e.g. \"2019\\n\"\n\tchunk := strconv.Itoa(year) + \"\\n\"\n\tcnt := 0\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tchunk += line + \"\\n\"\n\t\tcnt++\n\t\t// chunk every ten lines\n\t\tif cnt >= 10 {\n\t\t\tif verbose || (writeTo == writeToStdout) {\n\t\t\t\tfmt.Printf(\"chunk: %v\\n\", chunk)\n\t\t\t}\n\t\t\tif writeTo == writeToKafka {\n\t\t\t\tif err := writeMessage(writer, chunk, verbose); err != nil {\n\t\t\t\t\treturn chunks, false\n\t\t\t\t}\n\t\t\t\tchunksWritten.Inc()\n\t\t\t}\n\t\t\tchunks++\n\t\t\tif chunkCount >= 0 && chunks >= chunkCount {\n\t\t\t\tfmt.Printf(\"chunk count met: %v. Stopping\\n\", chunks)\n\t\t\t\treturn chunks, true\n\t\t\t}\n\t\t\tchunk = strconv.Itoa(year) + \"\\n\"\n\t\t\tcnt = 0\n\t\t\tif delay > 0 {\n\t\t\t\ttime.Sleep(time.Duration(delay) * time.Millisecond)\n\t\t\t}\n\t\t}\n\t}\n\treturn chunks, true\n}", "title": "" }, { "docid": "98cd8892e52607d68769c02529cd1e7a", "score": "0.55078816", "text": "func (s *spliceServer) serveChunk(req *Request, rep *Response) (err error) {\n\tif req.Start == 0 {\n\t\terr := s.prepareServe(req.Hash)\n\t\tif err != nil {\n\t\t\trep.Have = false\n\t\t\treturn nil\n\t\t}\n\t}\n\trep.Have = true\n\n\tspl := s.serve(req.Hash, int64(req.Start))\n\tif spl == nil {\n\t\treturn s.store.ServeChunk(req, rep)\n\t}\n\tdefer splice.Done(spl.pair)\n\n\tdata := make([]byte, spl.size)\n\tn, err := spl.pair.Read(data)\n\tif err != nil {\n\t\treturn s.store.ServeChunk(req, rep)\n\t}\n\trep.Chunk = data[:n]\n\trep.Size = n\n\trep.Last = spl.last\n\treturn nil\n}", "title": "" }, { "docid": "18d0e5a6347c17ceaa94fc644d2265c9", "score": "0.5447564", "text": "func (r *RpcDataPackage) IsChunkPackage() bool {\n\treturn r.GetChunkStreamId() != 0\n}", "title": "" }, { "docid": "720760b51888c12b92e9c411fdbb7e6b", "score": "0.5407204", "text": "func (i *Ingester) TransferChunks(stream client.Ingester_TransferChunksServer) error {\n\tfromIngesterID := \"\"\n\tseriesReceived := 0\n\n\txfer := func() error {\n\t\tuserStates := newUserStates(i.limiter, i.cfg, i.metrics)\n\n\t\tvar err error\n\t\tfromIngesterID, seriesReceived, err = i.fillUserStatesFromStream(userStates, stream)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ti.userStatesMtx.Lock()\n\t\tdefer i.userStatesMtx.Unlock()\n\n\t\ti.userStates = userStates\n\n\t\treturn nil\n\t}\n\n\tif err := i.transfer(stream.Context(), xfer); err != nil {\n\t\treturn err\n\t}\n\n\t// Close the stream last, as this is what tells the \"from\" ingester that\n\t// it's OK to shut down.\n\tif err := stream.SendAndClose(&client.TransferChunksResponse{}); err != nil {\n\t\tlevel.Error(util.Logger).Log(\"msg\", \"Error closing TransferChunks stream\", \"from_ingester\", fromIngesterID, \"err\", err)\n\t\treturn err\n\t}\n\tlevel.Info(util.Logger).Log(\"msg\", \"Successfully transferred chunks\", \"from_ingester\", fromIngesterID, \"series_received\", seriesReceived)\n\n\treturn nil\n}", "title": "" }, { "docid": "2501f9324c4e09ec27ae1d65a3a99ca3", "score": "0.54057324", "text": "func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader io.ReadSeeker) (bytesWritten int64, err error) {\n\tif chunkNumber < 0 {\n\t\terr := fmt.Errorf(\"invalid chunk number provided: %v\", chunkNumber)\n\t\treturn -1, err\n\t}\n\t// Only account after the checksum reads have been done\n\tif do, ok := reader.(pool.DelayAccountinger); ok {\n\t\t// To figure out this number, do a transfer and if the accounted size is 0 or a\n\t\t// multiple of what it should be, increase or decrease this number.\n\t\tdo.DelayAccounting(2)\n\t}\n\tm := md5.New()\n\tcurrentChunkSize, err := io.Copy(m, reader)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\t// If no data read, don't write the chunk\n\tif currentChunkSize == 0 {\n\t\treturn 0, nil\n\t}\n\tmd5sumBinary := m.Sum([]byte{})\n\tw.addMd5(&md5sumBinary, int64(chunkNumber))\n\tmd5sum := base64.StdEncoding.EncodeToString(md5sumBinary[:])\n\n\t// Object storage requires 1 <= PartNumber <= 10000\n\tossPartNumber := chunkNumber + 1\n\tif existing, ok := w.existingParts[ossPartNumber]; ok {\n\t\tif md5sum == *existing.Md5 {\n\t\t\tfs.Debugf(w.o, \"matched uploaded part found, part num %d, skipping part, md5=%v\", *existing.PartNumber, md5sum)\n\t\t\tw.addCompletedPart(existing.PartNumber, existing.Etag)\n\t\t\treturn currentChunkSize, nil\n\t\t}\n\t}\n\treq := objectstorage.UploadPartRequest{\n\t\tNamespaceName: common.String(w.f.opt.Namespace),\n\t\tBucketName: w.bucket,\n\t\tObjectName: w.key,\n\t\tUploadId: w.uploadID,\n\t\tUploadPartNum: common.Int(ossPartNumber),\n\t\tContentLength: common.Int64(currentChunkSize),\n\t\tContentMD5: common.String(md5sum),\n\t}\n\tw.o.applyPartUploadOptions(w.ui.req, &req)\n\tvar resp objectstorage.UploadPartResponse\n\terr = w.f.pacer.Call(func() (bool, error) {\n\t\t// req.UploadPartBody = io.NopCloser(bytes.NewReader(buf))\n\t\t// rewind the reader on retry and after reading md5\n\t\t_, err = reader.Seek(0, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treq.UploadPartBody = io.NopCloser(reader)\n\t\tresp, err = w.f.srv.UploadPart(ctx, req)\n\t\tif err != nil {\n\t\t\tif ossPartNumber <= 8 {\n\t\t\t\treturn shouldRetry(ctx, resp.HTTPResponse(), err)\n\t\t\t}\n\t\t\t// retry all chunks once have done the first few\n\t\t\treturn true, err\n\t\t}\n\t\treturn false, err\n\t})\n\tif err != nil {\n\t\tfs.Errorf(w.o, \"multipart upload failed to upload part:%d err: %v\", ossPartNumber, err)\n\t\treturn -1, fmt.Errorf(\"multipart upload failed to upload part: %w\", err)\n\t}\n\tw.addCompletedPart(&ossPartNumber, resp.ETag)\n\treturn currentChunkSize, err\n\n}", "title": "" }, { "docid": "2820d975397dc7440aaf32d7d7b5f021", "score": "0.53477246", "text": "func (l *Forwarder) PostSessionChunk(namespace string, sid session.ID, reader io.Reader) error {\n\treturn trace.BadParameter(\"not implemented\")\n}", "title": "" }, { "docid": "bc5d78f959b3a99d29ba147c051c1c25", "score": "0.53213626", "text": "func (a *defragmentator) update(chunk []byte) bool {\n\t// each message contains index of current chunk and total count of chunks\n\tchunkIndex, count := int(chunk[10]), int(chunk[11])\n\tif a.chunksData == nil {\n\t\ta.chunksData = make([][]byte, count)\n\t}\n\tif count != len(a.chunksData) || chunkIndex >= count {\n\t\treturn false\n\t}\n\tbody := chunk[chunkedHeaderLen:]\n\tif a.chunksData[chunkIndex] == nil {\n\t\tchunkData := make([]byte, 0, len(body))\n\t\ta.totalBytes += len(body)\n\t\ta.chunksData[chunkIndex] = append(chunkData, body...)\n\t\ta.processed++\n\t}\n\treturn a.processed == len(a.chunksData)\n}", "title": "" }, { "docid": "24c13e3138bdd8a492d12948b80acaa0", "score": "0.5282259", "text": "func (cfile *CFile) seekWriteChunk(addr string, conn *grpc.ClientConn, req *dp.SeekWriteChunkReq, copies *uint64) {\n\n\tif conn == nil {\n\t} else {\n\t\tdc := dp.NewDataNodeClient(conn)\n\t\tctx, _ := context.WithTimeout(context.Background(), METANODE_TIMEOUT_SECONDS*time.Second)\n\t\tret, err := dc.SeekWriteChunk(ctx, req)\n\t\tif err != nil {\n\t\t\tcfile.delErrDataConn(addr)\n\t\t\tlogger.Error(\"SeekWriteChunk err %v\", err)\n\t\t} else {\n\t\t\tif ret.Ret != 0 {\n\t\t\t} else {\n\t\t\t\tatomic.AddUint64(copies, 1)\n\t\t\t}\n\t\t}\n\t}\n\tcfile.wgWriteReps.Add(-1)\n\n}", "title": "" }, { "docid": "0ba3a5af4ef2f3094bd53e34ae95d868", "score": "0.52441335", "text": "func (fh *fileHandle) _writeChunk(data []byte, maxWriteBufSize int64, force bool) (err error) {\n\tif fh.writeBuffer == nil {\n\t\tfh.writeBuffer = newWriteBuffer()\n\t}\n\n\t// Buffer the writes to make sure we don't send an append request for small data chunks.\n\tif _, err := fh.writeBuffer.write(data); err != nil {\n\t\treturn err\n\t}\n\n\t// Once we have filled writing buffer to enough size (determined by `maxWriteBufSize`)\n\t// we need to issue an append request.\n\tif fh.writeBuffer.size() > maxWriteBufSize || force {\n\t\tif fh.appendHandle, err = fh.file.Write(fh.writeBuffer.reader(), fh.appendHandle, fh.writeBuffer.size()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfh.writeBuffer.reset()\n\t}\n\n\tif fh.wsize == 0 {\n\t\tfh.dirty = true\n\t}\n\tfh.wsize += uint64(len(data))\n\treturn nil\n}", "title": "" }, { "docid": "f8a550c5ca605aacdef319d9b1e862e0", "score": "0.52427685", "text": "func (state *inMemoryChannelState) send() bool {\n\t// Hold up transmission if we're being throttled\n\tif !state.stopping && state.channel.throttle.IsThrottled() {\n\t\tif !state.waitThrottle() {\n\t\t\t// Stopped\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Send\n\tif len(state.buffer) > 0 {\n\t\tstate.channel.waitgroup.Add(1)\n\n\t\t// If we have a callback, wait on the waitgroup now that it's\n\t\t// incremented.\n\t\tstate.channel.signalWhenDone(state.callback)\n\n\t\tgo func(buffer telemetryBufferItems, retry bool, retryTimeout time.Duration) {\n\t\t\tdefer state.channel.waitgroup.Done()\n\t\t\tstate.channel.transmitRetry(buffer, retry, retryTimeout)\n\t\t}(state.buffer, state.retry, state.retryTimeout)\n\t} else if state.callback != nil {\n\t\tstate.channel.signalWhenDone(state.callback)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "88bcc26f4120240fe20f0555e6a47ead", "score": "0.5213488", "text": "func (cc *clientConn) writeChunks(ctx context.Context, rs ResultSet, binary bool, serverStatus uint16) error {\n\tdata := cc.alloc.AllocWithLen(4, 1024)\n\treq := rs.NewChunk()\n\tgotColumnInfo := false\n\tfor {\n\t\t// Here server.tidbResultSet implements Next method.\n\t\terr := rs.Next(ctx, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !gotColumnInfo {\n\t\t\t// We need to call Next before we get columns.\n\t\t\t// Otherwise, we will get incorrect columns info.\n\t\t\tcolumns := rs.Columns()\n\t\t\terr = cc.writeColumnInfo(columns, serverStatus)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tgotColumnInfo = true\n\t\t}\n\t\trowCount := req.NumRows()\n\t\tif rowCount == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor i := 0; i < rowCount; i++ {\n\t\t\tdata = data[0:4]\n\t\t\tif binary {\n\t\t\t\tdata, err = dumpBinaryRow(data, rs.Columns(), req.GetRow(i))\n\t\t\t} else {\n\t\t\t\tdata, err = dumpTextRow(data, rs.Columns(), req.GetRow(i))\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = cc.writePacket(data); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn cc.writeEOF(serverStatus)\n}", "title": "" }, { "docid": "888f6414363407ae7ed6425e78b4f500", "score": "0.52132714", "text": "func (m *Manager) RestoreChunk(chunk []byte) (bool, error) {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\tif m.operation != opRestore {\n\t\treturn false, sdkerrors.Wrap(sdkerrors.ErrLogic, \"no restore operation in progress\")\n\t}\n\n\tif int(m.restoreChunkIndex) >= len(m.restoreChunkHashes) {\n\t\treturn false, sdkerrors.Wrap(sdkerrors.ErrLogic, \"received unexpected chunk\")\n\t}\n\n\t// Check if any errors have occurred yet.\n\tselect {\n\tcase done := <-m.chRestoreDone:\n\t\tm.endLocked()\n\t\tif done.err != nil {\n\t\t\treturn false, done.err\n\t\t}\n\t\treturn false, sdkerrors.Wrap(sdkerrors.ErrLogic, \"restore ended unexpectedly\")\n\tdefault:\n\t}\n\n\t// Verify the chunk hash.\n\thash := sha256.Sum256(chunk)\n\texpected := m.restoreChunkHashes[m.restoreChunkIndex]\n\tif !bytes.Equal(hash[:], expected) {\n\t\treturn false, sdkerrors.Wrapf(types.ErrChunkHashMismatch,\n\t\t\t\"expected %x, got %x\", hash, expected)\n\t}\n\n\t// Pass the chunk to the restore, and wait for completion if it was the final one.\n\tm.chRestore <- io.NopCloser(bytes.NewReader(chunk))\n\tm.restoreChunkIndex++\n\n\tif int(m.restoreChunkIndex) >= len(m.restoreChunkHashes) {\n\t\tclose(m.chRestore)\n\t\tm.chRestore = nil\n\t\tdone := <-m.chRestoreDone\n\t\tm.endLocked()\n\t\tif done.err != nil {\n\t\t\treturn false, done.err\n\t\t}\n\t\tif !done.complete {\n\t\t\treturn false, sdkerrors.Wrap(sdkerrors.ErrLogic, \"restore ended prematurely\")\n\t\t}\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "e8ed868f19de8bd179dce5de747f20f2", "score": "0.51647854", "text": "func broadcastChunk(fileChunk *FileChunk, chunk *[]byte, namespace string) {\n\tmainState, _ := LoadMainState()\n\tchunkServers := []ChunkServer{}\n\tfor _, chunkServer := range mainState.ChunkServers {\n\t\tchunkServers = append(chunkServers, chunkServer)\n\t}\n\n\tbody := Chunk{\n\t\tFileChunk: *fileChunk,\n\t\tNamespace: namespace,\n\t\tData: hex.EncodeToString(*chunk),\n\t}\n\n\tpayloadBuf := new(bytes.Buffer)\n\t_ = json.NewEncoder(payloadBuf).Encode(body)\n\n\tstartIdx := rand.Intn(len(chunkServers))\n\tfor i := 0; i < ReplicaCount; i++ {\n\t\treplica := ChunkReplica{\n\t\t\tExternalAddress: chunkServers[(startIdx+i)%len(chunkServers)].ExternalAddress,\n\t\t\tLocalAddress: chunkServers[(startIdx+i)%len(chunkServers)].LocalAddress,\n\t\t\tHealthy: true,\n\t\t}\n\n\t\t_, err := PostJSON(replica.LocalAddress+\"/chunkserver/replica\", body, map[string]string{\"APIKEY\": APIKey})\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed to propagate chunk\")\n\t\t\treplica.Healthy = false\n\t\t}\n\n\t\tfileChunk.Replicas = append(fileChunk.Replicas, replica)\n\t}\n}", "title": "" }, { "docid": "7df9f15befae2e86564a8e1f82c386b3", "score": "0.51522195", "text": "func (handler *UploadHandler) writeChunk(id string, info tusd.FileInfo, length int64, w http.ResponseWriter, r *http.Request) (int64, error) {\n\toffset := info.Offset\n\n\t// Test if this upload fits into the file's size\n\tif !info.SizeIsDeferred && offset+length > info.Size {\n\t\treturn 0, tusd.ErrSizeExceeded\n\t}\n\n\tmaxSize := info.Size - offset\n\t// If the upload's length is deferred and the PATCH request does not contain the Content-Length\n\t// header (which is allowed if 'Transfer-Encoding: chunked' is used), we still need to set limits for\n\t// the body size.\n\tif info.SizeIsDeferred {\n\t\tif handler.MaxSize > 0 {\n\t\t\t// Ensure that the upload does not exceed the maximum upload size\n\t\t\tmaxSize = handler.MaxSize - offset\n\t\t} else {\n\t\t\t// If no upload limit is given, we allow arbitrary sizes\n\t\t\tmaxSize = math.MaxInt64\n\t\t}\n\t}\n\tif length > 0 {\n\t\tmaxSize = length\n\t}\n\n\tvar bytesWritten int64\n\t// Prevent a nil pointer dereference when accessing the body which may not be\n\t// available in the case of a malicious request.\n\tif r.Body != nil {\n\t\tvar uploadFile io.ReadCloser\n\t\tuploadFile, _, err := r.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\tif err != http.ErrMissingFile && err != http.ErrNotMultipart {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tuploadFile = r.Body\n\t\t}\n\t\tdefer uploadFile.Close()\n\n\t\t// Limit the data read from the request's body to the allowed maximum\n\t\treader := io.LimitReader(uploadFile, maxSize)\n\n\t\tif handler.NotifyUploadProgress {\n\t\t\tvar stop chan<- struct{}\n\t\t\treader, stop = handler.sendProgressMessages(info, reader)\n\t\t\tdefer close(stop)\n\t\t}\n\n\t\tbytesWritten, err = handler.composer.Core.WriteChunk(id, offset, reader)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\t// Send new offset to client\n\tnewOffset := offset + bytesWritten\n\tw.Header().Set(\"Upload-Offset\", strconv.FormatInt(newOffset, 10))\n\tinfo.Offset = newOffset\n\n\treturn info.Offset, handler.finishUploadIfComplete(info)\n}", "title": "" }, { "docid": "8eacc9864b7a8694d06d4e5eed44e795", "score": "0.51129913", "text": "func TestChunkUploadDownload(t *testing.T) {\n\n\tvar (\n\t\tresource = func(addr swarm.Address) string { return \"/bzz-chunk/\" + addr.String() }\n\t\tvalidHash = swarm.MustParseHexAddress(\"aabbcc\")\n\t\tinvalidHash = swarm.MustParseHexAddress(\"bbccdd\")\n\t\tvalidContent = []byte(\"bbaatt\")\n\t\tinvalidContent = []byte(\"bbaattss\")\n\t\tmockValidator = validator.NewMockValidator(validHash, validContent)\n\t\tmockValidatingStorer = mock.NewValidatingStorer(mockValidator)\n\t\tclient = newTestServer(t, testServerOptions{\n\t\t\tStorer: mockValidatingStorer,\n\t\t})\n\t)\n\n\tt.Run(\"invalid hash\", func(t *testing.T) {\n\t\tjsonhttptest.ResponseDirect(t, client, http.MethodPost, resource(invalidHash), bytes.NewReader(validContent), http.StatusBadRequest, jsonhttp.StatusResponse{\n\t\t\tMessage: \"chunk write error\",\n\t\t\tCode: http.StatusBadRequest,\n\t\t})\n\n\t\t// make sure chunk is not retrievable\n\t\t_ = request(t, client, http.MethodGet, resource(invalidHash), nil, http.StatusNotFound)\n\t})\n\n\tt.Run(\"invalid content\", func(t *testing.T) {\n\t\tjsonhttptest.ResponseDirect(t, client, http.MethodPost, resource(validHash), bytes.NewReader(invalidContent), http.StatusBadRequest, jsonhttp.StatusResponse{\n\t\t\tMessage: \"chunk write error\",\n\t\t\tCode: http.StatusBadRequest,\n\t\t})\n\n\t\t// make sure not retrievable\n\t\t_ = request(t, client, http.MethodGet, resource(validHash), nil, http.StatusNotFound)\n\t})\n\n\tt.Run(\"ok\", func(t *testing.T) {\n\t\tjsonhttptest.ResponseDirect(t, client, http.MethodPost, resource(validHash), bytes.NewReader(validContent), http.StatusOK, jsonhttp.StatusResponse{\n\t\t\tMessage: http.StatusText(http.StatusOK),\n\t\t\tCode: http.StatusOK,\n\t\t})\n\n\t\t// try to fetch the same chunk\n\t\tresp := request(t, client, http.MethodGet, resource(validHash), nil, http.StatusOK)\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif !bytes.Equal(validContent, data) {\n\t\t\tt.Fatal(\"data retrieved doesnt match uploaded content\")\n\t\t}\n\t})\n\tt.Run(\"pin-invalid-value\", func(t *testing.T) {\n\t\theaders := make(map[string][]string)\n\t\theaders[api.PinHeaderName] = []string{\"hdgdh\"}\n\t\tjsonhttptest.ResponseDirectWithHeaders(t, client, http.MethodPost, resource(validHash), bytes.NewReader(validContent), http.StatusOK, jsonhttp.StatusResponse{\n\t\t\tMessage: http.StatusText(http.StatusOK),\n\t\t\tCode: http.StatusOK,\n\t\t}, headers)\n\n\t\t// Also check if the chunk is NOT pinned\n\t\tif mockValidatingStorer.GetModeSet(validHash) == storage.ModeSetPin {\n\t\t\tt.Fatal(\"chunk should not be pinned\")\n\t\t}\n\t})\n\tt.Run(\"pin-header-missing\", func(t *testing.T) {\n\t\theaders := make(map[string][]string)\n\t\tjsonhttptest.ResponseDirectWithHeaders(t, client, http.MethodPost, resource(validHash), bytes.NewReader(validContent), http.StatusOK, jsonhttp.StatusResponse{\n\t\t\tMessage: http.StatusText(http.StatusOK),\n\t\t\tCode: http.StatusOK,\n\t\t}, headers)\n\n\t\t// Also check if the chunk is NOT pinned\n\t\tif mockValidatingStorer.GetModeSet(validHash) == storage.ModeSetPin {\n\t\t\tt.Fatal(\"chunk should not be pinned\")\n\t\t}\n\t})\n\tt.Run(\"pin-ok\", func(t *testing.T) {\n\t\theaders := make(map[string][]string)\n\t\theaders[api.PinHeaderName] = []string{\"True\"}\n\t\tjsonhttptest.ResponseDirectWithHeaders(t, client, http.MethodPost, resource(validHash), bytes.NewReader(validContent), http.StatusOK, jsonhttp.StatusResponse{\n\t\t\tMessage: http.StatusText(http.StatusOK),\n\t\t\tCode: http.StatusOK,\n\t\t}, headers)\n\n\t\t// Also check if the chunk is pinned\n\t\tif mockValidatingStorer.GetModeSet(validHash) != storage.ModeSetPin {\n\t\t\tt.Fatal(\"chunk is not pinned\")\n\t\t}\n\n\t})\n\n}", "title": "" }, { "docid": "7c012dbb8d99d477eebd80ee38c29d8c", "score": "0.5103615", "text": "func (p *StubProtocol) SendHave(start ChunkID, end ChunkID, remote PeerID, sid SwarmID) error {\n\treturn nil\n}", "title": "" }, { "docid": "040c5a3c8f042c875fdcb7a405f7c3c5", "score": "0.50943935", "text": "func TestSplitterJobPartialSingleChunk(t *testing.T) {\n\tt.Parallel()\n\n\tstore := inmemchunkstore.New()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tdata := []byte(\"foo\")\n\tj := internal.NewSimpleSplitterJob(ctx, store, int64(len(data)), false)\n\n\tc, err := j.Write(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif c < len(data) {\n\t\tt.Fatalf(\"short write %d\", c)\n\t}\n\n\thashResult := j.Sum(nil)\n\taddressResult := swarm.NewAddress(hashResult)\n\n\tbmtHashOfFoo := \"2387e8e7d8a48c2a9339c97c1dc3461a9a7aa07e994c5cb8b38fd7c1b3e6ea48\"\n\taddress := swarm.MustParseHexAddress(bmtHashOfFoo)\n\tif !addressResult.Equal(address) {\n\t\tt.Fatalf(\"expected %v, got %v\", address, addressResult)\n\t}\n\n\t_, err = j.Write([]byte(\"bar\"))\n\tif err == nil {\n\t\tt.Fatal(\"expected error writing after write/sum complete\")\n\t}\n}", "title": "" }, { "docid": "fe2421e93092273e05e5a43e49da586b", "score": "0.50707746", "text": "func (fileWriter *FileWriter) StoreFileChunk(file *[]byte) bool {\n\tn, err := fileWriter.file.Write(*file)\n\n\tif err != nil || n != len(*file) {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"Error\": err,\n\t\t\t\"Writen bytes\": n,\n\t\t}).Error(\"Failed writing a chunk of a file.\")\n\t\treturn true\n\t}\n\n\tfileWriter.file.Sync()\n\treturn false\n}", "title": "" }, { "docid": "ceb21014fc57497ce984f62aa727c48c", "score": "0.50665104", "text": "func (b *Buffer) writeChunk(idx uint32) {\r\n\tif chunk := idx >> chunkShift; b.chunk != chunk {\r\n\t\tb.chunk = chunk\r\n\t\tb.chunks = append(b.chunks, header{\r\n\t\t\tChunk: chunk,\r\n\t\t\tStart: uint32(len(b.buffer)),\r\n\t\t\tValue: uint32(b.last),\r\n\t\t})\r\n\t}\r\n}", "title": "" }, { "docid": "05e94c14c0de6d3ac0cd562b49e324e6", "score": "0.5057141", "text": "func (s *MuxedStream) getChunk() *streamChunk {\n\ts.writeLock.Lock()\n\tdefer s.writeLock.Unlock()\n\n\tchunk := &streamChunk{\n\t\tstreamID: s.streamID,\n\t\tsendHeaders: !s.headersSent,\n\t\theaders: s.writeHeaders,\n\t\twindowUpdate: s.windowUpdate,\n\t\tsendData: !s.sentEOF,\n\t\teof: s.writeEOF && uint32(s.writeBuffer.Len()) <= s.sendWindow,\n\t}\n\t// Copy at most s.sendWindow bytes, adjust the sendWindow accordingly\n\ttoCopy := int(s.sendWindow)\n\tif toCopy > s.writeBuffer.Len() {\n\t\ttoCopy = s.writeBuffer.Len()\n\t}\n\n\tif toCopy > 0 {\n\t\tbuf := make([]byte, toCopy)\n\t\twriteLen, _ := s.writeBuffer.Read(buf)\n\t\tchunk.buffer = buf[:writeLen]\n\t\ts.sendWindow -= uint32(writeLen)\n\t}\n\n\t// Allow MuxedStream::Write() to continue, if needed\n\tif s.writeBuffer.Len() < s.writeBufferMaxLen {\n\t\ts.notifyWriteBufferHasSpace()\n\t}\n\n\t// When we write the chunk, we'll write the WINDOW_UPDATE frame if needed\n\ts.receiveWindow += s.windowUpdate\n\ts.windowUpdate = 0\n\n\t// When we write the chunk, we'll write the headers if needed\n\ts.headersSent = true\n\n\t// if this chunk contains the end of the stream, close the stream now\n\tif chunk.sendData && chunk.eof {\n\t\ts.sentEOF = true\n\t}\n\n\treturn chunk\n}", "title": "" }, { "docid": "93384e6e605bf818a8ce8bc5413f5394", "score": "0.50234973", "text": "func (e *Engine) processMessageMediaChunk(ctx context.Context, msg *sarama.ConsumerMessage) error {\n\tvar mediaChunk mediaChunkMessage\n\tif err := json.Unmarshal(msg.Value, &mediaChunk); err != nil {\n\t\treturn errors.Wrap(err, \"unmarshal message value JSON\")\n\t}\n\tfinalUpdateMessage := chunkProcessedStatus{\n\t\tType: messageTypeChunkProcessedStatus,\n\t\tTaskID: mediaChunk.TaskID,\n\t\tChunkUUID: mediaChunk.ChunkUUID,\n\t\tStatus: chunkStatusSuccess, // optimistic\n\t}\n\tdefer func() {\n\t\t// send the final message\n\t\tfinalUpdateMessage.TimestampUTC = time.Now().Unix()\n\t\t_, _, err := e.producer.SendMessage(&sarama.ProducerMessage{\n\t\t\tTopic: e.Config.Kafka.ChunkTopic,\n\t\t\tKey: sarama.ByteEncoder(msg.Key),\n\t\t\tValue: newJSONEncoder(finalUpdateMessage),\n\t\t})\n\t\tif err != nil {\n\t\t\te.logDebug(\"WARN\", \"failed to send final chunk update:\", err)\n\t\t}\n\t}()\n\t// send chunk 'processing' update\n\tupdateMessage := chunkProcessedStatus{\n\t\tType: messageTypeChunkProcessedStatus,\n\t\tTimestampUTC: time.Now().Unix(),\n\t\tTaskID: mediaChunk.TaskID,\n\t\tChunkUUID: mediaChunk.ChunkUUID,\n\t\tStatus: chunkStatusProcessing,\n\t}\n\t_, _, err := e.producer.SendMessage(&sarama.ProducerMessage{\n\t\tTopic: e.Config.Kafka.ChunkTopic,\n\t\tKey: sarama.ByteEncoder(msg.Key),\n\t\tValue: newJSONEncoder(updateMessage),\n\t})\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"SendMessage: %q %s %s\", e.Config.Kafka.ChunkTopic, messageTypeChunkProcessedStatus, chunkStatusProcessing)\n\t\tfinalUpdateMessage.Status = chunkStatusError\n\t\tfinalUpdateMessage.ErrorMsg = err.Error()\n\t\treturn err\n\t}\n\n\t// start sending chunk processing updates\n\tctxProcessingUpdate, cancelProcessingUpdate := context.WithCancel(ctx)\n\tprocessingUpdateFinished := e.periodicallySendProgressMessage(ctxProcessingUpdate, msg.Key, mediaChunk.TaskID, mediaChunk.ChunkUUID)\n\n\tignoreChunk := false\n\tretry := newDoubleTimeBackoff(\n\t\te.Config.Webhooks.Backoff.InitialBackoffDuration,\n\t\te.Config.Webhooks.Backoff.MaxBackoffDuration,\n\t\te.Config.Webhooks.Backoff.MaxRetries,\n\t)\n\tvar engineOutputContent engineOutput\n\terr = retry.Do(func() error {\n\t\treq, err := newRequestFromMediaChunk(e.client, e.Config.Webhooks.Process.URL, mediaChunk)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"new request\")\n\t\t}\n\t\treq = req.WithContext(ctx)\n\t\tresp, err := e.client.Do(req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tvar buf bytes.Buffer\n\t\tif _, err := io.Copy(&buf, resp.Body); err != nil {\n\t\t\treturn errors.Wrap(err, \"read body\")\n\t\t}\n\t\tif resp.StatusCode == http.StatusNoContent {\n\t\t\tignoreChunk = true\n\t\t\treturn nil\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn errors.Errorf(\"%d: %s\", resp.StatusCode, buf.String())\n\t\t}\n\t\tif buf.Len() > 0 {\n\t\t\tif err := json.NewDecoder(&buf).Decode(&engineOutputContent); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"decode response\")\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}) // NOTE: this err is handled below\n\n\t// stop sending processing updates\n\tcancelProcessingUpdate()\n\t<-processingUpdateFinished\n\n\tif err != nil {\n\t\t// send error message\n\t\terr = errors.Wrapf(err, \"SendMessage: %q %s %s\", e.Config.Kafka.ChunkTopic, messageTypeChunkProcessedStatus, chunkStatusSuccess)\n\t\tfinalUpdateMessage.Status = chunkStatusError\n\t\tfinalUpdateMessage.ErrorMsg = err.Error()\n\t\treturn err\n\t}\n\tif ignoreChunk {\n\t\tfinalUpdateMessage.Status = chunkStatusIgnored\n\t\treturn nil\n\t}\n\tcontent, err := json.Marshal(engineOutputContent)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"json: marshal engine output content\")\n\t\tfinalUpdateMessage.Status = chunkStatusError\n\t\tfinalUpdateMessage.ErrorMsg = err.Error()\n\t\treturn err\n\t}\n\t// send output message\n\toutputMessage := mediaChunkMessage{\n\t\tType: messageTypeEngineOutput,\n\t\tTaskID: mediaChunk.TaskID,\n\t\tJobID: mediaChunk.JobID,\n\t\tChunkUUID: mediaChunk.ChunkUUID,\n\t\tStartOffsetMS: mediaChunk.StartOffsetMS,\n\t\tEndOffsetMS: mediaChunk.EndOffsetMS,\n\t\tContent: string(content),\n\t}\n\t_, _, err = e.producer.SendMessage(&sarama.ProducerMessage{\n\t\tTopic: e.Config.Kafka.ChunkTopic,\n\t\tKey: sarama.ByteEncoder(msg.Key),\n\t\tValue: newJSONEncoder(outputMessage),\n\t})\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"SendMessage: %q %s %s\", e.Config.Kafka.ChunkTopic, messageTypeEngineOutput, err)\n\t\tfinalUpdateMessage.Status = chunkStatusError\n\t\tfinalUpdateMessage.ErrorMsg = err.Error()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ce649f7bbdd09fec76abd7e675dd82d", "score": "0.50189936", "text": "func (s *Supervisor) sendReadyChunksToClient(client client.Client) {\n\tbackoff := &ExponentialBackoff{Minimum: 50 * time.Millisecond, Maximum: 5000 * time.Millisecond}\n\tfor {\n\t\tvar readyChunk *readyChunk\n\t\tselect {\n\t\tcase <-s.stopRequest:\n\t\t\treturn\n\t\tcase readyChunk = <-s.retryChunks:\n\t\t\t// got a retry chunk; use it\n\t\tdefault:\n\t\t\t// pull from the default readyChunk queue\n\t\t\tselect {\n\t\t\tcase <-s.stopRequest:\n\t\t\t\treturn\n\t\t\tcase readyChunk = <-s.readyChunks:\n\t\t\t\t// got a chunk\n\t\t\t}\n\t\t}\n\n\t\tif readyChunk != nil {\n\t\t\tGlobalStatistics.SetClientStatus(client.Name(), clientStatusSending)\n\t\t\tif err := s.sendChunk(client, readyChunk.Chunk); err != nil {\n\t\t\t\tgrohl.Report(err, grohl.Data{\"msg\": \"failed to send chunk\", \"resolution\": \"retrying\"})\n\t\t\t\tGlobalStatistics.SetClientStatus(client.Name(), clientStatusRetrying)\n\n\t\t\t\t// Put the chunk back on the queue for someone else to try\n\t\t\t\tselect {\n\t\t\t\tcase <-s.stopRequest:\n\t\t\t\t\treturn\n\t\t\t\tcase s.retryChunks <- readyChunk:\n\t\t\t\t\t// continue\n\t\t\t\t}\n\n\t\t\t\t// Backoff\n\t\t\t\tselect {\n\t\t\t\tcase <-s.stopRequest:\n\t\t\t\t\treturn\n\t\t\t\tcase <-time.After(backoff.Next()):\n\t\t\t\t\t// continue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbackoff.Reset()\n\t\t\t\tGlobalStatistics.IncrementClientLinesSent(client.Name(), len(readyChunk.Chunk))\n\n\t\t\t\t// Snapshot progress\n\t\t\t\tif err := s.acknowledgeChunk(readyChunk.Chunk); err != nil {\n\t\t\t\t\tgrohl.Report(err, grohl.Data{\"msg\": \"failed to acknowledge progress\", \"resolution\": \"skipping\"})\n\t\t\t\t}\n\n\t\t\t\ts.readerPool.UnlockAll(readyChunk.LockedReaders)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1c37120c3e9861eeb91293dfcc7b6bec", "score": "0.50015205", "text": "func (f *outFragment) writeChunkData(b []byte) (int, error) {\n\tif len(b) > len(f.remaining) {\n\t\treturn 0, errTooLarge\n\t}\n\n\tif len(f.chunkStart) == 0 {\n\t\treturn 0, errNoOpenChunk\n\t}\n\n\tcopy(f.remaining, b)\n\tf.remaining = f.remaining[len(b):]\n\tf.chunkSize += len(b)\n\tf.checksum.Add(b)\n\treturn len(b), nil\n}", "title": "" }, { "docid": "2a4c1f5ba0a7a196a746c6e911aea87c", "score": "0.4977924", "text": "func smtpMethod(plain []byte, final *slotFinal) {\n\tvar err error\n\tif final.getNumChunks() == 1 {\n\t\t// If this is a single chunk message, pool it and get out.\n\t\twritePlainToPool(plain, \"m\")\n\t\tstats.outPlain++\n\t\treturn\n\t}\n\t// We're an exit and this is a multi-chunk message\n\tchunkFilename := writePlainToPool(plain, \"p\")\n\tlog.Tracef(\n\t\t\"Pooled partial chunk. MsgID=%x, Num=%d, \"+\n\t\t\t\"Parts=%d, Filename=%s\",\n\t\tfinal.getMessageID(),\n\t\tfinal.getChunkNum(),\n\t\tfinal.getNumChunks(),\n\t\tchunkFilename,\n\t)\n\t// Fetch the chunks info from the DB for the given message ID\n\tchunks := ChunkDb.Get(final.getMessageID(), final.getNumChunks())\n\t// This saves losts of -1's as slices start at 0 and chunks at 1\n\tcslot := final.getChunkNum() - 1\n\t// Test that the slot for this chunk is empty\n\tif chunks[cslot] != \"\" {\n\t\tlog.Warnf(\n\t\t\t\"Duplicate chunk %d in MsgID: %x\",\n\t\t\tfinal.chunkNum,\n\t\t\tfinal.messageID,\n\t\t)\n\t}\n\t// Insert the new chunk into the slice\n\tchunks[cslot] = chunkFilename\n\tlog.Tracef(\n\t\t\"Chunk state: %s\",\n\t\tstrings.Join(chunks, \",\"),\n\t)\n\t// Test if all chunk slots are populated\n\tif IsPopulated(chunks) {\n\t\tnewPoolFile := randPoolFilename(\"m\")\n\t\tlog.Tracef(\n\t\t\t\"Assembling chunked message into %s\",\n\t\t\tnewPoolFile,\n\t\t)\n\t\terr = ChunkDb.Assemble(newPoolFile, chunks)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Chunk assembly failed: %s\", err)\n\t\t\t// Don't return here or the bad chunk will remain in\n\t\t\t// the DB.\n\t\t}\n\t\t// Now the message is assembled into the Pool, the DB record\n\t\t// can be deleted\n\t\tChunkDb.Delete(final.getMessageID())\n\t\tstats.outPlain++\n\t} else {\n\t\t// Write the updated chunk status to\n\t\t// the DB\n\t\tChunkDb.Insert(final.getMessageID(), chunks)\n\t}\n}", "title": "" }, { "docid": "374b7fef515b69bea99ea8c745a98d8a", "score": "0.49764892", "text": "func (w *Writer) uploadBuffer(buf []byte, recvd int, start int64, doneReading bool) (*storagepb.Object, int64, bool, error) {\n\tvar err error\n\tvar finishWrite bool\n\tvar sent, limit int = 0, maxPerMessageWriteSize\n\toffset := start\n\tfor {\n\t\tfirst := sent == 0\n\t\t// This indicates that this is the last message and the remaining\n\t\t// data fits in one message.\n\t\tbelowLimit := recvd-sent <= limit\n\t\tif belowLimit {\n\t\t\tlimit = recvd - sent\n\t\t}\n\t\tif belowLimit && doneReading {\n\t\t\tfinishWrite = true\n\t\t}\n\n\t\t// Prepare chunk section for upload.\n\t\tdata := buf[sent : sent+limit]\n\t\treq := &storagepb.WriteObjectRequest{\n\t\t\tData: &storagepb.WriteObjectRequest_ChecksummedData{\n\t\t\t\tChecksummedData: &storagepb.ChecksummedData{\n\t\t\t\t\tContent: data,\n\t\t\t\t},\n\t\t\t},\n\t\t\tWriteOffset: offset,\n\t\t\tFinishWrite: finishWrite,\n\t\t}\n\n\t\t// Open a new stream and set the first_message field on the request.\n\t\t// The first message on the WriteObject stream must either be the\n\t\t// Object or the Resumable Upload ID.\n\t\tif first {\n\t\t\tw.stream, err = w.o.c.gc.WriteObject(w.ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, 0, false, err\n\t\t\t}\n\n\t\t\tif w.upid != \"\" {\n\t\t\t\treq.FirstMessage = &storagepb.WriteObjectRequest_UploadId{UploadId: w.upid}\n\t\t\t} else {\n\t\t\t\tspec, err := w.writeObjectSpec()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, 0, false, err\n\t\t\t\t}\n\t\t\t\treq.FirstMessage = &storagepb.WriteObjectRequest_WriteObjectSpec{\n\t\t\t\t\tWriteObjectSpec: spec,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Currently the checksums are only sent on the first message\n\t\t\t// of the stream, but in the future, we must also support sending it\n\t\t\t// on the *last* message of the stream (instead of the first).\n\t\t\tif w.SendCRC32C {\n\t\t\t\treq.ObjectChecksums = &storagepb.ObjectChecksums{\n\t\t\t\t\tCrc32C: proto.Uint32(w.CRC32C),\n\t\t\t\t\tMd5Hash: w.MD5,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\terr = w.stream.Send(req)\n\t\tif err == io.EOF {\n\t\t\t// err was io.EOF. The client-side of a stream only gets an EOF on Send\n\t\t\t// when the backend closes the stream and wants to return an error\n\t\t\t// status. Closing the stream receives the status as an error.\n\t\t\t_, err = w.stream.CloseAndRecv()\n\n\t\t\t// Retriable errors mean we should start over and attempt to\n\t\t\t// resend the entire buffer via a new stream.\n\t\t\t// If not retriable, falling through will return the error received\n\t\t\t// from closing the stream.\n\t\t\tif shouldRetry(err) {\n\t\t\t\tsent = 0\n\t\t\t\tfinishWrite = false\n\t\t\t\t// TODO: Add test case for failure modes of querying progress.\n\t\t\t\toffset, err = w.determineOffset(start)\n\t\t\t\tif err == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, 0, false, err\n\t\t}\n\n\t\t// Update the immediate stream's sent total and the upload offset with\n\t\t// the data sent.\n\t\tsent += len(data)\n\t\toffset += int64(len(data))\n\n\t\t// Not done sending data, do not attempt to commit it yet, loop around\n\t\t// and send more data.\n\t\tif recvd-sent > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Done sending data. Close the stream to \"commit\" the data sent.\n\t\tresp, finalized, err := w.commit()\n\t\t// Retriable errors mean we should start over and attempt to\n\t\t// resend the entire buffer via a new stream.\n\t\t// If not retriable, falling through will return the error received\n\t\t// from closing the stream.\n\t\tif shouldRetry(err) {\n\t\t\tsent = 0\n\t\t\tfinishWrite = false\n\t\t\toffset, err = w.determineOffset(start)\n\t\t\tif err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, 0, false, err\n\t\t}\n\n\t\treturn resp.GetResource(), offset, finalized, nil\n\t}\n}", "title": "" }, { "docid": "2f97aca77dd58ff7bc0d0c385f390bcc", "score": "0.49729717", "text": "func (e *MergeJoinExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error {\n\tchk.Reset()\n\tif !e.prepared {\n\t\tif err := e.prepare(ctx, chk); err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t}\n\tfor {\n\t\tif chk.NumRows() == e.maxChunkSize {\n\t\t\treturn nil\n\t\t}\n\n\t\t// reach here means there is no more data in \"e.resultChunk\"\n\t\thasMore, err := e.joinToChunk(chk)\n\t\tif err != nil || !hasMore {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e14af515078010464f3574a5fcbee510", "score": "0.49663743", "text": "func (r *JobRunner) onUploadChunk(chunk *LogStreamerChunk) error {\n\t// We consider logs to be an important thing, and we shouldn't give up\n\t// on sending the chunk data back to Buildkite. In the event Buildkite\n\t// is having downtime or there are connection problems, we'll want to\n\t// hold onto chunks until it's back online to upload them.\n\t//\n\t// This code will retry forever until we get back a successful response\n\t// from Buildkite that it's considered the chunk (a 4xx will be\n\t// returned if the chunk is invalid, and we shouldn't retry on that)\n\treturn retry.Do(func(s *retry.Stats) error {\n\t\tresponse, err := r.apiClient.UploadChunk(r.job.ID, &api.Chunk{\n\t\t\tData: chunk.Data,\n\t\t\tSequence: chunk.Order,\n\t\t\tOffset: chunk.Offset,\n\t\t\tSize: chunk.Size,\n\t\t})\n\t\tif err != nil {\n\t\t\tif response != nil && (response.StatusCode >= 400 && response.StatusCode <= 499) {\n\t\t\t\tr.logger.Warn(\"Buildkite rejected the chunk upload (%s)\", err)\n\t\t\t\ts.Break()\n\t\t\t} else {\n\t\t\t\tr.logger.Warn(\"%s (%s)\", err, s)\n\t\t\t}\n\t\t}\n\n\t\treturn err\n\t}, &retry.Config{Forever: true, Jitter: true, Interval: 5 * time.Second})\n}", "title": "" }, { "docid": "b4b24684ed6d7ef32fe77c0a927613bc", "score": "0.49374506", "text": "func (q *Queue) SendBatch(ctx context.Context, iterator BatchIterator) error {\n\tspan, ctx := q.startSpanFromContext(ctx, \"sb.Queue.SendBatch\")\n\tdefer span.Finish()\n\n\terr := q.ensureSender(ctx)\n\tif err != nil {\n\t\tlog.For(ctx).Error(err)\n\t\treturn err\n\t}\n\n\tfor !iterator.Done() {\n\t\tid, err := uuid.NewV4()\n\t\tif err != nil {\n\t\t\tlog.For(ctx).Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tbatch, err := iterator.Next(id.String(), &BatchOptions{\n\t\t\tSessionID: q.sender.sessionID,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.For(ctx).Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif err := q.sender.trySend(ctx, batch); err != nil {\n\t\t\tlog.For(ctx).Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "66ae73ba7b9085eaa966f91e4439d33d", "score": "0.4932058", "text": "func UploadByChunk(db *dropbox.Dropbox, fd *os.File, chunksize int, dst string, overwrite bool, parentRev string) (*dropbox.Entry, error) {\n\tvar err error\n\tvar cur *dropbox.ChunkUploadResponse\n\n\tfilename := \"resp.json\"\n\n\tfor err == nil {\n\t\tif _, err := os.Stat(filename); err == nil {\n\t\t\tcur, err = readFromFile(filename)\n\t\t\tret, _ := fd.Seek(int64(cur.Offset), 0)\n\t\t\tlog.Println(\"current offset:\", ret)\n\t\t}\n\n\t\tif cur, err = db.ChunkedUpload(cur, fd, chunksize); err != nil && err != io.EOF {\n\t\t\tif cur != nil {\n\t\t\t\tret, _ := fd.Seek(int64(cur.Offset), 0)\n\t\t\t\tlog.Println(\"====================Resend upload request=================\")\n\t\t\t\tlog.Println(\"resend current offset:\", ret)\n\t\t\t\tcur, err = db.ChunkedUpload(cur, fd, chunksize)\n\t\t\t}\n\n\t\t\tif err != nil && err != io.EOF {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\twriteToFile(cur, filename)\n\n\t}\n\n\tentry, err := db.CommitChunkedUpload(cur.UploadID, dst, overwrite, parentRev)\n\n\tos.Remove(filename)\n\n\treturn entry, err\n}", "title": "" }, { "docid": "202604f327fd23c5655ffab4b15cd49b", "score": "0.49268988", "text": "func sendBatch(opts SendOptions, addrs []net.Addr, rpcContext *rpc.Context) (*roachpb.BatchResponse, error) {\n\treturn (&DistSender{}).sendToReplicas(opts, 0, makeReplicas(addrs...), roachpb.BatchRequest{}, rpcContext)\n}", "title": "" }, { "docid": "5463176d81f40d5540a30a63b0a8c6f8", "score": "0.4926045", "text": "func SendBytes(arr []byte, offset, Length int16) {\n\tfor Length > 0 {\n\t\ttemp := Length\n\t\t// Need to force GET RESPONSE for Case 4 & for partial blocks\n\t\tif Length != int16(Lr) || Lr != Le || sendInProgressFlag {\n\t\t\ttemp = send61xx(Length) //send data remainig status\n\t\t}\n\t\tnativeMethods.T0SendData(arr, offset, temp)\n\t\tsendInProgressFlag = true\n\t\toffset += temp\n\t\tLength -= temp\n\t\tLr -= byte(temp)\n\t\tLe = Lr\n\t}\n\tsendInProgressFlag = false\n}", "title": "" }, { "docid": "5ca176e4da7ed51352f19ab3a94f93bd", "score": "0.49067312", "text": "func (m *Server) SendTransaction(\n\tctx context.Context,\n\targs *SendTransactionArgs,\n) (*SendTransactionReply, error) {\n\ttoBytes, err := hexutil.Decode(args.To)\n\tif err != nil {\n\t\treturn nil, errors2.Wrap(err, \"error decoding to\")\n\t}\n\tvar to common.Address\n\tcopy(to[:], toBytes)\n\n\tsequenceNum, valid := new(big.Int).SetString(args.SequenceNum, 10)\n\tif !valid {\n\t\treturn nil, errors.New(\"Invalid sequence num\")\n\t}\n\n\tvalueInt, valid := new(big.Int).SetString(args.Value, 10)\n\tif !valid {\n\t\treturn nil, errors.New(\"Invalid value\")\n\t}\n\n\tdata, err := hexutil.Decode(args.Data)\n\tif err != nil {\n\t\treturn nil, errors2.Wrap(err, \"error decoding data\")\n\t}\n\n\tpubkey, err := hexutil.Decode(args.Pubkey)\n\tif err != nil {\n\t\treturn nil, errors2.Wrap(err, \"error decoding pubkey\")\n\t}\n\n\tsignature, err := hexutil.Decode(args.Signature)\n\tif err != nil {\n\t\treturn nil, errors2.Wrap(err, \"error decoding signature\")\n\t}\n\n\tif len(signature) != signatureLength {\n\t\treturn nil, errors.New(\"signature of wrong length\")\n\t}\n\n\t// Convert sig with normalized v\n\tif signature[recoverBitPos] == 27 {\n\t\tsignature[recoverBitPos] = 0\n\t} else if signature[recoverBitPos] == 28 {\n\t\tsignature[recoverBitPos] = 1\n\t}\n\n\ttxDataHash := message.BatchTxHash(\n\t\tm.rollupAddress,\n\t\tto,\n\t\tsequenceNum,\n\t\tvalueInt,\n\t\tdata,\n\t)\n\n\tmessageHash := hashing.SoliditySHA3WithPrefix(txDataHash[:])\n\n\tif !crypto.VerifySignature(\n\t\tpubkey,\n\t\tmessageHash[:],\n\t\tsignature[:len(signature)-1],\n\t) {\n\t\treturn nil, errors.New(\"Invalid signature\")\n\t}\n\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tif !m.valid {\n\t\treturn nil, errors.New(\"Tx aggregator is not running\")\n\t}\n\n\tvar sigData [signatureLength]byte\n\tcopy(sigData[:], signature)\n\n\tm.transactions = append(m.transactions, message.BatchTx{\n\t\tTo: to,\n\t\tSeqNum: sequenceNum,\n\t\tValue: valueInt,\n\t\tData: data,\n\t\tSig: sigData,\n\t})\n\n\treturn &SendTransactionReply{}, nil\n}", "title": "" }, { "docid": "140af8f83d5e3c426068dc677908140d", "score": "0.4903169", "text": "func (s sender) Send(ctx context.Context, ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) {\n\tbr, err := s.Batch(ctx, &ba, grpc.FailFast(false))\n\tif err != nil {\n\t\treturn nil, roachpb.NewError(errors.Wrap(err, \"roachpb.Batch RPC failed\"))\n\t}\n\tpErr := br.Error\n\tbr.Error = nil\n\treturn br, pErr\n}", "title": "" }, { "docid": "f995abbf502608c745933568f0c1f43d", "score": "0.49022254", "text": "func writeChunk(writer io.Writer, chunkType string, data []byte) error {\n\tvar err error\n\n\ttypeCode := []byte(chunkType)\n\tif len(typeCode) != 4 {\n\t\treturn fmt.Errorf(\"Chunk type must be 4 bytes long\")\n\t}\n\ttypeCode = typeCode[0:4]\n\n\t_, err = writer.Write(typeCode)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = binary.Write(writer, binary.LittleEndian, int32(len(data)))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = writer.Write(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c7cf8426e09d5b2a2c4964b3e9a6e5c", "score": "0.4900658", "text": "func (client *Upload) Write(data []byte) (written int, err error) {\n\tctx := client.ctx\n\tdefer mon.Task()(&ctx, \"node: \"+client.peer.ID.String()[0:8])(&err)\n\n\tif client.finished {\n\t\treturn 0, io.EOF\n\t}\n\t// if we already encountered an error, keep returning it\n\tif client.sendError != nil {\n\t\treturn 0, client.sendError\n\t}\n\n\tfullData := data\n\tdefer func() {\n\t\t// write the hash of the data sent to the server\n\t\t// guaranteed not to return error\n\t\t_, _ = client.hash.Write(fullData[:written])\n\t}()\n\n\tfor len(data) > 0 {\n\t\t// pick a data chunk to send\n\t\tvar sendData []byte\n\t\tif client.allocationStep < int64(len(data)) {\n\t\t\tsendData, data = data[:client.allocationStep], data[client.allocationStep:]\n\t\t} else {\n\t\t\tsendData, data = data, nil\n\t\t}\n\n\t\t// create a signed order for the next chunk\n\t\torder, err := signing.SignUplinkOrder(ctx, client.privateKey, &pb.Order{\n\t\t\tSerialNumber: client.limit.SerialNumber,\n\t\t\tAmount: client.offset + int64(len(sendData)),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn written, ErrInternal.Wrap(err)\n\t\t}\n\n\t\t// send signed order + data\n\t\terr = client.stream.Send(&pb.PieceUploadRequest{\n\t\t\tOrder: order,\n\t\t\tChunk: &pb.PieceUploadRequest_Chunk{\n\t\t\t\tOffset: client.offset,\n\t\t\t\tData: sendData,\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\t_, closeErr := client.stream.CloseAndRecv()\n\t\t\tswitch {\n\t\t\tcase err != io.EOF && closeErr != nil:\n\t\t\t\terr = ErrProtocol.Wrap(errs.Combine(err, closeErr))\n\t\t\tcase closeErr != nil:\n\t\t\t\terr = ErrProtocol.Wrap(closeErr)\n\t\t\t}\n\n\t\t\tclient.sendError = err\n\t\t\treturn written, err\n\t\t}\n\n\t\t// update our offset\n\t\tclient.offset += int64(len(sendData))\n\t\twritten += len(sendData)\n\n\t\t// update allocation step, incrementally building trust\n\t\tclient.allocationStep = client.client.nextAllocationStep(client.allocationStep)\n\t}\n\n\treturn written, nil\n}", "title": "" }, { "docid": "0dead108791c9f1cc425299e7415a389", "score": "0.48994428", "text": "func (t *transaction) send(conn *redisconn.Connection, ask bool) {\n\tt.res = make([]interface{}, len(t.reqs)+1)\n\tflags := redisconn.DoTransaction\n\tif ask {\n\t\tt.asked = true\n\t\tflags |= redisconn.DoAsking\n\t}\n\tconn.SendBatchFlags(t.reqs, t, 0, flags)\n}", "title": "" }, { "docid": "05a2858166e7a3ad185833a6d8ec46b1", "score": "0.4893814", "text": "func (stream *Stream) sendOrDrop(request *orderer.StepRequest, allowDrop bool, report func(error)) error {\n\tmsgType := \"transaction\"\n\tif allowDrop {\n\t\tmsgType = \"consensus\"\n\t}\n\n\tstream.metrics.reportQueueOccupancy(stream.Endpoint, msgType, stream.Channel, len(stream.sendBuff), cap(stream.sendBuff))\n\n\tif allowDrop && len(stream.sendBuff) == cap(stream.sendBuff) {\n\t\tstream.Cancel(errOverflow)\n\t\tstream.metrics.reportMessagesDropped(stream.Endpoint, stream.Channel)\n\t\treturn errOverflow\n\t}\n\n\tselect {\n\tcase <-stream.abortChan:\n\t\treturn errors.Errorf(\"stream %d aborted\", stream.ID)\n\tcase stream.sendBuff <- struct {\n\t\trequest *orderer.StepRequest\n\t\treport func(error)\n\t}{request: request, report: report}:\n\t\treturn nil\n\tcase <-stream.commShutdown:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "8adc385485690de6ecf16dc0c03302e3", "score": "0.48921794", "text": "func (p *PinningService) PinnedChunk(ctx context.Context, a swarm.Address) (resp PinnedChunk, err error) {\n\terr = p.client.requestJSON(ctx, http.MethodGet, \"/pin/chunks/\"+a.String(), nil, &resp)\n\treturn\n}", "title": "" }, { "docid": "3fce8e6e94ad96e7b7b396ffa39b5e13", "score": "0.48897257", "text": "func (f *outFragment) canFitNewChunk() bool {\n\treturn len(f.remaining) > 2\n}", "title": "" }, { "docid": "8933d9e07e4f9c48a27cd8129bc4948c", "score": "0.48876166", "text": "func ConsumeChunk(buf []byte, payload *Chunk) ([]byte, error) {\n\tbuf = ConsumeNodeId(buf, &payload.Source)\n\tbuf = ConsumeNodeId(buf, &payload.Target)\n\tbuf = ConsumeStreamId(buf, &payload.Stream)\n\tbuf = ConsumeSequenceId(buf, &payload.Sequence)\n\tbuf = ConsumeSubsequenceIndex(buf, &payload.Subsequence)\n\treturn ConsumeBytesWithLength(buf, &payload.Data)\n}", "title": "" }, { "docid": "5bfb4ff284ba32ef33557b37594fcb6d", "score": "0.48809904", "text": "func (call *OutboundCall) flushFragment(fragment *outFragment, last bool) error {\n\tselect {\n\tcase <-call.ctx.Done():\n\t\treturn call.failed(call.ctx.Err())\n\n\tcase call.conn.sendCh <- fragment.finish(last):\n\t\treturn nil\n\n\tdefault:\n\t\treturn call.failed(ErrSendBufferFull)\n\t}\n}", "title": "" }, { "docid": "8d620458f87330f8f485a4c82cbf6847", "score": "0.4856861", "text": "func AppendChunk(buf []byte, payload *Chunk) []byte {\n\tbuf = AppendNodeId(buf, payload.Source)\n\tbuf = AppendNodeId(buf, payload.Target)\n\tbuf = AppendStreamId(buf, payload.Stream)\n\tbuf = AppendSequenceId(buf, payload.Sequence)\n\tbuf = AppendSubsequenceIndex(buf, payload.Subsequence)\n\treturn AppendBytesWithLength(buf, payload.Data)\n}", "title": "" }, { "docid": "3e5d681148e1b904a68328c39cc4eaf4", "score": "0.48552537", "text": "func (rc *readConn) readChunk(chunkMsg *Chunk) []byte {\n\t// Is this a chunk that was already received?\n\t// Drop already-received duplicates.\n\tif chunkMsg.seqno < rc.nread {\n\t\treturn nil\n\t}\n\tif chunkMsg.seqno == rc.nread {\n\t\trc.nread++\n\t\tif rc.nread%AckFrequency == 0 {\n\t\t\trc.ackWrite(rc.nread)\n\t\t}\n\t\tif chunkMsg == nil {\n\t\t\tpanic(\"eh\")\n\t\t}\n\t\treturn chunkMsg.chunk\n\t}\n\t// Otherwise, a future packet implies lost packets. Request a sync. Drop the future packet.\n\trc.syncWrite(nil, rc.nread)\n\treturn nil\n}", "title": "" }, { "docid": "4c9b8f5fc51ed8242947c428e0e52fbd", "score": "0.4848766", "text": "func (cw *ChunkWriter) Flush() error {\n\tif cw.pos > 0 {\n\t\tcw.doWrite(cw.chunk[:cw.pos])\n\t\tif cw.err == nil {\n\t\t\tcw.pos = 0\n\t\t}\n\t}\n\treturn cw.err\n}", "title": "" }, { "docid": "3bcd3c0d590fe163962466f3a1baa059", "score": "0.48425096", "text": "func (cw *ChunkWriter) Write(data []byte) (int, error) {\n\tif cw.err != nil {\n\t\treturn 0, cw.err\n\t}\n\n\tchunkSize := len(cw.chunk)\n\tdataSize := len(data)\n\tif cw.pos > 0 {\n\t\tn := copy(cw.chunk[cw.pos:], data)\n\t\tcw.pos += n\n\t\tif cw.pos == chunkSize {\n\t\t\tcw.doWrite(cw.chunk)\n\t\t\tif cw.err != nil {\n\t\t\t\treturn 0, cw.err\n\t\t\t}\n\t\t\tcw.pos = 0\n\t\t}\n\t\tif n == dataSize {\n\t\t\treturn n, nil\n\t\t}\n\t\tdata = data[n:]\n\t}\n\n\tfor ; len(data) >= chunkSize; data = data[chunkSize:] {\n\t\tcw.doWrite(data[:chunkSize])\n\t\tif cw.err != nil {\n\t\t\treturn 0, cw.err\n\t\t}\n\t}\n\n\tif len(data) > 0 {\n\t\tk := copy(cw.chunk[cw.pos:], data)\n\t\tcw.pos += k\n\t}\n\n\treturn dataSize, cw.err\n}", "title": "" }, { "docid": "e574803a230e05035fd0f216b8e33a58", "score": "0.48315603", "text": "func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err error) {\n\n\t// There are a couple of cases where it's possible for err and resp to both\n\t// be non-nil. However, we expose a simpler contract to our callers: exactly\n\t// one of resp and err will be non-nil. This means that any response body\n\t// must be closed here before returning a non-nil error.\n\tvar prepareReturn = func(resp *http.Response, err error) (*http.Response, error) {\n\t\tif err != nil {\n\t\t\tif resp != nil && resp.Body != nil {\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\t// This case is very unlikely but possible only if rx.ChunkRetryDeadline is\n\t\t// set to a very small value, in which case no requests will be sent before\n\t\t// the deadline. Return an error to avoid causing a panic.\n\t\tif resp == nil {\n\t\t\treturn nil, fmt.Errorf(\"upload request to %v not sent, choose larger value for ChunkRetryDealine\", rx.URI)\n\t\t}\n\t\treturn resp, nil\n\t}\n\t// Configure retryable error criteria.\n\terrorFunc := rx.Retry.errorFunc()\n\n\t// Configure per-chunk retry deadline.\n\tvar retryDeadline time.Duration\n\tif rx.ChunkRetryDeadline != 0 {\n\t\tretryDeadline = rx.ChunkRetryDeadline\n\t} else {\n\t\tretryDeadline = defaultRetryDeadline\n\t}\n\n\t// Send all chunks.\n\tfor {\n\t\tvar pause time.Duration\n\n\t\t// Each chunk gets its own initialized-at-zero backoff and invocation ID.\n\t\tbo := rx.Retry.backoff()\n\t\tquitAfterTimer := time.NewTimer(retryDeadline)\n\t\trx.attempts = 1\n\t\trx.invocationID = uuid.New().String()\n\n\t\t// Retry loop for a single chunk.\n\t\tfor {\n\t\t\tpauseTimer := time.NewTimer(pause)\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tquitAfterTimer.Stop()\n\t\t\t\tpauseTimer.Stop()\n\t\t\t\tif err == nil {\n\t\t\t\t\terr = ctx.Err()\n\t\t\t\t}\n\t\t\t\treturn prepareReturn(resp, err)\n\t\t\tcase <-pauseTimer.C:\n\t\t\tcase <-quitAfterTimer.C:\n\t\t\t\tpauseTimer.Stop()\n\t\t\t\treturn prepareReturn(resp, err)\n\t\t\t}\n\t\t\tpauseTimer.Stop()\n\n\t\t\t// Check for context cancellation or timeout once more. If more than one\n\t\t\t// case in the select statement above was satisfied at the same time, Go\n\t\t\t// will choose one arbitrarily.\n\t\t\t// That can cause an operation to go through even if the context was\n\t\t\t// canceled before or the timeout was reached.\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tquitAfterTimer.Stop()\n\t\t\t\tif err == nil {\n\t\t\t\t\terr = ctx.Err()\n\t\t\t\t}\n\t\t\t\treturn prepareReturn(resp, err)\n\t\t\tcase <-quitAfterTimer.C:\n\t\t\t\treturn prepareReturn(resp, err)\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tresp, err = rx.transferChunk(ctx)\n\n\t\t\tvar status int\n\t\t\tif resp != nil {\n\t\t\t\tstatus = resp.StatusCode\n\t\t\t}\n\n\t\t\t// Check if we should retry the request.\n\t\t\tif !errorFunc(status, err) {\n\t\t\t\tquitAfterTimer.Stop()\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\trx.attempts++\n\t\t\tpause = bo.Pause()\n\t\t\tif resp != nil && resp.Body != nil {\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t}\n\n\t\t// If the chunk was uploaded successfully, but there's still\n\t\t// more to go, upload the next chunk without any delay.\n\t\tif statusResumeIncomplete(resp) {\n\t\t\tresp.Body.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\treturn prepareReturn(resp, err)\n\t}\n}", "title": "" }, { "docid": "c7f4492c16e051a3fc3f370efc99a715", "score": "0.4823768", "text": "func (self *FSHandler)PostChunkHandler(writer http.ResponseWriter, request *http.Request) {\n log.Debugf(\"begin proc PostChunksHandler\\n\")\n\n resp := httputil.Response{}\n\n user, err := self.getUserInfo(writer, request)\n if err != nil {\n resp.Code = http.StatusUnauthorized\n resp.Err = err.Error()\n httputil.WriteJSONResponse(writer, resp)\n return\n }\n\n config := syscfg.GetSysConfig()\n root := config.Get(common.FSBasePath).(string)\n\n if !user.Sysadmin {\n root = filepath.Join(root, user.Username)\n }\n\n defer request.Body.Close()\n\n //partReader, err := request.MultipartReader()\n partReader := multipart.NewReader(request.Body, fscmd.DefaultMultiPartBoundary)\n if err != nil {\n resp.Code = http.StatusBadRequest\n resp.Err = err.Error()\n httputil.WriteJSONResponse(writer, resp)\n return\n }\n\n for {\n part, err := partReader.NextPart()\n if err == io.EOF {\n break\n }\n\n // check part read error\n if err != nil {\n log.Errorf(\"part reader Error: %#v\", err)\n resp.Err = err.Error()\n resp.Code = http.StatusInternalServerError\n httputil.WriteJSONResponse(writer, resp)\n return\n }\n\n if part.FormName() != \"chunk\" {\n continue\n }\n\n chunk, err := fscmd.ParseChunk(part.FileName())\n if err != nil {\n resp.Err = err.Error()\n resp.Code = http.StatusInternalServerError\n httputil.WriteJSONResponse(writer, resp)\n return\n }\n\n\n // before load chunk data. we will reformat file path\n // according to the root\n chunk.Path = filepath.Join(root, chunk.Path)\n\n log.Debugf(\"recv chunk: %#v\\n\", chunk)\n\n if err := chunk.SaveChunkData(part); err != nil {\n resp.Err = err.Error()\n resp.Code = http.StatusInternalServerError\n httputil.WriteJSONResponse(writer, resp)\n return\n }\n\n }\n\n resp.Code = http.StatusOK\n httputil.WriteJSONResponse(writer, resp)\n\n log.Debugf(\"end proc PostChunksHandler\\n\")\n}", "title": "" }, { "docid": "92141c78b79e0389380bae0b4669921d", "score": "0.4821508", "text": "func (c *MConnection) sendSomePackets() bool {\n\t// Block until .sendMonitor says we can write.\n\t// Once we're ready we send more than we asked for,\n\t// but amortized it should even out.\n\tc.sendMonitor.Limit(maxPacketSize, atomic.LoadInt64(&c.sendRate), true)\n\n\t// Now send some packets.\n\tfor i := 0; i < numBatchPackets; i++ {\n\t\tif c.sendPacket() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "08c7a32fd680cac7c49ee055498637e3", "score": "0.48201185", "text": "func splitChunk(plainTextByte []byte, limit int) [][]byte {\n\tif limit <= 0 {\n\t\t// this should never happen. but we shouldn't break the flow,\n\t\t// return the original input for EncryptOAEP to return the error\n\t\treturn [][]byte{plainTextByte}\n\t}\n\tchunks := make([][]byte, 0, len(plainTextByte)/limit+1)\n\tvar chunk []byte\n\tfor len(plainTextByte) >= limit {\n\t\tchunk, plainTextByte = plainTextByte[:limit], plainTextByte[limit:]\n\t\tchunks = append(chunks, chunk)\n\t}\n\tif len(plainTextByte) > 0 {\n\t\tchunks = append(chunks, plainTextByte)\n\t}\n\n\treturn chunks\n}", "title": "" }, { "docid": "bb6c8e32ab7700c0085a25204c0497f3", "score": "0.48085213", "text": "func splitSend(heightOfSmallerArray, width, height, y int, workerIn chan byte, world [][]byte) {\n\n\t// sends the chunk we need to perform the logic on and\n\t// 1 more layer at the top and 1 more at the bottom(so the logic is correct)\n\tfor h:=y-1; h<heightOfSmallerArray+1+y; h++ {\n\t\tfor x:=0; x<width; x++ {\n\t\t\tvar t int\n\t\t\tif h<0 {\n\t\t\t\t//top level\n\t\t\t\tt=(h+height)%height\n\t\t\t} else if h>=height {\n\t\t\t\t//bottom level\n\t\t\t\tt=(h-height)%height\n\t\t\t} else {\n\t\t\t\t//middle level\n\t\t\t\tt=h\n\t\t\t}\n\t\t\tworkerIn <-world[t][x]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92f7c40b8177c0899edfa7a3be8364ed", "score": "0.4796412", "text": "func (ch *Channel) trySendBytes(bytes []byte) bool {\n\tselect {\n\tcase ch.sendQueue <- bytes:\n\t\tatomic.AddUint32(&ch.sendQueueSize, 1)\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "b486234060f7c7ee0234b32ba26aad89", "score": "0.47947067", "text": "func (s *server) pinChunk(w http.ResponseWriter, r *http.Request) {\n\taddr, err := swarm.ParseHexAddress(mux.Vars(r)[\"address\"])\n\tif err != nil {\n\t\ts.Logger.Debugf(\"debug api: pin chunk: parse chunk address: %v\", err)\n\t\tjsonhttp.BadRequest(w, \"bad address\")\n\t\treturn\n\t}\n\n\thas, err := s.Storer.Has(r.Context(), addr)\n\tif err != nil {\n\t\ts.Logger.Debugf(\"debug api: pin chunk: localstore has: %v\", err)\n\t\tjsonhttp.BadRequest(w, err)\n\t\treturn\n\t}\n\n\tif !has {\n\t\tjsonhttp.NotFound(w, nil)\n\t\treturn\n\t}\n\n\terr = s.Storer.Set(r.Context(), storage.ModeSetPin, addr)\n\tif err != nil {\n\t\ts.Logger.Debugf(\"debug-api: pin chunk: pinning error: %v, addr %s\", err, addr)\n\t\tjsonhttp.InternalServerError(w, \"cannot pin chunk\")\n\t\treturn\n\t}\n\tjsonhttp.OK(w, nil)\n}", "title": "" }, { "docid": "3b34bdc999825b7ec4ff0f36fd03574f", "score": "0.47808218", "text": "func (w *ChunkWriter) chunk() error {\n\tif w.pipe != nil {\n\t\terr := w.pipe.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tpr, pw := io.Pipe()\n\tw.ch <- pr\n\tw.pipe = pw\n\tw.written = 0\n\treturn nil\n}", "title": "" }, { "docid": "e98b88f7116dc2a3e6237a59ad377e0f", "score": "0.47779799", "text": "func (s *Drive) PutChunk(sha256sum []byte, chunk []byte, _ *shade.File) error {\n\ts.cm.Lock()\n\tdefer s.cm.Unlock()\n\ts.chunks[string(sha256sum)] = chunk\n\treturn nil\n}", "title": "" }, { "docid": "7d1191059bcdd8e799bcb1230c976679", "score": "0.477513", "text": "func ChanSendUint32(ok bool, truthy, falsey chan<- uint32) chan<- uint32 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "f354fe99bc39db48f72bf9e6f9f57108", "score": "0.47640496", "text": "func (r *Renter) managedPushChunkForRepair(uuc *unfinishedUploadChunk, ct chunkType) (bool, error) {\n\t// Validate use of chunkType\n\tif (ct == chunkTypeStreamChunk) != (uuc.sourceReader != nil) {\n\t\terr := fmt.Errorf(\"Invalid chunkType use: streamChunk %v, chunk has sourceReader reader %v\",\n\t\t\tct == chunkTypeStreamChunk, uuc.sourceReader != nil)\n\t\tbuild.Critical(err)\n\t\treturn false, err\n\t}\n\n\t// Try and update any existing chunk in the heap\n\terr := r.uploadHeap.managedTryUpdate(uuc, ct)\n\tif err != nil {\n\t\treturn false, errors.AddContext(err, \"unable to update chunk in heap\")\n\t}\n\t// Push the chunk onto the upload heap\n\tpushed := r.uploadHeap.managedPush(uuc, ct)\n\t// If we were not able to push the chunk, or if the chunkType is localChunk we\n\t// return\n\tif !pushed || ct == chunkTypeLocalChunk {\n\t\treturn pushed, nil\n\t}\n\n\t// For streamChunks update the heap popped time\n\tuuc.mu.Lock()\n\tuuc.chunkPoppedFromHeapTime = time.Now()\n\tuuc.mu.Unlock()\n\n\t// Disrupt check\n\tif r.deps.Disrupt(\"skipPrepareNextChunk\") {\n\t\treturn pushed, nil\n\t}\n\n\t// Prepare and send the chunk to the workers.\n\terr = r.managedPrepareNextChunk(uuc)\n\tif err != nil {\n\t\treturn pushed, errors.AddContext(err, \"unable to prepare chunk for workers\")\n\t}\n\treturn pushed, nil\n}", "title": "" }, { "docid": "3053c8d46bc90baa5700fc01ca5c717f", "score": "0.475168", "text": "func SplitChannelMessageSend(s *discordgo.Session, channelID, text string) {\n\tconst codeblockDelimiter = \"```\"\n\n\tcodeblockFound := strings.Count(text, codeblockDelimiter) == 2\n\tchunks := Split(text, \"\\n\", 1800)\n\n\tcodeblockBegin := -1\n\tcodeblockEnd := -1\n\n\tif codeblockFound {\n\t\tbeginSet := false\n\n\t\tfor idx, chunk := range chunks {\n\n\t\t\tdelimiterCount := strings.Count(chunk, codeblockDelimiter)\n\t\t\tif delimiterCount == 2 {\n\t\t\t\tcodeblockBegin = idx\n\t\t\t\tcodeblockEnd = idx\n\t\t\t\tbreak\n\t\t\t} else if delimiterCount == 1 && !beginSet {\n\t\t\t\tcodeblockBegin = idx\n\t\t\t\tbeginSet = true\n\t\t\t} else if delimiterCount == 1 && beginSet {\n\t\t\t\tcodeblockEnd = idx\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t}\n\t}\n\n\tisCodeblockSplit := 0 <= codeblockBegin && codeblockBegin < codeblockEnd\n\n\tfor idx, chunk := range chunks {\n\n\t\tif isCodeblockSplit {\n\t\t\tif idx == codeblockBegin {\n\t\t\t\tchunk = chunk + codeblockDelimiter\n\t\t\t} else if codeblockBegin < idx && idx < codeblockEnd {\n\t\t\t\tchunk = codeblockDelimiter + chunk + codeblockDelimiter\n\t\t\t} else if idx == codeblockEnd {\n\t\t\t\tchunk = codeblockDelimiter + chunk\n\t\t\t}\n\t\t}\n\n\t\tif _, err := s.ChannelMessageSend(channelID, chunk); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a20815618f24cf360a35655411118f87", "score": "0.4750754", "text": "func (f *outFragment) endChunk() error {\n\tif !f.chunkOpen() {\n\t\treturn errNoOpenChunk\n\t}\n\n\tbinary.BigEndian.PutUint16(f.chunkStart, uint16(f.chunkSize))\n\tf.chunkStart = nil\n\tf.chunkSize = 0\n\treturn nil\n}", "title": "" }, { "docid": "d9e8b1bfbed423818704d5272a00329e", "score": "0.4746781", "text": "func (tx *Tx) SendBatch(ctx context.Context, b btcount.Batch) btcount.BatchResults {\n\tbatch := b.(*pgx.Batch)\n\tresults := tx.tx.SendBatch(ctx, batch)\n\n\treturn &batchresults{BatchResults: results}\n}", "title": "" }, { "docid": "50223649e1bf33675a63423ec69a211d", "score": "0.47376338", "text": "func TestChunkPipe(t *testing.T) {\n\tfor i := range dataWrites {\n\t\tt.Run(fmt.Sprintf(\"%d\", i), testChunkPipe)\n\t}\n}", "title": "" }, { "docid": "3f21f78b42f61d32089301e470060338", "score": "0.47372556", "text": "func (b *Bot) trySend() bool {\n if len(b.chips) == 2 {\n if b.high != nil && b.low != nil {\n for !b.low.ready || !b.high.ready { }\n b.low.getChip <- Min(b.chips[0], b.chips[1])\n b.high.getChip <- Max(b.chips[0], b.chips[1])\n b.done <- fmt.Sprintln(\"Bot\",b.id,\"sent chips:\",b.chips[0],\"and\",b.chips[1])\n return true\n }\n }\n return false\n}", "title": "" }, { "docid": "f1d585e1fd82cdae959616feb92a08cc", "score": "0.4727677", "text": "func (c *AWSStore) putChunks(userID string, chunks []Chunk) error {\n\tincomingErrors := make(chan error)\n\tfor _, chunk := range chunks {\n\t\tgo func(chunk Chunk) {\n\t\t\tincomingErrors <- c.putChunk(userID, &chunk)\n\t\t}(chunk)\n\t}\n\n\tvar lastErr error\n\tfor range chunks {\n\t\terr := <-incomingErrors\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t}\n\t}\n\treturn lastErr\n}", "title": "" }, { "docid": "7a0fba520c8b4a04dce0344520f53135", "score": "0.47260404", "text": "func (c *Store) putChunks(ctx context.Context, userID string, chunks []Chunk) error {\n\tincomingErrors := make(chan error)\n\tfor _, chunk := range chunks {\n\t\tgo func(chunk Chunk) {\n\t\t\tincomingErrors <- c.putChunk(ctx, userID, &chunk)\n\t\t}(chunk)\n\t}\n\n\tvar lastErr error\n\tfor range chunks {\n\t\terr := <-incomingErrors\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t}\n\t}\n\treturn lastErr\n}", "title": "" }, { "docid": "7a751a0eec9ef19783eb4f4b2dc24b2a", "score": "0.4720587", "text": "func (h *headChunkReader) Chunk(meta chunks.Meta) (chunkenc.Chunk, error) {\n\tchk, _, err := h.chunk(meta, false)\n\treturn chk, err\n}", "title": "" }, { "docid": "170a6a94157d6e6ecc8822cf67238fda", "score": "0.47194466", "text": "func (r *Replica) Send(ctx context.Context, ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) {\n\tr.assert5725(ba)\n\n\tvar br *roachpb.BatchResponse\n\n\tif err := r.checkBatchRequest(ba); err != nil {\n\t\treturn nil, roachpb.NewError(err)\n\t}\n\n\tctx, cleanup := tracing.EnsureContext(ctx, r.store.Tracer())\n\tdefer cleanup()\n\n\t// Differentiate between admin, read-only and write.\n\tvar pErr *roachpb.Error\n\tif ba.IsWrite() {\n\t\tlog.Trace(ctx, \"read-write path\")\n\t\tbr, pErr = r.addWriteCmd(ctx, ba)\n\t} else if ba.IsReadOnly() {\n\t\tlog.Trace(ctx, \"read-only path\")\n\t\tbr, pErr = r.addReadOnlyCmd(ctx, ba)\n\t} else if ba.IsAdmin() {\n\t\tlog.Trace(ctx, \"admin path\")\n\t\tbr, pErr = r.addAdminCmd(ctx, ba)\n\t} else if len(ba.Requests) == 0 {\n\t\t// empty batch; shouldn't happen (we could handle it, but it hints\n\t\t// at someone doing weird things, and once we drop the key range\n\t\t// from the header it won't be clear how to route those requests).\n\t\tr.panicf(\"empty batch\")\n\t} else {\n\t\tr.panicf(\"don't know how to handle command %s\", ba)\n\t}\n\tif _, ok := pErr.GetDetail().(*roachpb.RaftGroupDeletedError); ok {\n\t\t// This error needs to be converted appropriately so that\n\t\t// clients will retry.\n\t\tpErr = roachpb.NewError(roachpb.NewRangeNotFoundError(r.RangeID))\n\t}\n\tif pErr != nil {\n\t\tlog.Tracef(ctx, \"error: %s\", pErr)\n\t}\n\treturn br, pErr\n}", "title": "" }, { "docid": "077cbf1e457bab6305448d9d876a41ac", "score": "0.47146413", "text": "func (f *outFragment) chunkOpen() bool { return len(f.chunkStart) > 0 }", "title": "" }, { "docid": "2afe7f37e30dd7ef44d787c494c13add", "score": "0.4707447", "text": "func (ch SyncChannel) TrySend() ChannelOpResult {\n\tselect {\n\tcase ch <- empty:\n\t\treturn ChannelOpSuccess\n\tdefault:\n\t\treturn ChannelOpFailure\n\t}\n}", "title": "" }, { "docid": "4223c21a260ace244219c92d23846fb3", "score": "0.4691927", "text": "func (communication *TestComm) LockDataChunks(index uint32, metadata *common.MetaData) {\n\t// Noop on HTTP\n}", "title": "" }, { "docid": "53df82e362d12ea0927fd429fbf9ed33", "score": "0.4661675", "text": "func (t *HTTPTransport) Flush(timeout time.Duration) bool {\n\ttoolate := time.After(timeout)\n\n\t// Wait until processing the current batch has started or the timeout.\n\t//\n\t// We must wait until the worker has seen the current batch, because it is\n\t// the only way b.done will be closed. If we do not wait, there is a\n\t// possible execution flow in which b.done is never closed, and the only way\n\t// out of Flush would be waiting for the timeout, which is undesired.\n\tvar b batch\n\tfor {\n\t\tselect {\n\t\tcase b = <-t.buffer:\n\t\t\tselect {\n\t\t\tcase <-b.started:\n\t\t\t\tgoto started\n\t\t\tdefault:\n\t\t\t\tt.buffer <- b\n\t\t\t}\n\t\tcase <-toolate:\n\t\t\tgoto fail\n\t\t}\n\t}\n\nstarted:\n\t// Signal that there won't be any more items in this batch, so that the\n\t// worker inner loop can end.\n\tclose(b.items)\n\t// Start a new batch for subsequent events.\n\tt.buffer <- batch{\n\t\titems: make(chan batchItem, t.BufferSize),\n\t\tstarted: make(chan struct{}),\n\t\tdone: make(chan struct{}),\n\t}\n\n\t// Wait until the current batch is done or the timeout.\n\tselect {\n\tcase <-b.done:\n\t\tLogger.Println(\"Buffer flushed successfully.\")\n\t\treturn true\n\tcase <-toolate:\n\t\tgoto fail\n\t}\n\nfail:\n\tLogger.Println(\"Buffer flushing reached the timeout.\")\n\treturn false\n}", "title": "" }, { "docid": "53706e1ff151e87022f24385869c0cf8", "score": "0.4660338", "text": "func (f *outFragment) beginChunk() error {\n\tif f.chunkOpen() {\n\t\treturn errChunkAlreadyOpen\n\t}\n\n\tf.chunkStart = f.remaining[0:2]\n\tf.chunkSize = 0\n\tf.remaining = f.remaining[2:]\n\treturn nil\n}", "title": "" }, { "docid": "65c587319712c8c3791f0ec790d5c9fc", "score": "0.4658729", "text": "func (ctx *sliceCtx[T]) splitChunks(someNeeded bool) error {\n\tctx.Logf(\"split chunks (needed=%v): %s\", someNeeded, ctx.chunkInfo())\n\tsplitInto := 2\n\tif !someNeeded && len(ctx.chunks) == 1 {\n\t\t// It's our first iteration.\n\t\tsplitInto = ctx.initialSplit(len(ctx.chunks[0].elements))\n\t}\n\tvar newChunks []*arrayChunk[T]\n\tfor i, chunk := range ctx.chunks {\n\t\tif chunk.final {\n\t\t\tnewChunks = append(newChunks, chunk)\n\t\t\tcontinue\n\t\t}\n\t\tctx.Logf(\"split chunk #%d of len %d into %d parts\", i, len(chunk.elements), splitInto)\n\t\tchunks := splitChunk[T](chunk.elements, splitInto)\n\t\tif len(chunks) == 1 && someNeeded {\n\t\t\tctx.Logf(\"no way to further split the chunk\")\n\t\t\tchunk.final = true\n\t\t\tnewChunks = append(newChunks, chunk)\n\t\t\tcontinue\n\t\t}\n\t\tfoundNeeded := false\n\t\tfor j := range chunks {\n\t\t\tctx.Logf(\"testing without sub-chunk %d/%d\", j+1, len(chunks))\n\t\t\tif j < len(chunks)-1 || foundNeeded || !someNeeded {\n\t\t\t\tret, err := ctx.predRun(\n\t\t\t\t\tnewChunks,\n\t\t\t\t\tmergeRawChunks(chunks[j+1:]),\n\t\t\t\t\tctx.chunks[i+1:],\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif ret {\n\t\t\t\t\tctx.Logf(\"the chunk can be dropped\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tctx.Logf(\"no need to test this chunk, it's definitely needed\")\n\t\t\t}\n\t\t\tfoundNeeded = true\n\t\t\tnewChunks = append(newChunks, &arrayChunk[T]{\n\t\t\t\telements: chunks[j],\n\t\t\t})\n\t\t}\n\t}\n\tctx.chunks = newChunks\n\treturn nil\n}", "title": "" }, { "docid": "16e5ca766ea0dee24b04bc1f5e16b085", "score": "0.46566632", "text": "func (w *bodyWriter) Write(b []byte) (int, error) {\n\tif w.complete {\n\t\treturn 0, ErrWriteAfterComplete\n\t}\n\n\twritten := 0\n\tfor len(b) > 0 {\n\t\t// Make sure we have a fragment and an open chunk\n\t\tif err := w.ensureOpenChunk(); err != nil {\n\t\t\treturn written, err\n\t\t}\n\n\t\tbytesRemaining := w.fragment.bytesRemaining()\n\t\tif bytesRemaining < len(b) {\n\t\t\t// Not enough space remaining in this fragment - write what we can, finish this fragment,\n\t\t\t// and start a new fragment for the remainder of the argument\n\t\t\tif n, err := w.fragment.writeChunkData(b[:bytesRemaining]); err != nil {\n\t\t\t\treturn written + n, err\n\t\t\t}\n\n\t\t\tif err := w.finishFragment(false); err != nil {\n\t\t\t\treturn written, err\n\t\t\t}\n\n\t\t\twritten += bytesRemaining\n\t\t\tb = b[bytesRemaining:]\n\t\t} else {\n\t\t\t// Enough space remaining in this fragment - write the full chunk and be done with it\n\t\t\tif n, err := w.fragment.writeChunkData(b); err != nil {\n\t\t\t\treturn written + n, err\n\t\t\t}\n\n\t\t\twritten += len(b)\n\t\t\tw.alignsAtEnd = w.fragment.bytesRemaining() == 0\n\t\t\tb = nil\n\t\t}\n\t}\n\n\t// If the fragment is complete, send it immediately\n\tif w.fragment.bytesRemaining() == 0 {\n\t\tif err := w.finishFragment(false); err != nil {\n\t\t\treturn written, err\n\t\t}\n\t}\n\n\treturn written, nil\n}", "title": "" }, { "docid": "fc9d0ed0425042dc46fe651484b429a0", "score": "0.46497396", "text": "func (c *AWSStore) putChunk(userID string, chunk *Chunk) error {\n\terr := instrument.TimeRequestHistogram(\"Put\", s3RequestDuration, func() error {\n\t\tvar err error\n\t\t_, err = c.s3.PutObject(&s3.PutObjectInput{\n\t\t\tBody: bytes.NewReader(chunk.Data),\n\t\t\tBucket: aws.String(c.bucketName),\n\t\t\tKey: aws.String(chunkName(userID, chunk.ID)),\n\t\t})\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.chunkCache != nil {\n\t\tif err = c.chunkCache.StoreChunkData(userID, chunk); err != nil {\n\t\t\tlog.Warnf(\"Could not store %v in chunk cache: %v\", chunk.ID, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a92c12466cb1c935ee03902534e3d265", "score": "0.4645803", "text": "func ChanSendInt16(ok bool, truthy, falsey chan<- int16) chan<- int16 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "61bef54b78e11e6c22b2a4c6101fdc26", "score": "0.46439067", "text": "func ChanSendFloat32(ok bool, truthy, falsey chan<- float32) chan<- float32 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "f6910f7a4ca76031928314e2d147e40c", "score": "0.46336833", "text": "func (b *Buffer) RangeChunks(fn func(chunk uint32)) {\r\n\tfor _, c := range b.chunks {\r\n\t\tfn(c.Chunk)\r\n\t}\r\n}", "title": "" }, { "docid": "64e28d4b935e73f8b817b2c834aa5e49", "score": "0.4632609", "text": "func ChanSendInt32(ok bool, truthy, falsey chan<- int32) chan<- int32 {\n\tif ok {\n\t\treturn truthy\n\t}\n\treturn falsey\n}", "title": "" }, { "docid": "30664ca554cd1a1e94ed6cb7de053ce4", "score": "0.4623414", "text": "func (mr *MockKOTSHandlerMockRecorder) UploadAirgapBundleChunk(w, r interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UploadAirgapBundleChunk\", reflect.TypeOf((*MockKOTSHandler)(nil).UploadAirgapBundleChunk), w, r)\n}", "title": "" }, { "docid": "2c2248deabadd32d175d80e9413964c5", "score": "0.4619925", "text": "func (channel *Channel) onFileRecvChunk(_ *gotox.Tox, friendnumber uint32, fileNumber uint32, position uint64, data []byte) {\n\ttran, exists := channel.transfers[fileNumber]\n\tif !exists {\n\t\t// ignore zero length chunk that is sent to signal a complete transfer\n\t\tif len(data) == 0 {\n\t\t\treturn\n\t\t}\n\t\tlog.Println(tag, \"Receive transfer doesn't seem to exist!\", fileNumber)\n\t\t// send that we won't be accepting this transfer after all\n\t\tchannel.tox.FileControl(friendnumber, fileNumber, gotox.TOX_FILE_CONTROL_CANCEL)\n\t\t// and we're done\n\t\treturn\n\t}\n\t// write date to disk\n\ttran.file.WriteAt(data, (int64)(position))\n\t// update progress\n\ttran.SetProgress(position + uint64(len(data)))\n\t// this means the file has been completey received\n\tif position+uint64(len(data)) >= tran.size {\n\t\tpathelements := strings.Split(tran.file.Name(), \"/\")\n\t\t// callback with file name / identification\n\t\taddress, _ := channel.addressOf(friendnumber)\n\t\tname := pathelements[len(pathelements)-1]\n\t\tpath := strings.Join(pathelements, \"/\")\n\t\t// close & remove transfer\n\t\tchannel.closeTransfer(fileNumber, StSuccess)\n\t\t// call callback\n\t\tif channel.callbacks != nil {\n\t\t\t// all real callbacks are run in separate go routines to keep ToxCore none blocking!\n\t\t\tgo channel.callbacks.OnFileReceived(address, path, name)\n\t\t} else {\n\t\t\t// this shouldn't happen as file can only be received with callbacks, but let us be sure\n\t\t\tlog.Println(tag, \"No callback for OnFileReceived registered!\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "caec070d24a0563de4904b0d051e1db2", "score": "0.4618162", "text": "func (m *ControllerMock) SendBytesFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.SendBytesMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.SendBytesCounter) == uint64(len(m.SendBytesMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.SendBytesMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.SendBytesCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.SendBytesFunc != nil {\n\t\treturn atomic.LoadUint64(&m.SendBytesCounter) > 0\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "beadd2cb9edb4f07f6821f1d2655df66", "score": "0.46129107", "text": "func (s *Session) Transfer(srv *server.Server) (err error) {\n\tif !s.transferring.CAS(false, true) {\n\t\treturn errors.New(\"already being transferred\")\n\t}\n\n\tlogrus.Infof(\"Transferring %s to server %s in group %s\\n\", s.conn.IdentityData().DisplayName, srv.Name(), srv.Group())\n\n\tctx := event.C()\n\ts.handler().HandleTransfer(ctx, srv)\n\n\tctx.Continue(func() {\n\t\tconn, err := s.dial(srv)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif err = conn.DoSpawnTimeout(time.Minute); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\ts.serverMu.Lock()\n\t\ts.tempServerConn = conn\n\t\ts.serverMu.Unlock()\n\n\t\tpos := s.conn.GameData().PlayerPosition\n\t\t_ = s.conn.WritePacket(&packet.ChangeDimension{\n\t\t\tDimension: packet.DimensionNether,\n\t\t\tPosition: pos,\n\t\t})\n\n\t\tchunkX := int32(pos.X()) >> 4\n\t\tchunkZ := int32(pos.Z()) >> 4\n\t\tfor x := int32(-1); x <= 1; x++ {\n\t\t\tfor z := int32(-1); z <= 1; z++ {\n\t\t\t\t_ = s.conn.WritePacket(&packet.LevelChunk{\n\t\t\t\t\tChunkX: chunkX + x,\n\t\t\t\t\tChunkZ: chunkZ + z,\n\t\t\t\t\tSubChunkCount: 0,\n\t\t\t\t\tRawPayload: emptyChunkData,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\ts.serverMu.Lock()\n\t\ts.server.DecrementPlayerCount()\n\t\ts.server = srv\n\t\ts.server.IncrementPlayerCount()\n\t\ts.serverMu.Unlock()\n\t})\n\n\tctx.Stop(func() {\n\t\ts.setTransferring(false)\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "d0bcc61ff1ae2ef8f368caafdd1654a0", "score": "0.46124035", "text": "func (b *blockDec) sendErr(err error) {\n\tb.Last = true\n\tb.Type = blockTypeReserved\n\tb.err = err\n}", "title": "" }, { "docid": "91ea498c6a60e1eb9522476ca0e11d63", "score": "0.4608761", "text": "func (f *FirehoseSender) SendBatch(batch [][]byte, tag string) error {\n\tres, err := f.sendRecords(batch, tag)\n\tif err != nil {\n\t\treturn kbc.CatastrophicSendBatchError{ErrMessage: err.Error()}\n\t}\n\n\tretries := 0\n\tdelay := 250\n\tfor *res.FailedPutCount != 0 {\n\t\tlog.WarnD(\"retry-failed-records\", logger.M{\n\t\t\t\"stream\": tag, \"failed-record-count\": *res.FailedPutCount, \"retries\": retries,\n\t\t})\n\n\t\ttime.Sleep(time.Duration(delay) * time.Millisecond)\n\n\t\tretryLogs := [][]byte{}\n\t\tfor idx, entry := range res.RequestResponses {\n\t\t\tif entry != nil && entry.ErrorMessage != nil && *entry.ErrorMessage != \"\" {\n\t\t\t\tlog.ErrorD(\"failed-record\", logger.M{\"stream\": tag, \"msg\": &entry.ErrorMessage})\n\n\t\t\t\tretryLogs = append(retryLogs, batch[idx])\n\t\t\t}\n\t\t}\n\n\t\tres, err = f.sendRecords(retryLogs, tag)\n\t\tif err != nil {\n\t\t\treturn kbc.CatastrophicSendBatchError{ErrMessage: err.Error()}\n\t\t}\n\t\tif retries > 4 {\n\t\t\treturn kbc.PartialSendBatchError{\n\t\t\t\tErrMessage: \"Too many retries failed to put records -- stream: \" + tag,\n\t\t\t\tFailedMessages: retryLogs,\n\t\t\t}\n\t\t}\n\t\tretries++\n\t\tdelay *= 2\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f05389903c68f95d57456148bb025912", "score": "0.4602274", "text": "func (t *AzureBlockTarget) ProcessWrittenPart(result *pipeline.WorkerResult, listInfo *pipeline.TargetCommittedListInfo) (requeue bool, err error) {\n\trequeue = false\n\tblockList := convertToBase64EncodedList((*listInfo).List, result.NumberOfBlocks)\n\n\tif result.DuplicateOfBlockOrdinal >= 0 { // this block is a duplicate of another.\n\t\tif blockList[result.DuplicateOfBlockOrdinal] != \"\" {\n\t\t\tblockList[result.Ordinal] = blockList[result.DuplicateOfBlockOrdinal]\n\t\t} else { // we haven't yet see the block of which this is a dup, so requeue this one\n\t\t\trequeue = true\n\t\t}\n\t} else {\n\n\t\tblockList[result.Ordinal] = result.ItemID\n\t}\n\n\t(*listInfo).List = blockList\n\n\treturn\n}", "title": "" }, { "docid": "eeb95b1d18c3acbcd15f32e707127ea0", "score": "0.45904756", "text": "func (ds *DistSender) sendRPC(\n\tctx context.Context,\n\trangeID roachpb.RangeID,\n\treplicas ReplicaSlice,\n\tba roachpb.BatchRequest,\n) (*roachpb.BatchResponse, error) {\n\tif len(replicas) == 0 {\n\t\treturn nil, noNodeAddrsAvailError{}\n\t}\n\n\t// TODO(pmattis): This needs to be tested. If it isn't set we'll\n\t// still route the request appropriately by key, but won't receive\n\t// RangeNotFoundErrors.\n\tba.RangeID = rangeID\n\n\t// Set RPC opts with stipulation that one of N RPCs must succeed.\n\trpcOpts := SendOptions{\n\t\tSendNextTimeout: ds.sendNextTimeout,\n\t\tTimeout: base.NetworkTimeout,\n\t\tContext: ctx,\n\t\ttransportFactory: ds.transportFactory,\n\t}\n\ttracing.AnnotateTrace()\n\tdefer tracing.AnnotateTrace()\n\n\treply, err := ds.sendToReplicas(rpcOpts, rangeID, replicas, ba, ds.rpcContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply, nil\n}", "title": "" }, { "docid": "7474da149091c07dd5aad0f0527d8330", "score": "0.45892864", "text": "func UploadPartByChunk(accountURL, accountName, accountKey, containerName, remoteFile, partID string, httpClient *http.Client, chunk io.ReadSeeker) error {\n\tvar (\n\t\tctx = context.Background()\n\t)\n\tp, err := newPipeline(accountName, accountKey, httpClient)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create pipeline: %v\", err)\n\t}\n\n\tURL, err := getURL(accountURL, accountName, containerName, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid URL for container name %s: %v\", containerName, err)\n\t}\n\n\t// Create a ContainerURL object that wraps the container URL and a request\n\t// pipeline to make requests.\n\tcontainerURL := azblob.NewContainerURL(*URL, p)\n\n\t// create the blob, but we can handle if the container already exists\n\tif _, err := containerURL.Create(ctx, nil, azblob.PublicAccessNone); err != nil {\n\t\t// we can handle if it already exists\n\t\tvar (\n\t\t\tstorageError azblob.StorageError\n\t\t\tok bool\n\t\t)\n\t\tif storageError, ok = err.(azblob.StorageError); !ok {\n\t\t\treturn fmt.Errorf(\"error creating container %s: %v\", containerName, err)\n\t\t}\n\t\tsct := storageError.ServiceCode()\n\t\tif sct != azblob.ServiceCodeContainerAlreadyExists {\n\t\t\treturn fmt.Errorf(\"error creating container %s: %v\", containerName, err)\n\t\t}\n\t\t// it was an existing container, which is fine\n\t}\n\n\tblob := containerURL.NewBlockBlobURL(remoteFile)\n\n\tif _, err := blob.StageBlock(ctx, partID, chunk, azblob.LeaseAccessConditions{}, nil, azblob.ClientProvidedKeyOptions{}); err != nil {\n\t\treturn fmt.Errorf(\"failed to upload chunk %s: %v\", partID, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ecdd51ce8e92bbd4bffd22d94d88f30", "score": "0.45847636", "text": "func (this *RaidenProtocol) messageCanBeSent(msg encoding.Messager) bool {\n\tvar expired int64 = 0\n\tswitch msg2 := msg.(type) {\n\tcase *encoding.MediatedTransfer:\n\t\texpired = msg2.Expiration\n\tcase *encoding.RefundTransfer:\n\t\texpired = msg2.Expiration\n\t}\n\tif expired > 0 && expired <= this.BlockNumberGetter.GetBlockNumber() {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9480604f7e06af918660226d609d3541", "score": "0.45816094", "text": "func (ds *DistSender) sendSingleRange(\n\tctx context.Context, ba roachpb.BatchRequest, desc *roachpb.RangeDescriptor,\n) (*roachpb.BatchResponse, *roachpb.Error) {\n\t// HACK: avoid formatting the message passed to Span.LogEvent for\n\t// opentracing.noopSpans. We can't actually tell if we have a noopSpan, but\n\t// we can see if the span as a NoopTracer. Note that this particular\n\t// invocation is expensive because we're pretty-printing keys.\n\t//\n\t// TODO(tschottdorf): This hack can go away when something like\n\t// Span.LogEventf is added.\n\tsp := opentracing.SpanFromContext(ctx)\n\tif sp != nil && sp.Tracer() != (opentracing.NoopTracer{}) {\n\t\tsp.LogEvent(fmt.Sprintf(\"sending RPC to [%s, %s)\", desc.StartKey, desc.EndKey))\n\t}\n\n\t// Try to send the call.\n\treplicas := newReplicaSlice(ds.gossip, desc)\n\n\t// Rearrange the replicas so that those replicas with long common\n\t// prefix of attributes end up first. If there's no prefix, this is a\n\t// no-op.\n\tds.optimizeReplicaOrder(replicas)\n\n\t// If this request needs to go to a lease holder and we know who that is, move\n\t// it to the front.\n\tif !(ba.IsReadOnly() && ba.ReadConsistency == roachpb.INCONSISTENT) {\n\t\tif leaseHolder, ok := ds.leaseHolderCache.Lookup(desc.RangeID); ok {\n\t\t\tif i := replicas.FindReplica(leaseHolder.StoreID); i >= 0 {\n\t\t\t\treplicas.MoveToFront(i)\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO(tschottdorf): should serialize the trace here, not higher up.\n\tbr, err := ds.sendRPC(ctx, desc.RangeID, replicas, ba)\n\tif err != nil {\n\t\treturn nil, roachpb.NewError(err)\n\t}\n\n\t// If the reply contains a timestamp, update the local HLC with it.\n\tif br.Error != nil && br.Error.Now != hlc.ZeroTimestamp {\n\t\tds.clock.Update(br.Error.Now)\n\t} else if br.Now != hlc.ZeroTimestamp {\n\t\tds.clock.Update(br.Now)\n\t}\n\n\t// Untangle the error from the received response.\n\tpErr := br.Error\n\tbr.Error = nil // scrub the response error\n\treturn br, pErr\n}", "title": "" }, { "docid": "f575dba817510c783927fda6436febb6", "score": "0.45757985", "text": "func (m *archiveMilter) BodyChunk(chunk []byte, mod *milter.Modifier) (milter.Response, error) {\n\tif _, err := m.message.Write(chunk); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn milter.RespContinue, nil\n}", "title": "" } ]
40e70ab15300ac139f619b2767ae27d9
Lacks is identical to Contains but returns all missing labels
[ { "docid": "f9adcc95aead09fbac7b42289a443397", "score": "0.65304816", "text": "func (ls LabelArray) Lacks(needed LabelArray) LabelArray {\n\tmissing := LabelArray{}\nnextLabel:\n\tfor i := range needed {\n\t\tfor l := range ls {\n\t\t\tif needed[i].matches(&ls[l]) {\n\t\t\t\tcontinue nextLabel\n\t\t\t}\n\t\t}\n\n\t\tmissing = append(missing, needed[i])\n\t}\n\n\treturn missing\n}", "title": "" } ]
[ { "docid": "04acc93edeaac54b61c05426abf4b375", "score": "0.6628499", "text": "func (ls LabelArray) Contains(needed LabelArray) bool {\nnextLabel:\n\tfor i := range needed {\n\t\tfor l := range ls {\n\t\t\tif needed[i].matches(&ls[l]) {\n\t\t\t\tcontinue nextLabel\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "465f085e08911d6b4f56664e7a44a6d4", "score": "0.642048", "text": "func (me *LabelAgent) excludeContains(instance *matrix.Instance) {\n\tfor _, r := range me.excludeContainsRules {\n\t\tif strings.Contains(instance.GetLabel(r.label), r.value) {\n\t\t\tinstance.SetExportable(false)\n\t\t\tme.Logger.Trace().Msgf(\"excludeContains: (%s) [%s] instance with labels [%s] => excluded\", r.label, r.value, instance.GetLabels().String())\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8711b538a02ae2034e14db2ff5f79b8a", "score": "0.6318637", "text": "func isLabelsExist(expectedLabels map[string]label, actualLabels map[string]string) bool {\n\tfor key, expectedValue := range expectedLabels {\n\t\tactualValue, ok := actualLabels[key]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tswitch expectedValue.operator {\n\t\tcase \"=\":\n\t\t\tif !strings.EqualFold(expectedValue.value[0], actualValue) {\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase \"!=\":\n\t\t\tif strings.EqualFold(expectedValue.value[0], actualValue) {\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase \"in\":\n\t\t\tisExist := false\n\t\t\tfor _, value := range expectedValue.value {\n\t\t\t\tif strings.EqualFold(value, actualValue) {\n\t\t\t\t\tisExist = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !isExist {\n\t\t\t\treturn false\n\t\t\t}\n\t\tcase \"notin\":\n\t\t\tisExist := false\n\t\t\tfor _, value := range expectedValue.value {\n\t\t\t\tif strings.EqualFold(value, actualValue) {\n\t\t\t\t\tisExist = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif isExist {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a29a895cdbb5dd9bfba2b5c1b4f03f8d", "score": "0.60676956", "text": "func labelMatch(jobLabels []*v1alphapeloton.Label, queryLabels []*v1alphapeloton.Label) bool {\n\tif len(queryLabels) == 0 {\n\t\treturn true\n\t}\n\n\tlabelMap := constructLabelsMap(jobLabels)\n\tfor _, l := range queryLabels {\n\t\tif v, ok := labelMap[l.GetKey()]; !ok {\n\t\t\treturn false\n\t\t} else if v != l.GetValue() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c9340bfe43ae9e9fd8c88c014b764bd2", "score": "0.6005326", "text": "func anyInclude(labels []core.BuildLabel, label core.BuildLabel) bool {\n\tfor _, l := range labels {\n\t\tif l.Includes(label) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e779aa6c48f785f87d278953a5e72f95", "score": "0.59347266", "text": "func Test_createLabelSet(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\torig []common.StringKeyValue\n\t\texternalLabels map[string]string\n\t\textras []string\n\t\twant []prompb.Label\n\t}{\n\t\t{\n\t\t\t\"labels_clean\",\n\t\t\tlbs1,\n\t\t\tmap[string]string{},\n\t\t\t[]string{label31, value31, label32, value32},\n\t\t\tgetPromLabels(label11, value11, label12, value12, label31, value31, label32, value32),\n\t\t},\n\t\t{\n\t\t\t\"labels_duplicate_in_extras\",\n\t\t\tlbs1,\n\t\t\tmap[string]string{},\n\t\t\t[]string{label11, value31},\n\t\t\tgetPromLabels(label11, value31, label12, value12),\n\t\t},\n\t\t{\n\t\t\t\"labels_dirty\",\n\t\t\tlbs1Dirty,\n\t\t\tmap[string]string{},\n\t\t\t[]string{label31 + dirty1, value31, label32, value32},\n\t\t\tgetPromLabels(label11+\"_\", value11, \"key_\"+label12, value12, label31+\"_\", value31, label32, value32),\n\t\t},\n\t\t{\n\t\t\t\"no_original_case\",\n\t\t\tnil,\n\t\t\tnil,\n\t\t\t[]string{label31, value31, label32, value32},\n\t\t\tgetPromLabels(label31, value31, label32, value32),\n\t\t},\n\t\t{\n\t\t\t\"empty_extra_case\",\n\t\t\tlbs1,\n\t\t\tmap[string]string{},\n\t\t\t[]string{\"\", \"\"},\n\t\t\tgetPromLabels(label11, value11, label12, value12, \"\", \"\"),\n\t\t},\n\t\t{\n\t\t\t\"single_left_over_case\",\n\t\t\tlbs1,\n\t\t\tmap[string]string{},\n\t\t\t[]string{label31, value31, label32},\n\t\t\tgetPromLabels(label11, value11, label12, value12, label31, value31),\n\t\t},\n\t\t{\n\t\t\t\"valid_external_labels\",\n\t\t\tlbs1,\n\t\t\texlbs1,\n\t\t\t[]string{label31, value31, label32, value32},\n\t\t\tgetPromLabels(label11, value11, label12, value12, label41, value41, label31, value31, label32, value32),\n\t\t},\n\t\t{\n\t\t\t\"overwritten_external_labels\",\n\t\t\tlbs1,\n\t\t\texlbs2,\n\t\t\t[]string{label31, value31, label32, value32},\n\t\t\tgetPromLabels(label11, value11, label12, value12, label31, value31, label32, value32),\n\t\t},\n\t}\n\t// run tests\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tassert.ElementsMatch(t, tt.want, createLabelSet(tt.orig, tt.externalLabels, tt.extras...))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c9109f217a14c58bf579a7c7fc5bb5d4", "score": "0.59180045", "text": "func LabelMatches(labels, query map[string]string) bool {\n\tif query == nil || len(query) == 0 {\n\t\treturn true\n\t}\n\n\t// just terrible\n\tfor k, v := range query {\n\t\tval, ok := labels[k]\n\t\tif !ok || v != val {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "91a9ddb1e6a5f319678b61f5e2d4ac95", "score": "0.58856916", "text": "func intersectLabels(include []string, exclude []string, current labels.Labels) (string, map[string]string, error) {\n\ttmpResult := make(map[string]string)\n\tresult := make(map[string]string)\n\tname := \"\"\n\tincludeAll := false\n\tfor _, label := range include {\n\t\tif includeAll = (label == \"*\"); includeAll {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor _, label := range current {\n\t\ttmpResult[label.Name] = label.Value\n\t\tif label.Name == \"__name__\" {\n\t\t\tname = label.Value\n\t\t}\n\t}\n\t// only include select labels, discard series where labels are not matched\n\tif !includeAll {\n\t\tfor _, includeLabel := range include {\n\t\t\tif value, ok := tmpResult[includeLabel]; ok {\n\t\t\t\tresult[includeLabel] = value\n\t\t\t} else {\n\t\t\t\treturn \"\", nil, errors.New(\"labels not found\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresult = tmpResult\n\t}\n\tfor _, excludeLabel := range exclude {\n\t\tdelete(result, excludeLabel)\n\t}\n\treturn name, result, nil\n}", "title": "" }, { "docid": "904443b6a6cd0b6f97bcb7916f9d821d", "score": "0.5870928", "text": "func (vec Vector) ContainsSameLabelset() bool {\n\tswitch len(vec) {\n\tcase 0, 1:\n\t\treturn false\n\tcase 2:\n\t\treturn vec[0].Metric.Hash() == vec[1].Metric.Hash()\n\tdefault:\n\t\tl := make(map[uint64]struct{}, len(vec))\n\t\tfor _, ss := range vec {\n\t\t\thash := ss.Metric.Hash()\n\t\t\tif _, ok := l[hash]; ok {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tl[hash] = struct{}{}\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "0c68b596ad6d5381d2f9c1034518582c", "score": "0.5848887", "text": "func labelsMatch(labels, filter map[string]string, exact bool) bool {\n\tif exact && len(labels) != len(filter) {\n\t\treturn false\n\t}\n\n\tfor k, v := range filter {\n\t\tif v2, ok := labels[k]; !ok || v2 != v {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "17bfa19e1f0c24092f55afe1b9c9cf53", "score": "0.582122", "text": "func HasLabels() predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, true, LabelsTable, LabelsPrimaryKey...),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "title": "" }, { "docid": "cbc337af2644bffcc148cdfb5fa67b8d", "score": "0.5818082", "text": "func HasLabels(keyValuePair map[string]string) Predicate {\n\treturn func(snap *ZFSSnapshot) bool {\n\t\tfor key, value := range keyValuePair {\n\t\t\tif !snap.HasLabel(key, value) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "27d0bec6ff5364ea5bf4ba1258e7d823", "score": "0.5718562", "text": "func all(ci *ChangeInfo, labels map[string]int) bool {\n\tfor labelKey, wantValue := range labels {\n\t\tfound := false\n\t\tif labelEntry, ok := ci.Labels[labelKey]; ok {\n\t\t\tfor _, labelDetail := range labelEntry.All {\n\t\t\t\tif wantValue == labelDetail.Value {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "70bd3aa593a52c434881f429cc4c5a09", "score": "0.57115614", "text": "func LabelNotIn(vs ...string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldNotIn(FieldLabel, vs...))\n}", "title": "" }, { "docid": "aad21466fe3a21a07178ff92503f47ca", "score": "0.5665064", "text": "func (m *GaugeMetric) IsContained(labels []string) bool {\n\tif len(m.labelValues) != len(labels) {\n\t\treturn false\n\t}\n\tfor i, v := range labels {\n\t\tif !strings.EqualFold(v, m.labelValues[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "3eaad2ef3943228de5aa7e5c8ad24013", "score": "0.5657059", "text": "func (labels LabelsCollection) HasSubsetOf(that Labels) bool {\n\tif len(labels) == 0 {\n\t\treturn true\n\t}\n\tfor _, tag := range labels {\n\t\tif tag.SubsetOf(that) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f7c7f979cbd3b3bf137eaea50d5b6a50", "score": "0.5655261", "text": "func (t Labels) SubsetOf(that Labels) bool {\n\tfor k, v := range t {\n\t\tif that[k] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "dd1e8dd2974a3d13f2e45fe8955dff97", "score": "0.5642012", "text": "func DoesNotHaveLabel(labelKey string, labelValue string) FilterFunc {\n\treturn Complement(HasLabel(labelKey, labelValue))\n}", "title": "" }, { "docid": "d119b1bd4a754b0f94462a68df8dbab1", "score": "0.5606079", "text": "func containsAll(a, b []string) bool {\n\tm := make(map[string]struct{})\n\tfor _, v := range a {\n\t\tm[v] = struct{}{}\n\t}\n\n\tfor _, v := range b {\n\t\tif _, ok := m[v]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c7350cc2d47b975c52c6a2d02feb1d6b", "score": "0.55834126", "text": "func (i LabelsInstance) SubsetOf(that LabelsInstance) bool {\n\tfor k, v := range i {\n\t\tif that[k] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "de2061c89083c21c0aa820b2eb946bf2", "score": "0.5570589", "text": "func HasLabelsWith(preds ...predicate.Label) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\tstep := newLabelsStep()\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": "c33294c1b610d2aacb771b9e5be9422e", "score": "0.5545982", "text": "func matchesLabels(a, b map[string]string) bool {\n\tfor k, v := range b {\n\t\tif a[k] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a2f05347562095a7ecc8eb44658f592b", "score": "0.5544435", "text": "func (metric MetricDescription) hasLabel(label string) bool {\n\tfor _, l := range metric.Labels {\n\t\tif l.Key == label {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "df5675072d890a33ae1aec7a2feefeaa", "score": "0.5536526", "text": "func filterLabelsFunc(m Labels, match string) Labels {\n\tres := make(Labels)\n\tfor k, v := range m {\n\t\tif k == match {\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "7b8a6f02c4680dca1076e254a1b31982", "score": "0.5536369", "text": "func LabelContainsFold(v string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldContainsFold(FieldLabel, v))\n}", "title": "" }, { "docid": "804d0674044af6d539c9eb486c3212e7", "score": "0.5535948", "text": "func areLabelsInAllowList(labels, allowlist labels.Set) bool {\n\tif len(allowlist) == 0 {\n\t\treturn true\n\t}\n\n\tfor k, v := range labels {\n\t\tvalue, ok := allowlist[k]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tif value != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4a9720bbcd976be57781f2d36366edd3", "score": "0.55174124", "text": "func (m *TxMaxGaugeMetric) IsContained(labels []string) bool {\n\tif len(m.labelValues) != len(labels) {\n\t\treturn false\n\t}\n\tfor i, v := range labels {\n\t\tif !strings.EqualFold(v, m.labelValues[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "63d86d096af7baaef79ef41708b7f15f", "score": "0.5511465", "text": "func (o *StorageHitachiVolumeAllOf) HasLabel() bool {\n\tif o != nil && o.Label != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6b76b154a4cb7a0ea72fa49f4bd50636", "score": "0.55061305", "text": "func LabelContains(v string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldContains(FieldLabel, v))\n}", "title": "" }, { "docid": "3ce582c2964ce6f12bb9eae9c373a4ae", "score": "0.54879546", "text": "func (p *PackageEnvelope) HasLabels(labels map[string]string) bool {\n\tfor label, value := range labels {\n\t\tif !p.HasLabel(label, value) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0285024cac54535258c54495048c54ce", "score": "0.54850876", "text": "func containsAll(m map[*NodeSpec]bool, ss []string, nodes map[string]*NodeSpec) bool {\n\tfor _, s := range ss {\n\t\tname := nodes[s]\n\t\tif _, ok := m[name]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9de88a621c63c7a52e3952e65909c470", "score": "0.54848135", "text": "func getLabelsMap(labelSelectors string) map[string]label {\n\tlabelSelectorArr := strings.SplitN(labelSelectors, \",\", 2)\n\texpectedLabels := make(map[string]label, len(labelSelectorArr))\n\tfor _, labelSelector := range labelSelectorArr {\n\t\tif strings.Contains(labelSelector, \"!=\") {\n\t\t\tlabels := strings.Split(labelSelector, \"!=\")\n\t\t\tif len(labels) == 2 {\n\t\t\t\texpectedLabels[labels[0]] = label{operator: \"!=\", value: []string{labels[1]}}\n\t\t\t}\n\t\t} else if strings.Contains(labelSelector, \"=\") {\n\t\t\tlabels := strings.Split(labelSelector, \"=\")\n\t\t\tif len(labels) == 2 {\n\t\t\t\texpectedLabels[labels[0]] = label{operator: \"=\", value: []string{labels[1]}}\n\t\t\t}\n\t\t} else if strings.Contains(labelSelector, \" in \") {\n\t\t\tlabels := strings.Split(labelSelector, \" in (\")\n\t\t\tif len(labels) == 2 {\n\t\t\t\tvalues := []string{}\n\t\t\t\tvalueArr := strings.Split(labels[1][:len(labels[1])-1], \",\")\n\t\t\t\tfor _, value := range valueArr {\n\t\t\t\t\tvalues = append(values, value)\n\t\t\t\t}\n\t\t\t\texpectedLabels[labels[0]] = label{operator: \"in\", value: values}\n\t\t\t}\n\t\t} else if strings.Contains(labelSelector, \" notin \") {\n\t\t\tlabels := strings.Split(labelSelector, \" notin (\")\n\t\t\tif len(labels) == 2 {\n\t\t\t\tvalues := []string{}\n\t\t\t\tvalueArr := strings.Split(labels[1][:len(labels[1])-1], \",\")\n\t\t\t\tfor _, value := range valueArr {\n\t\t\t\t\tvalues = append(values, value)\n\t\t\t\t}\n\t\t\t\texpectedLabels[labels[0]] = label{operator: \"notin\", value: values}\n\t\t\t}\n\t\t}\n\n\t}\n\t// fmt.Printf(\"expected Labels: %+v\\n\", expectedLabels)\n\treturn expectedLabels\n}", "title": "" }, { "docid": "8ddbd2b5f46bc365a7e4a3f76c8475d8", "score": "0.5483424", "text": "func fetchLabelsSetFromLabelSelector(selector *metav1.LabelSelector) labels.Set {\n\treturn selector.MatchLabels\n}", "title": "" }, { "docid": "e97a5301c0821f5b000cc8a26afee429", "score": "0.5478229", "text": "func (m Matrix) ContainsSameLabelset() bool {\n\tswitch len(m) {\n\tcase 0, 1:\n\t\treturn false\n\tcase 2:\n\t\treturn m[0].Metric.Hash() == m[1].Metric.Hash()\n\tdefault:\n\t\tl := make(map[uint64]struct{}, len(m))\n\t\tfor _, ss := range m {\n\t\t\thash := ss.Metric.Hash()\n\t\t\tif _, ok := l[hash]; ok {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tl[hash] = struct{}{}\n\t\t}\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "4c4963f1a66fffd117aab42650382a99", "score": "0.54441637", "text": "func (s *Series) HasLabels(labelNames ...string) error {\n\tfor _, name := range labelNames {\n\t\t_, err := indexOfContainer(name, s.labels)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"verifying labels: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "72cc4bad0d0cae4ad8d4a97d5adef7eb", "score": "0.54172987", "text": "func (lr *labelsReader) fetchMissingLabels(misses []interface{}, missedIds []int64, newLabels []interface{}) (numNewLabels int, err error) {\n\tfor i := range misses {\n\t\tmissedIds[i] = misses[i].(int64)\n\t}\n\trows, err := lr.conn.Query(context.Background(), getLabelsSQL, missedIds)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer rows.Close()\n\n\tvar (\n\t\tkeys pgutf8str.TextArray\n\t\tvals pgutf8str.TextArray\n\t)\n\n\tfor rows.Next() {\n\t\tvar ids []int64\n\t\terr = rows.Scan(&ids, &keys, &vals)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif len(ids) != len(keys.Elements) {\n\t\t\treturn 0, fmt.Errorf(\"query returned a mismatch in ids and keys: %d, %d\", len(ids), len(keys.Elements))\n\t\t}\n\t\tif len(keys.Elements) != len(vals.Elements) {\n\t\t\treturn 0, fmt.Errorf(\"query returned a mismatch in timestamps and values: %d, %d\", len(keys.Elements), len(vals.Elements))\n\t\t}\n\t\tif len(keys.Elements) > len(misses) {\n\t\t\treturn 0, fmt.Errorf(\"query returned wrong number of labels: %d, %d\", len(misses), len(keys.Elements))\n\t\t}\n\n\t\tnumNewLabels = len(keys.Elements)\n\t\tmisses = misses[:len(keys.Elements)]\n\t\tnewLabels = newLabels[:len(keys.Elements)]\n\t\tkeyStrArr := keys.Get().([]string)\n\t\tvalStrArr := vals.Get().([]string)\n\t\tsizes := make([]uint64, numNewLabels)\n\t\tfor i := range newLabels {\n\t\t\tmisses[i] = ids[i]\n\t\t\tnewLabels[i] = labels.Label{Name: keyStrArr[i], Value: valStrArr[i]}\n\t\t\tsizes[i] = uint64(8 + int(unsafe.Sizeof(labels.Label{})) + len(keyStrArr[i]) + len(valStrArr[i])) // #nosec\n\t\t}\n\n\t\tnumInserted := lr.labels.InsertBatch(misses, newLabels, sizes)\n\t\tif numInserted < len(misses) {\n\t\t\tlog.Warn(\"msg\", \"labels cache starving, may need to increase size\")\n\t\t}\n\t}\n\treturn numNewLabels, nil\n}", "title": "" }, { "docid": "d8173f99b37911bb8d02b6c84f02ce61", "score": "0.54072195", "text": "func (m *LabelMatcher) Filter(in model.LabelValues) model.LabelValues {\n\tout := model.LabelValues{}\n\tfor _, v := range in {\n\t\tif m.Match(v) {\n\t\t\tout = append(out, v)\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "37acdff04f59faf27667c06c74c0a21e", "score": "0.5397721", "text": "func (m *CounterMetric) IsContained(labels []string) bool {\n\treturn true\n}", "title": "" }, { "docid": "1d951dcccf8f27375688e22bc287f3ce", "score": "0.53824645", "text": "func removeLabelsFunc(m Labels, match string) Labels {\n\tres := make(Labels)\n\tfor k, v := range m {\n\t\tif k != match {\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "828919c6a2795e119499da55a26f7679", "score": "0.5373417", "text": "func (node *Node) ContainsWithLabel(otherNodeLabel string) bool {\n\tif node.Label == otherNodeLabel {\n\t\treturn true\n\t}\n\n\tvar containsList = []bool{}\n\tfor _, n := range node.Children {\n\t\tcontainsList = append(containsList, n.ContainsWithLabel(otherNodeLabel))\n\t}\n\n\tfor _, value := range containsList {\n\t\tif value == true {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1947d554e711a08f1f01f62b2749aa37", "score": "0.53704935", "text": "func notContains(slice []string, item []byte) bool {\n\treturn !contains(slice, item)\n}", "title": "" }, { "docid": "d32d9bd00d4b46a966e613bc41feda0d", "score": "0.5366031", "text": "func TestLabel(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tbranch string\n\t\tfiles []github.PullRequestFile\n\t\tlabels []string\n\t}{\n\t\t{\n\t\t\tdesc: \"code-only\",\n\t\t\tbranch: \"foo\",\n\t\t\tfiles: []github.PullRequestFile{\n\t\t\t\t{Name: \"file.go\"},\n\t\t\t\t{Name: \"examples/README.md\"},\n\t\t\t},\n\t\t\tlabels: []string{},\n\t\t},\n\t\t{\n\t\t\tdesc: \"docs\",\n\t\t\tbranch: \"foo\",\n\t\t\tfiles: []github.PullRequestFile{\n\t\t\t\t{Name: \"docs/docs.md\"},\n\t\t\t},\n\t\t\tlabels: []string{\"documentation\"},\n\t\t},\n\t\t{\n\t\t\tdesc: \"helm\",\n\t\t\tbranch: \"foo\",\n\t\t\tfiles: []github.PullRequestFile{\n\t\t\t\t{Name: \"examples/chart/index.html\"},\n\t\t\t},\n\t\t\tlabels: []string{\"helm\"},\n\t\t},\n\t\t{\n\t\t\tdesc: \"docs-and-helm\",\n\t\t\tbranch: \"foo\",\n\t\t\tfiles: []github.PullRequestFile{\n\t\t\t\t{Name: \"docs/docs.md\"},\n\t\t\t\t{Name: \"examples/chart/index.html\"},\n\t\t\t},\n\t\t\tlabels: []string{\"documentation\", \"helm\"},\n\t\t},\n\t\t{\n\t\t\tdesc: \"docs-and-backport\",\n\t\t\tbranch: \"branch/foo\",\n\t\t\tfiles: []github.PullRequestFile{\n\t\t\t\t{Name: \"docs/docs.md\"},\n\t\t\t},\n\t\t\tlabels: []string{\"backport\", \"documentation\"},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.desc, func(t *testing.T) {\n\t\t\tb := &Bot{\n\t\t\t\tc: &Config{\n\t\t\t\t\tEnvironment: &env.Environment{\n\t\t\t\t\t\tOrganization: \"foo\",\n\t\t\t\t\t\tRepository: \"bar\",\n\t\t\t\t\t\tNumber: 0,\n\t\t\t\t\t\tUnsafeBase: test.branch,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tlabels, err := b.labels(context.Background(), test.files)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.ElementsMatch(t, labels, test.labels)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c6610b082be5509d1b05abbe4275d732", "score": "0.5359513", "text": "func (o *WorkflowServiceItemInstanceAllOf) HasLabel() bool {\n\tif o != nil && o.Label != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7cdcdf522dbdfbcdc445227b4c422c5e", "score": "0.5359227", "text": "func labeled(issue *github.Issue, label string) bool {\n\tfor _, l := range issue.Labels {\n\t\tif *l.Name == label {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2aae89936ba554c316841db6d817fc27", "score": "0.53361505", "text": "func labelsMatching(env labelExpressionEnv, keyExpr string) ([]string, error) {\n\tallLabels := env.resourceLabelGetter.GetAllLabels()\n\tvar matchingLabelValues []string\n\tfor key, value := range allLabels {\n\t\tmatch, err := utils.MatchString(key, keyExpr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif match {\n\t\t\tmatchingLabelValues = append(matchingLabelValues, value)\n\t\t}\n\t}\n\treturn matchingLabelValues, nil\n}", "title": "" }, { "docid": "b462923f8e1d2119246b8f60bb3d01cc", "score": "0.5315008", "text": "func (p antiAffinityLabel) filter(pools *csp.CSPList) (*csp.CSPList, error) {\n\tif p.labelSelector == \"\" {\n\t\treturn pools, nil\n\t}\n\t// pools that are already associated with\n\t// this label should be excluded\n\t//\n\t// NOTE: we try without giving any namespace\n\t// so that it lists from all available\n\t// namespaces\n\tcvrs, err := p.cvrList(\"\", metav1.ListOptions{LabelSelector: p.labelSelector})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texclude := cvr.NewListBuilder().WithAPIList(cvrs).List().GetPoolUIDs()\n\treturn pools.Filter(csp.IsNotUID(exclude...)), nil\n}", "title": "" }, { "docid": "699413619950fba5d02ac43866b0def7", "score": "0.5280235", "text": "func (p *PackageEnvelope) HasAnyLabel(labels map[string][]string) bool {\n\tfor name, values := range labels {\n\t\tfor _, value := range values {\n\t\t\tif p.HasLabel(name, value) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d7a6f054a845828fb79f14e6857e0266", "score": "0.5256131", "text": "func LabelSelector(query map[string]string) InstanceSelectorFunc {\n\treturn func(i *api.Instance) bool {\n\t\tif query == nil || len(query) == 0 {\n\t\t\treturn true\n\t\t}\n\n\t\t// just terrible\n\t\tlabels := i.Labels\n\t\tfor k, v := range query {\n\t\t\tval, ok := labels[k]\n\t\t\tif !ok || v != val {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}", "title": "" }, { "docid": "5b735494bb84df26c1719d782e8a5666", "score": "0.52549386", "text": "func TestEqualLabelss(t *testing.T, got, want []*promutils.Labels) {\n\tt.Helper()\n\tvar gotCopy []*promutils.Labels\n\tfor _, labels := range got {\n\t\tlabels = labels.Clone()\n\t\tlabels.Sort()\n\t\tgotCopy = append(gotCopy, labels)\n\t}\n\tif !reflect.DeepEqual(gotCopy, want) {\n\t\tt.Fatalf(\"unexpected labels:\\ngot\\n%v\\nwant\\n%v\", gotCopy, want)\n\t}\n}", "title": "" }, { "docid": "db76bc6bc4e94345f60e12ce385b5880", "score": "0.52512395", "text": "func (l k8sLabels) Has(key string) bool {\n\t_, ok := l.LabelSet[model.LabelName(key)]\n\treturn ok\n}", "title": "" }, { "docid": "d15c7adeff85a36fc7bd2e2a5b5c9b3c", "score": "0.5234453", "text": "func uniqueLabels(ll [][2]string) int {\n\td := map[string]int{}\n\tvar sum int\n\tfor i := 0; i < len(ll); i++ {\n\t\tfor _, j := range ll[i] {\n\t\t\tif _, ok := d[j]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\td[j]++\n\t\t}\n\t}\n\tfor i := range d {\n\t\tsum += d[i]\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "5d69bed8634a8a477eb0ad79115fdaac", "score": "0.52261496", "text": "func TestContains(t *testing.T) {\n\tfor _, tt := range containstt {\n\t\t// Act\n\t\tresult, err := contains(tt.v1, tt.v2)\n\n\t\t// Assert\n\t\tassert.Equal(t, tt.err, err, tt.message)\n\t\tassert.Equal(t, tt.result, (result != nil), tt.message)\n\t}\n}", "title": "" }, { "docid": "5dfcf1dbf7791804a4a90cb05d84a0b0", "score": "0.5224618", "text": "func DedupeAndMergeLabels(existLabel, newLabel map[string]string) map[string]string {\n\tif existLabel == nil {\n\t\treturn newLabel\n\t}\n\n\tfor k, v := range newLabel {\n\t\texistLabel[k] = v\n\t}\n\treturn existLabel\n}", "title": "" }, { "docid": "380e4127e877725ab57385ece27fd6b7", "score": "0.522451", "text": "func (m *TickerGaugeMetric) IsContained(labels []string) bool {\n\treturn true\n}", "title": "" }, { "docid": "308a7d7c63735a8f4e81669d5ecb6fbd", "score": "0.52188414", "text": "func (o *WorkflowSolutionDefinitionAllOf) HasLabel() bool {\n\tif o != nil && o.Label != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8e23c276e8f6854ff56b0197afd09cc5", "score": "0.52176964", "text": "func MatchLabels(selector Labels, target map[string]string) bool {\n\t// empty selector matches nothing\n\tif len(selector) == 0 {\n\t\treturn false\n\t}\n\t// *: * matches everything even empty target set\n\tselectorValues := selector[Wildcard]\n\tif len(selectorValues) == 1 && selectorValues[0] == Wildcard {\n\t\treturn true\n\t}\n\t// otherwise perform full match\n\tfor key, selectorValues := range selector {\n\t\ttargetVal, hasKey := target[key]\n\t\tif !hasKey {\n\t\t\treturn false\n\t\t}\n\t\tif !utils.SliceContainsStr(selectorValues, Wildcard) && !utils.SliceContainsStr(selectorValues, targetVal) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "08f279890e28020147d528cff0dbe027", "score": "0.5216609", "text": "func (m *CategoryMutation) ResetContains() {\n\tm.contains = nil\n\tm.clearedcontains = false\n\tm.removedcontains = nil\n}", "title": "" }, { "docid": "a2125fe426cc4d339731043eb00dcbaa", "score": "0.5209973", "text": "func TestCandidatesExcludingLabelSelector(t *testing.T) {\n\tselector, err := labels.Parse(\"app!=foo\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tchaoskube := setup(t, selector, labels.Everything(), labels.Everything(), []time.Weekday{}, time.UTC, false, 0)\n\n\tvalidateCandidates(t, chaoskube, []map[string]string{\n\t\t{\"namespace\": \"testing\", \"name\": \"bar\"},\n\t})\n}", "title": "" }, { "docid": "63fe108c03ab1135a94ae6d39410fd4e", "score": "0.5195777", "text": "func (q querier) LabelNames(...*labels.Matcher) ([]string, storage.Warnings, error) {\n\treturn nil, nil, errNotImplemented\n}", "title": "" }, { "docid": "0de7eb7280aa40fa507ad3a873478519", "score": "0.5195033", "text": "func (b Blobs) SearchLabels(labels ...string) (entries SearchResults, err error) {\n\tif err := b.UpdateSnapshot(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(b.DB.Snapshot) == 0 {\n\t\treturn nil, nil\n\t}\n\tif len(labels) == 0 {\n\t\treturn b.allEntries(), nil\n\t}\n\n\tentries = make(map[string]string)\n\tfor uuid, entry := range b.DB.Snapshot {\n\t\tblob := Blob(entry)\n\n\t\tlblVal := blob[KeyLabels]\n\t\tif len(lblVal) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\thaveLabels := strings.Split(lblVal, \",\")\n\n\t\tfound := 0\n\t\tfor _, want := range labels {\n\t\t\tfor _, have := range haveLabels {\n\t\t\t\tif have != want {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfound++\n\t\t\t\tif found == len(labels) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif found == len(labels) {\n\t\t\tentries[uuid] = blob.Name()\n\t\t}\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "f9f70359449371c73f952c339a259511", "score": "0.51670104", "text": "func LabelsMatch(metric *dto.Metric, labelFilter map[string]string) bool {\n\tmetricLabels := map[string]string{}\n\n\tfor _, labelPair := range metric.Label {\n\t\tmetricLabels[labelPair.GetName()] = labelPair.GetValue()\n\t}\n\n\t// length comparison then match key to values in the maps\n\tif len(labelFilter) > len(metricLabels) {\n\t\treturn false\n\t}\n\n\tfor labelName, labelValue := range labelFilter {\n\t\tif value, ok := metricLabels[labelName]; !ok || value != labelValue {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bf78c080a73339863f6b08f43e4de01e", "score": "0.5160854", "text": "func FindMissing(required []string, entries []string) []string {\n\tretval := []string{}\n\tfor _, req := range required {\n\t\tfound := false\n\t\tfor _, entry := range entries {\n\t\t\tif req == entry {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tretval = append(retval, req)\n\t\t}\n\t}\n\treturn retval\n}", "title": "" }, { "docid": "1b69b1735e481c43c532f15cf0ca1fa3", "score": "0.51583844", "text": "func (l4 *L4Filter) matchesLabels(labels labels.LabelArray) (bool, bool) {\n\tif l4.wildcard != nil {\n\t\tl7Rules := l4.L7RulesPerSelector[l4.wildcard]\n\t\tisDeny := l7Rules != nil && l7Rules.IsDeny\n\t\treturn true, isDeny\n\t} else if len(labels) == 0 {\n\t\treturn false, false\n\t}\n\n\tvar selected bool\n\tfor sel, rule := range l4.L7RulesPerSelector {\n\t\t// slow, but OK for tracing\n\t\tif idSel, ok := sel.(*labelIdentitySelector); ok && idSel.xxxMatches(labels) {\n\t\t\tisDeny := rule != nil && rule.IsDeny\n\t\t\tselected = true\n\t\t\tif isDeny {\n\t\t\t\treturn true, isDeny\n\t\t\t}\n\t\t}\n\t}\n\treturn selected, false\n}", "title": "" }, { "docid": "2aed9e63fbe6f0b5408f39795d1ec020", "score": "0.5142347", "text": "func (v *testVolume) hasLabel(label uint64, body *testBody) bool {\n\tvar offset, size dvid.Point3d\n\tif body == nil {\n\t\toffset = dvid.Point3d{0, 0, 0}\n\t\tsize = v.size\n\t} else {\n\t\toffset = body.offset\n\t\tsize = body.size\n\t}\n\tnx := v.size[0]\n\tnxy := nx * v.size[1]\n\tfor z := offset[2]; z < offset[2]+size[2]; z++ {\n\t\tfor y := offset[1]; y < offset[1]+size[1]; y++ {\n\t\t\ti := (z*nxy + y*nx + offset[0]) * 8\n\t\t\tfor x := int32(0); x < size[0]; x++ {\n\t\t\t\tcurLabel := binary.LittleEndian.Uint64(v.data[i : i+8])\n\t\t\t\tif curLabel == label {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\ti += 8\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e6e59171dbd99e691a5f87e74556cc86", "score": "0.51397026", "text": "func MergeLabels(l1 []Label, l2 ...[]Label) []Label {\n\tfor _, l := range l2 {\n\t\tfor _, e2 := range l {\n\t\t\tfound := false\n\n\t\t\tfor _, e1 := range l1 {\n\t\t\t\tif e1.Name == e2.Name {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !found {\n\t\t\t\tl1 = append(l1, e2)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn l1\n}", "title": "" }, { "docid": "68f743b043f95bff6beaac0210dc1b2a", "score": "0.5139613", "text": "func matchLabel(matchLabels map[string]string, objLabels map[string]string) bool {\n\t// nil (unspecfied) cliContext label matches everything\n\tif matchLabels == nil || len(matchLabels) == 0 {\n\t\treturn true\n\t}\n\n\t// nil object labels doesn't match anything\n\tif objLabels == nil {\n\t\treturn false\n\t}\n\n\tfor key, label := range matchLabels {\n\t\tif objLabel, ok := objLabels[key]; ok && objLabel == label {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dcda53afe95252968b9c775ad951cad1", "score": "0.51262885", "text": "func ContainsAny(src, tgt []string) (hits []string, ok bool) {\n\tvar m = make(map[string]bool)\n\tfor _, v := range src {\n\t\tm[v] = true\n\t}\n\tfor _, v := range tgt {\n\t\tif m[v] {\n\t\t\thits = append(hits, v)\n\t\t}\n\t}\n\n\treturn hits, len(hits) > 0\n}", "title": "" }, { "docid": "c132488e37df8f1508f0ca98ba4b7942", "score": "0.51246613", "text": "func (it *uniqueContains) Contains(ctx context.Context, val graph.Ref) bool {\n\treturn it.subIt.Contains(ctx, val)\n}", "title": "" }, { "docid": "c9cb74ee210b8114ef1ed34696460d6d", "score": "0.51075125", "text": "func filterPodLabels(labels map[string]string) map[string]string {\n\tres := map[string]string{}\n\tfor k, v := range labels {\n\t\tif strings.HasPrefix(k, k8sConst.LabelPrefix) {\n\t\t\tcontinue\n\t\t}\n\t\tres[k] = v\n\t}\n\treturn res\n}", "title": "" }, { "docid": "137fc1699e6b3f6238f28d707072d3e4", "score": "0.5098774", "text": "func (o *WorkflowServiceItemActionDefinitionAllOf) HasLabel() bool {\n\tif o != nil && o.Label != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c6dc2934d128ff11ef2cc0ce744fa6e2", "score": "0.50978047", "text": "func NotContain(a []string, s string) bool {\n\treturn !Contains(a, s)\n}", "title": "" }, { "docid": "0438cdc05daa322bb245f1e7ddde2c2a", "score": "0.50940394", "text": "func AllLabels() labelSet {\n\treturn labelSet{allLabels}\n}", "title": "" }, { "docid": "d33ece4e9807dd2f421ef228c9a6e6bc", "score": "0.5091744", "text": "func (o *KubernetesNodeGroupProfileAllOf) HasLabels() bool {\n\tif o != nil && o.Labels != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ac19a3405a0cf394eaf581f54f4964f0", "score": "0.50900215", "text": "func (s Set) FilterNotContains(slice any) any {\n\tsliceTyp := reflect.TypeOf(slice)\n\tif sliceTyp == nil || sliceTyp.Kind() != reflect.Slice {\n\t\tpanic(fmt.Sprintf(\"invalid slice type %T\", slice))\n\t}\n\n\tsliceVal := reflect.ValueOf(slice)\n\tsliceLen := sliceVal.Len()\n\tres := reflect.MakeSlice(sliceTyp, 0, sliceLen)\n\tfor i := 0; i < sliceLen; i++ {\n\t\tval := sliceVal.Index(i)\n\t\tif _, ok := s.m[val.Interface()]; !ok {\n\t\t\tres = reflect.Append(res, val)\n\t\t}\n\t}\n\treturn res.Interface()\n}", "title": "" }, { "docid": "1ab494b662d1cf2ae69f77c2b0385352", "score": "0.50881225", "text": "func (i TestInfo) GetLabels() map[string]string { return i.Labels }", "title": "" }, { "docid": "e3c40ca1f080e2c406bf59b8d1c36c1b", "score": "0.508512", "text": "func isIncluded(target *core.BuildTarget, filter []core.BuildLabel) bool {\n\tif len(filter) == 0 {\n\t\treturn true // if you don't specify anything, the filter has no effect.\n\t}\n\tfor _, f := range filter {\n\t\tif f.Includes(target.Label) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d2d43611dd61df9eb6c92709d994d872", "score": "0.50838166", "text": "func ContainsAll(m map[string]string, slice []string) bool {\n\tif len(slice) == 0 {\n\t\treturn true\n\t}\n\tif len(m) == 0 {\n\t\treturn false\n\t}\n\tfor _, elem := range slice {\n\t\tif _, ok := m[elem]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ee3ac0e8577760b797ec0a31eee29413", "score": "0.5081043", "text": "func labelInExceptionList(podLabels map[string]string, exceptionList []aadpodid.AzurePodIdentityException) bool {\n\tfor _, exception := range exceptionList {\n\t\tfor exceptionLabelKey, exceptionLabelValue := range exception.Spec.PodLabels {\n\t\t\tif val, ok := podLabels[exceptionLabelKey]; ok {\n\t\t\t\tif strings.EqualFold(val, exceptionLabelValue) {\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": "a06fc89dba35a1d1db316cbacebb738e", "score": "0.5064329", "text": "func (l BeaconingLabels) Labels() []string {\n\treturn []string{\"in_if_id\", prom.LabelNeighIA, prom.LabelResult}\n}", "title": "" }, { "docid": "4dc938d5a91ca35fab474f1fbae88151", "score": "0.5059585", "text": "func Labels(match map[string]string) ComparableFilter {\n\treturn Selector(labels.SelectorFromSet(match))\n}", "title": "" }, { "docid": "ede933d358af3e26bbc2517a1d00d34d", "score": "0.50507027", "text": "func (o *WorkflowTaskDefinitionAllOf) HasLabel() bool {\n\tif o != nil && o.Label != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "77057caaf55b9d28d884b20eb4756d8b", "score": "0.504104", "text": "func (df *DataFrame) SelectLabels(labels []string, level int) []int {\n\tempty := make([]int, 0)\n\terr := df.ensureIndexLevelPositions([]int{level})\n\tif err != nil {\n\t\tif options.GetLogWarnings() {\n\t\t\tlog.Printf(\"DataFrame.SelectLabels(): %v\", err)\n\t\t}\n\t\treturn empty\n\t}\n\tdf.index.Levels[level].UpdateLabelMap()\n\tinclude := make([]int, 0)\n\tfor _, label := range labels {\n\t\tval, ok := df.index.Levels[level].LabelMap[label]\n\t\tif !ok {\n\t\t\tif options.GetLogWarnings() {\n\t\t\t\tlog.Printf(\"DataFrame.SelectLabels(): %v not in label map\", label)\n\t\t\t}\n\t\t\treturn empty\n\t\t}\n\t\tinclude = append(include, val...)\n\t}\n\treturn include\n}", "title": "" }, { "docid": "d64fcf9c01f2091742adcc4b2efca0b9", "score": "0.50341046", "text": "func collectLabels(sample *pprofProfile.Sample, keys []string, svals []string) ([]string, []string) {\n\tkeys = keys[:0]\n\tsvals = svals[:0]\n\tfor k, vv := range sample.Label {\n\t\tfor _, v := range vv {\n\t\t\tkeys = append(keys, k)\n\t\t\tsvals = append(svals, v)\n\t\t}\n\t}\n\treturn keys, svals\n}", "title": "" }, { "docid": "14996ac94fc322b4f2238c92641ade82", "score": "0.50329304", "text": "func validateNoConflict(presentLabels []string, absentLabels []string) error {\n\tm := make(map[string]struct{}, len(presentLabels))\n\tfor _, l := range presentLabels {\n\t\tm[l] = struct{}{}\n\t}\n\tfor _, l := range absentLabels {\n\t\tif _, ok := m[l]; ok {\n\t\t\treturn fmt.Errorf(\"detecting at least one label (e.g., %q) that exist in both the present(%+v) and absent(%+v) label list\", l, presentLabels, absentLabels)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee3380fc9d9aa55f9cd72dc8f1f202d4", "score": "0.50324553", "text": "func LabelIn(vs ...string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldIn(FieldLabel, vs...))\n}", "title": "" }, { "docid": "263bdafbccf029c15750ea5ea5e8ac88", "score": "0.5031285", "text": "func testGraphNotContains(t *testing.T, g *Graph, name string) {\n\tfor _, v := range g.Vertices() {\n\t\tif dag.VertexName(v) == name {\n\t\t\tt.Fatalf(\n\t\t\t\t\"Expected %q to NOT be in:\\n\\n%s\",\n\t\t\t\tname, g.String())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "269871d1f910b1fb0adc4e9965ae65be", "score": "0.5027283", "text": "func ContainsFn(x, y interface{}) (bool, string) { return Contains(x, y) }", "title": "" }, { "docid": "e317905a3686954ae07dfdd0b7c5de6c", "score": "0.5023498", "text": "func containsAllIdentifiers(s1 *[]*ent.Identifier, s2 *[]*ent.Identifier) bool {\n\tif len(*s2) > len(*s1) {\n\t\treturn false\n\t}\n\tif s1 != nil && s2 != nil {\n\t\tfor _, s2Item := range *s2 {\n\t\t\tfound := false\n\t\t\tfor _, s1Item := range *s1 {\n\t\t\t\tif (((*s1Item).GetQualifier() == nil && (*s2Item).GetQualifier() == nil) || *((*s1Item).GetQualifier()) == *((*s2Item).GetQualifier())) &&\n\t\t\t\t\t(((*s1Item).GetValue() == nil && (*s2Item).GetValue() == nil) || *((*s1Item).GetValue()) == *((*s2Item).GetValue())) &&\n\t\t\t\t\t(((*s1Item).GetPosition() == nil && (*s2Item).GetPosition() == nil) || *((*s1Item).GetPosition()) == *((*s2Item).GetPosition())) {\n\t\t\t\t\tfound = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "fa7054409032f49b835800a04e540539", "score": "0.5023388", "text": "func hasLabel(c githubClient, org, repo string, num int, label string) (bool, error) {\n\tlabels, err := c.GetIssueLabels(org, repo, num)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get the labels on %s/%s#%d: %v\", org, repo, num, err)\n\t}\n\tfor _, candidate := range labels {\n\t\tif candidate.Name == label {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "804141f63f6107b4fc80c03438c3113a", "score": "0.5021612", "text": "func filterLabelsReFunc(m Labels, pattern string) Labels {\n\tre := regexp.MustCompile(pattern)\n\tres := make(Labels)\n\tfor k, v := range m {\n\t\tif re.MatchString(k) {\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "f9770ab64c57aaf58e872a5a53749a2b", "score": "0.502141", "text": "func (m *ImmutableGaugeMetric) IsContained(labels []string) bool {\n\treturn true\n}", "title": "" }, { "docid": "74beb6039598ed5aafc1615c2f2c02a0", "score": "0.50193673", "text": "func (m Metadata) Labels() *attribute.Set {\n\treturn m.labels\n}", "title": "" }, { "docid": "c8f9d3dfb4d314621c4d9a996c595aff", "score": "0.50175315", "text": "func (ds Devices) Contains(ids ...string) bool {\n\tfor _, id := range ids {\n\t\tif _, exists := ds[id]; !exists {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "54be856ac01034b146a2b9037a82a0ab", "score": "0.50111645", "text": "func (ls LabelArray) Labels() Labels {\n\tlbls := Labels{}\n\tfor _, l := range ls {\n\t\tlbls[l.Key] = l\n\t}\n\treturn lbls\n}", "title": "" }, { "docid": "ce3330d91324427b38ead45578e24b4a", "score": "0.5007788", "text": "func TestContains(t *testing.T) {\n\tfmt.Println(\"TestContains\")\n\ts := getTestSet()\n\ti := testItem{1}\n\tassertOperation(t, \"empty set contains 1\", s.Contains(i), false)\n\ts.Add(i)\n\tassertOperation(t, \"empty set contains 1\", s.Contains(i), true)\n\ts.Remove(i)\n\tassertOperation(t, \"empty set contains 1\", s.Contains(i), false)\n}", "title": "" }, { "docid": "c26f3d3f57ad8cdddb50733e776fc57a", "score": "0.50069785", "text": "func findExistingTopologyLabels(ctx context.Context, nodeList []corev1.Node) (string, string, error) {\n\tlog := logger.GetLogger(ctx)\n\tlabelMap := map[string]bool{\n\t\t\"beta\": false,\n\t\t\"GA\": false,\n\t}\n\tfor _, k8sNode := range nodeList {\n\t\tif k8sNode.Labels[corev1.LabelTopologyZone] != \"\" || k8sNode.Labels[corev1.LabelTopologyRegion] != \"\" {\n\t\t\tlabelMap[\"GA\"] = true\n\t\t}\n\t\tif k8sNode.Labels[corev1.LabelFailureDomainBetaZone] != \"\" ||\n\t\t\tk8sNode.Labels[corev1.LabelFailureDomainBetaRegion] != \"\" {\n\t\t\tlabelMap[\"beta\"] = true\n\t\t}\n\t\tif labelMap[\"GA\"] && labelMap[\"beta\"] {\n\t\t\treturn \"\", \"\", logger.LogNewErrorf(log, \"found conflicting topology labels on certain node(s) in \"+\n\t\t\t\t\"the cluster. Nodes in the cluster should either have the standard topology beta labels \"+\n\t\t\t\t\"starting with \\\"failure-domain.beta.kubernetes.io\\\" or standard topology GA labels starting with \"+\n\t\t\t\t\"\\\"topology.kubernetes.io\\\".\")\n\t\t}\n\t}\n\tswitch {\n\tcase labelMap[\"GA\"]:\n\t\tlog.Infof(\"Found standard topology GA labels on the existing nodes in the cluster.\")\n\t\treturn corev1.LabelTopologyZone, corev1.LabelTopologyRegion, nil\n\tcase labelMap[\"beta\"]:\n\t\tlog.Infof(\"Found standard topology beta labels on the existing nodes in the cluster.\")\n\t\treturn corev1.LabelFailureDomainBetaZone, corev1.LabelFailureDomainBetaRegion, nil\n\t}\n\treturn \"\", \"\", nil\n}", "title": "" }, { "docid": "bda1446eaf6d36851aeabbf83441fa1a", "score": "0.5003791", "text": "func (anonymousTraversal *anonymousTraversal) HasLabel(args ...interface{}) *GraphTraversal {\n\treturn anonymousTraversal.graphTraversal().HasLabel(args...)\n}", "title": "" }, { "docid": "1ae458d33da12145fc60c3941df3043e", "score": "0.5000349", "text": "func GetListOfRemoveLabels(mapOfRemoveLabels map[string]string, listofItemLabels []gitee.Label) []string {\n\t// init\n\tlistOfRemoveLabels := make([]string, 0)\n\t// range over the map to filter the list of labels\n\tfor l := range mapOfRemoveLabels {\n\t\t// check if the label is existing in current item\n\t\texistingInItem := false\n\t\tfor _, itemLabel := range listofItemLabels {\n\t\t\tif l == itemLabel.Name {\n\t\t\t\texistingInItem = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// the label is not existing in current item so it is no need to remove this label\n\t\tif !existingInItem {\n\t\t\tglog.Infof(\"label %s is not existing in current item\", l)\n\t\t\tcontinue\n\t\t}\n\n\t\t// append\n\t\tlistOfRemoveLabels = append(listOfRemoveLabels, l)\n\t}\n\treturn listOfRemoveLabels\n}", "title": "" }, { "docid": "834f7146bc4c536ba4117e92a264dfd7", "score": "0.49994847", "text": "func contains(slice []string, item []byte) bool {\n\tset := make(map[string]struct{}, len(slice))\n\tfor _, s := range slice {\n\t\tset[s] = struct{}{}\n\t}\n\n\t_, ok := set[string(item)]\n\treturn ok\n}", "title": "" }, { "docid": "8d9b762fb31d29d8e376ab38dd85be5c", "score": "0.49892676", "text": "func verifyLabels(nodes *corev1.NodeList, verbose bool) error {\n\tfor _, n := range nodes.Items {\n\t\t_, ok := n.ObjectMeta.Labels[labelUpgradeLock]\n\t\tif ok {\n\t\t\treturn errors.Errorf(\"label %s is present on node %s\", labelUpgradeLock, n.ObjectMeta.Name)\n\t\t}\n\t\tif verbose {\n\t\t\tfmt.Printf(\"[%s] Label %s isn't present\\n\", n.ObjectMeta.Name, labelUpgradeLock)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
2512edaa2e8fd84b0e19e7ee3de2aa4e
IsSuccess returns true when this combined query vulnerabilities too many requests response has a 2xx status code
[ { "docid": "3d609291f8aa462b3307d51aa66847a3", "score": "0.7248323", "text": "func (o *CombinedQueryVulnerabilitiesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" } ]
[ { "docid": "e703332cc628f76740edf5bba97a3a0f", "score": "0.6881904", "text": "func (o *CombinedQueryVulnerabilitiesInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "7dc2d5b6c9f0893252872f10c9c4a24d", "score": "0.6848526", "text": "func (o *CombinedQueryVulnerabilitiesBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "141653efd56b25102f5c6f17eaba3b58", "score": "0.6784954", "text": "func (o *CombinedQueryVulnerabilitiesForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "83276116f523533d89ee0e3df77aefe5", "score": "0.6725257", "text": "func (o *CombinedQueryVulnerabilitiesOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "0f8679afa1c7f531c55f6e39ec75a086", "score": "0.6701081", "text": "func (o *QueryEscalationsFilterTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "79d2f855f1ffdeb118972c418267ec4d", "score": "0.6640121", "text": "func (o *CombinedQueryEvaluationLogicTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1d6fd09c46d0306e0d74f8967f38464e", "score": "0.65103763", "text": "func (o *QueryScanHostMetadataTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "361b6daff8171d9105811510f0d92e7f", "score": "0.65070754", "text": "func (o *QueryPatternsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e7ae379bed3bfcb606c30c997a76d083", "score": "0.65014327", "text": "func (o *QueryPlatformsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "7e8f7f6eb3672dbfc5ba5c44f5d42c2c", "score": "0.6470118", "text": "func (o *GetMalQueryMetadataV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "9720fac1993d3a497843b4b29f7157e6", "score": "0.64470905", "text": "func (o *QueryCasesIdsByFilterTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cb1729bcd3e825cde8958ab7a70ac1ea", "score": "0.6385926", "text": "func (o *QueryRTResponsePoliciesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "9a9f09c3c444583c9ec3f2a4bf3e5403", "score": "0.6377335", "text": "func (o *QueryHostGroupsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1d5b52530eb77311be828275150f18a5", "score": "0.63114315", "text": "func (o *QueryCombinedSensorUpdatePoliciesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "a5faea0fb6c0505a010a348d32333343", "score": "0.6237377", "text": "func (o *QueryCombinedSensorUpdateKernelsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "4fd209941b7a2fe488cfbefe9c54de78", "score": "0.6230818", "text": "func (o *CreateCSPMAzureAccountTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ef602438c3cbd624081b12eb8a036446", "score": "0.62280774", "text": "func (o *IndicatorGetV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d13a674c7afe894f8180355002aafa66", "score": "0.62015253", "text": "func (o *QueryRuleTypesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "40e2305ef6c9413a223e335b9f1261ca", "score": "0.6180524", "text": "func (o *GetCSPMPolicyTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "fee156d0ad213d29ce050b22fcbbdd3d", "score": "0.6169315", "text": "func (o *CombinedQueryEvaluationLogicBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "10d0f3efcc3e3fe224f239c2a798b435", "score": "0.61508644", "text": "func (o *CreateRegistryEntitiesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6a46d111bc7b9f70a89df52e3315419f", "score": "0.6150196", "text": "func (o *RetrieveUserUUIDsByCIDTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "838a110f74113eb8e1d5b6078f8cae79", "score": "0.61452067", "text": "func (o *GetCSPMAzureUserScriptsAttachmentTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ca201429cc2578eaca687d825b9ec3c8", "score": "0.6126708", "text": "func (o *CombinedQueryEvaluationLogicInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "91f5956da91fe62cd3e443831f3f196c", "score": "0.6099864", "text": "func (o *AggregateAllowListTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c474eb988fd18f8f2384ffb788677370", "score": "0.609974", "text": "func (o *QueryCombinedSensorUpdatePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "fb4811d1aff6427034206e11992d9adf", "score": "0.60938007", "text": "func IsHTTPSuccess(code int) bool {\n\treturn code >= 200 && code < 300\n}", "title": "" }, { "docid": "99aff1f6c41490a327fb6e6362abefbb", "score": "0.60707843", "text": "func (o *DeleteCSPMAzureAccountTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "e1c67525cfad0257574867ea9a9640da", "score": "0.60682213", "text": "func (o *QueryCasesIdsByFilterBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "20eecda1ee603d37fdf177f91acec399", "score": "0.60544324", "text": "func (o *QueryDevicesByFilterScrollTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1dac0a39ba2824287b159882fc5a03e4", "score": "0.6045444", "text": "func (o *QueryPreventionPoliciesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "17bfbc83df576f89e7e6acde3dde4a09", "score": "0.6026548", "text": "func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "7261816f5340a39b33ffa9d0c9dc2519", "score": "0.60155505", "text": "func isSuccess(httpStatusCode int) bool {\n\treturn httpStatusCode >= 200 && httpStatusCode < 300\n}", "title": "" }, { "docid": "4d9d713cd8b083ec488d76abbfd5f312", "score": "0.6008913", "text": "func (o *DeleteSampleV3TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1c6d20b8dcabaa6dccfd2c1a624f6fcb", "score": "0.59934175", "text": "func (r WriteMultipleResult) IsSuccess() bool {\n\treturn r.FailedOperationIndex == -1\n}", "title": "" }, { "docid": "95512e2f8142033dc17f250103ddaebe", "score": "0.5989331", "text": "func (o *GetDomainUsingGETBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "df89f366707f4e8589c2c0013ed42821", "score": "0.59823465", "text": "func (o *IndicatorCreateV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "9ce276a0428ef686cc0a91288ba6ab6c", "score": "0.59736425", "text": "func (o *TokensCreateTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ed0b0960ba5dd7aa77ef5ab498ca0b3a", "score": "0.59602857", "text": "func (o *CombinedQueryEvaluationLogicForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "030b6093ddc010eb3e69183e63a19ef2", "score": "0.5918168", "text": "func (o *QueryActionsV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8be1b0df54b3bc6918649d58e8cf888c", "score": "0.59096766", "text": "func (o *QueryCombinedSensorUpdateKernelsBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "a75214d8293ab3f73db3729937e36bca", "score": "0.5906257", "text": "func (o *QueryCasesIdsByFilterInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "4010233988b85419fc5362fe1c065148", "score": "0.5906098", "text": "func (o *RTRGetPutFilesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c40b05b743826d07bbaf9d6e622cec54", "score": "0.59052765", "text": "func (o *QueryRTResponsePoliciesBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ab198cd9ff274b85e61122e7783fa13d", "score": "0.58893985", "text": "func (o *GetUserGroupMembersByIDV2TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "b379dfa38a7bfebbce348c20f6d21317", "score": "0.5888485", "text": "func (o *GetResourceByIDUsingGET5Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ab03ce08ba6883faabb51f5fc9cf58dc", "score": "0.5882593", "text": "func (o *GetCIDGroupMembersByTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0773958025190de1c5cbc78ee8441e02", "score": "0.58799285", "text": "func (o *QueryHostGroupsBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6875537b30886663cc22250c5fda8db6", "score": "0.58757865", "text": "func isSuccess(response *http.Response) bool {\n\treturn response.StatusCode >= 200 && response.StatusCode < 300\n}", "title": "" }, { "docid": "11facbe9add7ba26b02f7420f126521f", "score": "0.58750147", "text": "func (o *GetEndpointIDLabelsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1a617a334fac7e48c0a5433957ef6d93", "score": "0.5871594", "text": "func (o *TokensDeleteTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c3beec8a7b352a73a4a9b142a6e481b9", "score": "0.5852215", "text": "func (o *QueryCombinedSensorUpdatePoliciesInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ffb16b5dc693978f76783361244b296d", "score": "0.58443767", "text": "func (o *ListSocks5ServerBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "175bd9f952fb1dd541681f6fd720f3b7", "score": "0.5833958", "text": "func (o *GetDeploymentExpenseHistoryByIDUsingGET2Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cee8728e1cf72c0a4da321bc176071c1", "score": "0.58222467", "text": "func (o *QueryCombinedSensorUpdatePoliciesForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "13fd7aad8c6894a3eb51767423baa05c", "score": "0.581682", "text": "func (o *QueryEscalationsFilterForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "4b8486495e4bc91f123298e6759be4a1", "score": "0.5808889", "text": "func (o *GetAllGerritEventsUsingGETUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "2c2d19f2e148c1669e475f2d5023964c", "score": "0.5805967", "text": "func (o *GetServerGroupInUpstreamBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "fa64646019ac91feb65f35534d5d0c46", "score": "0.58015466", "text": "func (o *GetAllGerritEventsUsingGETInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "eca88148a2534b053d8d3caed62d6daa", "score": "0.5799501", "text": "func (o *GetMalQueryMetadataV1Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ba74c120e49a170e4ff636bd7441d7c3", "score": "0.5797452", "text": "func (o *DeleteHostGroupsTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "46262ee1c146863f105e0b703f087fb1", "score": "0.57867044", "text": "func (o *ExportUsingGETUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "70465e399d4175ff6e3d32c1272fb786", "score": "0.57856923", "text": "func (o *CombinedQueryVulnerabilitiesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "972519e136eb8a69a7dbc8f9099fb514", "score": "0.57796884", "text": "func (o *GetAllGerritEventsUsingGETForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "fd85d19ecc72e24f8bc90cc17d126dea", "score": "0.57773954", "text": "func (o *GetResourceByIDUsingGET5Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c8f07420cfececc91973422d5a93f45c", "score": "0.576756", "text": "func (o *RetrieveUserUUIDsByCIDBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "f0d673852f214e8724ebc5d8a1fd910f", "score": "0.5766829", "text": "func (o *GetMalQueryMetadataV1BadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "db7c87799f36d3ee274e60ff244e6e15", "score": "0.5766221", "text": "func (o *GetMalQueryMetadataV1Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6455aee7972cde2d69195094ce5a2d75", "score": "0.5756804", "text": "func (o *ExportUsingGETForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8caae7aefa71daa425f835870ebba62f", "score": "0.5756743", "text": "func (o *UpdateActionV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "35a4eead7e31b3e0dda29d7eed0c247c", "score": "0.5748957", "text": "func (o *QueryEscalationsFilterOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "517e859e5b67ae3a94729236993a83d4", "score": "0.57474965", "text": "func (o *QueryCombinedSensorUpdateKernelsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cf0f3691c07215803c92afafc2bbba32", "score": "0.57415175", "text": "func (o *GetDomainUsingGETUnauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "693d954a6c69b6d8734583c8d82a77ed", "score": "0.57363147", "text": "func (o *QueryCombinedSensorUpdateKernelsInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "064c92ac9efd3d110b2db6b9c0d060fc", "score": "0.5722703", "text": "func (o *QueryCasesIdsByFilterForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "c09b85eb7762b728e10dd655a979fedf", "score": "0.5717326", "text": "func (o *RTRListFilesTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "1795e44e5c55206601de63867b8c3394", "score": "0.5716631", "text": "func (o *ExportUsingGETInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cb00f51acb53c68351b5acbf4804da9e", "score": "0.5715279", "text": "func (o *QueryPatternsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "6fc78bf67b543c5b48bd4b08fecde1b7", "score": "0.571095", "text": "func (o *GetMalQueryMetadataV1InternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0f2a9ecefa6623e93b97b773a3403b7d", "score": "0.5700542", "text": "func (o *PatchCSPMAwsAccountTooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "855e98566512c15ee39cfab466f4027a", "score": "0.57003933", "text": "func (o *QueryPlatformsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0738274536dafbd97c16ed23906c2eee", "score": "0.56958884", "text": "func (o *QueryHostGroupsInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "81fe0d4dac71ed3a08ae7eabb88c11cc", "score": "0.5695702", "text": "func isResponseSuccess(status int) bool {\n\tif status >= 200 && status < 300 || status == 409 || status == 404 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "344444bac2cef54c1cfd78a243c18ac0", "score": "0.56931853", "text": "func (o *PcloudVpnconnectionsGetBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "54769e6e60c5a97d5a0f9ae2dfe3a162", "score": "0.5687918", "text": "func (o *QueryRTResponsePoliciesForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "02f2bf82a9e9081a53e2b38d18432b08", "score": "0.5686001", "text": "func (o *QueryHostGroupsForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "8b718090ec36652314559be8156ea861", "score": "0.56857854", "text": "func isOK(resp *http.Response) bool {\n\treturn resp.StatusCode == http.StatusOK ||\n\t\tresp.StatusCode == http.StatusCreated || /* see CreateOrUpdateConnector for the `StatusCreated` */\n\t\tresp.StatusCode == http.StatusAccepted || /* see PauseConnector for the `StatusAccepted` */\n\t\tresp.StatusCode == http.StatusNoContent || /* see TopicSettings for the `StatusNoContent` */\n\t\t(resp.Request.Method == http.MethodDelete && resp.StatusCode == http.StatusNoContent) || /* see RemoveConnector for the `StatusNoContnet` */\n\t\t(resp.Request.Method == http.MethodPost && resp.StatusCode == http.StatusNoContent) || /* see Restart tasks for the `StatusNoContnet` */\n\t\t(resp.StatusCode == http.StatusBadRequest && resp.Request.Method == http.MethodGet) /*||*/ /* for things like LSQL which can return 400 if invalid query, we need to read the json and print the error message */\n\t// (resp.Request.Method == http.MethodDelete && ((resp.StatusCode == http.StatusForbidden) || (resp.StatusCode == http.StatusBadRequest))) /* invalid value of something passed */\n}", "title": "" }, { "docid": "82c476a9500a9a54392a00f0f0f5e328", "score": "0.5684025", "text": "func (o *GetDeploymentExpenseHistoryByIDUsingGET2NotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "3c2290946dc3f9700d932e2f28350285", "score": "0.5680779", "text": "func (o *QueryScanHostMetadataForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "d8db25f4ddc7645243b494655e457afd", "score": "0.56791055", "text": "func (o *GetDomainUsingGETForbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "cf5a6a5cb583e1a405872f48e069d8e9", "score": "0.5678962", "text": "func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "15ad785d072cc25adab182ae2a39d70f", "score": "0.5673208", "text": "func (results Results) Failed() bool {\n\tfor _, r := range results {\n\t\tif len(r.Vulnerabilities) > 0 {\n\t\t\treturn true\n\t\t}\n\t\tfor _, m := range r.Misconfigurations {\n\t\t\tif m.Status == StatusFailure {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\tif len(r.Secrets) > 0 {\n\t\t\treturn true\n\t\t}\n\t\tif len(r.Licenses) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "62d123e5ed0fa5636d29431cd808d892", "score": "0.5673161", "text": "func (o *GetActionsV1TooManyRequests) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "fda243d809294db48ad4aa440612523e", "score": "0.5666", "text": "func (o *ListSocks5ServerInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "ef6348f0dc96c6574e89b12496c0c14a", "score": "0.56643087", "text": "func (o *CombinedQueryEvaluationLogicOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "dc8a5eda75a1161067c86673687d7658", "score": "0.5663513", "text": "func ResponseCheck(statusCode int) bool {\n\tswitch {\n\tcase statusCode < 300:\n\t\treturn true\n\tcase statusCode == 401:\n\t\tfmt.Printf(\"\\nAccess denied - check API Token. Status: %d\", statusCode)\n\t\tos.Exit(0)\n\tcase statusCode == 404:\n\t\tfmt.Printf(\"\\nURL not found - Status: %d\", statusCode)\n\t\tos.Exit(0)\n\tcase statusCode == 429:\n\t\tfmt.Printf(\"\\nRate limited by the Vend API :S Status: %d\", statusCode)\n\tcase statusCode >= 500:\n\t\tfmt.Printf(\"\\nServer error. Status: %d\", statusCode)\n\tdefault:\n\t\tfmt.Printf(\"\\nGot an unknown status code - Google it. Status: %d\", statusCode)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "93030996b7bb348cfa191227b9e5bb7e", "score": "0.56551534", "text": "func (o *GetTypesUsingGET5Unauthorized) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "0fed48c23b69cdbbec34979f49fea2a9", "score": "0.5651237", "text": "func (o *GetServerGroupInUpstreamInternalServerError) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "373dfea1429b8dc6f1140ba77fe0e520", "score": "0.564751", "text": "func (o *GetTypesUsingGET5Forbidden) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "7543406aa74e6b3d309c98e266dc01bc", "score": "0.5640079", "text": "func (o *PcloudCloudinstancesJobsGetallBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" } ]
41949194d6a2e12bd2d1d8dee0cbd2c0
Example curl invocations: for obtaining ALL external_entities GET: curl v
[ { "docid": "222d3be09fff98e7499e710d7193723c", "score": "0.49323457", "text": "func externalEntitiesHandler(formatter *render.Render) http.HandlerFunc {\n\n\tsfcplg.HttpMutex.Lock()\n\tdefer sfcplg.HttpMutex.Unlock()\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Debugf(\"External Entities HTTP handler: Method %s, URL: %s, sfcPlugin\", req.Method, req.URL, sfcplg)\n\n\t\tvar eeArray = make([]controller.ExternalEntity, 0)\n\t\tfor _, ee := range sfcplg.ramConfigCache.EEs {\n\t\t\teeArray = append(eeArray, ee)\n\t\t}\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\tformatter.JSON(w, http.StatusOK, eeArray)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "8aba60a9c18684db9022c1a3fd74ded5", "score": "0.57425", "text": "func (x EntityRestClient) MakeGetAllEntitiesURL() (path string, method string) {\n\tpath = x.makeURL(ESvcMainPathURL)\n\tmethod = http.MethodGet\n\treturn\n}", "title": "" }, { "docid": "1690b188e98bcc1ac984d05fe2d99156", "score": "0.5483951", "text": "func GetEntitiesAPICases(t *testing.T) []test.RestAPITestCase {\n\ttestCase := test.RestAPTestCaseFactory(t)\n\n\treturn []test.RestAPITestCase{\n\t\ttestCase(\n\t\t\t&test.RestAPITestCaseConfig{\n\t\t\t\tName: \"GET should return all configuration\",\n\t\t\t\tMethod: \"GET\",\n\t\t\t\tStatus: 200,\n\t\t\t\tURI: \"/_api/rest/entities\",\n\t\t\t\tRequestFile: \"\",\n\t\t\t\tResponseFile: \"api-get-all.json\",\n\t\t\t\tExpectedResponse: []models.EntityRestDto{},\n\t\t\t\tActualResponse: []models.EntityRestDto{},\n\t\t\t}),\n\t}\n}", "title": "" }, { "docid": "3f4689c0ef7c1137c15f8e67fab41c80", "score": "0.542399", "text": "func (p *PgClient) List(entity string, filters url.Values) (interface{}, error) {\n\n\tif entity == \"\" {\n\t\treturn nil, errors.New(\"no entity defined\")\n\t}\n\n\trequestURL := fmt.Sprintf(\"%s/%s\", p.Endpoint, entity)\n\tbody, err := p.Dialer.Get(requestURL, filters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch entity {\n\tcase \"incidents\":\n\t\tvar incidents ps.IncidentsResponse\n\t\tif err := json.Unmarshal(body, &incidents); err != nil {\n\t\t\tif p.Verbose {\n\t\t\t\tlogger.Info(\"%s\", err)\n\t\t\t}\n\t\t}\n\t\treturn incidents, err\n\tcase \"priorities\":\n\t\tvar priorities ps.Priorities\n\t\tif err := json.Unmarshal(body, &priorities); err != nil {\n\t\t\tlogger.Info(\"%s\", err)\n\t\t}\n\t\treturn priorities, err\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported entity\")\n\t}\n\n}", "title": "" }, { "docid": "b5214bff3b952435131093bc17088241", "score": "0.53617024", "text": "func List(entityType string, args map[string]string) ([]byte, error) {\n\tURL, err := url.Parse(fmt.Sprintf(\"%s%s/\", HOST, checkEntity(entityType)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv := URL.Query()\n\tfor key, value := range args {\n\t\tv.Set(key, value)\n\t}\n\tURL.RawQuery = v.Encode()\n\n\tresp, err := makeRequest(\"GET\", URL.String(), nil)\n\n\treturn resp, err\n}", "title": "" }, { "docid": "165713d1b68bbcc14a2100c5f72edc2f", "score": "0.53457654", "text": "func (entityApi *EntityApi) List(options map[string]string) ([]byte, error) {\n\trequest := api.CcaRequest{\n\t\tMethod: api.GET,\n\t\tEndpoint: entityApi.buildEndpoint(),\n\t\tOptions: options,\n\t}\n\tresponse, err := entityApi.apiClient.Do(request)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if response.IsError() {\n\t\treturn nil, api.CcaErrorResponse(*response)\n\t}\n\treturn response.Data, nil\n}", "title": "" }, { "docid": "703831e2e237794d9367b2885a9501ca", "score": "0.52082556", "text": "func (p *proteusAPI) GetEntities(parentId int64, _type string, start int, count int) (*APIEntityArray, error) {\n\tα := struct {\n\t\tM OperationGetEntities `xml:\"tns:getEntities\"`\n\t}{\n\t\tOperationGetEntities{\n\t\t\t&parentId,\n\t\t\t&_type,\n\t\t\t&start,\n\t\t\t&count,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationGetEntitiesResponse `xml:\"getEntitiesResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"GetEntities\", α, &γ); err != nil {\n\t\treturn nil, err\n\t}\n\treturn γ.M.Return, nil\n}", "title": "" }, { "docid": "940e7fa1ccdb2c373abfa6f0f2ae8296", "score": "0.5188578", "text": "func (x EntityRestClient) ExecGetAllEntities() ([]model.EntityQuery, error) {\n\tvar data []model.EntityQuery\n\n\tu, m := x.MakeGetAllEntitiesURL()\n\n\tmsg := fmt.Sprintf(\"%s(%s %s): %s\", logMarker, m, u, \"ExecGetAllEntities\")\n\ttools.Debugln(msg)\n\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\terr = processError(msg, err)\n\t\treturn data, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&data)\n\tif err != nil {\n\t\terr = processError(msg, err)\n\t\treturn data, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "37e741b74330d1aa99316bb702924c57", "score": "0.5162469", "text": "func GetEntities(allData *ArticleData){\n\t\t\n\t\turlValues := url.Values{}\n\t\turlValues.Set(\"text\", allData.Content)\n\t\turlValues.Add(\"powered_by\", \"no\")\n\t\turlValues.Add(\"policy\", \"whitelist\")\n\t\turlValues.Add(\"confidence\", \"0.5\")\n\t\tstatus,data:=PostRequest(\"http://10.2.10.52:2222\",\"/rest/annotate\",urlValues,\"xml\")\n\t\tfmt.Println(\"status for entity request\", status)\n\n\t\tentitiesMap := make(map[string]int)\n\t\ttype wrapper struct{\n\t\t\t\tResource []Resource `xml:\"Resources>Resource\"`\n\t\t}\n\t\tvar temp wrapper\n\n\t\terr := xml.Unmarshal( data, &temp)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Entities xml Unmarshall Error:\", err)\n\t\t}\n\t\t//Need to remove duplicates and get Categories.Hence a map\n\t\tentities:=make([]EntityData,0,cap(temp.Resource))\n\n\t\tfor _,URI :=range temp.Resource{\n\n\t\t\t_, valuePresent := entitiesMap[URI.URI]\n\t\t\tif !valuePresent{\n\n\t\t\t\tsplit:=strings.Split(URI.URI,`/`) //Extract term from dbpedia URI\n\n\t\t\t\tentity:=split[len(split)-1]\n\t\t\t\tfmt.Println(\"entity is \"+entity)\n\t\t\t\tentitiesMap[URI.URI]+=1 // update the map so that we can ignore if it appears again\n\t\t\t\tentityData:=GetEntityInfo(entity,\"\")\n\t\t\t\tif len(entityData)>0{\n\t\t\t\t\tentities=append(entities,GetEntityInfo(entity,\"\")[0]) // the first entry\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tallData.Entities=entities\n\n\n}", "title": "" }, { "docid": "707c21bc831cdbdddfa6c7bb25bb6af7", "score": "0.51437396", "text": "func (c *HTTPKubeletClient) getEntity(host, path, query string, entity runtime.Object) (*http.Response, error) {\n\trequest, err := http.NewRequest(\"GET\", c.url(host, path, query), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := c.Client.Do(request)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tdefer response.Body.Close()\n\tif response.StatusCode >= 300 || response.StatusCode < 200 {\n\t\treturn response, fmt.Errorf(\"kubelet %q server responded with HTTP error code %d\", host, response.StatusCode)\n\t}\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\terr = latest.Codec.DecodeInto(body, entity)\n\treturn response, err\n}", "title": "" }, { "docid": "684bfc7fba4c9de98534c817f442e2a6", "score": "0.51378185", "text": "func fetch(ctx context.Context, endpoint string) []byte {\n\tclient := ctx.Value(\"apiClient\").(*oauth.Client)\n\n\tresp, err := client.Get(fmt.Sprint(URL, endpoint))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == 200 {\n\t\treturn body\n\t} else {\n\t\tpanic(fmt.Sprintf(\"The API responded with a bad status code (%d): %s\", resp.StatusCode, string(body)))\n\t}\n}", "title": "" }, { "docid": "ea26ebe5e348f9c291b52ffe5a3e46d8", "score": "0.5110393", "text": "func main() {\n\tvar urlEdit bytes.Buffer\n\n\tfor _, url := range os.Args[1:] {\n\t\tif !strings.HasPrefix(url, \"http://\") {\n\t\t\tif !strings.HasPrefix(url, \"https://\") {\n\t\t\t\turlEdit.WriteString(\"http://\")\n\t\t\t}\n\t\t}\n\t\turlEdit.WriteString(url)\n\t\tresp, err := http.Get(urlEdit.String())\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"fetch: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t_, err = io.Copy(os.Stdout, resp.Body)\n\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"fetch: reading %s: %v\\n\", url, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6d183020fc77c029ff8884ceb4db41e4", "score": "0.50964016", "text": "func (a *EntitiesApiService) ListHosts(ctx _context.Context, localVarOptionals *ListHostsOpts) (PagedListResponseWithTime, *_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 PagedListResponseWithTime\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/hosts\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Size.IsSet() {\n\t\tlocalVarQueryParams.Add(\"size\", parameterToString(localVarOptionals.Size.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Cursor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cursor\", parameterToString(localVarOptionals.Cursor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.StartTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"start_time\", parameterToString(localVarOptionals.StartTime.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EndTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"end_time\", parameterToString(localVarOptionals.EndTime.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\", \"results\", \"cursor\", \"total_count\", \"start_time\", \"end_time\"}\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 PagedListResponseWithTime\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": "3edbec82635585302ec570752a9712a6", "score": "0.5058433", "text": "func (a *client) Incidents(params Parameters) (structs.PaginatedIncidents, error) {\n\tif params == nil {\n\t\tparams = make(Parameters)\n\t} else {\n\t\tparams = copyParams(params)\n\t}\n\n\tparams.Set(\"access_token\", a.oauth.AccessToken)\n\tresult := <-a.handler.addRequest(a.base_url+incidents, params)\n\tif result.err != nil {\n\t\treturn structs.PaginatedIncidents{}, result.err\n\t}\n\n\ttarget := structs.PaginatedIncidents{}\n\terr := json.Unmarshal(result.body, &target)\n\treturn target, err\n}", "title": "" }, { "docid": "4796331376d7cc3a2e6401942fbedca5", "score": "0.49936378", "text": "func (cm *Command) get(c *cli.Context, entityType string, getEntity func(id string) error) error {\n\targs, err := extractArgs(c.Args(), \"NAME\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tids, err := cm.Resolver.Resolve(entityType, args[\"NAME\"])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, id := range ids {\n\t\tif err := getEntity(id); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5da820b4255a773378973ad88caa3f61", "score": "0.49761143", "text": "func GetEntityInfo(name string,entityType string) ([]EntityData){\n\n\tvalues:=url.Values{\"QueryClass\":{entityType},\"QueryString\":{name}};\n \n\t _,result:=GetRequest(\"http://localhost:1111\",\"/api/search/KeywordSearch/\" ,values)\n\n\ttemp := EntityDataList{}\n\t\n\txml.Unmarshal(result,&temp)\n\n\tfor i,entityData:= range temp.EntityDataSlice{\n\t\tentityData.Classes=CleanClasses(entityData.Classes)\n\t\ttemp.EntityDataSlice[i]=entityData\n\t}\n\treturn temp.EntityDataSlice\n\t\n\n}", "title": "" }, { "docid": "5d93f27c9a3c45eacf5b88b892b02762", "score": "0.49633035", "text": "func serveExternalServicesList(db dbutil.DB) func(w http.ResponseWriter, r *http.Request) error {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tvar req api.ExternalServicesListRequest\n\t\terr := json.NewDecoder(r.Body).Decode(&req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(req.Kinds) == 0 {\n\t\t\treq.Kinds = append(req.Kinds, req.Kind)\n\t\t}\n\n\t\toptions := database.ExternalServicesListOptions{\n\t\t\tKinds: []string{req.Kind},\n\t\t\tAfterID: int64(req.AfterID),\n\t\t}\n\t\tif req.Limit > 0 {\n\t\t\toptions.LimitOffset = &database.LimitOffset{\n\t\t\t\tLimit: req.Limit,\n\t\t\t}\n\t\t}\n\n\t\tservices, err := database.ExternalServices(db).List(r.Context(), options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn json.NewEncoder(w).Encode(services)\n\t}\n}", "title": "" }, { "docid": "ea6c9ebe51fb95037e3171d12a941d98", "score": "0.49624893", "text": "func Entities(ctx context.Context, client *datastore.Client, kind string) ([]*datastore.Key, []datastore.PropertyList, error) {\n\tquery := datastore.NewQuery(kind)\n\tvar dst []datastore.PropertyList\n\tkeys, err := client.GetAll(ctx, query, &dst)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn keys, dst, err\n}", "title": "" }, { "docid": "22b8eb9613af07124ff9430b4745e5ad", "score": "0.4960948", "text": "func (api *API) getEntitiesHandler(c echo.Context) error {\n\tif err := validateParams(c, false); err != nil {\n\t\treturn handleError(err)\n\t}\n\tentityType := c.Param(\"type\")\n\n\t// Translate URL query to query struct.\n\trequestLabelSelector := c.QueryParam(\"query\")\n\tif requestLabelSelector == \"\" {\n\t\treturn handleError(ErrInvalidQuery.New(\"query string is empty\"))\n\t}\n\n\tq, err := query.Translate(requestLabelSelector)\n\tif err != nil {\n\t\treturn handleError(ErrInvalidQuery.New(\"invalid query: %s\", err))\n\t}\n\n\t// Query Filter\n\tf := etre.QueryFilter{}\n\tcsvReturnLabels := c.QueryParam(\"labels\")\n\tif csvReturnLabels != \"\" {\n\t\tf.ReturnLabels = strings.Split(csvReturnLabels, \",\")\n\t}\n\n\tentities, err := api.es.ReadEntities(entityType, q, f)\n\tif err != nil {\n\t\treturn handleError(ErrDb.New(\"database error: %s\", err))\n\t}\n\n\treturn c.JSON(http.StatusOK, entities)\n}", "title": "" }, { "docid": "9a4d942ba8931d0b04014c9019174151", "score": "0.49331856", "text": "func (x EntityRestClient) ExecGetEntity(id int) (*model.EntityQuery, error) {\n\tvar data *model.EntityQuery\n\n\tu, m := x.MakeGetEntityURL(id)\n\n\tmsg := fmt.Sprintf(\"%s(%s %s): %s\", logMarker, m, u, \"ExecGetEntity\")\n\ttools.Debugln(msg)\n\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\terr = processError(msg, err)\n\t\treturn data, err\n\t}\n\tdefer resp.Body.Close()\n\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&data)\n\tif err != nil {\n\t\terr = processError(msg, err)\n\t\treturn data, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "0080e959b7720bcd3473728e08c12ae0", "score": "0.49292254", "text": "func (p *proteusAPI) GetLinkedEntities(entityId int64, _type string, start int, count int) (*APIEntityArray, error) {\n\tα := struct {\n\t\tM OperationGetLinkedEntities `xml:\"tns:getLinkedEntities\"`\n\t}{\n\t\tOperationGetLinkedEntities{\n\t\t\t&entityId,\n\t\t\t&_type,\n\t\t\t&start,\n\t\t\t&count,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationGetLinkedEntitiesResponse `xml:\"getLinkedEntitiesResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"GetLinkedEntities\", α, &γ); err != nil {\n\t\treturn nil, err\n\t}\n\treturn γ.M.Return, nil\n}", "title": "" }, { "docid": "16b4b27be380e61c0953dca03e168762", "score": "0.48829943", "text": "func ListEntities(w http.ResponseWriter, r *http.Request) {\n\tres, err := dal.GetAllEntitites(\"\")\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\tcommon.WriteResponse(w, res)\n}", "title": "" }, { "docid": "b895ddf9c6832e58164ea18153f3b328", "score": "0.4878823", "text": "func (a *Client) GetAllUsingGET(params *GetAllUsingGETParams, opts ...ClientOption) (*GetAllUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAllUsingGETParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getAllUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/codestream/api/registry-events\",\n\t\tProducesMediaTypes: []string{\"*/*\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAllUsingGETReader{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.(*GetAllUsingGETOK)\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: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "bc675fe7c719fa9714a4964c4a0eb21d", "score": "0.48718688", "text": "func getAuthors(w http.ResponseWriter, r *http.Request) {\n\tsetHeaders(w, r, host)\n\tapiKey := os.Getenv(\"GBOOKS_API_KEY\")\n\tauthor := parseAuthor(r)\n\tfor _, n := range author {\n\t\tgo func(n string) {\n\t\t\tgetSingleAuthor(apiKey, n)\n\t\t}(n)\n\t}\n}", "title": "" }, { "docid": "2d63dc39fb8cc5c6d2c440edd539583b", "score": "0.4861464", "text": "func getListObjectsV1URL(endPoint, bucketName string, maxKeys string) string {\n\tqueryValue := url.Values{}\n\tif maxKeys != \"\" {\n\t\tqueryValue.Set(\"max-keys\", maxKeys)\n\t}\n\treturn makeTestTargetURL(endPoint, bucketName, \"\", queryValue)\n}", "title": "" }, { "docid": "1514679fc0b61a2f306adce087cf0e30", "score": "0.4846501", "text": "func infrastructure(client *http.Client, url string) ([]byte, error) {\r\n\treq, err := http.NewRequest(\"GET\", url, nil)\r\n\tresp, err := client.Do(req)\r\n\tif err != nil {\r\n\t\treturn nil, fmt.Errorf(\"client req error: \" + err.Error())\r\n\t} else {\r\n\t\tresponseBody, err := ioutil.ReadAll(resp.Body)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, fmt.Errorf(\"body read error: \" + err.Error())\r\n\t\t} else {\r\n\t\t\treturn responseBody, err\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "cd7bd4fb545f9012949c278e60f30232", "score": "0.4840636", "text": "func getListObjectsV2URL(endPoint, bucketName string, maxKeys string, fetchOwner string) string {\n\tqueryValue := url.Values{}\n\tqueryValue.Set(\"list-type\", \"2\") // Enables list objects V2 URL.\n\tif maxKeys != \"\" {\n\t\tqueryValue.Set(\"max-keys\", maxKeys)\n\t}\n\tif fetchOwner != \"\" {\n\t\tqueryValue.Set(\"fetch-owner\", fetchOwner)\n\t}\n\treturn makeTestTargetURL(endPoint, bucketName, \"\", queryValue)\n}", "title": "" }, { "docid": "ffbc8a8ad61f4aec4d528c21af13497d", "score": "0.48353562", "text": "func (a *EntitiesApiService) ListVnics(ctx _context.Context, localVarOptionals *ListVnicsOpts) (PagedListResponseWithTime, *_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 PagedListResponseWithTime\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/vnics\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Size.IsSet() {\n\t\tlocalVarQueryParams.Add(\"size\", parameterToString(localVarOptionals.Size.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Cursor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cursor\", parameterToString(localVarOptionals.Cursor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.StartTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"start_time\", parameterToString(localVarOptionals.StartTime.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EndTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"end_time\", parameterToString(localVarOptionals.EndTime.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\", \"results\", \"cursor\", \"total_count\", \"start_time\", \"end_time\"}\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 PagedListResponseWithTime\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": "222d03e048382b575bb0e6b3d349389e", "score": "0.48310605", "text": "func GetEntriesEndpoint(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Println(\"Get All Entries:\")\n\tjson.NewEncoder(w).Encode(issues)\n}", "title": "" }, { "docid": "55cbb730a63f9ba2810465ed5dade931", "score": "0.4829523", "text": "func listURL(client *golangsdk.ServiceClient) string {\n\treturn client.ServiceURL(\"flavors\")\n}", "title": "" }, { "docid": "e9199eea85ad96ef3d8018366f32f34e", "score": "0.48255646", "text": "func (r *RestService) List(relativeURL string, offset int64, limit int64) ([]byte, error) {\n\tqueryParams := fmt.Sprintf(\"?offset=%v&limit=%v\", offset, limit)\n\tfullURL := *r.Bitmovin.APIBaseURL + relativeURL + queryParams\n\n\treq, err := http.NewRequest(\"GET\", fullURL, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Api-Key\", *r.Bitmovin.APIKey)\n\tif r.Bitmovin.OrganizationID != nil {\n\t\treq.Header.Set(\"X-Tenant-Org-Id\", *r.Bitmovin.OrganizationID)\n\t}\n\treq.Header.Set(\"X-Api-Client\", ClientName)\n\treq.Header.Set(\"X-Api-Client-Version\", Version)\n\tif os.Getenv(\"DUMP_TRAFFIC\") != \"\" {\n\t\tb, _ := httputil.DumpRequest(req, true)\n\t\tprintln(string(b))\n\t}\n\tresp, err := r.Bitmovin.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif os.Getenv(\"DUMP_TRAFFIC\") != \"\" {\n\t\tb, _ := httputil.DumpResponse(resp, true)\n\t\tprintln(string(b))\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "4963f0b238f9fa1e24c46a540a3cfe92", "score": "0.48187906", "text": "func FetchAttestations(imageRef string, key string, repository string, log logr.Logger) ([]map[string]interface{}, error) {\n\tctx := context.Background()\n\tvar pubKey signature.Verifier\n\tvar err error\n\n\tif strings.HasPrefix(key, \"-----BEGIN PUBLIC KEY-----\") {\n\t\tpubKey, err = decodePEM([]byte(key))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"decode pem\")\n\t\t}\n\t} else {\n\t\tpubKey, err = sigs.PublicKeyFromKeyRef(ctx, key)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"loading public key\")\n\t\t}\n\t}\n\n\tvar opts []remote.Option\n\tro := options.RegistryOptions{}\n\n\topts, err = ro.ClientOpts(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"constructing client options\")\n\t}\n\n\tif repository != \"\" {\n\t\tsignatureRepo, err := name.NewRepository(repository)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to parse signature repository %s\", repository)\n\t\t}\n\t\topts = append(opts, remote.WithTargetRepository(signatureRepo))\n\t}\n\n\tcosignOpts := &cosign.CheckOpts{\n\t\tClaimVerifier: cosign.IntotoSubjectClaimVerifier,\n\t\tSigVerifier: pubKey,\n\t\tRegistryClientOpts: opts,\n\t}\n\n\tref, err := name.ParseReference(imageRef)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse image\")\n\t}\n\n\tverified, _, err := client.Verify(context.Background(), ref, cosign.AttestationsAccessor, cosignOpts)\n\tif err != nil {\n\t\tmsg := err.Error()\n\t\tlog.Info(\"failed to fetch attestations\", \"error\", msg)\n\t\tif strings.Contains(msg, \"MANIFEST_UNKNOWN: manifest unknown\") {\n\t\t\treturn nil, fmt.Errorf(\"not found\")\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\tinTotoStatements, err := decodeStatements(verified)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn inTotoStatements, nil\n}", "title": "" }, { "docid": "d47b4735a3944d5818214d73a33dd65d", "score": "0.48112953", "text": "func (x EntityRestClient) MakeGetEntityURL(id int) (path string, method string) {\n\tpath = x.makeURLWithID(ESvcMainPathURL, id)\n\tmethod = http.MethodGet\n\treturn\n}", "title": "" }, { "docid": "1c3af9e4a6c7bf5b86ecd1bc4765197c", "score": "0.4782958", "text": "func getEmbeddings(w http.ResponseWriter, req *http.Request) {\n\tenableCors(&w)\n\n\tvar response GetEmbeddingsResponse\n\tresponse = GetEmbeddingsResponse{200, embeddingQuery.AllProjPoints}\n\tresponseJSON, _ := json.Marshal(response)\n\tw.Write(responseJSON)\n}", "title": "" }, { "docid": "036c382a6d2c8bda9c9d9523930872c5", "score": "0.47610176", "text": "func TestIntegrationGetEntity_BrowserEntityOutline(t *testing.T) {\n\tt.Parallel()\n\n\tclient := newIntegrationTestClient(t)\n\n\tactual, err := client.GetEntity(\"MjUwODI1OXxCUk9XU0VSfEFQUExJQ0FUSU9OfDIwNDI2MTYyOA\")\n\n\trequire.NoError(t, err)\n\trequire.NotNil(t, actual)\n\n\t// These are a bit fragile, if the above GUID ever changes...\n\t// from BrowserApplicationEntity / BrowserApplicationEntityOutline\n\tassert.Equal(t, 204261628, *actual.ApplicationID)\n\tassert.Equal(t, 204261368, *actual.ServingApmApplicationID)\n\tassert.Equal(t, EntityAlertSeverityType(\"NOT_CONFIGURED\"), *actual.AlertSeverity)\n\n}", "title": "" }, { "docid": "71ef812e4263564aa502f0a5435e0a30", "score": "0.47446913", "text": "func main() {\n\tfor _, url := range os.Args[1:] {\n\t\tresp, err := http.Get(url)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"get %s fail, err: %v\", url, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t_, copyErr := io.Copy(os.Stdout, resp.Body)\n\t\tresp.Body.Close()\n\t\tif copyErr != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"io.Copy err: %v\", copyErr)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95a66b287b2e1f6ec3f547f8ece783d2", "score": "0.47393075", "text": "func (nc *NGSI10Client) QueryForNGSIV1Entity(eid string) int {\n\treq, _ := http.NewRequest(\"GET\", nc.IoTBrokerURL+\"/entity/\"+eid, nil)\n\tclient := nc.SecurityCfg.GetHTTPClient()\n\tresp, _ := client.Do(req)\n\treturn resp.StatusCode\n\n}", "title": "" }, { "docid": "10516366d1cc4ba3b38d8a05f78d5eb3", "score": "0.4736998", "text": "func queryContext(id string, IoTBrokerURL string) (map[string]interface{}, error) {\n\treq, _ := http.NewRequest(\"GET\", IoTBrokerURL+\"/ngsi-ld/v1/entities/\"+id, nil)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/ld+json\")\n\treq.Header.Add(\"Link\", \"<https://fiware.github.io/data-models/context.jsonld>; rel=\\\"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld\\\"; type=\\\"application/ld+json\\\"\")\n\tres, err := http.DefaultClient.Do(req)\n\tfmt.Println(res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar reqData interface{}\n\terr = json.Unmarshal(data, &reqData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\titemsMap := reqData.(map[string]interface{})\n\tfmt.Println(itemsMap)\n\tres.Body.Close()\n\treturn itemsMap, err\n}", "title": "" }, { "docid": "cb348bb7d9337afa9ea1c16e937023d0", "score": "0.47361982", "text": "func retreiveList(person Person) Response {\n\t//Download filter list\n\n\tfilterAuth := `{\"auth\": {\"userid\": \"` + person.Username + `\",\"password\": \"` + person.Password + `\"}}`\n\t// fmt.Println(filterAuth)\n\tfilterEndpoint := \"http://www.botsifter.com/api/getFilterList\"\n\tauth := bytes.NewBuffer([]byte(filterAuth))\n\tr, _ := http.Post(filterEndpoint, \"application/json\", auth)\n\tresponse, _ := ioutil.ReadAll(r.Body)\n\tvar resp Response\n\tjson.Unmarshal(response, &resp)\n\t// log.Printf(\"%#v\", resp)\n\treturn resp\n}", "title": "" }, { "docid": "a161b1c54ba78263c35c39aaa3192ca3", "score": "0.47348812", "text": "func (a *EntitiesApiService) ListClusters(ctx _context.Context, localVarOptionals *ListClustersOpts) (PagedListResponseWithTime, *_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 PagedListResponseWithTime\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/clusters\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Size.IsSet() {\n\t\tlocalVarQueryParams.Add(\"size\", parameterToString(localVarOptionals.Size.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Cursor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cursor\", parameterToString(localVarOptionals.Cursor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.StartTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"start_time\", parameterToString(localVarOptionals.StartTime.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EndTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"end_time\", parameterToString(localVarOptionals.EndTime.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\", \"results\", \"cursor\", \"total_count\", \"start_time\", \"end_time\"}\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 PagedListResponseWithTime\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": "da0bd9927aa97f130a7fa2c260791898", "score": "0.4730186", "text": "func (p *proteusAPI) GetEntitiesByName(parentId int64, name string, _type string, start int, count int) (*APIEntityArray, error) {\n\tα := struct {\n\t\tM OperationGetEntitiesByName `xml:\"tns:getEntitiesByName\"`\n\t}{\n\t\tOperationGetEntitiesByName{\n\t\t\t&parentId,\n\t\t\t&name,\n\t\t\t&_type,\n\t\t\t&start,\n\t\t\t&count,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationGetEntitiesByNameResponse `xml:\"getEntitiesByNameResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"GetEntitiesByName\", α, &γ); err != nil {\n\t\treturn nil, err\n\t}\n\treturn γ.M.Return, nil\n}", "title": "" }, { "docid": "3cb82d12ba32cc04a7713286c78d5a51", "score": "0.47194186", "text": "func (c *Client) List(ctx context.Context, url string, params interface{}, result interface{}) (*Response, error) {\n\n\tu, err := c.AddOptions(url, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := c.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Do(ctx, req, &result)\n}", "title": "" }, { "docid": "b56033aade5908140c7ed17c13080e26", "score": "0.4709901", "text": "func (s *ZapiSession) getForEntity(e interface{}, path ...string) error {\n\treq := &APIRequest{\n\t\tMethod: \"get\",\n\t\tURL: s.iControlPath(path),\n\t\tContentType: \"application/json\",\n\t}\n\n\tresp, err := s.apiCall(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(resp, e)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "66785b04238b32f38e58cb17c62264fa", "score": "0.47096577", "text": "func (cc *HelloWorld) list(stub shim.ChaincodeStubInterface) peer.Response {\n\n\tstartKey := \"\"\n\tendKey := \"\"\n\n\t// Get list of ID\n\tresultsIterator, err := stub.GetStateByRange(startKey, endKey)\n\tif err != nil {\n\t\treturn Error(http.StatusNotFound, \"Not Found\")\n\t}\n\tdefer resultsIterator.Close()\n\n\t// Write return buffer\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \\\"values\\\": [\")\n\tfor resultsIterator.HasNext() {\n\t\tit, _ := resultsIterator.Next()\n\t\tif buffer.Len() > 15 {\n\t\t\tbuffer.WriteString(\",\")\n\t\t}\n\t\tbuffer.WriteString(\"{\\\"id\\\":\\\"\")\n\t\tbuffer.WriteString(it.Key)\n\t\tbuffer.WriteString(\"\\\"}\")\n\n\n\t}\n\tbuffer.WriteString(\"]}\")\n\n\treturn Success(200, \"OK\", buffer.Bytes())\n}", "title": "" }, { "docid": "ac26924e48a5ddc72b17ec47ce3371b8", "score": "0.47090513", "text": "func Test_GET_Offer_List(t *testing.T) {\n\tdata := []Offer{\n\t\t{\n\t\t\tName: \"test3\",\n\t\t\tDescription: \"Offre gratuite!\",\n\t\t\tTags: []tag.Tag{\n\t\t\t\t{\n\t\t\t\t\tName: \"Tag1\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"test2\",\n\t\t\tDescription: \"120 euros\",\n\t\t\tTags: []tag.Tag{\n\t\t\t\t{\n\t\t\t\t\tName: \"Payant\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"test1\",\n\t\t\tDescription: \"10 euros\",\n\t\t\tTags: []tag.Tag{\n\t\t\t\t{\n\t\t\t\t\tName: \"Minimum\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, val := range data {\n\t\ttester.Create(urlOne, &val, nil)\n\t}\n\n\tvar all []Offer\n\tresp, err := tester.Retrieve(urlList+\"?orderBy=name\", &all)\n\tutils.AssertEqual(t, nil, err, \"app.Test\")\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode, \"Status code\")\n\tutils.AssertEqual(t, len(data), len(all))\n\tutils.AssertEqual(t, \"test1\", all[0].Name)\n\n\tvar results []Offer\n\tresp, err = tester.Retrieve(urlList+\"?toFind=euros\", &results)\n\tutils.AssertEqual(t, nil, err, \"app.Test\")\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode, \"Status code\")\n\tutils.AssertEqual(t, 2, len(results))\n\n\tvar found []Offer\n\tresp, err = tester.Retrieve(urlList+\"?tofind=grat\", &found)\n\tutils.AssertEqual(t, nil, err, \"app.Test\")\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode, \"Status code\")\n\tutils.AssertEqual(t, 1, len(found), \"Size\")\n\n\tvar limit []Offer\n\tresp, err = tester.Retrieve(urlList+\"?limit=2&offset=1\", &limit)\n\tutils.AssertEqual(t, nil, err, \"app.Test\")\n\tutils.AssertEqual(t, fiber.StatusOK, resp.StatusCode, \"Status code\")\n\tutils.AssertEqual(t, 2, len(limit), \"Size\")\n}", "title": "" }, { "docid": "b40197e5cc554d835c3c2cf5063d0f9b", "score": "0.47086352", "text": "func List(cmd *cli.Cmd) {\n\tprovider := cmd.String(cli.StringOpt{\n\t\tName: \"provider\",\n\t\tDesc: \"Cloud provider(i.e. amazon)\",\n\t\tHideValue: true,\n\t})\n\n\tidentifier := cmd.String(cli.StringOpt{\n\t\tName: \"identifier\",\n\t\tDesc: \"Cloud provider specific region/zone/etc identifier (i.e. us-east-1)\",\n\t\tHideValue: true,\n\t})\n\n\tcmd.Action = func() {\n\t\tl := location.Location{\n\t\t\tProvider: *provider,\n\t\t\tRegion: *identifier,\n\t\t}\n\n\t\tbody, errs := l.Find()\n\n\t\tif len(errs) > 0 {\n\t\t\tlog.Fatalf(\"Could not retrieve locations: %s\", errs[0])\n\t\t}\n\n\t\tlocations := &[]location.Location{}\n\t\terr := json.Unmarshal([]byte(body), locations)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tPrintLocationBrief(*locations)\n\t}\n}", "title": "" }, { "docid": "23715da8ea2d9e293a076e2affb57701", "score": "0.47037756", "text": "func (a *EntitiesApiService) BulkFetchVendorInfo(ctx _context.Context, localVarOptionals *BulkFetchVendorInfoOpts) (DetailedVendorInfoResponse, *_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 DetailedVendorInfoResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/vendor-infos/fetch\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.Body.IsSet() {\n\t\tlocalVarOptionalBody, localVarOptionalBodyok := localVarOptionals.Body.Value().(FetchRequest)\n\t\tif !localVarOptionalBodyok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"body should be FetchRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalBody\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v DetailedVendorInfoResponse\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": "2ecaa0c506c561597869c0236db312d2", "score": "0.46904764", "text": "func setHostAsOpensearchInResponse(response []models.CheckTriggerResponse, osExternalUrl string) []models.CheckTriggerResponse {\n\tfor i := range response {\n\t\tresponse[i].Host = osExternalUrl\n\n\t}\n\n\treturn response\n}", "title": "" }, { "docid": "f7563ec292c34f38c45fa8d1bab5c99e", "score": "0.46845487", "text": "func (s *Store) GetEntities(ctx context.Context, pred *store.SelectionPredicate) ([]*corev2.Entity, error) {\n\tv2store := etcdstore.NewStore(s.client)\n\tnamespace := corev2.ContextNamespace(ctx)\n\tstateReq := storev2.ResourceRequest{\n\t\tNamespace: namespace,\n\t\tContext: ctx,\n\t\tStoreName: new(corev3.EntityState).StoreName(),\n\t}\n\tconfigReq := storev2.ResourceRequest{\n\t\tNamespace: namespace,\n\t\tContext: ctx,\n\t\tStoreName: new(corev3.EntityConfig).StoreName(),\n\t}\n\tstatePred := new(store.SelectionPredicate)\n\tconfigPred := new(store.SelectionPredicate)\n\tif pred != nil {\n\t\tif pred.Limit != 0 {\n\t\t\tstatePred.Limit = pred.Limit\n\t\t\tconfigPred.Limit = pred.Limit\n\t\t}\n\t\tif pred.Continue != \"\" {\n\t\t\tvar token entityContinueToken\n\t\t\tif err := json.Unmarshal([]byte(pred.Continue), &token); err != nil {\n\t\t\t\treturn nil, &store.ErrNotValid{Err: err}\n\t\t\t}\n\t\t\tstatePred.Continue = string(token.StateContinue)\n\t\t\tconfigPred.Continue = string(token.ConfigContinue)\n\t\t}\n\t}\n\tstateList, err := v2store.List(stateReq, statePred)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfigList, err := v2store.List(configReq, configPred)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif pred != nil {\n\t\tvar token entityContinueToken\n\t\ttoken.ConfigContinue = []byte(configPred.Continue)\n\t\ttoken.StateContinue = []byte(statePred.Continue)\n\t\tb, _ := json.Marshal(token)\n\t\tcont := string(b)\n\t\tif cont == \"{}\" {\n\t\t\tcont = \"\"\n\t\t}\n\t\tpred.Continue = cont\n\t}\n\tstates := make([]corev3.EntityState, stateList.Len())\n\tif err := stateList.UnwrapInto(&states); err != nil {\n\t\treturn nil, &store.ErrDecode{Err: err, Key: etcdstore.StoreKey(stateReq)}\n\t}\n\tconfigs := make([]corev3.EntityConfig, configList.Len())\n\tif err := configList.UnwrapInto(&configs); err != nil {\n\t\treturn nil, &store.ErrDecode{Err: err, Key: etcdstore.StoreKey(configReq)}\n\t}\n\treturn entitiesFromConfigAndState(configs, states)\n}", "title": "" }, { "docid": "befe8579437912c498096b5c09180d0b", "score": "0.46840468", "text": "func (a *EntitiesApiService) ListVms(ctx _context.Context, localVarOptionals *ListVmsOpts) (PagedListResponseWithTime, *_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 PagedListResponseWithTime\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/vms\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Size.IsSet() {\n\t\tlocalVarQueryParams.Add(\"size\", parameterToString(localVarOptionals.Size.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Cursor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cursor\", parameterToString(localVarOptionals.Cursor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.StartTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"start_time\", parameterToString(localVarOptionals.StartTime.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EndTime.IsSet() {\n\t\tlocalVarQueryParams.Add(\"end_time\", parameterToString(localVarOptionals.EndTime.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\", \"results\", \"cursor\", \"total_count\", \"start_time\", \"end_time\"}\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 PagedListResponseWithTime\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": "4a96b43f0cfbea5bf2d33e133cf1c229", "score": "0.46824092", "text": "func (ms MongoStore) getAllEntities(c context.Context, kind string, integrationName string) (*mongo.Cursor, error) {\n\tctx, cancel := context.WithTimeout(c, time.Second*1)\n\tdefer cancel()\n\n\tcollection := ms.DataBase.Collection(entityCollection)\n\n\tfilter := bson.D{}\n\n\tif kind != \"\" {\n\t\tfilter = append(filter, bson.E{Key: \"mutation\", Value: kind})\n\t}\n\tif integrationName != \"\" {\n\t\tfilter = append(filter, bson.E{Key: \"integrationname\", Value: integrationName})\n\t}\n\n\t// Get all entity\n\tcursor, err := collection.Find(ctx, filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cursor, nil\n}", "title": "" }, { "docid": "912661743b81e89c15072392e556effc", "score": "0.4674902", "text": "func (t *targetrunner) lookupRemoteAll(lom *cluster.LOM, smap *smapX) *cluster.Snode {\n\tquery := make(url.Values)\n\tquery.Add(cmn.URLParamSilent, \"true\")\n\tquery.Add(cmn.URLParamCheckExistsAny, \"true\") // lookup all mountpaths _and_ copy if misplaced\n\tres := t.bcastTo(bcastArgs{\n\t\treq: cmn.ReqArgs{\n\t\t\tMethod: http.MethodHead,\n\t\t\tPath: cmn.URLPath(cmn.Version, cmn.Objects, lom.BckName(), lom.ObjName),\n\t\t\tQuery: query,\n\t\t},\n\t\tsmap: smap,\n\t})\n\tfor r := range res {\n\t\tif r.err == nil {\n\t\t\treturn r.si\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b012bcf7f4371a09fa20a068208cfc95", "score": "0.4673395", "text": "func TenantGetList(w http.ResponseWriter, r *http.Request) {\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n}", "title": "" }, { "docid": "d9fbc8beabe20ef70c3947a8b253f020", "score": "0.4671463", "text": "func (p *proteusAPI) GetLinkedEntitiesEx(getLinkedEntitiesJson string) (string, error) {\n\tα := struct {\n\t\tM OperationGetLinkedEntitiesEx `xml:\"tns:getLinkedEntitiesEx\"`\n\t}{\n\t\tOperationGetLinkedEntitiesEx{\n\t\t\t&getLinkedEntitiesJson,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationGetLinkedEntitiesExResponse `xml:\"getLinkedEntitiesExResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"GetLinkedEntitiesEx\", α, &γ); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn *γ.M.Return, nil\n}", "title": "" }, { "docid": "e65842d07c9b90202565fa573905a677", "score": "0.4669175", "text": "func getRequest() ([]wayurl, error) {\n\tresp, err := http.Get( \"http://web.archive.org/cdx/search/cdx?url=*.tevora.com/*&output=json&fl=original&collapse=urlkey\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error getting response. \", err)\n\t}\n\t/*client := &http.Client{Timeout: time.Second * 5}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"Error reading response. \", err)\n\t} */\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog .Fatal(\"Error reading body. \", err)\n\t}\n\n\t// create mother of all slices to hold slices.\n\tvar wrap [][]string\n\terr = json.Unmarshal(body, &wrap)\n\t// create array with size of response len. Refers to OG wayurl struct.\n\tout := make([]wayurl, 0, len(wrap))\n\tfor _, urls := range wrap {\n\t\tout = append(out, wayurl{url: urls[0]})\n\t}\n\tfmt.Printf(\"%s\\n\", out)\n\n\treturn out, nil\n}", "title": "" }, { "docid": "dda282409763fa956e86e371e28466c7", "score": "0.46666056", "text": "func (a *HttpArticleHandler) GetAll(c echo.Context) error {\n\n\tnumS := c.QueryParam(\"num\")\n\tnum, _ := strconv.Atoi(numS)\n\tcursor := c.QueryParam(\"cursor\")\n\tctx := c.Request().Context()\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\tlistAr, nextCursor, err := a.AUsecase.GetAll(ctx, cursor, int64(num))\n\n\t//reqId := uuid.NewV4().String()\n\tvar response = &models.BaseResponse{\n\t\tRequestID: \"\",\n\t\tNow: time.Now().Unix(),\n\t}\n\n\tif err != nil {\n\t\tresponse.Code = getStatusCode(err)\n\t\tresponse.Message = err.Error()\n\t\tresponse.Data = listAr\n\t\treturn c.JSON(getStatusCode(err), response)\n\t}\n\n\tif len(*listAr) > 0 {\n\t\tresponse.Message = models.DATA_AVAILABLE_SUCCESS\n\t} else {\n\t\tresponse.Message = models.DATA_EMPTY_SUCCESS\n\t}\n\n\tresponse.Code = http.StatusOK\n\tresponse.Data = listAr\n\n\tc.Response().Header().Set(`X-Cursor`, nextCursor)\n\n\tbuffer := new(bytes.Buffer)\n\n\tvar articles []string\n\tfor _, article := range *listAr {\n\t\tarticles = append(articles, article.Title)\n\t}\n\n\tgofiles.ArticleList(articles, buffer)\n\treturn c.HTMLBlob(response.Code, buffer.Bytes())\n\n\t//return c.JSON(response.Code, response)\n}", "title": "" }, { "docid": "b9240c2a97fbdf17b249273ad73763ce", "score": "0.4665672", "text": "func Curl(cli plugin.CliConnection, path string) (map[string]interface{}, error) {\n\toutput, err := cli.CliCommandWithoutTerminalOutput(\"curl\", path)\n\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn parseOutput(output)\n}", "title": "" }, { "docid": "95049fe70efd782b171103799f68d6a4", "score": "0.4660852", "text": "func requestCredList(client *http.Client, endpoint string) ([]string, error) {\n\tu, err := url.Parse(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.Path = iamSecurityCredsPath\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.New(resp.Status)\n\t}\n\n\tcredsList := []string{}\n\ts := bufio.NewScanner(resp.Body)\n\tfor s.Scan() {\n\t\tcredsList = append(credsList, s.Text())\n\t}\n\n\tif err := s.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn credsList, nil\n}", "title": "" }, { "docid": "6c472cee8112e231c62f1c968a4c35fa", "score": "0.46566728", "text": "func (p *proteusAPI) LinkEntitiesEx(linkEntitiesJson string) error {\n\tα := struct {\n\t\tM OperationLinkEntitiesEx `xml:\"tns:linkEntitiesEx\"`\n\t}{\n\t\tOperationLinkEntitiesEx{\n\t\t\t&linkEntitiesJson,\n\t\t},\n\t}\n\n\tγ := struct {\n\t\tM OperationLinkEntitiesExResponse `xml:\"linkEntitiesExResponse\"`\n\t}{}\n\tif err := p.cli.RoundTripWithAction(\"LinkEntitiesEx\", α, &γ); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf2a5a64ee1927082021b3b99836d812", "score": "0.46561235", "text": "func (r *showAllTagsInteractor) Execute(ctx context.Context, req InportRequest) (*InportResponse, error) {\n\n\tres := &InportResponse{}\n\n\terr := repository.ReadOnly(ctx, r.outport, func(ctx context.Context) error {\n\t\ttagObjs, err := r.outport.FetchTags(ctx)\n\n\t\tif err != nil {\n\t\t\treturn apperror.ObjectNotFound.Var(tagObjs)\n\t\t}\n\n\t\tfor _, v := range tagObjs {\n\t\t\tres.Tags = append(res.Tags, Tag{\n\t\t\t\tID: v.ID,\n\t\t\t\tTag: v.Tag,\n\t\t\t})\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "de7414d6bea68f0927a79cfc93106ca5", "score": "0.46558356", "text": "func (b *BigIP) getForEntity(e interface{}, path ...string) (error, bool) {\n\treq := &APIRequest{\n\t\tMethod: \"get\",\n\t\tURL: b.iControlPath(path),\n\t\tContentType: \"application/json\",\n\t}\n\n\tresp, err := b.APICall(req)\n\tif err != nil {\n\t\tvar reqError RequestError\n\t\tjson.Unmarshal(resp, &reqError)\n\t\tif reqError.Code == 404 {\n\t\t\treturn nil, false\n\t\t}\n\t\treturn err, false\n\t}\n\n\terr = json.Unmarshal(resp, e)\n\tif err != nil {\n\t\treturn err, false\n\t}\n\n\treturn nil, true\n}", "title": "" }, { "docid": "dafa051a478020d692e73cfd3e3c5cbc", "score": "0.46507147", "text": "func curl(init *SPH_UDF_INIT, args *SPH_UDF_ARGS, errf *ERR_FLAG) uintptr {\n\n\turl := args.stringval(0)\n\n\t// Get the data\n\tresp, _ := http.Get(url)\n\tdefer func() { _ = resp.Body.Close() }()\n\n\t// Check server response\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn args.return_string(fmt.Sprintf(\"Bad status: %s\", resp.Status))\n\t}\n\n\t// let's check content-type and avoid anything, but text\n\tcontentType := resp.Header.Get(\"Content-Type\")\n\tparts := strings.Split(contentType, \"/\")\n\tif len(parts) >= 1 && parts[0] == \"text\" {\n\t\t// retrieve whole body\n\t\ttext, _ := ioutil.ReadAll(resp.Body)\n\t\treturn args.return_string(string(text))\n\t}\n\n\treturn args.return_string(\"Content type: \" + contentType + \", will NOT download\")\n}", "title": "" }, { "docid": "82107a12917b9641285ae8946b21ecf7", "score": "0.46408364", "text": "func (a *HostsApiService) ApiHostGetHostTagsExecute(r ApiApiHostGetHostTagsRequest) (TagsOut, *_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 TagsOut\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HostsApiService.ApiHostGetHostTags\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/hosts/{host_id_list}/tags\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"host_id_list\"+\"}\", _neturl.PathEscape(parameterToString(r.hostIdList, \"csv\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.perPage != nil {\n\t\tlocalVarQueryParams.Add(\"per_page\", parameterToString(*r.perPage, \"\"))\n\t}\n\tif r.page != nil {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(*r.page, \"\"))\n\t}\n\tif r.orderBy != nil {\n\t\tlocalVarQueryParams.Add(\"order_by\", parameterToString(*r.orderBy, \"\"))\n\t}\n\tif r.orderHow != nil {\n\t\tlocalVarQueryParams.Add(\"order_how\", parameterToString(*r.orderHow, \"\"))\n\t}\n\tif r.search != nil {\n\t\tlocalVarQueryParams.Add(\"search\", parameterToString(*r.search, \"\"))\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.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[\"ApiKeyAuth\"]; 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[\"x-rh-identity\"] = 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": "ea0240be97922f0cca9b8d4e6e0ebaa3", "score": "0.46395418", "text": "func (c *convivaHTTPClient) get(ctx context.Context, v interface{}, url string) (int, error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq = req.WithContext(ctx)\n\treq.SetBasicAuth(c.username, c.password)\n\tres, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer res.Body.Close()\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif res.StatusCode != 200 {\n\t\tresponseError := responseError{}\n\t\tif err := json.Unmarshal(body, &responseError); err == nil {\n\t\t\treturn res.StatusCode, fmt.Errorf(\"%+v\", responseError)\n\t\t}\n\t\treturn res.StatusCode, fmt.Errorf(\"%+v\", res)\n\t}\n\terr = json.Unmarshal(body, v)\n\treturn res.StatusCode, err\n}", "title": "" }, { "docid": "af611022ae6d58d09ac4fdff05b32417", "score": "0.46362117", "text": "func (c *Client) get(url string) ([]byte, error) {\n\t// Prepare request\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Authorization\", c.token.Value)\n\n\treturn c.doRequest(req)\n}", "title": "" }, { "docid": "e401181a6aa9b0e971479e197e4f3f8d", "score": "0.46336877", "text": "func (bfsc *bfSuggestionClient) get(ctx context.Context, url string) ([]byte, error) {\n\tvar req *http.Request\n\tvar err error\n\n\treq, err = http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bfsc.request(ctx, req)\n}", "title": "" }, { "docid": "8b43d255a43799e477184caddc5922de", "score": "0.4624651", "text": "func main() {\n\n\tconf, err := sdk.NewConfig(context.Background(), []string{baseUrl})\n\tif err != nil {\n\t\tfmt.Printf(\"NewConfig returned error: %s\", err)\n\t\treturn\n\t}\n\n\t// Use the default http client\n\tclient := sdk.NewClient(nil, conf)\n\n\taddressOne, err := sdk.NewAddressFromPublicKey(publicKeyOne, networkType)\n\tif err != nil {\n\t\tfmt.Printf(\"NewAddressFromPublicKey returned error: %s\", err)\n\t\treturn\n\t}\n\n\taddressTwo, err := sdk.NewAddressFromPublicKey(publicKeyTwo, networkType)\n\tif err != nil {\n\t\tfmt.Printf(\"NewAddressFromPublicKey returned error: %s\", err)\n\t\treturn\n\t}\n\n\t// Get AccountsInfo for several accounts.\n\taccountsInfo, err := client.Account.GetAccountsInfo(context.Background(), addressOne, addressTwo)\n\tif err != nil {\n\t\tfmt.Printf(\"Account.GetAccountsInfo returned error: %s\", err)\n\t\treturn\n\t}\n\tfor _, accountInfo := range accountsInfo {\n\t\tfmt.Printf(\"%s\\n\", accountInfo.String())\n\t}\n}", "title": "" }, { "docid": "1a9c33442e6795b9737a848a6078ab89", "score": "0.4622583", "text": "func get(ctx context.Context, client *http.Client, apiURL string, v interface{}) (string, error) {\n\treq, err := http.NewRequest(\"GET\", apiURL, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"github: new req: %v\", err)\n\t}\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"github: get URL %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"github: read body: %v\", err)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"%s: %s\", resp.Status, body)\n\t}\n\n\tif err := json.NewDecoder(resp.Body).Decode(v); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to decode response: %v\", err)\n\t}\n\n\treturn getPagination(apiURL, resp), nil\n}", "title": "" }, { "docid": "1986ea452d3850381f9c1fa99d201c28", "score": "0.46154127", "text": "func main() {\n\tflag.Parse()\n\targs := flag.Args()\n\tif len(args) < 1 {\n\t\tlog.Println(\"starting url not specified\")\n\t\tos.Exit(1)\n\t}\n\turi := args[0]\n\n\tresp, err := GIG_Scripts.GigClient.GetRequest(uri)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\timages := helpers.FindImages(resp)\n\n\tfor _, img := range images {\n\t\tif helpers.ImageIsFound(img) {\n\n\t\t\tentity, entityTitles, releaseDate := helpers.CreateEntityFromImage(img)\n\n\t\t\tvar entities []models.Entity\n\t\t\tfor _, mentionedEntity := range entityTitles {\n\t\t\t\tchildEntity := helpers.CreateChildEntity(mentionedEntity, entity, releaseDate, img)\n\t\t\t\tentities = append(entities, childEntity)\n\t\t\t}\n\n\t\t\terr = GIG_Scripts.GigClient.AddEntitiesAsLinks(&entity, entities)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\t//save to db\n\t\t\tentity, saveErr := GIG_Scripts.GigClient.CreateEntity(entity)\n\t\t\tlibraries.ReportError(saveErr, img)\n\t\t}\n\t}\n\n\tlog.Println(\"image crawling completed\")\n\n}", "title": "" }, { "docid": "16427870b155a9ca9a8ef9fa29b7020f", "score": "0.4608753", "text": "func printApiList(url string) {\n\tdata, err := getList(url)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(string(data))\n}", "title": "" }, { "docid": "52a6f2d541e920218c58b2eb895e70c4", "score": "0.46074644", "text": "func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(client)\n\tif opts != nil {\n\t\tquery, err := opts.ToTenantListQuery()\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(client, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn TenantPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "56cccf8ea5328fb184b501c10e3decd5", "score": "0.45982432", "text": "func invokeEHAPI(endpoint string, client *http.Client) ([]byte, error) {\r\n\tehURL, err := url.Parse(fmt.Sprintf(\"%v/api/v1/%v\", *fEHHost, endpoint))\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treq, _ := http.NewRequest(\"GET\", ehURL.String(), nil)\r\n\r\n\treq.Header.Set(\"Accept\", \"application/json\")\r\n\treq.Header.Set(\"User-Agent\", \"extrahop-backupclient(github.com/mhenderson-so/extrahop-backup)\")\r\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"ExtraHop apikey=%v\", *fEHAPIKey))\r\n\r\n\tif *fVerbose {\r\n\t\tslog.Infoln(\"Requesting\", req.URL.String())\r\n\t}\r\n\tres, err := client.Do(req)\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer res.Body.Close()\r\n\tbody, err := ioutil.ReadAll(res.Body)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// http://stackoverflow.com/a/29046984/69683\r\n\tvar prettyJSON bytes.Buffer\r\n\terr = json.Indent(&prettyJSON, body, \"\", \"\\t\")\r\n\r\n\treturn prettyJSON.Bytes(), err\r\n}", "title": "" }, { "docid": "f94ebe101234bd349cd142e6e1afb25b", "score": "0.4596666", "text": "func List() {\n\tresponse, err := http.Get(APIBase)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, _ := ioutil.ReadAll(response.Body)\n\n\tfmt.Println(string(data))\n}", "title": "" }, { "docid": "0969951a7d0dfa9e279b02fc3ed019f6", "score": "0.4593738", "text": "func UtilGET(stub shim.ChaincodeStubInterface, requestStruct interface{}, function func(shim.ChaincodeStubInterface, []string) (Response, error)) (Response, error) {\n\tgetRequestAsBytes, err := json.Marshal(requestStruct)\n\tif err != nil {\n\t\treturn Response{}, err\n\t}\n\n\t// Get the asset using the asset id.\n\tres, err := function(stub, []string{string(getRequestAsBytes)})\n\tif err != nil {\n\t\treturn Response{}, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "074659da50ea063ff1cfdb76fbc6ad01", "score": "0.4586412", "text": "func performGetRequest (url string) (*http.Response, error) {\n\tconfig, err := config.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %v\", config.BearerToken))\n\tclient := &http.Client{}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn nil, errors.New(\"This gitlab operation was not able to be performed\")\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "336afebd231690fd7ba5e8b6456cf80c", "score": "0.45854145", "text": "func hostEntitiesHandler(formatter *render.Render) http.HandlerFunc {\n\n\tsfcplg.HttpMutex.Lock()\n\tdefer sfcplg.HttpMutex.Unlock()\n\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tlog.Debugf(\"Host Entities HTTP handler: Method %s, URL: %s\", req.Method, req.URL)\n\n\t\tvar heArray = make([]controller.HostEntity, 0)\n\t\tfor _, he := range sfcplg.ramConfigCache.HEs {\n\t\t\theArray = append(heArray, he)\n\t\t}\n\t\tswitch req.Method {\n\t\tcase \"GET\":\n\t\t\tformatter.JSON(w, http.StatusOK, heArray)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "89afc628333478dbb38709f0b3c1feae", "score": "0.4572533", "text": "func (a *UserAuthenticationApiService) GetTenantIdUsingGETExecute(r ApiGetTenantIdUsingGETRequest) (SimpleStringWeb, *_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 SimpleStringWeb\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"UserAuthenticationApiService.GetTenantIdUsingGET\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v0/whoami\"\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\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\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\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": "585469f88cdeb518bedd311a6718a482", "score": "0.4570554", "text": "func endpointPrediction(appID string, endpointKey string, host string, utterance string) {\r\n\r\n\tvar endpointUrl = fmt.Sprintf(\"%s/%s?subscription-key=%s&verbose=false&q=%s\", host, appID, endpointKey, url.QueryEscape(utterance))\r\n\t\r\n\tresponse, err := http.Get(endpointUrl)\r\n\r\n\t// 401 - check value of 'subscription-key' - do not use authoring key!\r\n\tif err!=nil {\r\n\t\t// handle error\r\n\t\tfmt.Println(\"error from Get\")\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\t\r\n\tresponse2, err2 := ioutil.ReadAll(response.Body)\r\n\r\n\tif err2!=nil {\r\n\t\t// handle error\r\n\t\tfmt.Println(\"error from ReadAll\")\r\n\t\tlog.Fatal(err2)\r\n\t}\r\n\r\n\tfmt.Println(\"response\")\r\n\tfmt.Println(string(response2))\r\n}", "title": "" }, { "docid": "89b78fa3725fb0757a5354b04c0e42c3", "score": "0.45704806", "text": "func (e *ElasticSearch) Fetch(q string, lang language.Tag, region language.Region, number int, offset int) (*Results, error) {\n\tres := &Results{}\n\n\tqu := elastic.NewBoolQuery().\n\t\tFilter(elastic.NewTermQuery(\"index\", true)).\n\t\tMust(\n\t\t\telastic.NewMultiMatchQuery(\n\t\t\t\tq,\n\t\t\t\t\"domain^3\", \"path^2\",\n\t\t\t\t\"title^1.5\", \"title.lang^1.5\",\n\t\t\t\t\"description\", \"description.lang\",\n\t\t\t).Type(\"cross_fields\").MinimumShouldMatch(\"-25%\"),\n\t\t).\n\t\tShould(\n\t\t\telastic.NewMultiMatchQuery(\n\t\t\t\tq,\n\t\t\t\t\"title.shingles\",\n\t\t\t\t\"description.shingles\",\n\t\t\t).Type(\"cross_fields\"),\n\t\t)\n\n\t// Boost results for regional queries (except for .me, .tv, etc. that are used for other purposes sometimes)\n\t// https://support.google.com/webmasters/answer/182192#1\n\tif t, err := region.TLD(); err == nil {\n\t\ttld := strings.ToLower(t.String())\n\t\tif tld != \"us\" && tld != \"tv\" && tld != \"me\" && tld != \"co\" && tld != \"io\" {\n\t\t\tqu = qu.Should(elastic.NewMatchQuery(\"tld\", tld))\n\t\t}\n\t}\n\n\ta, err := e.Analyzer(lang)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tidx := e.IndexName(a)\n\n\tout, err := e.Client.Search().Index(idx).Type(e.Type).Query(qu).From(offset).Size(number).Do(context.TODO())\n\tif err != nil {\n\t\treturn res, err\n\t}\n\n\tres.Count = out.TotalHits()\n\n\tfor _, u := range out.Hits.Hits {\n\t\tdoc := &document.Document{}\n\t\terr := json.Unmarshal(*u.Source, doc)\n\t\tif err != nil {\n\t\t\treturn res, err\n\t\t}\n\n\t\t// Rather than have the highlighting done here in elasticsearch\n\t\t// we should have a method on doc to highlight so we get consistent\n\t\t// highlighting regardless of the backend used???\n\t\t// For now, we have moved highlighting to a javascript function\n\t\t// if des, ok := u.Highlight[\"description\"]; ok {\n\t\t//\tfor _, v := range des {\n\t\t//\t\tdoc.Description = v\n\t\t//\t}\n\t\t//}\n\n\t\tdoc.ID = u.Id\n\t\tres.Documents = append(res.Documents, doc)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "3177f7f3c8061d090a1b4a44d8c355ab", "score": "0.45681927", "text": "func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\tu := listURL(client)\n\tif opts != nil {\n\t\tq, err := gophercloud.BuildQueryString(opts)\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\tu += q.String()\n\t}\n\treturn pagination.NewPager(client, u, func(r pagination.PageResult) pagination.Page {\n\t\treturn EndpointPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "title": "" }, { "docid": "71e5a007c8b759a8fbda513f02ecac40", "score": "0.45569843", "text": "func (s *EntitiesServer) GetEntitiesByCallsign(context.Context, *api.GetEntitiesByCallsignRequest) (*api.EntitiesResponse, error) {\n\treturn nil, status.New(codes.Unimplemented, \"method not implemented\").Err()\n}", "title": "" }, { "docid": "1bd4bb38e685bf0de01a1a83551a17ca", "score": "0.4554003", "text": "func (a BrandsApi) GetBrandEdibles(ocpc string, page int32, count int32, sort string) (*InlineResponse2008, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/brands/{ocpc}/edibles\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"ocpc\"+\"}\", fmt.Sprintf(\"%v\", ocpc), -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 '(api_key)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-API-Key\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-API-Key\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\tlocalVarQueryParams.Add(\"page\", a.Configuration.APIClient.ParameterToString(page, \"\"))\n\tlocalVarQueryParams.Add(\"count\", a.Configuration.APIClient.ParameterToString(count, \"\"))\n\tlocalVarQueryParams.Add(\"sort\", a.Configuration.APIClient.ParameterToString(sort, \"\"))\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new(InlineResponse2008)\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: \"GetBrandEdibles\", 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": "c38e7f40a088bf43d828f557f5e5110a", "score": "0.45498332", "text": "func (c *Client) GET(url string) ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", c.Endpoint+url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.do(req)\n}", "title": "" }, { "docid": "937479df39cbe4ae0abd67c91e589552", "score": "0.4548385", "text": "func main() {\n\treq := &oai.Request{\n\t\tBaseUrl: \"http://services.kb.nl/mdo/oai\",\n\t\tSet: \"DTS\",\n\t\tMetadataPrefix: \"dcx\",\n\t\tVerb: \"ListIdentifiers\",\n\t\tFrom: \"2012-09-06T014:00:00.000Z\",\n\t}\n\n\t// HarvestIdentifiers passes each individual OAI header to the getRecord\n\t// function as an Header object\n\treq.HarvestIdentifiers(getRecord)\n}", "title": "" }, { "docid": "537223263265adb78513a1e289f5072c", "score": "0.45482847", "text": "func (a *EntitiesApiService) GetHost(ctx _context.Context, id string, localVarOptionals *GetHostOpts) (Host, *_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 Host\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/entities/hosts/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Time.IsSet() {\n\t\tlocalVarQueryParams.Add(\"time\", parameterToString(localVarOptionals.Time.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\", \"entity_id\", \"name\", \"entity_type\", \"vmknics\", \"cluster\", \"vcenter_manager\", \"vm_count\", \"datastores\", \"service_tag\", \"vendor_id\", \"nsx_manager\", \"maintenance_mode\", \"connection_state\"}\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 Host\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": "10bb3dc4563d315f444eb31d2c6c88d5", "score": "0.45423713", "text": "func main() {\n\tflag.Parse()\n\n\tkey := os.Getenv(\"BFX_API_KEY\")\n\tsecret := os.Getenv(\"BFX_API_SECRET\")\n\tc := rest.NewClientWithURL(*api).Credentials(key, secret)\n\n\tavailable, err := c.Platform.Status()\n\tif err != nil {\n\t\tlog.Fatalf(\"getting status: %s\", err)\n\t}\n\n\tif !available {\n\t\tlog.Fatalf(\"API not available\")\n\t}\n\n\ttrades, err := c.Trades.All(\"\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting trades: %s\", err)\n\t}\n\tlog.Printf(\"Trades: %+v\\n\", trades)\n}", "title": "" }, { "docid": "393a6e3ad7ce210b777288f90bf5f97a", "score": "0.45316216", "text": "func Curl(h *Handler, request entity.CurlCommandRequest) ([]byte, error) {\n\treturn h.Curl(request)\n}", "title": "" }, { "docid": "3fc94a29489476b5504824fdb5e4a795", "score": "0.45279968", "text": "func getCentrisData(location string) ResponseBody{\n\n\tvar reqBody RequestBody = RequestBody{Text: location, Language: \"en\"}\n\n\treqBytes, err := json.Marshal(reqBody);\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n req, _ := http.NewRequest(\"POST\", \"https://www.centris.ca/Property/GetSearchAutoCompleteData\", strings.NewReader(string(reqBytes)))\n\treq.Header.Add(\"referer\", \"https://www.centris.ca/\");\n\treq.Header.Add(\"accept-language\", \"en-US,en;q=0.9\");\n\treq.Header.Add(\"origin\", \"https://www.centris.ca\");\n\treq.Header.Add(\"content-type\", \"application/json; charset=UTF-8\");\n\treq.Header.Add(\"accept\", \"/*\");\n\treq.Header.Add(\"authority\", \"www.centris.ca\");\n\t\n res, err := http.DefaultClient.Do(req)\n if err != nil {\n panic(err)\n }\n\n defer res.Body.Close()\n body, _ := ioutil.ReadAll(res.Body)\n\n var listingResult ResponseBody\n err = json.Unmarshal(body, &listingResult)\n if err != nil {\n panic(err)\n }\n\t\n\tif res.StatusCode != http.StatusOK {\n\t\tlog.Fatal(\"Unexpected Status\", res.Status)\n\t} else {\n\t\tfmt.Println(\"Success.\", res.Status)\n\n\t}\n\n\treturn listingResult\n}", "title": "" }, { "docid": "93b4a9cdfe798b4901cbffd6acdf8dd6", "score": "0.45257458", "text": "func main() {\n\n\turl := \"https://\" + fqdn + \"/identity/api/tokens\"\n\n\t// Prepare the body to send\n\tbody := map[string]string{\n\t\t\"username\": username,\n\t\t\"password\": password,\n\t\t\"tenant\": tenant,\n\t}\n\t// Convert body as bytes\n\tbodyAsBytes, err := json.Marshal(body)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\thttp.DefaultClient.Transport = tr\n\tresp, err := http.Post(url, \"application/json\", bytes.NewBuffer(bodyAsBytes))\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tvar result map[string]interface{}\n\n\tjson.NewDecoder(resp.Body).Decode(&result)\n\tfmt.Println(result[\"id\"].(string))\n}", "title": "" }, { "docid": "74901f7f37763fdea474dbf15519b2f8", "score": "0.45247996", "text": "func (y registriesController) ListIdentities(c *gin.Context) {\n\tvar registryKey = c.Param(`registryKey`)\n\tif registryKey == `` {\n\t\tutils.AbortWithLog(c, http.StatusBadRequest, nil, gin.H{`error`: `missing registryKey`})\n\t\treturn\n\t}\n\n\tidentities, err := models.NewRegistryMapping().ListBy(bson.M{`registryKey`: registryKey})\n\tif err != nil {\n\t\tutils.AbortWithLog(c, http.StatusNotFound, err, gin.H{`error`: `could not find identities`})\n\t\treturn\n\t}\n\tidMapping := []string{}\n\tfor _, id := range identities {\n\t\tidMapping = append(idMapping, *id.Identity)\n\t}\n\tc.JSON(http.StatusOK, idMapping)\n}", "title": "" }, { "docid": "3c92ada9469e98b809ad1ce55622b66b", "score": "0.45217416", "text": "func TestGetThing(t *testing.T) {\n\tvar certs []*x509.Certificate\n\tfor _, c := range entrustChain {\n\t\tcert := parseCertificate(c, t)\n\t\tcerts = append(certs, cert)\n\t}\n\tc := newCertutil(t)\n\t//c, err := NewCerutilInto(\"/tmp\")\n\t//if err != nil {\n\t//\tt.Fatal(err)\n\t//}\n\tdefer c.Delete()\n\tfor _, cert := range certs {\n\t\tout, err := c.Install(cert)\n\t\t//t.Log(cert.Subject.CommonName)\n\t\t//t.Log(cert.Issuer.CommonName)\n\t\t//t.Log(cert.Fingerprint)\n\t\tif err != nil {\n\t\t\tt.Fatal(errors.Wrapf(err, string(out)))\n\t\t}\n\t\t//t.Log(cert.CRLDistributionPoints)\n\t\t//t.Log(cert.SerialNumber.String())\n\t\tt.Log(cert.OCSPServer)\n\t}\n\tfor _, cert := range certs {\n\t\tout, err := c.Verify(cert)\n\t\tif err != nil {\n\t\t\tt.Fatal(errors.Wrapf(err, string(out)+\" \"+cert.Issuer.CommonName))\n\t\t}\n\t\tt.Log(string(out))\n\t}\n}", "title": "" }, { "docid": "ffd68b27ea34ead8c1823382484a9449", "score": "0.45164517", "text": "func request(page int) (*seq, http.Arrow) {\n\tvar seq seq\n\treturn &seq, http.GET(\n\t\tø.URI(\"https://api.github.com/users/fogfish/repos\"),\n\t\tø.Param(\"type\", \"all\"),\n\t\tø.Param(\"page\", page),\n\t\tø.Accept.JSON,\n\t\tƒ.Status.OK,\n\t\tƒ.Body(&seq),\n\t)\n}", "title": "" }, { "docid": "b05f755249245113faf2146269d7f01f", "score": "0.4511625", "text": "func execGetIngress(ctx context.Context, out io.Writer) error {\n\treturn runExecutor(ctx, func(executor Executor) error {\n\t\t//Get all ingress list in the namespace\n\t\tingresses, err := executor.BetaV1Client.Ingresses(executor.Namespace).List(ctx, metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\tif err != nil {\n\t\t\t\tcolor.Red.Fprintln(out, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t//Tables to show information\n\t\ttable := table.GetTableObject()\n\t\ttable.SetHeader([]string{\"Name\", \"HOST\", \"ADDRESS\", \"PATH\", \"PORTS\", \"TARGET SERVICE\", \"AGE\"})\n\n\t\tnow := time.Now()\n\t\tfor _, ingress := range ingresses.Items {\n\t\t\tobjectMeta := ingress.ObjectMeta\n\t\t\tingressSpec := ingress.Spec\n\n\t\t\tvar address string\n\t\t\tif len(ingress.Status.LoadBalancer.Ingress) == 0 {\n\t\t\t\taddress = \"\"\n\t\t\t} else {\n\t\t\t\taddress = ingress.Status.LoadBalancer.Ingress[0].Hostname\n\t\t\t}\n\t\t\tduration := duration.HumanDuration(now.Sub(objectMeta.CreationTimestamp.Time))\n\n\t\t\thost := ingressSpec.Rules[0].Host\n\t\t\tif len(host) <= 0 {\n\t\t\t\thost = \"*\"\n\t\t\t}\n\n\t\t\tport := []string{}\n\t\t\tservice := []string{}\n\t\t\tpaths := []string{}\n\t\t\tfor _, path := range ingressSpec.Rules[0].IngressRuleValue.HTTP.Paths {\n\t\t\t\tif path.Backend.ServicePort.IntVal != 0 {\n\t\t\t\t\tport = append(port, utils.Int32ToString(path.Backend.ServicePort.IntVal))\n\t\t\t\t}\n\t\t\t\tservice = append(service, path.Backend.ServiceName)\n\t\t\t\tpaths = append(paths, path.Path)\n\t\t\t}\n\t\t\ttable.Append([]string{objectMeta.Name, host, address, strings.Join(paths, \",\"), strings.Join(port, \",\"), strings.Join(service, \",\"), duration})\n\t\t}\n\t\ttable.Render()\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "532107aaeeb95cb96173e393df23c52f", "score": "0.45070854", "text": "func (o *GetAllVCentersUsingGETParams) WithHTTPClient(client *http.Client) *GetAllVCentersUsingGETParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "a97fe51d1d87e061724824b3a902d04e", "score": "0.4505758", "text": "func (c *GraphQLClient) fetch(query, resourcePath string, variables map[string]string) []byte {\n\thasNextPagePath := fmt.Sprintf(\"data.%s.pageInfo.hasNextPage\", resourcePath)\n\tcursorPath := fmt.Sprintf(\"data.%s.pageInfo.endCursor\", resourcePath)\n\tdataPath := fmt.Sprintf(\"data.%s\", resourcePath)\n\n\tvariables[\"login\"] = c.organization\n\n\tdata := gabs.Container{}\n\terrorTracker := map[string]GraphQLError{}\n\tfor {\n\t\tresp := c.call(query, variables)\n\n\t\tparsedResp, err := gabs.ParseJSON(resp)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\t// track GraphQL errors for diagnostics\n\t\tgqlerrors := parsedResp.Path(\"errors\")\n\t\tif gqlerrors != nil {\n\t\t\tc.checkFatalErrors(gqlerrors)\n\t\t\tc.trackFetchErrors(gqlerrors, errorTracker)\n\t\t}\n\n\t\t// Merge this page's data into all data\n\t\td := parsedResp.Path(dataPath)\n\t\tdata.Merge(d)\n\n\t\t// Handle pagination\n\t\thasNextPageData := parsedResp.Path(hasNextPagePath).Data()\n\t\tif hasNextPageData == nil {\n\t\t\tlog.Warnf(\n\t\t\t\t\"No hasNextPage in pageInfo for %s, something is wrong\",\n\t\t\t\tresourcePath,\n\t\t\t)\n\t\t\tbreak\n\t\t}\n\t\thasNextPage := hasNextPageData.(bool)\n\t\tif !hasNextPage {\n\t\t\tbreak\n\t\t}\n\n\t\tcursor := parsedResp.Path(cursorPath).Data().(string)\n\t\tvariables[\"cursor\"] = cursor\n\t}\n\n\tc.logFetchErrors(resourcePath, errorTracker)\n\n\treturn data.Bytes()\n}", "title": "" }, { "docid": "ceb48d05046aee5f8fcdaec1e5eb1e66", "score": "0.4502742", "text": "func (a *Client) GetAllUsingGET1(params *GetAllUsingGET1Params, opts ...ClientOption) (*GetAllUsingGET1OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAllUsingGET1Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getAllUsingGET_1\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/codestream/api/registry-webhooks\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAllUsingGET1Reader{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.(*GetAllUsingGET1OK)\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_1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "cb7c834897c872e5d20d3210d9d6c073", "score": "0.449619", "text": "func (client *ClientImpl) ListIdentitiesWithGlobalAccessTokens(ctx context.Context, args ListIdentitiesWithGlobalAccessTokensArgs) (*[]uuid.UUID, error) {\n\tif args.Revocations == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.Revocations\"}\n\t}\n\tqueryParams := url.Values{}\n\tif args.IsPublic != nil {\n\t\tqueryParams.Add(\"isPublic\", strconv.FormatBool(*args.IsPublic))\n\t}\n\tbody, marshalErr := json.Marshal(*args.Revocations)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"30d3a12b-66c3-4669-b016-ecb0706c8d0f\")\n\tresp, err := client.Client.Send(ctx, http.MethodPost, locationId, \"5.1-preview.1\", nil, queryParams, bytes.NewReader(body), \"application/json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue []uuid.UUID\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "085a5c50e3ae0d4be258d5201d36d648", "score": "0.44961855", "text": "func (api EntriesApi) request(apiUrl string, filters *FilterGroup, sort *Sort, page *Page) (*EntriesCollection, error) {\n\tparams := make(map[string]string)\n\n\tif page != nil {\n\t\tparams[\"pageStart\"] = strconv.Itoa(page.Offset - 1)\n\t\tparams[\"pageSize\"] = strconv.Itoa(page.Size)\n\t}\n\n\tif sort != nil {\n\t\tparams[\"sort\"] = sort.FieldId\n\t\tparams[\"sortDirection\"] = sort.Direction\n\t}\n\n\t//if filters != nil {\n\t//\tfor idx, filter := range filters.Filters {\n\t//\t\tparams[\"Filter\"+strconv.Itoa(idx)] = filter.FieldId+\"+\"+filter.Operator+\"+\"+filter.MatchValue\n\t//\t}\n\t//\n\t//\tparams[\"match\"] = filters.Grouping\n\t//}\n\n\tcollection := EntriesCollection{make([]map[string]interface{}, 0)}\n\n\terr := api.Client.Get(apiUrl, params, filters, &collection)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &collection, nil\n}", "title": "" }, { "docid": "b9eca2676076d82af1d98eb2160c022c", "score": "0.44955087", "text": "func TestClient_Query(t *testing.T) {\n\ttoken := os.Getenv(\"TEXTRAZOR_TOKEN\")\n\tif token == \"\" {\n\t\tt.Skip(\"No API token\")\n\t}\n\n\tcl := textrazor.NewClient(token, utils.DefaultClient)\n\tres, err := cl.Query(textrazor.EntitiesWordsRelations, \"I will go to beijing to play basketball next monday\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tutils.PrintlnJson(res)\n}", "title": "" }, { "docid": "07c68fc153239257ae2709c914bd52ac", "score": "0.44864854", "text": "func main() {\n\t// this url can be captured when `go get github.com/google/uuid v1.1.1`\n\ttileURL := \"https://sum.golang.org/tile/8/0/003\"\n\n\tresp, err := http.Get(tileURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// convert to base64\n\tb64List := []string{}\n\tsha256Len := 32\n\tfor i := 0; i < len(body); i = i + sha256Len {\n\t\tb64 := base64.StdEncoding.EncodeToString(body[i : i+sha256Len])\n\t\tb64List = append(b64List, b64)\n\t}\n\n\tfmt.Println(\"SHA-256 hashes in response: \")\n\tfmt.Println()\n\tfor i, hash := range b64List {\n\t\tfmt.Printf(\"[%03d]%s\\n\", i+1, hash)\n\t}\n\n\tfmt.Println()\n\tfmt.Printf(\"url: %s\\n\", tileURL)\n\tfmt.Printf(\"response length: %d bytes\\n\", len(body))\n}", "title": "" }, { "docid": "4137745406195647b87acc86b33e3bc5", "score": "0.44845253", "text": "func ExampleIncidentsClient_ListEntities() {\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 := armsecurityinsights.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.NewIncidentsClient().ListEntities(ctx, \"myRg\", \"myWorkspace\", \"afbd324f-6c48-459c-8710-8d1e1cd03812\", 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.IncidentEntitiesResponse = armsecurityinsights.IncidentEntitiesResponse{\n\t// \tEntities: []armsecurityinsights.EntityClassification{\n\t// \t\t&armsecurityinsights.AccountEntity{\n\t// \t\t\tName: to.Ptr(\"e1d3d618-e11f-478b-98e3-bb381539a8e1\"),\n\t// \t\t\tType: to.Ptr(\"Microsoft.SecurityInsights/Entities\"),\n\t// \t\t\tID: to.Ptr(\"/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Entities/e1d3d618-e11f-478b-98e3-bb381539a8e1\"),\n\t// \t\t\tKind: to.Ptr(armsecurityinsights.EntityKindEnumAccount),\n\t// \t\t\tProperties: &armsecurityinsights.AccountEntityProperties{\n\t// \t\t\t\tFriendlyName: to.Ptr(\"administrator\"),\n\t// \t\t\t\tAccountName: to.Ptr(\"administrator\"),\n\t// \t\t\t\tNtDomain: to.Ptr(\"domain\"),\n\t// \t\t\t},\n\t// \t}},\n\t// \tMetaData: []*armsecurityinsights.IncidentEntitiesResultsMetadata{\n\t// \t\t{\n\t// \t\t\tCount: to.Ptr[int32](1),\n\t// \t\t\tEntityKind: to.Ptr(armsecurityinsights.EntityKindEnumAccount),\n\t// \t}},\n\t// }\n}", "title": "" } ]
10eac633a294f22fcab51464cc367fcd
Perf is a short cut function that uses package initialized logger and performance log
[ { "docid": "7455b07444e70c048f2d077eb10d36f0", "score": "0.6896577", "text": "func Perf(message string) {\n\tLog.Perf(message)\n\treturn\n}", "title": "" } ]
[ { "docid": "e42b5aef44817c3915ca77aec3216bf7", "score": "0.6295017", "text": "func BenchmarkLogger(b *testing.B) {\n\tSetDriver(new(NilDriver))\n\n\tlog := GetLogger()\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tfor i := 0; i < b.N; i++ {\n\t\tlog.Infof(\"hello world\")\n\t}\n}", "title": "" }, { "docid": "cef34e0b55a0be8ee265dc6f29a9aad6", "score": "0.6019583", "text": "func BenchmarkLogger(b *testing.B) {\n\tbenchmarkLoggerN(b, 1, Info)\n}", "title": "" }, { "docid": "42a2f1a0f28ef0c5869ccd686733485d", "score": "0.59528667", "text": "func New(\n\tout io.ReadWriter,\n\toperation string,\n\tsetup Setup,\n) (*Benchmark, error) {\n\tif out == nil {\n\t\tout = os.Stdout\n\t}\n\n\tif err := checkSetupImplementation(setup); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid logger implementation: %w\", err)\n\t}\n\n\tbench := new(Benchmark)\n\n\tswitch operation {\n\tcase LogOperationInfo:\n\t\tfn, err := setup.Info(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbench.writeLog = func() { fn(\"information\") }\n\n\tcase LogOperationInfoFmt:\n\t\tfn, err := setup.InfoFmt(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbench.writeLog = func() { fn(\"information %d\", 42) }\n\n\tcase LogOperationInfoWithErrorStack:\n\t\tfn, err := setup.InfoWithErrorStack(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terrVal := errors.New(\"error with stack trace\")\n\t\tbench.writeLog = func() { fn(\"information\", errVal) }\n\n\tcase LogOperationError:\n\t\tfn, err := setup.Error(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbench.writeLog = func() { fn(\"error message\") }\n\n\tcase LogOperationInfoWith10Exist:\n\t\tfn, err := setup.InfoWith10Exist(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbench.writeLog = func() { fn(\"information\") }\n\n\tcase LogOperationInfoWith3:\n\t\tfn, err := setup.InfoWith3(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfields := NewFields3()\n\t\tbench.writeLog = func() { fn(\"information\", fields) }\n\n\tcase LogOperationInfoWith10:\n\t\tfn, err := setup.InfoWith10(out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfields := NewFields10()\n\t\tbench.writeLog = func() { fn(\"information\", fields) }\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported operation: %q\", operation)\n\t}\n\n\treturn bench, nil\n}", "title": "" }, { "docid": "6579f2262c2afebcd1a9e9ef3426f32f", "score": "0.5858207", "text": "func init(){\n\t// Verbose logging with file name and number\n\tlog.SetFlags(log.Lshortfile)\n\n\t// We can use all CPU cores\n\truntime.GOMAXPROCS(runtime.NumCPU())\n}", "title": "" }, { "docid": "9cdfd6b3ea9b67b8b134bd1f83ad0a39", "score": "0.57993484", "text": "func init() {\n\tloader.UseLogger(loggers.LoaderLog)\n\twallet.UseLogger(loggers.WalletLog)\n\tudb.UseLogger(loggers.WalletLog)\n\tticketbuyer.UseLogger(loggers.TkbyLog)\n\tchain.UseLogger(loggers.SyncLog)\n\tspv.UseLogger(loggers.SyncLog)\n\tp2p.UseLogger(loggers.SyncLog)\n\trpcserver.UseLogger(loggers.GrpcLog)\n\tjsonrpc.UseLogger(loggers.JsonrpcLog)\n\tconnmgr.UseLogger(loggers.CmgrLog)\n}", "title": "" }, { "docid": "525ffe582f694e2b6fda347781afc846", "score": "0.5791412", "text": "func logLatency (latency time.Duration, tag string) {\n go func(latency time.Duration, tag string) {\n file, _ := os.Create(config.OutDir + \"/\" + strconv.Itoa(int(C.NUM_DOCS)) + \"_docs_\" + strconv.Itoa(int(C.BLOOM_FILTER_SZ)) + \"bf_latency_\" + tag)\n defer file.Close()\n io.WriteString(file, latency.String())\n }(latency, tag)\n}", "title": "" }, { "docid": "1763695acd730e8a23d46b81371d87c0", "score": "0.5773322", "text": "func Benchmark_Logger(b *testing.B) {\n\tapp := fiber.New()\n\n\tapp.Use(New(Config{\n\t\tFormat: \"${bytesReceived} ${bytesSent} ${status}\",\n\t\tOutput: ioutil.Discard,\n\t}))\n\n\tapp.Get(\"/\", func(c *fiber.Ctx) error {\n\t\treturn c.SendString(\"Hello, World!\")\n\t})\n\n\th := app.Handler()\n\n\tfctx := &fasthttp.RequestCtx{}\n\tfctx.Request.Header.SetMethod(\"GET\")\n\tfctx.Request.SetRequestURI(\"/\")\n\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\n\tfor n := 0; n < b.N; n++ {\n\t\th(fctx)\n\t}\n\n\tutils.AssertEqual(b, 200, fctx.Response.Header.StatusCode())\n}", "title": "" }, { "docid": "4a1d82605a12a1b3221bb1c65cea7022", "score": "0.57584167", "text": "func BenchmarkDefaultLogger(b *testing.B) {\n\tSetDriver(new(NilDriver))\n\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tfor i := 0; i < b.N; i++ {\n\t\tInfof(\"hello world\")\n\t}\n}", "title": "" }, { "docid": "d7540648ce915b83be2d7c2bd832e367", "score": "0.5733917", "text": "func (t *Stopwatch) performanceLog(markerMessage string) {\n\tfmt.Sprintf(\"\\n[Stopwatch] %v for %s\", (t.Get() / t.accuracyFactor).Nanoseconds(), markerMessage)\n}", "title": "" }, { "docid": "030a9baef048b996461bc81c2913fbaf", "score": "0.56609744", "text": "func (s *Sampler) logStats() {\n\tdefer close(s.exit)\n\n\tt := time.NewTicker(10 * time.Second)\n\tdefer t.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-s.exit:\n\t\t\treturn\n\t\tcase now := <-t.C:\n\t\t\tkeptTraceCount := atomic.SwapUint64(&s.keptTraceCount, 0)\n\t\t\ttotalTraceCount := atomic.SwapUint64(&s.totalTraceCount, 0)\n\n\t\t\tduration := now.Sub(s.lastFlush)\n\t\t\ts.lastFlush = now\n\n\t\t\t// TODO: do we still want that? figure out how it conflicts with what the `state` exposes / what is public metrics.\n\t\t\tvar stats info.SamplerStats\n\t\t\tif duration > 0 {\n\t\t\t\tstats.KeptTPS = float64(keptTraceCount) / duration.Seconds()\n\t\t\t\tstats.TotalTPS = float64(totalTraceCount) / duration.Seconds()\n\t\t\t}\n\t\t\tengineType := fmt.Sprint(reflect.TypeOf(s.engine))\n\t\t\tlog.Tracef(\"%s: flushed %d sampled traces out of %d\", engineType, keptTraceCount, totalTraceCount)\n\n\t\t\tstate := s.engine.GetState()\n\n\t\t\tswitch state := state.(type) {\n\t\t\tcase sampler.InternalState:\n\t\t\t\tlog.Tracef(\"%s: inTPS: %f, outTPS: %f, maxTPS: %f, offset: %f, slope: %f, cardinality: %d\",\n\t\t\t\t\tengineType, state.InTPS, state.OutTPS, state.MaxTPS, state.Offset, state.Slope, state.Cardinality)\n\n\t\t\t\t// publish through expvar\n\t\t\t\t// TODO: avoid type switch, prefer engine method\n\t\t\t\tswitch s.engine.GetType() {\n\t\t\t\tcase sampler.NormalScoreEngineType:\n\t\t\t\t\tinfo.UpdateSamplerInfo(info.SamplerInfo{Stats: stats, State: state})\n\t\t\t\tcase sampler.ErrorsScoreEngineType:\n\t\t\t\t\tinfo.UpdateErrorsSamplerInfo(info.SamplerInfo{Stats: stats, State: state})\n\t\t\t\tcase sampler.PriorityEngineType:\n\t\t\t\t\tinfo.UpdatePrioritySamplerInfo(info.SamplerInfo{Stats: stats, State: state})\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tlog.Debugf(\"unhandled sampler engine, can't log state\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b49e44a530a57ff37847c23944fcb9bc", "score": "0.5636925", "text": "func init() {\n\tsetSubLogger(Subsystem, log, nil)\n\taddSubLogger(recommend.Subsystem, recommend.UseLogger)\n\taddSubLogger(dataset.Subsystem, dataset.UseLogger)\n\taddSubLogger(frdrpc.Subsystem, frdrpc.UseLogger)\n\taddSubLogger(revenue.Subsystem, revenue.UseLogger)\n\taddSubLogger(fiat.Subsystem, fiat.UseLogger)\n\taddSubLogger(accounting.Subsystem, accounting.UseLogger)\n}", "title": "" }, { "docid": "2ecdd08fc08fda3a8e1ece20f713d32f", "score": "0.5633372", "text": "func init() {\n\tlog = logger.GetLogger(\"SCRP\")\n}", "title": "" }, { "docid": "dae2d29cde0195bc5215d7c4f14c9f2b", "score": "0.5617614", "text": "func init() {\n\t// Verbose logging with file name and line number\n\tlog.SetFlags(log.Lshortfile)\n\n\t// Use all CPU cores\n\truntime.GOMAXPROCS(runtime.NumCPU())\n}", "title": "" }, { "docid": "1d2c0133f2b7582e1a838ff1516b335a", "score": "0.5593014", "text": "func BenchmarkLogitLoggerWithFormat(b *testing.B) {\n\toptions := logit.Options()\n\n\tlogger := logit.NewLogger(\n\t\toptions.WithDebugLevel(),\n\t\toptions.WithAppender(appender.Text()),\n\t\toptions.WithWriter(ioutil.Discard),\n\t\toptions.WithTimeFormat(timeFormat),\n\t)\n\n\tlogTask := func() {\n\t\tlogger.Debug(\"debug%s\", \"...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Info(\"info%s\", \"...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Warn(\"warning%s\", \"...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Error(nil, \"error%s\", \"...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t}\n\n\tb.ReportAllocs()\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogTask()\n\t}\n}", "title": "" }, { "docid": "144e7a0af89f1b8f0994f801a4df6aae", "score": "0.55749714", "text": "func PerformanceLogMiddleware(next http.Handler, allowLogDebug bool) http.Handler {\n\tif allowLogDebug {\n\t\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\tstart := time.Now()\n\t\t\tnext.ServeHTTP(rw, r)\n\t\t\tlog.Infof(\"%s %s %s\", r.Method, r.RequestURI, time.Since(start))\n\t\t})\n\t}\n\treturn next\n}", "title": "" }, { "docid": "55f094cfda0eebc74ae458a864757d74", "score": "0.5554961", "text": "func init() {\n\tlog.Print(\"register prom getMergeLatency\")\n\tprometheus.MustRegister(getMergeLatency)\n}", "title": "" }, { "docid": "691abf7cdae7b6517e1888f0e67c08e3", "score": "0.5552676", "text": "func BenchmarkLogInfo(b *testing.B){\n\tfor n := 0; n < b.N; n++{\n\t\tlogger.Info(\"This is a message\", \"client:123456\")\n\t}\n}", "title": "" }, { "docid": "fa79f1ad736f185b3afbe408de31beee", "score": "0.55333143", "text": "func Log(source string, frequency time.Duration) {\n\tlg := logger.New(\"go-process-metrics\")\n\n\tlogMetric := func(metricName, metricType string, value uint64) {\n\t\tlg.TraceD(metricName, logger.M{\n\t\t\t\"type\": metricType,\n\t\t\t\"value\": value,\n\t\t\t\"via\": \"process-metrics\",\n\t\t})\n\t}\n\n\tfor range time.Tick(frequency) {\n\t\t// get a variety of runtime stats\n\t\tstart := time.Now()\n\t\tnumGoRoutines := runtime.NumGoroutine()\n\t\tvar memStats runtime.MemStats\n\t\truntime.ReadMemStats(&memStats)\n\t\tgcStats := &debug.GCStats{\n\t\t\t// allocate 5 slots for 0,25,50,75,100th percentiles\n\t\t\tPauseQuantiles: make([]time.Duration, numPauseQuantiles),\n\t\t}\n\t\tdebug.ReadGCStats(gcStats)\n\t\tduration := time.Now().Sub(start)\n\n\t\t// Track how long gathering all these metrics actually take so we don't\n\t\t// start to lag our services too much.\n\t\t// Since this is in it's own go-routine it isn't an exact measure, but\n\t\t// something is better than nothing. It will give us the upper bound cost.\n\t\t// This may turn important since some calls like ReadMemStats must \"stop the world\"\n\t\t// to gather their information.\n\t\tlogMetric(\"MetricsCostNs\", \"gauge\", uint64(duration.Nanoseconds()))\n\n\t\t// log the # of go routines we have running\n\t\tlogMetric(\"NumGoroutine\", \"gauge\", uint64(numGoRoutines))\n\n\t\t// log various memory allocation stats\n\t\tlogMetric(\"Alloc\", \"gauge\", memStats.Alloc)\n\t\tlogMetric(\"HeapAlloc\", \"gauge\", memStats.HeapAlloc)\n\t\tlogMetric(\"NumConns\", \"gauge\", getSocketCount())\n\t\tlogMetric(\"NumFDs\", \"gauge\", getFDCount())\n\n\t\t// log various GC stats\n\t\tlogMetric(\"NumGC\", \"counter\", uint64(gcStats.NumGC))\n\t\t// log the min, 25th, 50th, 75th and max GC pause percentiles\n\t\tfor idx := 0; idx < numPauseQuantiles; idx++ {\n\t\t\tpercent := idx * 25\n\t\t\ttitle := fmt.Sprintf(\"GCPauseNs-%d\", percent)\n\t\t\tlogMetric(title, \"gauge\", uint64(gcStats.PauseQuantiles[idx].Nanoseconds()))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8fb2575610d9dc42466baf080110649", "score": "0.5491512", "text": "func BenchmarkLogitLoggerPrint(b *testing.B) {\n\toptions := logit.Options()\n\n\tlogger := logit.NewLogger(\n\t\toptions.WithDebugLevel(),\n\t\toptions.WithAppender(appender.Text()),\n\t\toptions.WithWriter(ioutil.Discard),\n\t\toptions.WithTimeFormat(timeFormat),\n\t)\n\n\tlogTask := func() {\n\t\tlogger.Println(\"debug\", \"trace\", \"xxx\", \"id\", 123, \"pi\", 3.14)\n\t\tlogger.Println(\"info\", \"trace\", \"xxx\", \"id\", 123, \"pi\", 3.14)\n\t\tlogger.Println(\"warn\", \"trace\", \"xxx\", \"id\", 123, \"pi\", 3.14)\n\t\tlogger.Println(\"error\", \"trace\", \"xxx\", \"id\", 123, \"pi\", 3.14)\n\t}\n\n\tb.ReportAllocs()\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogTask()\n\t}\n}", "title": "" }, { "docid": "c0914fffd62562c163a66ea575c3617b", "score": "0.5480939", "text": "func callLog(ctx context.Context, logger Logger, message string) {\n\tlogger.Log(ctx, message, SourceTrace)\n}", "title": "" }, { "docid": "49bc74704462ff81d0068c2ce17b3022", "score": "0.5478101", "text": "func startPerfSummarization(ctx context.Context, db *pgxpool.Pool, sCfg *perfSummariesConfig) {\n\tsklog.Infof(\"Perf summary config %+v\", *sCfg)\n\tif sCfg.AgeOutCommits <= 0 {\n\t\tpanic(\"Must have a positive, non-zero age_out_commits\")\n\t}\n\tif len(sCfg.KeysToSummarize) == 0 {\n\t\tpanic(\"Must specify at least one key\")\n\t}\n\tif len(sCfg.CorporaToSummarize) == 0 {\n\t\tpanic(\"Must specify at least one corpus\")\n\t}\n\tliveness := metrics2.NewLiveness(\"periodic_tasks\", map[string]string{\n\t\t\"task\": \"PerfSummarization\",\n\t})\n\n\tsc, err := gstorage.NewClient(ctx)\n\tif err != nil {\n\t\tpanic(\"Could not make google storage client \" + err.Error())\n\t}\n\tstorageClient := gcsclient.New(sc, sCfg.GCSBucket)\n\n\tgo util.RepeatCtx(ctx, sCfg.Period.Duration, func(ctx context.Context) {\n\t\tsklog.Infof(\"Tabulating all perf data for keys %s and corpora %s\", sCfg.KeysToSummarize, sCfg.CorporaToSummarize)\n\n\t\tif err := summarizeTraces(ctx, db, sCfg, storageClient); err != nil {\n\t\t\tsklog.Errorf(\"Could not summarize traces using config %+v: %s\", sCfg, err)\n\t\t\treturn\n\t\t}\n\t\tliveness.Reset()\n\t\tsklog.Infof(\"Done tabulating all perf data\")\n\t})\n}", "title": "" }, { "docid": "14821bca9410766e40a7011846ec38c0", "score": "0.5475148", "text": "func init() {\n\tloggerInstance = &Logger{logging.MustGetLogger(\"\")}\n\n\tformat := logging.MustStringFormatter(\n\t\t`{\"application\": \"kube2consul\", \"timestamp\": \"%{time:15:04:05.000}\", \"source\": \"%{longfunc}\", \"loglevel\": \"%{level}\", \"message\": \"%{message}\" }`,\n\t)\n\tbackend1 := logging.NewLogBackend(os.Stdout, \"\", 0)\n\tbackend1Formatter := logging.NewBackendFormatter(backend1, format)\n\tlogging.SetBackend(backend1Formatter)\n\n}", "title": "" }, { "docid": "2d37d13a871f96315c2a7fff9e83fe93", "score": "0.5461617", "text": "func recordStartupPerf(value *perf.Values, name string, duration time.Duration) {\n\tvalue.Append(perf.Metric{\n\t\tName: name,\n\t\tUnit: \"seconds\",\n\t\tDirection: perf.SmallerIsBetter,\n\t\tMultiple: true,\n\t}, duration.Seconds())\n}", "title": "" }, { "docid": "d0288791eb529a5722283380f197e3e2", "score": "0.54547596", "text": "func init() {\n\tlog.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)\n}", "title": "" }, { "docid": "2d72dd2d6e4080741198d71df48910b0", "score": "0.5451158", "text": "func (t *Stopwatch) performanceLogAndRestart(markerMessage string) {\n\tfmt.Sprintf(\"\\n[Stopwatch] %v for %s\", (t.GetAndRestart() / t.accuracyFactor).Nanoseconds(), markerMessage)\n}", "title": "" }, { "docid": "74408394a0a653424e3773907d0399c8", "score": "0.54328513", "text": "func BenchmarkLogger(b *testing.B) {\n\tlogger := zap.NewExample()\n\tdefer func() {\n\t\t_ = logger.Sync()\n\t}()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogger.Info(\"failed to fetch URL\",\n\t\t\tzap.String(\"url\", \"http://example.com\"),\n\t\t\tzap.Int(\"attempt\", 3),\n\t\t\tzap.Duration(\"backoff\", time.Second),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "72d2c8d4338f3f63dae5fca06f953cba", "score": "0.5432844", "text": "func Slow(ctx context.Context, v ...any) {\n\tgetLogger(ctx).Slow(v...)\n}", "title": "" }, { "docid": "b7791c402736c7a33772e955a64ef151", "score": "0.5396712", "text": "func init() {\n\tlogger = config.Logger()\n\tlog = logger.WithFields(logrus.Fields{\"tag\": \"Cluster\"})\n}", "title": "" }, { "docid": "2aa1861fa166e7d8deb158945e284cbf", "score": "0.53945714", "text": "func init() {\n\n\t//kpProfile = pprof.NewProfile(\"kp\")\n\tgo http.ListenAndServe(\":8089\", http.DefaultServeMux)\n\t//http.DefaultServeMux.Handle(\"/debug/pprof/kp\", pprofHTTP.Handler(\"kp\"))\n\n\t_ = expvar.NewFloat(\"parseTotalTime\")\n\n\t//go statsdSender()\n\t//go graphiteSender()\n}", "title": "" }, { "docid": "d3dbb536685ceb22830a923b6b279f71", "score": "0.5357037", "text": "func LogStats() {\n\tvar networkInBytes uint64 = 0\n\tvar networkOutBytes uint64 = 0\n\tvar networkInPackets uint64 = 0\n\tvar networkOutPackets uint64 = 0\n\n\tvar pnetworkInBytes uint64 = 0\n\tvar pnetworkOutBytes uint64 = 0\n\tvar pnetworkInPackets uint64 = 0\n\tvar pnetworkOutPackets uint64 = 0\n\n\tvar ready bool = false\n\tvar interval time.Duration = time.Duration(appParams.LogInterval)\n\n\tfor {\n\t\tmemstats, err := gostatgrab.GetMemStats()\n\t\tcpupercent, err1 := gostatgrab.GetCpuPercents()\n\t\tnetworkstats, err2 := gostatgrab.GetNetworkIoStats()\n\t\tif err != nil || err1 != nil || err2 != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tnetworkInBytes = 0\n\t\tnetworkOutBytes = 0\n\t\tnetworkInPackets = 0\n\t\tnetworkOutPackets = 0\n\t\tfor _, networkstat := range networkstats {\n\t\t\tnetworkInBytes += networkstat.ReadBytes\n\t\t\tnetworkOutBytes += networkstat.WriteBytes\n\t\t\tnetworkInPackets += networkstat.ReadPackets\n\t\t\tnetworkOutPackets += networkstat.WritePackets\n\t\t}\n\t\tinstant := time.Now()\n\t\t/*\n\t\t fmt.Printf(\"Time: %v\\n\", int64(instant.UnixNano()/1e9) - pinstant)\n\t\t fmt.Printf(\"CPUPercent: %.2f\\n\", cpupercent.User)\n\t\t fmt.Printf(\"MemTotal (MB): %d\\n\", memstats.Total/(1024*1024))\n\t\t fmt.Printf(\"MemUsed (MB): %d\\n\", memstats.Used/(1024*1024))\n\t\t fmt.Printf(\"NetInBytes (KB): %d\\n\", (networkInBytes - pnetworkInBytes)/1024)\n\t\t fmt.Printf(\"NetOoutbytes (KB): %d\\n\", (networkOutBytes -pnetworkOutBytes)/1024)\n\t\t fmt.Printf(\"NetInPackets: %d\\n\", networkInPackets - pnetworkInPackets)\n\t\t fmt.Printf(\"NetOutPackets: %d\\n\", networkOutPackets - pnetworkOutPackets)\n\t\t fmt.Printf(\"\\n\")\n\t\t*/\n\t\tif ready {\n\t\t\tSystemLog.Printf(\"%v %.2f %d %d %d %d %d %d\\n\",\n\t\t\t\t(int64(instant.UnixNano() / 1e3)),\n\t\t\t\tcpupercent.User,\n\t\t\t\tmemstats.Total/(1024*1024),\n\t\t\t\tmemstats.Used/(1024*1024),\n\t\t\t\t((networkInBytes - pnetworkInBytes) / 1024),\n\t\t\t\t((networkOutBytes - pnetworkOutBytes) / 1024),\n\t\t\t\t(networkInPackets - pnetworkInPackets),\n\t\t\t\t(networkOutPackets - pnetworkOutPackets))\n\t\t}\n\t\tready = true\n\t\ttime.Sleep(interval * time.Second)\n\n\t\tpnetworkInBytes = networkInBytes\n\t\tpnetworkOutBytes = networkOutBytes\n\n\t\tpnetworkInPackets = networkInPackets\n\t\tpnetworkOutPackets = networkOutPackets\n\t}\n\n}", "title": "" }, { "docid": "2ef364d0ae3dec11d00e66ad9a9055fc", "score": "0.53321964", "text": "func init() {\n\tlogger = flogging.MustGetLogger(pkgLogID)\n}", "title": "" }, { "docid": "94842d7dfba6d52149eb41f6a11f0449", "score": "0.53203315", "text": "func initLogging(logFormat string, enableDebugMode bool) {\n if enableDebugMode {\n logger = log.New(logFormat, zap.DebugLevel.String(), true)\n } else {\n logger = log.New(logFormat, zap.InfoLevel.String(), true)\n }\n\n // Pass the same logger for components\n touchbasemanager.InitLogger(logger)\n gcpclients.InitLogger(logger)\n configs.InitLogger(logger)\n email.InitLogger(logger)\n}", "title": "" }, { "docid": "1cd30b1b0006cf58be840ee742c1924a", "score": "0.53161764", "text": "func (s *Server) initLogging() {\n\tif !s.Options.Prod {\n\t\ts.Context = gologger.StdConfig.Use(s.Context)\n\t\ts.Context = logging.SetLevel(s.Context, logging.Debug)\n\t\ts.logRequestCB = func(ctx context.Context, entry *sdlogger.LogEntry) {\n\t\t\tlogging.Infof(ctx, \"%d %s %q (%s)\",\n\t\t\t\tentry.RequestInfo.Status,\n\t\t\t\tentry.RequestInfo.Method,\n\t\t\t\tentry.RequestInfo.URL,\n\t\t\t\tentry.RequestInfo.Latency,\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\n\tif s.Options.testStdout != nil {\n\t\ts.stdout = s.Options.testStdout\n\t} else {\n\t\ts.stdout = &sdlogger.Sink{Out: os.Stdout}\n\t}\n\n\tif s.Options.testStderr != nil {\n\t\ts.stderr = s.Options.testStderr\n\t} else {\n\t\ts.stderr = &sdlogger.Sink{Out: os.Stderr}\n\t}\n\n\ts.Context = logging.SetFactory(s.Context,\n\t\tsdlogger.Factory(s.stderr, sdlogger.LogEntry{\n\t\t\tOperation: &sdlogger.Operation{\n\t\t\t\tID: s.genUniqueID(32), // correlate all global server logs together\n\t\t\t},\n\t\t}, nil),\n\t)\n\ts.Context = logging.SetLevel(s.Context, logging.Debug)\n\n\t// Skip writing the root request log entry on Serverless GCP since the load\n\t// balancer there writes the entry itself.\n\tswitch s.Options.Serverless {\n\tcase module.GAE:\n\t\t// Skip. GAE writes it to \"appengine.googleapis.com/request_log\" itself.\n\tcase module.CloudRun:\n\t\t// Skip. Cloud Run writes it to \"run.googleapis.com/requests\" itself.\n\tdefault:\n\t\t// Emit to stderr where Cloud Logging collectors pick it up.\n\t\ts.logRequestCB = func(_ context.Context, entry *sdlogger.LogEntry) { s.stderr.Write(entry) }\n\t}\n}", "title": "" }, { "docid": "c9b3b42f63246a6789eb644145ce21ee", "score": "0.5290906", "text": "func init() {\n\tlogger = config.Logger()\n\tlog = logger.WithFields(logrus.Fields{\"action\": \"Cluster\"})\n}", "title": "" }, { "docid": "5edb864b65d3cc73c9038650270917b4", "score": "0.52746797", "text": "func Logger(ctx context.Context) *BenchmarkLogger {\n\treturn ctx.Value(loggerkey).(*BenchmarkLogger)\n}", "title": "" }, { "docid": "4656454e1727f87567a17e28f23b8dd0", "score": "0.5260766", "text": "func (testDeps) StartTestLog(w io.Writer) {\n}", "title": "" }, { "docid": "43a9d27128024d8d958a535b5c8ee83d", "score": "0.5226641", "text": "func (mgr *ResourceManager) LogStats() {\n\n\tlog.Infof(\"----------------------------- Resource API Call Latencies (ms) \" +\n\t\t\"-----------------------------\")\n\tlog.Infof(\"%-50v %-10v %-10v %-10v %-10v\", \" \", \"median\", \"min\", \"max\", \"99%\")\n\tfor k, _ := range mgr.apiTimes {\n\t\tfor m, _ := range mgr.apiTimes[k] {\n\t\t\tsort.Slice(mgr.apiTimes[k][m],\n\t\t\t\tfunc(i, j int) bool { return mgr.apiTimes[k][m][i] < mgr.apiTimes[k][m][j] })\n\t\t\tmid := float32(mgr.apiTimes[k][m][len(mgr.apiTimes[k][m])/2]) / float32(time.Millisecond)\n\t\t\tmin := float32(mgr.apiTimes[k][m][0]) / float32(time.Millisecond)\n\t\t\tmax := float32(mgr.apiTimes[k][m][len(mgr.apiTimes[k][m])-1]) / float32(time.Millisecond)\n\t\t\tp99 := float32(mgr.apiTimes[k][m][len(mgr.apiTimes[k][m])-1-len(mgr.apiTimes[k][m])/100]) /\n\t\t\t\tfloat32(time.Millisecond)\n\t\t\tlog.Infof(\"%-50v %-10v %-10v %-10v %-10v\", m+\" \"+k+\" latency: \",\n\t\t\t\tmid, min, max, p99)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ed1faeb6c123cc16c3546b6410937acf", "score": "0.52257615", "text": "func logElapsedTime(startTime time.Time, dbFunc, method string, key string) {\n\telapsedTime := time.Since(startTime)\n\t//Max DB allowed delays to log db elapsed time as error log\n\tif elapsedTime.Milliseconds() > int64(cfg.GetTolelateLatencyMs()) {\n\t\tlog.Print(\"Exceeded db elapsed time for \", dbFunc, \" key= \", key, \" DB elapsed time:\", elapsedTime)\n\t} else {\n\t\t//log.Print(\"Elapsed time for \", dbFunc, \" key= \", key, \" DB elapsed time=\", elapsedTime)\n\n\t}\n}", "title": "" }, { "docid": "04f4d5f0ff3260380cf0b2bc1ddf6381", "score": "0.52252424", "text": "func (al AccessLogger) newLoggerForCall(ctx context.Context, fullMethodString string, start time.Time, timestampFormat string) context.Context {\n\tvar f = make([]zapcore.Field, 0, 5)\n\tf = append(f, zap.String(\"grpc.start_time\", start.Format(timestampFormat)))\n\tif d, ok := ctx.Deadline(); ok {\n\t\tf = append(f, zap.String(\"grpc.request.deadline\", d.Format(timestampFormat)))\n\t}\n\tif cl, ok := peer.FromContext(ctx); ok {\n\t\tf = append(f, zap.Any(\"peer.address\", cl.Addr.String()))\n\t}\n\tcallLog := &log.FieldCarrier{Fields: append(f, al.serverCallFields(fullMethodString)...)}\n\treturn log.NewIncomingContext(ctx, callLog)\n}", "title": "" }, { "docid": "caaf25912b765721ae8a277203b01276", "score": "0.52224284", "text": "func Metric(f func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\tlogger := logrus.New()\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\ttimeStart := int(time.Now().UnixNano())\n\t\tf(w, r)\n\t\tgo logger.WithField(\"duration\", int(time.Now().UnixNano())-timeStart).\n\t\t\tWithField(\"url\", r.URL.Path).\n\t\t\tPrint()\n\t}\n}", "title": "" }, { "docid": "3433fcca256f983a576d1333977eaf20", "score": "0.52047145", "text": "func reportPerformance(initial time.Time, latency time.Duration,\n\ttransferTime time.Duration, body []byte, path string,\n\trc int, oldRc string) {\n\tvar annotation = \"\"\n\n\tif oldRc != \"\" {\n\t\told, _ := strconv.Atoi(oldRc)\n\t\tif rc != old && old != 0 {\n\t\t\tannotation = fmt.Sprintf(\" expected=%d\", old)\n\t\t}\n\t}\n\tfmt.Printf(\"%s %f %f 0 %d %s %d GET %d %s\\n\",\n\t\tinitial.Format(\"2006-01-02 15:04:05.000\"),\n\t\tlatency.Seconds(), transferTime.Seconds(), len(body), path,\n\t\trc, OfferedRate, annotation)\n}", "title": "" }, { "docid": "96e9f79f409af034ca0efbebb06aa8e7", "score": "0.52004915", "text": "func StartupPerf(ctx context.Context, s *testing.State) {\n\tparam := s.Param().(testParameters)\n\tcfg := lacrosfixt.NewConfig(\n\t\tlacrosfixt.Selection(param.lacrosSelection),\n\t\tlacrosfixt.Mode(param.lacrosMode))\n\n\t// This is the page title used to connect in the browser, right after the initial login, is\n\t// performed. This same title will be used later, during the regular login, to test if browser\n\t// restore worked, after the UI is restarted.\n\tconst htmlPageTitle = `Hooray, this is a title!`\n\tserver := createHTMLServer(htmlPageTitle)\n\tdefer server.Close()\n\n\t// Connects to session_manager via D-Bus.\n\tsm, err := session.NewSessionManager(ctx)\n\tif err != nil {\n\t\ts.Fatal(\"Failed to connect session_manager: \", err)\n\t}\n\n\tvars := parseVars(s)\n\tif !vars.skipInitialLogin {\n\t\t// Start UI, open a browser and leave a window opened in 'server.URL'.\n\t\tif err = performInitialLogin(ctx, param.bt, vars.creds, cfg, s.OutDir(), s.HasError, server.URL); err != nil {\n\t\t\ts.Fatal(\"Failed to do initial login: \", err)\n\t\t}\n\t}\n\n\tif !vars.skipRegularLogin {\n\t\tpv := perf.NewValues()\n\t\tfor i := 0; i < vars.iterations; i++ {\n\t\t\ttesting.ContextLogf(ctx, \"StartupPerf: Running iteration %d/%d\", i+1, vars.iterations)\n\n\t\t\t// Start to collect data, restart UI, wait for browser window to be opened and get the\n\t\t\t// metrics.\n\t\t\tv, err := performRegularLogin(ctx, param.bt, vars.creds, cfg, s.OutDir(), s.HasError, sm, server.URL, htmlPageTitle)\n\t\t\tif err != nil {\n\t\t\t\ts.Error(\"Failed to do regular login: \", err)\n\t\t\t\t// keep on the next iteration in case of failure\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Record the metrics.\n\t\t\trecordStartupPerf(pv, \"login_time\", v.loginTime)\n\t\t\trecordStartupPerf(pv, \"window_restore_time\", v.windowRestoreTime)\n\t\t\trecordStartupPerf(pv, \"lacros_load_time\", v.lacrosLoadTime)\n\t\t\trecordStartupPerf(pv, \"lacros_start_time\", v.lacrosStartTime)\n\t\t}\n\n\t\tif err := pv.Save(s.OutDir()); err != nil {\n\t\t\ts.Fatal(\"Failed saving perf data: \", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c019c8143a2664cb2ff728450cf24ffe", "score": "0.5197427", "text": "func (ctx *AppContext) logState() {\n\tctx.Log.Info.Printf(\"%s %s SERVER PARAMETERS:\", utils.Use().GetStack(ctx.Instanciate), PROJECT)\n\tctx.Log.Info.Printf(\"%s IP: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetIP())\n\tctx.Log.Info.Printf(\"%s Port: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetPort())\n\tctx.Log.Info.Printf(\"%s Address: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetAddress())\n\tctx.Log.Info.Printf(\"%s %s FILE SYSTEM:\", utils.Use().GetStack(ctx.Instanciate), PROJECT)\n\tctx.Log.Info.Printf(\"%s RootDir: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Exe)\n\tctx.Log.Info.Printf(\"%s LogPaths: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Logpath)\n\tctx.Log.Info.Printf(\"%s\\t info: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.logpath[\"info\"])\n\tctx.Log.Info.Printf(\"%s\\t debug: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.logpath[\"debug\"])\n\tctx.Log.Info.Printf(\"%s\\t error: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.logpath[\"error\"])\n\tctx.Log.Info.Printf(\"%s\\t benchmark: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.logpath[\"benchmark\"])\n\tctx.Log.Info.Printf(\"%s %s DATABASE CONTEXT:\", utils.Use().GetStack(ctx.Instanciate), PROJECT)\n\tctx.Log.Info.Printf(\"%s Database asked: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetDatabaseType())\n\tif ctx.Opts.GetDatabaseType() == \"mongo\" {\n\t\tctx.Log.Info.Printf(\"%s Mongo server address: %s:%s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetMongoIP(), ctx.Opts.GetMongoPort())\n\t\tif ctx.Opts.GetMongoReplicatSet() {\n\t\t\tctx.Log.Info.Printf(\"%s Mongo replica address: %s:%s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetReplicatIP(), ctx.Opts.GetReplicatPort())\n\t\t}\n\t} else {\n\t\tctx.Log.Info.Printf(\"%s Bolt datapath: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetDatapath())\n\t}\n\tif ctx.Opts.GetEmbedES() {\n\t\tctx.Log.Info.Printf(\"%s %s ELASTICSEARCH CONTEXT:\", utils.Use().GetStack(ctx.Instanciate), PROJECT)\n\t\tctx.Log.Info.Printf(\"%s ElasticSearch server address: %s\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetEs())\n\t\tif ctx.Opts.GetAllowAsync() {\n\t\t\tctx.Log.Info.Printf(\"%s %s API allow asynchronous indexation on this instance\", utils.Use().GetStack(ctx.Instanciate), PROJECT)\n\t\t\tctx.Log.Info.Printf(\"%s %s API allow %d simultaneous goroutines used by server context\", utils.Use().GetStack(ctx.Instanciate), PROJECT, ctx.Opts.GetGorout())\n\t\t\tctx.Log.Info.Printf(\"%s asynchronous indexation expected batch size: %d\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetBatch())\n\t\t\tctx.Log.Info.Printf(\"%s maximum simultaneous pools of batch is hardcoded to 200\", utils.Use().GetStack(ctx.Instanciate))\n\t\t}\n\t\tif ctx.Opts.GetIndex() {\n\t\t\tctx.Log.Info.Printf(\"%s You are asking a creation of all indexes in esmapping folder\", utils.Use().GetStack(ctx.Instanciate))\n\t\t}\n\t\tif ctx.Opts.GetRmindex() {\n\t\t\tctx.Log.Info.Printf(\"%s You are asking the deletion of all indexes in esmapping folder\", utils.Use().GetStack(ctx.Instanciate))\n\t\t}\n\t\tif ctx.Opts.GetReindex() {\n\t\t\tctx.Log.Info.Printf(\"%s You are asking the deletion and creation of all indexes in esmapping folder\", utils.Use().GetStack(ctx.Instanciate))\n\t\t\tif ctx.Opts.GetAllowAsync() {\n\t\t\t\tctx.Log.Info.Printf(\"%s data will be pushed asynchronously by batch of %d in a limit of 200 pools\", utils.Use().GetStack(ctx.Instanciate), ctx.Opts.GetBatch())\n\n\t\t\t} else {\n\t\t\t\tctx.Log.Info.Printf(\"%s data will be pushed synchronously, elasticsearch indexation is 100x slower\", utils.Use().GetStack(ctx.Instanciate))\n\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f874f93564efbc0b39dc17af3f4587e", "score": "0.5196368", "text": "func init() {\n\tlogger = config.Initlog()\n\tinitCache()\n}", "title": "" }, { "docid": "18be1fca2c73439b4c6aabda45cbaf47", "score": "0.5185067", "text": "func init() {\n\t// Initialize the logger\n\tLogger = newLogger()\n\n\t// Set the output to be stdout in the normal case, but discard all log output in quiet mode\n\tif Quiet {\n\t\tLogger.SetOutput(ioutil.Discard)\n\t} else {\n\t\tLogger.SetOutput(os.Stdout)\n\t}\n\n\t// Disable timestamp logging, but still output the seconds elapsed\n\tLogger.SetFormatter(&log.TextFormatter{\n\t\tDisableTimestamp: false,\n\t\tFullTimestamp: false,\n\t})\n\n\t// Disable the stdlib's automatic add of the timestamp in beginning of the log message,\n\t// as we stream the logs from stdlib log to this logrus instance.\n\tgolog.SetFlags(0)\n\tgolog.SetOutput(Logger.Writer())\n}", "title": "" }, { "docid": "b953cebe080554797c40c4eeee72b5dd", "score": "0.51827294", "text": "func (m *metricApacheCPUTime) init() {\n\tm.data.SetName(\"apache.cpu.time\")\n\tm.data.SetDescription(\"Jiffs used by processes of given category.\")\n\tm.data.SetUnit(\"{jiff}\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(true)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "67ee07543937520d341cf27ea82abdb1", "score": "0.5181769", "text": "func Slowf(ctx context.Context, format string, v ...any) {\n\tgetLogger(ctx).Slowf(format, v...)\n}", "title": "" }, { "docid": "0c782641b65a0345cb99f4cbbea6e68f", "score": "0.5175656", "text": "func (app *App) logStats() {\n\n\tconst statsFormat = `\n Shaders: %d\n Vaos: %d\n Buffers: %d\n Textures: %d\n Uniforms/frame: %d\nDraw calls/frame: %d\n CGO calls/frame: %d\n`\n\tapp.log.Info(statsFormat,\n\t\tapp.stats.Glstats.Shaders,\n\t\tapp.stats.Glstats.Vaos,\n\t\tapp.stats.Glstats.Buffers,\n\t\tapp.stats.Glstats.Textures,\n\t\tapp.stats.Unisets,\n\t\tapp.stats.Drawcalls,\n\t\tapp.stats.Cgocalls,\n\t)\n}", "title": "" }, { "docid": "fae265b395f992e894f32ed40760603b", "score": "0.5153042", "text": "func timing(name string, start time.Time) {\n\tif Config.Verbose > 0 {\n\t\tlog.Printf(\"Function '%s' elapsed time: %v\\n\", name, time.Since(start))\n\t} else if name == \"main\" {\n\t\tlog.Printf(\"elapsed time: %v\\n\", time.Since(start))\n\t}\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.5143072", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "8328a6c1ca50e561a0619e3b5906512a", "score": "0.5143072", "text": "func init() {\n\tDisableLog()\n}", "title": "" }, { "docid": "72fee91873971da7ab313b304c59f226", "score": "0.5141848", "text": "func init() {\n\n\tformat = logging.MustStringFormatter(\n\t\t\"%{color}%{time:15:04:05.000} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}\",\n\t)\n\n\tlowLayerBackend = logging.NewLogBackend(os.Stderr, \"\", 0)\n\n\tDefaultBackend = &ModuleLeveled{\n\t\tlevels: make(map[string]logging.Level),\n\t\tBackend: logging.NewBackendFormatter(lowLayerBackend, format),\n\t}\n\tDefaultBackend.SetLevel(loggingDefaultLevel, \"\")\n\n\tlogging.SetBackend(DefaultBackend)\n\n}", "title": "" }, { "docid": "29cc1eb17aff5bfee88b81b9d45fd689", "score": "0.51373225", "text": "func init() {\n\tLog = FileLogger()\n}", "title": "" }, { "docid": "30823ba2136a3176594d8af8b469869c", "score": "0.5134661", "text": "func InitSummaryLogs() {\n\tif summarylogger != noplogger {\n\t\treturn\n\t}\n\tif len(logging.logDir) == 0 {\n\t\treturn\n\t}\n\t// creating log path\n\tif err := os.MkdirAll(logging.logDir, os.ModePerm); err != nil {\n\t\tfmt.Printf(\"create dir failed, err=%s\\n\", err.Error())\n\t\treturn\n\t}\n\tsummarylogger = zap.New(newSummaryFileCore()).WithOptions(zap.AddCallerSkip(1), zap.AddCaller())\n}", "title": "" }, { "docid": "7864e89bd164a49aadebf49d16081e21", "score": "0.5130654", "text": "func init() {\n\tl := simple.NewSimpleLogger()\n\tls := os.Getenv(\"LOGLEVEL\")\n\tll, err := strconv.ParseInt(ls, 10, 8)\n\tlogLevel := logi.Level(ll)\n\tif ll > int64(logi.BOUNDARY) || err != nil {\n\t\tlogLevel = logi.INFO\n\t}\n\tSetLevel = l.SetLevel\n\t// Debug(\"set log level\", logi.LevelCodes[logLevel])\n\tSetPrinter = l.SetPrinter\n\tTrace = l.Trace\n\tDebug = l.Debug\n\tInfo = l.Info\n\tWarn = l.Warn\n\tError = l.Error\n\tCheck = l.Check\n\tFatal = l.Fatal\n\tTracef = l.Tracef\n\tDebugf = l.Debugf\n\tInfof = l.Infof\n\tWarnf = l.Warnf\n\tErrorf = l.Errorf\n\tFatalf = l.Fatalf\n\tSetLevel(logLevel)\n\tTraces = func(txt interface{}) {\n\t\tl.Trace(spew.Sdump(txt))\n\t}\n\tDebugs = func(txt interface{}) {\n\t\tl.Debug(spew.Sdump(txt))\n\t}\n\tInfos = func(txt interface{}) {\n\t\tl.Info(spew.Sdump(txt))\n\t}\n\tWarns = func(txt interface{}) {\n\t\tl.Warn(spew.Sdump(txt))\n\t}\n\tErrors = func(txt interface{}) {\n\t\tl.Error(spew.Sdump(txt))\n\t}\n\tFatals = func(txt interface{}) {\n\t\tl.Fatal(spew.Sdump(txt))\n\t}\n}", "title": "" }, { "docid": "0848435fd228ee1745662e5de610a04f", "score": "0.51302975", "text": "func (m *mockDataStore) UseLog(l *log.Logger) {\n\tm.Called(l)\n}", "title": "" }, { "docid": "3013768f4739b82a729e25850d3c9188", "score": "0.512185", "text": "func BenchmarkLogitLoggerWithJsonAppender(b *testing.B) {\n\toptions := logit.Options()\n\n\tlogger := logit.NewLogger(\n\t\toptions.WithDebugLevel(),\n\t\toptions.WithAppender(appender.Json()),\n\t\toptions.WithWriter(ioutil.Discard),\n\t\toptions.WithTimeFormat(timeFormat),\n\t)\n\n\tlogTask := func() {\n\t\tlogger.Debug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Info(\"info...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Warn(\"warning...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Error(nil, \"error...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t}\n\n\tb.ReportAllocs()\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogTask()\n\t}\n}", "title": "" }, { "docid": "e4b862a53116a59ea8395ba899f0626e", "score": "0.5116709", "text": "func Log(t testingT) TestingT { return TestingT{helper: t.Helper, report: t.Log} }", "title": "" }, { "docid": "40a8a28f2025031ad67a61535f0a2cfb", "score": "0.50997686", "text": "func initLogging() {\n\tif cls := os.Getenv(\"AZURE_SDK_GO_LOGGING\"); cls == \"all\" {\n\t\t// cls could be enhanced to support a comma-delimited list of log events\n\t\tlog.lst = func(cls Event, msg string) {\n\t\t\t// simple console logger, it writes to stderr in the following format:\n\t\t\t// [time-stamp] Event: message\n\t\t\tfmt.Fprintf(os.Stderr, \"[%s] %s: %s\\n\", time.Now().Format(time.StampMicro), cls, msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "111224e0f1ca78f9860e164c2ab0e6e1", "score": "0.50961924", "text": "func init() {\n\tlog.SetFormatter(&log.TextFormatter{})\n\tlog.SetReportCaller(true)\n}", "title": "" }, { "docid": "06f2d4c44b2ec03abb2b98605425ab26", "score": "0.5083899", "text": "func (mp MetricsPoller) logMetrics() {\n\tlog.Printf(\"Logging metrics in MetricsPoller\")\n\n\ttimeNow := uint64(time.Now().Unix())\n\n\tmp.Nodes.statsLock.RLock()\n\tdefer mp.Nodes.statsLock.RUnlock()\n\n\tfor fuzzerID, fuzzerStats := range mp.Nodes.Stats {\n\t\t// Log execs_per_sec\n\t\ttags := map[string]string{\n\t\t\t\"fuzzer_id\": fuzzerID,\n\t\t}\n\t\ttypes.SubmitMetricGauge(\n\t\t\t\"fuzzer.execs_per_sec\",\n\t\t\tfloat32(fuzzerStats.ExecsPerSec),\n\t\t\ttags,\n\t\t)\n\n\t\t// Log secs since last update\n\t\tsecsSinceLastUpdate := timeNow - fuzzerStats.LastUpdate\n\t\ttypes.SubmitMetricGauge(\n\t\t\t\"fuzzer.secs_since_last_update\",\n\t\t\tfloat32(secsSinceLastUpdate),\n\t\t\ttags,\n\t\t)\n\n\t\t// Log secs since last path\n\t\tif fuzzerStats.LastPath > 0 {\n\t\t\tsecsSinceLastPath := fuzzerStats.LastUpdate - fuzzerStats.LastPath\n\t\t\ttypes.SubmitMetricGauge(\n\t\t\t\t\"fuzzer.secs_since_last_path\",\n\t\t\t\tfloat32(secsSinceLastPath),\n\t\t\t\ttags,\n\t\t\t)\n\t\t}\n\n\t\t// Log paths so we can max(paths) to have an idea on fuzzing progress\n\t\ttypes.SubmitMetricGauge(\n\t\t\t\"fuzzer.paths_total\",\n\t\t\tfloat32(fuzzerStats.PathsTotal),\n\t\t\ttags,\n\t\t)\n\t}\n\n\tlog.Printf(\"Successfully logged metrics in MetricsPoller n_fuzzers=%d\", len(mp.Nodes.Stats))\n}", "title": "" }, { "docid": "8e00d972ce9511aac51139db5383b2cc", "score": "0.50786686", "text": "func init() {\n\n\t// initialize logger\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)\n}", "title": "" }, { "docid": "1ae2a64864c37eaa6433dc4a32f3024f", "score": "0.5076466", "text": "func initLog(name string, conf *frmLogConf) *LogInstance {\n\t{\n\t\t// prepare a backup directory for legacy log\n\t\tfstat, err := os.Stat(backupDir)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tos.Mkdir(backupDir, 0755)\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Sprintf(\"failed check log backup directory - %q\", err))\n\t\t\t}\n\t\t}\n\t\tif err == nil && !fstat.IsDir() {\n\t\t\tpanic(fmt.Sprintf(\"failed check log backup directory - \"+\n\t\t\t\t\"%s is not a directory\", backupDir))\n\t\t}\n\t}\n\tlogobj := frmLogger{\n\t\tfrmLogConf: *conf,\n\t\tlogname: name,\n\t\tchanTerm: make(chan bool),\n\t}\n\tif err := logobj.renewlog(); err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to create Log handler - %q\", err))\n\t}\n\t//create cycle msg list\n\tflagExec := true\n\tmsgchan := make(chan *frmLogUnit, conf.QueueSize)\n\tctrchan := make(chan int)\n\t// log sender\n\tprocLog := func(level QLogLevel, msg string) {\n\t\tif !flagExec {\n\t\t\treturn\n\t\t}\n\t\tlogobj.lock.Lock()\n\t\tdefer logobj.lock.Unlock()\n\t\tif !flagExec { // double check\n\t\t\treturn\n\t\t}\n\t\tts := time.Now().Unix()\n\t\tmsgchan <- &frmLogUnit{level, msg, ts}\n\t}\n\t// log termnator\n\tprocTerm := func() {\n\t\tlogobj.lock.Lock()\n\t\tdefer logobj.lock.Unlock()\n\t\tif !flagExec {\n\t\t\treturn\n\t\t}\n\t\tflagExec = false\n\t\tclose(logobj.chanTerm)\n\t}\n\tgo loggerProc(&logobj, msgchan, ctrchan)\n\tgo loggerCtrl(&logobj, ctrchan)\n\treturn &LogInstance{procLog, procTerm}\n}", "title": "" }, { "docid": "9a5c43f1170d02a6267de28a4bec5566", "score": "0.5067903", "text": "func Trace(v ...interface{}) {\n\tpkgOperationsMutex.Lock()\n\tdefer pkgOperationsMutex.Unlock()\n\tCurrent.traceWithCallDepth(staticFuncCallDepth, newLogMessage(v))\n}", "title": "" }, { "docid": "ab934af00e0394d83ff79108c3effec2", "score": "0.5067304", "text": "func main() {\n\tportsArg := flag.String(\"ports\", \"4001,2379\", \"etcd listening ports\")\n\tiface := flag.String(\"iface\", \"eth0\", \"interface for sniffing traffic on\")\n\tpromisc := flag.Bool(\"promiscuous\", false, \"promiscuous mode\")\n\tperiod := flag.Uint(\"period\", 60, \"seconds between submissions\")\n\ttopK := flag.Uint(\"topk\", 10, \"submit stats for the top <K> sniffed paths\")\n\tprometheusPort := flag.Uint(\"prometheus-port\", 0, \"port for prometheus exporter to listen on\")\n\tflag.Parse()\n\n\tif *prometheusPort != 0 {\n\t\thttp.Handle(\"/metrics\", prometheus.UninstrumentedHandler())\n\t\tgo http.ListenAndServe(\":\"+strconv.Itoa(int(*prometheusPort)), nil)\n\t}\n\n\tnumCPU := runtime.NumCPU()\n\truntime.GOMAXPROCS(numCPU)\n\n\tms := loghisto.NewMetricSystem(time.Duration(*period)*time.Second, false)\n\tms.Start()\n\tmetricStream := make(chan *loghisto.ProcessedMetricSet, 2)\n\tms.SubscribeToProcessedMetrics(metricStream)\n\tdefer ms.UnsubscribeFromProcessedMetrics(metricStream)\n\n\tgo statPrinter(metricStream, *topK, *period)\n\n\tports := []uint16{}\n\tfor _, p := range strings.Split(*portsArg, \",\") {\n\t\tp, err := strconv.Atoi(p)\n\t\tif err == nil {\n\t\t\tports = append(ports, uint16(p))\n\t\t}\n\t}\n\n\th, err := pcap.Openlive(*iface, 1518, *promisc, 1000)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tdefer h.Close()\n\n\tportArray := strings.Split(*portsArg, \",\")\n\tdst := strings.Join(portArray, \" or dst port \")\n\tsrc := strings.Join(portArray, \" or src port \")\n\tfilter := fmt.Sprintf(\"tcp and (dst port %s or src port %s)\", dst, src)\n\tfmt.Println(\"using bpf filter: \", filter)\n\tif err := h.Setfilter(filter); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tunparsedPackets := make(chan *pcap.Packet, 10240)\n\tparsedPackets := make(chan *pcap.Packet, 10240)\n\tfor i := 0; i < 5; i++ {\n\t\tgo packetDecoder(unparsedPackets, parsedPackets)\n\t}\n\n\tprocessors := []chan *pcap.Packet{}\n\tfor i := 0; i < 50; i++ {\n\t\tp := make(chan *pcap.Packet, 10240)\n\t\tprocessors = append(processors, p)\n\t\tgo processor(ms, p)\n\t}\n\n\tgo streamRouter(ports, parsedPackets, processors)\n\n\tfor {\n\t\tpkt := h.Next()\n\t\tif pkt != nil {\n\t\t\tselect {\n\t\t\tcase unparsedPackets <- pkt:\n\t\t\tdefault:\n\t\t\t\tfmt.Println(\"SHEDDING IN MAIN\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f80963b7b45ef0bb3e51ae34aca72be2", "score": "0.5065429", "text": "func init() {\n\tMessageTimeout = 500 * time.Millisecond\n\tHealthTimeout = 10 * time.Millisecond\n\n\tif DefaultLogger == nil {\n\t\tlogrus.SetReportCaller(true)\n\t\tDefaultLogger = logrus.WithField(\"component\", \"core/pid\")\n\t} else {\n\t\tDefaultLogger = DefaultLogger.WithField(\"component\", \"core/pid\")\n\t}\n}", "title": "" }, { "docid": "1bc6ed24e72d19cbfe62113644b39928", "score": "0.5059267", "text": "func Latencyf(ctx context.Context, label string, format string, args ...interface{}) {\n\taelog.Infof(ctx, label+\" : \"+format, args...)\n}", "title": "" }, { "docid": "3a37f59a8ec779671a29c4d950f01b25", "score": "0.50488544", "text": "func BenchmarkLog(b *testing.B) {\n\tlogFunctions := []struct {\n\t\tname string\n\t\tfn func(float64) float64\n\t}{\n\t\t{\"e\", math.Log},\n\t\t{\"2\", math.Log2},\n\t\t{\"10\", math.Log10},\n\t}\n\n\tsizes := []int{1, 2, 10, 100, 1000}\n\n\tfor _, size := range sizes {\n\t\tb.Run(fmt.Sprint(size), func(b *testing.B) {\n\t\t\targ := 3 << size\n\t\t\tbase := 5 << size\n\t\t\tfor _, f := range logFunctions {\n\t\t\t\tb.Run(f.name, func(b *testing.B) {\n\t\t\t\t\tfor i := 0; i < b.N; i++ {\n\t\t\t\t\t\t_ = f.fn(float64(arg)) / f.fn(float64(base))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b115a3a093d89cc43b15fe9281515eed", "score": "0.50447416", "text": "func prepareLogs() {\n\tif args.verbose {\n\t\tverboseLog = log.New(os.Stdout, \"debug : \", 0)\n\t} else {\n\t\tverboseLog = log.New(ioutil.Discard, \"\", 0)\n\t}\n\tif args.veryVerbose {\n\t\tveryVerboseLog = log.New(os.Stdout, \"debug : \", 0)\n\t} else {\n\t\tveryVerboseLog = log.New(ioutil.Discard, \"\", 0)\n\t}\n}", "title": "" }, { "docid": "307639474ef80ebbeb771003b14afda0", "score": "0.5040788", "text": "func logger(format string, a ...interface{}) {\n\tfmt.Printf(\"HERO-SERVICE:\\t\"+format+\"\\n\", a...)\n}", "title": "" }, { "docid": "4ed5f906315c263d0dd9759a146d3402", "score": "0.5040729", "text": "func BenchmarkLoggerIsEnable(b *testing.B) {\n\tSetDriver(new(NilDriver))\n\tlog := GetLogger()\n\n\tb.ResetTimer()\n\tb.ReportAllocs()\n\tfor i := 0; i < b.N; i++ {\n\t\tlog.IsInfoEnabled()\n\t}\n}", "title": "" }, { "docid": "5c4689152adde7836e96ee75599f8aaa", "score": "0.5036556", "text": "func init() {\n\tswitch os.Getenv(\"LOG_LVL\") {\n\tcase \"TRACE\":\n\t\tshouldTrace = true\n\t\tfallthrough\n\tcase \"WARN\":\n\t\tshouldWarn = true\n\t}\n}", "title": "" }, { "docid": "97321718f6907b6c3d4215ff6245a589", "score": "0.5034942", "text": "func (r *Report) prettyPrintToConsole() {\n\n fmt.Printf(\"Concurrency Level: %d\\n\", r.ConcurrencyLevel)\n fmt.Printf(\"Time taken for tests: %.6fs \\n\", r.TimeTaken)\n\n fmt.Printf(\"Complete requests: %d\\n\", r.CompletedRequests)\n fmt.Printf(\"Failed requests: %d\\n\", r.FailedRequests)\n fmt.Printf(\"Success Rate: %.2f %% \\n\", r.SuccessRate * 100)\n\n fmt.Printf(\"Total sent: %d bytes\\n\", r.TotalSentBytes)\n fmt.Printf(\"Total received: %d bytes\\n\", r.TotalReceivedBytes)\n fmt.Printf(\"Total transferred: %d bytes\\n\", r.TotalTransferred)\n fmt.Printf(\"Transfer rate: %.3f bytes/s (mean)\\n\", r.TransferRate)\n\n fmt.Printf(\"Requests per second: %.3f (mean)\\n\", r.RequestPerSecond)\n fmt.Printf(\"Time per request: %.3fms (mean)\\n\", r.TimePerRequest * 1000)\n fmt.Printf(\"Time per request concurrency: %.3fms (mean)\\n\", r.TimePerRequestConcurrency * 1000)\n fmt.Printf(\"Latency(min,mean,max): %.3fms, %.3fms ,%.3fms \\n\", r.MinLatency * 1000, r.MeanLatency * 1000, r.MaxLatency * 1000)\n\n}", "title": "" }, { "docid": "8a048cf3cd64981d5646129bf08e9aef", "score": "0.5025537", "text": "func BenchmarkLogitLoggerWithTextAppender(b *testing.B) {\n\toptions := logit.Options()\n\n\tlogger := logit.NewLogger(\n\t\toptions.WithDebugLevel(),\n\t\toptions.WithAppender(appender.Text()),\n\t\toptions.WithWriter(ioutil.Discard),\n\t\toptions.WithTimeFormat(timeFormat),\n\t)\n\n\tlogTask := func() {\n\t\tlogger.Debug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Info(\"info...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Warn(\"warning...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Error(nil, \"error...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t}\n\n\tb.ReportAllocs()\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogTask()\n\t}\n}", "title": "" }, { "docid": "c40954bc3c62c6adb814fac716d8d4e7", "score": "0.5015877", "text": "func init() {\n\t// Initialize logger\n\tbackend := logging.NewLogBackend(os.Stdout, \"\", 0)\n\tformat := logging.MustStringFormatter(\"%{color}%{time:15:04:05.000} %{module}.%{shortfunc}() ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}\")\n\tbackendFormatter := logging.NewBackendFormatter(backend, format)\n\tlogging.SetBackend(backendFormatter)\n\tlogger = logging.MustGetLogger(\"Notificator\")\n\tlogging.SetLevel(logging.DEBUG, \"Notificator\")\n\n\tlogger.Info(\"Initialized logging\")\n}", "title": "" }, { "docid": "177e4cfa12d93d49421132fb0ed353bd", "score": "0.50127685", "text": "func (c *ConfigLocal) GetPerfLog() logger.Logger {\n\tperfLog := c.kbCtx.GetPerfLog()\n\tif perfLog != nil {\n\t\treturn perfLog\n\t}\n\treturn c.MakeLogger(\"\")\n}", "title": "" }, { "docid": "185e80ca5928b9c7d32659ccc73705f5", "score": "0.50097734", "text": "func ServiceLog(ctx context.Context, param, request, response interface{}, err error) Logger {\n\treturn &logger{f: serviceLog(ctx, param, request, response, err)}\n}", "title": "" }, { "docid": "b3f844b0bce21dfe83e1a29ebf7bdce1", "score": "0.50070935", "text": "func Sloww(ctx context.Context, msg string, fields ...LogField) {\n\tgetLogger(ctx).Sloww(msg, fields...)\n}", "title": "" }, { "docid": "9b3eb1456a072d21b9ac15181aa1aa82", "score": "0.500002", "text": "func init() {\n\t//Register the metrics collectors you want to use\n\tregistry.MustRegister(collectors...)\n}", "title": "" }, { "docid": "b8d0f0bc2680f9afe634f09862efcbc1", "score": "0.49980673", "text": "func (s *service) logStatistics() {\n\tif s.statisticsCounter = s.statisticsCounter + 1; (s.statisticsCounter % 100) == 0 {\n\t\tgoroutines := runtime.NumGoroutine()\n\t\tmemstats := new(runtime.MemStats)\n\t\truntime.ReadMemStats(memstats)\n\t\tfields := map[string]interface{}{\n\t\t\t\"GoRoutines\": goroutines,\n\t\t\t\"HeapAlloc\": memstats.HeapAlloc,\n\t\t\t\"HeapReleased\": memstats.HeapReleased,\n\t\t\t\"StackSys\": memstats.StackSys,\n\t\t}\n\t\tLog.WithFields(fields).Infof(\"resource statistics counter: %d\", s.statisticsCounter)\n\t}\n}", "title": "" }, { "docid": "76f27d8db7296768713bcb59fc4f83f8", "score": "0.4997948", "text": "func useLogger(logger seelog.LoggerInterface) {\n\tlog = logger\n}", "title": "" }, { "docid": "bbb98b1c9c5292e9b5adccc57149c620", "score": "0.49855882", "text": "func Init() {\n\tlog.Formatter = new(logrus.JSONFormatter)\n\n\tif env := os.Getenv(\"APP_ENV\"); env == \"test\" {\n\t\tf, e := os.Create(\"../../tests.log\")\n\t\tif e != nil {\n\t\t\tlog.Fatal(\"Failed to create log file for whilst tests are running\")\n\t\t}\n\t\tlog.Out = f\n\t}\n\n\tif env := os.Getenv(\"APP_ENV\"); env != \"test\" {\n\t\thook := NewStatsDHook()\n\t\tlog.Hooks.Add(hook)\n\t}\n}", "title": "" }, { "docid": "bea96490e6abd85b9e0953229ad8fccd", "score": "0.49745286", "text": "func Use(logger Logger) {\n\tif logger == nil {\n\t\treturn\n\t}\n\tl0 = logger\n\tl1 = l0.AddCallerSkip(1)\n}", "title": "" }, { "docid": "252eeb24890d77ab286769c6a50fbef4", "score": "0.4970291", "text": "func init() {\n\tregisterMetrics()\n}", "title": "" }, { "docid": "8f81586bdecaf69627e910a349a53c9b", "score": "0.4967113", "text": "func Init(conf *Configuration) {\n\tl := logrus.New()\n\tl.SetReportCaller(true)\n\tl.Formatter = &logrus.TextFormatter{\n\t\tCallerPrettyfier: func(f *runtime.Frame) (string, string) {\n\t\t\tfilename := path.Base(f.File)\n\t\t\treturn fmt.Sprintf(\"%s:%d\", filename, f.Line), \" [API SERVICE]\"\n\t\t},\n\t\tTimestampFormat: conf.TimestampFormat,\n\t\tDisableLevelTruncation: conf.DisableLevelTruncation,\n\t\tDisableColors: conf.DisableColors,\n\t\tFullTimestamp: conf.FullTimestamp,\n\t\tForceColors: conf.ForceColors,\n\t}\n\n\terr := os.MkdirAll(LogDir, DirPermission)\n\n\tif err != nil || os.IsExist(err) {\n\t\tpanic(\"can't create log dir. no configured logging to files\")\n\t} else {\n\n\t\tinfoFileHook, _ := rotatefilehook.NewRotateFileHook(rotatefilehook.RotateFileConfig{\n\t\t\tFilename: fmt.Sprintf(conf.Filename, FileName),\n\t\t\tMaxSize: conf.MaxSize, // megabytes\n\t\t\tMaxBackups: conf.MaxBackups,\n\t\t\tMaxAge: conf.MaxAge, //days\n\t\t\tLevel: conf.Level,\n\t\t\tFormatter: &logrus.JSONFormatter{\n\t\t\t\tCallerPrettyfier: func(f *runtime.Frame) (string, string) {\n\t\t\t\t\tfilename := path.Base(f.File)\n\t\t\t\t\treturn fmt.Sprintf(\"%s:%d\", filename, f.Line), ServiceHider\n\t\t\t\t},\n\t\t\t\tTimestampFormat: conf.TimestampFormat,\n\t\t\t\tFieldMap: logrus.FieldMap{\n\t\t\t\t\tlogrus.FieldKeyTime: TimeFieldKey,\n\t\t\t\t\tlogrus.FieldKeyMsg: MessageFieldKey,\n\t\t\t\t\tlogrus.FieldKeyFile: FileFieldKey,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tl.AddHook(infoFileHook)\n\t}\n\n\tl.SetLevel(logrus.TraceLevel)\n\tlogrus.SetOutput(colorable.NewColorableStdout())\n\n\te = logrus.NewEntry(l)\n}", "title": "" }, { "docid": "3ca9822a877f73b863a5971d5b0763f6", "score": "0.496391", "text": "func init() {\n\n\tlogDir := \"./\"\n\n\tlogfile := path.Join(logDir, \"dadaAPI\")\n\tfsWriter, err := rotatelogs.New(\n\t\tlogfile+\"_%Y-%m-%d.log\",\n\t\trotatelogs.WithMaxAge(time.Duration(168)*time.Hour),\n\t\trotatelogs.WithRotationTime(time.Duration(24)*time.Hour),\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmultiWriter := io.MultiWriter(fsWriter, os.Stdout)\n\tlog.SetReportCaller(true)\n\n\tlog.SetFormatter(&nested.Formatter{\n\t\tTimestampFormat: \"2006-01-02 15:04:05\",\n\t})\n\n\t// log.SetOutput(ansicolor.NewAnsiColorWriter(multiWriter))\n\tlog.SetOutput(multiWriter)\n\tlog.SetLevel(log.InfoLevel)\n}", "title": "" }, { "docid": "f6c284bcdebd8083b9477721009a8a4d", "score": "0.49464816", "text": "func UseTraceLog() {\n\tLogger.Level = dlog.TraceLevel\n\tlog.Trace(\"use trace logging\")\n}", "title": "" }, { "docid": "c00437e8d425b8c063f807d1da4fb46e", "score": "0.49382925", "text": "func init() {\n\tconf = zap.NewProductionConfig()\n\tconf.Level = glevel\n\tconf.DisableStacktrace = true\n\tconf.EncoderConfig.EncodeTime = zapcore.TimeEncoderOfLayout(timeLayout)\n\t// conf.OutputPaths = append(conf.OutputPaths, \"server.log\")\n\n\tlogger, _ = conf.Build(zap.AddCaller(), zap.AddCallerSkip(1))\n\tsugar = logger.Sugar()\n}", "title": "" }, { "docid": "b3038aadd20d246d380746c9d915ad52", "score": "0.4935141", "text": "func (srv *Srv) log(enabled bool, v ...interface{}) {\n\tLog := _drv.Cfg().Log\n\tif !Log.IsEnabled(enabled) {\n\t\treturn\n\t}\n\tif len(v) == 0 {\n\t\tLog.Logger.Infof(\"%v %v\", srv.sysName(), callInfo(1))\n\t} else {\n\t\tLog.Logger.Infof(\"%v %v %v\", srv.sysName(), callInfo(1), fmt.Sprint(v...))\n\t}\n}", "title": "" }, { "docid": "6fe648db3e2cc1629252831362d6b418", "score": "0.49336788", "text": "func init() {\n\tlog.SetFlags(log.LstdFlags | log.Lmicroseconds | log.Lshortfile)\n\tlog.SetOutput(os.Stdout)\n}", "title": "" }, { "docid": "23aab89a42063d14b0a049fb765afa1d", "score": "0.49325433", "text": "func BenchmarkLogitFileWithoutBuffer(b *testing.B) {\n\tfile, _ := createFileOf(filepath.Join(b.TempDir(), b.Name()))\n\tdefer file.Close()\n\n\toptions := logit.Options()\n\tlogger := logit.NewLogger(\n\t\toptions.WithDebugLevel(),\n\t\toptions.WithAppender(appender.Text()),\n\t\toptions.WithWriter(file),\n\t\toptions.WithTimeFormat(timeFormat),\n\t)\n\n\tlogTask := func() {\n\t\tlogger.Debug(\"debug...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Info(\"info...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Warn(\"warning...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t\tlogger.Error(nil, \"error...\").String(\"trace\", \"xxx\").Int(\"id\", 123).Float64(\"pi\", 3.14).Log()\n\t}\n\n\tb.ReportAllocs()\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tlogTask()\n\t}\n}", "title": "" }, { "docid": "974a3e400043c9f1d979a2544c1e2e23", "score": "0.49308208", "text": "func init() {\n\tlog.SetPrefix(\"TRACE: \")\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)\n}", "title": "" }, { "docid": "7a49f3eac38621f49c1cd08816e35ec3", "score": "0.49306208", "text": "func (lc mockCryptoLogger) Warn(msg string, args ...interface{}) {\n}", "title": "" }, { "docid": "914108027e4995c47050a790a67a600f", "score": "0.49292764", "text": "func InitLogging(logPath string) {}", "title": "" }, { "docid": "0903317c7c826bd3f9a443c9f19baa2b", "score": "0.49290192", "text": "func RecordLatency(tags map[string]string, d time.Duration) {\n\tname := \"handler.latency\"\n\tname = addTagsToName(name, tags)\n\tif os.Getenv(\"STATS\") == \"on\" {\n\t\tfmt.Printf(\"RecordLatency: %v = %v\\n\", name, d)\n\t}\n}", "title": "" }, { "docid": "5ebe1c999abeb891ef0da3334c4fb09a", "score": "0.49277908", "text": "func (ctx *AppContext) defineLogSystem(opts IServerOption) (io.Writer, io.Writer, io.Writer, io.Writer) {\n\t// open files for log and benchmarking\n\tctx.logpath = make(map[string]string)\n\tctx.logpath[\"info\"] = PROJECT + \"_info.log\"\n\tctx.logpath[\"debug\"] = PROJECT + \"_debug.log\"\n\tctx.logpath[\"error\"] = PROJECT + \"_error.log\"\n\tctx.logpath[\"benchmark\"] = PROJECT + \"_benchmark.log\"\n\tinfoFile, err := os.OpenFile(\n\t\tfilepath.Join(opts.GetLogpath(), ctx.logpath[\"info\"]),\n\t\tos.O_RDWR|os.O_CREATE|os.O_APPEND,\n\t\t0666)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening file: %v\", err)\n\t}\n\tdebugFile, err := os.OpenFile(\n\t\tfilepath.Join(opts.GetLogpath(), ctx.logpath[\"debug\"]),\n\t\tos.O_RDWR|os.O_CREATE|os.O_APPEND,\n\t\t0666)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening file: %v\", err)\n\t}\n\terrorFile, err := os.OpenFile(\n\t\tfilepath.Join(opts.GetLogpath(), ctx.logpath[\"error\"]),\n\t\tos.O_RDWR|os.O_CREATE|os.O_APPEND,\n\t\t0666)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening file: %v\", err)\n\t}\n\tbenchmarkFile, err := os.OpenFile(\n\t\tfilepath.Join(opts.GetExeFolder(), \"benchmark\", ctx.logpath[\"benchmark\"]),\n\t\tos.O_RDWR|os.O_CREATE|os.O_APPEND,\n\t\t0666)\n\tif err != nil {\n\t\tlog.Fatalf(\"error opening file: %v\", err)\n\t}\n\t// we define an output able to log on file and standart output\n\tinfo := io.MultiWriter(infoFile, os.Stdout)\n\terrOut := io.MultiWriter(errorFile, infoFile, os.Stdout)\n\tdebug := io.MultiWriter(os.Stdout)\n\tif opts.GetDebug() {\n\t\tdebug = io.MultiWriter(debugFile, infoFile, os.Stdout)\n\t}\n\tbenchmark := io.MultiWriter(benchmarkFile, os.Stdout)\n\treturn info, errOut, debug, benchmark\n}", "title": "" }, { "docid": "2debe9ce611744463d4b3932723ca64c", "score": "0.49216157", "text": "func init() {\n\tvar err error\n\tlog, err = zap.NewProduction(zap.AddCallerSkip(1))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4bf1fea06e8ad5790480d17e36859425", "score": "0.49114823", "text": "func printStat() {\n\tstart := time.Now()\n\tticker := time.NewTicker(5 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase ci := <-reqCh:\n\t\t\treqCnt += ci\n\t\t\tif reqCnt%10 == 0 {\n\t\t\t\tfmt.Println(\" ReqCnt : \", reqCnt, \" Time taken=\", time.Since(start))\n\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tfmt.Println(\" ReqCnt : \", reqCnt, \" Time taken=\", time.Since(start))\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "489d9538ce00a9d1df4d484aef226efe", "score": "0.49031976", "text": "func logDepth(ctx context.Context, depth int, sev Severity, format string, args []interface{}) {\n\t// TODO(tschottdorf): logging hooks should have their entry point here.\n\taddStructured(ctx, sev, depth+1, format, args)\n}", "title": "" }, { "docid": "c4df3ec71ec9581da256769c73fe0d9f", "score": "0.48994297", "text": "func (d *deviceCommon) init(inst instance.Instance, state *state.State, name string, conf deviceConfig.Device, volatileGet VolatileGetter, volatileSet VolatileSetter) {\n\tlogCtx := logger.Ctx{\"driver\": conf[\"type\"], \"device\": name}\n\tif inst != nil {\n\t\tlogCtx[\"project\"] = inst.Project().Name\n\t\tlogCtx[\"instance\"] = inst.Name()\n\t}\n\n\td.logger = logger.AddContext(logCtx)\n\td.inst = inst\n\td.name = name\n\td.config = conf\n\td.state = state\n\td.volatileGet = volatileGet\n\td.volatileSet = volatileSet\n}", "title": "" } ]
2824172481e0e59e2f084944d7a2e304
IsValid returns whether the move is valid.
[ { "docid": "6b94beac475dbf14a53cb9a63cfc9727", "score": "0.72395253", "text": "func (m Move) IsValid(b Board) bool {\n\treturn b[m.R][m.C] == Empty\n}", "title": "" } ]
[ { "docid": "c6a2e4b23c98b09de9923939a1651a5b", "score": "0.7024879", "text": "func (g *State) Validate(m *Move) bool {\n\tif m.Pass {\n\t\treturn true\n\t}\n\tcurrent := g.Board()\n\tnext, _, err := current.Play(m.Coords[0], m.Coords[1], g.Next)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn !g.History.Ko(next)\n}", "title": "" }, { "docid": "2af00e2ea35a1ebbc45595f871b49d57", "score": "0.6775296", "text": "func validMove(r, c int) bool {\n\treturn r >= 0 && r < row && c >= 0 && c < col\n}", "title": "" }, { "docid": "d39faeb02b4206084820eccd321e8337", "score": "0.66260827", "text": "func (pos *Position) IsValid() bool { return pos.Line > 0 }", "title": "" }, { "docid": "afd8250be27ae152c9ba4da582019de8", "score": "0.63419074", "text": "func (m *FileMove) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDestination(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFailure(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFilesToMove(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReference(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateScanner(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSource(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSvm(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVolume(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4d4679f174232d0297dc839bfb2a7388", "score": "0.6288852", "text": "func (g *State) CanMove(p string) bool {\n\tswitch g.Next {\n\tcase BlackStone:\n\t\treturn g.isPlayerBlack(p)\n\tcase WhiteStone:\n\t\treturn g.isPlayerWhite(p)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b551eb156c2577faf5c3d61d31b022e9", "score": "0.6269706", "text": "func (p FilePos) IsValid() bool {\n\treturn p.Line > 0\n}", "title": "" }, { "docid": "4cdabc94eca345cfa88c8e6921344786", "score": "0.6214387", "text": "func (nb *Board) validMove(from, to Vector2d) *Vector2d {\n\tpieceFrom, pieceTo := nb.board[from.y][from.x], nb.board[to.y][to.x]\n\tif pieceTo == nil {\n\t\treturn &to\n\t} else {\n\t\tposMove := pieceFrom.canTake(pieceTo)\n\t\tif posMove != nil && nb.board[posMove.y][posMove.x] == nil {\n\t\t\treturn posMove\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abf86965dd35cf2e3f6dc5084ad74e01", "score": "0.6189565", "text": "func CheckMove(b board.IBoard, workerPos, targetPos board.Pos) bool {\n\tworkerTile, err := b.TileAt(workerPos)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\ttargetTile, err := b.TileAt(targetPos)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tvalidMove := true\n\tfor _, rule := range moveRules {\n\t\t// if !rule(build) {\n\t\t// \tfmt.Printf(\"BUILD RULE BROKEN: %v\\n\", idx)\n\t\t// }\n\t\tvalidMove = validMove && rule(b, workerTile, targetTile)\n\t}\n\treturn validMove\n}", "title": "" }, { "docid": "0d5a0c8673ae4d5bba4c02a92a5fcde5", "score": "0.61693114", "text": "func (m *Movie) IsValid() bool {\n\tif m.Name == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b0042b9356935ab890f62ec8e6d05ada", "score": "0.6102805", "text": "func (g *Grid) Valid(p Coord) bool {\n\treturn p.Y >= 0 && p.Y < len(g.cells) && p.X >= 0 && p.X < len(g.cells[0])\n}", "title": "" }, { "docid": "651149dcb96b93c20972e22b2027e238", "score": "0.6072993", "text": "func (l SourceLocation) IsValid() bool {\n\treturn l.File != \"\" && l.Line > 0\n}", "title": "" }, { "docid": "228c4ea16aec63f40a2a5aabf29c3f1f", "score": "0.6051917", "text": "func (grid *BattleGrid) directionValid(locX int, locY int, cardinal int, gridId int) bool {\n\tvar newX, newY int\n\n\t//fmt.Printf(\"loc is %v %v %s \\n\", locX, locY, grid.grid[locX][locY])\n\t//fmt.Printf(\"card is %v \", cardinal)\n\n\tnewX = locX\n\tnewY = locY\n\n\tnewX, newY = getXYFromCardinal(newX, newY, cardinal)\n\n\tif newX < 0 || newY < 0 {\n\t\treturn false\n\t}\n\n\tvar tgrid Grid = grid.getEntityGrid(gridId)\n\n\tif newX > tgrid.maxY || newY > tgrid.maxX {\n\t\treturn false\n\t}\n\n\t// check for character collisions\n\tif cardinal != STAY {\n\t\tif gridId == grid.charGridId && newX == grid.charXLoc && newY == grid.charYLoc {\n\t\t\treturn false\n\t\t} else if grid.hasApprentice && gridId == grid.appGridId && newX == grid.appXLoc && newY == grid.appYLoc {\n\t\t\treturn false\n\t\t} else if gridId == grid.monsterGridId && newX == grid.monsterXLoc && newY == grid.monsterYLoc {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif grid.isPassable(tgrid.grid[newY][newX]) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d24a8c9b6817a07d792ebf33ea9936fc", "score": "0.6015221", "text": "func (k *Knight) ValidMoves(pcs []Piece) []location.Location {\n\tbearings := []bearing{\n\t\t{Row: -1, Col: 2},\n\t\t{Row: 1, Col: 2},\n\t\t{Row: 2, Col: 1},\n\t\t{Row: 2, Col: -1},\n\t\t{Row: 1, Col: -2},\n\t\t{Row: -1, Col: -2},\n\t\t{Row: -2, Col: -1},\n\t\t{Row: -2, Col: 1},\n\t}\n\n\tcurrentRow := k.loc.GetRow()\n\tcurrentCol := k.loc.GetCol()\n\n\tvar validMoves []location.Location\n\tvar loc location.Location\n\n\tfor _, b := range bearings {\n\t\tloc = location.Location{\n\t\t\tRow: currentRow + b.Row,\n\t\t\tCol: currentCol + b.Col,\n\t\t}\n\t\t// check if valid location\n\t\tif isValidLocation(loc) {\n\t\t\t// check if location is vacant or occupied by opponent\n\t\t\tif !isLocationOccupied(loc, pcs) || isLocationOccupiedByOpponent(loc, k.Color(), pcs) {\n\t\t\t\tvalidMoves = append(validMoves, loc)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn validMoves\n}", "title": "" }, { "docid": "d95f16ff6daa9aa420c61f5183f5dec2", "score": "0.6006687", "text": "func (this *Instance) CanMove() (bool, error) {\n\tif !this.IsLastCheckValid {\n\t\treturn false, fmt.Errorf(\"%+v: last check invalid\", this.Key)\n\t}\n\tif !this.IsRecentlyChecked {\n\t\treturn false, fmt.Errorf(\"%+v: not recently checked\", this.Key)\n\t}\n\tif !this.ReplicationSQLThreadState.IsRunning() {\n\t\treturn false, fmt.Errorf(\"%+v: instance is not replicating\", this.Key)\n\t}\n\tif !this.ReplicationIOThreadState.IsRunning() {\n\t\treturn false, fmt.Errorf(\"%+v: instance is not replicating\", this.Key)\n\t}\n\tif !this.SecondsBehindMaster.Valid {\n\t\treturn false, fmt.Errorf(\"%+v: cannot determine replication lag\", this.Key)\n\t}\n\tif !this.HasReasonableMaintenanceReplicationLag() {\n\t\treturn false, fmt.Errorf(\"%+v: lags too much\", this.Key)\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "6501c428e45dee60b591f6877b020ab8", "score": "0.5994776", "text": "func IsValid(x, y int) bool {\n\tif x < 0 || x >= boardSize {\n\t\treturn false\n\t}\n\tif y < 0 || y >= boardSize {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a1f01bf44c037bb92cbc214511ef63b2", "score": "0.59643704", "text": "func (field *Field) CanMove(move MoveType) bool {\r\n\tswitch move {\r\n\tcase UP:\r\n\t\tif field.canMoveTo(playerPos.x, playerPos.y+1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\tcase LEFT:\r\n\t\tif field.canMoveTo(playerPos.x-1, playerPos.y) {\r\n\t\t\treturn true\r\n\t\t}\r\n\tcase DOWN:\r\n\t\tif field.canMoveTo(playerPos.x, playerPos.y-1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\tcase RIGHT:\r\n\t\tif field.canMoveTo(playerPos.x+1, playerPos.y) {\r\n\t\t\treturn true\r\n\t\t}\r\n\tcase PASS:\r\n\t\treturn true\r\n\tdefault:\r\n\t\tfmt.Fprintln(os.Stderr, errorStr+\"Trying to move to unhandled location. Detail:\", move)\r\n\t}\r\n\treturn false\r\n}", "title": "" }, { "docid": "feeef1f7ec0782b9e848566f0c50b2e8", "score": "0.5962428", "text": "func (l SensorLoc) IsValid() bool {\n\tswitch l {\n\tcase SensorLocNone,\n\t\tSensorLocPowerButtonTopLeft,\n\t\tSensorLocKeyboardBottomLeft,\n\t\tSensorLocKeyboardBottomRight,\n\t\tSensorLocKeyboardTopRight,\n\t\tSensorLocRightSide,\n\t\tSensorLocLightSide,\n\t\tSensorLocLeftOfPowerButtonTopRight:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "67be824b617096231ee50503084391d8", "score": "0.5961707", "text": "func (s SplitState) IsValid() bool {\n\tswitch s {\n\tcase SplitDone, SplitRunning:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "c34c1ff325ae1409f39b7cb561c4f467", "score": "0.59257704", "text": "func (tile *Tile) IsValid() bool {\n\tif tile.Zoom > 32 || tile.Zoom < 0 {\n\t\treturn false\n\t}\n\tworldTileSize := int(1) << tile.Zoom\n\tif tile.X < 0 || tile.X >= worldTileSize ||\n\t\ttile.Y < 0 || tile.Y >= worldTileSize {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5f5c47f8f3eb05e5bbd74027e1f6149d", "score": "0.5887275", "text": "func (pos *Position) IsPseudoLegal(m Move) bool {\n\tif m == NullMove ||\n\t\tm.SideToMove() != pos.SideToMove ||\n\t\tpos.Get(m.From()) != m.Piece() ||\n\t\tpos.Get(m.CaptureSquare()) != m.Capture() ||\n\t\tm.Piece().Color() == m.Capture().Color() {\n\t\treturn false\n\t}\n\n\tif m.Piece().Figure() == Pawn {\n\t\t// Pawn move is tested above. Promotion is always correct.\n\t\tif m.MoveType() == Enpassant && !pos.IsEnpassantSquare(m.To()) {\n\t\t\treturn false\n\t\t}\n\t\tif BbPawnStartRank.Has(m.From()) && BbPawnDoubleRank.Has(m.To()) && !pos.IsEmpty((m.From()+m.To())/2) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\tif m.Piece().Figure() == Knight {\n\t\t// Knight move is tested above. Knight jumps around.\n\t\treturn true\n\t}\n\n\t// Quick test of queen's attack on an empty board.\n\tsq := m.From()\n\tto := m.To().Bitboard()\n\tif bbSuperAttack[sq]&to == 0 {\n\t\treturn false\n\t}\n\n\tall := pos.ByColor[White] | pos.ByColor[Black]\n\n\tswitch m.Piece().Figure() {\n\tcase Pawn: // handled aove\n\t\tpanic(\"unreachable\")\n\tcase Knight: // handled above\n\t\tpanic(\"unreachable\")\n\tcase Bishop:\n\t\treturn to&BishopMobility(sq, all) != 0\n\tcase Rook:\n\t\treturn to&RookMobility(sq, all) != 0\n\tcase Queen:\n\t\treturn to&QueenMobility(sq, all) != 0\n\tcase King:\n\t\tif m.MoveType() == Normal {\n\t\t\treturn to&bbKingAttack[sq] != 0\n\t\t}\n\n\t\t// m.MoveType() == Castling\n\t\tif m.SideToMove() == White && m.To() == SquareG1 {\n\t\t\tif pos.CastlingAbility()&WhiteOO == 0 ||\n\t\t\t\t!pos.IsEmpty(SquareF1) || !pos.IsEmpty(SquareG1) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif m.SideToMove() == White && m.To() == SquareC1 {\n\t\t\tif pos.CastlingAbility()&WhiteOOO == 0 ||\n\t\t\t\t!pos.IsEmpty(SquareB1) ||\n\t\t\t\t!pos.IsEmpty(SquareC1) ||\n\t\t\t\t!pos.IsEmpty(SquareD1) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif m.SideToMove() == Black && m.To() == SquareG8 {\n\t\t\tif pos.CastlingAbility()&BlackOO == 0 ||\n\t\t\t\t!pos.IsEmpty(SquareF8) ||\n\t\t\t\t!pos.IsEmpty(SquareG8) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif m.SideToMove() == Black && m.To() == SquareC8 {\n\t\t\tif pos.CastlingAbility()&BlackOOO == 0 ||\n\t\t\t\t!pos.IsEmpty(SquareB8) ||\n\t\t\t\t!pos.IsEmpty(SquareC8) ||\n\t\t\t\t!pos.IsEmpty(SquareD8) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\trook, start, end := CastlingRook(m.To())\n\t\tif pos.Get(start) != rook {\n\t\t\treturn false\n\t\t}\n\t\tthem := m.SideToMove().Opposite()\n\t\tif pos.GetAttacker(m.From(), them) != NoFigure ||\n\t\t\tpos.GetAttacker(end, them) != NoFigure ||\n\t\t\tpos.GetAttacker(m.To(), them) != NoFigure {\n\t\t\treturn false\n\t\t}\n\tdefault:\n\t\tpanic(\"unreachable\")\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "59ab7d245c82c90b5ad3a8d540a80ae7", "score": "0.5778122", "text": "func (b *Board) GetIsValid() bool {\n\tif b == nil || b.IsValid == nil {\n\t\treturn false\n\t}\n\treturn *b.IsValid\n}", "title": "" }, { "docid": "1ebd9f1d707d4412718b9e22a680c9aa", "score": "0.5760297", "text": "func (p *PortRange) IsValid() bool {\n\treturn p.IsSet() && p.Start < p.End\n}", "title": "" }, { "docid": "2ea278098c7bfb496b1da90fbc04dabd", "score": "0.5734612", "text": "func (b *Board) Move(pos int, steps int) bool {\n\tply := b.colors[pos]\n\n\tfinalpos := (pos + steps) % BoardSize\n\n\tif finalpos > startPos(ply) {\n\t\tdiff := finalpos - startPos(ply)\n\n\t\tif diff < steps && diff <= 4 && b.home[ply.Idx()][diff-1] == Unoccupied { // This was complete round and it fits\n\t\t\tb.home[ply.Idx()][diff-1] = ply\n\t\t\tb.colors[pos] = Unoccupied\n\t\t\tif *verbose {\n\t\t\t\tfmt.Printf(\"Moved ply %d to home\\n\", ply)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\n\tswitch b.colors[finalpos] {\n\tcase Unoccupied:\n\t\tb.colors[pos] = Unoccupied\n\t\tb.colors[finalpos] = ply\n\tcase ply:\n\t\treturn false\n\tdefault:\n\t\tother := b.colors[finalpos]\n\t\tb.base[other.Idx()]++\n\t\tb.colors[pos] = Unoccupied\n\t\tb.colors[finalpos] = ply\n\t}\n\n\tif *verbose {\n\t\tfmt.Printf(\"Moved ply %d to %d\\n\", ply, finalpos)\n\t}\n\n\treturn true // Move was legal\n}", "title": "" }, { "docid": "cf1627315a812feb694509eac18e31e6", "score": "0.5734342", "text": "func (s *Status) Valid() bool {\n\treturn s != nil && *s >= 100 && *s < 600\n}", "title": "" }, { "docid": "6ea3c0565625ec5d1325d0051ff7e715", "score": "0.5718698", "text": "func (h *HexMap) GetValidMoves(botId int) []client.Position {\n\treturn h.getPositionsInRange(h.myBots[botId].Position.X, h.myBots[botId].Position.Y, h.config.Move)\n}", "title": "" }, { "docid": "275f50a519d67ed84711a4073dfb95a9", "score": "0.5718606", "text": "func (d *Depth) IsValid() bool {\n\td.m.Lock()\n\tvalid := d.validationError == nil\n\td.m.Unlock()\n\treturn valid\n}", "title": "" }, { "docid": "df04c3b17bfde726765f6347af606ea8", "score": "0.5715035", "text": "func (v Value) Valid() bool {\n\treturn v >= Loss && v <= Win\n}", "title": "" }, { "docid": "65513af0be4f7becad0af74fc0f66d46", "score": "0.5694596", "text": "func (p PlayerIndex) Valid(state ImmutableState) bool {\n\tif p == AdminPlayerIndex || p == ObserverPlayerIndex {\n\t\treturn true\n\t}\n\tif withinBounds := p.WithinBounds(state); !withinBounds {\n\t\treturn false\n\t}\n\tplayerState := state.ImmutablePlayerStates()[p]\n\tif !state.Manager().Delegate().PlayerMayBeActive(playerState) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c2b782b70bcc607bd180c957b9033640", "score": "0.56912977", "text": "func valid(pos position) bool {\n\twestSide := false\n\teastSide := false\n\n\t// make a negative false\n\tif pos.westMissionaries < 0 || pos.eastMissionaries < 0 || pos.westCannibals < 0 || pos.eastCannibals < 0 {\n\t\treturn false\n\t}\n\n\t// make anything more than 3 false\n\tif pos.westMissionaries > 3 || pos.eastMissionaries > 3 || pos.westCannibals > 3 || pos.eastCannibals > 3 {\n\t\treturn false\n\t}\n\n\t// check if west side is valid\n\tif pos.westMissionaries >= pos.westCannibals || pos.westMissionaries == 0 {\n\t\twestSide = true\n\t} else {\n\t\twestSide = false\n\t}\n\n\t//check if east side is valid\n\tif pos.eastMissionaries >= pos.eastCannibals || pos.eastMissionaries == 0 {\n\t\teastSide = true\n\t} else {\n\t\teastSide = false\n\t}\n\n\t//if both sides are valid return true\n\tif westSide && eastSide == true {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "6fc6ae79d0107c856578dd40c7eb6580", "score": "0.56735605", "text": "func (p *Point) Valid() bool {\n\treturn p != nil && p.Point != nil\n}", "title": "" }, { "docid": "bb5cd955100daaf82804bfd0a343eba9", "score": "0.5662403", "text": "func (p PlayerIndex) Valid(state ImmutableState) bool {\n\tif p == AdminPlayerIndex || p == ObserverPlayerIndex {\n\t\treturn true\n\t}\n\tif state == nil {\n\t\treturn false\n\t}\n\tif p < 0 || int(p) >= len(state.ImmutablePlayerStates()) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0561a9e72f42018275a3c19806ceaace", "score": "0.56588334", "text": "func (b Board) ValidMoves() []Move {\n\tmoves := make([]Move, 0, 50)\n\tfor r := 0; r < 6; r++ {\n\t\tfor c := 0; c < 6; c++ {\n\t\t\tif b[r][c] == Empty {\n\t\t\t\tfor sub := 0; sub < 4; sub++ {\n\t\t\t\t\tmoves = append(moves, Move{r, c, sub, 0})\n\t\t\t\t\tmoves = append(moves, Move{r, c, sub, 1})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn moves\n}", "title": "" }, { "docid": "0c56ae5d58c64b80ac4b1d3c12d4bd52", "score": "0.565412", "text": "func (b Board) Valid(pos backtrack.Position) bool {\n\ts := posToSquare(pos)\n\tfor i := 0; i < s.r; i++ { // for every row that has a queen so far\n\t\tif b[i]-1 == s.c { // this column is already covered\n\t\t\treturn false\n\t\t}\n\t\tif checkDiag(i, b[i]-1, s.r, s.c) {\n\t\t\t// should cover the diags\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f6f4cd415ef7704b1a09eca30fb5ba60", "score": "0.56492764", "text": "func (d Frame) IsValid() bool {\n\treturn d.Original != \"\"\n}", "title": "" }, { "docid": "97c8e23a0b0fb8f19ed30cca231ccd3c", "score": "0.5628398", "text": "func (king *King) ValidMoves(board *ChessBoard) map[Coordinate]bool {\n\tvalidMoves := make(map[Coordinate]bool)\n\tpotentialCoordinates := getSurroundingCoordinates(king.currentCoordinate)\n\t// temporarily set current king space to nil, to simulate board if king were to move\n\tboard.BoardPieces[king.currentCoordinate.Row][king.currentCoordinate.Column] = nil\n\tfor i := 0; i < len(potentialCoordinates); i++ {\n\t\tif potentialCoordinates[i].isLegal() && !isSpaceOccupiedBySameSidePiece(potentialCoordinates[i], board, king.pieceSide) && !willKingMoveLeadToCheck(potentialCoordinates[i], board, king.pieceSide) {\n\t\t\tvalidMoves[potentialCoordinates[i]] = true\n\t\t}\n\t}\n\tboard.BoardPieces[king.currentCoordinate.Row][king.currentCoordinate.Column] = king\n\tif king.canCastle(board, true) {\n\t\tvalidMoves[getCastleCoordinate(king.currentCoordinate, true)] = true\n\t}\n\tif king.canCastle(board, false) {\n\t\tvalidMoves[getCastleCoordinate(king.currentCoordinate, false)] = true\n\t}\n\treturn validMoves\n}", "title": "" }, { "docid": "d0975e13d6c6e5c3ad32473cbcd45d37", "score": "0.56236154", "text": "func (b *Bishop) ValidMoves(pcs []Piece) []location.Location {\n\tbearings := []bearing{\n\t\t{Row: 1, Col: 1},\n\t\t{Row: -1, Col: 1},\n\t\t{Row: 1, Col: -1},\n\t\t{Row: -1, Col: -1},\n\t}\n\n\tcurrentRow := b.loc.GetRow()\n\tcurrentCol := b.loc.GetCol()\n\n\tvar validMoves []location.Location\n\tvar loc location.Location\n\tisBlocked := false\n\n\tfor _, bear := range bearings {\n\t\tloc = location.Location{Row: currentRow, Col: currentCol}\n\t\tisBlocked = false\n\t\tfor !isBlocked {\n\t\t\tloc = location.Location{Row: loc.GetRow() + bear.Row, Col: loc.GetCol() + bear.Col}\n\t\t\t// check if location is valid\n\t\t\tif isValidLocation(loc) {\n\t\t\t\t// check if location is vacant\n\t\t\t\tif !isLocationOccupied(loc, pcs) {\n\t\t\t\t\tvalidMoves = append(validMoves, loc)\n\t\t\t\t} else {\n\t\t\t\t\t// check if location is occupied by opponent\n\t\t\t\t\tif isLocationOccupiedByOpponent(loc, b.color, pcs) {\n\t\t\t\t\t\tvalidMoves = append(validMoves, loc)\n\t\t\t\t\t}\n\t\t\t\t\tisBlocked = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// if location is invalid, piece is blocked by the edge of the board\n\t\t\t\tisBlocked = true\n\t\t\t}\n\t\t}\n\t}\n\treturn validMoves\n}", "title": "" }, { "docid": "4920c2a1c87c6b39cfd82e544592e5ee", "score": "0.5620828", "text": "func (c *Cursor) Valid() bool {\n\treturn c.current != nil\n}", "title": "" }, { "docid": "d871879acaf54c832c69ed1ced669548", "score": "0.55794823", "text": "func (this *Vec2) IsValid() bool {\n\treturn IsValid(this.X) && IsValid(this.Y)\n}", "title": "" }, { "docid": "17c542fdad523e738f8d280b98f62833", "score": "0.55560684", "text": "func (m *LookMovePlan) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLooksToCopy(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLooksToMove(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c261a22a16b106a8b2e5801990da83e2", "score": "0.5528999", "text": "func (tf TimeFrame) IsValid() bool {\n\tswitch tf {\n\tcase TimeFrameOneMin,\n\t\tTimeFrameFiveMin,\n\t\tTimeFrameFifteenMin,\n\t\tTimeFrameThirtyMin,\n\t\tTimeFrameOneHour:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "c49bcea84d5148ca69cdc82f8a4ec3ce", "score": "0.55263394", "text": "func (gen *ChildGenerator) HasMoves() bool {\n\treturn gen.movesLeft != 0\n}", "title": "" }, { "docid": "29aee18d58f40ee5617380c260531164", "score": "0.55211425", "text": "func (r *Room) CanMove(d Direction, canSeeHidden, canSeeInvisible bool) bool {\n\tdoor, ok := r.Neighbours[d]\n\tif !ok {\n\t\treturn false\n\t}\n\n\tif door.isLocked {\n\t\treturn false\n\t}\n\n\tif door.isHidden && !canSeeHidden {\n\t\treturn false\n\t}\n\n\tif door.isInvisible && !canSeeInvisible {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bbd6bb000c03bb473a116c94ed118921", "score": "0.5504889", "text": "func (m Move) IsCapture() bool { return m.capturedPiece != nil }", "title": "" }, { "docid": "beb0ba4d3671bb63b79f7b9fe4743880", "score": "0.55013496", "text": "func (op Operation) Valid() (matched bool) {\n\treturn op.Number != \"\"\n}", "title": "" }, { "docid": "76124acbcf2f7abaa252df02b82ff810", "score": "0.54986304", "text": "func (s DiamondState) IsValid() bool {\n\tswitch s {\n\tcase DiamondInitialized, DiamondDone, DiamondCanceled:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "a6039fabe90435d893f3a2f7ad210f0a", "score": "0.54945", "text": "func (s *Span) Valid() bool {\n\treturn s.Start != nil && s.End != nil\n}", "title": "" }, { "docid": "9636d355318bfbbd745c26af92c60a1e", "score": "0.5473513", "text": "func (self VideoMode) IsValid() bool {\n\treturn int(C.sfVideoMode_isValid(*self.Cref)) == 1\n}", "title": "" }, { "docid": "1914eaf54cf3a704cb67cfb54b274b44", "score": "0.5473052", "text": "func (v DowntimeNotifyEndStateActions) IsValid() bool {\n\tfor _, existing := range allowedDowntimeNotifyEndStateActionsEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f8dba0214a97e93f1d2add7bb24c1a61", "score": "0.54676133", "text": "func (z *Zip) Valid() bool {\n\treturn z.Pos < len(z.Left) && z.Pos < len(z.Right)\n}", "title": "" }, { "docid": "71f7a585ef76a37469eaeff8d4268932", "score": "0.5465017", "text": "func (x *fastReflection_MsgEditValidator) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "ed540f9afe0cb96e8eaf2093eab40da2", "score": "0.5462576", "text": "func (cmd *MoveCommand) IsSane() bool {\n\treturn cmd.args.Source != \"\" && cmd.args.Target != \"\"\n}", "title": "" }, { "docid": "4e4d4b7f549c332fd0ca2afc528b87fd", "score": "0.54610264", "text": "func (p Phase) IsValid() bool {\n\treturn p > _phase && phase_ > p\n}", "title": "" }, { "docid": "5b7d89dcfbb1b819b0b5f1a1692f15ef", "score": "0.5458705", "text": "func (b BoardName) IsValid() bool {\n\tswitch b {\n\tcase BoardNameBloonchipper,\n\t\tBoardNameDartmonkey,\n\t\tBoardNameNocturne,\n\t\tBoardNameNami:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "51a6e3ac67402c1c1b7f66e643a473ad", "score": "0.5457426", "text": "func (s LazySchedule) IsValid() bool {\n\n\tstartTime := s.GetStartTime()\n\tendTime := s.GetEndTime()\n\tratio := s.GetRatio()\n\n\treturn startTime >= 0 && endTime >= startTime && ratio.GT(sdk.ZeroDec())\n}", "title": "" }, { "docid": "ff7e8541d4a2cdcaa823c040b659749c", "score": "0.54521084", "text": "func (v HoldOutDurationUnitDto) IsValid() bool {\n\tfor _, existing := range AllowedHoldOutDurationUnitDtoEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f6600012df06c80669998b5b3d008997", "score": "0.5449648", "text": "func (i Role) Valid() bool {\n\treturn i > 0 && i < Role(len(_Role_index)-1)\n}", "title": "" }, { "docid": "ac012979626e3ac340983088c178ecc0", "score": "0.54481035", "text": "func (h *Hero) IsValid() bool {\n\tif h.ID == \"\" {\n\t\treturn false\n\t}\n\tif h.Name == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4807264763caf3f5194e1ed7b79fb925", "score": "0.5434144", "text": "func (r RouteInfo) IsValidRoute() bool {\n\treturn (len(r.Pools) > 0) ||\n\t\tlen(r.Blocks) > 0 ||\n\t\tlen(r.Host.NodeNames) > 0 ||\n\t\tlen(r.Refs) > 0\n}", "title": "" }, { "docid": "be67d67cfdb69da539195bb132ecbbdf", "score": "0.54226846", "text": "func (m *BillingMovement) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAmount(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBalance(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDate(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMovementID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOperation(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrder(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePreviousBalance(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "04f37b2044bfc814ea237ed2bec2b93c", "score": "0.5415109", "text": "func (k King) GetValidMoves() []Position {\n\tvar positions []Position\n\t\n\t// Go top\n\tpositions = appendPosition(positions, k.position.x, k.position.y + 1)\n\n\t// Go bottom\n\tpositions = appendPosition(positions, k.position.x, k.position.y - 1)\n\n\t// Go left\n\tpositions = appendPosition(positions, k.position.x - 1, k.position.y)\n\n\t// Go right\n\tpositions = appendPosition(positions, k.position.x + 1, k.position.y)\n\n\t// Go top right\n\tpositions = appendPosition(positions, k.position.x + 1, k.position.y + 1)\n\n\t// Go top left\n\tpositions = appendPosition(positions, k.position.x - 1, k.position.y + 1)\n\n\t// Go bottom right\n\tpositions = appendPosition(positions, k.position.x + 1, k.position.y - 1)\n\n\t// Go bottom left\n\tpositions = appendPosition(positions, k.position.x - 1, k.position.y - 1)\n\n\treturn positions\n}", "title": "" }, { "docid": "5a63374087471a13dc6da4120fd05d9a", "score": "0.5415081", "text": "func (ls *LineString) Valid() bool {\n\treturn ls != nil && ls.LineString != nil\n}", "title": "" }, { "docid": "87d6f12a8e27628e432d81e6ce282d28", "score": "0.54041106", "text": "func (d *CommandLine) IsValid() int32 {\n\treturn int32(C.gocef_command_line_is_valid(d.toNative(), d.is_valid))\n}", "title": "" }, { "docid": "f6a6b8a812f52551bdc0808978f2bb43", "score": "0.539892", "text": "func (state *ContainerState) Valid() bool {\n\treturn state.State.valid()\n}", "title": "" }, { "docid": "dbccc38e8bbc2c71e447c94b2f91144c", "score": "0.5396377", "text": "func (n Line) IsValid() bool { return n.Ordinal() > 0 }", "title": "" }, { "docid": "6a41a0afebe4ebb687f3222d8bd274ad", "score": "0.5396118", "text": "func (m GameMode) IsValid() bool {\n\treturn m == SoloMode || m == SoloFPPMode || m == DuoMode || m == DuoFPPMode || m == SquadMode || m == SquadFPPMode\n}", "title": "" }, { "docid": "82264c68f6e15eff146de9077df3a623", "score": "0.5394944", "text": "func (g *Grid) Valid() bool {\n\treturn g.validGroup(&box) && g.validGroup(&col) && g.validGroup(&row)\n}", "title": "" }, { "docid": "03ff3ab2c077d77abe3a15f284d3ebb7", "score": "0.5389497", "text": "func (p PropertyID) IsValid() bool {\n\tif _, ok := propertyTypeMap[p]; ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7060567e38de56328c1f6d2de57ebc75", "score": "0.53881687", "text": "func (b Board) IsValidSpace(loc Coord) bool {\n\tif loc.Y < 0 || b.Height <= loc.Y ||\n\t\tloc.X < 0 || b.Width <= loc.X {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6ae613b28562a0bd93c8b3cda1e51820", "score": "0.53679746", "text": "func (ctx *Context) IsValid() bool {\n\tif ctx.From == \"\" || ctx.To == \"\" || ctx.ThemeName == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "619d9c8ebb43d8475c3138f979b21a57", "score": "0.53621876", "text": "func (conf Config) IsValid() bool {\n\treturn conf.K >= 1 &&\n\t\tconf.ActionSpace >= 3 &&\n\t\t// conf.SharedLayers >= conf.BoardSize &&\n\t\tconf.SharedLayers >= 0 &&\n\t\tconf.FC > 1 &&\n\t\tconf.BatchSize >= 1 &&\n\t\t// conf.ActionSpace >= conf.Width*conf.Height &&\n\t\tconf.Features > 0\n}", "title": "" }, { "docid": "cf8a247410453e2f1e886daa004044fc", "score": "0.53609043", "text": "func (p Pin) IsValid() bool {\n\treturn p.h&^0x7F != 0\n}", "title": "" }, { "docid": "08523d114608d42537e80198e24dc1e9", "score": "0.535593", "text": "func (header FrameHeader) IsValid() bool {\n\tif (header & 0xffe00000) == 0xffe00000 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "25bdce0aa734d3b56d1ee0fdeb019762", "score": "0.5354201", "text": "func (s *Token) Valid() bool {\n\tif s.t != nil {\n\t\treturn s.t.Valid\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "6a7398b4ae487d61798bbb4b23687602", "score": "0.5352174", "text": "func (g *Game) Move(m Move) bool {\n\tif !g.Board.ApplyMove(m, g.Turn) {\n\t\treturn false\n\t}\n\n\tswitch g.Turn {\n\tcase White: g.Turn = Black\n\tcase Black: g.Turn = White\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b2b05f9b4e1d201711a6f688c3c75d6d", "score": "0.53423864", "text": "func (x *fastReflection_MsgDelegate) IsValid() bool {\n\treturn x != nil\n}", "title": "" }, { "docid": "93712ebc977b4806398dd333ee6531cb", "score": "0.533586", "text": "func (m *EMM) IsValid() bool {\n\n\t// bool value to be returned\n\tvar status bool\n\tstatus = true\n\n\tm.mutex.RLock()\n\t// Sum of the whole matrix\n\tvar sum Counter\n\tsum = 0\n\t// Iterate through each column\n\tfor _, column := range m.Column {\n\t\t// Sum of a row\n\t\tvar sumOfRow Counter\n\t\tsumOfRow = 0\n\t\t// Iterate through each row\n\t\tfor _, row := range column.Row {\n\t\t\tsumOfRow += row\n\t\t}\n\t\t// Check that sum of row is valid\n\t\tif sumOfRow != column.Sum {\n\t\t\tstatus = false\n\t\t}\n\t\t// Add to whole sum\n\t\tsum += sumOfRow\n\t}\n\n\t// Check that sum of whole matrix is valid\n\tif sum != m.Sum {\n\t\tstatus = false\n\t}\n\n\t//Iterate over all states (except 0)\n\t//and check if there is at least one way\n\t//to reach the state from another state\n\tfor colKey := range m.Column {\n\t\tif colKey != 0 {\n\t\t\tsumOfAllCountersToJump := m.innerJumpToSum(colKey, false)\n\t\t\tif sumOfAllCountersToJump == 0 {\n\t\t\t\tstatus = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tm.mutex.RUnlock()\n\n\treturn status\n}", "title": "" }, { "docid": "3386fe52d3976cbba47de4dbceb969e6", "score": "0.53261894", "text": "func (g *Game) MakeMove(m Move) error {\n\n\tif g.Completion.Done {\n\t\treturn &MoveError{\n\t\t\tCause: m,\n\t\t\tReason: \"the game is over\",\n\t\t}\n\t}\n\n\tif m.Moving.Color != g.Turn() {\n\t\treturn &MoveError{\n\t\t\tCause: m,\n\t\t\tReason: \"it is \" + g.Turn().String() + \"'s turn\",\n\t\t}\n\t}\n\t// check if the move is valid\n\tvar validMove bool\n\tseeing := m.Moving.Seeing()\n\tfor _, s := range seeing {\n\t\tif m.To == s {\n\t\t\tvalidMove = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !validMove {\n\t\treturn &MoveError{\n\t\t\tCause: m,\n\t\t\tReason: \"piece cannot see space\",\n\t\t}\n\t}\n\n\tif m.Moving.Type == PiecePawn && (m.To.Rank == 0 || m.To.Rank == 7) {\n\t\tswitch m.Promotion {\n\t\tcase PieceRook, PieceKnight, PieceBishop, PieceQueen:\n\t\t\tbreak\n\t\tcase PieceNone:\n\t\t\treturn &MoveError{\n\t\t\t\tCause: m,\n\t\t\t\tReason: \"must specify what to promote pawn to\",\n\t\t\t}\n\t\tdefault:\n\t\t\treturn &MoveError{\n\t\t\t\tCause: m,\n\t\t\t\tReason: \"cannot promote to \" + m.Promotion.String(),\n\t\t\t}\n\t\t}\n\t} else if m.Promotion != PieceNone {\n\t\treturn &MoveError{\n\t\t\tCause: m,\n\t\t\tReason: \"piece cannot promote\",\n\t\t}\n\t}\n\n\tvar legal bool\n\tlegalMoves := m.Moving.LegalMoves()\n\tfor _, s := range legalMoves {\n\t\tif m.To == s {\n\t\t\tlegal = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !legal {\n\t\treturn &MoveError{\n\t\t\tCause: m,\n\t\t\tReason: \"player is in check\",\n\t\t\tInCheck: true,\n\t\t}\n\t}\n\n\tother := g.Turn().Other()\n\toldAlivePieces := len(g.AlivePieces(other))\n\n\t// make the move\n\tg.MakeMoveUnconditionally(m)\n\n\t// move rook in castles\n\tif m.Moving.Type == PieceKing {\n\t\tdiff := m.Moving.Location.File - m.To.File\n\n\t\tif diff == -2 {\n\t\t\trook, _ := g.PieceAt(Space{File: 0, Rank: m.To.Rank})\n\t\t\tg.MakeMoveUnconditionally(Move{\n\t\t\t\tMoving: rook,\n\t\t\t\tTo: Space{File: 3, Rank: m.To.Rank},\n\t\t\t})\n\t\t}\n\t\tif diff == 2 {\n\t\t\trook, _ := g.PieceAt(Space{File: 7, Rank: m.To.Rank})\n\t\t\tg.MakeMoveUnconditionally(Move{\n\t\t\t\tMoving: rook,\n\t\t\t\tTo: Space{File: 5, Rank: m.To.Rank},\n\t\t\t})\n\t\t}\n\t}\n\n\t// update move counts\n\n\tg.Fullmove++\n\tif len(g.AlivePieces(other)) < oldAlivePieces || m.Moving.Type == PiecePawn {\n\t\tg.Halfmove = 0\n\t} else {\n\t\tg.Halfmove++\n\t}\n\n\t// check completion state\n\tif g.InCheckmate(g.Turn()) {\n\t\tg.Completion.Done = true\n\t\tg.Completion.Winner = g.Turn().Other()\n\t}\n\tif g.InStalemate(g.Turn()) {\n\t\tg.Completion.Done = true\n\t\tg.Completion.Draw = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db88cbd8834482ab611872d8c2bc51c8", "score": "0.5325977", "text": "func (s Sector) IsValid() bool {\n\tif s.Val > 0 && s.Val <= 20 {\n\t\treturn s.Pos > 0 && s.Pos <= 3\n\t} else if s.Val == 25 {\n\t\treturn s.Pos == 1 || s.Pos == 2\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7c2f6bbcba8b6c7c005c802d6bad7c2f", "score": "0.5314219", "text": "func (r *Rule) IsValid() error {\n\tif len(r.From) == 0 && len(r.Subject) == 0 {\n\t\treturn fmt.Errorf(\"Need to set From or Subject\")\n\t}\n\n\tif len(r.Channel) == 0 {\n\t\treturn fmt.Errorf(\"Need to set a Channel\")\n\t}\n\n\tif !strings.HasPrefix(r.Channel, \"#\") && !strings.HasPrefix(r.Channel, \"@\") {\n\t\treturn fmt.Errorf(\"Need to set a #channel or @user\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "375e6b7e13b6d11bdb7459b7c1167afb", "score": "0.5309675", "text": "func (m *FileMoveInlineDestination) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateSvm(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVolume(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "104c7325fdb2b7f022229fc9773b97b8", "score": "0.53054506", "text": "func (ctx *SyncContext) IsValid() bool {\n\tif ctx == nil {\n\t\tklog.Errorf(\"SyncContext is nil\")\n\t\treturn false\n\t}\n\tif ctx.KubeClient == nil {\n\t\tklog.Errorf(\"KubeClient is nil\")\n\t\treturn false\n\t}\n\tif ctx.StopChan == nil {\n\t\tklog.Errorf(\"StopChan is nil\")\n\t\treturn false\n\t}\n\tif ctx.InformerFactory == nil {\n\t\tklog.Errorf(\"InformerFactory is nil\")\n\t\treturn false\n\t}\n\tif ctx.Store == nil {\n\t\tklog.Errorf(\"Storage is nil\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "84e853941375bb9060584a6eadcff136", "score": "0.5277625", "text": "func (m *ModerationOp) IsValid() bool {\n\treturn m != nil && m.Hash.IsValid()\n}", "title": "" }, { "docid": "206debab6ce0c2adf2622c88d83c8d5e", "score": "0.52628773", "text": "func (s Snake) checkMove(dir int8) bool {\n\tswitch dir {\n\tcase up:\n\t\tif s.direction == up || s.direction == down {\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\tcase right:\n\t\tif s.direction == right || s.direction == left {\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\tcase down:\n\t\tif s.direction == down || s.direction == up {\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\tcase left:\n\t\tif s.direction == left || s.direction == right {\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5a0ab573ad5d495471363ccb19330fdb", "score": "0.5262849", "text": "func (r *sstIterator) Valid() (bool, error) {\n\treturn r.valid && r.err == nil, r.err\n}", "title": "" }, { "docid": "33490f2e0f22a49c78789fb6ffed282a", "score": "0.5261737", "text": "func (mode GameMode) Valid() bool {\n\tswitch mode {\n\tcase ModeFiveColor, ModeSixColor, ModeRainbow, ModeDarkRainbow:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c66a51e912c4fbbf2738fc76aa8263f7", "score": "0.5259454", "text": "func (n *NopInvalidator) IsValid(*Metadata) bool {\n\treturn true\n}", "title": "" }, { "docid": "c0451f5f10b6d128da4db24ba47faed6", "score": "0.5253344", "text": "func (v GetTeamMembershipsSort) IsValid() bool {\n\tfor _, existing := range allowedGetTeamMembershipsSortEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a8036c6921148a5a10de94cfc563dec3", "score": "0.52488536", "text": "func (b *board) validate() bool {\n\tfor i, c := range b.grid {\n\t\tif c == 'Q' {\n\t\t\tq := queen{row: i / b.column, column: i % b.column}\n\t\t\tif !q.walk(allDirections, b) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ff77866eb2bc1b4ca07d3990716805d8", "score": "0.5247673", "text": "func (g *Game) roomIsValid(c Side, x, y int) bool {\n\tif g.Board[x][y] != Blank {\n\t\treturn false\n\t}\n\n\tif g.lineIsValid(c, g.topOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.topRightOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.rightOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.bottomRightOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.bottomOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.bottomLeftOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.leftOf(x, y)) {\n\t\treturn true\n\t}\n\n\tif g.lineIsValid(c, g.topLeftOf(x, y)) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d45bc23424b240e697cef065221de403", "score": "0.5228555", "text": "func (w *wayPath) IsValid() bool { return len(w.Path) > 1 && (w.Role == \"outer\" || w.Role == \"inner\") }", "title": "" }, { "docid": "3a6abe76b0dd59e1ac2218d657222410", "score": "0.5227412", "text": "func (b *Board) Validate() string {\n\txcount, ocount := 0, 0\n\tfor _, row := range b {\n\t\tfor _, space := range row {\n\t\t\tswitch space {\n\t\t\tcase O:\n\t\t\t\tocount += 1\n\t\t\tcase X:\n\t\t\t\txcount += 1\n\t\t\t}\n\t\t}\n\t}\n\n\t// There are nine spaces on the board; make sure at least one is empty\n\tif xcount+ocount == 9 {\n\t\treturn \"All spaces are full; there's no where for me to play\"\n\t}\n\n\t// Either the # of moves per player should be equal (we went first)\n\t// Or there should be one more X than O's (they went first)\n\tif xcount == ocount || xcount-1 == ocount {\n\t\treturn \"\"\n\t}\n\treturn \"It's not O's turn.\"\n\n}", "title": "" }, { "docid": "7169432cacd951a9cbf6c3557fac76cb", "score": "0.5208595", "text": "func (topo *CPUTopology) IsValid() bool {\n\treturn topo.NumSockets != 0 && topo.NumNodes != 0 && topo.NumCores != 0 && topo.NumCPUs != 0\n}", "title": "" }, { "docid": "5e90c79c3f0e5afd2ed34f7b91d9c2bc", "score": "0.52025497", "text": "func (notNull NotNull) IsValid() bool {\n\treturn len(notNull[0]) > 0\n}", "title": "" }, { "docid": "470d249a9078ebe56be0abc7ce0de431", "score": "0.5202488", "text": "func (v *geoValidator) IsValid(errors *validate.Errors) {\n\tif !v.Latitude.Valid && !v.Longitude.Valid {\n\t\treturn\n\t}\n\n\tif v.Latitude.Valid != v.Longitude.Valid {\n\t\terrors.Add(validators.GenerateKey(v.Name), \"only one coordinate given, must have neither or both\")\n\t}\n\n\tif v.Latitude.Float64 < -90.0 || v.Latitude.Float64 > 90.0 {\n\t\tv.Message = fmt.Sprintf(\"Latitude %v is out of range\", v.Latitude)\n\t\terrors.Add(validators.GenerateKey(v.Name), v.Message)\n\t}\n\n\tif v.Longitude.Float64 < -180.0 || v.Longitude.Float64 > 180.0 {\n\t\tv.Message = fmt.Sprintf(\"Longitude %v is out of range\", v.Longitude)\n\t\terrors.Add(validators.GenerateKey(v.Name), v.Message)\n\t}\n\n\tif v.Longitude.Float64 == 0 && v.Latitude.Float64 == 0 {\n\t\tv.Message = \"a valid geo coordinate must be given\"\n\t\terrors.Add(validators.GenerateKey(v.Name), v.Message)\n\t}\n}", "title": "" }, { "docid": "93cb07271237c2318a3ec0d6567ba752", "score": "0.520193", "text": "func (i *MockIterator) Valid() bool {\n\tif i.currentIdx < 0 || i.currentIdx >= len(i.keys) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "250df354c5d9760816189faed4b275d9", "score": "0.52015996", "text": "func (this *Game) Move(player uint8, x int, y int) (bool, error) {\n\tpos := -1\n\tswitch y {\n\tcase 1:\n\t\tpos = x + y - 2\n\tcase 2:\n\t\tpos = x + y\n\tcase 3:\n\t\tpos = x + y + 2\n\t}\n\treturn this.Place(player, pos)\n}", "title": "" }, { "docid": "54a951adff66f312117e692d9583911c", "score": "0.51997596", "text": "func (v Validations) IsValid() bool {\n\treturn Flag(v)&FValid == FValid\n}", "title": "" }, { "docid": "95a1c3120a62402135eaf81a35134fb7", "score": "0.51989615", "text": "func ValidateUserMove(board string, before string) (rune, error) {\n\tuserSym := rune('X')\n\tif len(board) != 9 {\n\t\treturn userSym, errors.New(\"Invalid Input! board length is not 9\")\n\t}\n\n\tfor i := range board {\n\t\tif (board[i] != '-') && (board[i] != 'X') && (board[i] != 'O') {\n\t\t\treturn userSym, errors.New(\"Invalid symbol in board\")\n\t\t}\n\t}\n\n\tmoves := 0\n\tfor i := range board {\n\t\tif board[i] != before[i] {\n\t\t\tmoves++\n\t\t\tif moves > 1 || before[i] != '-' {\n\t\t\t\treturn userSym, errors.New(\"Invalid Input! You Can't play more than one move at once\")\n\t\t\t}\n\t\t\tuserSym = rune(board[i])\n\t\t}\n\t}\n\n\tif before == Blank {\n\t\tif board == Blank {\n\t\t\treturn 'X', nil\n\t\t}\n\t\tif strings.ContainsRune(board, 'O') {\n\t\t\treturn 'O', nil\n\t\t}\n\t} else {\n\t\tif moves == 0 {\n\t\t\treturn userSym, errors.New(\"Please make your move\")\n\t\t}\n\t}\n\n\treturn userSym, nil\n}", "title": "" }, { "docid": "9f40b5df3d84937dc7a9dc780cce98f0", "score": "0.51975304", "text": "func IsMove(e ld.Entity) bool { return ld.Is(e, Class_Move.ID) }", "title": "" }, { "docid": "0e2b5a6263d8b3f2c84a88650946da96", "score": "0.5189677", "text": "func (tq TimeQuality) IsValid() bool {\n\treturn !((!tq.TzKnown && tq.IsSynced) || (!tq.IsSynced && tq.SyncAccuracy != nil))\n}", "title": "" } ]
e4c212541e01dc1f0ffcedc2d0214755
GetCommands returns all of the commands registered with the plugin.
[ { "docid": "6179df2ee46eeb0cb67c0622b75af151", "score": "0.0", "text": "func (p *interactionPlugin) GetInteractions() []Interaction {\n\treturn p.interactions\n}", "title": "" } ]
[ { "docid": "370511bbbe331c560e5fbc3192f14548", "score": "0.85941094", "text": "func (p *plugin) GetCommands() []Command {\n\treturn p.commands\n}", "title": "" }, { "docid": "bdb07683ba73117264f2b170e7f10578", "score": "0.7691778", "text": "func GetCommands() *cobra.Command {\n\n\t//collect the commands in the package\n\taddWrite()\n\treturn relCmd\n}", "title": "" }, { "docid": "fdf45f84aa6e7660624366a7887f2e13", "score": "0.7554886", "text": "func GetCommands(base bot.BaseCommand, cfg *config.Config) bot.Commands {\n\tvar commands bot.Commands\n\n\tcommands.AddCommand(\n\t\tnewStatsCommand(base, cfg),\n\t\tnewBotLogCommand(base, cfg),\n\t\tnewPingCommand(base),\n\t)\n\n\treturn commands\n}", "title": "" }, { "docid": "fd60f630b59ea34fbfc36f7486f3ac31", "score": "0.7491122", "text": "func GetCommands(base bot.BaseCommand, cfg *config.Config) bot.Commands {\n\tvar commands bot.Commands\n\n\tgameConfig := loadConfig(cfg)\n\tif !gameConfig.Enabled {\n\t\treturn commands\n\t}\n\n\tcommands.AddCommand(\n\t\tNewNumberGuesserCommand(base),\n\t\tNewQuizCommand(base),\n\t)\n\n\treturn commands\n}", "title": "" }, { "docid": "19e3927260cf2f80a72522f851e6f902", "score": "0.7327537", "text": "func (h CommandHandler) GetCommands() CmdMap {\n\treturn h.cmds\n}", "title": "" }, { "docid": "6762b4e79d652b70b5cc999cae9ea1ab", "score": "0.7279163", "text": "func GetCommands() ([]Task, error) {\n\tvar (\n\t\tcommands []Task\n\t)\n\n\tdb.Find(&commands)\n\n\treturn commands, nil\n}", "title": "" }, { "docid": "9b07d2d11b632308940cd2c1f34d70a1", "score": "0.72209364", "text": "func (c *Client) GetCommands(ctx context.Context, request *GetCommandsRequest) (*BotCommands, error) {\n\tvar result BotCommands\n\n\tif err := c.rpc.Invoke(ctx, request, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "e9ffb5dc99eb3679f6c48178b8214405", "score": "0.7187537", "text": "func (s *Action) GetCommands() []*ucli.Command {\n\treturn []*ucli.Command{\n\t\t{\n\t\t\tName: \"add\",\n\t\t\tAliases: []string{\"a\"},\n\t\t\tUsage: \"Adds an existing password for a website\",\n\t\t\tArgsUsage: \"<name> <username> <password>\",\n\t\t\tFlags: []ucli.Flag{\n\t\t\t\t&ucli.BoolFlag{\n\t\t\t\t\tName: \"advanced\",\n\t\t\t\t\tAliases: []string{\"a\"},\n\t\t\t\t\tUsage: \"Enable advanced mode\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tAction: s.Add,\n\t\t},\n\t\t{\n\t\t\tName: \"backup\",\n\t\t\tAliases: []string{\"b\"},\n\t\t\tUsage: \"Creates a backup\",\n\t\t\tArgsUsage: \"<path>\",\n\t\t\tAction: s.Backup,\n\t\t},\n\t\t{\n\t\t\tName: \"category\",\n\t\t\tSubcommands: []*ucli.Command{\n\t\t\t\t{\n\t\t\t\t\tName: \"list\",\n\t\t\t\t\tAliases: []string{\"ls\"},\n\t\t\t\t\tUsage: \"list all categories\",\n\t\t\t\t\tAction: s.CategoryList,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"delete\",\n\t\t\tAliases: []string{\"d\"},\n\t\t\tUsage: \"Deletes an item\",\n\t\t\tArgsUsage: \"<name> <username>\",\n\t\t\tAction: s.Delete,\n\t\t},\n\t\t{\n\t\t\tName: \"edit\",\n\t\t\tAliases: []string{\"e\"},\n\t\t\tUsage: \"Edits an item\",\n\t\t\tArgsUsage: \"<name> <username>\",\n\t\t\tAction: s.Edit,\n\t\t},\n\t\t{\n\t\t\tName: \"generate\",\n\t\t\tAliases: []string{\"g\"},\n\t\t\tUsage: \"Generates a password for an item\",\n\t\t\tArgsUsage: \"<name> <username>\",\n\t\t\tFlags: []ucli.Flag{\n\t\t\t\t&ucli.BoolFlag{\n\t\t\t\t\tName: \"advanced\",\n\t\t\t\t\tAliases: []string{\"a\"},\n\t\t\t\t\tUsage: \"Enable advanced mode\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tAction: s.Generate,\n\t\t},\n\t\t{\n\t\t\tName: \"list\",\n\t\t\tAliases: []string{\"ls\"},\n\t\t\tUsage: \"Lists all websites\",\n\t\t\tArgsUsage: \"<name>\",\n\t\t\tAction: s.List,\n\t\t},\n\t\t{\n\t\t\tName: \"me\",\n\t\t\tUsage: \"Display info card with default username and phone number\",\n\t\t\tAction: s.Me,\n\t\t},\n\t\t{\n\t\t\tName: \"password\",\n\t\t\tAliases: []string{\"p\"},\n\t\t\tUsage: \"Changes master password\",\n\t\t\tAction: s.Password,\n\t\t},\n\t\t{\n\t\t\tName: \"restore\",\n\t\t\tAliases: []string{\"r\"},\n\t\t\tUsage: \"Restores a backup\",\n\t\t\tArgsUsage: \"<path>\",\n\t\t\tAction: s.Restore,\n\t\t},\n\t\t{\n\t\t\tName: \"unclip\",\n\t\t\tUsage: \"Internal command to clear clipboard\",\n\t\t\tDescription: \"Clear the clipboard if the content matches the checksum.\",\n\t\t\tHidden: true,\n\t\t\tFlags: []ucli.Flag{\n\t\t\t\t&ucli.IntFlag{\n\t\t\t\t\tName: \"timeout\",\n\t\t\t\t\tUsage: \"Time to wait\",\n\t\t\t\t}, &ucli.BoolFlag{\n\t\t\t\t\tName: \"force\",\n\t\t\t\t\tUsage: \"Clear clipboard even if checksum mismatches\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tAction: s.Unclip,\n\t\t},\n\t\t{\n\t\t\tName: \"update\",\n\t\t\tAliases: []string{\"u\"},\n\t\t\tUsage: \"Updates to the latest release\",\n\t\t\tAction: s.Update,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9e17a2b9bc6441c86bc734d5ba461238", "score": "0.69744426", "text": "func (a *API) GetCommands() chan *SDPCommand {\n\treturn a.Commands\n}", "title": "" }, { "docid": "a0fdbd5a70de29ca8378e0f6b9309a58", "score": "0.69277275", "text": "func (d *Devfile200) GetCommands() []common.DevfileCommand {\n\tvar commands []common.DevfileCommand\n\n\tfor _, command := range d.Commands {\n\t\t// we convert devfile command id to lowercase so that we can handle\n\t\t// cases efficiently without being error prone\n\t\t// we also convert the odo push commands from build-command and run-command flags\n\t\tif command.Exec != nil {\n\t\t\tcommand.Exec.Id = strings.ToLower(command.Exec.Id)\n\t\t} else if command.Composite != nil {\n\t\t\tcommand.Composite.Id = strings.ToLower(command.Composite.Id)\n\t\t}\n\n\t\tcommands = append(commands, command)\n\t}\n\n\treturn commands\n}", "title": "" }, { "docid": "d230837bb02b191bd0b679d318d410bf", "score": "0.6920009", "text": "func (api *API) GetCommands(w http.ResponseWriter, res *http.Request) {\n\tcmds, err := api.handler.Commands.FindAll()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"error decoding GetCommands request\")\n\t\toutputJSON(w, false, \"An internal error occured when trying to find all commands\", nil)\n\t\treturn\n\t}\n\n\tjs, _ := json.Marshal(cmds)\n\tif _, err := w.Write(js); err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "title": "" }, { "docid": "6e2008faa4715793f6502d9d793f9d7f", "score": "0.68647695", "text": "func (d *Devfile200) GetCommands() []common.DevfileCommand {\n\tvar commands []common.DevfileCommand\n\n\tfor _, command := range d.Commands {\n\t\t// we convert devfile command id to lowercase so that we can handle\n\t\t// cases efficiently without being error prone\n\t\t// we also convert the odo push commands from build-command and run-command flags\n\t\tcommand.Exec.Id = strings.ToLower(command.Exec.Id)\n\t\tcommands = append(commands, command)\n\t}\n\n\treturn commands\n}", "title": "" }, { "docid": "c2ccd7d4a87592cf33fd2f3333f9efbd", "score": "0.6832994", "text": "func Get() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"instance\",\n\t\t\tUsage: \"Virtual and bare metal servers.\",\n\t\t\tSubcommands: instancecommands.Get(),\n\t\t},\n\t\t{\n\t\t\tName: \"image\",\n\t\t\tUsage: \"Base operating system layout for a server.\",\n\t\t\tSubcommands: imagecommands.Get(),\n\t\t},\n\t\t{\n\t\t\tName: \"flavor\",\n\t\t\tUsage: \"Resource allocations for servers.\",\n\t\t\tSubcommands: flavorcommands.Get(),\n\t\t},\n\t\t{\n\t\t\tName: \"keypair\",\n\t\t\tUsage: \"SSH keypairs for accessing servers.\",\n\t\t\tSubcommands: keypaircommands.Get(),\n\t\t},\n\t\t{\n\t\t\tName: \"volume-attachment\",\n\t\t\tUsage: \"Volumes attached to servers.\",\n\t\t\tSubcommands: volumeattachmentcommands.Get(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4a105fcaeb3d7a2b23162d32b58e5c46", "score": "0.6775594", "text": "func (b *BotInfo) GetCommands() (value []BotCommand, ok bool) {\n\tif b == nil {\n\t\treturn\n\t}\n\tif !b.Flags.Has(2) {\n\t\treturn value, false\n\t}\n\treturn b.Commands, true\n}", "title": "" }, { "docid": "dff9345ce03b52f16dcb7ce00544684d", "score": "0.6770471", "text": "func Get() []cli.Command {\n\treturn []cli.Command{\n\t\tlist,\n\t\tcreate,\n\t\tget,\n\t\tupdate,\n\t\tremove,\n\t\treboot,\n\t\trebuild,\n\t\tresize,\n\t\tlistAddresses,\n\t\tlistAddressesByNetwork,\n\t\tgetMetadata,\n\t\tsetMetadata,\n\t\tupdateMetadata,\n\t\tdeleteMetadata,\n\t}\n}", "title": "" }, { "docid": "395a70cdb3cb2b7ee63beb3a96bf7fa9", "score": "0.67567134", "text": "func (d TestDevfileData) GetCommands() map[string]v1.Command {\n\n\tcommands := make(map[string]v1.Command, len(d.Commands))\n\n\tfor _, command := range d.Commands {\n\t\t// we convert devfile command id to lowercase so that we can handle\n\t\t// cases efficiently without being error prone\n\t\t// we also convert the odo push commands from build-command and run-command flags\n\t\tcommand.Id = strings.ToLower(command.Id)\n\t\tcommands[command.Id] = command\n\t}\n\n\treturn commands\n}", "title": "" }, { "docid": "840af435a3bb0e7bc4f70309c83a7ba6", "score": "0.6710914", "text": "func Get() []cli.Command {\n\treturn []cli.Command{\n\t\tcreate,\n\t\tget,\n\t\tremove,\n\t\tlist,\n\t}\n}", "title": "" }, { "docid": "0aa20950106515316d3d9c62b75c5ca6", "score": "0.6705352", "text": "func Get() []cli.Command {\n\treturn []cli.Command{\n\t\tlist,\n\t\tget,\n\t\tcreate,\n\t\tremove,\n\t}\n}", "title": "" }, { "docid": "8bc36ff343d5d9b4ba2c5ebb247c68a1", "score": "0.6633952", "text": "func (c *ClosedVectorPath) GetCommands() (value []VectorPathCommandClass) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Commands\n}", "title": "" }, { "docid": "1759946d2a4750a0ef359f724bd957e0", "score": "0.6603597", "text": "func Get() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"snapshot\",\n\t\t\tUsage: \"Copies of block storage volumes at a specific moment in time. Used for backup, restoration, and other long term storage.\",\n\t\t\tSubcommands: snapshotcommands.Get(),\n\t\t},\n\t\t{\n\t\t\tName: \"volume\",\n\t\t\tUsage: \"Block level volumes to add storage capacity to your servers.\",\n\t\t\tSubcommands: volumecommands.Get(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2f0c6a6dd6baf8353c99ee5f672af0b2", "score": "0.656283", "text": "func (b *Bot) GetMyCommands(options OptionsGetMyCommands) (result APIResponse[[]BotCommand]) {\n\treturn b.requestBotCommands(\"getMyCommands\", options)\n}", "title": "" }, { "docid": "49b602ad56651dfd02224ba3ce7e26e3", "score": "0.64729285", "text": "func getAdminCommands() []*cli.Command {\n\treturn []*cli.Command{\n\t\tGetStore().Wrap(setupCommand()),\n\t\tGetStore().Wrap(destroyCmd()),\n\t\tGetStore().Wrap(initCmd()),\n\t\tGetStore().Wrap(resetCmd()),\n\t\tGetStore().Wrap(isSetup()),\n\t\tGetStore().Wrap(userCmd()),\n\t}\n}", "title": "" }, { "docid": "f76dd3e2bd98ae510eae7c8acfae68d9", "score": "0.64607954", "text": "func (c *Command) Commands() []*Command {\n\treturn c.commands\n}", "title": "" }, { "docid": "d83938b28728aee9da5114ab1588ed97", "score": "0.6362929", "text": "func getCommandList() []string {\n\tvar commandList []string\n\tfor value := range Commands {\n\t\tcommandList = append(commandList, value)\n\t}\n\treturn commandList\n}", "title": "" }, { "docid": "661dc37868b45b2acf36057431d9acfe", "score": "0.6233398", "text": "func (c *Command) Commands() []*Command {\n\t// do not sort commands if it already sorted or sorting was disabled\n\tif EnableCommandSorting && !c.commandsAreSorted {\n\t\tsort.Sort(commandSorterByName(c.commands))\n\t\tc.commandsAreSorted = true\n\t}\n\treturn c.commands\n}", "title": "" }, { "docid": "b1c97d8155676f57946da21333edd290", "score": "0.6227196", "text": "func AllCommands() ([]cli.Command, error) {\n\t// Create commands\n\tfetchCmd, err := NewFetchCommand()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating fetch command: %s\",\n\t\t\terr.Error())\n\t}\n\n\tlinkCmd, err := NewLinkCommand()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating link command: %s\",\n\t\t\terr.Error())\n\t}\n\n\tcreateCmd, err := NewCreateCommand()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating create command: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// commands holds all the Commands to register with the cli library\n\tcommands := []Command{fetchCmd, linkCmd, createCmd}\n\n\t// cmds holds all the cli library typed Command structs\n\tcmds := []cli.Command{}\n\n\tfor _, cmd := range commands {\n\t\tcmds = append(cmds, cmd.Command())\n\t}\n\n\treturn cmds, nil\n}", "title": "" }, { "docid": "375dac5640427344b7fc724111fad7d5", "score": "0.621985", "text": "func (s *CommandsService) List() *CommandsListCall {\n\treturn &CommandsListCall{\n\t\ts: s.s,\n\t\tpageToken: 1,\n\t\turlParams: make(map[string][]string),\n\t}\n}", "title": "" }, { "docid": "e16ee79c14f76b6f397a555b234b8303", "score": "0.61894286", "text": "func AllCommands() map[string]*Command {\n\treturn commands\n}", "title": "" }, { "docid": "9443051ceaa9419da9a1dd75597d7692", "score": "0.61598545", "text": "func (g Group) Commands() (cmds []*Command) {\n\tg.rw.RLock()\n\tdefer g.rw.RUnlock()\n\treturn g.commands\n}", "title": "" }, { "docid": "92eb5f20f3f5a0ed52cfee4494dcf79c", "score": "0.615188", "text": "func (c *Command) Commands() map[string]Command {\n\treturn c.commands\n}", "title": "" }, { "docid": "222a221fb3bdda08645e74f32f066224", "score": "0.6147424", "text": "func (app *Application) Commands() map[string]*Command {\n\treturn app.commands\n}", "title": "" }, { "docid": "6334b5950ca1bd7610ffbf56f5ab8dea", "score": "0.61373276", "text": "func (a *App) Commands() map[string]Command {\n\treturn a.commands\n}", "title": "" }, { "docid": "79d0cd82c3d27bf68f8b0ad467094cad", "score": "0.6129891", "text": "func (a *App) Commands() []string {\n\tcmds := map[string]bool{}\n\tfor _, cfg := range a.vaultConfigs() {\n\t\tfor _, cmd := range cfg.commands {\n\t\t\tcmds[cmd] = true\n\t\t}\n\t}\n\n\tret := []string{}\n\tfor cmd := range cmds {\n\t\tret = append(ret, cmd)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9f2f48526820fea558c391f7bd3a8230", "score": "0.60990393", "text": "func GetPluginCommandGroups(verifier extensions.PathVerifier) (templates.PluginCommandGroups, bool,\n\terror) {\n\n\totherCommands := templates.PluginCommandGroup{\n\t\tMessage: \"Other Commands\",\n\t}\n\tgroups := make(map[string]templates.PluginCommandGroup, 0)\n\n\tpathCommands := templates.PluginCommandGroup{\n\t\tMessage: \"Locally Available Commands:\",\n\t}\n\n\tpath := \"PATH\"\n\tif runtime.GOOS == \"windows\" {\n\t\tpath = \"path\"\n\t}\n\n\tpaths := sets.NewString(filepath.SplitList(os.Getenv(path))...)\n\tfor _, dir := range paths.List() {\n\t\tfiles, err := ioutil.ReadDir(dir)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, f := range files {\n\t\t\tif f.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !strings.HasPrefix(f.Name(), \"jx-\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpluginPath := filepath.Join(dir, f.Name())\n\t\t\tsubCommand := strings.TrimPrefix(strings.Replace(filepath.Base(pluginPath), \"-\", \" \", -1), \"jx \")\n\t\t\tpc := &templates.PluginCommand{\n\t\t\t\tPluginSpec: jenkinsv1.PluginSpec{\n\t\t\t\t\tSubCommand: subCommand,\n\t\t\t\t\tDescription: pluginPath,\n\t\t\t\t},\n\t\t\t\tErrors: make([]error, 0),\n\t\t\t}\n\t\t\tpathCommands.Commands = append(pathCommands.Commands, pc)\n\t\t\tif errs := verifier.Verify(filepath.Join(dir, f.Name())); len(errs) != 0 {\n\t\t\t\tfor _, err := range errs {\n\t\t\t\t\tpc.Errors = append(pc.Errors, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpcgs := templates.PluginCommandGroups{}\n\tfor _, g := range groups {\n\t\tpcgs = append(pcgs, g)\n\t}\n\tif len(otherCommands.Commands) > 0 {\n\t\tpcgs = append(pcgs, otherCommands)\n\t}\n\tif len(pathCommands.Commands) > 0 {\n\t\tpcgs = append(pcgs, pathCommands)\n\t}\n\treturn pcgs, false, nil\n}", "title": "" }, { "docid": "b01643322449238db4d5897e88d4c3c2", "score": "0.60602397", "text": "func (plugin *Plugin) GetMethods() []string {\n\n\tvar methods []string\n\tmethods = plugin.methods\n\treturn methods\n}", "title": "" }, { "docid": "1d2490de0269cd1bda27c2f274719cca", "score": "0.6057887", "text": "func Commands(globalParams *command.GlobalParams) []*cobra.Command {\n\treturn secrethelper.Commands()\n}", "title": "" }, { "docid": "9397473f8cb6e39f2510eff4ce9c894c", "score": "0.6051828", "text": "func (app *Application) Commands() map[string]*Command {\n\treturn commands\n}", "title": "" }, { "docid": "4ffd67b1d54b41dfa25cd4090b79b545", "score": "0.6050966", "text": "func (m Module) Commands() []telegram.Command {\n\treturn []telegram.Command{\n\t\t{\n\t\t\tName: \"ping\",\n\t\t\tDescription: \"ping the bot.\",\n\t\t\tFunc: m.ping,\n\t\t},\n\t\t{\n\t\t\tName: \"about\",\n\t\t\tDescription: \"about the bot.\",\n\t\t\tFunc: m.about,\n\t\t},\n\t\t{\n\t\t\tName: \"start\",\n\t\t\tDescription: \"start the bot.\",\n\t\t\tFunc: m.start,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "727c8a129d8a6827c2565264dd86fdcb", "score": "0.6024534", "text": "func GetDeviceCommands(client *http.Client, endpoint string, id string) ([]DeviceCommand, error) {\n\tret := []DeviceCommand{}\n\n\tcontents, err := issueCommand(client, endpoint, \"/devices/\"+id+\"/commands\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := json.Unmarshal(contents, &ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "28c65889aac8dd667abded6e49147e92", "score": "0.60067666", "text": "func (cfg *Cfg) ListCommands() []string {\n\tlist := make([]string, 0, len(cfg.commands))\n\tfor cmd := range cfg.commands {\n\t\tlist = append(list, cmd)\n\t}\n\treturn list\n}", "title": "" }, { "docid": "0add1901f754902d597c23680dbcce31", "score": "0.59999686", "text": "func getCommands(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(commands)\n}", "title": "" }, { "docid": "f2607fd84f4dca1714bfec72e989e0f8", "score": "0.5995077", "text": "func (c *Commander) All() map[string]*Command {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\treturn c.commands\n}", "title": "" }, { "docid": "50f9e5260b2e64e6cfd4c5fc121c007b", "score": "0.599144", "text": "func Commands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"fetch\",\n\t\t\tAliases: []string{\"f\"},\n\t\t\tUsage: \"Fetch API information\",\n\t\t\tAction: fetch,\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{Name: \"api-name, a\"},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"list\",\n\t\t\tAliases: []string{\"l\"},\n\t\t\tUsage: \"List APIs.\",\n\t\t\tAction: list,\n\t\t},\n\t\t{\n\t\t\tName: \"publish\",\n\t\t\tAliases: []string{\"p\"},\n\t\t\tUsage: \"Publish API\",\n\t\t\tAction: publish,\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{Name: \"api-name, a\"},\n\t\t\t\tcli.StringFlag{Name: \"filename, f\"},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a5e42a9d899f3c7e086cd17dbc23affb", "score": "0.5990509", "text": "func (b *Bot) Commands() []Command {\n\tcs := append(([]Command)(nil), b.commands...)\n\treturn cs\n}", "title": "" }, { "docid": "4fe3be3ee82ec212b94c974ac83beb62", "score": "0.5977825", "text": "func (Module) GetModuleCommands() []*cli.Command {\n\treturn []*cli.Command{\n\t\t{\n\t\t\tName: \"demo\",\n\t\t\tUsage: \"Demo module of dops\",\n\t\t\tDescription: `NOTICE: This module does nothing, except showing all possible flags for an interactive demo.`,\n\t\t\tCategory: categories.Dops,\n\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tFlags: []cli.Flag{\n\t\t\t\t&cli.BoolFlag{Name: \"Boolean\"},\n\t\t\t\t&cli.DurationFlag{Name: \"Duration\"},\n\t\t\t\t&cli.Float64Flag{Name: \"Float64\"},\n\t\t\t\t&cli.Float64SliceFlag{Name: \"Float64List\"},\n\t\t\t\t&cli.IntFlag{Name: \"Int\"},\n\t\t\t\t&cli.IntSliceFlag{Name: \"IntList\"},\n\t\t\t\t&cli.PathFlag{Name: \"Path\"},\n\t\t\t\t&cli.StringFlag{Name: \"String\"},\n\t\t\t\t&cli.StringSliceFlag{Name: \"StringList\"},\n\t\t\t\t&cli.TimestampFlag{Name: \"Timestamp\"},\n\t\t\t\t&cli.OptionFlag{Name: \"Options\"},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "eb2ba2aa420c4c1a84f51604e35b073e", "score": "0.59286773", "text": "func (rc *anotherCommand) Commands() []Command {\n\treturn []Command{\n\t\t&notRunnableCommand{},\n\t\t&unimplementedCommand{},\n\t\t&simpleCommand{},\n\t}\n}", "title": "" }, { "docid": "c7957a785d8a7b9097b992e6344701f1", "score": "0.59270537", "text": "func ListCommands() (list []string) {\n\tconn.ForEachDoc(func(id int, doc []byte) (moveOn bool) {\n\t\tcmd := new(Command)\n\t\tjson.Unmarshal(doc, cmd)\n\t\tlist = append(list, cmd.Name)\n\t\treturn true\n\t})\n\treturn list\n}", "title": "" }, { "docid": "35eb5b4e1fae022c6932ff7289092809", "score": "0.5892587", "text": "func NewCmdGetPlugins(commonOpts *opts.CommonOptions) *cobra.Command {\n\toptions := &GetPluginsOptions{\n\t\tCommonOptions: commonOpts,\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"plugins\",\n\t\tShort: \"List all visible plugin executables on a user's PATH\",\n\t\tLong: get_plugins_long,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\toptions.Cmd = cmd\n\t\t\toptions.Args = args\n\t\t\terr := options.Complete()\n\t\t\thelper.CheckErr(err)\n\t\t\terr = options.Run()\n\n\t\t\thelper.CheckErr(err)\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "09c142f1de4085a6f1350560d2ef1c8d", "score": "0.5880457", "text": "func Commands(_ *command.GlobalParams) []*cobra.Command {\n\treturn nil\n}", "title": "" }, { "docid": "b7ea3bec3a1fc77382845c8b6f293c30", "score": "0.58792895", "text": "func getMainCommands() []*cobra.Command {\n\trootCommands := []*cobra.Command{\n\t\t_autoUpdateCommand,\n\t\t_cpCommand,\n\t\t_playCommand,\n\t\t_loginCommand,\n\t\t_logoutCommand,\n\t\t_mountCommand,\n\t\t_refreshCommand,\n\t\t_searchCommand,\n\t\t_statsCommand,\n\t\t_umountCommand,\n\t\t_unshareCommand,\n\t}\n\n\tif len(_varlinkCommand.Use) > 0 {\n\t\trootCommands = append(rootCommands, _varlinkCommand)\n\t}\n\treturn rootCommands\n}", "title": "" }, { "docid": "d831cbce268a23268bdd13a76b73c77a", "score": "0.5876687", "text": "func Cmds() [25]string {\n\treturn commands\n}", "title": "" }, { "docid": "c29c37891e6b675c7677ce77aa69ae7f", "score": "0.5865243", "text": "func (c *Commands) GetHelp() []Help {\n\thelp := make([]Help, 0)\n\n\tfor _, command := range c.commands {\n\t\tif helpCommand, ok := command.(HelpProvider); ok {\n\t\t\thelp = append(help, helpCommand.GetHelp()...)\n\t\t}\n\t}\n\n\treturn help\n}", "title": "" }, { "docid": "12aa6d5fda7a75349970d5c1f680194f", "score": "0.5857659", "text": "func Commands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"weixin\",\n\t\t\tUsage: \"Run weixin api\",\n\t\t\tAction: api,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d572a41ed85a870be33a503f4d020aad", "score": "0.5855069", "text": "func (rc *rootCommand) Commands() []Command {\n\treturn []Command{\n\t\t&notRunnableCommand{},\n\t\t&unimplementedCommand{},\n\t}\n}", "title": "" }, { "docid": "0bf8c4c3d163faadc38c9f65ab0bc531", "score": "0.58481175", "text": "func (c *Command) GetAllSubCommands() []*Command {\n\tcommands := make([]*Command, 0, 0)\n\tif c.Runnable() {\n\t\tcommands = append(commands, c)\n\t} else {\n\t\tfor _, subCmd := range c.SubCommands {\n\t\t\tcommands = append(commands, subCmd.GetAllSubCommands()...)\n\t\t}\n\t}\n\treturn commands\n}", "title": "" }, { "docid": "c4c9fe1986a046262253d75e9b829199", "score": "0.5838079", "text": "func (s *Sound) getCommands() error {\n\terr := db.Select(&s.Commands, \"SELECT * FROM command WHERE sound_id = $1\", s.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e229703556d924a7112a4c290fc39f1e", "score": "0.581409", "text": "func GetSubCommands() []*cobra.Command {\n\n\tvar getServicesRoutes = &cobra.Command{\n\t\tUse: \"service-routes\",\n\t\tRunE: actionGetServicesRoutes,\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\t\tproject, check := utils.GetProjectID()\n\t\t\tif !check {\n\t\t\t\tutils.LogDebug(\"Project not specified in flag\", nil)\n\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t}\n\t\t\tobj, err := GetServicesRoutes(project, \"service-route\", map[string]string{})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t}\n\t\t\tvar ids []string\n\t\t\tfor _, v := range obj {\n\t\t\t\tids = append(ids, v.Meta[\"id\"])\n\t\t\t}\n\t\t\treturn ids, cobra.ShellCompDirectiveDefault\n\t\t},\n\t}\n\n\tvar getServicesRole = &cobra.Command{\n\t\tUse: \"service-role\",\n\t\tRunE: actionGetServicesRole,\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\t\tswitch len(args) {\n\t\t\tcase 0:\n\t\t\t\tproject, check := utils.GetProjectID()\n\t\t\t\tif !check {\n\t\t\t\t\tutils.LogDebug(\"Project not specified in flag\", nil)\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tobjs, err := GetServicesRole(project, \"service-role\", map[string]string{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tvar serviceIds []string\n\t\t\t\tfor _, v := range objs {\n\t\t\t\t\tserviceIds = append(serviceIds, v.Meta[\"serviceId\"])\n\t\t\t\t}\n\t\t\t\treturn serviceIds, cobra.ShellCompDirectiveDefault\n\t\t\tcase 1:\n\t\t\t\tproject, check := utils.GetProjectID()\n\t\t\t\tif !check {\n\t\t\t\t\tutils.LogDebug(\"Project not specified in flag\", nil)\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tobjs, err := GetServicesRole(project, \"service-role\", map[string]string{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tvar roleID []string\n\t\t\t\tfor _, v := range objs {\n\t\t\t\t\troleID = append(roleID, v.Meta[\"roleId\"])\n\t\t\t\t}\n\t\t\t\treturn roleID, cobra.ShellCompDirectiveDefault\n\t\t\t}\n\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t},\n\t}\n\n\tvar getServicesSecrets = &cobra.Command{\n\t\tUse: \"secrets\",\n\t\tRunE: actionGetServicesSecrets,\n\t\tValidArgsFunction: secretsAutoCompleteFun,\n\t}\n\n\tvar getServices = &cobra.Command{\n\t\tUse: \"services\",\n\t\tRunE: actionGetServices,\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\t\tswitch len(args) {\n\t\t\tcase 0:\n\t\t\t\tproject, check := utils.GetProjectID()\n\t\t\t\tif !check {\n\t\t\t\t\tutils.LogDebug(\"Project not specified in flag\", nil)\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tobjs, err := GetServices(project, \"service\", map[string]string{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tvar serviceIds []string\n\t\t\t\tfor _, v := range objs {\n\t\t\t\t\tserviceIds = append(serviceIds, v.Meta[\"serviceId\"])\n\t\t\t\t}\n\t\t\t\treturn serviceIds, cobra.ShellCompDirectiveDefault\n\t\t\tcase 1:\n\t\t\t\tproject, check := utils.GetProjectID()\n\t\t\t\tif !check {\n\t\t\t\t\tutils.LogDebug(\"Project not specified in flag\", nil)\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tobjs, err := GetServices(project, \"service\", map[string]string{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t\t\t}\n\t\t\t\tvar versions []string\n\t\t\t\tfor _, v := range objs {\n\t\t\t\t\tversions = append(versions, v.Meta[\"version\"])\n\t\t\t\t}\n\t\t\t\treturn versions, cobra.ShellCompDirectiveDefault\n\t\t\t}\n\t\t\treturn nil, cobra.ShellCompDirectiveDefault\n\t\t},\n\t}\n\n\treturn []*cobra.Command{getServicesRoutes, getServicesSecrets, getServices, getServicesRole}\n}", "title": "" }, { "docid": "b689d39bcf85e90a146054b9d66ed9df", "score": "0.5800459", "text": "func (w *SpamModule) Commands() []Command {\n\treturn []Command{\n\t\t&autoSilenceCommand{w},\n\t\t&wipeCommand{},\n\t\t&getPressureCommand{w},\n\t\t&getRaidCommand{w},\n\t\t&banRaidCommand{w},\n\t}\n}", "title": "" }, { "docid": "27be2f6d081931631e4ff37faf128df2", "score": "0.57818085", "text": "func (c *CommandsListCall) Do() (*ListCommandsResponse, error) {\n\tc.urlParams[\"page\"] = []string{strconv.Itoa(c.pageToken)}\n\turls := c.s.baseURL + \"/commands\" + \"?\" + url.Values(c.urlParams).Encode()\n\treq, err := http.NewRequest(http.MethodGet, urls, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := c.s.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := checkResponse(res); err != nil {\n\t\treturn nil, err\n\t}\n\tret := &ListCommandsResponse{\n\t\tServerResponse: ServerResponse{\n\t\t\tHeader: res.Header,\n\t\t\tStatusCode: res.StatusCode,\n\t\t\tBody: res.Body,\n\t\t},\n\t}\n\tret.Commands = nil\n\ttarget := &ret\n\tif err := json.NewDecoder(res.Body).Decode(&(*target).Commands); err != nil {\n\t\treturn nil, err\n\t}\n\tret.NextPage = c.pageToken + 1\n\treturn ret, nil\n}", "title": "" }, { "docid": "55503daa241a375c7c52ea55ca21338e", "score": "0.57770056", "text": "func (ctx *helpContext) VisibleCommands() []*Command { return ctx.command.visibleCommands }", "title": "" }, { "docid": "907e4b7125da1ca276f13f48f5e74604", "score": "0.57652336", "text": "func (Module) GetModuleCommands() []*cli.Command {\n\treturn []*cli.Command{\n\t\t{\n\t\t\tName: \"ci\",\n\t\t\tUsage: \"Runs on every push to the official GitHub repository of dops\",\n\t\t\tWarning: \"This module should only be used while working on dops\",\n\t\t\tCategory: categories.Dops,\n\t\t\tAction: func(context *cli.Context) error {\n\n\t\t\t\tvar commands []*cli.Command\n\n\t\t\t\tfor _, m := range cli.ActiveModules {\n\t\t\t\t\tcommands = append(commands, m.GetModuleCommands()...)\n\t\t\t\t}\n\n\t\t\t\tsort.Sort(cli.CommandsByName(commands))\n\n\t\t\t\tpterm.Info.Println(\"Cleaning svg files...\")\n\t\t\t\t_ = os.RemoveAll(\"./docs/_assets/example_svg\")\n\t\t\t\t_ = os.MkdirAll(\"./docs/_assets/example_svg\", 0600)\n\n\t\t\t\tpterm.Info.Println(\"Generating documentation...\")\n\n\t\t\t\tfor _, cmd := range commands {\n\t\t\t\t\tpterm.Info.Println(\"Generating docs for: \" + cmd.Name)\n\t\t\t\t\tdoc := cli.CommandDocumentation(cmd, nil, 0)\n\t\t\t\t\terr := ioutil.WriteFile(\"./docs/modules/\"+cmd.Name+\".md\", []byte(doc), 0600)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsidebarPath := \"./docs/_sidebar.md\"\n\t\t\t\tsidebarContentByte, err := ioutil.ReadFile(sidebarPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tsidebarContent := string(sidebarContentByte)\n\n\t\t\t\tbeforeRegex := regexp.MustCompile(`(?ms).*<!-- <<<CI-MODULES-START>> -->`)\n\t\t\t\tafterRegex := regexp.MustCompile(`(?ms)<!-- <<<CI-MODULES-END>> -->.*`)\n\n\t\t\t\tbefore := beforeRegex.FindAllString(sidebarContent, 1)[0]\n\t\t\t\tafter := afterRegex.FindAllString(sidebarContent, 1)[0]\n\n\t\t\t\tvar newSidebarContent string\n\n\t\t\t\tnewSidebarContent += before + \"\\n\"\n\n\t\t\t\tfor _, cmd := range commands {\n\t\t\t\t\tnewSidebarContent += \" - [\" + cmd.Name + \"](modules/\" + cmd.Name + \".md)\\n\"\n\t\t\t\t}\n\n\t\t\t\tnewSidebarContent += after\n\n\t\t\t\tutils.WriteFile(sidebarPath, []byte(newSidebarContent), false)\n\n\t\t\t\tpterm.Success.Println(\"Documentation successfully generated!\")\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tHidden: true,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "4e9a3a475a5df86f8899cc8b3c0c958f", "score": "0.57556975", "text": "func GetCommandList(prefix string) []string {\n\tcommands := make([]string, 0, len(commandListSingleton.commands))\n\n\tfor key := range commandListSingleton.commands {\n\t\tif len(prefix) == 0 {\n\t\t\tcommands = append(commands, key)\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(key, prefix) {\n\t\t\tcommands = append(commands, key)\n\t\t}\n\t}\n\n\treturn commands\n}", "title": "" }, { "docid": "0f5a855cdac05346efc0d1088b0edbe6", "score": "0.5751763", "text": "func getPlaySubCommands() []*cobra.Command {\n\treturn []*cobra.Command{\n\t\t_playKubeCommand,\n\t}\n}", "title": "" }, { "docid": "4a662f25afcc5e2fc1e25fcf4544c388", "score": "0.573928", "text": "func GetCommand() cli.Command {\n\treturn cli.Command{\n\t\tName: \"get\",\n\t\tUsage: \"Querys the admin api for a list of the specified resource\",\n\t\tAction: action.Get,\n\t}\n}", "title": "" }, { "docid": "19f16fdc94fb9436338da7d8509b9ddb", "score": "0.57343477", "text": "func (c *Command) Commands() []*Command {\n\tcmds := []*Command{}\n\tcobraCommands := c.Command.Commands()\n\tfor _, cmd := range cobraCommands {\n\t\tcmds = append(cmds, NewCommand(cmd))\n\t}\n\treturn cmds\n}", "title": "" }, { "docid": "f507624ce7131b86a5deab960b472838", "score": "0.5703653", "text": "func (brc *badRootCommand) Commands() []Command {\n\treturn []Command{\n\t\t&simpleCommand{},\n\t\t&simpleCommand{},\n\t}\n}", "title": "" }, { "docid": "a0ce71f35d8888f49b2b1253b1be94ac", "score": "0.56981117", "text": "func GetFeatures() []string {\r\n\tvar features []string\r\n\tfor k := range Conf.Commands {\r\n\t\tfeatures = append(features, k)\r\n\t}\r\n\treturn features\r\n}", "title": "" }, { "docid": "7531674a194b07a7c8d5b2b761bbdf44", "score": "0.56922364", "text": "func (c *Command) CobraCommands() []*cobra.Command {\n\treturn c.Command.Commands()\n}", "title": "" }, { "docid": "a8d998c889cbda4c5409f6b9a05e3800", "score": "0.5691046", "text": "func FetchGetSubCommands() *cobra.Command {\n\tvar getCmd = &cobra.Command{\n\t\tUse: \"get\",\n\t\tShort: \"\",\n\t\tSilenceErrors: true,\n\t}\n\tgetCmd.AddCommand(auth.GetSubCommands()...)\n\tgetCmd.AddCommand(database.GetSubCommands()...)\n\tgetCmd.AddCommand(eventing.GetSubCommands()...)\n\tgetCmd.AddCommand(filestore.GetSubCommands()...)\n\tgetCmd.AddCommand(ingress.GetSubCommands()...)\n\tgetCmd.AddCommand(letsencrypt.GetSubCommands()...)\n\tgetCmd.AddCommand(project.GetSubCommands()...)\n\tgetCmd.AddCommand(remoteservices.GetSubCommands()...)\n\tgetCmd.AddCommand(services.GetSubCommands()...)\n\tgetCmd.AddCommand(getSubCommands()...)\n\n\treturn getCmd\n}", "title": "" }, { "docid": "6960f42a5ebd9b27de53de98768832aa", "score": "0.5682963", "text": "func getContainerSubCommands() []*cobra.Command {\n\n\treturn []*cobra.Command{\n\t\t_cpCommand,\n\t\t_cleanupCommand,\n\t\t_mountCommand,\n\t\t_refreshCommand,\n\t\t_runlabelCommand,\n\t\t_statsCommand,\n\t\t_umountCommand,\n\t}\n}", "title": "" }, { "docid": "1c89bfa84d385074e9153c7af10c6a17", "score": "0.56814456", "text": "func getAdditionalCommands() {\n\tadditionalCommands := flags.addedCommands\n\tSupportedCommands = appendUnique(SupportedCommands, additionalCommands)\n}", "title": "" }, { "docid": "5e8458d127b1816639bdd8bbcfd1e1cf", "score": "0.5678092", "text": "func (rcf *rootCommandWithFlags) Commands() []Command {\n\treturn []Command{\n\t\t&notRunnableCommand{},\n\t\t&innerCommand{},\n\t}\n}", "title": "" }, { "docid": "3715436d725d554811fb09de123e0526", "score": "0.5663359", "text": "func NewCommands() map[string]*Command {\n\treturn make(map[string]*Command)\n}", "title": "" }, { "docid": "842b6c978a2afccd9e4015545c7a2aa1", "score": "0.55706936", "text": "func SubCommands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"list\",\n\t\t\tUsage: \"Lists the available Locations.\",\n\t\t\tAction: cmd.LocationList,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "15b7cc1e82adb9a305414a914a804f4b", "score": "0.55587155", "text": "func (p *CommandParking) GetCommandArray() []string {\n\treturn p.commandArray\n}", "title": "" }, { "docid": "2d91297372495839e80bad406ac642cb", "score": "0.5534856", "text": "func listCommands() {\n\tconst (\n\t\tcategoryChain uint8 = iota\n\t\tcategoryWallet\n\t\tnumCategories\n\t)\n\n\t// Get a list of registered commands and categorize and filter them.\n\tcmdMethods := btcjson.RegisteredCmdMethods()\n\tcategorized := make([][]string, numCategories)\n\tfor _, method := range cmdMethods {\n\t\tflags, err := btcjson.MethodUsageFlags(method)\n\t\tif err != nil {\n\t\t\t// This should never happen since the method was just\n\t\t\t// returned from the package, but be safe.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip the commands that aren't usable from this utility.\n\t\tif flags&unusableFlags != 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tusage, err := btcjson.MethodUsageText(method)\n\t\tif err != nil {\n\t\t\t// This should never happen since the method was just\n\t\t\t// returned from the package, but be safe.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Categorize the command based on the usage flags.\n\t\tcategory := categoryChain\n\t\tif flags&btcjson.UFWalletOnly != 0 {\n\t\t\tcategory = categoryWallet\n\t\t}\n\t\tcategorized[category] = append(categorized[category], usage)\n\t}\n\n\t// Display the command according to their categories.\n\tcategoryTitles := make([]string, numCategories)\n\tcategoryTitles[categoryChain] = \"Chain Server Commands:\"\n\tcategoryTitles[categoryWallet] = \"Wallet Server Commands (--wallet):\"\n\tfor category := uint8(0); category < numCategories; category++ {\n\t\tfmt.Println(categoryTitles[category])\n\t\tfor _, usage := range categorized[category] {\n\t\t\tfmt.Println(usage)\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "373381c3bc43431be4812bfd70228bce", "score": "0.5530304", "text": "func (s *Sensor) Commands() []string {\n\tif s.commands == nil {\n\t\treturn nil\n\t}\n\t// Return a copy to prevent users\n\t// changing the values under our feet.\n\tavail := make([]string, len(s.commands))\n\tcopy(avail, s.commands)\n\treturn avail\n}", "title": "" }, { "docid": "b24afe2349f9c89b06a294bc8343853d", "score": "0.5511865", "text": "func GetCmdList(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"Query all the runners\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tres, _, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", queryRoute, types.QueryList), nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"could not list runners\\n%s\\n\", err.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out []*runner.Runner\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e9f7397c06d0e2877719f8c681e56529", "score": "0.5510213", "text": "func (lt *Layout) Commands() (cmds []tele.Command) {\n\tfor k, v := range lt.commands {\n\t\tcmds = append(cmds, tele.Command{\n\t\t\tText: strings.TrimLeft(k, \"/\"),\n\t\t\tDescription: v,\n\t\t})\n\t}\n\treturn\n}", "title": "" }, { "docid": "dfc7e3e6b1a574e2660db9739a835aaa", "score": "0.5501978", "text": "func CreateGlobalCommands() []Command {\n\treturn []Command{\n\t\tNewGlobalCommand([][]string{{\"clinicus\"}}, \"The Clinicus may appear at first a doddering old man, but inside he is quite deft. It is always easy to begin a war, but very difficult to stop one.\"),\n\t\tNewGlobalCommand([][]string{{\"legionary\"}}, \"I have always been of the opinion that unpopularity earned by doing what is right is not unpopularity at all, but glory.\"),\n\t\tNewGlobalCommand([][]string{{\"centurion\"}}, \"Great empires are not maintained by timidity.\"),\n\t\tNewGlobalCommand([][]string{{\"scorpion\"}}, \"For the last time, Scorpios are Roman anti-Infantry siege craft. Scorpions are what crawls out of the mouths of dead Egyptians.\"),\n\t\tNewGlobalCommand([][]string{{\"decurion\"}}, \"Roma Invicta! We gather strength as we go!\"),\n\t\tNewGlobalCommand([][]string{{\"aquilifer\"}}, \"Where there is unity, there is victory. We must defend our Eagle with our lives!\"),\n\t\tNewGlobalCommand([][]string{{\"gold\"}}, \"The sinews of war are infinite money.\"),\n\t}\n}", "title": "" }, { "docid": "60bd1acb7b86701ffe9ecff5774723b5", "score": "0.54915285", "text": "func GetCommand() *cobra.Command {\n\treturn powerCmd\n}", "title": "" }, { "docid": "60bd1acb7b86701ffe9ecff5774723b5", "score": "0.54915285", "text": "func GetCommand() *cobra.Command {\n\treturn powerCmd\n}", "title": "" }, { "docid": "ee544d0e4f8602eeb77f69280820a4bc", "score": "0.54718596", "text": "func (w *SpamModule) Commands() []bot.Command {\n\treturn []bot.Command{\n\t\t&autoSilenceCommand{w},\n\t\t&wipeCommand{},\n\t\t&getPressureCommand{w},\n\t\t&getRaidCommand{w},\n\t\t&banRaidCommand{w},\n\t}\n}", "title": "" }, { "docid": "a277daefa3ea852d6a16325408e37963", "score": "0.5469863", "text": "func SubCommands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"list\",\n\t\t\tUsage: \"Lists the available Apps.\",\n\t\t\tAction: cmd.AppList,\n\t\t},\n\t\t{\n\t\t\tName: \"deploy\",\n\t\t\tUsage: \"Deploys the App with the given id as a server on the cloud.\",\n\t\t\tAction: cmd.AppDeploy,\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"id\",\n\t\t\t\t\tUsage: \"Identifier of the App which will be deployed\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"location-id\",\n\t\t\t\t\tUsage: \"Identifier of the Location on which the App will be deployed\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"cloud-account-id\",\n\t\t\t\t\tUsage: \"Identifier of the Cloud Account with which the App will be deployed\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"server-plan-id\",\n\t\t\t\t\tUsage: \"Identifier of the Server Plan on which the App will be deployed\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"hostname\",\n\t\t\t\t\tUsage: \"A hostname for the cloud server to deploy\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "64a2d7eeecf960262c7961c36a4439cc", "score": "0.5468547", "text": "func SubCommands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"firewall-profiles\",\n\t\t\tUsage: \"Provides information about firewall profiles\",\n\t\t\tSubcommands: append(firewall_profiles.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"floating-ips\",\n\t\t\tUsage: \"Provides information about floating IPs\",\n\t\t\tSubcommands: append(floating_ips.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"load-balancers\",\n\t\t\tUsage: \"Provides information about load balancers\",\n\t\t\tSubcommands: append(load_balancers.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"vpcs\",\n\t\t\tUsage: \"Provides information about Virtual Private Clouds (VPCs)\",\n\t\t\tSubcommands: append(vpcs.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"subnets\",\n\t\t\tUsage: \"Provides information about VPC Subnets\",\n\t\t\tSubcommands: append(subnets.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"vpns\",\n\t\t\tUsage: \"Provides information about VPC Virtual Private Networks (VPNs)\",\n\t\t\tSubcommands: append(vpns.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"dns-domains\",\n\t\t\tUsage: \"Provides information about DNS domains and records\",\n\t\t\tSubcommands: append(domains.SubCommands()),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ff97ed51ac072ba7021555148e061d62", "score": "0.54606855", "text": "func DebugCommands() *Commands {\n\tc := &Commands{}\n\n\tc.cmds = []command{\n\t\tcommand{aliases: []string{\"help\"}, cmdFn: c.help, helpMsg: \"Prints the help message.\"},\n\t\tcommand{aliases: []string{\"break\", \"b\"}, cmdFn: breakpoint, helpMsg: \"Set break point at the entry point of a function, or at a specific file/line. Example: break foo.go:13\"},\n\t\tcommand{aliases: []string{\"continue\", \"c\"}, cmdFn: cont, helpMsg: \"Run until breakpoint or program termination.\"},\n\t\tcommand{aliases: []string{\"step\", \"si\"}, cmdFn: step, helpMsg: \"Single step through program.\"},\n\t\tcommand{aliases: []string{\"next\", \"n\"}, cmdFn: next, helpMsg: \"Step over to next source line.\"},\n\t\tcommand{aliases: []string{\"threads\"}, cmdFn: threads, helpMsg: \"Print out info for every traced thread.\"},\n\t\tcommand{aliases: []string{\"thread\", \"t\"}, cmdFn: thread, helpMsg: \"Switch to the specified thread.\"},\n\t\tcommand{aliases: []string{\"clear\"}, cmdFn: clear, helpMsg: \"Deletes breakpoint.\"},\n\t\tcommand{aliases: []string{\"goroutines\"}, cmdFn: goroutines, helpMsg: \"Print out info for every goroutine.\"},\n\t\tcommand{aliases: []string{\"breakpoints\", \"bp\"}, cmdFn: breakpoints, helpMsg: \"Print out info for active breakpoints.\"},\n\t\tcommand{aliases: []string{\"print\", \"p\"}, cmdFn: printVar, helpMsg: \"Evaluate a variable.\"},\n\t\tcommand{aliases: []string{\"info\"}, cmdFn: info, helpMsg: \"Provides info about args, funcs, locals, sources, or vars.\"},\n\t\tcommand{aliases: []string{\"exit\"}, cmdFn: nullCommand, helpMsg: \"Exit the debugger.\"},\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "390ecee0d8c1b61b3b81daf061402a73", "score": "0.5458958", "text": "func SubCommands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"list\",\n\t\t\tUsage: \"This action lists the server plans offered by the cloud provider identified by the given id.\",\n\t\t\tAction: cmd.ServerPlanList,\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"cloud-provider-id\",\n\t\t\t\t\tUsage: \"Cloud provider id\",\n\t\t\t\t},\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"realm-id\",\n\t\t\t\t\tUsage: \"Identifier of the realm to which the server plan belongs\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"show\",\n\t\t\tUsage: \"This action shows information about the Server Plan identified by the given id.\",\n\t\t\tAction: cmd.ServerPlanShow,\n\t\t\tFlags: []cli.Flag{\n\t\t\t\tcli.StringFlag{\n\t\t\t\t\tName: \"id\",\n\t\t\t\t\tUsage: \"Server plan id\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "afe5125c68a62985f116f8e9b30a8fba", "score": "0.5447081", "text": "func NewCommands() com.UsersCommandHandler {\n\treturn &com.UsersCommandHandlers{}\n}", "title": "" }, { "docid": "1e4c135b4639b163ff4627bede1051b5", "score": "0.543493", "text": "func (s *DefaultStore) GetCommand(name string) (string, error) {\n\tcmd, ok := s.commands[name]\n\tif !ok {\n\t\treturn \"\", errors.Errorf(\"plugin %q doesn't have command\", name)\n\t}\n\n\treturn cmd, nil\n}", "title": "" }, { "docid": "ce0314affdf31d29a44c3143e8ae84e2", "score": "0.54348963", "text": "func (d *Device) ListCommands(params *ListParams) ([]*Command, *Error) {\n\tif params == nil {\n\t\tparams = &ListParams{}\n\t}\n\n\tparams.DeviceId = d.Id\n\n\tdata, pErr := params.Map()\n\tif pErr != nil {\n\t\treturn nil, &Error{name: InvalidRequestErr, reason: pErr.Error()}\n\t}\n\n\trawRes, err := d.client.request(resourcenames.ListCommands, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar list []*Command\n\tpErr = json.Unmarshal(rawRes, &list)\n\tif pErr != nil {\n\t\treturn nil, newJSONErr(pErr)\n\t}\n\n\tfor _, c := range list {\n\t\tc.client = d.client\n\t}\n\n\treturn list, nil\n}", "title": "" }, { "docid": "12ad5822ecdfc5e24314c0e691ced27e", "score": "0.5413075", "text": "func (c *Cmd) GetHandlers() []Handler {\n\treturn []Handler{\n\t\tNewCmdHandler(GetSTHConsistency, c.GetSTHConsistency),\n\t\tNewCmdHandler(GetSTH, c.GetSTH),\n\t\tNewCmdHandler(GetEntries, c.GetEntries),\n\t\tNewCmdHandler(GetProofByHash, c.GetProofByHash),\n\t\tNewCmdHandler(GetEntryAndProof, c.GetEntryAndProof),\n\t\tNewCmdHandler(GetIssuers, c.GetIssuers),\n\t\tNewCmdHandler(Webfinger, c.Webfinger),\n\t\tNewCmdHandler(AddVC, c.AddVC),\n\t\tNewCmdHandler(AddLdContext, c.AddLdContext),\n\t}\n}", "title": "" }, { "docid": "13ad399f2db0890c1785c88d2c2667a7", "score": "0.54067224", "text": "func GetTxCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: fmt.Sprintf(\"%s transactions subcommands\", types.ModuleName),\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\n\tcmd.AddCommand(\n\t\tCmdCreateChannel(),\n\t\tCmdSendMessage(),\n\t\tCmdVotePoll(),\n\t)\n\n\treturn cmd\n}", "title": "" }, { "docid": "b24d49c6eb0e428d6ceec2ce6bb11aa4", "score": "0.54054403", "text": "func (w *StatusModule) Commands() []bot.Command {\n\treturn []bot.Command{\n\t\t&setStatusCommand{},\n\t\t&addStatusCommand{},\n\t\t&removeStatusCommand{},\n\t}\n}", "title": "" }, { "docid": "dc6ba74ccd37e36fd09cb8b50c64262d", "score": "0.5387151", "text": "func SubCommands() []cli.Command {\n\treturn []cli.Command{\n\t\t{\n\t\t\tName: \"firewall-profiles\",\n\t\t\tUsage: \"Provides information about firewall profiles\",\n\t\t\tSubcommands: append(firewall_profiles.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"floating-ips\",\n\t\t\tUsage: \"Provides information about floating IPs\",\n\t\t\tSubcommands: append(floating_ips.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"vpcs\",\n\t\t\tUsage: \"Provides information about Virtual Private Clouds (VPCs)\",\n\t\t\tSubcommands: append(vpcs.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"subnets\",\n\t\t\tUsage: \"Provides information about VPC Subnets\",\n\t\t\tSubcommands: append(subnets.SubCommands()),\n\t\t},\n\t\t{\n\t\t\tName: \"vpns\",\n\t\t\tUsage: \"Provides information about VPC Virtual Private Networks (VPNs)\",\n\t\t\tSubcommands: append(vpns.SubCommands()),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "08edfb3afcdcded64968bc54fdb6a2e7", "score": "0.538135", "text": "func (m *Rails) Commands(c *typgo.Context) []*cli.Command {\n\treturn []*cli.Command{\n\t\t{\n\t\t\tName: \"rails\",\n\t\t\tUsage: \"Rails-like generation\",\n\t\t\tSubcommands: []*cli.Command{\n\t\t\t\tscaffoldCmd(c),\n\t\t\t\trepositoryCmd(c),\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2d4ecebf4bf6e46432fe73d28e084b23", "score": "0.53788483", "text": "func (f *RuleStore) GetRecordedCommands(predicate func(cmd interface{}) (interface{}, bool)) []interface{} {\n\tf.mtx.Lock()\n\tdefer f.mtx.Unlock()\n\n\tresult := make([]interface{}, 0, len(f.RecordedOps))\n\tfor _, op := range f.RecordedOps {\n\t\tcmd, ok := predicate(op)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cmd)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "70987ce9ed3b297a95cc7ebeed2f77b6", "score": "0.53784823", "text": "func Commands(globalParams *command.GlobalParams) []*cobra.Command {\n\tversionCmd := version.MakeCommand(\"Agent\")\n\n\treturn []*cobra.Command{versionCmd}\n}", "title": "" }, { "docid": "037d5e25f3a5234ced67d270dcae8e87", "score": "0.53665924", "text": "func GetCmdDistributions(queryRoute string) *cobra.Command {\n\n\tcmd := &cobra.Command{\n\t\tUse: \"distributions-all\",\n\t\tShort: \"get a list of all distributions \",\n\t\tArgs: cobra.ExactArgs(0),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", queryRoute, types.QueryAllDistributions)\n\t\t\tres, height, err := clientCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvar dr types.Distributions\n\t\t\ttypes.ModuleCdc.MustUnmarshalJSON(res, &dr)\n\t\t\tout := types.NewQueryAllDistributionsResponse(dr, height)\n\t\t\treturn clientCtx.PrintProto(&out)\n\t\t},\n\t}\n\tflags.AddQueryFlagsToCmd(cmd)\n\treturn cmd\n}", "title": "" }, { "docid": "f8cf75ec2102f4dad6cbf591a2391142", "score": "0.5360179", "text": "func (m *AntiRaidMod) Commands() map[string]*base.ModCommand {\n\treturn m.commands\n}", "title": "" }, { "docid": "59db28bf9a301152bbe248bf8533e07c", "score": "0.53577423", "text": "func (c *Command) GetHandlers() []command.Handler {\n\treturn []command.Handler{\n\t\tcmdutil.NewCommandHandler(CommandName, SendDIDDocRequest, c.SendDIDDocRequest),\n\t\tcmdutil.NewCommandHandler(CommandName, SendRegisterRouteRequest, c.SendRegisterRouteRequest),\n\t}\n}", "title": "" }, { "docid": "cb89f73c0be5e383f2a772b279ec1439", "score": "0.53441745", "text": "func (c *Command) GetHandlers() []command.Handler {\n\treturn []command.Handler{\n\t\tcmdutil.NewCommandHandler(commandName, saveCredentialCommandMethod, c.SaveCredential),\n\t}\n}", "title": "" } ]
047f5ad4447c94065b00999bfeac0f89
Run starts continuous sensor data acquisition loop.
[ { "docid": "9b1668ab0c3b41415cdf50b7bc5cbe0b", "score": "0.7010654", "text": "func (d *BH1750FVI) Run() {\n\tgo func() {\n\t\td.quit = make(chan bool)\n\n\t\ttimer := time.Tick(time.Duration(d.Poll) * time.Millisecond)\n\n\t\tvar lighting float64\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase d.lightingReadings <- lighting:\n\t\t\tcase <-timer:\n\t\t\t\tl, err := d.measureLighting()\n\t\t\t\tif err == nil {\n\t\t\t\t\tlighting = l\n\t\t\t\t}\n\t\t\t\tif err == nil && d.lightingReadings == nil {\n\t\t\t\t\td.lightingReadings = make(chan float64)\n\t\t\t\t}\n\t\t\tcase <-d.quit:\n\t\t\t\td.lightingReadings = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn\n}", "title": "" } ]
[ { "docid": "d43a07afbfa0bbc346aa0f1f15ead349", "score": "0.6955429", "text": "func (c *lscChoco) Run() {\n\tc.status.State = state.RUNNING\n\tfor i := range c.sensors {\n\t\tc.sensors[i].SetState(state.RUNNING)\n\t\tgo c.sensors[i].Run()\n\t}\n}", "title": "" }, { "docid": "89d7f627590a4ed2075f9a2887cc3959", "score": "0.6612477", "text": "func (c *ClockHand) Run() {\n\tCalibrate(true, c.Encoder, c.Hand, c.Config.Steps)\n}", "title": "" }, { "docid": "08d706f92cb53c6e7de1fb6edd51cd8c", "score": "0.6562002", "text": "func (c *csiManager) Run() {\n\tgo c.runLoop()\n}", "title": "" }, { "docid": "72a70c56197b704b6131c6be0b93ce61", "score": "0.64701855", "text": "func (s *AutoScaler) Run() {\n\tticker := s.clock.NewTicker(s.pollPeriod)\n\ts.readyCh <- struct{}{} // For testing.\n\n\t// Don't wait for ticker and execute pollAPIServer() for the first time.\n\ts.pollAPIServer()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C():\n\t\t\ts.pollAPIServer()\n\t\tcase <-s.stopCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "156922137cc165093c5cfe75fcb349a1", "score": "0.6435637", "text": "func (p *GaugeCollectionProcess) Run() {\n\tdefer close(p.stopped)\n\n\t// Wait a random amount of time\n\tstopReceived := p.delayStart()\n\tif stopReceived {\n\t\treturn\n\t}\n\n\t// Create a ticker to start each cycle\n\tp.resetTicker()\n\n\t// Loop until we get a signal to stop\n\tfor {\n\t\tselect {\n\t\tcase <-p.ticker.C:\n\t\t\tp.collectAndFilterGauges()\n\t\tcase <-p.stop:\n\t\t\t// Can't use defer because this might\n\t\t\t// not be the original ticker.\n\t\t\tp.ticker.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4c869bc5f9f6500ceb16f3a90b36d48e", "score": "0.63650286", "text": "func Run() {\n\tflag.Parse()\n\n\tif enableDebug {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\n\tlog.Infof(\"sensor: args => %#v\", os.Args)\n\n\tdirName, err := os.Getwd()\n\terrutils.WarnOn(err)\n\tlog.Debugf(\"sensor: cwd => %#v\", dirName)\n\n\tinitSignalHandlers()\n\tdefer func() {\n\t\tlog.Debug(\"defered cleanup on shutdown...\")\n\t\tcleanupOnShutdown()\n\t}()\n\n\tlog.Debug(\"sensor: setting up channels...\")\n\tdoneChan = make(chan struct{})\n\n\terr = ipc.InitChannels()\n\terrutils.FailOn(err)\n\n\tcmdChan, err := ipc.RunCmdServer(doneChan)\n\terrutils.FailOn(err)\n\n\tmonDoneChan := make(chan bool, 1)\n\tmonDoneAckChan := make(chan bool)\n\tpidsChan := make(chan []int, 1)\n\tptmonStartChan := make(chan int, 1)\n\n\tlog.Info(\"sensor: waiting for commands...\")\ndoneRunning:\n\tfor {\n\t\tselect {\n\t\tcase cmd := <-cmdChan:\n\t\t\tlog.Debug(\"\\nsensor: command => \", cmd)\n\t\t\tswitch data := cmd.(type) {\n\t\t\tcase *messages.StartMonitor:\n\t\t\t\tif data == nil {\n\t\t\t\t\tlog.Info(\"sensor: 'start' command - no data...\")\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tlog.Debugf(\"sensor: 'start' command (%#v) - starting monitor...\", data)\n\t\t\t\tmonitor(monDoneChan, monDoneAckChan, pidsChan, ptmonStartChan, data, dirName)\n\n\t\t\t\t//target app started by ptmon... (long story :-))\n\t\t\t\t//TODO: need to get the target app pid to pemon, so it can filter process events\n\t\t\t\tlog.Debugf(\"sensor: target app started => %v %#v\", data.AppName, data.AppArgs)\n\t\t\t\ttime.Sleep(3 * time.Second)\n\n\t\t\tcase *messages.StopMonitor:\n\t\t\t\tlog.Debug(\"sensor: 'stop' command - stopping monitor...\")\n\t\t\t\tbreak doneRunning\n\t\t\tdefault:\n\t\t\t\tlog.Debug(\"sensor: ignoring unknown command => \", cmd)\n\t\t\t}\n\n\t\tcase <-time.After(time.Second * 5):\n\t\t\tlog.Debug(\".\")\n\t\t}\n\t}\n\n\tmonDoneChan <- true\n\tlog.Info(\"sensor: waiting for monitor to finish...\")\n\t<-monDoneAckChan\n\n\tipc.TryPublishEvt(3, \"monitor.finish.completed\")\n\n\tlog.Info(\"sensor: done!\")\n}", "title": "" }, { "docid": "481383b6508b424188e487a5fe8cac3e", "score": "0.63121283", "text": "func (l *LaunchControl) Run(ctx context.Context) error {\n\tctx, cancel := context.WithCancel(ctx)\n\n\tdefer cancel()\n\tch := make(chan Event, ReadBufferDepth)\n\twg := sync.WaitGroup{}\n\n\tfor i := 0; i < NumChannels; i++ {\n\t\tif err := l.Reset(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// The first swap enables double buffering.\n\t\tif err := l.SwapBuffers(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := l.SetTemplate(0); err != nil {\n\t\treturn err\n\t}\n\n\tlcfg := drivers.ListenConfig{\n\t\tTimeCode: false,\n\t\tActiveSense: false,\n\t\tSysEx: true,\n\t\tOnErr: func(err error) {\n\t\t\t_ = l.handleError(err)\n\t\t},\n\t}\n\n\tvar err error\n\tl.stopFn, err = l.inputDriver.Listen(func(msg []byte, milliseconds int32) {\n\t\tif len(msg) == 3 {\n\t\t\tch <- Event{\n\t\t\t\tTimestamp: milliseconds,\n\t\t\t\tStatus: msg[0],\n\t\t\t\tData1: msg[1],\n\t\t\t\tData2: msg[2],\n\t\t\t}\n\t\t} else {\n\t\t\tl.sysexEvent(msg)\n\t\t}\n\t}, lcfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase evt := <-ch:\n\t\t\t\tl.event(evt)\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tticker := time.NewTicker(FlashPeriod)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tl.lock.Lock()\n\t\t\t\tl.flashes++\n\t\t\t\tch := l.currentChannel\n\t\t\t\tl.lock.Unlock()\n\n\t\t\t\t_ = l.SwapBuffers(ch)\n\t\t\t}\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase err := <-l.errorChan:\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "1db19976efcecb6df12e1eb64953513e", "score": "0.6300502", "text": "func Run() {\n\n\tdone := make(chan bool)\n\t// Initialization\n\tdriver.ElevInit()\n\tgo FloorLights()\n\tgo DoorTimer()\n\televatorDirection = DOWN\n\tfor driver.ElevGetFloorSensorSignal() == -1 {\n\t\tdriver.ElevSetSpeed(-SPEED)\n\t}\n\tdriver.ElevSetSpeed(0)\n\tgo Idle()\n\tgo Open()\n\tgo Down()\n\tgo Up()\n\tgo DoorSafety()\n\tidleCh <- true\n\t<-done\n}", "title": "" }, { "docid": "eb5b3400734611bdedfc181c1f9dee82", "score": "0.62875366", "text": "func (a *Aggregator) Run() {\n\tfor {\n\t\tnow := time.Now()\n\t\twait := now.Add(a.pollingInterval).\n\t\t\tTruncate(a.pollingInterval).\n\t\t\tSub(now)\n\t\ttime.Sleep(wait)\n\n\t\tts := time.Now().Truncate(a.pollingInterval)\n\t\tcounts := a.counter.Reset()\n\n\t\ta.mu.Lock()\n\t\ta.data = a.data.Next()\n\t\ta.data.Value = Rate{\n\t\t\tTimestamp: ts.Unix(),\n\t\t\tCounts: counts,\n\t\t}\n\t\ta.mu.Unlock()\n\t}\n}", "title": "" }, { "docid": "bde21c65880c585711a8fd1dcf5a2336", "score": "0.6243527", "text": "func (t *Ticker) Run() {\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.C:\n\t\t\tp, err := t.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- p\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bde21c65880c585711a8fd1dcf5a2336", "score": "0.6243527", "text": "func (t *Ticker) Run() {\n\tfor {\n\t\tselect {\n\t\tcase <-t.Done:\n\t\t\treturn\n\t\tcase <-t.C:\n\t\t\tp, err := t.Get()\n\t\t\tif err != nil {\n\t\t\t\tt.Errs <- err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Data <- p\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a146d9bd4092ac5db50b614a1a038a4f", "score": "0.61958647", "text": "func (c DeviceManager) Run() {\n\tactive := false\n\tmanual := false\n\tstatus := false\n\tsensorTemp, err := tempsensor.GetTemp()\n\ttempsensor.CheckError(err)\n\tif err == nil {\n\t\tactive, manual = c.evaluateState(sensorTemp, calderadevice.CalderaActive)\n\t}\n\n\terr = calderadevice.SetState(active)\n\tcalderadevice.CheckError(err)\n\tcalderaTemp, err := calderadevice.GetTemp()\n\tcalderadevice.CheckError(err)\n\n\tstatus = !calderadevice.CalderaError && !tempsensor.SensorError\n\n\tif calderadevice.CalderaActive != active {\n\t\tlog.Println(\"devicemanager:: new caldera device state \", active)\n\t\tnotifier.NotifyCalderaState(active, manual)\n\t\tcalderadevice.CalderaActive = active\n\t}\n\n\tif int(time.Now().Unix())-lastExternalWeatherRequest > externalWeatherPeriod {\n\t\tresp, err := http.Get(\"https://api.openweathermap.org/data/2.5/weather?units=metric&q=Fuenlabrada,es&appid=62b6faef972916a25c2420b17af38d40\")\n\t\tif err == nil {\n\t\t\tlastExternalWeatherRequest = int(time.Now().Unix())\n\t\t\tvar info map[string]interface{}\n\t\t\tjson.NewDecoder(resp.Body).Decode(&info)\n\t\t\tmain := info[\"main\"].(map[string]interface{})\n\t\t\tLastExternalWeatherTemp = main[\"temp\"].(float64)\n\t\t} else {\n\t\t\tlog.Println(\"devicemanager:: cannot get external temp\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t}\n\te := msgbroker.NewEvent(sensorTemp, calderaTemp, LastExternalWeatherTemp, status, active, manual)\n\tmsgbroker.Publish(e)\n\tled.Update(e)\n}", "title": "" }, { "docid": "9d0c9270d10fcc91ae93a59b21e7f268", "score": "0.6191934", "text": "func (d *DetectorController) Start() {\n\td.wg.Add(1)\n\tgo func() {\n\t\tdefer d.wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-d.stopChan:\n\t\t\t\treturn\n\t\t\tcase <-d.clock.After(d.runInterval):\n\t\t\t}\n\n\t\t\tlogrus.Debugf(\"DetectorController: starting run loop\")\n\t\t\tif err := d.run(); err != nil {\n\t\t\t\tlogrus.WithError(err).Errorf(\"error running DetectorController\")\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e7eb118c242d20556b817fbe155b46fe", "score": "0.618175", "text": "func (s *SignalMonitor) Run() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif s.isOn {\n\t\treturn\n\t}\n\ts.isOn = true\n\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\n\tgo s.process(wg)\n\n\twg.Wait()\n}", "title": "" }, { "docid": "222715262d98fcc43a343a16863e37d7", "score": "0.6170761", "text": "func (v *App) Run() {\n\t// log.Println(\"Starting App polling\")\n\tv.running = true\n\tsdl.SetEventFilterFunc(v.filterEvent, nil)\n\n\t// sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, \"linear\")\n\tv.renderer.SetDrawColor(64, 64, 64, 255)\n\tv.renderer.Clear()\n\n\t// v.pointsGraph.SetSeries(v.pointsGraph.Accessor())\n\tv.spikeGraph.SetSeries(nil)\n\n\tfor v.running {\n\t\tsdl.PumpEvents()\n\n\t\tv.renderer.Clear()\n\n\t\t// v.pointsGraph.MarkDirty(true)\n\t\tv.spikeGraph.MarkDirty(true)\n\n\t\tif samples.PoiSamples != nil {\n\t\t\tdraw := v.spikeGraph.Check()\n\t\t\tif draw {\n\t\t\t\tv.spikeGraph.DrawAt(0, 100)\n\t\t\t}\n\t\t}\n\n\t\tv.expoGraph.DrawAt(0, 300)\n\n\t\tv.txtSimStatus.Draw()\n\t\tv.txtActiveProperty.Draw()\n\n\t\tv.window.UpdateSurface()\n\n\t\t// sdl.Delay(17)\n\t\ttime.Sleep(time.Millisecond * 100)\n\t}\n\n\tv.shutdown()\n}", "title": "" }, { "docid": "5b26a52136470410aad6a62ab7e77170", "score": "0.6157234", "text": "func (monitor *controllerMonitor) Run(stopCh <-chan struct{}) {\n\tklog.Info(\"Starting Antrea Controller Monitor\")\n\tcontrollerCRD := monitor.getControllerCRD()\n\tvar err error = nil\n\tfor {\n\t\tif controllerCRD == nil {\n\t\t\tcontrollerCRD, err = monitor.createControllerCRD()\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to create controller monitoring CRD %v : %v\", controllerCRD, err)\n\t\t\t}\n\t\t} else {\n\t\t\tcontrollerCRD, err = monitor.updateControllerCRD(controllerCRD)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to update controller monitoring CRD %v : %v\", controllerCRD, err)\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(60 * time.Second)\n\t}\n\t<-stopCh\n}", "title": "" }, { "docid": "3f6869d5ac200d1316014713bb3f8f80", "score": "0.6141843", "text": "func (loop *mainLoop) Run() {\n\tloop.running = true\n\n\tfor loop.running {\n\t\tselect {\n\t\t// Send a value over the channel in order to\n\t\t// signal that the loop started.\n\t\tcase loop.initialized <- 1:\n\n\t\t\t// A request to pause the loop is received.\n\t\tcase <-loop.PauseCh:\n\t\t\t// do something or simply send-back a value to\n\t\t\t// the pause channel.\n\t\t\tloop.PauseCh <- 0\n\n\t\t\t// A request to terminate the loop is received.\n\t\tcase <-loop.TerminateCh:\n\t\t\tloop.running = false\n\t\t\tloop.TerminateCh <- 0\n\n\t\t\t// Receive a tick from the ticker.\n\t\tcase <-loop.ticker.C:\n\t\t\t// Initiate the exit procedure.\n\t\t\tapplication.Exit()\n\n\t\t\t// Receive a duration string and create a proper\n\t\t\t// ticker from it.\n\t\tcase durationStr := <-loop.durationCh:\n\t\t\tduration, err := time.ParseDuration(durationStr)\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"Error parsing a duration string.\")\n\t\t\t}\n\t\t\tloop.ticker = time.NewTicker(duration)\n\t\t\tapplication.Logf(\"A new duration received. Running for %s...\", durationStr)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21350f8d6f056929af0c13f49803b9fc", "score": "0.6130177", "text": "func (sO *ScreenOutput) Run() {\n\tfor _, channel := range sO.DataInput {\n\t\tgo sO.runChannelInput(channel)\n\t}\n}", "title": "" }, { "docid": "dd650257811c9b5f5f9803f1b6f959ce", "score": "0.6098018", "text": "func (t *Terminal) Run() error {\n\tend := make(chan int)\n\tvar err error\n\tgo func() {\n\t\t_, err = io.Copy(t.displayDevice, t.computingDevice)\n\t\tend <- 1\n\t}()\n\n\tgo func() {\n\t\t_, err = io.Copy(t.computingDevice, t.inputDevice)\n\t\tend <- 1\n\t}()\n\t<-end\n\treturn err\n}", "title": "" }, { "docid": "8f912134cd0761893af78a44dbfffd75", "score": "0.6079436", "text": "func (w *Watcher) Run() {\n\tfor {\n\t\tif w.closed {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Millisecond * time.Duration(w.Interval))\n\t\tl := len(w.Inputs)\n\t\tw.LogFunc(\"Checking %d items...\\n\", l)\n\t\tw.DoRemoval()\n\t\tw.DoUpdate()\n\t\ttime.Sleep(time.Millisecond * time.Duration(w.Interval))\n\t}\n}", "title": "" }, { "docid": "d6b3e14f14eca1c58df01485c135ff96", "score": "0.6075075", "text": "func (client *Client) Run(done chan bool, ready chan bool) {\n\tif client.Config == nil {\n\t\tlog.Fatalln(\"nil Config struct for websocket Client -> make sure valid Config is accessible to websocket Client\")\n\t}\n\n\tch := &Channel{\n\t\tConnection: client.connection(),\n\t\tEventHandler: client.EventHandler,\n\t}\n\n\tclient.Channel = ch\n\n\tif !client.DisabledReader {\n\t\tgo ch.read()\n\t}\n\n\tready <- true\n\n\tlog.Printf(\"\\nconnected to %s\\n\", client.Config.WSURL)\n\n\t<-done\n\n\tlog.Println(\"reading stopped\")\n}", "title": "" }, { "docid": "52d7be24f478d6ffc5bcc631a993a4cc", "score": "0.60618913", "text": "func (pc *ParticleClient) Run() error {\n\tlog.Println(\"Starting particle client: \", pc.config.Description)\n\n\tcloseReader := make(chan struct{}) // is closed to close reader\n\treaderClosed := make(chan struct{}) // struct{} is sent when reader exits\n\tvar readerRunning bool // indicates reader is running\n\n\tparticleReader := func() {\n\t\tdefer func() {\n\t\t\treaderClosed <- struct{}{}\n\t\t}()\n\n\t\turlAuth := particleEventURL + \"sample\" + \"?access_token=\" + pc.config.AuthToken\n\n\t\tstream, err := eventsource.Subscribe(urlAuth, \"\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Particle subscription error: \", err)\n\t\t\treturn\n\t\t}\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-stream.Events:\n\t\t\t\tvar pEvent ParticleEvent\n\t\t\t\terr := json.Unmarshal([]byte(event.Data()), &pEvent)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Got error decoding particle event: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tvar pPoints []particlePoint\n\t\t\t\terr = json.Unmarshal([]byte(pEvent.Data), &pPoints)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"error decoding Particle samples: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpoints := make(data.Points, len(pPoints))\n\n\t\t\t\tfor i, p := range pPoints {\n\t\t\t\t\tpoints[i] = p.toPoint()\n\t\t\t\t\tpoints[i].Time = pEvent.Timestamp\n\t\t\t\t}\n\n\t\t\t\terr = SendNodePoints(pc.nc, pc.config.ID, points, false)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Particle error sending points: \", err)\n\t\t\t\t}\n\n\t\t\tcase err := <-stream.Errors:\n\t\t\t\tlog.Println(\"Particle error: \", err)\n\n\t\t\tcase <-closeReader:\n\t\t\t\tlog.Println(\"Exiting particle reader\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tcheckTime := time.Minute\n\tcheckReader := time.NewTicker(checkTime)\n\n\tstartReader := func() {\n\t\tif readerRunning {\n\t\t\treturn\n\t\t}\n\t\treaderRunning = true\n\t\tgo particleReader()\n\t\tcheckReader.Stop()\n\t}\n\n\tstopReader := func() {\n\t\tif readerRunning {\n\t\t\tcloseReader <- struct{}{}\n\t\t\treaderRunning = false\n\t\t}\n\t}\n\n\tstartReader()\n\ndone:\n\tfor {\n\t\tselect {\n\t\tcase <-pc.stop:\n\t\t\tlog.Println(\"Stopping particle client: \", pc.config.Description)\n\t\t\tbreak done\n\t\tcase pts := <-pc.newPoints:\n\t\t\terr := data.MergePoints(pts.ID, pts.Points, &pc.config)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"error merging new points: \", err)\n\t\t\t}\n\n\t\t\tfor _, p := range pts.Points {\n\t\t\t\tswitch p.Type {\n\t\t\t\tcase data.PointTypeAuthToken:\n\t\t\t\t\tstopReader()\n\t\t\t\t\tstartReader()\n\t\t\t\tcase data.PointTypeDisable:\n\t\t\t\t\tif p.Value == 1 {\n\t\t\t\t\t\tstopReader()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstartReader()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase pts := <-pc.newEdgePoints:\n\t\t\terr := data.MergeEdgePoints(pts.ID, pts.Parent, pts.Points, &pc.config)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"error merging new points: \", err)\n\t\t\t}\n\n\t\tcase <-readerClosed:\n\t\t\treaderRunning = false\n\t\t\tcheckReader.Reset(checkTime)\n\n\t\tcase <-checkReader.C:\n\t\t\tstartReader()\n\t\t}\n\t}\n\n\t// clean up\n\tstopReader()\n\treturn nil\n}", "title": "" }, { "docid": "290dccaa72f9d947ee39537dea685b03", "score": "0.6032979", "text": "func (e *Engine) Run() {\n\te.running = true\n\tstart := time.Now()\n\n\tfor e.running {\n\t\te.simStepper.Step(e.World, e.World, time.Since(start))\n\t}\n}", "title": "" }, { "docid": "cd55bd8fee80105b242ec199a1f65317", "score": "0.59925914", "text": "func (c *Reader) Run() {\n\t// Log service settings\n\tc.logSettings()\n\n\t// Run immediately\n\tc.poll()\n\n\t// Schedule additional runs\n\tsched := cron.New()\n\tsched.AddFunc(fmt.Sprintf(\"@every %s\", c.opts.LookupInterval), c.poll)\n\tsched.Start()\n}", "title": "" }, { "docid": "9126636535009d1a6627a1cd4d5118db", "score": "0.59733474", "text": "func (c *client) Run() {\n\tstream, err := c.client.ListAndWatch(context.Background(), &api.Empty{})\n\tif err != nil {\n\t\tklog.ErrorS(err, \"ListAndWatch ended unexpectedly for device plugin\", \"resource\", c.resource)\n\t\treturn\n\t}\n\n\tfor {\n\t\tresponse, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tklog.ErrorS(err, \"ListAndWatch ended unexpectedly for device plugin\", \"resource\", c.resource)\n\t\t\treturn\n\t\t}\n\t\tklog.V(2).InfoS(\"State pushed for device plugin\", \"resource\", c.resource, \"resourceCapacity\", len(response.Devices))\n\t\tc.handler.PluginListAndWatchReceiver(c.resource, response)\n\t}\n}", "title": "" }, { "docid": "f85d6472d11e96df6a077d939cfb3c6c", "score": "0.59524536", "text": "func (r *serverOneDotOne) Run() {\n\tr.state = RstateRunning\n\n\t// event handling is a NOP in this model\n\trxcallback := func(ev EventInterface) int {\n\t\tassert(r == ev.GetTarget())\n\t\tlog(LogVV, \"proc-ed\", ev.String())\n\t\treturn 0\n\t}\n\n\tgo func() {\n\t\tfor r.state == RstateRunning {\n\t\t\tr.receiveEnqueue()\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tr.processPendingEvents(rxcallback)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "5ea38cb9d4e041393c21b3da2fa22093", "score": "0.59515995", "text": "func (r *Renewer) Run(done <-chan struct{}) error {\n\tticker := time.NewTicker(time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tif err := r.tick(); err != nil {\n\t\t\t\tticker.Stop()\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-done:\n\t\t\tticker.Stop()\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "faa839d2a4531532a92bcf0e336417cd", "score": "0.5936852", "text": "func (ctx Context) Run() {\n\tstdin := bufio.NewReader(os.Stdin)\n\t// the UGE load sensor protocol\n\tfor {\n\t\tline, _, err := stdin.ReadLine()\n\t\tif err != nil {\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif string(line) == \"quit\" {\n\t\t\tos.Exit(0)\n\t\t}\n\t\tfmt.Println(\"begin\")\n\t\tfor _, sensor := range ctx.sensors {\n\t\t\thost, errHost := sensor.HostNameFunction()\n\t\t\tif errHost != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"error during hostname function call: %s\\n\", errHost)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresource, errResource := sensor.ResourceNameFunction()\n\t\t\tif errResource != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"error during resource name function call: %s\\n\", errResource)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmeasurement, errMeasurement := sensor.MeasurementFunction()\n\t\t\tif errMeasurement != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"error during measurement function call: %s\\n\", errMeasurement)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// write load value for resource for the given host\n\t\t\tfmt.Printf(\"%s:%s:%s\\n\", host, resource, measurement)\n\t\t}\n\t\tfmt.Println(\"end\")\n\t}\n}", "title": "" }, { "docid": "f816dde208542e47579b40146bc3db1e", "score": "0.5932895", "text": "func Run(c chan darksky.ForecastResponse, dsc DarkskyConfig) {\n\tfor {\n\t\tlog.Debug(\"Start darksky loop\")\n\t\tlog.Debug(\"Calling darksky.io\")\n\t\tclient := darksky.New(dsc.DarkskyToken)\n\t\trequest := darksky.ForecastRequest{}\n\t\trequest.Latitude = darksky.Measurement(dsc.Latitude)\n\t\trequest.Longitude = darksky.Measurement(dsc.Longitude)\n\t\tforecast, err := client.Forecast(request)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Failed to get response from darksky.io\")\n\t\t\tlog.Error(err)\n\t\t} else {\n\t\t\tlog.Debug(\"Got response from darksky.io\")\n\t\t\tc <- forecast\n\t\t}\n\t\ttime.Sleep(time.Duration(dsc.PollIntervalSec*1000) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "682f0f03845d914485a0a71c31c85c9a", "score": "0.5925827", "text": "func (w Watcher) Run(stopCh <-chan struct{}) {\n\tfmt.Println(\"client/run:Running\")\n\tgo w.controller.Run(stopCh)\n}", "title": "" }, { "docid": "273c8afbc4a6dbe4a9ddacf4e6be518f", "score": "0.5910161", "text": "func startThermalCam() {\n\tfor {\n\t\tgrid = amg.ReadPixels()\n\t\ttime.Sleep(time.Duration(*refresh) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "dcb33ac3126e3240e4b740edbbc60726", "score": "0.58963245", "text": "func (rp *Reprovider) Run(tick time.Duration) {\n\t// dont reprovide immediately.\n\t// may have just started the daemon and shutting it down immediately.\n\t// probability( up another minute | uptime ) increases with uptime.\n\tafter := time.After(time.Minute)\n\tvar done doneFunc\n\tfor {\n\t\tif tick == 0 {\n\t\t\tafter = make(chan time.Time)\n\t\t}\n\n\t\tselect {\n\t\tcase <-rp.ctx.Done():\n\t\t\treturn\n\t\tcase done = <-rp.trigger:\n\t\tcase <-after:\n\t\t}\n\n\t\t//'mute' the trigger channel so when `ipfs bitswap reprovide` is called\n\t\t//a 'reprovider is already running' error is returned\n\t\tunmute := rp.muteTrigger()\n\n\t\terr := rp.Reprovide()\n\t\tif err != nil {\n\t\t\tlog.Debug(err)\n\t\t}\n\n\t\tif done != nil {\n\t\t\tdone(err)\n\t\t}\n\n\t\tunmute()\n\n\t\tafter = time.After(tick)\n\t}\n}", "title": "" }, { "docid": "c83ab8daf7eac76b3607bbb2d4ac5189", "score": "0.5865717", "text": "func (s *Server) Run() {\n\tstopChan := make(chan bool, 1)\n\tinputChan := make(chan interface{})\n\tgo s.filter(inputChan, stopChan)\n\tfor _ = range s.ticker.C {\n\t\tstopChan <- true\n\t\tstopChan = make(chan bool, 1)\n\t\tinputChan = make(chan interface{})\n\t\tgo s.filter(inputChan, stopChan)\n\t}\n}", "title": "" }, { "docid": "a8fddb91909902c5d62e5057c12761a9", "score": "0.58548975", "text": "func (c *Client) Run() (err error) {\n\t// boot\n\tif err = c.boot(); err != nil {\n\t\treturn\n\t}\n\n\t// read loop\n\tgo c.tunReadLoop()\n\t// write loop\n\tgo c.connReadLoop()\n\n\t// wait both loop done\n\t<-c.done\n\t<-c.done\n\n\treturn\n}", "title": "" }, { "docid": "0e5164c1f7f77d7c47a21fa85c90b220", "score": "0.5854713", "text": "func (c *SensorController) Run(ctx context.Context, ssThreads, jobThreads int) {\n\tdefer c.ssQueue.ShutDown()\n\tdefer c.podQueue.ShutDown()\n\n\tc.log.Infof(\"sensor controller (version: %s) (instance: %s) starting\", axis.GetVersion(), c.Config.InstanceID)\n\t_, err := c.watchControllerConfigMap(ctx)\n\tif err != nil {\n\t\tc.log.Errorf(\"failed to register watch for controller config map: %v\", err)\n\t\treturn\n\t}\n\n\tc.ssInformer = c.newSensorInformer()\n\tc.podInformer = c.newPodInformer()\n\tgo c.ssInformer.Run(ctx.Done())\n\tgo c.podInformer.Run(ctx.Done())\n\n\tfor _, informer := range []cache.SharedIndexInformer{c.ssInformer, c.podInformer} {\n\t\tif !cache.WaitForCacheSync(ctx.Done(), informer.HasSynced) {\n\t\t\tc.log.Panicf(\"timed out waiting for the caches to sync\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor i := 0; i < ssThreads; i++ {\n\t\tgo wait.Until(c.runWorker, time.Second, ctx.Done())\n\t}\n\tfor i := 0; i < jobThreads; i++ {\n\t\tgo wait.Until(c.podWorker, time.Second, ctx.Done())\n\t}\n\n\t<-ctx.Done()\n}", "title": "" }, { "docid": "9a0ef5dd53ae8ef74adbefef738ecc36", "score": "0.58377135", "text": "func (recorder *recorderSerialPort) run() {\n\tlog.Print(\"Serial Recorder running\")\n\tfor {\n\t\tselect {\n\n\t\t// Data received to record\n\t\tcase m := <-recorder.write:\n\t\t\t//log.Print(\"Got a recorder write\")\n\t\t\tif recorder.isClosing {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check if a new file should be created\n\t\t\t// 18mb max size\n\t\t\tif recorder.fileSize+len(m) >= 1048576*18 {\n\t\t\t\tloadNewFile(recorder)\n\t\t\t}\n\n\t\t\t// Record the data\n\t\t\t//log.Print(\"Record serial data\")\n\t\t\tn, err := recorder.writer.Write(m)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error writing serial data to file: %s\", err.Error())\n\t\t\t}\n\t\t\trecorder.fileSize += n\n\t\t\t//log.Printf(\"Recorded %d bytes to the file\", n)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a110658fe074e5f838b1df30a90c2d48", "score": "0.58358836", "text": "func (r *gatewayOneDotOne) Run() {\n\tr.state = RstateRunning\n\n\tgo func() {\n\t\tfor r.state == RstateRunning {\n\t\t\tr.send()\n\t\t\ttime.Sleep(time.Microsecond * 100)\n\t\t}\n\t\tr.closeTxChannels()\n\t}()\n}", "title": "" }, { "docid": "d5f3145e1947ced5c3ead5d9a3c63cb8", "score": "0.5822715", "text": "func Start(projectName string) {\n\tconst pin = 21\n\tconst timezone = \"America/Chicago\"\n\n\tsensor, err := sensor.GetInstance(pin)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn\n\t}\n\n\tclient, ctx, err := database.GetClient(projectName)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn\n\t}\n\n\tfor {\n\t\tutc := time.Now().UTC()\n\t\tlocal := utc\n\n\t\tlocation, err := time.LoadLocation(timezone)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(\"Error setting location:\", err)\n\t\t\treturn\n\t\t}\n\t\tlocal = local.In(location)\n\n\t\tdate := utc.Format(\"2006-01-02T15:04:05Z07:00\")\n\t\treadableDate := local.Format(\"Mon, 02 Jan 2006 15:04:05 MST\")\n\n\t\tisDry := true\n\t\tif sensor.Read() == 0 {\n\t\t\tisDry = false\n\t\t}\n\n\t\treference := \"log/\" + date\n\n\t\tif err := client.NewRef(reference).Set(ctx, &Reading{\n\t\t\tReadableDate: readableDate,\n\t\t\tIsDry: isDry,\n\t\t}); err != nil {\n\t\t\tlog.Fatalln(\"Error setting value:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Printf(\"Date: %v, ReadableDate: %v, IsDry: %v\", date, readableDate, isDry)\n\n\t\ttime.Sleep(6 * time.Hour)\n\t}\n}", "title": "" }, { "docid": "79db5eb499b71d1343984ccb8e1f19f1", "score": "0.5790082", "text": "func (p *Poller) Run() {\n\tgo util.Forever(func() {\n\t\te, err := p.getFunc()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"failed to list: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tp.sync(e)\n\t}, p.period)\n}", "title": "" }, { "docid": "58f48de3678d8e3873d336b130fa7bd4", "score": "0.5786529", "text": "func (r *serverFour) Run() {\n\tr.state = RstateRunning\n\n\trxcallback := func(ev EventInterface) int {\n\t\ttioevent := ev.(*TimedAnyEvent)\n\t\ttio := tioevent.GetTio()\n\t\ttio.doStage(r)\n\n\t\treturn 0\n\t}\n\n\tgo func() {\n\t\tfor r.state == RstateRunning {\n\t\t\t// recv\n\t\t\tr.receiveEnqueue()\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tr.processPendingEvents(rxcallback)\n\t\t}\n\n\t\tr.closeTxChannels()\n\t}()\n}", "title": "" }, { "docid": "e3d7d97f30bf7ba23a8471604aa2ac49", "score": "0.57845145", "text": "func (n *Ncd) Run() {\n\tn._start()\n}", "title": "" }, { "docid": "0491b2c5b9b279f1657ef398e324cba1", "score": "0.5769771", "text": "func (c *checkPointer) Run() {\n\tgo func() {\n\t\tc.logCheckPoint()\n\n\t\tfor range time.Tick(time.Minute * 60) {\n\t\t\tc.logCheckPoint()\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b684c044c0c236dd5a01b6a767fea67a", "score": "0.5760882", "text": "func (monitor *agentMonitor) Run(stopCh <-chan struct{}) {\n\tklog.Info(\"Starting Antrea Agent Monitor\")\n\tagentCRD := monitor.getAgentCRD()\n\tvar err error = nil\n\tfor {\n\t\tif agentCRD == nil {\n\t\t\tagentCRD, err = monitor.createAgentCRD()\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to create agent monitoring CRD %v : %v\", agentCRD, err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tagentCRD, err = monitor.updateAgentCRD(agentCRD)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"Failed to update agent monitoring CRD %v : %v\", agentCRD, err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(60 * time.Second)\n\t}\n\t<-stopCh\n}", "title": "" }, { "docid": "18770b82873d9faddd4ba07c428456c6", "score": "0.57597923", "text": "func (c *Controller) Run(stopChan <-chan struct{}) {\n\tticker := time.NewTicker(c.Interval)\n\tdefer ticker.Stop()\n\tfor {\n\t\terr := c.RunOnce()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\tcase <-stopChan:\n\t\t\tlog.Info(\"Terminating main controller loop\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1fd09a7d3a6d7396b2a2b1224cd8e685", "score": "0.5754786", "text": "func (dfdd *dfddImpl) run() {\n\n\tticker := common.NewTimer(stateMachineTickerInterval)\n\n\tfor {\n\t\tselect {\n\t\tcase e := <-dfdd.inputListenerCh:\n\t\t\tdfdd.handleListenerEvent(common.InputServiceName, e)\n\t\tcase e := <-dfdd.storeListenerCh:\n\t\t\tdfdd.handleListenerEvent(common.StoreServiceName, e)\n\t\tcase <-ticker.C:\n\t\t\tdfdd.handleTicker()\n\t\t\tticker.Reset(stateMachineTickerInterval)\n\t\tcase <-dfdd.shutdownC:\n\t\t\tdfdd.shutdownWG.Done()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "13c35cbd947529f4eea69b4753163a13", "score": "0.57544184", "text": "func (e *EchoTester) Run() {\n\tstart := iclock()\n\tfor e.clt.pongCount < maxCount {\n\t\ttime.Sleep(1 * time.Millisecond)\n\t\te.tickMs()\n\t}\n\te.printResult(start)\n\te.clt.SaveRtt()\n}", "title": "" }, { "docid": "2de1b121c2615ddd7ab25be7cc4d07da", "score": "0.5754394", "text": "func (r *Robot) Run() {\n\tgbot := gobot.NewGobot()\n\n\t// Set up the adapter.\n\tsa := sphero.NewSpheroAdaptor(r.Name, r.Port)\n\n\t// New sphero driver.\n\tsd := sphero.NewSpheroDriver(sa, r.Name)\n\tsd.SetStabilization(true)\n\tsd.ConfigureCollisionDetection(r.CC)\n\n\t// Channel to talk to the device.\n\ttalk := make(chan string)\n\n\t// Work function is provided to gorobot to control the robot.\n\twork := func() {\n\t\t// Tell the robot to run the pause logic on collisions.\n\t\tgobot.On(sd.Event(\"collision\"), func(data interface{}) {\n\t\t\tr.Outs++\n\t\t\tlog.Println(r.Name, \"Collision Detected - Pausing\", r.Outs)\n\n\t\t\tif r.Outs == 3 {\n\t\t\t\ttalk <- \"shutdown\"\n\t\t\t} else {\n\t\t\t\ttalk <- \"pause\"\n\t\t\t}\n\t\t})\n\n\t\t// Shutdown the game after a minute.\n\t\tgobot.After(300*time.Second, func() {\n\t\t\tlog.Println(\"GAME OVER\")\n\t\t\ttalk <- \"shutdown\"\n\t\t})\n\n\t\t// Starting up the robot.\n\t\tlog.Println(r.Name, \"Starting Robot\")\n\t\tsd.SetRGB(r.Color[0], r.Color[1], r.Color[2])\n\n\tshutdown:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase command := <-talk:\n\t\t\t\tswitch command {\n\t\t\t\t// Pause command stops the robot and turns the color red.\n\t\t\t\tcase \"pause\":\n\t\t\t\t\t//log.Println(name, \"Pausing Robot\")\n\t\t\t\t\tsd.Stop()\n\t\t\t\t\tsd.SetRGB(220, 20, 60) // Red\n\t\t\t\t\ttime.Sleep(5 * time.Second)\n\n\t\t\t\t// Shutdown command breaks from the work loop.\n\t\t\t\tcase \"shutdown\":\n\t\t\t\t\tbreak shutdown\n\t\t\t\t}\n\n\t\t\t// Every second choose a random direction and roll fast.\n\t\t\tcase <-time.After(500 * time.Millisecond):\n\t\t\t\tdirection := uint16(gobot.Rand(360))\n\t\t\t\t//log.Println(r.Name, \"Chaning Direction\", direction)\n\t\t\t\tsd.SetRGB(r.Color[0], r.Color[1], r.Color[2])\n\t\t\t\tsd.Roll(150, direction)\n\t\t\t}\n\t\t}\n\n\t\t// On shutdown stop the robot and change the color to blue.\n\t\tlog.Println(r.Name, \"Shutting Down Robot\")\n\t\tsd.Stop()\n\n\t\tfor i := 0; i < 3; i++ {\n\t\t\tsd.SetRGB(220, 20, 60) // Red\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tsd.SetRGB(r.Color[0], r.Color[1], r.Color[2])\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\n\t\tlog.Println(r.Name, \"DONE Robot\")\n\t\tr.WG.Done()\n\t}\n\n\trobot := gobot.NewRobot(\n\t\t\"sphero\",\n\t\t[]gobot.Connection{sa},\n\t\t[]gobot.Device{sd},\n\t\twork,\n\t)\n\n\tgbot.AddRobot(robot)\n\tgbot.Start()\n}", "title": "" }, { "docid": "c7cfff408dce16891638ba524d9c233f", "score": "0.5750802", "text": "func (p *Player) Run() {\n\tfor {\n\t\ttrack, err := p.pcptr.Next()\n\t\tif err != nil {\n\t\t\tlog.Infof(\"Failed to Get Track: %s\", err)\n\t\t\t<-p.channels.CheckNext // Block until we have a next track\n\t\t\tcontinue\n\t\t}\n\t\tp.play(track) // Blocks\n\t\tp.pcptr.End(track) // Publish end event\n\t}\n}", "title": "" }, { "docid": "d9f1b97862b190100177365a38209739", "score": "0.574856", "text": "func (s *GenericSync) Run() (chan struct{}, error) {\n\n\tclient, err := dynamic.NewForConfig(s.kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquit := make(chan struct{})\n\tgo s.loop(client, quit)\n\treturn quit, nil\n}", "title": "" }, { "docid": "9462a8cb29d1fd49353610c4a880a3bb", "score": "0.5745358", "text": "func (e *Executor) Run() { e.loop() }", "title": "" }, { "docid": "972adbd33c50a7acfec40df51961175a", "score": "0.5730905", "text": "func (gb *GameBoy) Run() {\n\tif err := gb.APU.Start(); err != nil {\n\t\tpanic(err)\n\t}\n\tdsTick := false\n\tfor {\n\t\tselect {\n\t\tcase _, _ = <-gb.exitChan:\n\t\t\tgb.APU.Stop()\n\t\t\treturn\n\t\tdefault:\n\t\t\tgb.Timer.Prepare()\n\t\t\tgb.CPU.Step()\n\t\t\tgb.MMU.Step()\n\t\t\tgb.Timer.Step()\n\t\t\tgb.Serial.Step()\n\t\t\tif !dsTick {\n\t\t\t\tgb.APU.Step()\n\t\t\t\tgb.PPU.Step()\n\t\t\t\tdsTick = gb.CPU.DoubleSpeed()\n\t\t\t} else {\n\t\t\t\tdsTick = false\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2487fb7ce1efe7006bec95770dea00b5", "score": "0.5726101", "text": "func (p *DirectBuy) Run() error {\n\tlog := p.log\n\tlog.Info(\"Start direct buy service...\")\n\tdefer func() {\n\t\tlog.Info(\"Closed direct buy service\")\n\t\tp.done <- struct{}{}\n\t}()\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tp.runUpdateStatus()\n\t}()\n\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "0c115be0c432612afa76091bce9a6974", "score": "0.5721955", "text": "func (h *MPU6050Driver) Start() (err error) {\n\tif err := h.initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tif _, err := h.connection.Write([]byte{MPU6050_RA_ACCEL_XOUT_H}); err != nil {\n\t\t\t\th.Publish(h.Event(Error), err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdata := make([]byte, 14)\n\t\t\t_, err := h.connection.Read(data)\n\t\t\tif err != nil {\n\t\t\t\th.Publish(h.Event(Error), err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbuf := bytes.NewBuffer(data)\n\t\t\tbinary.Read(buf, binary.BigEndian, &h.Accelerometer)\n\t\t\tbinary.Read(buf, binary.BigEndian, &h.Temperature)\n\t\t\tbinary.Read(buf, binary.BigEndian, &h.Gyroscope)\n\t\t\th.convertToCelsius()\n\t\t\ttime.Sleep(h.interval)\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "de1a9fb492323c68336d1d5d67968dfb", "score": "0.5721334", "text": "func (ra *relayAnnouncer) Run() error {\n\tra.conn = mqtt.NewClient(ra.options)\n\tif token := ra.conn.Connect(); token.Wait() {\n\t\terr := token.Error()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"1 Cog connection error: %s\", err)\n\t\t\treturn errorStartAnnouncer\n\t\t}\n\t}\n\tif token := ra.conn.Subscribe(ra.receiptTopic, 1, ra.cogReceipt); token.Wait() {\n\t\terr := token.Error()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"2 Cog connection error: %s\", err)\n\t\t\tra.conn.Disconnect(0)\n\t\t\treturn errorStartAnnouncer\n\t\t}\n\t}\n\tra.state = relayAnnouncerWaitingState\n\tgo func() {\n\t\tra.loop()\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "507d3204b991e7d6dd21f44dfda7b603", "score": "0.57187575", "text": "func (csw *ChannelStatsWatcher) Run(ctx context.Context) {\n\tflushed, unregister := csw.statser.RegisterFlush()\n\tdefer unregister()\n\n\tticker := time.NewTicker(csw.sampleInterval)\n\tdefer ticker.Stop()\n\n\tcsw.sample()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-flushed:\n\t\t\tcsw.emit()\n\t\t\tcsw.sample() // Ensure there will always be at least one sample\n\t\tcase <-ticker.C:\n\t\t\tcsw.sample()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c76f6a122d7dd658a4bc730ebded2438", "score": "0.57144487", "text": "func (s *Service) run() {\n\n\t// Create a communicator for sending and receiving packets.\n\tcommunicator := comm.NewCommunicator(s.config.PollInterval, s.config.Port)\n\tdefer communicator.Stop()\n\n\t// Create a ticker for sending pings.\n\tpingTicker := time.NewTicker(s.config.PingInterval)\n\tdefer pingTicker.Stop()\n\n\t// Create a ticker for timeout checks.\n\tpeerTicker := time.NewTicker(s.config.PeerTimeout)\n\tdefer peerTicker.Stop()\n\n\t// Create the packet that will be sent to all peers.\n\tpkt := &comm.Packet{\n\t\tID: s.config.ID,\n\t\tUserData: s.config.UserData,\n\t}\n\n\t// Continue processing events until explicitly stopped.\n\tfor {\n\t\tselect {\n\t\tcase p := <-communicator.PacketChan:\n\t\t\ts.processPacket(p)\n\t\tcase <-pingTicker.C:\n\t\t\tcommunicator.Send(pkt)\n\t\tcase <-peerTicker.C:\n\t\t\ts.processPeers()\n\t\tcase <-s.stopChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58376a0d3bf7d39e07b55876ff981742", "score": "0.57123125", "text": "func (gb *GameBoy) Run() {\n\t// Number of extra clocks consumed in the last tick.\n\tclockDebt := 0\n\n\tfor {\n\t\tselect {\n\n\t\tcase <-gb.clk.C:\n\t\t\tclockDebt = gb.RunClocks(CPUClock/BaseClock - clockDebt)\n\n\t\tcase event := <-gb.events:\n\t\t\tgb.jp.Handle(event)\n\n\t\tcase frame := <-gb.ppu.F:\n\t\t\tselect {\n\t\t\tcase gb.F <- frame:\n\t\t\tdefault:\n\t\t\t}\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32bbad790bd1ae9ed9184807925c590f", "score": "0.5698966", "text": "func (l *renderLoop) Run() {\n\truntime.LockOSThread()\n\tcubelib.Initialize()\n\n\t// Create the 3D world\n\tworld := cubelib.NewWorld()\n\tworld.SetCamera(0.0, 0.0, 5.0)\n\n\tcube := cubelib.NewCube()\n\tcube.AttachTexture(loadImage(\"marmo.png\"))\n\n\tworld.Attach(cube)\n\tangle := float32(0.0)\n\tfor {\n\t\tselect {\n\t\tcase <-l.pause:\n\t\t\tl.ticker.Stop()\n\t\t\tl.pause <- 0\n\t\tcase <-l.terminate:\n\t\t\tcubelib.Cleanup()\n\t\t\tl.terminate <- 0\n\t\tcase <-l.ticker.C:\n\t\t\tangle += 0.05\n\t\t\tcube.RotateY(angle)\n\t\t\tworld.Draw()\n\t\t\tcubelib.Swap()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f25aecc8d81bd6838ef256c39e8da9d9", "score": "0.569128", "text": "func (t *tractorBus) Start() {\n\tgo func() {\n\t\tfor {\n\t\t\tt.bus <- rand.Intn(10)\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "32ba3b9f44b2dca48b66c390b9907fb7", "score": "0.56866395", "text": "func (conn *Connection) Run() {\n\tfor {\n\t\tline, _, err := conn.incoming.ReadLine()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tconn.handleEvent(line)\n\t}\n}", "title": "" }, { "docid": "4153dd49d303691392efc5bf222b68a1", "score": "0.56836736", "text": "func (p *rpmPlugin) Run() {\n\tif p.frequency <= config.FREQ_DISABLE_SAMPLING {\n\t\trpmlog.Debug(\"Disabled.\")\n\t\treturn\n\t}\n\n\t// Subscribe to filesystem events are care about\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\trpmlog.WithError(err).Error(\"can't instantiate rpm watcher\")\n\t\tp.Unregister()\n\t\treturn\n\t}\n\n\terr = watcher.Add(\"/var/lib/rpm/.rpm.lock\")\n\tif err != nil {\n\t\t// Some old distros, like SLES 11, do not provide .rpm.lock file, but the same\n\t\t// effect can be achieved by listening some standard files from the RPM database\n\t\terr = watcher.Add(\"/var/lib/rpm/Installtid\")\n\t\tif err != nil {\n\t\t\trpmlog.WithError(err).Error(\"can't setup trigger file watcher for rpm\")\n\t\t\tp.Unregister()\n\t\t\treturn\n\t\t}\n\t}\n\n\tcounter := 1\n\tticker := time.NewTicker(1)\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-watcher.Events:\n\t\t\tif ok {\n\t\t\t\tif event.Op&fsnotify.Write == fsnotify.Write {\n\t\t\t\t\tcounter = counter + 1\n\t\t\t\t\tif counter > 1 {\n\t\t\t\t\t\trpmlog.WithFields(logrus.Fields{\n\t\t\t\t\t\t\t\"frequency\": p.frequency,\n\t\t\t\t\t\t\t\"counter\": counter,\n\t\t\t\t\t\t}).Debug(\"rpm plugin oversampling.\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trpmlog.Debug(\"rpm lock watcher closed.\")\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tticker.Stop()\n\t\t\tticker = time.NewTicker(p.frequency)\n\t\t\tif counter > 0 {\n\t\t\t\tdata, err := p.fetchPackageInfo()\n\t\t\t\tif err != nil {\n\t\t\t\t\trpmlog.WithError(err).Error(\"fetching rpm data\")\n\t\t\t\t} else {\n\t\t\t\t\tp.EmitInventory(data, entity.NewFromNameWithoutID(p.Context.EntityKey()))\n\t\t\t\t}\n\t\t\t\tcounter = 0\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a1310fd2074083d9e8059c19a4e845d", "score": "0.5683643", "text": "func (ts *TimeService) Run() {\n\tfor {\n\t\tselect {\n\t\tcase <-ts.Dead:\n\t\t\t// let's close this channel to make sure we can no longer attempt to write to it\n\t\t\tclose(ts.ReqChan)\n\t\t\treturn\n\t\tcase req := <-ts.ReqChan:\n\t\t\tprocessingTime := time.Duration(ts.AvgResponseTime+1.0-rand.Float64()) * time.Second\n\t\t\ttime.Sleep(processingTime)\n\t\t\treq.RspChan <- time.Now()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba23c9f239479cbe0a9a39342f691edc", "score": "0.56802654", "text": "func (h *EventHandler) Run() {\n\tticker := time.NewTicker(2 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tif !h.needHandle || h.isDoing {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\th.needHandle = false\n\t\t\th.isDoing = true\n\t\t\t// if has error\n\t\t\tif h.doHandle() {\n\t\t\t\th.needHandle = true\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t}\n\t\t\th.isDoing = false\n\t\tcase <-h.ctx.Done():\n\t\t\tblog.Infof(\"EventHandler for %s run loop exit\", h.lbID)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0e429893f223f37ed4496ce95edf6355", "score": "0.5678846", "text": "func (d *Data) Run() {\n\tgo func() {\n\t\tfor channelData := range d.channels {\n\t\t\tif err := d.pools.Invoke(channelData); err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(\"update data error(%s)\", err.Error()))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tfor {\n\t\t\tlog.Error(fmt.Sprintf(\"update run count(%d)\", d.pools.Running()))\n\t\t\tif d.pools.Running() <= 0 {\n\t\t\t\td.pools.Release()\n\t\t\t\td.done <- true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttime.Sleep(3 * time.Second)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "4dc898cd67e818f54d72876143dd288f", "score": "0.5676403", "text": "func (h *AutoscalersController) RunControllerLoop(stopCh <-chan struct{}) {\n\th.processingLoop(stopCh)\n}", "title": "" }, { "docid": "3f98a1f166274ba845519e186db38f53", "score": "0.5674741", "text": "func Run(deviceName string) error {\n\tkeyboard, err := uinput.CreateKeyboard(\"/dev/uinput\", []byte(\"mapper-kbd\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer keyboard.Close()\n\n\tfor {\n\t\tdevice, err := connectDevice(deviceName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts := &shutdown{time.Now(), 0}\n\n\t\tfor {\n\t\t\terr := processEvent(device, keyboard, s)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error: %v\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "711419c9eee836fe23a4db948b6796c6", "score": "0.56628156", "text": "func (d *DataNode) Run() {\n\tlog.Printf(\"datanode starts running...\\n\")\n\t// perform handshake with NameNode\n\td.handshakeWithNameNode()\n\td.registerWithNameNode()\n\td.reportBlock()\n\tgo d.reportPeriodically()\n\tgo d.serveClients()\n\tfor {\n\t\td.sendHeartBeat()\n\t\ttime.Sleep(time.Second * time.Duration(config.HeartBeatInSec))\n\t}\n}", "title": "" }, { "docid": "e336765c863462a0726048aa532d4bbb", "score": "0.5659655", "text": "func (w *WatchManager) run() {\n\tw.pollUpdatesInWasp() // initial pull from WASP\n\trunning := true\n\tfor running {\n\t\tselect {\n\t\tcase <-time.After(1 * time.Minute):\n\t\t\tw.pollUpdatesInWasp()\n\n\t\tcase <-w.stopChannel:\n\t\t\trunning = false\n\t\t}\n\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "title": "" }, { "docid": "8dceca5cdd8b373def6a0838503ccd17", "score": "0.5655745", "text": "func (w *Window) Run() {\n\tw.readEvents(w.nativeWin.EventChan())\n}", "title": "" }, { "docid": "f071989f849d6d7412b192bed6056be6", "score": "0.565223", "text": "func (transport *IRCTransport) Run() {\n\tdefer transport.cleanUp()\n\n\t// Connect to server.\n\tif err := transport.connect(); err != nil {\n\t\ttransport.log.Fatalf(\"Error creating connection: \", err)\n\t}\n\n\t// Receiver loop.\n\tgo transport.receiverLoop()\n\n\t// Semaphore clearing ticker.\n\tticker := time.NewTicker(time.Second * time.Duration(transport.antiFloodDelay))\n\tdefer ticker.Stop()\n\tgo func() {\n\t\tfor range ticker.C {\n\t\t\ttransport.resetFloodSemaphore()\n\t\t}\n\t}()\n\n\t// Main loop.\n\tfor {\n\t\tselect {\n\t\tcase msg, ok := <-transport.messages:\n\t\t\tif ok {\n\t\t\t\t// Are there any handlers registered for this IRC event?\n\t\t\t\tif handlers, exists := transport.ircEventHandlers[msg.Command]; exists {\n\t\t\t\t\tfor _, handler := range handlers {\n\t\t\t\t\t\thandler(transport, msg)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\ttransport.log.Infof(\"IRC transport exiting...\")\n}", "title": "" }, { "docid": "8da28513c01e7b0823ddd462f39dc64d", "score": "0.5643745", "text": "func (p *PerceptorService) Run() {\n\t// Create Dialer\n\td := &websocket.Dialer{\n\t\tReadBufferSize: 4096,\n\t\tWriteBufferSize: 4096,\n\t}\n\n\t// Attempt to connect to WS Service\n\tfor {\n\t\tconn, _, err := d.Dial(fmt.Sprintf(\"ws://%s\", p.addr), p.headers())\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"WS Connection Failure: %s\", err)\n\t\t\ttime.Sleep(time.Second)\n\t\t\tcontinue\n\t\t}\n\tReadLoop:\n\t\tfor {\n\t\t\tt, m, e := conn.ReadMessage()\n\t\t\t// On Error close the connection and break the loop\n\t\t\tif e != nil {\n\t\t\t\tlog.Errorf(\"WS Connection Lost: %s\", e)\n\t\t\t\tconn.Close()\n\t\t\t\tbreak ReadLoop\n\t\t\t}\n\n\t\t\tif t == websocket.TextMessage {\n\t\t\t\t// Put the message on the event channel\n\t\t\t\tlog.Debugf(\"Recived Message: %s\", m)\n\t\t\t\tp.channel <- m\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1e0308781ed3efd67f38c7a6ca6b149a", "score": "0.56411046", "text": "func (t *Uint64Tracker) Run(initialValue uint64) {\n\tt.value = initialValue\n\tt.pending = nil\n\tinputChan := make(chan inquiry, 10)\n\tt.input = inputChan\n\tgo func() {\n\t\tfor i := range inputChan {\n\t\t\tif i.Return == nil {\n\t\t\t\tt.handleSet(i.NewValue)\n\t\t\t} else {\n\t\t\t\tt.handleGet(i)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "b9e5eddeedc38399df7242c760897920", "score": "0.56381154", "text": "func (client *AMIClient) Run() {\n\tgo func() {\n\t\tfor {\n\t\t\tdata, err := readMessage(client.bufReader)\n\t\t\tif err != nil {\n\t\t\t\tswitch err {\n\t\t\t\tcase syscall.ECONNABORTED:\n\t\t\t\t\tfallthrough\n\t\t\t\tcase syscall.ECONNRESET:\n\t\t\t\t\tfallthrough\n\t\t\t\tcase syscall.ECONNREFUSED:\n\t\t\t\t\tfallthrough\n\t\t\t\tcase io.EOF:\n\t\t\t\t\tclient.NetError <- err\n\t\t\t\t\t<-client.waitNewConnection\n\t\t\t\tdefault:\n\t\t\t\t\tclient.Error <- err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ev, err := newEvent(data); err != nil {\n\t\t\t\tif err != errNotEvent {\n\t\t\t\t\tclient.Error <- err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tclient.Events <- ev\n\t\t\t}\n\n\t\t\tif response, err := newResponse(data); err == nil {\n\t\t\t\tclient.notifyResponse(response)\n\t\t\t}\n\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "7b89306521dba04cca7ce64f07860ec3", "score": "0.5635752", "text": "func (s *Syncer) Run() error {\n\tfor {\n\t\terrors := s.RunOnce()\n\t\tvar err error\n\t\tif len(errors) != 0 {\n\t\t\tif len(errors) == 1 {\n\t\t\t\terr = errors[0]\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"Errors: %v\", errors)\n\t\t\t}\n\t\t\ts.logger.WithError(err).Error(\"Failed running sync\")\n\t\t} else {\n\t\t\ts.logger.Debug(\"Updating success timestamp\")\n\t\t\ts.updateSuccessTimestamp()\n\t\t}\n\n\t\t// No poll interval configured, so return now\n\t\tif s.pollInterval == 0 {\n\t\t\ts.logger.Info(\"No poll configured\")\n\t\t\treturn err\n\t\t}\n\t\tsleep := randomize(s.pollInterval)\n\t\ts.logger.WithField(\"duration\", sleep).Info(\"Sleeping\")\n\t\ttime.Sleep(sleep)\n\t}\n}", "title": "" }, { "docid": "abc584bf60bb0f8f6cbc07f06ec714cb", "score": "0.5631471", "text": "func (r *RunloopShortCircuiter) Run() {\n\tfor !r.complated {\n\t\tnextEvent := app.NSApplication_nextEventMatchingMask_untilDate_inMode_dequeue(app.NSApp(),\n\t\t\tevent.NSAnyEventMask, // mask\n\t\t\tdate.NSDate_distantFuture(), // expiration.\n\t\t\trunloop.NSDefaultRunLoopMode, // mode.\n\t\t\ttrue, // flag\n\t\t)\n\t\tif nextEvent == 0 {\n\t\t\tbreak\n\t\t}\n\t\tapp.NSApplication_sendEvent(app.NSApp(), nextEvent)\n\t}\n\tr.complated = false\n}", "title": "" }, { "docid": "b837f4e1865479aed1402c72c30380c3", "score": "0.5626742", "text": "func (r *serverThree) Run() {\n\tr.state = RstateRunning\n\n\t// event handling is a NOP in this model\n\trxcallback := func(ev EventInterface) int {\n\t\tassert(r == ev.GetTarget())\n\t\tlog(LogV, \"rxcallback\", r.String(), ev.String())\n\n\t\trealevent, ok := ev.(*TimedUniqueEvent)\n\t\tassert(ok)\n\n\t\t// send the response\n\t\tgwysrc := ev.GetSource()\n\t\tat := clusterTripPlusRandom()\n\t\tevresponse := newTimedUniqueEvent(r, at, gwysrc, realevent.id)\n\t\tr.Send(evresponse, SmethodWait)\n\t\treturn 0\n\t}\n\n\tgo func() {\n\t\tfor r.state == RstateRunning {\n\t\t\tr.receiveEnqueue()\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tr.processPendingEvents(rxcallback)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "4aecd013426caa05e6910d8c6a72e1f9", "score": "0.5605753", "text": "func (b *Bridge) Run(ctx context.Context) {\n\tticker := time.NewTicker(b.interval)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tif err := b.Push(); err != nil && b.logger != nil {\n\t\t\t\tb.logger.Println(\"error pushing to Graphite:\", err)\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d6ad467fbbf72bcfa5a8d4748c2dd487", "score": "0.5602829", "text": "func (p *Input) Run() {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tif !p.started {\n\t\tp.log.Info(\"Starting TCP input\")\n\t\terr := p.server.Start()\n\t\tif err != nil {\n\t\t\tp.log.Errorw(\"Error starting the TCP server\", \"error\", err)\n\t\t}\n\t\tp.started = true\n\t}\n}", "title": "" }, { "docid": "3daf08cc65b289fb4986c962a3880f91", "score": "0.559843", "text": "func (m *Monitor) Start(updatesChann Updates, updateFrequency time.Duration) error {\n\tdev, err := m.fetchDevices()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func(dev []Device) {\n\t\tfor {\n\t\t\tfor _, d := range dev {\n\t\t\t\tdata, err := m.fetchRawData(d)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t}\n\n\t\t\t\t// TODO buffer already posted?\n\t\t\t\tfor _, r := range data {\n\t\t\t\t\tupdatesChann <- r\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttime.Sleep(updateFrequency)\n\n\t\t\tdev, err = m.fetchDevices()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t}\n\t\t}\n\t}(dev)\n\n\treturn nil\n}", "title": "" }, { "docid": "29f26855027f9ee4b971a99583ae9537", "score": "0.55981433", "text": "func (h *Hub) Run() {\n\tfor {\n\t\tselect {\n\t\tcase client := <-h.Register:\n\t\t\th.Clients[client] = true\n\t\tcase client := <-h.Unregister:\n\t\t\tdelete(h.Clients, client)\n\t\tcase message := <-h.BroadMsg:\n\t\t\tlogger.Info.Println(\"received from local: \", string(message.Message), \"message type:\", message.MessageType)\n\t\t\th.handleClientMessage(&message)\n\t\tcase message := <-h.ServerMsg:\n\t\t\tlogger.Info.Println(\"received from cloud: \", string(message.Message), \"message type:\", message.MessageType)\n\t\t\th.handleServerMessage(&message)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c77233b76473d11ae5bacd45deb70dec", "score": "0.5597353", "text": "func run() {\n\tlogs.Start()\n\n\t// Send all data for the centralized database\n\tgo store.push()\n\tstore.Lock()\n\tdefer store.Unlock()\n\n\t// Creating the listener\n\tconfigData := config.GetConfig()\n\twatcher(configData)\n}", "title": "" }, { "docid": "d118a6c9ff7365246cecbad42de056ee", "score": "0.55954486", "text": "func main() {\n\tgo getData()\n\tfmt.Println(\"Subscription started\")\n\tfor {\n\t\tselect {\n\t\tcase val := <-Data:\n\t\t\tprocessData(val)\n\t\tcase <-Stop:\n\t\t\tfmt.Println(\"Stop\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2b24fc3ca870b07e657c87fd3c777bab", "score": "0.55859756", "text": "func (self *WtfPush) Run() {\n\tfor {\n\t\tblob := <-self.pushch\n\t\tif self.conn == nil {\n\t\t\tconn, err := net.DialTCP(\"tcp\", nil, self.addr)\n\t\t\tif err == nil {\n\t\t\t\tself.conn = conn\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif self.conn != nil {\n\t\t\terr := SendBlob(self.conn, blob)\n\t\t\tif err != nil {\n\t\t\t\t_ = self.conn.Close()\n\t\t\t\tself.conn = nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e51d3c56ea0a44244c04cfdf3d6e0921", "score": "0.5581068", "text": "func (rhost *rhostData) run() {\n\tif rhost.teo.param.RPort > 0 {\n\t\trhost.running = true\n\t\tgo func() {\n\t\t\treconnect := 0\n\t\t\trhost.teo.wg.Add(1)\n\t\t\tfor {\n\t\t\t\taddr := rhost.teo.param.RAddr\n\t\t\t\tport := rhost.teo.param.RPort\n\t\t\t\tteolog.Connectf(MODULE, \"connecting to r-host %s:%d:%d\\n\", addr, port, 0)\n\t\t\t\trhost.tcd = rhost.teo.td.ConnectChannel(addr, port, 0)\n\t\t\t\trhost.connect()\n\t\t\t\trhost.wg.Add(1)\n\t\t\t\trhost.wg.Wait()\n\t\t\t\tif !rhost.teo.running {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treconnect++\n\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t}\n\t\t\trhost.teo.wg.Done()\n\t\t\trhost.running = false\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "01bbf0d94a470a8755749adce90031b6", "score": "0.5572139", "text": "func (p *Producer) Run() {\n\tp.wg.Add(1)\n\tdefer p.wg.Done()\n\n\tsendMsg := func(routingKey string, data []byte) {\n\t\ttimeStamp := time.Now()\n\t\terr := p.rabbitChannel.Publish(\n\t\t\tp.rabbitExchange,\n\t\t\troutingKey,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tamqp.Publishing{\n\t\t\t\tDeliveryMode: amqp.Persistent,\n\t\t\t\tTimestamp: timeStamp,\n\t\t\t\tContentType: \"text/plain\",\n\t\t\t\tBody: data,\n\t\t\t})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error publishing %s\", string(data))\n\t\t\tp.writeFailure(\n\t\t\t\tfmt.Sprintf(\"%s/%s-%d.txt\",\n\t\t\t\t\tp.failureDir,\n\t\t\t\t\troutingKey,\n\t\t\t\t\ttimeStamp.UnixNano()),\n\t\t\t\tdata)\n\t\t}\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase event := <-p.eventsChan:\n\t\t\tsendMsg(\"raw_events\", event)\n\t\tcase meter := <-p.metersChan:\n\t\t\tsendMsg(\"raw_meters\", meter)\n\t\tcase <-p.quitChan:\n\t\t\tp.rabbitChannel.Close()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "256b8b68aba380c6a1be7faaeb20c509", "score": "0.55658746", "text": "func (c *Timer) Run() {\n\t//c.active = true\n\tc.ticker = time.NewTicker(c.options.TickerInternal)\n\tc.lastTick = time.Now()\n\tif !c.started {\n\t\tc.started = true\n\t\tc.options.OnRun(true)\n\t} else {\n\t\tc.options.OnRun(false)\n\t}\n\tc.options.OnTick()\n\tfor tickAt := range c.ticker.C {\n\t\tc.passed += tickAt.Sub(c.lastTick)\n\t\tc.lastTick = time.Now()\n\t\tc.options.OnTick()\n\t\tif c.Remaining() <= 0 {\n\t\t\tc.ticker.Stop()\n\t\t\tc.options.OnDone(false)\n\t\t} else if c.Remaining() <= c.options.TickerInternal {\n\t\t\tc.ticker.Stop()\n\t\t\ttime.Sleep(c.Remaining())\n\t\t\tc.passed = c.options.Duration\n\t\t\tc.options.OnTick()\n\t\t\tc.options.OnDone(false)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3460fd7a00f03accef6446ae90332c52", "score": "0.55638254", "text": "func (fm *Fesl) Run(ctx context.Context) {\n\tfor {\n\t\tselect {\n\t\tcase event := <-fm.socket.EventChan:\n\t\t\tfm.Handle(event)\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "087bae3644e2248ebfa3b1e6882fb00d", "score": "0.55624676", "text": "func (ws *WindowSurface) Run() {\n\t// log.Println(\"Starting viewer polling\")\n\tws.running = true\n\t// var simStatus = \"\"\n\tvar frameStart time.Time\n\tvar elapsedTime float64\n\tvar loopTime float64\n\n\tsleepDelay := 0.0\n\n\t// Get a reference to SDL's internal keyboard state. It is updated\n\t// during sdl.PollEvent()\n\tkeyState := sdl.GetKeyboardState()\n\n\trasterizer := renderer.NewBresenHamRasterizer()\n\n\tsdl.SetEventFilterFunc(ws.filterEvent, nil)\n\n\tfor ws.running {\n\t\tframeStart = time.Now()\n\n\t\tsdl.PumpEvents()\n\n\t\tif keyState[sdl.SCANCODE_Z] != 0 {\n\t\t\tws.mod--\n\t\t}\n\t\tif keyState[sdl.SCANCODE_X] != 0 {\n\t\t\tws.mod++\n\t\t}\n\n\t\tws.clearDisplay()\n\n\t\tws.render(rasterizer)\n\n\t\t// This takes on average 5-7ms\n\t\t// ws.texture.Update(nil, ws.pixels.Pix, ws.pixels.Stride)\n\t\tws.texture.Update(nil, ws.rasterBuffer.Pixels().Pix, ws.rasterBuffer.Pixels().Stride)\n\t\tws.renderer.Copy(ws.texture, nil, nil)\n\n\t\tws.txtFPSLabel.DrawAt(10, 10)\n\t\tf := fmt.Sprintf(\"%2.2f\", 1.0/elapsedTime*1000.0)\n\t\tws.dynaTxt.DrawAt(ws.txtFPSLabel.Bounds.W+10, 10, f)\n\n\t\t// ws.mx, ws.my, _ = sdl.GetMouseState()\n\t\tws.txtMousePos.DrawAt(10, 25)\n\t\tf = fmt.Sprintf(\"<%d, %d>\", ws.mx, ws.my)\n\t\tws.dynaTxt.DrawAt(ws.txtMousePos.Bounds.W+10, 25, f)\n\n\t\tws.txtLoopLabel.DrawAt(10, 40)\n\t\tf = fmt.Sprintf(\"%2.2f\", loopTime)\n\t\tws.dynaTxt.DrawAt(ws.txtLoopLabel.Bounds.W+10, 40, f)\n\n\t\tws.renderer.Present()\n\n\t\t// time.Sleep(time.Millisecond * 5)\n\t\tloopTime = float64(time.Since(frameStart).Nanoseconds() / 1000000.0)\n\t\t// elapsedTime = float64(time.Since(frameStart).Seconds())\n\n\t\tsleepDelay = math.Floor(framePeriod - loopTime)\n\t\t// fmt.Printf(\"%3.5f ,%3.5f, %3.5f \\n\", framePeriod, elapsedTime, sleepDelay)\n\t\tif sleepDelay > 0 {\n\t\t\tsdl.Delay(uint32(sleepDelay))\n\t\t\telapsedTime = framePeriod\n\t\t} else {\n\t\t\telapsedTime = loopTime\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d345c573a1546a189470a44dbfc1c8f2", "score": "0.55465424", "text": "func (rm *ResourceQuotaManager) Run(period time.Duration) {\n\trm.syncTime = time.Tick(period)\n\tgo util.Forever(func() { rm.synchronize() }, period)\n}", "title": "" }, { "docid": "8ec2dab7eab3399b434f05b24f716fe1", "score": "0.5542409", "text": "func (s *keyvisualService) run() {\n\t// TODO: make the ticker consistent with heartbeat interval\n\tticker := time.NewTicker(time.Minute)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-s.ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tcluster := s.svr.GetRaftCluster()\n\t\t\tif cluster == nil || !serverapi.IsServiceAllowed(s.svr, defaultRegisterAPIGroupInfo) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts.scanRegions(cluster)\n\t\t\t// TODO: implements the stats\n\t\t}\n\t}\n}", "title": "" }, { "docid": "503267a0e3b5fd29bca2c51a8cfd684e", "score": "0.5539959", "text": "func (s *ClientState) Run() error {\n\ts.DetermineInitialMasters()\n\tdefer s.closeRedisConnections()\n\tif err := s.Connect(); err != nil {\n\t\treturn err\n\t}\n\tif err := VerifyMasterFileString(s.GetConfig().RedisMasterFile); err != nil {\n\t\treturn err\n\t}\n\tif err := s.SendClientStarted(); err != nil {\n\t\treturn err\n\t}\n\tif s.opts.ConsulClient != nil {\n\t\tvar err error\n\t\ts.configChanges, err = s.opts.ConsulClient.WatchConfig()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\ts.configChanges = make(chan consul.Env)\n\t}\n\tgo s.Reader()\n\ts.Writer()\n\treturn nil\n}", "title": "" }, { "docid": "995b153b37f80eb6c43025e3a5012a2c", "score": "0.55364794", "text": "func (c *Controller) Run(ctx context.Context) error {\n\t// Start the informer factories to begin populating the informer caches\n\tc.log.Infof(\"starting step control loop, node name: %s\", c.nodeName)\n\n\t// 初始化runner\n\tc.log.Info(\"init controller engine\")\n\tif err := engine.Init(c.wc, c.informer.Recorder()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := c.sync(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tc.waitDown(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "9bb3c3a6bf5d6351449f897b5747ce6e", "score": "0.5536473", "text": "func (b *bufferedChan) Run() {\n\tdefer close(b.OutChannel)\n\tfor value := range b.inChannel {\n\t\tselect {\n\t\tcase <-b.ctx.Done():\n\t\t\tfmt.Println(\"Run: Time to return\")\n\t\t\treturn\n\t\tcase b.OutChannel <- value:\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "e2476530ebceee4ad74f8b0a4b0d8174", "score": "0.5531131", "text": "func (c *carBus) Start() {\n\tgo func() {\n\t\tfor {\n\t\t\tc.bus <- rand.Intn(10)\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "4f4bfabe1221ddd65a99f1d3f2ac09cb", "score": "0.5528175", "text": "func (a *MockAgent) Run() {\n\tfor {\n\t\t<-a.Input // consume message to unblock Sender\n\t}\n}", "title": "" }, { "docid": "93bfdb869f3d0d593b511cd29ebc52cf", "score": "0.55246913", "text": "func (inj *Injector) Run() {\n\tinj.startTime = time.Now()\n\t//go inj.Stat.DoRun()\n\n\tfor shootAgain := bool(true); shootAgain == true; {\n\n\t\tshootAgain = inj.UpdateSpeed()\n\t\ttime.Sleep(time.Millisecond * 1000)\n\t}\n\tfmt.Printf(\"*** Test done ***\\n\")\n}", "title": "" }, { "docid": "22c4962ebc8ba7a09ef769d52cfeafbe", "score": "0.55173874", "text": "func (h *Hub) Run() {\n\th.done.Add(1)\n\tfor {\n\t\tselect {\n\t\tcase r := <-h.register:\n\t\t\tif r.event == \"add\" {\n\t\t\t\th.addSession(r.session)\n\t\t\t} else {\n\t\t\t\th.removeSession(r.session)\n\t\t\t}\n\n\t\tcase subinfo := <-h.subscribe:\n\t\t\tif subinfo.event == \"add\" {\n\t\t\t\th.subscribeSession(subinfo.session, subinfo.stream, subinfo.identifier)\n\t\t\t} else if subinfo.event == \"removeAll\" {\n\t\t\t\th.unsubscribeSessionFromChannel(subinfo.session, subinfo.identifier, false)\n\t\t\t} else {\n\t\t\t\th.unsubscribeSession(subinfo.session, subinfo.stream, subinfo.identifier)\n\t\t\t}\n\n\t\tcase message := <-h.broadcast:\n\t\t\th.broadcastToStream(message.Stream, message.Data)\n\n\t\tcase command := <-h.disconnect:\n\t\t\th.disconnectSessions(command.Identifier, command.Reconnect)\n\n\t\tcase <-h.shutdown:\n\t\t\th.done.Done()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7dedafb912cb727747f8eb372de9d8cb", "score": "0.55159366", "text": "func (ftm *FtmBridge) run() {\n\tftm.wg.Add(1)\n\tgo ftm.observeBlocks()\n}", "title": "" }, { "docid": "7eb158ef178232de82bb2f0a1e67c889", "score": "0.5510581", "text": "func Run() {\n\tgo listen()\n}", "title": "" }, { "docid": "a0ff55523f3d614aae1e3b530ea60340", "score": "0.55103284", "text": "func (ip *Interpreter) Run() {\n\t// initialise stop channel\n\tip.stopch = make(chan struct{})\n\n\t// load sprites\n\tip.loadSprites()\n\n\t// start sound and delay timers\n\tip.stget, ip.stset, ip.ststop = newTimer()\n\tip.dtget, ip.dtset, ip.dtstop = newTimer()\n\n\t// set PC to program start address\n\tip.pc = memoryOffsetProgram\n\n\tcurrentTime := time.Now()\n\tvar accum time.Duration\n\n\tticker := time.NewTicker(TimestepBatch)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase newTime := <-ticker.C:\n\t\t\tframeTime := newTime.Sub(currentTime)\n\t\t\tcurrentTime = newTime\n\t\t\taccum += frameTime\n\t\t\tfor accum >= TimestepSimulation {\n\t\t\t\tip.step()\n\t\t\t\taccum -= TimestepSimulation\n\t\t\t}\n\t\tcase <-ip.stopch:\n\t\t\t// stop delay and sound timers\n\t\t\tip.ststop <- struct{}{}\n\t\t\tip.dtstop <- struct{}{}\n\t\t\tclose(ip.displaych)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]