text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *Credentials) Remove(username string) {
delete(c.whitelist, username)
} | [
-0.8226357698440552,
0.12767361104488373,
0.03691442310810089,
-0.2857881486415863,
-0.9737706780433655,
0.13871073722839355,
0.13200950622558594,
1.2450844049453735,
0.3139397203922272,
0.4795873761177063,
-0.8801538944244385,
0.6021760106086731,
-1.4839210510253906,
0.7166281938552856,
... |
func (c *Credentials) IsAuthorised(token string) bool {
_, ok := c.whitelist[token]
return ok
} | [
-0.6093475222587585,
-0.03933320939540863,
0.3549186587333679,
-0.7766696214675903,
0.12373605370521545,
-0.378935843706131,
-0.5979719758033752,
0.47440633177757263,
0.4718818664550781,
0.8221068382263184,
-0.038411639630794525,
1.0623924732208252,
-0.8759669661521912,
0.42709121108055115... |
func (db Database) GetItems() (*models.ItemList, error) {
list := &models.ItemList{}
rows, err := db.Conn.Query("SELECT * FROM items ORDER BY created_at desc;")
if err != nil {
return list, err
}
for rows.Next() {
var item models.Item
if err = rows.Scan(
&item.ID,
&item.Name,
&item.Description,
... | [
-0.4677077531814575,
0.358319491147995,
0.2741447389125824,
0.5106229186058044,
1.1866614818572998,
0.31264394521713257,
-0.9965754747390747,
-0.2766706049442291,
-0.5577521324157715,
-0.5171738862991333,
-0.34707340598106384,
0.04153084754943848,
0.3492725193500519,
0.5133252739906311,
... |
func (db Database) NewItem(item *models.Item) error {
var id string
var createdAt time.Time
query := `INSERT INTO items (name, description) VALUES ($1, $2) RETURNING id, created_at;`
if err := db.Conn.QueryRow(query, item.Name, item.Description).Scan(&id, &createdAt); err != nil {
return nil
}
item.ID = id
... | [
-0.4760896563529968,
0.7221798896789551,
0.27589088678359985,
0.2935169041156769,
0.4467715620994568,
1.0241022109985352,
-0.04642036184668541,
-0.29250264167785645,
-0.7161889672279358,
-0.365654319524765,
-0.6794828176498413,
-0.38269656896591187,
-0.01584561914205551,
0.8414722681045532... |
func (db Database) SearchItemByID(itemID string) (models.Item, error) {
item := models.Item{}
query := `SELECT * FROM items WHERE id = $1;`
row := db.Conn.QueryRow(query, itemID)
switch err := row.Scan(&item.ID, &item.Name, &item.Description, &item.Creation); err {
case sql.ErrNoRows:
return item, ErrNoMatch
... | [
-0.12041390687227249,
0.30079957842826843,
0.17545445263385773,
0.502226710319519,
0.4077090620994568,
0.06792588531970978,
-1.153199315071106,
-1.3031370639801025,
-0.4902496039867401,
-0.032885290682315826,
-0.4869711101055145,
-0.5704498291015625,
-0.35194459557533264,
0.448435783386230... |
func (db Database) DeleteItem(itemID string) error {
query := `DELETE FROM items WHERE id = $1;`
_, err := db.Conn.Exec(query, itemID)
switch err {
case sql.ErrNoRows:
return ErrNoMatch
default:
return err
}
} | [
-0.4064616560935974,
0.7166541218757629,
0.23312291502952576,
0.4394628405570984,
0.7321406006813049,
0.6453740000724792,
0.002466969657689333,
-0.06116881221532822,
0.08684134483337402,
-0.28090572357177734,
0.022443298250436783,
-0.33584606647491455,
-0.27940812706947327,
0.4419381916522... |
func (db Database) UpdateItem(itemID string, itemData models.Item) (models.Item, error) {
item := models.Item{}
query := `UPDATE items SET name=$1, description=$2 WHERE id=$3 RETURNING id, name, description, created_at;`
if err := db.Conn.QueryRow(
query, itemData.Name, itemData.Description, itemID,
).Scan(
&i... | [
-0.6772369742393494,
-0.425575315952301,
0.13808871805667877,
0.332621693611145,
0.008242912590503693,
0.9737820029258728,
-0.7406216859817505,
-0.0647408664226532,
-0.48634615540504456,
0.11343760788440704,
-0.35268041491508484,
0.05245477333664894,
0.05463825911283493,
-0.079037852585315... |
func (p *FakePeer) Identifier() string {
return string(p.id)
} | [
-0.38536882400512695,
-0.5453567504882812,
0.05654638260602951,
-1.101369857788086,
-0.2607336640357971,
1.410862922668457,
-0.15503063797950745,
0.8010603785514832,
0.8504031896591187,
-0.007366476114839315,
-0.5741156339645386,
-0.006449932232499123,
-0.8031220436096191,
-0.1749490946531... |
func (p *FakePeer) Status() peer.Status {
return peer.Status{
ConnectionStatus: peer.Available,
PendingRequestCount: 0,
}
} | [
-0.7548612952232361,
-1.2351266145706177,
0.08159758895635605,
-0.9418740272521973,
-0.3190959393978119,
0.6860994100570679,
-0.9970904588699341,
1.0243968963623047,
0.2548699676990509,
-0.17250868678092957,
-0.40982186794281006,
-0.08135147392749786,
-0.7158280611038208,
0.917618811130523... |
func Call(ctx context.Context, prefix string, fn func() error, lateFn func(error)) error {
buildErr := func(e error) error {
return fmt.Errorf("%v: %v", prefix, e)
}
var d = struct {
sync.Mutex
fn struct {
done bool
err error
}
ctxDone bool
}{}
// run fn in go routine
ctx2, cancel := context.Wi... | [
0.3441081941127777,
0.2853545844554901,
1.1112054586410522,
-0.25353407859802246,
-1.0609911680221558,
0.12560229003429413,
-1.2246222496032715,
0.24447523057460785,
0.4524334967136383,
-0.22496305406093597,
0.5416387319564819,
0.31107252836227417,
0.22268640995025635,
-0.7154179811477661,... |
func (s SSHAuthKeys) Name() string {
return authKeysFilename
} | [
-0.696326494216919,
-0.6572765707969666,
0.40217798948287964,
0.029983412474393845,
-0.9676278233528137,
0.23065072298049927,
0.02104094810783863,
0.19899621605873108,
-0.10659827291965485,
1.1144871711730957,
-0.7175657153129578,
0.6181460022926331,
0.26771169900894165,
0.4541749656200409... |
func (s SSHAuthKeys) Label() string {
return ""
} | [
-0.37734517455101013,
-0.1373416781425476,
0.260988712310791,
-0.379987508058548,
0.16233520209789276,
1.3733059167861938,
-0.6427618265151978,
0.17139145731925964,
1.1631067991256714,
0.4227721095085144,
0.23324620723724365,
0.5421090126037598,
-0.8474492430686951,
0.19234950840473175,
... |
func (s SSHAuthKeys) Type() string {
return SSHAuthKeysTypename
} | [
-0.7786111235618591,
-0.015157739631831646,
0.15169578790664673,
-0.2573981285095215,
-0.06307537108659744,
0.6155989766120911,
-0.4601109027862549,
-0.3888859152793884,
1.1111698150634766,
0.7623556852340698,
-0.1700671911239624,
0.7762452363967896,
-0.28853416442871094,
0.709087729454040... |
func (s SSHAuthKeys) String() string {
return fmt.Sprintf("%s with keys: %s", authKeysFilename, s.Keys)
} | [
-0.19438312947750092,
-0.8802332878112793,
0.20240673422813416,
-1.3059086799621582,
-0.65857994556427,
0.0417129248380661,
-0.2890225052833557,
-0.08643656224012375,
-0.4651913046836853,
0.7974309325218201,
0.02040548250079155,
1.2951030731201172,
0.019755033776164055,
-0.1487386524677276... |
func (c *SSHAuthKeysConfigurator) Create(ctx context.Context, item depgraph.Item) error {
return c.writeSSHAuthKeys(item.(SSHAuthKeys).Keys)
} | [
-0.9942833185195923,
0.609032154083252,
0.10619771480560303,
-0.0898299291729927,
0.36006176471710205,
-0.024009039625525475,
-0.10346521437168121,
-0.16988803446292877,
0.30284383893013,
0.6226468086242676,
-0.4653279483318329,
-0.4728841185569763,
0.3262850046157837,
0.23207956552505493,... |
func (c *SSHAuthKeysConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error) {
return c.writeSSHAuthKeys(newItem.(SSHAuthKeys).Keys)
} | [
-2.278707504272461,
0.42344173789024353,
0.34830382466316223,
0.21956190466880798,
0.10168136656284332,
0.11452114582061768,
-0.48027539253234863,
0.35205256938934326,
1.0698376893997192,
0.686421275138855,
0.13841299712657928,
0.08742990344762802,
-0.19023455679416656,
0.00190329190809279... |
func (c *SSHAuthKeysConfigurator) Delete(ctx context.Context, item depgraph.Item) error {
return c.writeSSHAuthKeys("")
} | [
-0.49597716331481934,
0.8860899209976196,
0.1676221638917923,
0.288849413394928,
0.454306036233902,
0.12137770652770996,
0.6204990744590759,
0.5072426795959473,
0.9423009157180786,
0.7831708192825317,
-0.6796184182167053,
0.11729846149682999,
-0.18186262249946594,
-0.4764094948768616,
0.... |
func (c *SSHAuthKeysConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool) {
return false
} | [
-1.8730969429016113,
0.5723746418952942,
0.39904242753982544,
0.07109993696212769,
0.23302002251148224,
-0.19672460854053497,
-0.8760840892791748,
0.2564857006072998,
-0.23007269203662872,
-0.40285295248031616,
-0.6536844372749329,
0.11025210469961166,
0.11802024394273758,
0.20817634463310... |
func Status() error {
doc := `Usage:
calicoctl node status
Description:
Display the status of the Calico node`
// Note: This call is ignoring the error because error check happens at the level above
// i.e at `node.go` before it calls `node.Status`. This call is just so help message gets
// printed for this opt... | [
0.4884869158267975,
-0.45849382877349854,
0.6005733609199524,
-0.12226936221122742,
0.5384552478790283,
0.472784161567688,
-0.05681154504418373,
0.14758718013763428,
-0.8585770130157471,
0.2601523995399475,
0.284968763589859,
1.0057841539382935,
-0.15180394053459167,
0.7137725353240967,
... |
func NomalConnect(broker string, number int) []MQTT.Client {
var clients []MQTT.Client
for index := 0; index < number; index++ {
prosessID := strconv.FormatInt(int64(os.Getpid()), 16)
clientID := fmt.Sprintf("%s-%d", prosessID, index)
opts := MQTT.NewClientOptions()
opts.AddBroker(broker)
opts.SetClientID(c... | [
-0.18154387176036835,
-0.8441520929336548,
0.8574031591415405,
-0.479101300239563,
-0.3223407566547394,
-0.09963719546794891,
-0.8382984399795532,
-1.0809454917907715,
-0.48474013805389404,
0.8284852504730225,
-0.08770961314439774,
-0.40693074464797974,
-0.5476879477500916,
0.2577451467514... |
func printSummary(results []time.Duration) {
max := results[0]
min := results[0]
var sum time.Duration
for _, r := range results {
if r < min {
min = r
}
if r > max {
max = r
}
sum += r
}
avg := int(sum) / len(results)
fmt.Println("avg: ", avg, "max:", max.Nanoseconds(), "min: ", min.Nanoseconds(... | [
-0.3490779995918274,
0.34201744198799133,
0.6954448223114014,
0.039871904999017715,
0.24457906186580658,
0.2108222097158432,
0.1986590325832367,
-0.6819905638694763,
-0.0677584782242775,
0.666339635848999,
0.12299171090126038,
1.1541850566864014,
0.2678678035736084,
0.5129559636116028,
-... |
func (mp *JoinMultiplicity) JoinFiltersDoNotDuplicateLeftRows() bool {
return mp.LeftMultiplicity&MultiplicityNotDuplicatedVal != 0
} | [
-0.21763493120670319,
0.4758787453174591,
0.6201643943786621,
0.3492731750011444,
0.03415456414222717,
1.1572827100753784,
-0.20975910127162933,
-0.21668259799480438,
0.15153750777244568,
-0.09815698862075806,
-0.5780984163284302,
-0.753096342086792,
-0.8858397603034973,
1.932024359703064,... |
func (mp *JoinMultiplicity) JoinFiltersDoNotDuplicateRightRows() bool {
return mp.RightMultiplicity&MultiplicityNotDuplicatedVal != 0
} | [
-0.7825459241867065,
0.8337847590446472,
0.8227335810661316,
0.9817377924919128,
-0.4045470952987671,
0.6676055788993835,
0.10117701441049576,
-0.4161936938762665,
-0.3205468952655792,
-0.16976779699325562,
-0.10203893482685089,
-0.6465708017349243,
-1.2452765703201294,
1.7644683122634888,... |
func (mp *JoinMultiplicity) JoinFiltersMatchAllLeftRows() bool {
return mp.LeftMultiplicity&MultiplicityPreservedVal != 0
} | [
0.7959924936294556,
-0.40890660881996155,
0.6377476453781128,
0.8890020251274109,
-0.6834178566932678,
0.3456532061100006,
-0.8099531531333923,
0.8075286149978638,
0.7239828705787659,
0.10205961763858795,
0.11080862581729889,
-1.1074095964431763,
-0.9452276229858398,
1.9764940738677979,
... |
func (mp *JoinMultiplicity) JoinFiltersMatchAllRightRows() bool {
return mp.RightMultiplicity&MultiplicityPreservedVal != 0
} | [
0.09327571839094162,
-0.183924600481987,
0.8762033581733704,
1.4018607139587402,
-1.3031387329101562,
-0.09266498684883118,
-0.5615131855010986,
0.6910493969917297,
0.2965434193611145,
0.0010414051357656717,
0.2714991569519043,
-0.962459921836853,
-1.1939523220062256,
1.7260496616363525,
... |
func (mp *JoinMultiplicity) JoinDoesNotDuplicateLeftRows(op opt.Operator) bool {
switch op {
case opt.InnerJoinOp, opt.LeftJoinOp, opt.FullJoinOp:
break
case opt.SemiJoinOp:
return true
default:
panic(errors.AssertionFailedf("unsupported operator: %v", op))
}
return mp.JoinFiltersDoNotDuplicateLeftRows()
... | [
-0.22376497089862823,
0.2244366854429245,
0.6454925537109375,
0.8509054183959961,
0.33685585856437683,
0.9564394354820251,
-0.05073213949799538,
-0.08533935248851776,
1.0147969722747803,
0.2137576788663864,
-1.0312191247940063,
-0.974614679813385,
-0.8274564743041992,
1.2538689374923706,
... |
func (mp *JoinMultiplicity) JoinDoesNotDuplicateRightRows(op opt.Operator) bool {
switch op {
case opt.InnerJoinOp, opt.LeftJoinOp, opt.FullJoinOp:
break
case opt.SemiJoinOp:
panic(errors.AssertionFailedf("right rows are not included in the output of a %v", op))
default:
panic(errors.AssertionFailedf("unsup... | [
-0.3493659198284149,
0.48838919401168823,
0.7171792984008789,
1.2637226581573486,
-0.12212219089269638,
0.5952540040016174,
0.4174460768699646,
-0.39161041378974915,
0.6650703549385071,
0.25159910321235657,
-0.4420669674873352,
-0.8687881231307983,
-1.1286537647247314,
0.962700366973877,
... |
func (mp *JoinMultiplicity) JoinPreservesLeftRows(op opt.Operator) bool {
switch op {
case opt.InnerJoinOp, opt.SemiJoinOp:
break
case opt.LeftJoinOp, opt.FullJoinOp:
return true
default:
panic(errors.AssertionFailedf("unsupported operator: %v", op))
}
return mp.JoinFiltersMatchAllLeftRows()
} | [
-0.06168822571635246,
0.13149701058864594,
0.7469595074653625,
0.76605224609375,
-0.16215623915195465,
0.23185567557811737,
-0.5280998945236206,
1.2229033708572388,
1.0072661638259888,
0.4194257855415344,
-0.559323251247406,
-1.339367151260376,
-0.9624540209770203,
0.7355700135231018,
-0... |
func (mp *JoinMultiplicity) JoinPreservesRightRows(op opt.Operator) bool {
switch op {
case opt.InnerJoinOp, opt.LeftJoinOp:
break
case opt.FullJoinOp:
return true
case opt.SemiJoinOp:
panic(errors.AssertionFailedf("right rows are not included in the output of a %v", op))
default:
panic(errors.Assertion... | [
-0.23631909489631653,
0.32275763154029846,
0.7679814100265503,
1.1067487001419067,
-0.7574939131736755,
0.041535213589668274,
-0.18254970014095306,
1.0027070045471191,
0.7421483397483826,
0.35784465074539185,
-0.14782437682151794,
-1.3276675939559937,
-1.2565497159957886,
0.560119092464447... |
func (mp *JoinMultiplicity) Format(op opt.Operator) string {
switch op {
case opt.InnerJoinOp, opt.LeftJoinOp, opt.FullJoinOp, opt.SemiJoinOp:
default:
panic(errors.AssertionFailedf("unsupported operator: %v", op))
}
if !mp.isInteresting(op) {
return ""
}
var buf bytes.Buffer
const zeroOrMore = "zero-or-... | [
-0.19845463335514069,
-0.1554470956325531,
0.7502918839454651,
0.391946017742157,
-0.2367260903120041,
-0.003713138634338975,
0.5698634386062622,
-0.10953956842422485,
0.69222491979599,
-0.0273980014026165,
0.2217106819152832,
-0.8972938656806946,
-0.11396509408950806,
0.3076302111148834,
... |
func (mp *JoinMultiplicity) String() string {
return mp.Format(opt.InnerJoinOp)
} | [
-0.16478927433490753,
-1.1851036548614502,
0.447014182806015,
0.3570978045463562,
-0.20029866695404053,
1.1327085494995117,
-0.23122572898864746,
0.03567035496234894,
0.20926722884178162,
0.024823831394314766,
0.8682126998901367,
-0.3061666786670685,
-1.5343586206436157,
-0.735717535018920... |
func (mp *JoinMultiplicity) isInteresting(op opt.Operator) bool {
switch op {
case opt.InnerJoinOp:
return mp.JoinFiltersDoNotDuplicateLeftRows() || mp.JoinFiltersDoNotDuplicateRightRows() ||
mp.JoinFiltersMatchAllLeftRows() || mp.JoinFiltersMatchAllRightRows()
case opt.LeftJoinOp:
return mp.JoinFiltersDoNot... | [
-0.5380505919456482,
0.5719290971755981,
1.0177252292633057,
0.38348472118377686,
-0.3016324043273926,
0.21543161571025848,
0.36295703053474426,
-0.1859627366065979,
0.8543607592582703,
0.05634510889649391,
-0.28290802240371704,
-0.48589658737182617,
-1.0257035493850708,
-0.032174441963434... |
func (r *TtyRenderer) outputIndentation(w io.Writer) {
i := 0
for i < (r.indentationLevel * r.tabSize) {
w.Write([]byte(" "))
i++
}
} | [
-0.8745399117469788,
-0.1233205795288086,
0.35539892315864563,
-1.0205309391021729,
-0.2988145351409912,
-0.6053091883659363,
1.0872975587844849,
-0.7149088978767395,
-0.7901223301887512,
0.92978835105896,
0.11612329632043839,
-0.6533023118972778,
-0.5808484554290771,
0.3900655508041382,
... |
func splitFileFunction(data []byte, atEOF bool) (advanceBy int, block []byte, err error) {
if atEOF && len(data) == 0 {
return 0, nil, nil
}
if atEOF {
return len(data), data, nil
}
index := strings.Index(string(data), "\n\n")
if index != -1 {
return index + 1, data[0:index], nil
}
return
} | [
-0.298519104719162,
-0.11822264641523361,
0.610370934009552,
-0.3744966983795166,
-0.6729336380958557,
-0.988213062286377,
0.5149006843566895,
0.8807024359703064,
-0.34544989466667175,
0.17022326588630676,
-0.4198702573776245,
0.3786466419696808,
-0.18402013182640076,
0.2317759394645691,
... |
func BlobHash(data []byte) SHA256 {
return SumSHA256(data)
} | [
1.7443591356277466,
-1.0419315099716187,
0.2865165174007416,
-0.24617958068847656,
-0.15838660299777985,
0.34916988015174866,
-0.39922046661376953,
-0.2841798961162567,
0.7244517207145691,
0.818648636341095,
-0.7758657932281494,
0.28121471405029297,
0.0346374548971653,
0.08044404536485672,... |
func (d *Daemon) NewBlobReplicator(channel uint16, callback BlobCallback) *BlobReplicator {
br := BlobReplicator{
Channel: channel,
BlobMap: make(map[SHA256]Blob),
BlobCallback: callback,
//RequestManager : requestManager
d: d,
}
br.RequestManager = NewRequestManager(NewRequestManagerConfig())
... | [
-0.25414443016052246,
0.008910780772566795,
0.5893168449401855,
-0.7529352903366089,
-0.5609347224235535,
-0.447701632976532,
-0.9742943644523621,
0.13464871048927307,
1.0206269025802612,
-0.23124463856220245,
-0.6326841115951538,
-0.1642439365386963,
-1.2046725749969482,
0.842902183532714... |
func (self *BlobReplicator) TickRequests() {
self.RequestManager.RemoveExpiredRequests()
var requests map[string]([]SHA256) = self.RequestManager.GenerateRequests()
for addr, hashList := range requests {
for _, hash := range hashList {
self.SendRequest(hash, addr)
}
}
} | [
-0.2522974908351898,
0.34535834193229675,
0.39872798323631287,
0.174468994140625,
0.5399623513221741,
-0.22863523662090302,
-0.0996953621506691,
0.3183515965938568,
-0.28244736790657043,
0.35342544317245483,
-0.1313612014055252,
-0.4256795346736908,
-0.5401375889778137,
0.862197756767273,
... |
func (self *BlobReplicator) SendRequest(hash SHA256, addr string) {
m := self.NewGetBlobMessage(hash)
c := self.d.Pool.Pool.Addresses[addr]
if c == nil {
log.Panic("ERROR: Address does not exist")
}
self.d.Pool.Pool.SendMessage(c, m)
} | [
-0.19984614849090576,
0.35137176513671875,
0.4773416519165039,
0.01757877692580223,
0.6932840347290039,
-0.35072216391563416,
-0.03689606860280037,
-0.14976546168327332,
0.4430171847343445,
0.678778350353241,
0.1540280282497406,
0.9360021948814392,
-0.6012533903121948,
0.41072559356689453,... |
func (self *BlobReplicator) CompleteRequest(hash SHA256, addr string) {
self.RequestManager.RequestFinished(hash, addr)
} | [
0.2695876657962799,
-0.6015860438346863,
0.35072061419487,
-0.13807669281959534,
0.18999403715133667,
-0.32469937205314636,
0.09624480456113815,
0.19130584597587585,
0.3451751470565796,
0.5821475386619568,
-0.32266366481781006,
-0.245504230260849,
-0.278064489364624,
0.4987817704677582,
... |
func (self *BlobReplicator) InjectBlob(data []byte) error {
fmt.Printf("InjectBlob: %s \n", BlobHash(data).Hex())
blob := NewBlob(data)
if _, ok := self.BlobMap[blob.Hash]; ok == true {
log.Printf("InjectBlob, Warning, fail, duplicate, %s \n", blob.Hash.Hex())
return errors.New("InjectBlob, fail, duplicate")
}... | [
0.3132043480873108,
0.4690144956111908,
1.016226053237915,
0.5206823348999023,
-0.05118937790393829,
1.4017208814620972,
0.33362868428230286,
0.4810733199119568,
0.42289742827415466,
0.3612273931503296,
-0.7074368596076965,
0.13095328211784363,
-1.2490102052688599,
1.042155146598816,
1.0... |
func (self *BlobReplicator) AddIgnoreHash(hash SHA256) error {
if self.HasBlob(hash) == true {
return errors.New("IgnoreHash, blob is replicated, handle condition")
}
if self.IsIgnored(hash) == true {
return errors.New("IgnoreHash, hash is already ignored, handle condition\n")
}
currentTime := uint32(time.N... | [
0.3201732039451599,
-0.267488956451416,
0.8053498268127441,
0.00912199541926384,
0.02762785367667675,
0.8782790899276733,
0.2007853239774704,
0.5887221097946167,
-0.027882833033800125,
0.5047913193702698,
-0.9237028360366821,
-0.5081675052642822,
-1.059604525566101,
0.6374465227127075,
1... |
func (self *BlobReplicator) HasBlob(hash SHA256) bool {
_, ok := self.BlobMap[hash]
return ok
} | [
0.4170517325401306,
-0.3461090922355652,
0.7068887948989868,
0.4344457983970642,
0.16779382526874542,
0.07763595134019852,
0.04717430844902992,
0.7736682891845703,
0.3309222161769867,
-0.3582271337509155,
-1.1016654968261719,
-1.134939432144165,
-0.8550219535827637,
1.1144671440124512,
-... |
func (self *BlobReplicator) FilterHashList(hashList []SHA256) []SHA256 {
var list []SHA256
for _, hash := range hashList {
if self.HasBlob(hash) == false && self.IsIgnored(hash) == false {
list = append(list, hash)
}
}
return list
} | [
0.3250707983970642,
-0.4457412362098694,
0.6644162535667419,
0.5460536479949951,
-0.7507306933403015,
0.699672520160675,
-0.6555672287940979,
0.4426742494106293,
-0.006667830981314182,
1.181300401687622,
-0.967866063117981,
-0.4113970696926117,
-1.204276204109192,
0.8005654215812683,
0.5... |
func (self *BlobDataMessage) Handle(mc *gnet.MessageContext,
daemon interface{}) error {
self.c = mc
return daemon.(*Daemon).recordMessageEvent(self, mc)
} | [
0.8184985518455505,
0.05357604846358299,
0.42313703894615173,
-0.3788948655128479,
1.3987542390823364,
0.3525077998638153,
-0.17598401010036469,
-0.910102128982544,
-0.27417632937431335,
-0.5610675811767578,
-0.17661243677139282,
0.6335292458534241,
-1.1156837940216064,
0.7005733847618103,... |
func (self *BlobDataMessage) Process(d *Daemon) {
//route to channel
br := d.GetBlobReplicator(self.Channel)
if br == nil {
log.Panic("BlobDataMessage, Process blob replicator channel does not exist\n ")
}
br.CompleteRequest(BlobHash(self.Data), self.c.Conn.Addr())
//BlobHash(
br.InjectBlob(self.Data)
} | [
0.8080228567123413,
-0.3275376558303833,
0.5979334712028503,
-1.2441632747650146,
1.3139803409576416,
0.484934002161026,
-0.6696799397468567,
-0.1810729056596756,
0.247494637966156,
0.34847232699394226,
-0.19055567681789398,
0.8328074812889099,
-0.28337740898132324,
0.5217652916908264,
1... |
func (self *AnnounceBlobsMessage) Handle(mc *gnet.MessageContext,
daemon interface{}) error {
self.c = mc
return daemon.(*Daemon).recordMessageEvent(self, mc)
} | [
0.8170368075370789,
0.19898585975170135,
0.45936083793640137,
-0.006378317251801491,
0.9752464294433594,
0.48059964179992676,
0.14728699624538422,
-0.866773247718811,
-0.21504700183868408,
-0.49062925577163696,
-0.054224513471126556,
0.5483670234680176,
-1.3658013343811035,
1.2617679834365... |
func New() *Server {
ws := &Server{}
ws.controls = make([]control.Control, 0)
ws.middleware = make([]middle.Handler, 0)
ws.staticFiles = make(map[string]string)
ws.router = mux.NewRouter()
http.Handle("/", ws.router)
return ws
} | [
-0.8115912079811096,
-1.3788036108016968,
0.4426720142364502,
-0.08637259900569916,
-0.06645932048559189,
0.462227463722229,
0.11862652748823166,
-0.35390472412109375,
-0.20210689306259155,
-0.5186447501182556,
-0.5799588561058044,
0.8466933965682983,
-0.08267469704151154,
1.21750581264495... |
func (ws *Server) AddControl(c control.Control) {
ws.controls = append(ws.controls, c)
} | [
0.2572503387928009,
0.9268956780433655,
0.3496406078338623,
0.09573548287153244,
0.39803045988082886,
1.2059625387191772,
-0.7007437348365784,
-0.8267443180084229,
1.1392371654510498,
-0.6873567700386047,
-1.1243687868118286,
0.5102834701538086,
-0.6575747728347778,
0.9294832348823547,
0... |
func (ws *Server) AddGlobalMiddleware(m middle.Handler) {
ws.middleware = append(ws.middleware, m)
} | [
-0.5848997235298157,
0.30393606424331665,
0.4952702224254608,
0.23739424347877502,
-0.5229112505912781,
1.338608741760254,
-0.48191094398498535,
0.3286249339580536,
0.48013028502464294,
0.2716851234436035,
-0.45457854866981506,
0.8313202261924744,
-1.405674934387207,
1.753333330154419,
-... |
func (ws *Server) AddStaticDirectory(endpoint string, path string) {
ws.staticFiles[endpoint] = path
} | [
-0.7497931718826294,
-0.4699529707431793,
0.5755732655525208,
0.1992589682340622,
-0.1422078162431717,
-0.03810068219900131,
-0.16235166788101196,
-0.09404066950082779,
0.30763739347457886,
-0.5320761203765869,
-0.6936926245689392,
0.8671820759773254,
-0.04468212276697159,
0.57947605848312... |
func (ws *Server) Start() {
ws.setupServer()
ws.addRoutesForControls()
ws.addRoutesForStaticFiles()
fmt.Printf("Listening on %v...\n", ws.server.Addr)
ws.server.ListenAndServe()
} | [
-0.42291873693466187,
-1.1535369157791138,
0.4624369442462921,
-0.25984400510787964,
0.5328205823898315,
0.1688796877861023,
0.3420906960964203,
0.7988395690917969,
-0.33002811670303345,
-0.23571543395519257,
-0.552708089351654,
1.3126580715179443,
0.09313143044710159,
0.8800275325775146,
... |
func ExpandAssets() {
dir, err := util.AssetDir("file")
if err != nil {
log.Fatal(err)
}
for _, fname := range dir {
if fname == "message-ja.txt" || fname == "message-en.txt" {
continue
}
fnameDisk := path.Join(cfg.FileDir, fname)
fnameDisk = filepath.FromSlash(fnameDisk)
if util.IsFile(fnameDisk) {
... | [
0.0261092372238636,
0.4465687572956085,
1.0078204870224,
-0.2296317219734192,
0.030222076922655106,
0.2514757215976715,
1.328944444656372,
-0.09444427490234375,
-0.2956450879573822,
-0.5122877955436707,
1.0378119945526123,
-0.3253186345100403,
0.3791879415512085,
0.8856317400932312,
-0.4... |
func SetLogger(printLog, isSilent bool) {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
l := &lumberjack.Logger{
Filename: path.Join(cfg.LogDir, "gou.log"),
MaxSize: 5, // megabytes
MaxBackups: 10,
MaxAge: 28, //days
}
switch {
case isSilent:
fmt.Println("logging is discarded")
log.Set... | [
-0.028330137953162193,
0.0838499441742897,
0.7294490337371826,
0.056304480880498886,
-0.30781203508377075,
0.5690269470214844,
-0.4011493921279907,
0.670314371585846,
0.0378769226372242,
-0.7117305397987366,
0.3890441358089447,
0.00516620185226202,
-0.10043445974588394,
1.713836431503296,
... |
func SetupDirectories() {
for _, j := range []string{cfg.RunDir, cfg.LogDir} {
if !util.IsDir(j) {
err := os.MkdirAll(j, 0755)
if err != nil {
log.Fatal(err)
}
}
}
} | [
-0.47071680426597595,
0.5022547245025635,
0.5794593095779419,
0.09928242117166519,
0.5602007508277893,
0.15851356089115143,
1.2060611248016357,
-0.19968679547309875,
0.5708317160606384,
-0.3953525424003601,
0.2291797399520874,
-0.41136816143989563,
-0.14974993467330933,
1.2906421422958374,... |
func Upload(ctx context.Context, p string, userID int, data io.Reader) error {
var err error
if p, err = validatePath(p); err != nil {
return err
}
// identify the source and query that
sources, err := getSourcesForUser(ctx, userID)
if err != nil {
return err
}
splitPath := strings.Split(p, "/")
for _, s... | [
-0.3058933913707733,
0.08816950768232346,
0.60214763879776,
-0.06657293438911438,
-0.4914676249027252,
-0.09897597879171371,
0.32970210909843445,
-0.049894124269485474,
-0.011181735433638096,
-0.18104547262191772,
0.5877745747566223,
-0.13089703023433685,
-0.9368627667427063,
0.06264691054... |
func parseFieldParameters(str string) (params fieldParameters) {} | [
-0.4695073962211609,
-0.07529985159635544,
0.059001632034778595,
-0.29313257336616516,
-0.37632593512535095,
-0.5333288311958313,
0.10715683549642563,
0.049508385360240936,
-0.5241875648498535,
0.39654669165611267,
-0.7877176403999329,
-0.23692263662815094,
-1.1276359558105469,
0.095503687... |
func AddManagementKubeconfigFlags(kubeconfig, kubecontext *string, flags *pflag.FlagSet) {
flags.StringVar(kubeconfig, "kubeconfig", "", "path to the kubeconfig from which the management cluster will be accessed")
flags.StringVar(kubecontext, "kubecontext", "", "name of the kubeconfig context to use for the managemen... | [
-0.028990214690566063,
0.23583415150642395,
0.759920060634613,
-0.10113580524921417,
0.7105892896652222,
0.7730758786201477,
-1.209917426109314,
-0.41159307956695557,
-0.40532585978507996,
-0.1457977294921875,
0.3962138593196869,
0.7774467468261719,
-1.22540283203125,
1.1357316970825195,
... |
func (Token) Fields() []ent.Field {
return []ent.Field{
field.UUID("id", uuid.UUID{}).
Immutable(),
field.String("name").
MinLen(1).
MaxLen(64).
NotEmpty(),
field.String("secret").
NotEmpty().
MinLen(40).
MaxLen(80).
Sensitive(),
field.Enum("permissions").
Immutable().
Values("Rea... | [
-0.9351881742477417,
0.25735360383987427,
0.2748006284236908,
-1.4055982828140259,
0.5876407027244568,
0.049594808369874954,
-1.4237616062164307,
-0.5153276920318604,
0.1785186529159546,
0.18353351950645447,
-0.5845943093299866,
-0.24222733080387115,
0.08269720524549484,
-0.402374446392059... |
func (Token) Edges() []ent.Edge {
return []ent.Edge{
edge.From("user", User.Type).
Ref("tokens").
Unique().
Required(),
}
} | [
-0.5093225836753845,
-0.25930845737457275,
0.21677514910697937,
-0.3246922791004181,
0.4975703954696655,
0.4716654419898987,
-1.4632065296173096,
0.27965041995048523,
0.5590839385986328,
0.1183847188949585,
-0.0057721007615327835,
1.0358268022537231,
-0.01219312846660614,
-0.21280339360237... |
func (avisess *AviSession) PostMultipartWafAppSignatureObjectRequest(fileLocPtr *os.File, uri string, tenant string, fileParams map[string]string) error {
url := avisess.prefix + "/api/wafapplicationsignatureprovider/" + uri
return avisess.restMultipartFileObjectUploadRequest("POST", fileLocPtr, url, nil, 0, tenant, ... | [
-0.748066246509552,
-0.3181205689907074,
0.469953328371048,
0.438990980386734,
-0.26256150007247925,
0.44669651985168457,
-0.08143475651741028,
0.6769391894340515,
-0.5045145750045776,
0.26911067962646484,
-1.0493758916854858,
-1.0091997385025024,
-0.05508127808570862,
0.36902371048927307,... |
func (avisess *AviSession) PostMultipartFileObjectRequest(fileLocPtr *os.File, tenant string, fileParams map[string]string) error {
url := avisess.prefix + "/api/fileobject/upload"
return avisess.restMultipartFileObjectUploadRequest("POST", fileLocPtr, url, nil, 0, tenant, fileParams)
} | [
-0.41442009806632996,
-0.8077695965766907,
0.7109400629997253,
0.22688329219818115,
-0.11918003112077713,
0.31128719449043274,
-0.2703952491283417,
-0.0028491278644651175,
-0.9065084457397461,
0.05581793561577797,
-0.5989586114883423,
-0.7180232405662537,
-0.1595243364572525,
-0.0558347851... |
func (avisess *AviSession) restMultipartFileObjectUploadRequest(verb string, filePathPtr *os.File, url string,
lastErr error, retryNum int, tenant string, fileParams map[string]string) error {
if errorResult := avisess.checkRetryForSleep(retryNum, verb, url, lastErr); errorResult != nil {
return errorResult
}
if... | [
-0.4809896647930145,
-0.317245215177536,
1.0261948108673096,
0.26483672857284546,
0.08847248554229736,
-0.05599370226264,
-0.08447928726673126,
-0.33061644434928894,
-0.6737069487571716,
0.17172269523143768,
0.15160416066646576,
-0.6418516039848328,
-0.6177797913551331,
-0.1041925176978111... |
func NewAviSession(host string, username string, options ...func(*AviSession) error) (*AviSession, error) {
if flag.Parsed() == false {
flag.Parse()
}
avisess := &AviSession{
host: host,
username: username,
}
avisess.sessionid = ""
avisess.csrfToken = ""
avisess.prefix = "https://" + avisess.host + "/"... | [
0.050550732761621475,
-0.16576194763183594,
0.9112903475761414,
0.6315307021141052,
0.24478840827941895,
0.25840333104133606,
-0.3958558738231659,
-0.5013290047645569,
0.5068774223327637,
0.9529287815093994,
-0.8174611330032349,
0.07420690357685089,
-0.11587784439325333,
-0.524486899375915... |
func SetPassword(password string) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setPassword(password)
}
} | [
-0.2823566198348999,
0.06429940462112427,
0.5155339241027832,
1.7285525798797607,
-0.49023550748825073,
-0.3018433153629303,
0.5247821807861328,
-0.3587720990180969,
1.6592494249343872,
0.9379159808158875,
-0.29328250885009766,
0.361997127532959,
0.8751546740531921,
-0.12638135254383087,
... |
func SetVersion(version string) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setVersion(version)
}
} | [
-0.6579797267913818,
-0.3832244873046875,
0.3177343010902405,
1.7567481994628906,
-0.28962063789367676,
-0.07990829646587372,
0.5715137720108032,
-0.19541384279727936,
1.4552541971206665,
1.0410475730895996,
-1.2839007377624512,
-0.24304644763469696,
0.40852487087249756,
-0.221524879336357... |
func SetAuthToken(authToken string) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setAuthToken(authToken)
}
} | [
-0.5937113761901855,
-0.5093027949333191,
0.40310731530189514,
0.39303603768348694,
-0.13622035086154938,
-0.17822159826755524,
0.6551821827888489,
-0.19283540546894073,
1.266921043395996,
-0.21687647700309753,
-1.224395990371704,
1.0951435565948486,
0.9832626581192017,
-0.0084153506904840... |
func SetRefreshAuthTokenCallback(f func() string) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setRefreshAuthTokenCallback(f)
}
} | [
0.1893431395292282,
-0.08399418741464615,
0.38729536533355713,
0.38421177864074707,
-0.3674461543560028,
-0.3031826615333557,
0.5041673183441162,
-0.948599100112915,
1.0210689306259155,
-0.0045908475294709206,
-0.7553812265396118,
0.10446161031723022,
2.1246867179870605,
0.0029687434434890... |
func SetRefreshAuthTokenCallbackV2(f func() (string, error)) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setRefreshAuthTokenCallbackV2(f)
}
} | [
-0.3248662054538727,
-0.8562348484992981,
0.2312084287405014,
0.44789832830429077,
-0.7561218738555908,
-0.6263083219528198,
-0.040744561702013016,
-0.838766872882843,
0.49234411120414734,
0.07375369220972061,
-0.8442724943161011,
0.8056197166442871,
1.5927631855010986,
0.5149300694465637,... |
func SetTenant(tenant string) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setTenant(tenant)
}
} | [
-0.1595716029405594,
-0.3308652341365814,
0.31438785791397095,
0.48284053802490234,
-0.8918160796165466,
-0.33066439628601074,
0.29773300886154175,
-0.7047368288040161,
1.1810309886932373,
0.5484838485717773,
-0.8077821135520935,
0.3824506402015686,
0.47411391139030457,
-0.8107373714447021... |
func SetInsecure(avisess *AviSession) error {
avisess.insecure = true
return nil
} | [
-0.10956545919179916,
0.195958212018013,
0.5140259265899658,
1.144456386566162,
0.4409775137901306,
0.13417519629001617,
-0.6839671730995178,
-0.9801852703094482,
0.2850286066532135,
0.2523099482059479,
-1.050950527191162,
0.8613482713699341,
0.04941219836473465,
-0.19849155843257904,
0.... |
func SetControllerStatusCheckLimits(numRetries, retryInterval int) func(*AviSession) error {
return func(avisess *AviSession) error {
if numRetries <= 0 || retryInterval <= 0 {
return errors.New("Retry count and retry interval should be greater than zero")
}
avisess.ctrlStatusCheckRetryCount = numRetries
av... | [
0.7185213565826416,
-0.34065359830856323,
0.2671382427215576,
0.6345845460891724,
0.4578374922275543,
0.9590798020362854,
-0.012945571914315224,
0.5439220070838928,
0.25976309180259705,
-0.6256396174430847,
-0.6466830372810364,
0.10216154903173447,
-0.06097794696688652,
0.35681039094924927... |
func SetTransport(transport *http.Transport) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setTransport(transport)
}
} | [
-0.6465356945991516,
-0.09165602177381516,
0.4272811710834503,
0.886050283908844,
0.09347576647996902,
-0.24723342061042786,
0.6202399134635925,
-1.244291067123413,
1.6072804927825928,
-0.2576066255569458,
-1.1153836250305176,
0.30876967310905457,
0.915329098701477,
-0.2047921121120453,
... |
func SetClient(client HttpClient) func(*AviSession) error {
return func(sess *AviSession) error {
return sess.setClient(client)
}
} | [
-0.6333414912223816,
-0.1080409437417984,
0.34069761633872986,
0.5876118540763855,
-0.6026778817176819,
-0.011107848957180977,
0.5900064706802368,
-0.928341269493103,
1.4112896919250488,
0.534864604473114,
-0.4787246882915497,
0.8516080975532532,
0.8098838925361633,
-0.7279502153396606,
... |
func (avisess *AviSession) collectCookiesFromResp(resp *http.Response) {
// collect cookies from the resp
avisess.cookiesCollectLock.Lock()
defer avisess.cookiesCollectLock.Unlock()
var csrfToken string
var sessionID string
for _, cookie := range resp.Cookies() {
if cookie.Name == "csrftoken" {
csrfToken = ... | [
0.37058696150779724,
-1.6952223777770996,
0.17554894089698792,
0.7742238640785217,
0.2777148187160492,
-0.5413113832473755,
-0.3710985481739044,
-0.28882378339767456,
1.216253399848938,
0.5238385796546936,
-0.051260411739349365,
-0.018361812457442284,
0.4027368128299713,
0.7027134895324707... |
func (avisess *AviSession) RestRequest(verb string, uri string, payload interface{}, tenant string, lastError error,
retryNum ...int) (*http.Response, error) {
return avisess.restRequest(verb, uri, payload, tenant, nil)
} | [
0.16567885875701904,
0.1873622089624405,
0.5128345489501953,
0.4119621813297272,
0.025960996747016907,
-0.48971569538116455,
-0.47731417417526245,
0.3122493624687195,
0.733113169670105,
0.033413760364055634,
0.7612860798835754,
0.9558849334716797,
-0.20685537159442902,
-1.1563782691955566,... |
func (avisess *AviSession) restRequest(verb string, uri string, payload interface{}, tenant string, lastError error,
retryNum ...int) (*http.Response, error) {
url := avisess.prefix + uri
// If optional retryNum arg is provided, then count which retry number this is
retry := 0
if len(retryNum) > 0 {
retry = retr... | [
-0.025873027741909027,
-0.1417400985956192,
1.002848505973816,
0.3980667293071747,
-0.19094166159629822,
-0.5330894589424133,
-0.36663609743118286,
-0.48361676931381226,
1.1649134159088135,
0.43994012475013733,
0.8901201486587524,
0.8635985851287842,
-0.05361352115869522,
-0.41181954741477... |
func (avisess *AviSession) fetchBody(verb, uri string, resp *http.Response) (result []byte, err error) {
url := avisess.prefix + uri
errorResult := AviError{HttpStatusCode: resp.StatusCode, Verb: verb, Url: url}
if resp.StatusCode == 204 {
// no content in the response
return result, nil
}
// It cannot be ass... | [
0.12944504618644714,
-0.9272834062576294,
0.8835717439651489,
0.25351664423942566,
-0.29892170429229736,
-0.7602131962776184,
-0.6548870801925659,
-0.5362653136253357,
1.0910786390304565,
0.45650288462638855,
0.6958869099617004,
0.0750674456357956,
-0.11705942451953888,
0.03865540772676468... |
func (avisess *AviSession) restMultipartUploadRequest(verb string, uri string, file_path_ptr *os.File, tenant string, lastErr error,
retryNum ...int) error {
url := avisess.prefix + "/api/fileservice/" + uri
// If optional retryNum arg is provided, then count which retry number this is
retry := 0
if len(retryNum)... | [
-0.4399392306804657,
-0.354690819978714,
1.0436081886291504,
0.36358487606048584,
-0.12640245258808136,
-0.31458353996276855,
-0.22671927511692047,
-0.3049103617668152,
-0.08365004509687424,
-0.0557686947286129,
0.44992583990097046,
0.07220083475112915,
-0.7350010871887207,
0.2926052510738... |
func (avisess *AviSession) restMultipartDownloadRequest(verb string, uri string, file_path_ptr *os.File, tenant string, lastErr error, retryNum ...int) error {
url := avisess.prefix + "/api/fileservice/" + uri
// If optional retryNum arg is provided, then count which retry number this is
retry := 0
if len(retryNum... | [
-0.47069495916366577,
-0.268963098526001,
0.9393820762634277,
0.4270201027393341,
-0.6101066470146179,
-0.6856098771095276,
-0.39046987891197205,
-0.5296186804771423,
0.3041693866252899,
0.22628137469291687,
0.6475779414176941,
0.6076536774635315,
-0.7935653328895569,
0.0674574077129364,
... |
func (avisess *AviSession) CheckControllerStatus() (bool, *http.Response, error) {
url := avisess.prefix + "/api/cluster/status"
var isControllerUp bool
for round := 0; round < avisess.ctrlStatusCheckRetryCount; round++ {
checkReq, err := http.NewRequest("GET", url, nil)
if err != nil {
glog.Errorf("CheckCont... | [
-0.6330424547195435,
-0.1766396462917328,
0.8063853979110718,
0.022988025099039078,
0.5331087112426758,
0.25311464071273804,
0.00794076919555664,
-0.10372001677751541,
0.36895546317100525,
0.6376712918281555,
-0.21300369501113892,
0.12402274459600449,
-0.701970100402832,
0.2342459708452224... |
func getMinTimeDuration(durationFirst, durationSecond time.Duration) time.Duration {
if durationFirst <= durationSecond {
return durationFirst
}
return durationSecond
} | [
0.5355345010757446,
-0.7709872126579285,
0.5565035343170166,
0.554095447063446,
-1.0884660482406616,
-0.14260338246822357,
-0.28248628973960876,
-1.4707585573196411,
-0.6479083299636841,
0.03997059911489487,
0.08727966248989105,
0.8890771865844727,
0.062414977699518204,
0.8814657330513,
... |
func (avisess *AviSession) Get(uri string, response interface{}, options ...ApiOptionsParams) error {
return avisess.restRequestInterfaceResponse("GET", uri, nil, response, options...)
} | [
-0.7696688175201416,
-0.09865567088127136,
0.553253173828125,
0.0843476951122284,
0.4923582971096039,
-0.7312436103820801,
0.009435589425265789,
-0.9252907633781433,
1.0102263689041138,
0.27054938673973083,
0.23726779222488403,
0.4893125593662262,
-0.7312217950820923,
-1.2045843601226807,
... |
func (avisess *AviSession) Post(uri string, payload interface{}, response interface{}, options ...ApiOptionsParams) error {
return avisess.restRequestInterfaceResponse("POST", uri, payload, response, options...)
} | [
-0.23968516290187836,
0.05820392444729805,
0.40767526626586914,
0.48358845710754395,
0.12760546803474426,
-0.15737631916999817,
-0.012954753823578358,
-1.1041605472564697,
0.7170851826667786,
-0.3709379732608795,
0.29299473762512207,
-0.5680646896362305,
-0.9361593723297119,
-0.69567286968... |
func (avisess *AviSession) Put(uri string, payload interface{}, response interface{}, options ...ApiOptionsParams) error {
return avisess.restRequestInterfaceResponse("PUT", uri, payload, response, options...)
} | [
-0.5036290287971497,
-0.07946556806564331,
0.40026581287384033,
-0.32923752069473267,
0.19467943906784058,
-0.07249724864959717,
0.4140942394733429,
-0.9336119890213013,
0.8089771270751953,
0.40530654788017273,
0.23267576098442078,
0.12897902727127075,
-1.007189393043518,
-1.23553097248077... |
func (avisess *AviSession) Patch(uri string, payload interface{}, patchOp string, response interface{}, options ...ApiOptionsParams) error {
var patchPayload = make(map[string]interface{})
patchPayload[patchOp] = payload
glog.Infof(" PATCH OP %v data %v", patchOp, payload)
return avisess.restRequestInterfaceRespons... | [
-0.43325817584991455,
-0.12336929142475128,
0.4842855930328369,
-0.08828664571046829,
-0.5697008967399597,
0.2990536093711853,
0.10234560072422028,
-0.4282580018043518,
1.1404645442962646,
0.23021849989891052,
0.37565964460372925,
0.2302607148885727,
-0.4532879590988159,
-0.890510797500610... |
func (avisess *AviSession) Delete(uri string, params ...interface{}) error {
var payload, response interface{}
if len(params) > 0 {
payload = params[0]
if len(params) == 2 {
response = params[1]
}
}
return avisess.restRequestInterfaceResponse("DELETE", uri, payload, response)
} | [
-0.5375455617904663,
0.14806340634822845,
0.7398233413696289,
0.8027222752571106,
0.5174939036369324,
-0.22047112882137299,
0.3494728207588196,
-0.6541929244995117,
0.9822880625724792,
0.8241851329803467,
0.672850489616394,
0.2716650068759918,
-0.9922663569450378,
-0.5539231896400452,
-0... |
func (avisess *AviSession) GetCollectionRaw(uri string, options ...ApiOptionsParams) (AviCollectionResult, error) {
var result AviCollectionResult
opts, err := getOptions(options)
if err != nil {
return result, err
}
if len(opts.params) != 0 {
uri = updateUri(uri, opts)
}
httpResponse, rerror := avisess.rest... | [
-1.007788062095642,
0.36840468645095825,
1.2577747106552124,
0.3654301166534424,
-0.25600630044937134,
-0.4888025224208832,
-0.34438014030456543,
-1.0292589664459229,
0.5539798140525818,
-0.18341471254825592,
0.5328352451324463,
0.3674076795578003,
0.0846974104642868,
-0.2202286571264267,
... |
func (avisess *AviSession) GetCollection(uri string, objList interface{}, options ...ApiOptionsParams) error {
result, err := avisess.GetCollectionRaw(uri, options...)
if err != nil {
return err
}
if result.Count == 0 {
return nil
}
return json.Unmarshal(result.Results, &objList)
} | [
-1.384734034538269,
0.06417827308177948,
0.7882910370826721,
0.8152875304222107,
0.49602577090263367,
-0.7240706086158752,
-0.5250076055526733,
-0.9137245416641235,
0.19802770018577576,
0.9021569490432739,
-0.02024533413350582,
0.04006190225481987,
-0.1089913472533226,
0.0100336829200387,
... |
func (avisess *AviSession) GetRaw(uri string, options ...ApiOptionsParams) ([]byte, error) {
opts, err := getOptions(options)
if err != nil {
return nil, err
}
if len(opts.params) != 0 {
uri = updateUri(uri, opts)
}
resp, rerror := avisess.restRequest("GET", uri, nil, opts.tenant, nil)
if rerror != nil || re... | [
-0.676241934299469,
1.1558449268341064,
1.3106297254562378,
0.5534791946411133,
-0.5079025626182556,
-0.047530777752399445,
-0.9118666648864746,
-0.997772753238678,
1.005589485168457,
-0.17723745107650757,
0.7638565301895142,
1.3632527589797974,
-0.0869135707616806,
-0.4760269224643707,
... |
func (avisess *AviSession) PostRaw(uri string, payload interface{}, options ...ApiOptionsParams) ([]byte, error) {
opts, err := getOptions(options)
if err != nil {
return nil, err
}
if len(opts.params) != 0 {
uri = updateUri(uri, opts)
}
resp, rerror := avisess.restRequest("POST", uri, payload, opts.tenant, n... | [
-0.8659372925758362,
0.9197961091995239,
1.3435580730438232,
0.07717827707529068,
-1.0238665342330933,
0.31073153018951416,
-0.9697669148445129,
-0.5682604908943176,
0.4633905291557312,
-0.45870107412338257,
0.3667760193347931,
0.3108520209789276,
-0.2547971308231354,
-0.08216680586338043,... |
func (avisess *AviSession) PutRaw(uri string, payload interface{}, options ...ApiOptionsParams) ([]byte, error) {
opts, err := getOptions(options)
if err != nil {
return nil, err
}
if len(opts.params) != 0 {
uri = updateUri(uri, opts)
}
resp, rerror := avisess.restRequest("PUT", uri, payload, opts.tenant, nil... | [
-1.0137853622436523,
1.1703462600708008,
1.3364123106002808,
-0.21678024530410767,
-0.8319989442825317,
0.3556309640407562,
-0.736682653427124,
-0.7174696922302246,
0.568015456199646,
0.09239315986633301,
0.6714071035385132,
0.5830073356628418,
-0.3215307295322418,
-0.5188435316085815,
-... |
func (avisess *AviSession) GetMultipartRaw(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error {
opts, err := getOptions(options)
if err != nil {
return err
}
return avisess.restMultipartDownloadRequest("GET", uri, file_loc_ptr, opts.tenant, nil)
} | [
-0.3605940341949463,
0.2424207627773285,
0.9292946457862854,
-0.10670523345470428,
-0.4620341360569,
-0.6399177312850952,
-1.0881415605545044,
-0.140700101852417,
0.1140189915895462,
-0.43711626529693604,
0.31292420625686646,
0.6805173754692078,
0.03836576268076897,
0.10282818228006363,
... |
func (avisess *AviSession) PostMultipartRequest(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error {
opts, err := getOptions(options)
if err != nil {
return err
}
return avisess.restMultipartUploadRequest("POST", uri, file_loc_ptr, opts.tenant, nil)
} | [
-0.6513734459877014,
-0.3920750617980957,
0.7328395843505859,
0.07817055284976959,
-0.40163302421569824,
-0.4422278106212616,
0.05889572575688362,
-0.15932835638523102,
0.012181869708001614,
0.3844783306121826,
-0.15508651733398438,
0.13873030245304108,
-0.7462963461875916,
0.3912170231342... |
func (avisess *AviSession) GetUri(obj string, options ...ApiOptionsParams) (string, error) {
opts, err := getOptions(options)
if err != nil {
return "", err
}
if opts.result == nil {
return "", errors.New("reference to result provided")
}
if opts.name == "" {
return "", errors.New("Name not specified")
}
... | [
-1.1576493978500366,
0.21344900131225586,
1.1338574886322021,
0.5885422825813293,
-0.3649628758430481,
-0.45083528757095337,
0.11781030148267746,
0.16836324334144592,
0.5387253761291504,
0.3616428077220917,
-0.09940391778945923,
-0.15634587407112122,
-0.5702667832374573,
-0.461281031370162... |
func (avisess *AviSession) DeleteObject(uri string, options ...ApiOptionsParams) error {
opts, err := getOptions(options)
if err != nil {
return err
}
return avisess.restRequestInterfaceResponse("DELETE", uri, opts.payload, opts.result, options...)
} | [
-0.527188777923584,
-0.22861050069332123,
0.944309413433075,
0.38576143980026245,
0.214175745844841,
-0.20847591757774353,
0.3898615837097168,
-0.7738169431686401,
0.6505709886550903,
0.09602010250091553,
-0.08716028928756714,
0.3082900643348694,
-0.48072218894958496,
-0.6783963441848755,
... |
func (avisess *AviSession) GetObject(obj string, options ...ApiOptionsParams) error {
opts, err := getOptions(options)
uri, err := avisess.GetUri(obj, options...)
if err != nil {
return err
}
res, err := avisess.GetCollectionRaw(uri, options...)
if err != nil {
return err
}
if strings.Contains(uri, "cluster... | [
-1.057342290878296,
-0.08611027896404266,
0.9444196224212646,
0.31139811873435974,
-0.09423764050006866,
-0.4588510990142822,
0.14492662250995636,
-1.4869370460510254,
0.376371830701828,
0.763354480266571,
-0.10669761151075363,
0.33026760816574097,
-0.3659878075122833,
-0.7109814286231995,... |
func (avisess *AviSession) GetObjectByName(obj string, name string, result interface{}, options ...ApiOptionsParams) error {
opts, err := getOptions(options)
if err != nil {
return err
}
return avisess.GetObject(obj, SetName(name), SetResult(result), SetOptTenant(opts.tenant))
} | [
-0.5581957101821899,
-0.008463610894978046,
0.6650357842445374,
0.8427053093910217,
-0.31940385699272156,
-0.4996497929096222,
0.27833282947540283,
-1.4621751308441162,
0.13529174029827118,
0.9604141712188721,
-0.9357536435127258,
-0.11787699908018112,
-0.2676652669906616,
-1.1073368787765... |
func (avisess *AviSession) GetControllerVersion() (string, error) {
var resp interface{}
err := avisess.Get("/api/initial-data", &resp)
if err != nil {
return "", err
}
version := resp.(map[string]interface{})["version"].(map[string]interface{})["Version"].(string)
return version, nil
} | [
0.008829943835735321,
-0.817253589630127,
0.5392975807189941,
0.3660062551498413,
0.5931460857391357,
-0.07854173332452774,
0.38982194662094116,
-0.5398264527320862,
-0.23152171075344086,
0.6123713850975037,
-0.8900946974754333,
0.6611344814300537,
-0.1831570267677307,
0.702018141746521,
... |
func (avisess *AviSession) Logout() error {
url := avisess.prefix + "logout"
req, _ := avisess.newAviRequest("POST", url, nil, avisess.tenant)
_, err := avisess.client.Do(req)
if err != nil {
return err
}
return nil
} | [
-0.26276883482933044,
0.6066615581512451,
0.4814267158508301,
0.07127644121646881,
0.40010866522789,
0.03198036551475525,
-0.950670599937439,
-0.1374434232711792,
0.96517014503479,
0.8415187001228333,
0.20007027685642242,
1.0589916706085205,
0.36124828457832336,
-0.8102675676345825,
0.67... |
func keyForTemplate(namespace, tmplName string) string {
return namespace + "/" + tmplName
} | [
-0.6615459322929382,
-0.3412166237831116,
0.2816482484340668,
-1.5994101762771606,
-0.32166144251823425,
-0.136816143989563,
-0.6435760855674744,
0.15572790801525116,
-0.5752913355827332,
0.07481656968593597,
-0.4930418133735657,
-0.48548486828804016,
0.4960497319698334,
0.7019014358520508... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.